-
Notifications
You must be signed in to change notification settings - Fork 33
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: support managing non primary jobs and gangs
* feat: support managing not primary jobs and gangs * fixes after testing * fix indentation * cleanup the query
- Loading branch information
Showing
4 changed files
with
62 additions
and
120 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,18 +1,8 @@ | ||
---@alias GroupType 'gang' | 'job' | ||
|
||
---Fetches DB Player Entities by Group | ||
---@param name string | ||
---@param type GroupType | ||
---@return table[] | ||
function FetchPlayerEntitiesByGroup(name, type) | ||
local chars = {} | ||
local result = MySQL.query.await("SELECT citizenid, charinfo, gang, job FROM `players` WHERE JSON_VALUE("..type..", '$.name') = ?", {name}) | ||
for i = 1, #result do | ||
chars[i] = result[i] | ||
chars[i].charinfo = json.decode(result[i].charinfo) | ||
chars[i].job = result[i].job and json.decode(result[i].job) | ||
chars[i].gang = result[i].gang and json.decode(result[i].gang) | ||
end | ||
|
||
return chars | ||
---@return {citizenid: string, grade: integer}[] | ||
function FetchPlayersInGroup(name, type) | ||
return MySQL.query.await("SELECT citizenid, grade FROM player_groups WHERE `group` = ? AND `type` = ?", {name, type}) | ||
end |