Skip to content

Commit

Permalink
Update init.lua
Browse files Browse the repository at this point in the history
  • Loading branch information
Luan Luciano authored Mar 29, 2024
1 parent 2eaf63e commit ef4be4a
Showing 1 changed file with 18 additions and 18 deletions.
36 changes: 18 additions & 18 deletions data/modules/scripts/gamestore/init.lua
Original file line number Diff line number Diff line change
Expand Up @@ -1828,36 +1828,36 @@ local function HandleHirelingNameChange(playerId, offer, newHirelingName)
return
end

local functionCallback = function(playerId, data, hireling)
local player = Player(playerId)
if not player then
local functionCallback = function(playerIdInFunction, data, hireling)
local playerInFunction = Player(playerIdInFunction)
if not playerInFunction then
return
end

local offer = data.offer

Check warning on line 1837 in data/modules/scripts/gamestore/init.lua

View workflow job for this annotation

GitHub Actions / luacheck

[luacheck] reported by reviewdog 🐶 unused variable 'offer' Raw Output: data/modules/scripts/gamestore/init.lua:1837:9: unused variable 'offer'

Check warning on line 1837 in data/modules/scripts/gamestore/init.lua

View workflow job for this annotation

GitHub Actions / luacheck

[luacheck] reported by reviewdog 🐶 shadowing upvalue argument 'offer' on line 1825 Raw Output: data/modules/scripts/gamestore/init.lua:1837:9: shadowing upvalue argument 'offer' on line 1825
local newHirelingName = data.newHirelingName

Check warning on line 1838 in data/modules/scripts/gamestore/init.lua

View workflow job for this annotation

GitHub Actions / luacheck

[luacheck] reported by reviewdog 🐶 shadowing upvalue argument 'newHirelingName' on line 1825 Raw Output: data/modules/scripts/gamestore/init.lua:1838:9: shadowing upvalue argument 'newHirelingName' on line 1825

if not hireling then
return player:showInfoModal("Error", "Your must select a hireling.")
return playerInFunction:showInfoModal("Error", "Your must select a hireling.")
end

if hireling.active > 0 then
return player:showInfoModal("Error", "Your hireling must be inside his/her lamp.")
return playerInFunction:showInfoModal("Error", "Your hireling must be inside his/her lamp.")
end

local oldName = hireling.name
hireling.name = newHirelingName

if not player:makeCoinTransaction(data.offer, oldName .. " to " .. newHirelingName) then
return player:showInfoModal("Error", "Transaction error")
if not playerInFunction:makeCoinTransaction(data.offer, oldName .. " to " .. newHirelingName) then
return playerInFunction:showInfoModal("Error", "Transaction error")
end

local lamp = player:findHirelingLamp(hireling:getId())
local lamp = playerInFunction:findHirelingLamp(hireling:getId())
if lamp then
lamp:setAttribute(ITEM_ATTRIBUTE_DESCRIPTION, "This mysterious lamp summons your very own personal hireling.\nThis item cannot be traded.\nThis magic lamp is the home of " .. hireling:getName() .. ".")
end
logger.debug("{} has been renamed to {}", oldName, newHirelingName)
sendUpdatedStoreBalances(playerId)
sendUpdatedStoreBalances(playerIdInFunction)
end

player:sendHirelingSelectionModal("Choose a Hireling", "Select a hireling below", functionCallback, { offer = offer, newHirelingName = newHirelingName })
Expand Down Expand Up @@ -1896,22 +1896,22 @@ local function HandleHirelingSexChange(playerId, offer)
return
end

local cb = function(playerId, data, hireling)
local player = Player(playerId)
if not player then
local functionCallback = function(playerIdInFunction, data, hireling)
local playerInFunction = Player(playerIdInFunction)
if not playerInFunction then
return
end

if not hireling then
return player:showInfoModal("Error", "Your must select a hireling.")
return playerInFunction:showInfoModal("Error", "Your must select a hireling.")
end

if hireling.active > 0 then
return player:showInfoModal("Error", "Your hireling must be inside his/her lamp.")
return playerInFunction:showInfoModal("Error", "Your hireling must be inside his/her lamp.")
end

if not player:makeCoinTransaction(data.offer, hireling:getName()) then
return player:showInfoModal("Error", "Transaction error")
if not playerInFunction:makeCoinTransaction(data.offer, hireling:getName()) then
return playerInFunction:showInfoModal("Error", "Transaction error")
end

local changeTo, sexString, lookType
Expand All @@ -1929,10 +1929,10 @@ local function HandleHirelingSexChange(playerId, offer)
hireling.looktype = lookType

logger.debug("{} sex was changed to {}", hireling:getName(), sexString)
sendUpdatedStoreBalances(playerId)
sendUpdatedStoreBalances(playerIdInFunction)
end

player:sendHirelingSelectionModal("Choose a Hireling", "Select a hireling below", cb, { offer = offer })
player:sendHirelingSelectionModal("Choose a Hireling", "Select a hireling below", functionCallback, { offer = offer })
end

function GameStore.processHirelingChangeSexPurchase(player, offer)
Expand Down

0 comments on commit ef4be4a

Please sign in to comment.