diff options
author | jtoelke <jtoelke@gmx.de> | 2013-06-28 13:18:17 -0700 |
---|---|---|
committer | jtoelke <jtoelke@gmx.de> | 2013-06-28 13:18:17 -0700 |
commit | e8a4dddb3b54814713c411a094fc1a9b90492962 (patch) | |
tree | 3856e10b80ae965d42b477354a3e5d79c3b04cfb /world/map | |
parent | d6d562b4a7bf157a36c0560be4ec14f9f463aa86 (diff) | |
parent | bc66a98377575c7c8e9592e50cbdcf083d6ecaff (diff) | |
download | serverdata-e8a4dddb3b54814713c411a094fc1a9b90492962.tar.gz serverdata-e8a4dddb3b54814713c411a094fc1a9b90492962.tar.bz2 serverdata-e8a4dddb3b54814713c411a094fc1a9b90492962.tar.xz serverdata-e8a4dddb3b54814713c411a094fc1a9b90492962.zip |
Merge pull request #20 from o11c/master
Refactor callfunc and callsub out of if statements
Diffstat (limited to 'world/map')
-rw-r--r-- | world/map/npc/001-1/guide.txt | 14 | ||||
-rw-r--r-- | world/map/npc/008-1/annualeaster.txt | 13 | ||||
-rw-r--r-- | world/map/npc/009-1/jack.txt | 12 | ||||
-rw-r--r-- | world/map/npc/009-1/milly.txt | 31 | ||||
-rw-r--r-- | world/map/npc/016-1/gwendolyn.txt | 14 | ||||
-rw-r--r-- | world/map/npc/020-2/baktar.txt | 96 | ||||
-rw-r--r-- | world/map/npc/botcheck/announcements.txt | 9 | ||||
-rw-r--r-- | world/map/npc/functions/banker.txt | 4 | ||||
-rw-r--r-- | world/map/npc/halloween/2008/prize_master.txt | 17 | ||||
-rw-r--r-- | world/map/npc/halloween/2011/trick_or_treat.txt | 1 |
10 files changed, 113 insertions, 98 deletions
diff --git a/world/map/npc/001-1/guide.txt b/world/map/npc/001-1/guide.txt index 18ee0a09..07c6f9bb 100644 --- a/world/map/npc/001-1/guide.txt +++ b/world/map/npc/001-1/guide.txt @@ -4,9 +4,13 @@ // This line is only relevant for players, who started before the timestamp was introduced. // Set the graduation cap flag at the right position. // It is a bugfix - if ((TUT_var < 4) && (TUT_var & 2)) set FLAGS, FLAGS|FLAG_GOT_GRADUATIONCAP; + if ((TUT_var < 4) && (TUT_var & 2)) + set FLAGS, FLAGS|FLAG_GOT_GRADUATIONCAP; - if ((TUT_var != 0) && !(FLAGS & FLAG_GOT_GRADUATIONCAP) && BaseLevel >= 10) callsub S_Grad; + if ((TUT_var != 0) && !(FLAGS & FLAG_GOT_GRADUATIONCAP) && BaseLevel >= 10) + goto L_Grad; + +L_DoneGrad: mes "[Ian the Guide]"; mes "\"Would you like to know about something?\""; next; @@ -160,7 +164,7 @@ L_Know: mes "\"But remember, the game isn't fun when you already know what to do. Use it well or you will lose interest in playing The Mana World! Please help by reporting anything that is unclear, outdated or that needs to be seen on our forums at http://forums.themanaworld.org.\""; close; -S_Grad: +L_Grad: getinventorylist; if (@inventorylist_count == 100) goto L_TooMany; mes "[Ian the Guide]"; @@ -168,11 +172,11 @@ S_Grad: getitem "GraduationCap", 1; set FLAGS, FLAGS | FLAG_GOT_GRADUATIONCAP; next; - return; + goto L_DoneGrad; L_TooMany: mes "[Ian the Guide]"; mes "\"I wanted to give you something, but you don't have room for it.\""; next; - return; + goto L_DoneGrad; } diff --git a/world/map/npc/008-1/annualeaster.txt b/world/map/npc/008-1/annualeaster.txt index 2e59275c..7032a0f3 100644 --- a/world/map/npc/008-1/annualeaster.txt +++ b/world/map/npc/008-1/annualeaster.txt @@ -168,10 +168,19 @@ OnTimer1000: set $@isEaster, 1; if (!$@wasEaster && $@isEaster) - callsub S_enableEggs; + goto L_do_update_enable; if ($@wasEaster && !$@isEaster) - callsub S_disableEggs; + goto L_do_update_disable; +L_do_update_enable: + callsub S_enableEggs; + goto L_done_update; + +L_do_update_disable: + callsub S_disableEggs; + goto L_done_update; + +L_done_update: set $@wasEaster, $@isEaster; if (!$@isEaster) diff --git a/world/map/npc/009-1/jack.txt b/world/map/npc/009-1/jack.txt index 65968d5e..f92813db 100644 --- a/world/map/npc/009-1/jack.txt +++ b/world/map/npc/009-1/jack.txt @@ -39,8 +39,11 @@ mes "[Jack Lumber]"; mes "\"Hello there, my name is Jack Lumber, the enemy of all trees. If you need some firewood just let me know.\""; - if (@inspector == 1) - callsub S_NohMask_Ask; + if (@inspector != 1) + goto L_NotInspector; + callsub S_NohMask_Ask; + +L_NotInspector: next; if (@Q_Forestbow < 1) goto L_Close; @@ -96,8 +99,9 @@ L_Bow_state_2: if (@Q_Forestbow > 3) goto L_Bow_state_4; mes "\"Good luck hunting those tree monsters - you will need it.\""; - if (@inspector == 1) - callsub S_NohMask_Ask; + if (@inspector != 1) + goto L_Close; + callsub S_NohMask_Ask; goto L_Close; L_Bow_state_4: diff --git a/world/map/npc/009-1/milly.txt b/world/map/npc/009-1/milly.txt index a6b505cc..b5a482a2 100644 --- a/world/map/npc/009-1/milly.txt +++ b/world/map/npc/009-1/milly.txt @@ -29,8 +29,7 @@ mes "[Milly]"; mes "\"Hello traveler, welcome to Hurnscald.\""; next; - if (@inspector == 1) - callsub S_InspectorQuest; + callsub S_InspectorMaybe; mes "\"Have you met Kfahr yet? He is the greatest hero that ever walked the land of Hurnscald!\""; menu @@ -61,8 +60,7 @@ L_NoKnifeYet: mes "[Milly]"; mes "\"Hi again.\""; next; - if (@inspector == 1) - callsub S_InspectorQuest; + callsub S_InspectorMaybe; mes "\"Have you talked to Kfahr lately?\""; menu @@ -109,8 +107,7 @@ L_GotBoneKnife: mes "[Milly]"; mes "\"Hi there.\""; next; - if (@inspector == 1) - callsub S_InspectorQuest; + callsub S_InspectorMaybe; mes "\"I heard that you got an exotic knife from Kfahr."; mes "Would you kindly show it to me?\""; @@ -159,8 +156,7 @@ L_SavedRossy: mes "[Milly]"; mes "\"Hi friend!\""; next; - if (@inspector == 1) - callsub S_InspectorQuest; + callsub S_InspectorMaybe; mes "\"Word of your fame has spread throughout all Hurnscald of your great heroism by helping my friends Rossy and Julia!\""; next; @@ -195,8 +191,7 @@ L_SavedCindy: mes "[Milly]"; mes "\"Hi!\""; next; - if (@inspector == 1) - callsub S_InspectorQuest; + callsub S_InspectorMaybe; mes "\"Are the rumors true?\""; next; @@ -234,8 +229,7 @@ L_GotSetzer: mes "[Milly]"; mes "\"Hello!\""; next; - if (@inspector == 1) - callsub S_InspectorQuest; + callsub S_InspectorMaybe; mes "\"I heard that you got hold of a Setzer!\""; next; @@ -266,8 +260,7 @@ L_OfferCap: mes "[Milly]"; mes "\"Hi there, hero of Hurnscald!\""; next; - if (@inspector == 1) - callsub S_InspectorQuest; + callsub S_InspectorMaybe; mes "\"You really have proven yourself over and over. There is no way anyone could possibly say, you are not the equal of Kfahr!\""; next; @@ -326,8 +319,7 @@ L_FinishedGood: mes "[Milly]"; mes "\"Hi there friend, my hero!\""; next; - if (@inspector == 1) - callsub S_InspectorQuest; + callsub S_InspectorMaybe; mes "\"Wear the copter beany cap in good health, mana and wealth! See you around!\""; goto L_Close; @@ -336,8 +328,7 @@ L_FinishedBad: mes "[Milly]"; mes "\"Oh, it's you. I suppose you're here to make fun of my hat again.\""; next; - if (@inspector == 1) - callsub S_InspectorQuest; + callsub S_InspectorMaybe; mes "\"Won't you continue your travels soon?\""; menu "That's what I'm going to do.", -, @@ -368,7 +359,9 @@ L_Close: set @inspector, 0; close; -S_InspectorQuest: +S_InspectorMaybe: + if (@inspector != 1) + return; menu "Have you seen anything strange lately?", L_NohMask_Strange, "Do you know anything about the recent robberies?", L_NohMask_Robbery, diff --git a/world/map/npc/016-1/gwendolyn.txt b/world/map/npc/016-1/gwendolyn.txt index f3ae3f7e..47b8e463 100644 --- a/world/map/npc/016-1/gwendolyn.txt +++ b/world/map/npc/016-1/gwendolyn.txt @@ -79,7 +79,7 @@ L_fee: set Zeny, Zeny - @SCHOOLFEE; set @Q_hawkseye, 2; - callsub S_Update_Var; + callsub S_Update_Var; mes "[Gwendolyn Bowmaker]"; mes "\"The first thing you need is, obviously, a bow. You should not use any you come across, but a high quality one. I think it would be best to go to Alan in Hurnscald. He is my cousin, and knows how to make Forest Bows of exquisite quality. \""; @@ -101,7 +101,7 @@ L_state2: goto L_bow_bought; set @Q_hawkseye, 3; - callsub S_Update_Var; + callsub S_Update_Var; mes "[Gwendolyn Bowmaker]"; mes "\"Very well, this looks fine. It is time for your first lesson. \""; next; @@ -142,7 +142,7 @@ L_state3: getexp @QUEST_EGG_EXP, 0; set @Q_hawkseye, 4; - callsub S_Update_Var; + callsub S_Update_Var; mes "[Gwendolyn Bowmaker]"; mes "\"Very well. That will make a great meal.\""; @@ -157,7 +157,7 @@ L_state4: next; set @Q_hawkseye, 5; - callsub S_Update_Var; + callsub S_Update_Var; mes "[Gwendolyn Bowmaker]"; mes "\"Ok. You have made great progress. I think you are ready for further tasks.\""; next; @@ -432,7 +432,7 @@ L_target_hit: if( rand(500) > (2*readparam(bDex) + readparam(bAgi))) goto L_target_nohit; set @Q_hawkseye, 6; - callsub S_Update_Var; + callsub S_Update_Var; setskill SKILL_MALLARDS_EYE, 1; getexp @QUEST_HAWK_EXP, 0; @@ -465,13 +465,13 @@ L_state1: L_no_student: mes "\"That's a pity. Well, if you change your mind, come back any time.\""; set @Q_hawkseye, 1; - callsub S_Update_Var; + callsub S_Update_Var; goto L_Close; L_no_money: mes "\"I am sorry, but it seems that you don't have enough money. Come back when you have reorganized your finances.\""; set @Q_hawkseye, 1; - callsub S_Update_Var; + callsub S_Update_Var; goto L_Close; L_no_bow: diff --git a/world/map/npc/020-2/baktar.txt b/world/map/npc/020-2/baktar.txt index c6603d43..8e88e30d 100644 --- a/world/map/npc/020-2/baktar.txt +++ b/world/map/npc/020-2/baktar.txt @@ -98,7 +98,7 @@ L_KnowAlready: mes @npcname$; mes "\"I love Tulimshar's stuff. I'm collecting souvenirs from Tulimshar to help remind me of all the great times I had there. If you give me an interesting item from the area, I'll give you a nice reward. So, you have a new item?\""; goto L_startitem; -close; + close; L_exotic: mes @npcname$; @@ -183,76 +183,76 @@ L_NeverMind: L_DesertHat_Item: if(@Q_status & (1<<@BIT_DESERTHAT)) goto L_havealready; if (countitem("DesertHat") < 1) goto L_Noitem; - delitem "DesertHat", 1; - set Zeny, Zeny + @MONEY_DESERTHAT; - getexp @XP_DESERTHAT,0; - set @Q_status, @Q_status | (1<<@BIT_DESERTHAT); - callsub S_Update_Var; + delitem "DesertHat", 1; + set Zeny, Zeny + @MONEY_DESERTHAT; + getexp @XP_DESERTHAT,0; + set @Q_status, @Q_status | (1<<@BIT_DESERTHAT); + callsub S_Update_Var; close; L_DesertShirt_Item: if(@Q_status & (1<<@BIT_DESERTSHIRT)) goto L_havealready; if (countitem("DesertShirt") < 1) goto L_Noitem; - delitem "DesertShirt", 1; - set Zeny, Zeny + @MONEY_DESERTSHIRT; - getexp @XP_DESERTSHIRT,0; - set @Q_status, @Q_status | (1<<@BIT_DESERTSHIRT); - callsub S_Update_Var; + delitem "DesertShirt", 1; + set Zeny, Zeny + @MONEY_DESERTSHIRT; + getexp @XP_DESERTSHIRT,0; + set @Q_status, @Q_status | (1<<@BIT_DESERTSHIRT); + callsub S_Update_Var; close; L_SerfHat_Item: if(@Q_status & (1<<@BIT_SERFHAT)) goto L_havealready; if (countitem("SerfHat") < 1) goto L_Noitem; - delitem "SerfHat", 1; - set Zeny, Zeny + @MONEY_SERFHAT; - getexp @XP_SERFHAT,0; - set @Q_status, @Q_status | (1<<@BIT_SERFHAT); - callsub S_Update_Var; + delitem "SerfHat", 1; + set Zeny, Zeny + @MONEY_SERFHAT; + getexp @XP_SERFHAT,0; + set @Q_status, @Q_status | (1<<@BIT_SERFHAT); + callsub S_Update_Var; close; L_tongue_Item: if(@Q_status & (1<<@BIT_MS_TONGUE)) goto L_havealready; if (countitem("MountainSnakeTongue") < 1) goto L_Noitem; - delitem "MountainSnakeTongue", 1; - set Zeny, Zeny + @MONEY_MS_TONGUE; - getexp @XP_MS_TONGUE,0; - set @Q_status, @Q_status | (1<<@BIT_MS_TONGUE); - callsub S_Update_Var; -close; + delitem "MountainSnakeTongue", 1; + set Zeny, Zeny + @MONEY_MS_TONGUE; + getexp @XP_MS_TONGUE,0; + set @Q_status, @Q_status | (1<<@BIT_MS_TONGUE); + callsub S_Update_Var; + close; L_egg_Item: if(@Q_status & (1<<@BIT_MS_EGG)) goto L_havealready; if (countitem("MountainSnakeEgg") < 1) goto L_Noitem; - delitem "MountainSnakeEgg", 1; - set Zeny, Zeny + @MONEY_MS_EGG; - getexp @XP_MS_EGG,0; - set @Q_status, @Q_status | (1<<@BIT_MS_EGG); - callsub S_Update_Var; -close; + delitem "MountainSnakeEgg", 1; + set Zeny, Zeny + @MONEY_MS_EGG; + getexp @XP_MS_EGG,0; + set @Q_status, @Q_status | (1<<@BIT_MS_EGG); + callsub S_Update_Var; + close; L_skin_Item: if(@Q_status & (1<<@BIT_SNAKESKIN)) goto L_havealready; if (countitem("SnakeSkin") < 1) goto L_Noitem; - delitem "SnakeSkin", 1; - set Zeny, Zeny + @MONEY_SNAKESKIN; - getexp @XP_SNAKESKIN,0; - set @Q_status, @Q_status | (1<<@BIT_SNAKESKIN); - callsub S_Update_Var; -close; + delitem "SnakeSkin", 1; + set Zeny, Zeny + @MONEY_SNAKESKIN; + getexp @XP_SNAKESKIN,0; + set @Q_status, @Q_status | (1<<@BIT_SNAKESKIN); + callsub S_Update_Var; + close; L_BugLegItem: if(@Q_status & (1<<@BIT_BUGLEG)) goto L_havealready; if (countitem("BugLeg") < 1) goto L_Noitem; - delitem "BugLeg", 1; - set Zeny, Zeny + @MONEY_BUGLEG; - getexp @XP_BUGLEG,0; - set @Q_status, @Q_status | (1<<@BIT_BUGLEG); - callsub S_Update_Var; -close; + delitem "BugLeg", 1; + set Zeny, Zeny + @MONEY_BUGLEG; + getexp @XP_BUGLEG,0; + set @Q_status, @Q_status | (1<<@BIT_BUGLEG); + callsub S_Update_Var; + close; L_Noitem: mes @npcname$; mes "\"Well, if you happen to get items from Tulimshar, see me first before you sell anything.\""; -close; + close; L_havealready: mes @npcname$; mes "\"I already collected what you can offer me.\""; -close; + close; S_Update_Var: set QUEST_Nivalis_state, @@ -293,7 +293,7 @@ L_2_init: next; set @Q_status2, 1; callsub S_Update_Var2; -close; + close; L_2_talk1: mes @npcname$; @@ -313,7 +313,7 @@ L_2_talk1: mes "\"Ok.\""; set @Q_status2, 2; callsub S_Update_Var2; -close; + close; L_2_talk2: mes @npcname$; @@ -336,7 +336,7 @@ L_2_talk2: mes "\"I WANT YOU TO KILL THAT BASTARD!!\""; set @Q_status2, 3; callsub S_Update_Var2; -close; + close; L_2_talk3: menu "Ok, I am a professional in doing such things", L_2_professional, @@ -346,7 +346,7 @@ L_2_talk3: "Nevermind", -; mes @npcname$; mes "\"Get out of my way, prank!\""; -close; + close; L_2_professional: mes @npcname$; @@ -374,7 +374,7 @@ L_2_name: "They call me Mistakes. I am a professional killer as well. You heard about that business in the terranite cave?", -; mes @npcname$; mes "\"Alright, I see. Ok maybe I really need to calm down. Please leave me alone... I will try to calm down, ok?\""; -close; + close; S_Update_Var2: set QUEST_Nivalis_state, @@ -383,6 +383,6 @@ S_Update_Var2: set QUEST_Nivalis_state, (QUEST_Nivalis_state & ~(@Q_MASK2_BITS) | (@Q_status2_bits << @Q_SHIFT2_BITS)); -return; + return; } diff --git a/world/map/npc/botcheck/announcements.txt b/world/map/npc/botcheck/announcements.txt index 34e98273..95ca5438 100644 --- a/world/map/npc/botcheck/announcements.txt +++ b/world/map/npc/botcheck/announcements.txt @@ -167,8 +167,7 @@ OnTimer3600000: callsub S_PerformBroadcast; set $@GMSA_CURRENT_TICK, 0; set $@GMSA_MAX, $@GMSA_MAX - 1; - if ($@GMSA_MAX == 0) - callsub S_StopBroadcast; - end; - -}
\ No newline at end of file + if ($@GMSA_MAX != 0) + end; + callsub S_StopBroadcast; +} diff --git a/world/map/npc/functions/banker.txt b/world/map/npc/functions/banker.txt index 863f3ce1..42348957 100644 --- a/world/map/npc/functions/banker.txt +++ b/world/map/npc/functions/banker.txt @@ -2,7 +2,9 @@ function|script|Banker|{ - if (BankAccount > 0) callsub S_MoveAccount; + if (BankAccount == 0) + goto L_Start; + callsub S_MoveAccount; L_Start: mes "[" + @npcname$ + "]"; diff --git a/world/map/npc/halloween/2008/prize_master.txt b/world/map/npc/halloween/2008/prize_master.txt index d2accb34..34d4236b 100644 --- a/world/map/npc/halloween/2008/prize_master.txt +++ b/world/map/npc/halloween/2008/prize_master.txt @@ -3,7 +3,10 @@ 010-2.gat,43,32,0 script Prize Master 150,{ if (Halloween08 == 65535) goto L_Finished; - if (Halloween08 == 0) callsub S_Explain; + if (Halloween08 != 0) goto L_DidExplain; + callsub S_Explain; + +L_DidExplain: // Get detailed info about equipment callfunc "ProcessEquip"; @@ -59,7 +62,7 @@ L_Pumpkin_Done: mes "[Prize Master]"; mes "\"I think I've seen this Jack O before.\""; close; - + @@ -76,7 +79,7 @@ L_Axe_Done: mes "[Prize Master]"; mes "\"You've pulled the axe on me already.\""; close; - + @@ -197,7 +200,7 @@ L_GradCap_Done: mes "[Prize Master]"; mes "\"Sorry, professor, but I've already seen you.\""; close; - + @@ -222,7 +225,7 @@ L_NohMask_Done: mes "\"I've caught you trying to get another prize for the same mask.\""; close; - + @@ -366,9 +369,9 @@ L_BCowboy_BadTorso: mes "[Prize Master]"; mes "\"Fashion doesn't seem to be your forte. Try to match that hat better.\""; close; - - + + L_Antler: diff --git a/world/map/npc/halloween/2011/trick_or_treat.txt b/world/map/npc/halloween/2011/trick_or_treat.txt index b5fc7ba3..1b502d65 100644 --- a/world/map/npc/halloween/2011/trick_or_treat.txt +++ b/world/map/npc/halloween/2011/trick_or_treat.txt @@ -7,6 +7,7 @@ //+ set @hw2011_npc_id, $@hw2011_npc_vincent; //+ if (gettime(7) == $@hw2011_year && gettime(6) == 10 && gettime(5) >= $@hw2011_start_day) //+ callfunc "TrickOrTreat2011"; +// Later note: it turns out that callfunc in an "if" is actually illegal. // Variables: // $@hw2011_maskmemory = Sliced Array containing the record of the last masks used to trick or treat each NPC. |