Skip to content

Commit

Permalink
typo and fix of an error
Browse files Browse the repository at this point in the history
  • Loading branch information
brightrim committed Jan 2, 2025
1 parent e950f67 commit 7ff9f31
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 2 deletions.
15 changes: 14 additions & 1 deletion base/gems.lua
Original file line number Diff line number Diff line change
Expand Up @@ -153,8 +153,21 @@ function M.returnGemsToUser(user, item, isMessage)
local itemKey = gemDataKey[i]
local level = tonumber(item:getData(itemKey))

local owner = item:getData(itemKey.."owner")

if level and level > 0 then
common.CreateItem(user, M.gemItemId[i], 1, 999, {[M.levelDataKey] = level, ["owner"] = item:getData(itemKey.."owner")})

if owner ~= user.name then --For some reason when creating the new gems, it refuses to report the owner even if you add it to the data table when creating it below, and instead merges the gems with existing gems with different owner names. As such we report this incident individually here.
log(user.name..
" unsocketed a "..
world:getItemName(item.id, 1)..
" with a level "..level.." "..
world:getItemName(M.gemItemId[i], 1)..
" that previously belonged to "..owner..
".")
end

common.CreateItem(user, M.gemItemId[i], 1, 999, {[M.levelDataKey] = level})
item:setData(itemKey, "")
item:setData(itemKey.."owner", "")
end
Expand Down
2 changes: 1 addition & 1 deletion base/magicsmith.lua
Original file line number Diff line number Diff line change
Expand Up @@ -134,7 +134,7 @@ function M.handleSocketing(user, gem)
if isSocketable(item.id) then
local key = gems.getDataKey(gem.id)
local level = item:getData(key)
local gemOwner = item:getData("owner")
local gemOwner = gem:getData("owner")

if level == "" then
local newLevel = tonumber(gem:getData(gems.levelDataKey)) or 1 --If the gem has no level set, it's 1 by default.
Expand Down

0 comments on commit 7ff9f31

Please sign in to comment.