summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJesusaves <cpntb1@ymail.com>2019-05-23 22:30:29 -0300
committerJesusaves <cpntb1@ymail.com>2019-05-23 22:30:29 -0300
commit47abb1ee1826eeaf2495b52f7b5641ff7de60006 (patch)
tree0c04118a56d2e31d766aea1da1badf44870e441b
parente31d15407908c90fac899f0200b854d7793a3966 (diff)
downloadserverdata-47abb1ee1826eeaf2495b52f7b5641ff7de60006.tar.gz
serverdata-47abb1ee1826eeaf2495b52f7b5641ff7de60006.tar.bz2
serverdata-47abb1ee1826eeaf2495b52f7b5641ff7de60006.tar.xz
serverdata-47abb1ee1826eeaf2495b52f7b5641ff7de60006.zip
*cough cough* I present to you all, the unification of Siege System.
So I can work with all sieges at once.
-rw-r--r--db/constants.conf3
-rw-r--r--npc/012-1/guards.txt188
-rw-r--r--npc/functions/siege.txt105
3 files changed, 178 insertions, 118 deletions
diff --git a/db/constants.conf b/db/constants.conf
index de9185d17..c988fa40a 100644
--- a/db/constants.conf
+++ b/db/constants.conf
@@ -4292,6 +4292,9 @@ constants_db: {
MK_SIEGE_NIVAL: 4
MK_SIEGE_HALIN: 5
+ // Special
+ MK_SIEGE_DURATION: 790
+
comment__: "Report Bug Flags"
RB_NONE: 0
RB_DISPBOTTOM: 1
diff --git a/npc/012-1/guards.txt b/npc/012-1/guards.txt
index 8bb8b517e..8ec5b140f 100644
--- a/npc/012-1/guards.txt
+++ b/npc/012-1/guards.txt
@@ -602,133 +602,85 @@ OnInit:
OnMKSiege:
$@SIEGE_HURNS=rand(1,10);
OnStartSiege:
- siege_setup("014-3");
kamibroadcast(col("WARNING! WARNING! Monster Army marching towards Hurnscald!!",1));
- siege_cast("014-3", .name$, 0, TP_HURNS);
+ do_siege("012-1", "014-3", "HURNS", TP_HURNS, .name$, .siegetime);
initnpctimer;
end;
-// Warmup
-OnTimer70000:
-OnTimer95000:
- siege_cast("012-1", .name$, $@SIEGE_HURNS, TP_HURNS);
-OnTimer35000:
- siege_cast("014-3", .name$, $@SIEGE_HURNS, TP_HURNS);
- end;
-
// Timers
-OnTimer60000:
- siege_setup("012-1");
- siege_cast("014-3", .name$, $@SIEGE_HURNS, TP_HURNS);
- mapannounce("012-1", "##2Message to all Hurnscald NPCs: Take shelter!", bc_map);
- disablenpc "Oscar";
- disablenpc "Gwendolyn";
- disablenpc "Milly";
- disablenpc "LOFBot";
- disablenpc "Locamit";
- disablenpc "Andrei Sakar";
- disablenpc "Luffyx";
- disablenpc "Tezzerin";
- disablenpc "Hinnak";
- disablenpc "Igor";
- disablenpc "Dyrin The Traveler";
- disablenpc "Mahad";
- disablenpc "Jack";
- end;
-
-OnTimer90000:
- siege_cast("012-1", .name$, 0, TP_HURNS);
- siege_cast("014-3", .name$, $@SIEGE_HURNS, TP_HURNS);
- disablenpc "Shoppa Kep";
- disablenpc "Richard";
-
- disablenpc "Celestia";
- disablenpc "Airlia";
- disablenpc "Nicholas";
- disablenpc "Wyara";
- disablenpc "Alan";
- disablenpc "Khafar";
- disablenpc "Melina";
- disablenpc "Helena";
- disablenpc "Rakinorf, Mayor";
- end;
-
-OnTimer196000:
- siege_cast("012-1", .name$, $@SIEGE_HURNS, TP_HURNS);
- end;
-
-OnTimer280000:
- siege_boss("012-1", $@SIEGE_HURNS);
- siege_cast("012-1", .name$, $@SIEGE_HURNS, TP_HURNS);
- end;
-
-// At certain moments, the difficulty rises
-OnTimer310000:
-OnTimer520000:
-OnTimer640000:
- $@SIEGE_HURNS+=1;
-// Spawn each 45s after timer 120, difficulty raisers exempt (same for boss)
-OnTimer220000:
-OnTimer265000:
-//Timer 280000: BOSS WAVE
-//OnTimer310000: difficulty raiser
-OnTimer355000:
-OnTimer400000:
-OnTimer445000:
-OnTimer490000:
-//Timer 520000: difficulty raiser
-OnTimer535000:
-OnTimer580000:
-OnTimer625000:
-//OnTimer640000: difficulty raiser
-OnTimer670000:
- siege_cast("012-1", .name$, $@SIEGE_HURNS, TP_HURNS);
- end;
-
-OnTimer700000:
- mapannounce("012-1", "##1The Monster Army is getting tired of resistance!", bc_map);
- siege_cast("012-1", .name$, $@SIEGE_HURNS, TP_HURNS);
- end;
+OnTimer5000:
+ .siegetime+=5;
+ do_siege("012-1", "014-3", "HURNS", TP_HURNS, .name$, .siegetime);
+ switch (.siegetime) {
+ // Monster Army arrives in town
+ case 60:
+ disablenpc "Oscar";
+ disablenpc "Gwendolyn";
+ disablenpc "Milly";
+ disablenpc "LOFBot";
+ disablenpc "Locamit";
+ disablenpc "Andrei Sakar";
+ disablenpc "Luffyx";
+ disablenpc "Tezzerin";
+ disablenpc "Hinnak";
+ disablenpc "Igor";
+ disablenpc "Dyrin The Traveler";
+ disablenpc "Mahad";
+ disablenpc "Jack";
+ break;
+ // Monster Army deployed in town
+ case 90:
+ disablenpc "Shoppa Kep";
+ disablenpc "Richard";
+
+ disablenpc "Celestia";
+ disablenpc "Airlia";
+ disablenpc "Nicholas";
+ disablenpc "Wyara";
+ disablenpc "Alan";
+ disablenpc "Khafar";
+ disablenpc "Melina";
+ disablenpc "Helena";
+ disablenpc "Rakinorf, Mayor";
+ break;
+ // Monster army have withdrawn completly
+ case MK_SIEGE_DURATION:
+ announce(("Hurnscald siege is over!"), bc_all);
+ enablenpc "Gwendolyn";
+ enablenpc "Milly";
+ enablenpc "LOFBot";
+ enablenpc "Locamit";
+ enablenpc "Andrei Sakar";
+ enablenpc "Luffyx";
+ enablenpc "Tezzerin";
+ enablenpc "Hinnak";
+ enablenpc "Igor";
+ enablenpc "Dyrin The Traveler";
+ enablenpc "Mahad";
+ enablenpc "Jack";
+ enablenpc "Shoppa Kep";
+ enablenpc "Richard";
+ enablenpc "Celestia";
+ enablenpc "Airlia";
+ enablenpc "Nicholas";
+ enablenpc "Wyara";
+ enablenpc "Alan";
+ enablenpc "Khafar";
+ enablenpc "Melina";
+ enablenpc "Helena";
+ enablenpc "Rakinorf, Mayor";
+ enablenpc "Oscar";
+ stopnpctimer;
+ end;
+ break;
+ }
-OnTimer760000:
- $@MK_SCENE=MK_NONE;
- $@MK_AGGRO=$@MK_AGGRO/20;
- mapannounce("012-1", "##1The Monster King army is preparing to withdraw!", bc_map);
- end;
-OnTimer790000:
- siege_revert("012-1");
- siege_revert("014-3");
- enablenpc("Mana Stone");
- $@SIEGE_HURNS=0;
- announce(("Hurnscald siege is over!"), bc_all);
- enablenpc "Gwendolyn";
- enablenpc "Milly";
- enablenpc "LOFBot";
- enablenpc "Locamit";
- enablenpc "Andrei Sakar";
- enablenpc "Luffyx";
- enablenpc "Tezzerin";
- enablenpc "Hinnak";
- enablenpc "Igor";
- enablenpc "Dyrin The Traveler";
- enablenpc "Mahad";
- enablenpc "Jack";
- enablenpc "Shoppa Kep";
- enablenpc "Richard";
- enablenpc "Celestia";
- enablenpc "Airlia";
- enablenpc "Nicholas";
- enablenpc "Wyara";
- enablenpc "Alan";
- enablenpc "Khafar";
- enablenpc "Melina";
- enablenpc "Helena";
- enablenpc "Rakinorf, Mayor";
- enablenpc "Oscar";
- stopnpctimer;
+ // Loop again
+ initnpctimer;
end;
OnInit:
+ .siegetime=0;
end;
}
diff --git a/npc/functions/siege.txt b/npc/functions/siege.txt
index 7071a68f1..9d6b479d7 100644
--- a/npc/functions/siege.txt
+++ b/npc/functions/siege.txt
@@ -165,6 +165,26 @@ function script siege_setup {
return;
}
+// Check if boss was killed or not
+// siege_check ( map )
+function script siege_check {
+ .@m$=getarg(0);
+ .@mb=0;
+
+ .@mb+=mobcount(.@m$, "#SiegeCtrl::OnSergeantDeath");
+ .@mb+=mobcount(.@m$, "#SiegeCtrl::OnLieutenantDeath");
+ .@mb+=mobcount(.@m$, "#SiegeCtrl::OnCaptainDeath");
+ .@mb+=mobcount(.@m$, "#SiegeCtrl::OnColonelDeath");
+ .@mb+=mobcount(.@m$, "#SiegeCtrl::OnGeneralDeath");
+
+ // Players failed, so reduce score in 1
+ if (.@mb) {
+ $MK_TEMPVAR-=1;
+ kamibroadcast("Players failed to defend the city!!"+.@mb);
+ }
+ return;
+}
+
// Revert what siege_setup did
// siege_revert ( map )
function script siege_revert {
@@ -323,6 +343,91 @@ function script siege_cast {
}
+////////////////////////////////////////////
+// Utility Function
+// do_siege ( town, outskirts, varcode, flag, npc, timer )
+function script do_siege {
+ .@m$=getarg(0);
+ .@o$=getarg(1);
+ .@c$=getarg(2);
+ .@tp=getarg(3);
+ .@n$=getarg(4);
+ .@t=getarg(5);
+
+ switch (.@t) {
+ // Warmup
+ case 70:
+ case 95:
+ siege_cast(.@m$, .@n$, getd("$@SIEGE_"+.@c$), .@tp);
+ case 35:
+ siege_cast(.@o$, .@n$, getd("$@SIEGE_"+.@c$), .@tp);
+ break;
+ // Setup and casts
+ case 0:
+ siege_setup(.@o$);
+ siege_cast("014-3", .name$, 0, TP_HURNS);
+ break;
+ case 60:
+ siege_setup(.@m$);
+ siege_cast(.@o$, .@n$, 0, .@tp);
+ mapannounce(.@m$, "##2Message to all NPCs in town: Take shelter!", bc_map);
+ break;
+ case 90:
+ siege_cast(.@m$, .@n$, getd("$@SIEGE_"+.@c$), .@tp);
+ siege_cast(.@o$, .@n$, getd("$@SIEGE_"+.@c$), .@tp);
+ break;
+ // Boss stage
+ case 280:
+ siege_boss(.@m$, getd("$@SIEGE_"+.@c$));
+ siege_cast(.@m$, .@n$, getd("$@SIEGE_"+.@c$), .@tp);
+ break;
+ // Difficulty Raisers
+ case 310:
+ case 520:
+ case 640:
+ .@varsig=getd("$@SIEGE_"+.@c$);
+ setd("$@SIEGE_"+.@c$, .@varsig+1);
+ // Regular flow
+ case 195:
+ case 220:
+ case 265:
+ //case 280: BOSS WAVE
+ //case 310: difficulty raiser
+ case 355:
+ case 400:
+ case 445:
+ case 490:
+ //case 520: difficulty raiser
+ case 535:
+ case 580:
+ case 625:
+ //case 640: difficulty raiser
+ case 670:
+ siege_cast(.@m$, .@n$, getd("$@SIEGE_"+.@c$), .@tp);
+ break;
+ // Ending flow
+ case 700:
+ mapannounce("012-1", "##1The Monster Army is preparing the retreat in about one minute!", bc_map);
+ siege_cast(.@m$, .@n$, getd("$@SIEGE_"+.@c$), .@tp);
+ break;
+ case 760:
+ mapannounce("012-1", "##1The Monster Army is withdrawing within 30 seconds!", bc_map);
+ $@MK_SCENE=MK_NONE;
+ $@MK_AGGRO=$@MK_AGGRO/20;
+ break;
+ // Check db/constants.conf to change this value!
+ case MK_SIEGE_DURATION:
+ siege_check(.@m$);
+ siege_revert(.@m$);
+ siege_revert(.@o$);
+ enablenpc("Mana Stone");
+ setd("$@SIEGE_"+.@c$, 0);
+ break;
+ }
+
+ return;
+}
+
// Utility NPC
- script #SiegeCtrl NPC_HIDDEN,{
end;