Skip to content

Commit

Permalink
Merge pull request #11 from iseeyoucopy/main
Browse files Browse the repository at this point in the history
 Cleanup: Debug Prints to Devmode and Remove Unused Dependencies
  • Loading branch information
iseeyoucopy authored Dec 7, 2024
2 parents ccdf6f0 + cf6796d commit b83ca26
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 12 deletions.
5 changes: 2 additions & 3 deletions fxmanifest.lua
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,7 @@ dependency {
'vorp_inventory',
'vorp_character',
'bcc-utils',
'feather-menu',
'feather-progressbar',
'feather-menu'
}

version '1.0.0'
version '1.0.1'
16 changes: 8 additions & 8 deletions server/server.lua
Original file line number Diff line number Diff line change
Expand Up @@ -481,28 +481,28 @@ function getAvailableSpace(source, itemName)
end

BccUtils.RPC:Register("bcc-crafting:GetCraftingData", function(params, cb, recSource)
print("[DEBUG] Received RPC request for crafting data")
devPrint("[DEBUG] Received RPC request for crafting data")
local user = VORPcore.getUser(recSource)
if not user then
print("[DEBUG] No user found for source: " .. tostring(recSource))
devPrint("[DEBUG] No user found for source: " .. tostring(recSource))
return cb(false)
end

local char = user.getUsedCharacter
if not char then
print("[DEBUG] No character data found for user.")
devPrint("[DEBUG] No character data found for user.")
return cb(false)
end

local playerId = char.charIdentifier
print("[DEBUG] Character ID: " .. tostring(playerId))
devPrint("[DEBUG] Character ID: " .. tostring(playerId))

-- Query the database directly
MySQL.query('SELECT currentXP, currentLevel FROM bcc_craft_progress WHERE charidentifier = @charidentifier', {
['@charidentifier'] = playerId
}, function(result)
if not result or #result == 0 then
print("[DEBUG] No crafting data found. Initializing default data.")
devPrint("[DEBUG] No crafting data found. Initializing default data.")

-- Insert default data if none exists
MySQL.execute(
Expand All @@ -522,7 +522,7 @@ BccUtils.RPC:Register("bcc-crafting:GetCraftingData", function(params, cb, recSo
-- Extract current XP and level
local currentXP = result[1].currentXP
local level = result[1].currentLevel
print("[DEBUG] Retrieved XP: " .. tostring(currentXP) .. ", Level: " .. tostring(level))
devPrint("[DEBUG] Retrieved XP: " .. tostring(currentXP) .. ", Level: " .. tostring(level))

-- Calculate XP required for the next level
local xpForNextLevel = 0
Expand All @@ -534,13 +534,13 @@ BccUtils.RPC:Register("bcc-crafting:GetCraftingData", function(params, cb, recSo
end

if xpForNextLevel == 0 then
print("[DEBUG] XP threshold not found for level: " .. tostring(level))
devPrint("[DEBUG] XP threshold not found for level: " .. tostring(level))
return cb(false)
end

-- Calculate the remaining XP to the next level
local xpToNextLevel = xpForNextLevel - (currentXP % xpForNextLevel)
print("[DEBUG] XP to next level: " .. tostring(xpToNextLevel))
devPrint("[DEBUG] XP to next level: " .. tostring(xpToNextLevel))

-- Prepare the response
local craftingData = {
Expand Down
2 changes: 1 addition & 1 deletion version
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
<1.0.0>
<1.0.1>
See GitHub for updates!

0 comments on commit b83ca26

Please sign in to comment.