From 22524d2f042d3645a7cd0b0aaa6bee13fea61cd8 Mon Sep 17 00:00:00 2001 From: Jesusaves Date: Sat, 4 Jul 2020 13:41:23 -0300 Subject: Avoid redeclaration of towns and locations at MapToLoc and LocToMap (also fix bugs) --- npc/functions/util.txt | 21 ++++++++------------- 1 file changed, 8 insertions(+), 13 deletions(-) diff --git a/npc/functions/util.txt b/npc/functions/util.txt index fb93ff074..c3c1f390a 100644 --- a/npc/functions/util.txt +++ b/npc/functions/util.txt @@ -927,9 +927,8 @@ function script EnterTown { // Fill variable .@v$=getarg(0); - // Validade variable, see npc/000-1/exit.txt first - setarray .@locs$, "Candor", "Tulim", "Halin", "Hurns", "LoF", "Lilit", "Nival", "Frostia"; - if (array_find(.@locs$, .@v$) < 0) + // Validade variable, see npc/config/location.txt first + if (array_find($@LOCMASTER_LOC$, .@v$) < 0) return Exception("Invalid location passed to EnterTown: "+.@v$); LOCATION$=.@v$; @@ -948,14 +947,12 @@ function script LocToMap { else .@err=RB_DEBUGMES; - // Validade variable, see npc/000-1/exit.txt first - setarray .@mapx$, "005-1", "003-1", "009-1", "012-1", "017-1", "018-5", "020-1", "024-1"; - setarray .@locs$, "Candor", "Tulim", "Halin", "Hurns", "LoF", "Lilit", "Nival", "Frostia"; - .@lx=array_find(.@locs$, .@v$); + // Validade variable, see npc/config/location.txt first + .@lx=array_find($@LOCMASTER_LOC$, .@v$); if (.@lx < 0) return Exception("Invalid location passed to LocToMap: "+.@v$, .@err); - return .@locs$[.@lx]; + return $@LOCMASTER_MAP$[.@lx]; } // Convert map name to location id @@ -970,14 +967,12 @@ function script MapToLoc { else .@err=RB_DEBUGMES; - // Validade variable, see npc/000-1/exit.txt first - setarray .@mapx$, "005-1", "003-1", "009-1", "012-1", "017-1", "018-5", "020-1", "024-1"; - setarray .@locs$, "Candor", "Tulim", "Halin", "Hurns", "LoF", "Lilit", "Nival", "Frostia"; - .@lx=array_find(.@mapx$, .@v$); + // Validade variable, see npc/config/location.txt first + .@lx=array_find($@LOCMASTER_MAP$, .@v$); if (.@lx < 0) return Exception("Invalid map passed to MapToLoc: "+.@v$, .@err); - return .@locs$[.@lx]; + return $@LOCMASTER_LOC$[.@lx]; } // Returns TOP 3 Average Level -- cgit v1.2.3-60-g2f50