summaryrefslogtreecommitdiff
path: root/npc/052-2
diff options
context:
space:
mode:
authorJesusaves <cpntb1@ymail.com>2021-04-09 13:33:57 -0300
committerJesusaves <cpntb1@ymail.com>2021-04-09 13:33:57 -0300
commitcf18ce071c79ae37e14ea38943e0b1d88da70a7b (patch)
treef9159c9b60b3018300dd22ffba0d797bc5e828e5 /npc/052-2
parent8a4bf716002a017de77fe7df301ef8e4aaf00a2e (diff)
downloadserverdata-cf18ce071c79ae37e14ea38943e0b1d88da70a7b.tar.gz
serverdata-cf18ce071c79ae37e14ea38943e0b1d88da70a7b.tar.bz2
serverdata-cf18ce071c79ae37e14ea38943e0b1d88da70a7b.tar.xz
serverdata-cf18ce071c79ae37e14ea38943e0b1d88da70a7b.zip
Override
Diffstat (limited to 'npc/052-2')
-rw-r--r--npc/052-2/_import.txt8
-rwxr-xr-xnpc/052-2/chest.txt167
-rwxr-xr-xnpc/052-2/janitor.txt32
-rwxr-xr-xnpc/052-2/lobby.txt352
-rwxr-xr-xnpc/052-2/mapflags.txt2
-rwxr-xr-xnpc/052-2/partyroom.txt267
-rwxr-xr-xnpc/052-2/storage.txt179
7 files changed, 1007 insertions, 0 deletions
diff --git a/npc/052-2/_import.txt b/npc/052-2/_import.txt
new file mode 100644
index 00000000..07ba8d12
--- /dev/null
+++ b/npc/052-2/_import.txt
@@ -0,0 +1,8 @@
+// Map 052-2: Illia forsaken inn
+// This file is generated automatically. All manually added changes will be removed when running the Converter.
+"npc/052-2/chest.txt",
+"npc/052-2/janitor.txt",
+"npc/052-2/lobby.txt",
+"npc/052-2/mapflags.txt",
+"npc/052-2/partyroom.txt",
+"npc/052-2/storage.txt",
diff --git a/npc/052-2/chest.txt b/npc/052-2/chest.txt
new file mode 100755
index 00000000..ff632e1f
--- /dev/null
+++ b/npc/052-2/chest.txt
@@ -0,0 +1,167 @@
+
+052-2,136,73,0 script Chest#illia NPC111,{
+ @step = 8;
+ if ($@illia_progress < @step) goto L_ShouldNotBeHere;
+ if (@illia_got_rewards > 2) end;
+ if (@illia_got_rewards == 2) goto L_AlreadyGotReward;
+ if (@illia_current_num_rewards > 0) goto L_ResumePick;
+ @illia_current_num_rewards = 0;
+ mes "You find an opened chest which seems full of equipments.";
+ next;
+ mes "You realize again you were not the first one to visit this place. But where the others failed, you succeeded.";
+ goto L_Pick;
+
+L_ShouldNotBeHere:
+ heal -Hp, 0;
+ end;
+
+OnInit:
+ setarray $@illia_common_rewards$, "SteelShield", "WarlordHelmet", "KnightsHelmet", "InfantryHelmet", "CrusadeHelmet", "ChainmailShirt", "LightPlatemail", "WarlordPlate", "Setzer", "RockKnife", "WarlordBoots", "ForestArmor", "ForestBow", "WoodenStaff", "WizardHat", "WoodenShield", "ShortSword", "SilkRobe", "LeatherGloves", "BoneKnife", "JeansChaps";
+ setarray $@illia_common_rewards_n$, "Steel Shield", "Warlord Helmet", "Knights Helmet", "Infantry Helmet", "Crusade Helmet", "Chainmail Shirt", "Light Platemail", "Warlord Plate", "Setzer", "Rock Knife", "Warlord Boots", "Forest Armor", "Forest Bow", "Wooden Staff", "Wizard Hat", "Wooden Shield", "Short Sword", "Silk Robe", "Leather Gloves", "Bone Knife", "Jeans Chaps";
+ setarray $@illia_unique_rewards$, "BullHelmet", "BansheeBow", "HeartOfIsis", "LazuriteRobe";
+ setarray $@illia_unique_rewards_n$, "Bull Helmet", "Banshee Bow", "Heart of Isis", "Lazurite Robe";
+ end;
+
+L_ResumePick:
+ mes "Ok. I should continue to dig in this chest...";
+ menu
+ "... and quickly.", L_GetReward,
+ "... or maybe not. I am out of time.", L_AskLeaving,
+ "... but I can't carry more stuff.", L_AskLeaving,
+ "... no, wait a minute.", L_close;
+
+L_Pick:
+ menu
+ "Let's take what I deserve for all this.", L_GetReward,
+ "Wait.", L_close;
+
+L_GetReward:
+ if (@illia_got_rewards == 0)
+ goto L_GetCommonReward;
+ if (@illia_got_rewards == 1)
+ goto L_GetUniqueReward;
+ goto L_close;
+
+L_GetCommonReward:
+ if (@illia_current_num_rewards == $@illia_num_common_reward_items)
+ goto L_RewardDone;
+ getinventorylist;
+ @index = rand(getarraysize($@illia_common_rewards$));
+ @reward$ = $@illia_common_rewards$[@index];
+ if ((checkweight(@reward$, 1) == 0) || (@inventorylist_count == 100))
+ goto L_InventoryNoSpace;
+ @illia_current_num_rewards = @illia_current_num_rewards + 1;
+ getitem @reward$, 1;
+ mes "You found a " + $@illia_common_rewards_n$[@index] + "!";
+ @reward$ = "";
+ goto L_GetCommonReward;
+
+L_GetUniqueReward:
+ if (@illia_current_num_rewards == $@illia_num_unique_reward_items)
+ goto L_RewardDone;
+ if (Illia_Uniques_Count >= 2)
+ goto L_GetUniqueReward2;
+ getinventorylist;
+ @index = rand(getarraysize($@illia_unique_rewards$));
+ @reward$ = $@illia_unique_rewards$[@index];
+ if ((checkweight(@reward$, 1) == 0) || (@inventorylist_count == 100))
+ goto L_InventoryNoSpace;
+ next;
+ mes "You notice an interesting shape hidden under a cover...";
+ next;
+ @illia_current_num_rewards = @illia_current_num_rewards + 1;
+ getitem @reward$, 1;
+ mes "You found a " + $@illia_unique_rewards_n$[@index] + "!";
+ Illia_Uniques_Count = Illia_Uniques_Count + 1;
+ @reward$ = "";
+ goto L_GetUniqueReward;
+
+L_GetUniqueReward2:
+ next;
+ mes "You find a bunch of gold pieces!";
+ next;
+ Zeny = Zeny + 100000*($@illia_num_unique_reward_items - @illia_current_num_rewards);
+ getexp 200000*($@illia_num_unique_reward_items - @illia_current_num_rewards), 0;
+ @illia_current_num_rewards = $@illia_num_unique_reward_items;
+ goto L_GetUniqueReward;
+
+L_AlreadyGotReward:
+ mes "I already took my part.";
+ next;
+ goto L_AskLeaving;
+
+L_RewardDone:
+ @illia_got_rewards = @illia_got_rewards + 1;
+ @illia_current_num_rewards = 0;
+ next;
+ if (@illia_got_rewards == 1)
+ goto L_GetUniqueReward;
+ goto L_AskLeaving; // @illia_got_rewards == 2
+
+L_InventoryNoSpace:
+ mes "You cannot carry more stuff. Make some room first.";
+ close;
+
+L_AskLeaving:
+ mes "It's time to leave this place now.";
+ next;
+ // Force the hero to leave last, as this event triggers the end of the quest
+ // as well as some dialogs from Valia, when the hero returns.
+ if (strcharinfo(0) == $@iLLIA_HERO$ && getareausers("052-2", 19, 8, 137, 88) > 1)
+ goto L_WaitHelpersLeave;
+ goto L_PrepareLeaving;
+
+L_WaitHelpersLeave:
+ mes "However, I'd better wait my friends leave before I do.";
+ next;
+ mes "I prefer to know they left safely this place.";
+ close;
+
+L_PrepareLeaving:
+ mes "Use Valia's ring to teleport now?";
+ menu
+ "Yes. Time to make her pay for her trick!", L_Leave,
+ "No, I still need to see things here.", L_close;
+
+L_Leave:
+ @illia_got_rewards = 3;
+ @illia_current_num_rewards = 0;
+ addtimer 1000, "Chest#illia::OnMsg1";
+ addtimer 4000, "Chest#illia::OnMsg2";
+ addtimer 7000, "Chest#illia::OnMsg3";
+ addtimer 9000, "Chest#illia::OnFx";
+ addtimer 10000, "Chest#illia::OnRing";
+ close;
+
+OnMsg1:
+ message strcharinfo(0), "At the moment you are wearing the ring, you start to feel dizzy...";
+ end;
+
+OnMsg2:
+ message strcharinfo(0), "Who is Luvia? Something isn't right... It looks like your memory is rewritten.";
+ end;
+
+OnMsg3:
+ message strcharinfo(0), "Damn, this ring! That Valia! Someone...";
+ end;
+
+OnFx:
+ misceffect FX_MAGIC_BLUE_TELEPORT, strcharinfo(0);
+ end;
+
+OnRing:
+ warp "007-2",31 + rand(0,2),23 + rand(0,2);
+ if (strcharinfo(0) == $@iLLIA_HERO$)
+ goto L_ScheduleEnd;
+ end;
+
+L_ScheduleEnd:
+ $@iLLIA_STATUS = 253;
+ startnpctimer "Valia";
+ donpcevent "#IlliaDaemon::OnCommandToggle";
+ end;
+
+L_close:
+ close;
+
+}
diff --git a/npc/052-2/janitor.txt b/npc/052-2/janitor.txt
new file mode 100755
index 00000000..aedecb61
--- /dev/null
+++ b/npc/052-2/janitor.txt
@@ -0,0 +1,32 @@
+052-2,1,1,0 script #IlliaJanitor5 NPC32767,{
+end;
+
+OnCommandClean:
+ // For security, kill all.
+ killmonster "052-2", "All";
+ npcwarp 1, 1, "Luvia?";
+ end;
+
+}
+
+052-2,1,1,0 script #IlliaJanitor6 NPC32767,{
+end;
+
+OnCommandClean:
+ killmonster "052-2", "#ItemsInvoker::OnDeath";
+ npcwarp 1, 1, "#ItemsInvoker";
+ end;
+
+}
+
+052-2,1,1,0 script #IlliaJanitor7 NPC32767,{
+end;
+
+OnCommandClean:
+ killmonster "052-2", "#LuviaDaemon::OnDeath";
+ killmonster "052-2", "#LuviaDaemon::OnWGD";
+ npcwarp 83, 28, "#LuviaDaemon";
+ npcwarp 88, 15, "Luvia";
+ end;
+
+}
diff --git a/npc/052-2/lobby.txt b/npc/052-2/lobby.txt
new file mode 100755
index 00000000..48fdac03
--- /dev/null
+++ b/npc/052-2/lobby.txt
@@ -0,0 +1,352 @@
+
+052-2,40,19,0 script #InnDoorTrigger NPC32767,2,2,{
+ @step = 5;
+ if ($@illia_progress < @step) goto L_ShouldNotBeHere;
+ if ($@illia_level_5_progress == 8) goto L_Warp;
+ message strcharinfo(0), "A magical field prevents you from going further...";
+ end;
+
+L_Warp:
+ warp "052-2", 23, 71;
+ message strcharinfo(0), "This place is full of dust... *coughs*";
+ end;
+
+L_ShouldNotBeHere:
+ heal -100, 0;
+ end;
+
+}
+
+052-2,33,40,0 script #EntranceTrigger NPC32767,4,2,{
+ @step = 5;
+ if ($@illia_progress < @step) goto L_ShouldNotBeHere;
+ if ($@illia_level_5_progress == 0 && strcharinfo(0) == $@iLLIA_HERO$) goto L_StartVoices;
+ end;
+
+L_StartVoices:
+ $@illia_level_5_progress = 1;
+ donpcevent "#MysteriousVoice::OnCommandStart";
+ end;
+
+L_ShouldNotBeHere:
+ heal -100, 0;
+ end;
+}
+
+052-2,1,1,0 script #LuviaShadow NPC127,{
+end;
+
+OnCommandEscape:
+ initnpctimer;
+ end;
+
+OnTimer100:
+ if ($@illia_level_5_progress != 7)
+ end;
+ npcwarp 39, 35, "#LuviaShadow";
+ misceffect FX_DARK_TELEPORT;
+ npcwarp 1, 1, "Luvia?";
+ end;
+
+OnTimer750:
+ if ($@illia_level_5_progress != 7)
+ end;
+ npcwarp 1, 1, "#LuviaShadow";
+ stopnpctimer;
+ setnpctimer 0;
+ end;
+
+OnCommandInvoke:
+ initnpctimer;
+ end;
+
+OnTimer650:
+ if ($@illia_level_5_progress != 2)
+ end;
+ npcwarp 39, 35, "#LuviaShadow";
+ misceffect FX_EVIL_SUMMON;
+ end;
+
+OnTimer1500:
+ if ($@illia_level_5_progress != 2)
+ end;
+ npcwarp 1, 1, "#LuviaShadow";
+ npcwarp 39, 35, "Luvia?";
+ $@illia_level_5_progress = 3;
+ stopnpctimer;
+ setnpctimer 0;
+ end;
+
+OnNN:
+ message strcharinfo(0), "The last guard is down. Let's go after Luvia now!";
+ end;
+
+}
+
+052-2,1,1,0 script #MysteriousVoice NPC127,{
+end;
+
+OnInit:
+ setarray $@illia_lobby_voices$, "Finally.", "I was...", "Waiting...", "For you!";
+ end;
+
+OnCommandStart:
+ $@illia_lobby_voices_index = 0;
+ initnpctimer;
+ end;
+
+OnTimer2000:
+ if ($@illia_level_5_progress != 1)
+ end;
+ npcwarp rand(30,42), rand(32,38), "?";
+ donpcevent "?::OnCommandTalk";
+ end;
+
+OnTimer3000:
+ if ($@illia_level_5_progress != 1)
+ end;
+ npcwarp 1, 1, "?";
+ $@illia_lobby_voices_index = $@illia_lobby_voices_index + 1;
+ // FIXME Uncomment next line, comment the next next, when getarraysize is repaired.
+ //if ($@illia_lobby_voices_index < getarraysize($@illia_lobby_voices$)) goto L_Continue;
+ if ($@illia_lobby_voices_index < 4)
+ goto L_Continue;
+ // End the process
+ stopnpctimer;
+ setnpctimer 0;
+ $@illia_lobby_voices_index = 0;
+ $@illia_level_5_progress = 2;
+ donpcevent "#LuviaShadow::OnCommandInvoke";
+ end;
+
+L_Continue:
+ setnpctimer 0;
+ end;
+
+}
+
+052-2,1,1,0 script ? NPC127,{
+end;
+
+OnCommandTalk:
+ npctalk strnpcinfo(0), $@illia_lobby_voices$[$@illia_lobby_voices_index];
+ end;
+
+}
+
+052-2,1,1,0 script Luvia? NPC371,2,2,{
+ if ($@illia_level_5_progress != 3) end;
+ if (isin("052-2", 37,36, 41,39)) goto L_HandleTalk;
+ // Notify too far
+ mes "You see a strange and frightening, yet beautiful woman.";
+ if (strcharinfo(0) == $@iLLIA_HERO$)
+ mes "Maybe she knows something about this place.";
+ close;
+
+L_HandleTalk:
+ if (strcharinfo(0) == $@iLLIA_HERO$)
+ goto L_TalkToHero;
+ goto L_TalkToHelper;
+
+L_TalkToHelper:
+ mes "She gives you a quick look then gives her attention to " + $@iLLIA_HERO$ + ".";
+ close;
+
+L_TalkToHero:
+ mes "Are you Luvia? Your sister Valia sent me to save you! Where is Ismuth?";
+ next;
+ $@illia_level_5_progress = 4;
+ initnpctimer;
+ close;
+
+OnTimer1500:
+ if ($@illia_level_5_progress != 4)
+ end;
+ npctalk strnpcinfo(0), "Yes " + $@iLLIA_HERO$ + ", I am Luvia.";
+ end;
+
+OnTimer4500:
+ if ($@illia_level_5_progress != 4)
+ end;
+ npctalk strnpcinfo(0), "How nice of all of you to have come to save me!";
+ end;
+
+OnTimer7500:
+ if ($@illia_level_5_progress != 4)
+ end;
+ npctalk strnpcinfo(0), "But I fear...";
+ end;
+
+OnTimer10500:
+ if ($@illia_level_5_progress != 4)
+ end;
+ npctalk strnpcinfo(0), "... that you are mistaken about who has to be saved!";
+ end;
+
+OnTimer13500:
+ if ($@illia_level_5_progress != 4)
+ end;
+ npctalk strnpcinfo(0), "Don't make these faces...";
+ end;
+
+OnTimer16500:
+ if ($@illia_level_5_progress != 4)
+ end;
+ npctalk strnpcinfo(0), "Valia is just helping me by sending new soldiers for my personal army!";
+ end;
+
+OnTimer21500:
+ if ($@illia_level_5_progress != 4)
+ end;
+ npctalk strnpcinfo(0), "So, if I may... Let's see what you are made of!";
+ end;
+
+OnTimer24500:
+ if ($@illia_level_5_progress != 4)
+ end;
+ npctalk strnpcinfo(0), "Demonotis!";
+ misceffect FX_EVIL_SUMMON;
+ callsub S_GetHeroRect;
+ areamonster "052-2", $@illia_lobby_x1, $@illia_lobby_y1, $@illia_lobby_x2, $@illia_lobby_y2, "", 1101, 20 + 16 - 480/(30+$Illia_Luvia_Harvest), "Luvia?::OnDSDeath";
+ callsub S_ClearHeroRect;
+ end;
+
+OnTimer44000:
+ if ($@illia_level_5_progress != 4)
+ end;
+ npctalk strnpcinfo(0), "Demonotis!";
+ misceffect FX_EVIL_SUMMON;
+ callsub S_GetHeroRect;
+ areamonster "052-2", $@illia_lobby_x1, $@illia_lobby_y1, $@illia_lobby_x2, $@illia_lobby_y2, "", 1101, 28 + 16 - 480/(30+$Illia_Luvia_Harvest), "Luvia?::OnDSDeath";
+ callsub S_ClearHeroRect;
+ end;
+
+OnTimer77000:
+ if ($@illia_level_5_progress != 4)
+ end;
+ npctalk strnpcinfo(0), "Demonotis!";
+ misceffect FX_EVIL_SUMMON;
+ callsub S_GetHeroRect;
+ areamonster "052-2", $@illia_lobby_x1, $@illia_lobby_y1, $@illia_lobby_x2, $@illia_lobby_y2, "", 1101, 42 + 16 - 480/(30+$Illia_Luvia_Harvest), "Luvia?::OnDSDeath";
+ callsub S_ClearHeroRect;
+ // That was the last spawn: reset the timer to start the CheckInvoke loop.
+ $@illia_level_5_progress = 5;
+ setnpctimer 0;
+ end;
+
+OnTimer6500:
+ if ($@illia_level_5_progress != 6)
+ end;
+ npctalk strnpcinfo(0), "Okay. You have some skill.";
+ end;
+
+OnTimer10000:
+ if ($@illia_level_5_progress != 6)
+ end;
+ npctalk strnpcinfo(0), "But that was only the beginning!";
+ end;
+
+OnTimer13000:
+ if ($@illia_level_5_progress != 6)
+ end;
+ npctalk strnpcinfo(0), "I'll leave you in the good hands of your predecessors. Farewell!";
+ end;
+
+OnTimer18500:
+ if ($@illia_level_5_progress != 6)
+ end;
+ npctalk strnpcinfo(0), "Demonotis Major!";
+ misceffect FX_EVIL_SUMMON;
+ misceffect FX_MAGIC_DARK_EXPLOSION;
+ callsub S_GetHeroRect;
+ areamonster "052-2", $@illia_lobby_x1, $@illia_lobby_y1, $@illia_lobby_x2, $@illia_lobby_y2, "", 1103, 8 + (16 - 480/(30+$Illia_Luvia_Harvest))/3, "Luvia?::OnWGDeath";
+ callsub S_ClearHeroRect;
+ end;
+
+OnTimer20000:
+ if ($@illia_level_5_progress != 6)
+ end;
+ $@illia_level_5_progress = 7;
+ donpcevent "#LuviaShadow::OnCommandEscape";
+ setnpctimer 0;
+ end;
+
+OnTimer2000:
+ if ($@illia_progress != 5)
+ goto L_Clear;
+ if ($@illia_level_5_progress != 5 && $@illia_level_5_progress != 7)
+ end;
+ setnpctimer 0;
+ // Mock players randomly (more or less once every 40 secs) and if still enough mobs running after them
+ if ($@illia_level_5_progress == 5 && rand(20) == 0 && (mobcount("052-2", "Luvia?::OnDSDeath") > 20))
+ npctalk strnpcinfo(0), "Ahaha! Run... Run!";
+ if ($@illia_level_5_progress == 5 && (mobcount("052-2", "Luvia?::OnDSDeath") < 0))
+ goto L_AllWavesClear;
+ if ($@illia_level_5_progress == 7 && (mobcount("052-2", "Luvia?::OnWGDeath") < 0))
+ goto L_AllWavesClear;
+ end;
+
+L_Clear:
+ stopnpctimer;
+ setnpctimer 0;
+ killmonster "052-2", "Luvia?::OnDSDeath";
+ killmonster "052-2", "Luvia?::OnWGDeath";
+ end;
+
+L_AllWavesClear:
+ $@illia_level_5_progress = $@illia_level_5_progress + 1;
+ stopnpctimer;
+ setnpctimer 0;
+ if ($@illia_level_5_progress == 6)
+ startnpctimer;
+ if ($@illia_level_5_progress == 8)
+ goto L_ChaseLuvia;
+ end;
+
+L_ChaseLuvia:
+ $@illia_progress = 6;
+ callfunc "UpdateIlliaProgress";
+ $@illia_max_time = $@illia_max_time + 360;
+ areatimer 0, "052-2", 19, 18, 48, 43, 2000, "#LuviaShadow::OnNN";
+ end;
+
+S_GetHeroRect:
+ if (!(attachrid($@iLLIA_HERO_ID)))
+ goto L_Clear;
+ if(!(isin("052-2", 20, 21, 47, 43)))
+ goto L_Clear;
+
+ $@illia_lobby_x = getx();
+ $@illia_lobby_y = gety();
+
+ $@illia_lobby_x1 = $@illia_lobby_x - 12;
+ $@illia_lobby_y1 = $@illia_lobby_y - 8;
+ $@illia_lobby_x2 = $@illia_lobby_x + 12;
+ $@illia_lobby_y2 = $@illia_lobby_y + 8;
+
+ if ($@illia_lobby_x1 < 20)
+ $@illia_lobby_x1 = 20;
+ if ($@illia_lobby_y1 < 19)
+ $@illia_lobby_y1 = 19;
+ if ($@illia_lobby_x2 > 47)
+ $@illia_lobby_x2 = 47;
+ if ($@illia_lobby_y2 > 42)
+ $@illia_lobby_y2 = 42;
+
+ detachrid;
+ return;
+
+S_ClearHeroRect:
+ $@illia_lobby_x1 = 20;
+ $@illia_lobby_y1 = 19;
+ $@illia_lobby_x2 = 47;
+ $@illia_lobby_y2 = 42;
+ return;
+
+OnDSDeath:
+ end;
+
+OnWGDeath:
+ end;
+
+}
diff --git a/npc/052-2/mapflags.txt b/npc/052-2/mapflags.txt
new file mode 100755
index 00000000..d4ce9d64
--- /dev/null
+++ b/npc/052-2/mapflags.txt
@@ -0,0 +1,2 @@
+052-2 mapflag nosave 007-2,36,23
+//052-2 mapflag resave 007-2,36,23
diff --git a/npc/052-2/partyroom.txt b/npc/052-2/partyroom.txt
new file mode 100755
index 00000000..55c9bcdb
--- /dev/null
+++ b/npc/052-2/partyroom.txt
@@ -0,0 +1,267 @@
+
+052-2,88,19,0 script #TriggerDialog NPC32767,3,2,{
+ @step = 7;
+ if ($@illia_progress < @step) goto L_ShouldNotBeHere;
+ if ($@illia_level_7_progress == 0 && strcharinfo(0) == $@iLLIA_HERO$) goto L_SpawnLuvia;
+ end;
+
+L_SpawnLuvia:
+ $@illia_level_7_progress = 1;
+ donpcevent "Luvia::OnCommandStart";
+ end;
+
+L_ShouldNotBeHere:
+ heal -Hp, 0;
+ end;
+
+}
+
+052-2,77,48,0 script #TriggerPlaceLuvia NPC32767,1,1,{
+ if (strcharinfo(0) != $@iLLIA_HERO$) end;
+ if ($@illia_progress == 7 && $@illia_level_7_progress == 0) goto L_PlaceLuvia;
+ end;
+
+L_PlaceLuvia:
+ npcwarp 88, 15, "#LuviaDaemon";
+ npcwarp 88, 15, "Luvia";
+ end;
+
+}
+
+052-2,88,15,0 script Luvia NPC371,{
+ @step = 7;
+ if ($@illia_progress < @step) goto L_ShouldNotBeHere;
+ if ($@illia_level_7_progress == 0 && strcharinfo(0) == $@iLLIA_HERO$) goto L_Start;
+ end;
+
+OnCommandStart:
+ goto L_Start;
+
+L_Start:
+ setnpctimer 0;
+ if ($@illia_level_7_progress == 1)
+ startnpctimer;
+ end;
+
+L_ShouldNotBeHere:
+ heal -Hp, 0;
+ end;
+
+OnTimer1000:
+ npctalk strnpcinfo(0), "Oh well, who thought you would survive so far?";
+ end;
+
+OnTimer5000:
+ npctalk strnpcinfo(0), "All this way, for nothing, only to die from my hands...";
+ end;
+
+OnTimer10000:
+ npctalk strnpcinfo(0), "Don't worry, you will continue to live, for my sake.";
+ end;
+
+OnTimer15000:
+ npctalk strnpcinfo(0), "One piece of advice: get prepared!";
+ stopnpctimer;
+ setnpctimer 0;
+ donpcevent "#LuviaDaemon::OnCommandInvoke";
+ end;
+
+}
+
+052-2,88,15,0 script #LuviaDaemon NPC32767,{
+end;
+
+OnCommandInvoke:
+ setnpctimer 0;
+ if ($@illia_level_7_progress == 1)
+ startnpctimer;
+ end;
+
+OnTimer2000:
+ if ($@illia_level_7_progress != 1) end;
+ misceffect FX_DARK_TELEPORT;
+ // Kill any mob existing on the map
+ // That's to terminate any attempt at players mass-summoning mobs
+ // and hide in a corner of the map.
+ killmonster "052-2", "All";
+ npcwarp 1, 1, "Luvia";
+ end;
+
+OnTimer100:
+ if ($@illia_progress != 7)
+ goto L_Clear;
+ if ($@illia_level_7_progress != 3)
+ end;
+ // Trance mode
+ callsub S_SpawnWitchGuard;
+ end;
+
+OnTimer2600:
+ if ($@illia_level_7_progress != 3)
+ end;
+ npcwarp 1, 1, "#LuviaDaemon";
+ setnpctimer 0;
+ end;
+
+OnTimer5000:
+ if ($@illia_level_7_progress != 1)
+ end;
+ // Warp to the place to spawn luvia once the teleport sequence is finished
+ if (!(attachrid($@iLLIA_HERO_ID)))
+ end;
+ $@illia_luvia_x = getx();
+ $@illia_luvia_y = gety();
+ npcwarp $@illia_luvia_x, $@illia_luvia_y, "#LuviaDaemon";
+
+ detachrid;
+ // This is a fix to force the official mana client to display a npc after a warp.
+ // Note: the manaplus client do not need this.
+ disablenpc "#LuviaDaemon";
+ end;
+
+OnTimer5500:
+ if ($@illia_level_7_progress != 1) end;
+ // See the note above.
+ enablenpc "#LuviaDaemon";
+ misceffect FX_EVIL_SUMMON;
+ misceffect FX_CHANNELLING_CAST;
+ monster "052-2", $@illia_luvia_x, $@illia_luvia_y, "", 1102, 1, "#LuviaDaemon::OnDeath";
+ $@illia_luvia_x = 0;
+ $@illia_luvia_y = 0;
+ end;
+
+OnTimer9000:
+ if ($@illia_level_7_progress != 1) end;
+ set $@illia_luvia_trance_delay, 480; // 8 minutes before turning in trance mode
+ $@illia_witch_guard_threshold = 30 + ($Illia_Luvia_Harvest*3)/5;
+ if ($@illia_witch_guard_threshold > 100)
+ $@illia_witch_guard_threshold = 100;
+ $@illia_level_7_progress = 2;
+ npcwarp 1, 1, "#LuviaDaemon";
+ setnpctimer 0;
+ end;
+
+OnTimer26000:
+ if ($@illia_progress != 7)
+ goto L_Clear;
+ if ($@illia_level_7_progress != 2)
+ end;
+ // The more players Luvia "harvested", the stronger she is.
+ if (rand(100) >= $@illia_witch_guard_threshold)
+ end;
+ // Decrease her power over time.
+ $@illia_witch_guard_threshold = $@illia_witch_guard_threshold - 7;
+ // Keep always a small probability when it reached the minimum
+ if ($@illia_witch_guard_threshold <= 0)
+ $@illia_witch_guard_threshold = 6 + $Illia_Luvia_Harvest/5;
+ callsub S_SpawnWitchGuard;
+ end;
+
+S_SpawnWitchGuard:
+ if (!(attachrid($@iLLIA_HERO_ID)))
+ end;
+ npcwarp getx(), gety(), "#LuviaDaemon";
+ misceffect FX_EVIL_SUMMON;
+ misceffect FX_GROUND_SPAWN;
+ monster "052-2", getx(), gety(), "", 1103, 1, "#LuviaDaemon::OnWGD";
+ detachrid;
+ areatimer 0, "052-2", 73, 11, 115, 49, 0, "#LuviaDaemon::OnWGS";
+ return;
+
+OnTimer30000:
+ if ($@illia_level_7_progress != 2)
+ end;
+ npcwarp 1, 1, "#LuviaDaemon";
+ $@illia_luvia_trance_delay = $@illia_luvia_trance_delay - 30;
+ if ($@illia_luvia_trance_delay <= 0)
+ goto L_TriggerTrance;
+ setnpctimer 0;
+ end;
+
+L_TriggerTrance:
+ $@illia_level_7_progress = 3;
+ $@illia_luvia_trance_delay = 0;
+ areatimer 0, "052-2", 73, 11, 115, 49, 0, "#LuviaDaemon::OnTT";
+ setnpctimer 0;
+ end;
+
+L_Clear:
+ stopnpctimer;
+ setnpctimer 0;
+ end;
+
+OnDeath:
+ stopnpctimer;
+ setnpctimer 0;
+ if ($@illia_progress != 7)
+ end;
+ $@illia_level_7_progress = 4;
+ killmonster "052-2", "#LuviaDaemon::OnWGD";
+ mapannounce "052-2", "Luvia : How? By mere humans! But we will see again! Enjoy your victory while it lasts, " + $@iLLIA_HERO$ + "!!", 0;
+
+ $@illia_bp = $Illia_Luvia_Harvest * 16 / 10 + 120;
+ areatimer 0, "052-2", 73, 11, 115, 49, 0, "#LuviaDaemon::OnBP";
+
+ areatimer 0, "052-2", 73, 11, 115, 49, 2000, "#LuviaDaemon::OnW00t";
+
+ $@illia_progress = 8;
+ callfunc "UpdateIlliaProgress";
+ // Set the number of common rewards rewards
+ if ($Illia_Luvia_Harvest < 15)
+ $@illia_num_common_reward_items = 0;
+ if ($Illia_Luvia_Harvest >= 15 && $Illia_Luvia_Harvest < 35)
+ $@illia_num_common_reward_items = 1;
+ if ($Illia_Luvia_Harvest >= 35)
+ $@illia_num_common_reward_items = 2;
+
+ // Set the number of unique rewards
+ if ($Illia_Luvia_Harvest < 40)
+ $@illia_num_unique_reward_items = 1;
+ if ($Illia_Luvia_Harvest >= 40)
+ $@illia_num_unique_reward_items = 2;
+ $Illia_Luvia_Harvest = 0;
+
+ // Extend the time limit of +7 mins to leave enough time to pick
+ // the rewards even if close to the time limit
+ $@illia_max_time = $@illia_max_time + 300;
+
+ // Record how many times the quest was finished
+ $Illia_Win_Counter = $Illia_Win_Counter + 1;
+
+ end;
+
+OnBP:
+ BOSS_POINTS = BOSS_POINTS + $@illia_bp;
+ message strcharinfo(0), "You gain " + $@illia_bp + " Boss Points giving you a total of " + BOSS_POINTS + ".";
+ end;
+
+OnWGD:
+ end;
+
+OnWGS:
+ if ($@illia_level_7_progress == 2)
+ message strcharinfo(0), "One of Luvia's guard spawned from the depths to assist her!";
+ end;
+
+OnTT:
+ if ($@illia_level_7_progress == 3)
+ message strcharinfo(0), "Luvia seems to become in trance!";
+ end;
+
+OnW00t:
+ message strcharinfo(0), "You defeated this evil sorceress... But what about her sister now?";
+ end;
+
+}
+
+052-2,88,12,0 script #ToLuviaRoomDoor NPC32767,1,2,{
+ @step = 7;
+ if ($@illia_progress < @step) goto L_ShouldNotBeHere;
+ if ($@illia_level_7_progress < 4) end;
+ warp "052-2", 133, 84;
+ end;
+
+L_ShouldNotBeHere:
+ heal -Hp, 0;
+ end;
+}
diff --git a/npc/052-2/storage.txt b/npc/052-2/storage.txt
new file mode 100755
index 00000000..97e675f5
--- /dev/null
+++ b/npc/052-2/storage.txt
@@ -0,0 +1,179 @@
+
+052-2,23,69,0 script #TriggerItemsInvoker NPC32767,1,0,{
+ @step = 6;
+ if ($@illia_progress < @step) goto L_ShouldNotBeHere;
+ if (strcharinfo(0) != $@iLLIA_HERO$) end;
+ if ($@illia_level_6_progress == 0) goto L_StartItemInvoker;
+ end;
+
+L_ShouldNotBeHere:
+ heal -Hp, 0;
+ end;
+
+L_StartItemInvoker:
+ $@illia_level_6_progress = 1;
+ donpcevent "#ItemsInvoker::OnCommandStart";
+ end;
+
+}
+
+052-2,1,1,0 script #ItemsInvoker NPC32767,{
+end;
+
+OnInit:
+ setarray $@illia_storage_items, 541, 567, 568, 562;
+ setarray $@illia_storage_special_items, 687, 827, 1229;
+ // Map coords:* x1,y1, x2,y2, ...
+ setarray $@illia_storage_item_points, 20,67, 22,75, 27,71, 30,73, 34,76, 30,64, 34,65, 34,62, 21,61, 22,64;
+ end;
+
+OnCommandStart:
+ $@illia_storage_max_items = 20;
+ $@illia_storage_deviation = (8 + ($Illia_Luvia_Harvest*70)/100)*3;
+ initnpctimer;
+ areatimer 0, "052-2", 19, 60, 35, 78, 10, "#ItemsInvoker::OnStart";
+ end;
+
+OnStart:
+ message strcharinfo(0), "You feel a strange atmosphere in this room... You sense a strong magic rising from the depth!";
+ end;
+
+OnTimer1000:
+ if ($@illia_storage_max_items == 0)
+ goto L_CheckMobs;
+ $@item_invoke_index = rand(getarraysize($@illia_storage_item_points)/2);
+ $@item_invoke_x = $@illia_storage_item_points[$@item_invoke_index*2];
+ $@item_invoke_y = $@illia_storage_item_points[($@item_invoke_index*2)+1];
+ npcwarp $@item_invoke_x, $@item_invoke_y, "#ItemsInvoker";
+ // This is a fix to force the official mana client to display a npc after a warp.
+ // Note: the manaplus client do not need this.
+ disablenpc "#ItemsInvoker";
+ end;
+
+OnTimer1500:
+ // See the note above.
+ enablenpc "#ItemsInvoker";
+ areatimer 0, "052-2", 19, 60, 35, 78, 10, "#ItemsInvoker::OnItem";
+ misceffect FX_GROUND_SPAWN;
+ end;
+
+OnTimer3750:
+ setnpctimer 0;
+ $@item_invoke_x = 0;
+ $@item_invoke_y = 0;
+ $@item_invoke_index = 0;
+ end;
+
+OnItem:
+ if (strcharinfo(0) == $@iLLIA_HERO$)
+ goto L_ItemSpawn;
+ end;
+
+L_ItemSpawn:
+ // This section will decide what to spawn: special monster, monster, item, special item
+ // Calculation uses a decreasing variable which introduces a deviation.
+ // Its initial value is based on $@illia_Luvia_Harvest
+ // * first decide (50% / 50%) if the deviation will be positive or negative
+ // * Apply the deviation to a random number between 0, 100. (note the final value can be < 0 or > 100)
+ // The purpose is that, when the initial deviation is high, there are high chances to get either
+ // a special monster, or a special item.
+ @m = rand(100);
+ if (@m < 50)
+ @r = rand(100) - $@illia_storage_deviation;
+ if (@m >= 50)
+ @r = rand(100) + $@illia_storage_deviation;
+ // Reduce the deviation
+ $@illia_storage_deviation = $@illia_storage_deviation*83/100;
+ if (@r < 5)
+ goto L_MakeSpecialMonster;
+ if (@r < 50)
+ goto L_MakeMonster;
+ if (@r > 98)
+ goto L_MakeSpecialItem;
+ // Normal item
+ makeitem $@illia_storage_items[rand(getarraysize($@illia_storage_items))], rand(2, 8), "052-2", $@item_invoke_x, $@item_invoke_y;
+ $@illia_storage_max_items = $@illia_storage_max_items - 1;
+ @r = 0;
+ end;
+
+L_MakeSpecialMonster:
+ monster "052-2", $@item_invoke_x, $@item_invoke_y, "", 1103, 1, "#ItemsInvoker::OnDeath";
+ areatimer 0, "052-2", 19, 60, 35, 78, 10, "#ItemsInvoker::OnWtf";
+ $@illia_storage_max_items = $@illia_storage_max_items - 1;
+ end;
+
+L_MakeMonster:
+ monster "052-2", $@item_invoke_x, $@item_invoke_y, "", 1101, rand(1, 3), "#ItemsInvoker::OnDeath";
+ $@illia_storage_max_items = $@illia_storage_max_items - 1;
+ @r = 0;
+ end;
+
+L_MakeSpecialItem:
+ makeitem $@illia_storage_special_items[rand(getarraysize($@illia_storage_special_items))], rand(2, 4), "052-2", $@item_invoke_x, $@item_invoke_y;
+ areatimer 0, "052-2", 19, 60, 35, 78, 10, "#ItemsInvoker::OnWow";
+ $@illia_storage_max_items = $@illia_storage_max_items - 1;
+ @r = 0;
+ end;
+
+L_CheckMobs:
+ if ($@illia_progress != 6)
+ goto L_Clear;
+ if (mobcount("052-2", "#ItemsInvoker::OnDeath") < 0)
+ goto L_Stop;
+ setnpctimer 0;
+ end;
+
+L_Clear:
+ stopnpctimer;
+ setnpctimer 0;
+ $@illia_storage_deviation = 0;
+ $@illia_storage_max_items = 0;
+ killmonster "052-2", "#ItemsInvoker::OnDeath";
+ end;
+
+L_Stop:
+ stopnpctimer;
+ setnpctimer 0;
+ npcwarp 1, 1, "#ItemsInvoker";
+ $@illia_storage_deviation = 0;
+ $@illia_storage_max_items = 0;
+ $@illia_level_6_progress = 2;
+ $@illia_progress = 7;
+ callfunc "UpdateIlliaProgress";
+ $@illia_max_time = $@illia_max_time + 900;
+ areatimer 0, "052-2", 19, 60, 35, 78, 10, "#ItemsInvoker::OnStop";
+ end;
+
+OnDeath:
+ end;
+
+OnStop:
+ message strcharinfo(0), "The magic seems to quickly dissipate.";
+ end;
+
+OnWtf:
+ message strcharinfo(0), "Look out!";
+ end;
+
+OnWow:
+ message strcharinfo(0), "Wow, see what appeared!";
+ end;
+
+}
+
+052-2,35,68,0 script #ToPartyRoom NPC32767,1,1,{
+ @step = 6;
+ if ($@illia_progress < @step) goto L_ShouldNotBeHere;
+ if ($@illia_level_6_progress == 2) goto L_Warp;
+ message strcharinfo(0), "The strong magic inside this room prevents you from going further.";
+ end;
+
+L_Warp:
+ warp "052-2", 73, 48;
+ end;
+
+L_ShouldNotBeHere:
+ heal -Hp, 0;
+ end;
+
+}