summaryrefslogtreecommitdiff
path: root/world/map/npc
diff options
context:
space:
mode:
authorBen Longbons <b.r.longbons@gmail.com>2013-09-16 11:04:07 -0700
committerBen Longbons <b.r.longbons@gmail.com>2013-09-16 11:28:50 -0700
commitc8f2dea0bd0068aac6f59a5053d4f0576f21bb23 (patch)
tree6fd01d79a602924b9c56e9e7b8ef014bcdbce6a1 /world/map/npc
parent1f30542a2d0a10e1834bac8d83fb210afc3d618f (diff)
downloadserverdata-c8f2dea0bd0068aac6f59a5053d4f0576f21bb23.tar.gz
serverdata-c8f2dea0bd0068aac6f59a5053d4f0576f21bb23.tar.bz2
serverdata-c8f2dea0bd0068aac6f59a5053d4f0576f21bb23.tar.xz
serverdata-c8f2dea0bd0068aac6f59a5053d4f0576f21bb23.zip
Refactor all broken returns into goto L_Return
Diffstat (limited to 'world/map/npc')
-rw-r--r--world/map/npc/008-1/annualeaster.txt5
-rw-r--r--world/map/npc/009-1/milly.txt2
-rw-r--r--world/map/npc/009-4/torches.txt20
-rw-r--r--world/map/npc/018-2/caul.txt10
-rw-r--r--world/map/npc/027-1/graves.txt5
-rw-r--r--world/map/npc/027-1/monsters.txt15
-rw-r--r--world/map/npc/052-1/channelling.txt3
-rw-r--r--world/map/npc/functions/dailyquest.txt5
-rw-r--r--world/map/npc/functions/game_rules.txt5
-rw-r--r--world/map/npc/functions/mob_points.txt6
-rw-r--r--world/map/npc/items/magic_gm_top_hat.txt5
-rw-r--r--world/map/npc/items/require_stat.txt7
-rw-r--r--world/map/npc/items/restricted_item.txt7
13 files changed, 69 insertions, 26 deletions
diff --git a/world/map/npc/008-1/annualeaster.txt b/world/map/npc/008-1/annualeaster.txt
index 66c1c746..e4ed6b1b 100644
--- a/world/map/npc/008-1/annualeaster.txt
+++ b/world/map/npc/008-1/annualeaster.txt
@@ -219,12 +219,13 @@ S_disableEggs:
S_relocateEasterEgg:
if ($@peopleFoundEggs[$@EggID] < $@AEASTER_mapcount)
- return;
+ goto L_Return;
set $@peopleFoundEggs[$@EggID], 0;
set $@eastereggPos, rand(getarraysize($@easteregg_posx));
npcwarp $@easteregg_posx[$@eastereggPos], $@easteregg_posy[$@eastereggPos], "#TestEgg" + $@EggID;
- return;
+L_Return:
+ return;
}
diff --git a/world/map/npc/009-1/milly.txt b/world/map/npc/009-1/milly.txt
index 00a63939..c195d9eb 100644
--- a/world/map/npc/009-1/milly.txt
+++ b/world/map/npc/009-1/milly.txt
@@ -362,7 +362,7 @@ L_Close:
S_InspectorMaybe:
if (@inspector != 1)
- return;
+ goto L_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/009-4/torches.txt b/world/map/npc/009-4/torches.txt
index 79fb6ca1..eaf8c837 100644
--- a/world/map/npc/009-4/torches.txt
+++ b/world/map/npc/009-4/torches.txt
@@ -67,7 +67,7 @@ L_Error2:
function|script|DoneWithTorches|,
{
if (OrumQuest < 11 && OrumQuest >= 8)
- return;
+ goto L_Return;
if (OrumQuest < 7) goto L_Different;
@@ -82,29 +82,41 @@ L_Different:
mes "The flame on this torch looks different than the rest. You better tell Orum about it before doing anything.";
set OrumQuest, 6;
close;
+
+L_Return:
+ return;
}
// To make sure in range of torches
function|script|InRangeTorch1|,
{
if (isin("009-4.gat",67,20,69,25))
- return;
+ goto L_Return;
mes "You're too far away to do anything with that torch.";
close;
+
+L_Return:
+ return;
}
function|script|InRangeTorch2|,
{
if (isin("009-4.gat",65,41,69,46))
- return;
+ goto L_Return;
mes "You're too far away to do anything with that torch.";
close;
+
+L_Return:
+ return;
}
function|script|InRangeTorch3|,
{
if (isin("009-4.gat",33,84,37,88))
- return;
+ goto L_Return;
mes "You're too far away to do anything with that torch.";
close;
+
+L_Return:
+ return;
}
function|script|TorchLoop|,
diff --git a/world/map/npc/018-2/caul.txt b/world/map/npc/018-2/caul.txt
index 8da98bdc..a599f5f8 100644
--- a/world/map/npc/018-2/caul.txt
+++ b/world/map/npc/018-2/caul.txt
@@ -438,15 +438,16 @@ L_monster_oil_pc_bad_ok:
L_monster_oil_auto_bad:
if (rand(3) == 0)
- return;
+ goto L_Return;
if (rand(readparam(bInt) + 100) > 70)
- return;
+ goto L_Return;
mes "The brew begins to bubble more violently.";
set @bubble_mode, @bubble_mode + 1;
if (@bubble_mode > 2)
next;
if (@bubble_mode > 2)
goto L_monster_oil_explode;
+
return;
L_monster_oil_explode:
@@ -1001,7 +1002,7 @@ L_check_explosion:
L_check_exp_nof:
// in about 95% of the cases anything is fine, so return.
- if (rand(1000) > @prob) return;
+ if (rand(1000) > @prob) goto L_Return;
// in some cases it is not:
// kabooom!
close2;
@@ -1069,6 +1070,9 @@ L_close:
set @inspector, 0;
close;
+L_Return:
+ return;
+
S_Update_Var:
set QUEST_Forestbow_state,
(QUEST_Forestbow_state & ~(@Q_MASK)
diff --git a/world/map/npc/027-1/graves.txt b/world/map/npc/027-1/graves.txt
index b4d9e273..5f522e15 100644
--- a/world/map/npc/027-1/graves.txt
+++ b/world/map/npc/027-1/graves.txt
@@ -3,9 +3,12 @@
function|script|GraveTooFar|,
{
if (isin("027-1.gat",89,54,122,76))
- return;
+ goto L_Return;
mes "You are too far away to read the grave.";
close;
+
+L_Return:
+ return;
}
027-1.gat,89,62,0|script|Grave#1|400,
diff --git a/world/map/npc/027-1/monsters.txt b/world/map/npc/027-1/monsters.txt
index 8daed98c..4b6fdfba 100644
--- a/world/map/npc/027-1/monsters.txt
+++ b/world/map/npc/027-1/monsters.txt
@@ -28,12 +28,12 @@ _MOBCOUNT_ZOMBIES:
set @state, ((QUEST_Graveyard_Inn & @Graveyard_Inn_MASK) >> @Graveyard_Inn_SHIFT);
if (@state != 1)
- return;
+ goto L_Return;
set @ring, @ring + 1;
if (@ring < 10)
- return;
+ goto L_Return;
if (rand(8) != 0)
- return;
+ goto L_Return;
message strcharinfo(0), "You found a ring hidden in the zombie's rotten rags. Maybe this is what Aldred was looking for...";
set @state, 2;
callsub S_Update_Mask;
@@ -47,17 +47,20 @@ _MOBCOUNT_FALLENS:
set @state, ((QUEST_Graveyard_Inn & @Graveyard_Inn_MASK) >> @Graveyard_Inn_SHIFT);
if (@state != 1)
- return;
+ goto L_Return;
set @ring, @ring + 1;
if (@ring < 10)
- return;
+ goto L_Return;
if (rand(8) != 0)
- return;
+ goto L_Return;
message strcharinfo(0), "You found a ring inside the fallen's broken helmet. Maybe this is what Aldred was looking for...";
set @state, 2;
callsub S_Update_Mask;
return;
+L_Return:
+ return;
+
S_Update_Mask:
set QUEST_Graveyard_Inn,
(QUEST_Graveyard_Inn & ~(@Graveyard_Inn_MASK))
diff --git a/world/map/npc/052-1/channelling.txt b/world/map/npc/052-1/channelling.txt
index af33683d..89e281ff 100644
--- a/world/map/npc/052-1/channelling.txt
+++ b/world/map/npc/052-1/channelling.txt
@@ -179,7 +179,7 @@ OnTimer11000:
S_ItemSpawn:
if (isloggedin(getcharid(3, $@illia_char_channelling$)) == 0)
- return;
+ goto L_Return;
attachrid(getcharid(3, $@illia_char_channelling$));
// spawn items at random
set $@illia_item_spawn_i, rand(getarraysize($@illia_small_lazurites)/2);
@@ -205,6 +205,7 @@ S_ItemSpawn:
set $@illia_item_spawn_y, 0;
detachrid;
+L_Return:
return;
S_CheckChannelling:
diff --git a/world/map/npc/functions/dailyquest.txt b/world/map/npc/functions/dailyquest.txt
index 9b9d626e..aadafc89 100644
--- a/world/map/npc/functions/dailyquest.txt
+++ b/world/map/npc/functions/dailyquest.txt
@@ -119,7 +119,7 @@ L_Exit:
S_SayPhrase:
if (@dq_handle_return)
- return;
+ goto L_Return;
if (DailyQuestPoints < @dq_cost)
goto L_Exhausted;
if (DailyQuestPoints > BaseLevel)
@@ -150,4 +150,7 @@ L_Low:
L_Exhausted:
mes "\"You look exhausted, maybe you should rest a bit.\"";
return;
+
+L_Return:
+ return;
}
diff --git a/world/map/npc/functions/game_rules.txt b/world/map/npc/functions/game_rules.txt
index caf13cb1..1d9bd91d 100644
--- a/world/map/npc/functions/game_rules.txt
+++ b/world/map/npc/functions/game_rules.txt
@@ -14,7 +14,8 @@ function|script|GameRules|,
"Portugues (Portuguese)", L_Portuguese,
"Polski (Polish)", L_Polish,
"Italiano (Italian)", L_Italian;
- if (@canSkip) return;
+ // is this even reachable? TODO look at how the 'cancel' button works.
+ if (@canSkip) goto L_Return;
L_English:
mes "Players breaking the following rules may be banned (up to and including a permanent ban) or have their characters reset at the GM's discretion:";
@@ -159,5 +160,7 @@ L_End:
set @read, 1;
if (TUT_var == 0)
set TUT_var, gettimetick(2);
+
+L_Return:
return;
}
diff --git a/world/map/npc/functions/mob_points.txt b/world/map/npc/functions/mob_points.txt
index 0bdcec06..5f711afb 100644
--- a/world/map/npc/functions/mob_points.txt
+++ b/world/map/npc/functions/mob_points.txt
@@ -2,7 +2,7 @@
function|script|MobPoints|,
{
- if (@mobID < 1002) return;
+ if (@mobID < 1002) goto L_Return;
setarray @points,
1, // Maggot
@@ -159,4 +159,8 @@ L_good:
L_end:
set @value, 0;
+ end;
+
+L_Return:
+ return;
}
diff --git a/world/map/npc/items/magic_gm_top_hat.txt b/world/map/npc/items/magic_gm_top_hat.txt
index bd35846e..35b5fbd7 100644
--- a/world/map/npc/items/magic_gm_top_hat.txt
+++ b/world/map/npc/items/magic_gm_top_hat.txt
@@ -1,6 +1,6 @@
function|script|ActivateMagicGMTophat|,
{
- if (getgmlevel() < 60) return;
+ if (getgmlevel() < 60) goto L_Return;
getinventorylist;
if ((checkweight("MurdererCrown", 1) == 0) || (@inventorylist_count == 100))
goto L_Inventory;
@@ -15,4 +15,7 @@ function|script|ActivateMagicGMTophat|,
L_Inventory:
message strcharinfo(0), "You cannot create this item. You're too heavy or you don't have a free slot.";
return;
+
+L_Return:
+ return;
}
diff --git a/world/map/npc/items/require_stat.txt b/world/map/npc/items/require_stat.txt
index 699cb8f9..01ca1600 100644
--- a/world/map/npc/items/require_stat.txt
+++ b/world/map/npc/items/require_stat.txt
@@ -7,7 +7,7 @@
function|script|RequireStat|,
{
- if (@bStat$ == "" || @minbStatVal < 0) return;
+ if (@bStat$ == "" || @minbStatVal < 0) goto L_Return;
set @bStatVal, 0;
if (@bStat$ == "Str")
set @bStatVal, readparam(bStr);
@@ -21,8 +21,11 @@ function|script|RequireStat|,
set @bStatVal, readparam(bInt);
if (@bStat$ == "Luk")
set @bStatVal, readparam(bLuk);
- if (@bStatVal >= @minbStatVal) return;
+ if (@bStatVal >= @minbStatVal) goto L_Return;
// If the requirement isn't met, then we end the script.
// Hence, subsequent item modifiers won't be applied.
end;
+
+L_Return:
+ return;
}
diff --git a/world/map/npc/items/restricted_item.txt b/world/map/npc/items/restricted_item.txt
index 423b2c63..2aa69c7e 100644
--- a/world/map/npc/items/restricted_item.txt
+++ b/world/map/npc/items/restricted_item.txt
@@ -9,11 +9,14 @@
function|script|RestrictedItem|,
{
if (!@minLvl) set @minLvl, 60;
- if (debug || getgmlevel() >= @minLvl) return; // If the active character is staff, do nothing.
+ if (debug || getgmlevel() >= @minLvl) goto L_Return; // If the active character is staff, do nothing.
message strcharinfo(0), "This item repells you with extreme force. It does not seem to be meant for you.";
unequipbyid @slotId;
- if (getgmlevel()) return;
+ if (getgmlevel()) goto L_Return;
gmcommand "@wgm Restricted item '" + @itemId + "' used by character '" + strcharinfo(0) + "'.";
gmcommand "@l Restricted item '" + @itemId + "' used by character '" + strcharinfo(0) + "'.";
end;
+
+L_Return:
+ return;
}