Index: scripts/zones/Beadeaux/npcs/Treasure_Coffer.lua =================================================================== --- scripts/zones/Beadeaux/npcs/Treasure_Coffer.lua (revision 2069) +++ scripts/zones/Beadeaux/npcs/Treasure_Coffer.lua (working copy) @@ -69,7 +69,7 @@ if(diceroll <= success) then -- Succeded to open the coffer player:messageSpecial(CHEST_UNLOCKED); - + listAF = getAFbyZone(zone); if(questItemNeeded == 1) then player:addKeyItem(OLD_GAUNTLETS); player:messageSpecial(KEYITEM_OBTAINED,OLD_GAUNTLETS); -- Old Gauntlets (KI) Index: scripts/zones/Castle_Oztroja/npcs/Treasure_Coffer.lua =================================================================== --- scripts/zones/Castle_Oztroja/npcs/Treasure_Coffer.lua (revision 2069) +++ scripts/zones/Castle_Oztroja/npcs/Treasure_Coffer.lua (working copy) @@ -61,7 +61,7 @@ if(math.random() <= success) then -- 0 or 1 -- Succeded to open the coffer player:messageSpecial(CHEST_UNLOCKED); - + local listAF = getAFbyZone(zone); if(questItemNeeded == 2) then for nb = 1,table.getn(listAF),3 do if(mJob == listAF[nb]) then Index: scripts/zones/Castle_Zvahl_Baileys/npcs/Treasure_Coffer.lua =================================================================== --- scripts/zones/Castle_Zvahl_Baileys/npcs/Treasure_Coffer.lua (revision 2069) +++ scripts/zones/Castle_Zvahl_Baileys/npcs/Treasure_Coffer.lua (working copy) @@ -45,14 +45,15 @@ for nb = 1,table.getn(listAF),3 do if(player:getQuestStatus(JEUNO,listAF[nb + 1]) ~= QUEST_AVAILABLE and mJob == listAF[nb] and player:hasItem(listAF[nb + 2]) == false) then questItemNeeded = 2; + AFgear = listAF[nb+2]; break end end end -------------------------------------- - local pack = openChance(player,npc,trade,TreasureType,TreasureLvL,TreasureMinLvL,questItemNeeded); - local success = 0; + local pack = openChance(player,npc,trade,TreasureType,TreasureLvL,TreasureMinLvL,questItemNeeded); + local success = 0; if(pack[2] ~= nil) then player:messageSpecial(pack[2]); success = pack[1]; @@ -63,10 +64,10 @@ if(success ~= -2) then player:tradeComplete(); - if(math.random() <= success) then -- 0 or 1 + if(math.random() <= success) then -- Succeded to open the coffer player:messageSpecial(CHEST_UNLOCKED); - + local listAF = getAFbyZone(zone); if(questItemNeeded == 1) then player:addKeyItem(OLD_GAUNTLETS); player:messageSpecial(KEYITEM_OBTAINED,OLD_GAUNTLETS); -- Old Gauntlets (KI) @@ -101,6 +102,7 @@ end; + ----------------------------------- -- onTrigger Action ----------------------------------- Index: scripts/zones/Crawlers_Nest/npcs/Treasure_Chest.lua =================================================================== --- scripts/zones/Crawlers_Nest/npcs/Treasure_Chest.lua (revision 2069) +++ scripts/zones/Crawlers_Nest/npcs/Treasure_Chest.lua (working copy) @@ -31,11 +31,30 @@ -- Player traded a key. if((trade:hasItemQty(1040,1) or trade:hasItemQty(1115,1) or trade:hasItemQty(1023,1) or trade:hasItemQty(1022,1)) and trade:getItemCount() == 1) then + + local mJob = player:getMainJob(); local zone = player:getZone(); + local AFHandsActivated = player:getVar("BorghertzAlreadyActiveWithJob"); + local zone = player:getZone(); -- IMPORTANT ITEM: AF2 RDM QUEST ----------- if(player:getVar("needs_crawler_blood") == 1) then + questItemNeeded = 3; + end + + if((AFHandsActivated == 2 or AFHandsActivated == 9) and player:hasKeyItem(OLD_GAUNTLETS) == false) then questItemNeeded = 1; + else + local listAF = getAFbyZone(zone); + + for nb = 1,table.getn(listAF),3 do + if(player:getQuestStatus(JEUNO,listAF[nb + 1]) ~= QUEST_AVAILABLE and mJob == listAF[nb] and player:hasItem(listAF[nb + 2]) == false) then + questItemNeeded = 2; + break + end + end end + + -------------------------------------- local pack = openChance(player,npc,trade,TreasureType,TreasureLvL,TreasureMinLvL,questItemNeeded); @@ -54,10 +73,23 @@ -- Succeded to open the coffer player:messageSpecial(CHEST_UNLOCKED); - if(questItemNeeded == 1) then + if(questItemNeeded == 3) then player:addKeyItem(CRAWLER_BLOOD); player:messageSpecial(KEYITEM_OBTAINED,CRAWLER_BLOOD); -- Crawler Blood (KI) player:setVar("needs_crawler_blood",0); + listAF = getAFbyZone(zone); + elseif(questItemNeeded == 1) then + player:addKeyItem(OLD_GAUNTLETS); + player:messageSpecial(KEYITEM_OBTAINED,OLD_GAUNTLETS); -- Old Gauntlets (KI) + elseif(questItemNeeded == 2) then + for nb = 1,table.getn(listAF),3 do + if(mJob == listAF[nb]) then + player:addItem(listAF[nb + 2]); + player:messageSpecial(ITEM_OBTAINED,listAF[nb + 2]); + break + end + end + else player:setVar("["..zone.."]".."Treasure_"..TreasureType,os.time() + math.random(CHEST_MIN_ILLUSION_TIME,CHEST_MAX_ILLUSION_TIME)); @@ -87,6 +119,9 @@ function onTrigger(player,npc) player:messageSpecial(CHEST_LOCKED,1040); + player:addKeyItem(CRAWLER_BLOOD); + player:messageSpecial(KEYITEM_OBTAINED,CRAWLER_BLOOD); -- Crawler Blood (KI) + player:setVar("needs_crawler_blood",0); end; ----------------------------------- Index: scripts/zones/Garlaige_Citadel/npcs/Treasure_Coffer.lua =================================================================== --- scripts/zones/Garlaige_Citadel/npcs/Treasure_Coffer.lua (revision 2069) +++ scripts/zones/Garlaige_Citadel/npcs/Treasure_Coffer.lua (working copy) @@ -41,7 +41,7 @@ questItemNeeded = 1; else local listAF = getAFbyZone(zone); - + for nb = 1,table.getn(listAF),3 do if(player:getQuestStatus(JEUNO,listAF[nb + 1]) ~= QUEST_AVAILABLE and mJob == listAF[nb] and player:hasItem(listAF[nb + 2]) == false) then questItemNeeded = 2; @@ -66,18 +66,22 @@ if(math.random() <= success) then -- Succeded to open the coffer player:messageSpecial(CHEST_UNLOCKED); - + listAF = getAFbyZone(zone); if(questItemNeeded == 1) then player:addKeyItem(OLD_GAUNTLETS); player:messageSpecial(KEYITEM_OBTAINED,OLD_GAUNTLETS); -- Old Gauntlets (KI) elseif(questItemNeeded == 2) then - for nb = 1,table.getn(listAF),3 do + for nb = 1,table.getn(listAF),3 do if(mJob == listAF[nb]) then player:addItem(listAF[nb + 2]); player:messageSpecial(ITEM_OBTAINED,listAF[nb + 2]); break end end + + + + else player:setVar("["..zone.."]".."Treasure_"..TreasureType,os.time() + math.random(CHEST_MIN_ILLUSION_TIME,CHEST_MAX_ILLUSION_TIME)); Index: scripts/zones/Ifrits_Cauldron/npcs/Treasure_Coffer.lua =================================================================== --- scripts/zones/Ifrits_Cauldron/npcs/Treasure_Coffer.lua (revision 2069) +++ scripts/zones/Ifrits_Cauldron/npcs/Treasure_Coffer.lua (working copy) @@ -70,7 +70,7 @@ if(math.random() <= success) then -- Succeded to open the coffer player:messageSpecial(CHEST_UNLOCKED); - + local listAF = getAFbyZone(zone); if(questItemNeeded == 1) then player:addKeyItem(OLD_GAUNTLETS); player:messageSpecial(KEYITEM_OBTAINED,OLD_GAUNTLETS); -- Old Gauntlets (KI) Index: scripts/zones/Monastic_Cavern/npcs/Treasure_Coffer.lua =================================================================== --- scripts/zones/Monastic_Cavern/npcs/Treasure_Coffer.lua (revision 2069) +++ scripts/zones/Monastic_Cavern/npcs/Treasure_Coffer.lua (working copy) @@ -66,7 +66,7 @@ if(math.random() <= success) then -- Succeded to open the coffer player:messageSpecial(CHEST_UNLOCKED); - + listAF = getAFbyZone(zone); if(questItemNeeded == 1) then player:addKeyItem(OLD_GAUNTLETS); player:messageSpecial(KEYITEM_OBTAINED,OLD_GAUNTLETS); -- Old Gauntlets (KI) Index: scripts/zones/Quicksand_Caves/npcs/Treasure_Coffer.lua =================================================================== --- scripts/zones/Quicksand_Caves/npcs/Treasure_Coffer.lua (revision 2069) +++ scripts/zones/Quicksand_Caves/npcs/Treasure_Coffer.lua (working copy) @@ -65,7 +65,7 @@ if(math.random() <= success) then -- Succeded to open the coffer player:messageSpecial(CHEST_UNLOCKED); - + local listAF = getAFbyZone(zone); if(questItemNeeded == 3) then player:addKeyItem(MAP_OF_THE_QUICKSAND_CAVES); player:messageSpecial(KEYITEM_OBTAINED,MAP_OF_THE_QUICKSAND_CAVES); -- Map of the Quicksand Caves (KI) Index: scripts/zones/Sea_Serpent_Grotto/npcs/Treasure_Coffer.lua =================================================================== --- scripts/zones/Sea_Serpent_Grotto/npcs/Treasure_Coffer.lua (revision 2069) +++ scripts/zones/Sea_Serpent_Grotto/npcs/Treasure_Coffer.lua (working copy) @@ -70,7 +70,7 @@ if(math.random() <= success) then -- Succeded to open the coffer player:messageSpecial(CHEST_UNLOCKED); - + local listAF = getAFbyZone(zone); if(questItemNeeded == 1) then player:addKeyItem(OLD_GAUNTLETS); player:messageSpecial(KEYITEM_OBTAINED,OLD_GAUNTLETS); -- Old Gauntlets (KI) Index: scripts/zones/Temple_of_Uggalepih/npcs/Treasure_Coffer.lua =================================================================== --- scripts/zones/Temple_of_Uggalepih/npcs/Treasure_Coffer.lua (revision 2069) +++ scripts/zones/Temple_of_Uggalepih/npcs/Treasure_Coffer.lua (working copy) @@ -65,7 +65,7 @@ if(math.random() <= success) then -- Succeded to open the coffer player:messageSpecial(CHEST_UNLOCKED); - + local listAF = getAFbyZone(zone); if(questItemNeeded == 3) then player:addKeyItem(MAP_OF_THE_TEMPLE_OF_UGGALEPIH); player:messageSpecial(KEYITEM_OBTAINED,MAP_OF_THE_TEMPLE_OF_UGGALEPIH); -- Map of the Temple of Uggalepih (KI) Index: scripts/zones/The_Boyahda_Tree/npcs/Treasure_Coffer.lua =================================================================== --- scripts/zones/The_Boyahda_Tree/npcs/Treasure_Coffer.lua (revision 2069) +++ scripts/zones/The_Boyahda_Tree/npcs/Treasure_Coffer.lua (working copy) @@ -70,7 +70,7 @@ if(math.random() <= success) then -- Succeded to open the coffer player:messageSpecial(CHEST_UNLOCKED); - + listAF = getAFbyZone(zone); if(questItemNeeded == 1) then player:addKeyItem(OLD_GAUNTLETS); player:messageSpecial(KEYITEM_OBTAINED,OLD_GAUNTLETS); -- Old Gauntlets (KI) Index: scripts/zones/The_Eldieme_Necropolis/npcs/Treasure_Coffer.lua =================================================================== --- scripts/zones/The_Eldieme_Necropolis/npcs/Treasure_Coffer.lua (revision 2069) +++ scripts/zones/The_Eldieme_Necropolis/npcs/Treasure_Coffer.lua (working copy) @@ -63,10 +63,10 @@ if(success ~= -2) then player:tradeComplete(); - if(math.random() <= success) then -- 0 or 1 + if(math.random() <= success) then -- Succeded to open the coffer player:messageSpecial(CHEST_UNLOCKED); - + local listAF = getAFbyZone(zone); if(questItemNeeded == 1) then player:addKeyItem(OLD_GAUNTLETS); player:messageSpecial(KEYITEM_OBTAINED,OLD_GAUNTLETS); -- Old Gauntlets (KI) @@ -77,7 +77,8 @@ player:messageSpecial(ITEM_OBTAINED,listAF[nb + 2]); break end - end + end + else player:setVar("["..zone.."]".."Treasure_"..TreasureType,os.time() + math.random(CHEST_MIN_ILLUSION_TIME,CHEST_MAX_ILLUSION_TIME)); Index: scripts/zones/Toraimarai_Canal/npcs/Treasure_Coffer.lua =================================================================== --- scripts/zones/Toraimarai_Canal/npcs/Treasure_Coffer.lua (revision 2069) +++ scripts/zones/Toraimarai_Canal/npcs/Treasure_Coffer.lua (working copy) @@ -67,7 +67,7 @@ if(math.random() <= success) then -- Succeded to open the coffer player:messageSpecial(CHEST_UNLOCKED); - + local listAF = getAFbyZone(zone); if(questItemNeeded == 2) then for nb = 1,table.getn(listAF),3 do if(mJob == listAF[nb]) then