summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJesusaves <cpntb1@ymail.com>2020-04-30 14:34:35 -0300
committerJesusaves <cpntb1@ymail.com>2020-04-30 14:34:35 -0300
commit15e75f3b96e0e5e156b5511590f3d4d7d10d5912 (patch)
tree8167e0246b85d1a0985c4130b92c095171cba1d6
parent97bc84d1f0d8aa72d965cbc8b6695d581ac90e09 (diff)
downloadserverdata-15e75f3b96e0e5e156b5511590f3d4d7d10d5912.tar.gz
serverdata-15e75f3b96e0e5e156b5511590f3d4d7d10d5912.tar.bz2
serverdata-15e75f3b96e0e5e156b5511590f3d4d7d10d5912.tar.xz
serverdata-15e75f3b96e0e5e156b5511590f3d4d7d10d5912.zip
Prototype for Kamelot Chests
The treasure chests are Iilia-level
-rw-r--r--db/re/item_db.conf6
-rw-r--r--npc/014-4/kamelot.txt5
-rw-r--r--npc/042-0/arthur.txt6
-rw-r--r--npc/042-5/ctrl.txt80
-rw-r--r--npc/042-6/_import.txt1
-rw-r--r--npc/042-6/ctrl.txt123
-rw-r--r--npc/functions/treasure.txt6
7 files changed, 215 insertions, 12 deletions
diff --git a/db/re/item_db.conf b/db/re/item_db.conf
index f0b32508c..1ff1f585c 100644
--- a/db/re/item_db.conf
+++ b/db/re/item_db.conf
@@ -3961,8 +3961,8 @@ item_db: (
},
{
Id: 756
- AegisName: "CryptKey"
- Name: "Crypt Key"
+ AegisName: "KamelotKey"
+ Name: "Kamelot Key"
Type: "IT_ETC"
Buy: 50
Sell: 10
@@ -15659,6 +15659,8 @@ item_db: (
}
Script: <"
mercenary_create 1211, 3600000;
+ if (!rand2(5))
+ delitem 7594, 1;
">
},
// Additional usable items
diff --git a/npc/014-4/kamelot.txt b/npc/014-4/kamelot.txt
index f6cf38488..c549741f9 100644
--- a/npc/014-4/kamelot.txt
+++ b/npc/014-4/kamelot.txt
@@ -20,7 +20,7 @@
// 16 - Magic Seal Broken
// 32 - Boss cutscene seen (presumably, victory)
// 64 - Boss defeated
-// $KAMELOT_KEY [ guild_id ] = (bitmask) Keys and Lockpicks
+// $KAMELOT_KEYMASK [ guild_id ] = (bitmask) Keys and Lockpicks
// 1 - Treasure A (Boss Room key)
// 2 - Treasure B
// 4 - Treasure C
@@ -42,7 +42,7 @@
// 65536 - Cell XII 38,27
// If more than 12 players, loop back
-// $KAMELOT_KEYMASK [ guild_id ] = Which bit was assigned as the key
+// $KAMELOT_KEY [ guild_id ] = Which bit was assigned as the key
// $KAMELOT_COOLDOWN [ guild_id ] = Last attempt (weekly attempts)
// KamelotCleanup(guildid)
@@ -52,6 +52,7 @@ function script KamelotCleanup {
$@KAMELOT_WAVE[.@g]=0;
$KAMELOT_MX[.@g]=0;
$KAMELOT_PC[.@g]=0;
+ $KAMELOT_KEY[.@g]=0;
$KAMELOT_QUEST[.@g]=0;
$KAMELOT_KEYMASK[.@g]=0;
return;
diff --git a/npc/042-0/arthur.txt b/npc/042-0/arthur.txt
index f2a7e870b..de243b33d 100644
--- a/npc/042-0/arthur.txt
+++ b/npc/042-0/arthur.txt
@@ -75,7 +75,7 @@ L_Quest:
$KAMELOT_QUEST[.@g]=1;
$KAMELOT_MX[.@g]=getguildavg(.@g);
$KAMELOT_PC[.@g]=$@guildmembercount;
- $KAMELOT_KEYMASK[.@g]=any(1,2,4,8);
+ $KAMELOT_KEY[.@g]=any(1,2,4,8);
if (!is_admin()) // FIXME: This should be unconditional
$KAMELOT_COOLDOWN[.@g] = gettimeparam(GETTIME_WEEKDAY);
mapannounce(getmap(), "##1KAMELOT CASTLE, GUILD DUNGEON: MISSION START!", bc_map);
@@ -343,7 +343,7 @@ L_Hint:
next;
guinevereSpawn(3);
mesn;
- switch ($KAMELOT_KEYMASK[.@g]) {
+ switch ($KAMELOT_KEY[.@g]) {
case 1:
.@path$=l("West"); break;
case 2:
@@ -353,7 +353,7 @@ L_Hint:
case 8:
.@path$=l("East"); break;
default:
- .@path$=l("ERROR, REPORT ME: Invalid: %d", $KAMELOT_KEYMASK[.@g]); break;
+ .@path$=l("ERROR, REPORT ME: Invalid: %d", $KAMELOT_KEY[.@g]); break;
}
mesq l("The key is on the sewer %s path. Be careful. May the light be with you.", b(.@path$));
if ($KAMELOT_QUEST[.@g] & 2)
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;
+}
+
+
+
+
+
+
diff --git a/npc/042-6/_import.txt b/npc/042-6/_import.txt
index 03a6a9978..5b4626810 100644
--- a/npc/042-6/_import.txt
+++ b/npc/042-6/_import.txt
@@ -1,3 +1,4 @@
// Map 042-6: Camelot Sewer East Path
// This file is generated automatically. All manually added changes will be removed when running the Converter.
"npc/042-6/_warps.txt",
+"npc/042-6/ctrl.txt",
diff --git a/npc/042-6/ctrl.txt b/npc/042-6/ctrl.txt
new file mode 100644
index 000000000..99ce0732b
--- /dev/null
+++ b/npc/042-6/ctrl.txt
@@ -0,0 +1,123 @@
+// TMW 2 Script
+// Author:
+// Jesusalva
+// Micksha
+// Description:
+// Controls sewers.
+// FIXME: The warps back should only work if treasure was found
+// Spawn monsters and respawns them.
+
+// A simple random treasure chest - to be sure players were introduced to this
+// awesome system. Same rules as any treasure box still applies.
+042-6,65,89,0 script #chest_0426 NPC_CHEST,{
+ function monster0426;
+ KamelotTreasure();
+ specialeffect(.dir == 0 ? 24 : 25, AREA, getnpcid()); // closed ? opening : closing
+ close;
+
+OnInit:
+ .distance = 2;
+ end;
+
+OnInstanceInit:
+ // Yes, we just hope it works out of box
+ explode(.@map$, .map$, "@");
+ .@g=atoi(.@map$[1]);
+ if (.@g < 1) {
+ debugmes "[ERROR] [KAMELOT] Unable to spawn for Kamelot %s", .map$;
+ debugmes "[ERROR] [KAMELOT] Using dummy data (returned: %d)", .@g;
+ .@g=0;
+ }
+ debugmes "Spawning monsters for guild %d", .@g;
+ .@mx=getguildavg(.@g);
+ monster0426(1, 20, 20, 115, 100, .@mx);
+ monster0426(4, 20, 51, 51, 71, .@mx);
+ monster0426(5, 85, 56, 115, 100, .@mx);
+ monster0426(2, 79, 40, 97, 52, .@mx);
+ monster0426(5, 51, 20, 80, 50, .@mx);
+
+ // Boss monster
+ // TODO
+
+ // Neutral monsters
+ areamonster(.map$, 20, 20, 115, 100, strmobinfo(1, YellowSlime), YellowSlime, 5);
+ areamonster(.map$, 20, 20, 115, 100, strmobinfo(1, ManaGhost), ManaGhost, max(1, .@mx/10));
+
+ // Bonus monsters
+ if (!rand2(2))
+ areamonster(.map$, 20, 20, 115, 100, strmobinfo(1, MagicBif), MagicBif, 1);
+ if (!rand2(2))
+ areamonster(.map$, 20, 20, 115, 100, strmobinfo(1, SilverChest), SilverChest, 1);
+ if (!rand2(2))
+ areamonster(.map$, 20, 20, 115, 100, strmobinfo(1, BronzeChest), BronzeChest, 1);
+ // Next time I promise a Whirly Bird >.>
+ end;
+
+OnKillMob:
+ if (!playerattached())
+ goto OnRespawn;
+ // Maybe a reward is due
+ .@g=getcharid(2);
+ if (.@g < 1) percentheal -100, -100;
+ getexp $KAMELOT_MX[.@g]*7, $KAMELOT_MX[.@g]*4;
+ .@delay=max(3000, 21000-$KAMELOT_PC[.@g]*1000);
+ // FALLTHROUGH
+
+OnRespawn:
+ .@delay=(.@delay ? .@delay : 3000);
+ sleep(.@delay);
+ // Yes, we just hope it works out of box
+ explode(.@map$, .map$, "@");
+ .@g=atoi(.@map$[1]);
+ if (.@g < 1) {
+ debugmes "[ERROR] [KAMELOT] Unable to respawn for Kamelot %s", .map$;
+ .@g=0;
+ }
+ monster0426(1, 20, 20, 115, 100, $KAMELOT_MX[.@g]);
+ end;
+
+function monster0426 {
+ .@label$=instance_npcname(.name$)+"::OnKillMob";
+ .@gcount=getarg(0);
+ .@x1=getarg(1);
+ .@y1=getarg(2);
+ .@x2=getarg(3);
+ .@y2=getarg(4);
+ .@avg=getarg(5);
+ .@m$=instance_mapname("042-6");
+ //debugmes "Total %d, map %s (power %d)", .@gcount, .@m$, .@avg;
+ freeloop(true);
+ for (.@i=0; .@i < .@gcount; .@i++) {
+ .@mobId=any(CursedSoldier, CursedArcher); // 50-50 ratio
+ .@mob=areamonster(.@m$, .@x1, .@y1, .@x2, .@y2, strmobinfo(1, .@mobId), .@mobId, 1, .@label$);
+ // Reconfigure the monster
+ setunitdata(.@mob, UDT_LEVEL, .@avg+1);
+ setunitdata(.@mob, UDT_STR, 1+.@avg*6/10);
+ setunitdata(.@mob, UDT_AGI, 1+.@avg*5/10);
+ setunitdata(.@mob, UDT_VIT, 1+.@avg*5/10);
+ setunitdata(.@mob, UDT_INT, 1+.@avg*6/10);
+ setunitdata(.@mob, UDT_DEX, 1+.@avg*6/10);
+ setunitdata(.@mob, UDT_LUK, 1+.@avg*5/10);
+ setunitdata(.@mob, UDT_ADELAY, 1372);
+ setunitdata(.@mob, UDT_ATKRANGE, (.@mobId == CursedArcher ? any(6,7) : any(1,2)));
+ // Battle Status
+ setunitdata(.@mob, UDT_MAXHP, .@avg*40);
+ setunitdata(.@mob, UDT_HP, .@avg*40);
+ setunitdata(.@mob, UDT_ATKMIN, .@avg*52/10);
+ setunitdata(.@mob, UDT_ATKMAX, .@avg*72/10);
+ setunitdata(.@mob, UDT_DEF, 1+.@avg*12/10);
+ setunitdata(.@mob, UDT_MDEF, 1+.@avg*8/10);
+ setunitdata(.@mob, UDT_HIT, .@avg*6); // Advised: x3
+ setunitdata(.@mob, UDT_FLEE, .@avg*45/10); // Advised: x4
+ // Critical calculation
+ .@min=15;
+ .@max=max(.@min, min(40, .@avg/3));
+ setunitdata(.@mob, UDT_CRIT, rand2(.@min, .@max));
+ // Loop through
+ }
+ freeloop(false);
+ return;
+ }
+
+}
+
diff --git a/npc/functions/treasure.txt b/npc/functions/treasure.txt
index f9a02186b..948492793 100644
--- a/npc/functions/treasure.txt
+++ b/npc/functions/treasure.txt
@@ -35,11 +35,11 @@ function script TreasureBox {
// There's also rares (9%), uncommons (30%) and commons (60%)
.@ur_rate=min(10, (TREASURE_OPEN/10));
if (.@t % 149 == 0 || .@r < .@ur_rate)
- .@loot=any(AtroposMixture, GoldenApple, DivineApple, MercBoxA, MoveSpeedPotion, Shemagh, EverburnPowder, IridiumOre, PlatinumOre, YerbaMate);
+ .@loot=any(AtroposMixture, GoldenApple, DivineApple, MercBoxC, MoveSpeedPotion, Shemagh, EverburnPowder, IridiumOre, PlatinumOre, YerbaMate);
else if (.@t % 50 == 0 || .@r < 100)
- .@loot=any(SmokeGrenade, SnakeEgg, LachesisBrew, ArrowAmmoBox, GoldPieces, SilverGift, TerraniteOre, LeadOre, TinOre, SilverOre, GoldOre, TitaniumOre, FluoPowder, EquipmentBlueprintC, AlchemyBlueprintC, AlchemyBlueprintD, AncientBlueprint, JasmineTea);
+ .@loot=any(MercBoxB, SmokeGrenade, SnakeEgg, LachesisBrew, ArrowAmmoBox, GoldPieces, SilverGift, TerraniteOre, LeadOre, TinOre, SilverOre, GoldOre, TitaniumOre, FluoPowder, EquipmentBlueprintC, AlchemyBlueprintC, AlchemyBlueprintD, AncientBlueprint, JasmineTea);
else if (.@r < 1000 || .@t == 0)
- .@loot=any(MoubooSteak, ClothoLiquor, Coal, RedPlushWine, HastePotion, CoinBag, StrengthPotion, Dagger, BronzeGift, IronOre, CopperOre, BlueDye, EquipmentBlueprintB, AlchemyBlueprintB, AlchemyBlueprintC, OolongTea);
+ .@loot=any(MercBoxA, MoubooSteak, ClothoLiquor, Coal, RedPlushWine, HastePotion, CoinBag, StrengthPotion, Dagger, BronzeGift, IronOre, CopperOre, BlueDye, EquipmentBlueprintB, AlchemyBlueprintB, AlchemyBlueprintC, OolongTea);
else if (.@r < 5000)
.@loot=any(Croconut, Potatoz, MoubooSteak, ClothoLiquor, Coal, SmallMushroom, HastePotion, StrengthPotion, WoodenLog, LeatherPatch, Beer, EquipmentBlueprintA, EquipmentBlueprintB, AlchemyBlueprintA, SpearmintTea, TreasureMap);
else