summaryrefslogtreecommitdiff
path: root/npc/042-5/ctrl.txt
diff options
context:
space:
mode:
Diffstat (limited to 'npc/042-5/ctrl.txt')
-rw-r--r--npc/042-5/ctrl.txt80
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;
+}
+
+
+
+
+
+