diff options
author | Jesusaves <cpntb1@ymail.com> | 2023-10-01 19:50:53 -0300 |
---|---|---|
committer | Jesusaves <cpntb1@ymail.com> | 2023-10-01 19:50:53 -0300 |
commit | 7a19627296566e9e7c092c3bef665c8e49165cc9 (patch) | |
tree | 2a810ec77463ddcd997fb78fa39bde848bdfc20c /npc/042-5 | |
parent | 01dadc7c6e14b1b6df28574c7237c1ceb38432b2 (diff) | |
download | serverdata-7a19627296566e9e7c092c3bef665c8e49165cc9.tar.gz serverdata-7a19627296566e9e7c092c3bef665c8e49165cc9.tar.bz2 serverdata-7a19627296566e9e7c092c3bef665c8e49165cc9.tar.xz serverdata-7a19627296566e9e7c092c3bef665c8e49165cc9.zip |
Fix typos (not tested) and give also a free treasure when quest is complete.
Requires user to survive and leave the map normally.
Diffstat (limited to 'npc/042-5')
-rw-r--r-- | npc/042-5/ctrl.txt | 55 |
1 files changed, 33 insertions, 22 deletions
diff --git a/npc/042-5/ctrl.txt b/npc/042-5/ctrl.txt index 4b51645f6..009132cc0 100644 --- a/npc/042-5/ctrl.txt +++ b/npc/042-5/ctrl.txt @@ -111,35 +111,39 @@ function monster0425 { /////////////////////////////////////////////////////////////// // This is required for others -// KamelotTreasure( POSITION ID ) +// KamelotTreasure( POSITION ID{, reward = False} ) function script KamelotTreasure { .@id=getarg(0); .@g=getcharid(2); if (.@g < 1) die(); - if ($KAMELOT_KEYMASK[.@g] & .@id) { - mesc l("The chest is unlocked and empty."); - close; - } - inventoryplace Iten, 1, NPCEyes, 2; - mesc l("Open the chest?"); - mesc l("Cost: 1 @@", getitemlink(TreasureKey)), 1; - if (!countitem(TreasureKey)) - close; - next; - if (askyesno() == ASK_NO) - close; - - delitem TreasureKey, 1; - mesc l("You open the chest!"); + inventoryplace Iten, 1, NPCEyes, 2; - .@empty=($KAMELOT_KEYMASK[.@g] & .@id); - $KAMELOT_KEYMASK[.@g]=$KAMELOT_KEYMASK[.@g]|.@id; + if (!getarg(1, false)) { + if ($KAMELOT_KEYMASK[.@g] & .@id) { + mesc l("The chest is unlocked and empty."); + close; + } + mesc l("Open the chest?"); + mesc l("Cost: 1 @@", getitemlink(TreasureKey)), 1; + if (!countitem(TreasureKey)) + close; + next; + if (askyesno() == ASK_NO) + close; + + delitem TreasureKey, 1; + mesc l("You open the chest!"); + + .@empty=($KAMELOT_KEYMASK[.@g] & .@id); + $KAMELOT_KEYMASK[.@g]=$KAMELOT_KEYMASK[.@g]|.@id; + } - if (!.@empty) { - if (.@id == $KAMELOT_KEY[.@g]) { + // Determine the reward, if it is not already looted + if (!.@empty || getarg(1, false)) { + if (.@id == $KAMELOT_KEY[.@g] && !getarg(1, false)) { dispbottom l("You found the key!"); - rentitem KamelotKey, 86400; // Ensure they expire after 24 hours + rentitem KamelotKey, 86400; // Ensure it expires after 24 hours .@key=true; } .@r=100+rand2(10000)-($KAMELOT_MX[.@g]*2)-getguildlvl(.@g); @@ -152,8 +156,12 @@ function script KamelotTreasure { else .@loot=any(SacredImmortalityPotion, DivineApple, ArcmageBoxset, GoldenApple, MercBoxA, MercBoxB, MercBoxC, MoveSpeedPotion, AtroposMixture, EverburnPowder, IridiumOre, PlatinumOre, YerbaMate, SmokeGrenade, SnakeEgg, LachesisBrew, BoneAmmoBox, GoldPieces, TerraniteOre, LeadOre, TinOre, SilverOre, GoldOre, TitaniumOre, FluoPowder, EquipmentBlueprintC, AlchemyBlueprintC, AlchemyBlueprintD, AncientBlueprint, JasmineTea, MoubooSteak, ClothoLiquor, Coal, RedPlushWine, HastePotion, CoinBag, StrengthPotion, Pearl, BronzeGift, IronOre, CopperOre, BlueDye, EquipmentBlueprintB, AlchemyBlueprintB, AlchemyBlueprintC, OolongTea, Croconut, CelestiaTea, MoubooSteak, ClothoLiquor, Coal, SmallMushroom, HastePotion, StrengthPotion, WoodenLog, LeatherPatch, DwarvenSake, EquipmentBlueprintA, EquipmentBlueprintB, AlchemyBlueprintA, SpearmintTea, TreasureMap, FatesPotion, CrazyRum, LightGreenDiamond, EarthPowder, WoodenLog, MysteriousBottle, FluoPowder, ChamomileTea, ScrollSCave); // > 70 options (~1% each) + // Announcement method depends if it has a dialog window or not + if (!getarg(1, false)) + dispbottom l("You find @@ inside!", getitemlink(.@loot)); + else + mesc l("You find @@ inside!", getitemlink(.@loot)); - mesc l("You find @@ inside!", getitemlink(.@loot)); // If itemtype == Armor/Weapon, make it guild bound and put bonus .@t=getiteminfo(.@loot, ITEMINFO_TYPE); if (.@t == IT_WEAPON) { @@ -176,6 +184,9 @@ function script KamelotTreasure { mesc l("Seems like someone else opened this chest before you!"); } + // If it is the reward prize, do not announce + if (getarg(1, false)) return; + // Announcement if (.@key) .@p$=b(" They found the key!"); |