From 96b454eaaf249253e317bd0add21b971cab4c28f Mon Sep 17 00:00:00 2001 From: Marco Date: Fri, 22 Mar 2024 13:20:23 -0300 Subject: [PATCH] chore: remove unnecessary checking --- data-canary/npc/king_canary.lua | 9 +++------ data-otservbr-global/npc/emperor_kruzak.lua | 9 +++------ data-otservbr-global/npc/king_tibianus.lua | 9 +++------ data-otservbr-global/npc/queen_eloise.lua | 9 +++------ 4 files changed, 12 insertions(+), 24 deletions(-) diff --git a/data-canary/npc/king_canary.lua b/data-canary/npc/king_canary.lua index edaafc482cb..3790a472ea5 100644 --- a/data-canary/npc/king_canary.lua +++ b/data-canary/npc/king_canary.lua @@ -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 @@ -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_THUNDERs) @@ -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) @@ -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) diff --git a/data-otservbr-global/npc/emperor_kruzak.lua b/data-otservbr-global/npc/emperor_kruzak.lua index a080258fbf4..6568ba6f28f 100644 --- a/data-otservbr-global/npc/emperor_kruzak.lua +++ b/data-otservbr-global/npc/emperor_kruzak.lua @@ -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 @@ -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) @@ -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) @@ -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) diff --git a/data-otservbr-global/npc/king_tibianus.lua b/data-otservbr-global/npc/king_tibianus.lua index acdd6c4b0ad..5f84d81b2c8 100644 --- a/data-otservbr-global/npc/king_tibianus.lua +++ b/data-otservbr-global/npc/king_tibianus.lua @@ -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 @@ -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) @@ -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) @@ -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) diff --git a/data-otservbr-global/npc/queen_eloise.lua b/data-otservbr-global/npc/queen_eloise.lua index ab0b04132c7..36cbebc7c0e 100644 --- a/data-otservbr-global/npc/queen_eloise.lua +++ b/data-otservbr-global/npc/queen_eloise.lua @@ -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 @@ -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) @@ -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) @@ -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_THUNDERss)