summaryrefslogtreecommitdiff
path: root/npc/006-1/crazyfefe.txt
diff options
context:
space:
mode:
Diffstat (limited to 'npc/006-1/crazyfefe.txt')
-rw-r--r--npc/006-1/crazyfefe.txt230
1 files changed, 230 insertions, 0 deletions
diff --git a/npc/006-1/crazyfefe.txt b/npc/006-1/crazyfefe.txt
new file mode 100644
index 000000000..d41a145a1
--- /dev/null
+++ b/npc/006-1/crazyfefe.txt
@@ -0,0 +1,230 @@
+// TMW2 Script
+// Author:
+// TMW Org. (original code)
+// Jesusalva
+// Description:
+// Crazyfefe will wake up when he smells battle
+// Variables:
+// $@FIGHT_CAVE_LEVEL
+// Tracks if a fight is going on, and the current round if true.
+// $@FEFE_DELAY
+// Tracks the delay between challenges. Also used to start the combat.
+// $@FIGHT_CAVE_HERO$
+// Whoever started a fight. Also used to know if a fight is about to begin.
+// $@FIGHT_CAVE_PLAYER_COUNT
+// How many players are there
+
+006-1,50,52,0 script Crazyfefe NPC_STATUE_EVILMAN,{
+ if ($@FIGHT_CAVE_LEVEL) goto L_Enjoy;
+ if ($@FEFE_DELAY < gettimetick(2)) goto L_Wait;
+ mesn;
+ mesq l("Who dares to disturb my slumber?");
+ next;
+ menu
+ l("Sorry, sorry! Please rest, great Crazyfefe!"), L_Exit,
+ l("I do. I want to challenge the Candor Cave!"), L_Next,
+ l("What is this place anyway?"), L_Explain;
+
+L_Next:
+ mesn;
+ mesq l("Very well, but for a fee of @@ GP. There's no free lunch, after all!", .price);
+ select
+ l("Sorry, I misclicked the first button. Have a nice nap, great Crazyfefe!"),
+ l("Yeah, I have money to throw away. Give me ##Bfive##b minutes, and Bring it on!"),
+ l("Yeah, I have money to throw away. Give me ##Bten##b minutes, and Bring it on!"),
+ l("Yeah, I have money to throw away. Give me ##Bfifteen##b minutes, and Bring it on!"),
+ "","",
+ rif(is_gm(), l("I'm GM and got the money. Gimme HALF HOUR to invite everybody!"));
+
+ // Cancel?
+ if (@menu == 1)
+ goto L_Exit;
+
+ // Already started?
+ if ($@FIGHT_CAVE_LEVEL || $@FIGHT_CAVE_HERO$ != "")
+ goto L_AlreadyStarted;
+
+ // Enough money?
+ if (Zeny < .price)
+ goto L_NotEnough;
+
+ Zeny = Zeny - .price;
+ // Time delay
+ $@FEFE_DELAY = gettimetick(2)+300*(@menu-1);
+ $@FIGHT_CAVE_HERO$ = strcharinfo(0);
+ initnpctimer;
+ mesn;
+ mesq l("Please wait the designed time.");
+ close;
+
+L_StartFight:
+ if (getmapusers("006-1") < 3)
+ goto L_NotEnoughPlayers;
+ $@FIGHT_CAVE_LEVEL = 1;
+ $@FEFE_DELAY = gettimetick(2)+.delay;
+ $@FIGHT_CAVE_PLAYER_COUNT = getmapusers("006-1");
+ mapannounce("006-1", "Let the battle begin!", bc_map);
+ initnpctimer;
+ end;
+
+L_Enjoy:
+ npctalk3 l("Pay attention to the fight, @@!", strcharinfo(0));
+ end;
+
+L_NotEnough:
+ mesn;
+ mesq l("You lack money. Go sell your stuff. And don't ask why a statue needs money!");
+ close;
+
+L_AlreadyStarted:
+ mesn;
+ mesq l("Sorry, @@ already started the fight.", $@FIGHT_CAVE_HERO$);
+ close;
+
+L_Wait:
+ .@time$=FuzzyTime($@FEFE_DELAY,2,2);
+ mesn;
+ mesq l("Be Patient... You still need to wait @@.", .@time$);
+ goto L_Exit;
+
+L_NotEnoughPlayers:
+ mapannounce("006-1", "Oh noes! There's not enough players. Fight aborted, no refunds!", bc_map);
+ goto L_CleanUp;
+
+L_Explain:
+ mesn;
+ mesq l("I am @@, guardian of Candor Cave. Below this cave, lies the legendary Fefe, arch-wizard from the Great War.", .name$);
+ next;
+ mesn;
+ mesq l("During the war, the Monster King cursed the place where he died, but he fought back, and cursed the curse.");
+ next;
+ mesn;
+ mesq l("For short, they had a fight with curses, and now there's a talking statue over his grave which can spawn monsters here.");
+ next;
+ mesn;
+ mesq l("If you pay the fee, I'll spawn them. You should not fight alone, instead, you need a group of at least three, because, you know, the curse. Or something.");
+ next;
+ menu
+ l("I need to think about this."), L_Exit,
+ l("I'm interested."), L_Next;
+
+L_Exit:
+ close;
+
+
+
+
+
+
+
+// Check if we're ready for next wave. Otherwise, do this check again after 5 seconds.
+L_CaveLogic:
+ $@FIGHT_CAVE_PLAYER_COUNT = getmapusers("006-1");
+ if (mobcount("006-1", "Crazyfefe::OnPetDeath") <= 0)
+ goto L_NextRound;
+ // reset timer
+ initnpctimer;
+ end;
+
+// TODO
+L_NextRound:
+ $@FIGHT_CAVE_LEVEL = $@FIGHT_CAVE_LEVEL + $@FIGHT_CAVE_PLAYER_COUNT;
+ if ($@FIGHT_CAVE_LEVEL >= 2200)
+ goto L_CleanUp;
+
+ mapannounce "006-1", "The next round, with level " + $@FIGHT_CAVE_LEVEL + ", is starting with " + $@FIGHT_CAVE_PLAYER_COUNT + " player(s) left alive." , 0;
+ goto L_Summon;
+
+// TODO
+L_Summon:
+ .@amount=($@FIGHT_CAVE_LEVEL/3);
+ for (.@i = 0; .@i < .@amount; ++.@i) {
+ .@mid=rand(1,15);
+ .@monsterId=Piou;
+ switch (.@mid) {
+ case 1:
+ .@monsterId = CaveMaggot ; break;
+ case 2:
+ .@monsterId = Wolvern ; break;
+ case 3:
+ .@monsterId = DarkLizard ; break;
+ case 4:
+ .@monsterId = MagicGoblin ; break;
+ case 5:
+ .@monsterId = Bandit ; break;
+ case 6:
+ .@monsterId = GreenSlime ; break;
+ case 7:
+ .@monsterId = LavaSlime ; break;
+ case 8:
+ .@monsterId = Snake ; break;
+ case 9:
+ .@monsterId = DesertBandit ; break;
+ case 10:
+ .@monsterId = Sarracenus ; break;
+ case 11:
+ .@monsterId = AngryRedScorpion ; break;
+ case 12:
+ .@monsterId = BlackScorpion ; break;
+ case 13:
+ .@monsterId = FallenGuard1 ; break;
+ case 14:
+ .@monsterId = Yeti ; break;
+ default:
+ .@monsterId = AngryScorpion ; break;
+ }
+ areamonster "006-1", 20, 20, 70, 60, "", .@monsterId, .@amount, "Crazyfefe::OnPetDeath";
+ }
+ close;
+
+L_CleanUp:
+ npctalk3 "Game Over!";
+ mapannounce "006-1", "Who will be the next to fall on Crazyfefe's Cave?", 0;
+
+ areatimer 0, "006-1", 20, 20, 70, 60, 10, "Crazyfefe::OnReward";
+ $@FIGHT_CAVE_LEVEL = 0;
+ $@FIGHT_CAVE_HERO$ = "";
+ killmonster "006-1", "Crazyfefe::OnPetDeath";
+ stopnpctimer;
+ end;
+
+
+
+
+
+
+
+
+// Rewards surviving players, according to performance
+OnReward:
+ if (ispcdead())
+ end;
+ // TODO
+ Zeny=Zeny+($@FIGHT_CAVE_LEVEL);
+ getexp $@FIGHT_CAVE_LEVEL, 0;
+ dispbottom l("You've gained @@ GP and EXP", ($@FIGHT_CAVE_LEVEL));
+ end;
+
+// Announces and attempts to start the fight once time run out
+OnTimer300000:
+ if ($@FEFE_DELAY <= gettimetick(2)) goto L_StartFight;
+ announce $@FIGHT_CAVE_HERO$+" invites everyone to a challenge against Candor Cave. It'll start in "+FuzzyTime($@FEFE_DELAY,2,2)+". Prepare yourselves!", bc_all|bc_npc;
+ inittimer;
+ end;
+
+// Every 5 seconds, handle cave, if fighting. Does nothing when waiting.
+OnTimer5000:
+ if ($@FIGHT_CAVE_LEVEL)
+ goto L_CaveLogic;
+ end;
+
+OnPetDeath:
+ end;
+
+OnInit:
+ .sex=G_OTHER;
+ .distance=5;
+ .price=8000;
+ .delay=(60*60*4);
+ end;
+}