diff options
author | Jesusaves <cpntb1@ymail.com> | 2020-04-30 14:34:35 -0300 |
---|---|---|
committer | Jesusaves <cpntb1@ymail.com> | 2020-04-30 14:34:35 -0300 |
commit | 15e75f3b96e0e5e156b5511590f3d4d7d10d5912 (patch) | |
tree | 8167e0246b85d1a0985c4130b92c095171cba1d6 /npc/042-5 | |
parent | 97bc84d1f0d8aa72d965cbc8b6695d581ac90e09 (diff) | |
download | serverdata-15e75f3b96e0e5e156b5511590f3d4d7d10d5912.tar.gz serverdata-15e75f3b96e0e5e156b5511590f3d4d7d10d5912.tar.bz2 serverdata-15e75f3b96e0e5e156b5511590f3d4d7d10d5912.tar.xz serverdata-15e75f3b96e0e5e156b5511590f3d4d7d10d5912.zip |
Prototype for Kamelot Chests
The treasure chests are Iilia-level
Diffstat (limited to 'npc/042-5')
-rw-r--r-- | npc/042-5/ctrl.txt | 80 |
1 files changed, 78 insertions, 2 deletions
diff --git a/npc/042-5/ctrl.txt b/npc/042-5/ctrl.txt index dfc799122..e76efb24c 100644 --- a/npc/042-5/ctrl.txt +++ b/npc/042-5/ctrl.txt @@ -9,7 +9,7 @@ // A simple random treasure chest - to be sure players were introduced to this // awesome system. Same rules as any treasure box still applies. -042-5,0,0,0 script #ctrl0425 NPC_CHEST,{ +042-5,0,0,0 script #ctrl0425 NPC_HIDDEN,{ function monster0425; end; @@ -51,10 +51,12 @@ OnKillMob: .@g=getcharid(2); if (.@g < 1) percentheal -100, -100; getexp $KAMELOT_MX[.@g]*7, $KAMELOT_MX[.@g]*3; + .@delay=max(3000, 21000-$KAMELOT_PC[.@g]*1000); // FALLTHROUGH OnRespawn: - sleep(3000); + .@delay=(.@delay ? .@delay : 3000); + sleep(.@delay); // Yes, we just hope it works out of box explode(.@map$, .map$, "@"); .@g=atoi(.@map$[1]); @@ -110,3 +112,77 @@ function monster0425 { } +/////////////////////////////////////////////////////////////// +// This is required for others + +// KamelotTreasure( POSITION ID ) +function script KamelotTreasure { + .@id=getarg(0); + .@g=getcharid(2); + if (.@g < 1) percentheal -100, -100; + 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]) { + dispbottom l("You found the key!"); + getitem KamelotKey, 1; + .@key=true; + } + .@r=rand2(10000); + + // Select treasure list + if (.@r == 0) // 0.01% total, 0.025% each + .@loot=any(MylarinDust, SupremeGift, HousingLetterIII, TimeFlask); + else if (.@r < 300) // 0.3% each + .@loot=any(MagicApple, PrismGift, EquipmentBlueprintD, ChampionshipBow, Halberd, AncientShield, AncientSword, Setzer, MercBoxD, Shemagh); + else + .@loot=any(SacredImmortalityPotion, DivineApple, ArcmageBoxset, GoldenApple, MercBoxA, MercBoxB, MercBoxC, MoveSpeedPotion, AtroposMixture, EverburnPowder, IridiumOre, PlatinumOre, YerbaMate, SmokeGrenade, SnakeEgg, LachesisBrew, ArrowAmmoBox, GoldPieces, SilverGift, TerraniteOre, LeadOre, TinOre, SilverOre, GoldOre, TitaniumOre, FluoPowder, EquipmentBlueprintC, AlchemyBlueprintC, AlchemyBlueprintD, AncientBlueprint, JasmineTea, MoubooSteak, ClothoLiquor, Coal, RedPlushWine, HastePotion, CoinBag, StrengthPotion, Dagger, BronzeGift, IronOre, CopperOre, BlueDye, EquipmentBlueprintB, AlchemyBlueprintB, AlchemyBlueprintC, OolongTea, Croconut, Potatoz, MoubooSteak, ClothoLiquor, Coal, SmallMushroom, HastePotion, StrengthPotion, WoodenLog, LeatherPatch, Beer, EquipmentBlueprintA, EquipmentBlueprintB, AlchemyBlueprintA, SpearmintTea, TreasureMap, FatesPotion, ChocolateBar, Plushroom, Chagashroom, RawLog, LeatherPatch, StrangeCoin, ChamomileTea); // > 70 options (~1% each) + + + inventoryplace .@loot, 1; + mesc l("You find @@ inside!", getitemlink(.@loot)); + getitem .@loot, 1; + } else { + mesc l("You find @@ inside!", l("nothing")); + mesc l("Seems like someone else opened this chest before you!"); + } + + // Announcement + if (.@key) + .@p$=b(" They found the key!"); + mapannounce "042-6@"+.@g, strcharinfo(0)+" has opened a Treasure Chest!"+.@p$, 0; + mapannounce "042-7@"+.@g, strcharinfo(0)+" has opened a Treasure Chest!"+.@p$, 0; + mapannounce "042-8@"+.@g, strcharinfo(0)+" has opened a Treasure Chest!"+.@p$, 0; + mapannounce "042-9@"+.@g, strcharinfo(0)+" has opened a Treasure Chest!"+.@p$, 0; + // Guild Master Notification + .@gm$=getguildmaster(.@g); + if (!getcharid(3, .@gm$)) return; + .@gma=getcharid(3, .@gm$); + .@gmb=getcharid(0, .@gm$); + if (!isloggedin(.@gma, .@gmb)) return; + message .@gm$, strcharinfo(0)+" has opened a Treasure Chest."+.@p$; + return; +} + + + + + + |