Skip to content

Commit

Permalink
Merge branch 'main' of github.com:AndrewR3K/feather-core
Browse files Browse the repository at this point in the history
  • Loading branch information
AndrewR3K committed Feb 4, 2024
2 parents c722c27 + 35f6a60 commit 4cc04bc
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 9 deletions.
14 changes: 9 additions & 5 deletions server/controllers/characters.lua
Original file line number Diff line number Diff line change
@@ -1,14 +1,16 @@
CharacterController = {}

function CharacterController.CreateCharacter(userID, roleID, firstname, lastname, dob, dollars, gold, tokens, xp, x, y, z, lang,clothing,attributes)
function CharacterController.CreateCharacter(userID, roleID, firstname, lastname, model, dob, img, dollars, gold, tokens, xp, x, y, z, lang, clothing, attributes, desc)
return MySQL.query.await(
"INSERT INTO characters (user_id, role_id, first_name, last_name, dob, dollars, gold, xp, tokens, x, y, z, lang,clothing,attributes) VALUES (@userid, @roleid, @firstname, @lastname, @dob, @dollars, @gold, @tokens, @xp, @x, @y, @z, @lang,@clothing,@attributes)",
"INSERT INTO characters (user_id, role_id, first_name, last_name,model, dob, img, dollars, gold, tokens, xp, x, y, z, lang, clothing, attributes, description, dead) VALUES (@userid, @roleid, @firstname, @lastname, @model, @dob, @img, @dollars, @gold, @tokens, @xp, @x, @y, @z, @lang, @clothing, @attributes, @description, @dead)",
{
['userid'] = userID,
['roleid'] = roleID,
['firstname'] = firstname,
['lastname'] = lastname,
['model'] = model,
['dob'] = dob,
['img'] = img,
['dollars'] = dollars,
['gold'] = gold,
['tokens'] = tokens,
Expand All @@ -18,7 +20,9 @@ function CharacterController.CreateCharacter(userID, roleID, firstname, lastname
['z'] = z,
['lang'] = lang,
['clothing'] = clothing,
['attributes'] = attributes
['attributes'] = attributes,
['description'] = desc,
['dead'] = 0
})
end

Expand Down Expand Up @@ -47,7 +51,7 @@ function CharacterController.UpdateCharacter(character)
--TODO: Make this update dynamic so its not a hard defined list of elelments to update.

MySQL.query.await(
"UPDATE characters SET first_name = @firstname, last_name = @lastname, dob = @dob, dollars = @dollars, gold = @gold, tokens = @tokens, xp = @xp, x = @x, y = @y, z = @z, dead = @dead, lang = @lang, clothing = @clothing, attributes = @attributes WHERE id = @id",
"UPDATE characters SET first_name = @firstname, last_name = @lastname, dob = @dob, dollars = @dollars, gold = @gold, tokens = @tokens, xp = @xp, x = @x, y = @y, z = @z, dead = @dead, clothing = @clothing, attributes = @attributes, lang = @lang WHERE id = @id",
{
['firstname'] = character.first_name,
['lastname'] = character.last_name,
Expand All @@ -61,8 +65,8 @@ function CharacterController.UpdateCharacter(character)
['z'] = character.z,
['lang'] = character.lang,
['id'] = character.id,
['attributes'] = character.attributes,
['clothing'] = character.clothing,
['attributes'] = character.attributes,
['dead'] = character.dead
})

Expand Down
7 changes: 3 additions & 4 deletions server/services/character.lua
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,8 @@ function CharacterAPI.GetCharacterByID(ID)
return CacheAPI.GetCacheByID("character", ID)
end

function CharacterAPI.CreateCharacter(userid, roldid, firstname, lastname, dob, dollars, gold, tokens, xp, x, y, z, lang,clothing,attributes)
CharacterController.CreateCharacter(userid, roldid, firstname, lastname, dob, dollars, gold, tokens, xp, x, y, z,
lang,clothing,attributes)
function CharacterAPI.CreateCharacter(userid, roldid, firstname, lastname, model, dob,img, dollars, gold, tokens, xp, x, y, z, lang, clothing, attributes, desc)
CharacterController.CreateCharacter(userid, roldid, firstname, lastname, model,dob,img, dollars, gold, tokens, xp, x, y, z, lang, clothing, attributes, desc)
end

function CharacterAPI.GetAvailableCharactersFromDB(src)
Expand Down Expand Up @@ -147,4 +146,4 @@ if Config.DevMode then
TriggerClientEvent("chat:addSuggestion", "/InitiateCharacter", "Initiate a character", {
{ name = "CharID", help = "character ID to spawn" }
})
end
end

0 comments on commit 4cc04bc

Please sign in to comment.