From 71ae140049dc991d2afe179d7467ec92e1f54e94 Mon Sep 17 00:00:00 2001 From: Jesusaves Date: Mon, 11 Jun 2018 22:46:49 -0300 Subject: Function to class masters. --- npc/003-0-1/colin.txt | 143 +------------------------------------------- npc/003-0-1/luca.txt | 143 +------------------------------------------- npc/functions/class.txt | 156 ++++++++++++++++++++++++++++++++++++++++++++++++ npc/scripts.conf | 1 + 4 files changed, 162 insertions(+), 281 deletions(-) create mode 100644 npc/functions/class.txt (limited to 'npc') diff --git a/npc/003-0-1/colin.txt b/npc/003-0-1/colin.txt index d2c22263b..1c435c257 100644 --- a/npc/003-0-1/colin.txt +++ b/npc/003-0-1/colin.txt @@ -7,147 +7,8 @@ // so expect core changes! 003-0-1,58,29,0 script Colin NPC_PLAYER,{ - - mesn; - mesq l("I am the Wizard Mages master."); - if (!MAGIC_LVL) goto L_NoMagic; - if (getskilllv(MAGIC_WARRIOR) && !is_admin()) close; - - if (getskilllv(WIZARD_MAGE) == 1 && MAGIC_LVL >= 2 && ST_TIER == 0) goto L_Tier2; - if (getskilllv(WIZARD_MAGE) == 1 && MAGIC_LVL >= 2 && ST_TIER == 1) mes col("...Where is the recipe for the potion? Ah, I lost it...", 9); - - // Sanity check - if (getskilllv(MG_FIREBALL) >= 1) mesq l("Are you using my skill?"); - if (getskilllv(MG_FIREBALL) >= 1) close; - // could grant MG_THUNDERSTORM perhaps, oh, I don't care. - - if (getskilllv(WIZARD_MAGE) == 0) goto L_SignUp; - close; - -L_SignUp: - next; - mesn; - mesq l("You have some magic power. Do you want to join the Wizard Mages? ##BThis cannot be undone##b."); - next; - mesn; - mesq l("We use sheer magic to destroy, explode, burn, freeze, and in overall kill our opponents!"); - next; - menu - l("What do I need to do to join?"), L_JoinReq, - l("I'm not interested, sorry."), -; - close; - -L_JoinReq: - mesn; - mesq l("Ah, nothing too major, as you already have magic."); - next; - mesn; - mesq l("We only require a small fee of 1 @@, or 40 @@", getitemlink(DivineApple), getitemlink(SnakeEgg)); - next; - switch(select( - rif(countitem(DivineApple) >= 1, l("I got the apple.")), - rif(countitem(SnakeEgg) >= 40, l("I got the eggs.")), - l("I will apply later."))) { - - case 1: - delitem DivineApple, 1; - goto L_Tier1Ok; - break; - case 2: - // If player had 40 eggs, and eat 1 - they are clearly cheating. - // It will delete all 39 eggs, and when it tries to delete the 40th, - // it won't find and will terminate the script. No lame cheating. - // Of course, all 39 eggs are gone for and I can't do anything about it. - delitem SnakeEgg, 40; - goto L_Tier1Ok; - break; - default: - break; - } - - close; - -L_Tier1Ok: - // The last argument is duration: 0 - permanent 1- temporary. If omitted, defaults to 1. - skill(MG_FIREBALL,1,0); - skill(WIZARD_MAGE,1,0); - mes ""; - mesn; - mesq l("Here, learn the ##BFireball##b. It is on Magical skills tab. You can drag it to the shortcut list. Use it to protect people!"); - close; - -L_NoMagic: - next; - mesn; - mesq l("Your lack of magical power is critical. I dare say, you might never in your life get access to a Mana Stone."); - next; - mesn; - mesq l("Besides the Magic Council, Andrei Sakar have his own Mana Stone, but I doubt he would train the likes of you, or share his Mana Stone."); - next; - mesn; - mesq l("Perhaps, in the city, someone knows rumors about Mana Stones and can teach you. Other than that, you're on your own."); - close; - -// progressbar("", ) -// Script will be canceled if character moves :D -// So I probably could *try* to reuse TMW-BR Magic Tier 2 Scripts. -L_Tier2: - next; - mesn; - mesq l("Wha, your magic power increased! How?! Ah, nevermind. You are eligible to get tier 2!"); - next; - mesn; - mesq l("But whoa, not so fast! You must pass the seven steps of a trial first!"); - next; - mesn; - mesq l("The first trial is simple, I'm not doing anything in special. Bring me 1 @@, or 20 @@ and 20 @@.", getitemlink(DivineApple), getitemlink(SilkCocoon), getitemlink(ChocolateMouboo)); - next; - switch(select( - rif(countitem(DivineApple) >= 1, l("I got the apple.")), - rif(countitem(SilkCocoon) >= 20 && countitem(ChocolateMouboo) >= 20, l("I got the silk and chocolate.")), - l("I will apply later."))) { - - case 1: - delitem DivineApple, 1; - goto L_Tier2Ok; - break; - case 2: - delitem SilkCocoon, 20; - delitem ChocolateMouboo, 20; - goto L_Tier2Ok; - break; - default: - break; - } - - close; - -L_Tier2Ok: - // The last argument is duration: 0 - permanent 1- temporary. If omitted, defaults to 1. - addtoskill(MG_FIREBALL,1,0); - getexp 10000, 0; - ST_TIER=1; - mes ""; - mesn; - mesq l("Good, good. The skill you got earlier just raised a single level. I'll also impair some experience on you, no biggies."); - next; - mesn; - mesq l("Now, the real challenge will start. You have a lot of raw power, but that doesn't gives you a lot of skills to learn."); - next; - mesn; - mesq l("I can make a nice, simple potion for you. Once you drink it, the raw mana will settle on your body."); - next; - mesn; - mesq l("However, beware! That potion is short-lived, you'll be running against time. Get ready to travel a lot."); - next; - mesn; - mesq l("Come talk to me when you're ready, and we can begin."); - close; - -L_T2_S1: - addtoskill(WIZARD_MAGE,1,0); - getexp 40000, 0; // Yes, 40k experience points. Waw. - close; + ClassMaster(WIZARD_MAGE, "Wizard Mages", MAGIC_WARRIOR, + MG_FIREBALL); OnInit: .@npcId = getnpcid(0, .name$); diff --git a/npc/003-0-1/luca.txt b/npc/003-0-1/luca.txt index 434014a50..f03413294 100644 --- a/npc/003-0-1/luca.txt +++ b/npc/003-0-1/luca.txt @@ -7,146 +7,9 @@ // so expect core changes! 003-0-1,35,29,0 script Luca NPC_PLAYER,{ - - mesn; - mesq l("I am the Magic Warriors master."); - if (!MAGIC_LVL) goto L_NoMagic; - if (getskilllv(WIZARD_MAGE) && !is_admin()) close; - - if (getskilllv(MAGIC_WARRIOR) == 1 && MAGIC_LVL >= 2 && ST_TIER == 0) goto L_Tier2; - if (getskilllv(MAGIC_WARRIOR) == 1 && MAGIC_LVL >= 2 && ST_TIER == 1) mes col("...Where is the recipe for the potion? Ah, I lost it...", 9); - - // Sanity check - if (getskilllv(SM_BASH) >= 1) mesq l("Are you using my skill?"); - if (getskilllv(SM_BASH) >= 1) close; - - if (getskilllv(MAGIC_WARRIOR) == 0) goto L_SignUp; - close; - -L_SignUp: - next; - mesn; - mesq l("You have some magic power. Do you want to join the Magic Warriors? ##BThis cannot be undone##b."); - next; - mesn; - mesq l("We use swords and bows to protect the people, and we use magic to spice things up! Because we're strong even without it!"); - next; - menu - l("What do I need to do to join?"), L_JoinReq, - l("I'm not interested, sorry."), -; - close; - -L_JoinReq: - mesn; - mesq l("Ah, nothing too major, as you already have magic."); - next; - mesn; - mesq l("We only require a small fee of 1 @@, or 40 @@", getitemlink(DivineApple), getitemlink(SnakeEgg)); - next; - switch(select( - rif(countitem(DivineApple) >= 1, l("I got the apple.")), - rif(countitem(SnakeEgg) >= 40, l("I got the eggs.")), - l("I will apply later."))) { - - case 1: - delitem DivineApple, 1; - goto L_Tier1Ok; - break; - case 2: - // If player had 40 eggs, and eat 1 - they are clearly cheating. - // It will delete all 39 eggs, and when it tries to delete the 40th, - // it won't find and will terminate the script. No lame cheating. - // Of course, all 39 eggs are gone for and I can't do anything about it. - delitem SnakeEgg, 40; - goto L_Tier1Ok; - break; - default: - break; - } - - close; - -L_Tier1Ok: - // The last argument is duration: 0 - permanent 1- temporary. If omitted, defaults to 1. - skill(SM_BASH,1,0); - skill(MAGIC_WARRIOR,1,0); - mes ""; - mesn; - mesq l("Here, learn the ##BFalkon Punch##b. It is on Physical skills tab. You can drag it to the shortcut list. Use it to protect people!"); - close; - -L_NoMagic: - next; - mesn; - mesq l("Your lack of magical power is critical. I dare say, you might never in your life get access to a Mana Stone."); - next; - mesn; - mesq l("Besides the Magic Council, Andrei Sakar have his own Mana Stone, but I doubt he would train the likes of you, or share his Mana Stone."); - next; - mesn; - mesq l("Perhaps, in the city, someone knows rumors about Mana Stones and can teach you. Other than that, you're on your own."); - close; - -// progressbar("", ) -// Script will be canceled if character moves :D -// So I probably could *try* to reuse TMW-BR Magic Tier 2 Scripts. -L_Tier2: - next; - mesn; - mesq l("Wha, your magic power increased! How?! Ah, nevermind. You are eligible to get tier 2!"); - next; - mesn; - mesq l("But whoa, not so fast! You must pass the seven steps of a trial first!"); - next; - mesn; - mesq l("The first trial is simple, I'm not doing anything in special. Bring me 1 @@, or 20 @@ and 20 @@.", getitemlink(DivineApple), getitemlink(SilkCocoon), getitemlink(ChocolateMouboo)); - next; - switch(select( - rif(countitem(DivineApple) >= 1, l("I got the apple.")), - rif(countitem(SilkCocoon) >= 20 && countitem(ChocolateMouboo) >= 20, l("I got the silk and chocolate.")), - l("I will apply later."))) { - - case 1: - delitem DivineApple, 1; - goto L_Tier2Ok; - break; - case 2: - delitem SilkCocoon, 20; - delitem ChocolateMouboo, 20; - goto L_Tier2Ok; - break; - default: - break; - } - - close; - -L_Tier2Ok: - // The last argument is duration: 0 - permanent 1- temporary. If omitted, defaults to 1. - addtoskill(SM_BASH,1,0); - getexp 10000, 0; - ST_TIER=1; - mes ""; - mesn; - mesq l("Good, good. The skill you got earlier just raised a single level. I'll also impair some experience on you, no biggies."); - next; - mesn; - mesq l("Now, the real challenge will start. You have a lot of raw power, but that doesn't gives you a lot of skills to learn."); - next; - mesn; - mesq l("I can make a nice, simple potion for you. Once you drink it, the raw mana will settle on your body."); - next; - mesn; - mesq l("However, beware! That potion is short-lived, you'll be running against time. Get ready to travel a lot."); - next; - mesn; - mesq l("Come talk to me when you're ready, and we can begin."); - close; - -L_T2_S1: - addtoskill(MAGIC_WARRIOR,1,0); - getexp 40000, 0; // Yes, 40k experience points. Waw. - close; + ClassMaster(MAGIC_WARRIOR, "Magic Warriors", WIZARD_MAGE, + SM_BASH); + end; OnInit: .@npcId = getnpcid(0, .name$); diff --git a/npc/functions/class.txt b/npc/functions/class.txt new file mode 100644 index 000000000..e36015fd3 --- /dev/null +++ b/npc/functions/class.txt @@ -0,0 +1,156 @@ +// TMW-2 Script +// Author: +// Saulc +// Jesusalva +// Description: +// Handles Colin and Luca. They say exactly the same things, afterall. + +// ClassID, ClassName, OtherClass, sk1, +function script ClassMaster { + .@CLASS=getarg(0); + .@CNAME=getarg(1); + .@OTHER=getarg(2); + + // Skills + .@SK_T1=getarg(3); + mesn; + mesq l("I am the @@ master.", .@CNAME); + if (!MAGIC_LVL) goto L_NoMagic; + if (getskilllv(.@OTHER) && !is_admin()) close; + + if (getskilllv(.@CLASS) == 1 && MAGIC_LVL >= 2 && ST_TIER == 0) goto L_Tier2; + if (getskilllv(.@CLASS) == 1 && MAGIC_LVL >= 2 && ST_TIER == 1) mes col("...Where is the recipe for the potion? Ah, I lost it...", 9); + + // Sanity check + if (getskilllv(.@SK_T1) >= 1) mesq l("Are you using my skill?"); + if (getskilllv(.@SK_T1) >= 1) close; + + if (getskilllv(.@CLASS) == 0) goto L_SignUp; + close; + +L_SignUp: + next; + mesn; + mesq l("You have some magic power. Do you want to join the Magic Warriors? ##BThis cannot be undone##b."); + next; + mesn; + mesq l("We use swords and bows to protect the people, and we use magic to spice things up! Because we're strong even without it!"); + next; + menu + l("What do I need to do to join?"), L_JoinReq, + l("I'm not interested, sorry."), -; + close; + +L_JoinReq: + mesn; + mesq l("Ah, nothing too major, as you already have magic."); + next; + mesn; + mesq l("We only require a small fee of 1 @@, or 40 @@", getitemlink(DivineApple), getitemlink(SnakeEgg)); + next; + switch(select( + rif(countitem(DivineApple) >= 1, l("I got the apple.")), + rif(countitem(SnakeEgg) >= 40, l("I got the eggs.")), + l("I will apply later."))) { + + case 1: + delitem DivineApple, 1; + goto L_Tier1Ok; + break; + case 2: + // If player had 40 eggs, and eat 1 - they are clearly cheating. + // It will delete all 39 eggs, and when it tries to delete the 40th, + // it won't find and will terminate the script. No lame cheating. + // Of course, all 39 eggs are gone for and I can't do anything about it. + delitem SnakeEgg, 40; + goto L_Tier1Ok; + break; + default: + break; + } + + close; + +L_Tier1Ok: + // The last argument is duration: 0 - permanent 1- temporary. If omitted, defaults to 1. + skill(.@SK_T1,1,0); + skill(.@CLASS,1,0); + mes ""; + mesn; + mesq l("Here, learn the ##BFalkon Punch##b. It is on Physical skills tab. You can drag it to the shortcut list. Use it to protect people!"); + close; + +L_NoMagic: + next; + mesn; + mesq l("Your lack of magical power is critical. I dare say, you might never in your life get access to a Mana Stone."); + next; + mesn; + mesq l("Besides the Magic Council, Andrei Sakar have his own Mana Stone, but I doubt he would train the likes of you, or share his Mana Stone."); + next; + mesn; + mesq l("Perhaps, in the city, someone knows rumors about Mana Stones and can teach you. Other than that, you're on your own."); + close; + +// progressbar("", ) +// Script will be canceled if character moves :D +// So I probably could *try* to reuse TMW-BR Magic Tier 2 Scripts. +L_Tier2: + next; + mesn; + mesq l("Wha, your magic power increased! How?! Ah, nevermind. You are eligible to get tier 2!"); + next; + mesn; + mesq l("But whoa, not so fast! You must pass the seven steps of a trial first!"); + next; + mesn; + mesq l("The first trial is simple, I'm not doing anything in special. Bring me 1 @@, or 20 @@ and 20 @@.", getitemlink(DivineApple), getitemlink(SilkCocoon), getitemlink(ChocolateMouboo)); + next; + switch(select( + rif(countitem(DivineApple) >= 1, l("I got the apple.")), + rif(countitem(SilkCocoon) >= 20 && countitem(ChocolateMouboo) >= 20, l("I got the silk and chocolate.")), + l("I will apply later."))) { + + case 1: + delitem DivineApple, 1; + goto L_Tier2Ok; + break; + case 2: + delitem SilkCocoon, 20; + delitem ChocolateMouboo, 20; + goto L_Tier2Ok; + break; + default: + break; + } + + close; + +L_Tier2Ok: + // The last argument is duration: 0 - permanent 1- temporary. If omitted, defaults to 1. + addtoskill(.@SK_T1,1,0); + getexp 10000, 0; + ST_TIER=1; + mes ""; + mesn; + mesq l("Good, good. The skill you got earlier just raised a single level. I'll also impair some experience on you, no biggies."); + next; + mesn; + mesq l("Now, the real challenge will start. You have a lot of raw power, but that doesn't gives you a lot of skills to learn."); + next; + mesn; + mesq l("I can make a nice, simple potion for you. Once you drink it, the raw mana will settle on your body."); + next; + mesn; + mesq l("However, beware! That potion is short-lived, you'll be running against time. Get ready to travel a lot."); + next; + mesn; + mesq l("Come talk to me when you're ready, and we can begin."); + close; + +L_T2_S1: + addtoskill(.@CLASS,1,0); + getexp 40000, 0; // Yes, 40k experience points. Waw. + close; + +} diff --git a/npc/scripts.conf b/npc/scripts.conf index 664ebe1e8..7fe96a48e 100644 --- a/npc/scripts.conf +++ b/npc/scripts.conf @@ -31,6 +31,7 @@ "npc/functions/barber.txt", "npc/functions/bank.txt", "npc/functions/confused-tree-dict.txt", +"npc/functions/class.txt", "npc/functions/doors.txt", "npc/functions/fishing.txt", "npc/functions/hammocks.txt", -- cgit v1.2.3-60-g2f50