Skip to content

Commit

Permalink
chore: remove unnecessary checking
Browse files Browse the repository at this point in the history
  • Loading branch information
omarcopires committed Mar 22, 2024
1 parent 82a7086 commit 3fe8332
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 26 deletions.
11 changes: 4 additions & 7 deletions data-canary/npc/king_canary.lua
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ local function creatureSayCallback(npc, creature, type, message)
npcHandler:setTopic(playerId, 0)
elseif npcHandler:getTopic(playerId) == 3 then
if player:kv():get("golden-outfit-quest") < 1 then
if player:getMoney() + player:getBankBalance() >= 500000000 then
if player:removeMoneyBank(500000000) then
local inbox = player:getStoreInbox()
local inboxItems = inbox:getItems()
if inbox and #inboxItems <= inbox:getMaxCapacity() then
Expand All @@ -78,10 +78,9 @@ local function creatureSayCallback(npc, creature, type, message)
decoKit:setAttribute(ITEM_ATTRIBUTE_DESCRIPTION, "You bought this item in the Store.\nUnwrap it in your own house to create a " .. decoItemName .. ".")
decoKit:setCustomAttribute("unWrapId", 31510)
npcHandler:say("Take this armor as a token of great gratitude. Let us forever remember this day, my friend!", npc, creature)
player:removeMoneyBank(500000000)
player:addOutfit(1211)
player:addOutfit(1210)
player:getPosition():sendMagicEffect(CONST_ME_EARLY_THUNDERs)
player:getPosition():sendMagicEffect(CONST_ME_EARLY_THUNDER)
player:kv():set("golden-outfit-quest", 1)
else
npcHandler:say("Please make sure you have free slots in your store inbox.", npc, creature)
Expand All @@ -96,9 +95,8 @@ local function creatureSayCallback(npc, creature, type, message)
elseif npcHandler:getTopic(playerId) == 4 then
if player:kv():get("golden-outfit-quest") == 1 then
if player:kv():get("golden-outfit-quest") < 2 then
if player:getMoney() + player:getBankBalance() >= 250000000 then
if player:removeMoneyBank(250000000) then
npcHandler:say("Take this helmet as a token of great gratitude. Let us forever remember this day, my friend. ", npc, creature)
player:removeMoneyBank(250000000)
player:addOutfitAddon(1210, 1)
player:addOutfitAddon(1211, 1)
player:getPosition():sendMagicEffect(CONST_ME_EARLY_THUNDER)
Expand All @@ -120,9 +118,8 @@ local function creatureSayCallback(npc, creature, type, message)
elseif npcHandler:getTopic(playerId) == 5 then
if player:kv():get("golden-outfit-quest") == 2 then
if player:kv():get("golden-outfit-quest") < 3 then
if player:getMoney() + player:getBankBalance() >= 250000000 then
if player:removeMoneyBank(250000000) then
npcHandler:say("Take this boots as a token of great gratitude. Let us forever remember this day, my friend. ", npc, creature)
player:removeMoneyBank(250000000)
player:addOutfitAddon(1210, 2)
player:addOutfitAddon(1211, 2)
player:getPosition():sendMagicEffect(CONST_ME_EARLY_THUNDER)
Expand Down
9 changes: 3 additions & 6 deletions data-otservbr-global/npc/emperor_kruzak.lua
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ local function creatureSayCallback(npc, creature, type, message)
npcHandler:setTopic(playerId, 0)
elseif npcHandler:getTopic(playerId) == 3 then
if player:kv():get("golden-outfit-quest") < 1 then
if player:getMoney() + player:getBankBalance() >= 500000000 then
if player:removeMoneyBank(500000000) then
local inbox = player:getStoreInbox()
local inboxItems = inbox:getItems()
if inbox and #inboxItems <= inbox:getMaxCapacity() then
Expand All @@ -83,7 +83,6 @@ local function creatureSayCallback(npc, creature, type, message)
decoKit:setAttribute(ITEM_ATTRIBUTE_DESCRIPTION, "You bought this item in the Store.\nUnwrap it in your own house to create a " .. decoItemName .. ".")
decoKit:setCustomAttribute("unWrapId", 31510)
npcHandler:say("Take this armor as a token of great gratitude. Let us forever remember this day, my friend!", npc, creature)
player:removeMoneyBank(500000000)
player:addOutfit(1211)
player:addOutfit(1210)
player:getPosition():sendMagicEffect(CONST_ME_EARLY_THUNDER)
Expand All @@ -101,9 +100,8 @@ local function creatureSayCallback(npc, creature, type, message)
elseif npcHandler:getTopic(playerId) == 4 then
if player:kv():get("golden-outfit-quest") == 1 then
if player:kv():get("golden-outfit-quest") < 2 then
if player:getMoney() + player:getBankBalance() >= 250000000 then
if player:removeMoneyBank(250000000) then
npcHandler:say("Take this helmet as a token of great gratitude. Let us forever remember this day, my friend. ", npc, creature)
player:removeMoneyBank(250000000)
player:addOutfitAddon(1210, 1)
player:addOutfitAddon(1211, 1)
player:getPosition():sendMagicEffect(CONST_ME_EARLY_THUNDER)
Expand All @@ -125,9 +123,8 @@ local function creatureSayCallback(npc, creature, type, message)
elseif npcHandler:getTopic(playerId) == 5 then
if player:kv():get("golden-outfit-quest") == 2 then
if player:kv():get("golden-outfit-quest") < 3 then
if player:getMoney() + player:getBankBalance() >= 250000000 then
if player:removeMoneyBank(250000000) then
npcHandler:say("Take this boots as a token of great gratitude. Let us forever remember this day, my friend. ", npc, creature)
player:removeMoneyBank(250000000)
player:addOutfitAddon(1210, 2)
player:addOutfitAddon(1211, 2)
player:getPosition():sendMagicEffect(CONST_ME_EARLY_THUNDER)
Expand Down
9 changes: 3 additions & 6 deletions data-otservbr-global/npc/king_tibianus.lua
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ local function creatureSayCallback(npc, creature, type, message)
npcHandler:setTopic(playerId, 0)
elseif npcHandler:getTopic(playerId) == 3 then
if player:kv():get("golden-outfit-quest") < 1 then
if player:getMoney() + player:getBankBalance() >= 500000000 then
if player:removeMoneyBank(500000000) then
local inbox = player:getStoreInbox()
local inboxItems = inbox:getItems()
if inbox and #inboxItems <= inbox:getMaxCapacity() then
Expand All @@ -88,7 +88,6 @@ local function creatureSayCallback(npc, creature, type, message)
decoKit:setAttribute(ITEM_ATTRIBUTE_DESCRIPTION, "Unwrap it in your own house to create a " .. decoItemName .. ".")
decoKit:setCustomAttribute("unWrapId", 31510)
npcHandler:say("Take this armor as a token of great gratitude. Let us forever remember this day, my friend!", npc, creature)
player:removeMoneyBank(500000000)
player:addOutfit(1211)
player:addOutfit(1210)
player:getPosition():sendMagicEffect(CONST_ME_EARLY_THUNDER)
Expand All @@ -106,9 +105,8 @@ local function creatureSayCallback(npc, creature, type, message)
elseif npcHandler:getTopic(playerId) == 4 then
if player:kv():get("golden-outfit-quest") == 1 then
if player:kv():get("golden-outfit-quest") < 2 then
if player:getMoney() + player:getBankBalance() >= 250000000 then
if player:removeMoneyBank(250000000) then
npcHandler:say("Take this helmet as a token of great gratitude. Let us forever remember this day, my friend. ", npc, creature)
player:removeMoneyBank(250000000)
player:addOutfitAddon(1210, 2)
player:addOutfitAddon(1211, 2)
player:getPosition():sendMagicEffect(CONST_ME_EARLY_THUNDER)
Expand All @@ -130,9 +128,8 @@ local function creatureSayCallback(npc, creature, type, message)
elseif npcHandler:getTopic(playerId) == 5 then
if player:kv():get("golden-outfit-quest") == 2 then
if player:kv():get("golden-outfit-quest") < 3 then
if player:getMoney() + player:getBankBalance() >= 250000000 then
if player:removeMoneyBank(250000000) then
npcHandler:say("Take this boots as a token of great gratitude. Let us forever remember this day, my friend. ", npc, creature)
player:removeMoneyBank(250000000)
player:addOutfitAddon(1210, 1)
player:addOutfitAddon(1211, 1)
player:getPosition():sendMagicEffect(CONST_ME_EARLY_THUNDER)
Expand Down
11 changes: 4 additions & 7 deletions data-otservbr-global/npc/queen_eloise.lua
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ local function creatureSayCallback(npc, creature, type, message)
npcHandler:setTopic(playerId, 0)
elseif npcHandler:getTopic(playerId) == 3 then
if player:kv():get("golden-outfit-quest") < 1 then
if player:getMoney() + player:getBankBalance() >= 500000000 then
if player:removeMoneyBank(500000000) then
local inbox = player:getStoreInbox()
local inboxItems = inbox:getItems()
if inbox and #inboxItems <= inbox:getMaxCapacity() then
Expand All @@ -78,7 +78,6 @@ local function creatureSayCallback(npc, creature, type, message)
decoKit:setAttribute(ITEM_ATTRIBUTE_DESCRIPTION, "You bought this item in the Store.\nUnwrap it in your own house to create a " .. decoItemName .. ".")
decoKit:setCustomAttribute("unWrapId", 31510)
npcHandler:say("Take this armor as a token of great gratitude. Let us forever remember this day, my friend!", npc, creature)
player:removeMoneyBank(500000000)
player:addOutfit(1211)
player:addOutfit(1210)
player:getPosition():sendMagicEffect(CONST_ME_EARLY_THUNDER)
Expand All @@ -96,9 +95,8 @@ local function creatureSayCallback(npc, creature, type, message)
elseif npcHandler:getTopic(playerId) == 4 then
if player:kv():get("golden-outfit-quest") == 1 then
if player:kv():get("golden-outfit-quest") < 2 then
if player:getMoney() + player:getBankBalance() >= 250000000 then
if player:removeMoneyBank(250000000) then
npcHandler:say("Take this helmet as a token of great gratitude. Let us forever remember this day, my friend. ", npc, creature)
player:removeMoneyBank(250000000)
player:addOutfitAddon(1210, 1)
player:addOutfitAddon(1211, 1)
player:getPosition():sendMagicEffect(CONST_ME_EARLY_THUNDER)
Expand All @@ -120,12 +118,11 @@ local function creatureSayCallback(npc, creature, type, message)
elseif npcHandler:getTopic(playerId) == 5 then
if player:kv():get("golden-outfit-quest") == 2 then
if player:kv():get("golden-outfit-quest") < 3 then
if player:getMoney() + player:getBankBalance() >= 250000000 then
if player:removeMoneyBank(250000000) then
npcHandler:say("Take this boots as a token of great gratitude. Let us forever remember this day, my friend. ", npc, creature)
player:removeMoneyBank(250000000)
player:addOutfitAddon(1210, 2)
player:addOutfitAddon(1211, 2)
player:getPosition():sendMagicEffect(CONST_ME_EARLY_THUNDERss)
player:getPosition():sendMagicEffect(CONST_ME_EARLY_THUNDER)
player:kv():set("golden-outfit-quest", 3)
npcHandler:setTopic(playerId, 2)
else
Expand Down

0 comments on commit 3fe8332

Please sign in to comment.