viewing paste Toasty's Warper 1.32 | Athena

Posted on the
  1. //-------------------------------------------------------------------------
  2. //Toasty Warper 1.32
  3. // by ToastOfDoom
  4. //-------------------------------------------------------------------------
  5. //Changelog:
  6. //1.32 --------------------------------------------------------------------
  7. //- Changed default 'Upper' value to allow for 3rd class. (Thanks Annie)
  8. //1.31 --------------------------------------------------------------------
  9. //- Reverted BaseJob check back to jobLookup method but uses BaseJob instead
  10. //  of Class. Best of both methods. Saves on post processing calculations
  11. //  but still allows for an elegant way of writing script (don't need a 
  12. //  bunch of exceptions)
  13. //1.3 ---------------------------------------------------------------------
  14. //- Changed OnStart labels to OnStartNPC to prevent mystery errors.
  15. //- Removed jobLookup and replaced with BaseJob check with simple 
  16. //  adjustment for dancers. (Cheers to AnnieRuru for reminding me)
  17. //- Changed the way Upper status was checked.
  18. //- Changed the way WoE status was checked.
  19. //- Commented out defaultly missing moc_filds.
  20. //- Modified mapserver console output when script loads.
  21. //1.2 ---------------------------------------------------------------------
  22. //- Added a index lookup for maps (.map_<mapname> = index)
  23. //- Implemented user count for nodes (stored in .userCount_#[%])
  24. //- Added settings to turn on/off user count for nodes and maps
  25. //  (in OnInit: .showNodeUserCount, .showMapUserCount)
  26. //- Optimised the overflow test function so it wouldn't sleep so much
  27. //  (ie..no longer takes so much time to execute)
  28. //1.1 ---------------------------------------------------------------------
  29. //- Renamed some NPCs cause 'warper' was too common and was causing problems
  30. //- Chucked out the old cost system and replaced with a new multi-
  31. //  modification structure. Thus old bug with cost not passing on pass 1st
  32. //  sub menu no longer exists.
  33. //- Now can dynamically adjusts available maps/menus according to:
  34. //     - "gm": 0: allows everyone
  35. //             0+: only allows people above or equal to set gmlevel
  36. //             0-: only allows people below or equal to set gmlevel
  37. //     - "woe": 1:active when woe inactive
  38. //              2:active when woe active
  39. //              3:active regardless of woe setting
  40. //     - "job": works exactly the same as the 'job' setting in item_db
  41. //     - "upper": same as 'upper' setting in item_db
  42. //     - "gender": same as 'sex' setting in item_db
  43. //     - "blvl": works the same as 'gm' but with base level instead
  44. //     - "flag": when passed a variable name, it check if variable is 
  45. //               empty as the condition to allow access.
  46. //     - "function": like with 'flag' but instead of a variable, it uses a
  47. //                   function name. Will pass the following parameters:
  48. //                      Node: "Node", <nodeID>, <nodeName>  
  49. //                      Map: "Map", <mapID>, <mapTitle>, <mapName>, <mapX>, <mapY>, <mapCost>
  50. //- Other modifiers added: "zeny", "mapUsers"
  51. //- Shortened some of the map names to get them to fit better
  52. //1.0 ---------------------------------------------------------------------
  53. //- Added menu check in OnInit that checks if a menu may exceed maximum
  54. //  menu length. Hardcoded to print a warning at 2000 characters to
  55. //  compensate for changes in length due to number of map users. Client
  56. //  will crash if exceeds 2047.
  57. //0.3 ---------------------------------------------------------------------
  58. //- Fixed npc duplication problem
  59. //- Added last warp functionality (edit .numLastWarps in OnInit to adjust
  60. //  number of listed warps)
  61. //- Colour-coded some things in the menu
  62. //0.2 ---------------------------------------------------------------------
  63. //- Fixed bad lookup names for x/y coords for warp (thanks BrianL)
  64. //- Removed 'Back' option for root node
  65. //- Added ablilty to define basic zeny cost to individual nodes and/or maps
  66. //0.1 ---------------------------------------------------------------------
  67. //- Initial Release
  68. //-------------------------------------------------------------------------
  69. -	script	toastywarperbase	-1,{
  70.  
  71. 	function StartNode;
  72. 	function EndNode;
  73. 	function AddMap;
  74. 	function SetArrayValue;
  75. 	function GetArrayValue;
  76. 	function WipeArray; //can't use cleararray =P
  77. 	function ComputeMenu;
  78. 	function ShowMenu;
  79. 	function SelectMap;
  80. 	function AddLastWarpsNode;
  81. 	function ConvertStringToChrArray;
  82. 	function GenerateMapSaveString;
  83. 	function AddMapToList;
  84. 	function ListMaps;
  85. 	function InitialiseMapData;
  86. 	function PrepLastWarpsMenu;
  87. 	function TestMenus;
  88. 	function CountAllUsers;
  89.  
  90. OnStartNPC:
  91. 	set @gotoCount, 0;	//make sure it doesn't overflow and crash later on.
  92. 	if(getgmlevel() >= .gmAccessLvl) {
  93. 		mes "Would to like to test all the menus for overflow error?";
  94. 		next;
  95. 		if(prompt("Yes:No") == 1) {
  96. 			TestMenus();
  97. 		}
  98. 	}
  99.  
  100. 	mes "Welcome!!";
  101.  
  102. 	if(.showNodeUserCount)
  103. 		CountAllUsers();
  104.  
  105. 	next;
  106.  
  107. 	set .@selectedMap, ShowMenu();
  108. 	SelectMap(.@selectedMap);
  109.  
  110. 	end;
  111.  
  112. 	function ShowMenu {
  113. 		setarray .@stack$[0], ".menu_0$";	//traversed menu stack
  114.  
  115. 		while(1) {
  116. 			set .@currentMenu$, .@stack$[getarraysize(.@stack$) - 1];
  117. 			set .@menuStr$, ComputeMenu(.@currentMenu$);
  118.  
  119. 			if(getstrlen(.@menuStr$) >= 2047) { //graceful close if menu string overflows(2047)
  120. 				debugmes "TOASTYWARPER - ERROR: Menu (" + getd(.@currentMenu$ + "[0]") + ") has overflowed: " + getstrlen(.@menuStr$) + " chars.";
  121. 				mes "An error has occurred. Please notify the GMs";
  122. 				close;
  123. 			}
  124. 			set .@menu, select(.@menuStr$);
  125. 			set .@selectedItem, atoi(getd(.@currentMenu$ + "[" + (.@menu + 1) + "]"));
  126.  
  127. 			if(.@selectedItem == 0) {
  128. 				//back
  129. 				if(getarraysize(.@stack$) <= 1) {
  130. 					set .@i, -1;
  131. 					break;
  132. 				}
  133. 				setarray .@stack$[getarraysize(.@stack$) - 1], "";
  134. 			} else
  135. 				if(.@selectedItem <= .mapOffset) {
  136. 					setarray .@stack$[getarraysize(.@stack$)], ((.@selectedItem == .mapOffset)?"@menu_lastwarps$":".menu_" + .@selectedItem + "$");
  137. 				} else {
  138. 					//leaf node - map
  139. 					set .@i, .@selectedItem - .mapOffset;
  140. 					break;
  141. 				}
  142. 		}
  143. 		return .@i;
  144. 	}
  145.  
  146. 	function CountAllUsers {
  147. 		//".userCount_#[%]"
  148. 		set .@i, .nodeCount;
  149.  
  150. 		while(.@i > 0) {
  151. 			set .@nodePtr$, ".menu_" + .@i + "$";
  152. 			set .@userCount, 0;
  153. 			set .@k, 2;
  154. 			while(getd(.@nodePtr$ + "[" + .@k + "]") != "") {
  155. 				set .@selectedItem, atoi(getd(.@nodePtr$ + "[" + .@k + "]"));
  156. 				if(.@selectedItem <= .mapOffset) {
  157. 					//node
  158. 					set .@userCount, .@userCount + ((.@selectedItem != .mapOffset)?
  159. 							(getd(".userCount_" + (.@selectedItem / 128) + "[" + (.@selectedItem % 128))):
  160. 							0); //make sure it's not the lastwarp menu
  161. 				} else {
  162. 					//map
  163. 					set .@selectedItem, .@selectedItem - .mapOffset;
  164.  
  165. 					set .@a$, "_" + (.@selectedItem / 128) + "$[" + (.@selectedItem % 128) + "]";
  166. 					set .@mapMap$, getd(".maps_map" + .@a$);
  167. 					set .@mapUsers$, getd(".maps_mapUsers" + .@a$);
  168.  
  169. 					set .@userCount, .@userCount + getmapusers((.@mapUsers$ == "")?.@mapMap$:.@mapUsers$);
  170. 				}
  171. 				set .@k, .@k + 1;
  172. 			}
  173. 			setd(".userCount_" + (.@i / 128) + "[" + (.@i % 128) + "]", .@userCount);
  174. 			set .@i, .@i - 1;
  175. 		}
  176. 	}
  177.  
  178. 	//Dynamic generation of menus happens in here!!!
  179. 	function ComputeMenu { //menu_pointer
  180. 		//default precomputed string (here for memory's sake)
  181. 		//return getd(getarg(0) + "[1]");
  182. 		set .@i, 2;
  183. 		set @gotoCount, @gotoCount + 3;
  184.  
  185. 		while(getd(getarg(0) + "[" + .@i + "]") != "") {
  186. 			set .@selectedItem, atoi(getd(getarg(0) + "[" + .@i + "]"));
  187.  
  188. 			set .@player_job, getd(".jobLookUp_" + BaseJob);
  189.  
  190. 			set @gotoCount, @gotoCount + 1;
  191. 			if(.@selectedItem <= .mapOffset) {
  192. 				//node - category
  193. 				set @gotoCount, @gotoCount + 1;
  194. 				if(.@selectedItem == .mapOffset) {
  195. 					//lastwarp
  196. 					set .@output$, .@output$ + "Last Warp";
  197. 				} else {
  198. 					set .@enable, 1;
  199. 					set .@a$, "_" + (.@selectedItem / 128) + "[" + (.@selectedItem % 128) + "]";
  200. 					set .@b$, "_" + (.@selectedItem / 128) + "$[" + (.@selectedItem % 128) + "]";
  201.  
  202. 					set .@nodeName$, getd(".menu_" + .@selectedItem + "$[0]");
  203. 					set .@gm, getd(".menus_gm" + .@a$);
  204. 					set .@woe, getd(".menus_woe" + .@a$);
  205. 					set .@job, getd(".menus_job" + .@a$);
  206. 					set .@upper, getd(".menus_upper" + .@a$);
  207. 					set .@gender, getd(".menus_gender" + .@a$);
  208. 					set .@blvl, getd(".menus_blvl" + .@a$);
  209. 					set .@flag$, getd(".menus_flag" + .@b$);
  210. 					set .@function$, getd(".menus_function" + .@b$);
  211.  
  212. 					set .@enable, .@enable && ((.@gm >= 0)?(getgmlevel() >= .@gm):((getgmlevel() + .@gm) <= 0));
  213. 					set .@enable, .@enable && (.@woe & ((agitcheck() || agitcheck2()) + 1) > 0);
  214. 					set .@enable, .@enable && ((.@job & (1 << .@player_job)) > 0);
  215. 					set .@enable, .@enable && ((.@upper & pow(2, Upper)) > 0);
  216. 					set .@enable, .@enable && (.@gender == Sex || .@gender == 2);
  217. 					set .@enable, .@enable && ((.@blvl >= 0)?(BaseLevel >= .@blvl):(BaseLevel + .@blvl <= 0));
  218. 					set .@enable, .@enable && ((.@flag$ != "")?getd(.@flag$):1);
  219. 					if(.@function$ != "")	//used if here cause logical operators won't shortcircuit and thus will execute really bad code
  220. 						set .@enable, .@enable && callfunc(.@function$, "Node", .@selectedItem, .@nodeName$);
  221.  
  222. 					set .@userCount, getd(".userCount" + .@a$);
  223.  
  224. 					set .@output$, .@output$ + ((.@enable)?(.@nodeName$ + 
  225. 							((.showNodeUserCount)?(" [^0000FF" + .@userCount + "^000000]"):"")):"");
  226.  
  227. 					set @gotoCount, @gotoCount + 2;
  228. 				}
  229.  
  230. 				set .@output$, .@output$ + ":";
  231. 			} else {
  232. 				//leaf node - map
  233. 				set .@selectedItem, .@selectedItem - .mapOffset;
  234.  
  235. 				set .@enable, 1;
  236. 				set .@a$, "_" + (.@selectedItem / 128) + "[" + (.@selectedItem % 128) + "]";
  237. 				set .@b$, "_" + (.@selectedItem / 128) + "$[" + (.@selectedItem % 128) + "]";
  238.  
  239. 				set .@mapName$, getd(".maps_name" + .@b$);
  240. 				set .@mapMap$, getd(".maps_map" + .@b$);
  241.  
  242. 				set .@zeny, getd(".maps_zeny" + .@a$);
  243. 				set .@gm, getd(".maps_gm" + .@a$);
  244. 				set .@woe, getd(".maps_woe" + .@a$);
  245. 				set .@job, getd(".maps_job" + .@a$);
  246. 				set .@upper, getd(".maps_upper" + .@a$);
  247. 				set .@gender, getd(".maps_gender" + .@a$);
  248. 				set .@blvl, getd(".maps_blvl" + .@a$);
  249. 				set .@mapUsers$, getd(".maps_mapUsers" + .@b$);
  250. 				set .@flag$, getd(".maps_flag" + .@b$);
  251. 				set .@function$, getd(".maps_function" + .@b$);
  252.  
  253. 				set .@enable, .@enable && ((.@gm >= 0)?(getgmlevel() >= .@gm):((getgmlevel() + .@gm) <= 0));
  254. 				set .@enable, .@enable && (.@woe & ((agitcheck() || agitcheck2()) + 1) > 0);
  255. 				set .@enable, .@enable && ((.@job & (1 << .@player_job)) > 0);
  256. 				set .@enable, .@enable && ((.@upper & pow(2, Upper)) > 0);
  257. 				set .@enable, .@enable && (.@gender == Sex || .@gender == 2);
  258. 				set .@enable, .@enable && ((.@blvl >= 0)?(BaseLevel >= .@blvl):(BaseLevel + .@blvl <= 0));
  259. 				set .@enable, .@enable && ((.@flag$ != "")?getd(.@flag$):1);
  260. 				if(.@function$ != "") {	//used if here cause logical operators won't shortcircuit and thus will execute really bad code
  261. 					set .@mapX, getd(".maps_x" + .@a$);
  262. 					set .@mapY, getd(".maps_y" + .@a$);
  263. 					set .@enable, .@enable && callfunc(.@function$, "Map", .@selectedItem, .@mapName$, .@mapMap$, .@mapX, .@mapY, .@zeny);
  264. 				}
  265.  
  266. 				set .@numUsers, getmapusers((.@mapUsers$ == "")?.@mapMap$:.@mapUsers$);				
  267.  
  268. 				set .@output$, .@output$ + ((.@enable)?
  269. 					("- " + .@mapName$ + 
  270. 					((.showMapUserCount)?(" [^0000FF" + .@numUsers + "^000000]"):"") + 
  271. 					((.@zeny > 0)?(" - " + .@zeny + "z"):"")):"") + ":";
  272.  
  273. 				set @gotoCount, @gotoCount + 2;
  274. 			}
  275. 			set .@i, .@i + 1;
  276. 			set @gotoCount, @gotoCount + 1;
  277. 		}
  278. 		return .@output$ + ((getarg(0) != ".menu_0$") ? "Back" : "");
  279. 	}
  280.  
  281. 	function SelectMap { // <mapID>
  282. 		set .@name$, GetArrayValue(".maps_name", getarg(0), 1);
  283. 		set .@map$, GetArrayValue(".maps_map", getarg(0), 1);
  284. 		set .@x, GetArrayValue(".maps_x", getarg(0));
  285. 		set .@y, GetArrayValue(".maps_y", getarg(0));
  286. 		set .@users, getmapusers(.@map$);
  287. 		set .@cost, GetArrayValue(".maps_zeny", getarg(0));
  288.  
  289. 		mes "^0000FF" + .@name$ + "^000000 has ^0000FF" + .@users + "^000000 player" + ((.@users != 1)?"s":"") + " at the moment.";
  290. 		if(.@cost > 0) {
  291. 			mes "It costs ^0000FF" + .@cost + "z^000000 to warp here.";
  292. 			if(Zeny < .@cost) {
  293. 				mes " ";
  294. 				mes "^FF0000You do not have enough zeny to warp here.^000000";
  295. 				mes "Please come back when you do.";
  296. 				close2;
  297. 				return;
  298. 			}
  299. 		}
  300.  
  301. 		mes "Would you like to warp there now?";
  302.  
  303. 		set .@menu, select("Yes:No");
  304. 		close2;
  305.  
  306. 		if(.@menu == 1) {
  307. 			AddMapToList(getarg(0) + 1);
  308. 			PrepLastWarpsMenu();
  309.  
  310. 			set Zeny, Zeny - .@cost;
  311. 			warp .@map$, .@x, .@y;
  312. 		}
  313.  
  314. 		return;
  315. 	}
  316.  
  317. 	OnPCLoginEvent:
  318. 		set @toasty_stackStart, 0;
  319. 		ConvertStringToChrArray(toasty_mapSave$, "@toasty_savedMaps");
  320. 		InitialiseMapData();
  321. 		end;
  322.  
  323. 	OnInit:
  324. 		set .gotoLimit, 2000;	//lower this if you get infinite loop errors
  325. 		set .numLastWarps, 10;	//max 64
  326. 		set .gmAccessLvl, 80;
  327.  
  328. 		set .mapOffset, 1000; //increase if total number of nodes exceed
  329.  
  330. 		set .showNodeUserCount, 1;	//enables|disables display of number of users on nodes
  331. 		set .showMapUserCount, 1;	//enables|disables display of number of users on maps
  332.  
  333. 		//used for data compression in last warp storage (DON'T TOUCH)
  334. 		setarray .char$[0],
  335. 			"0", "1", "2", "3", "4", "5", "6", "7", "8", "9",
  336. 			"A", "B", "C", "D", "E", "F", "G", "H", "I",
  337. 			"J", "K", "L", "M", "N", "O", "P", "Q", "R",
  338. 			"S", "T", "U", "V", "W", "X", "Y", "Z",
  339. 			"a", "b", "c", "d", "e", "f", "g", "h", "i",
  340. 			"j", "k", "l", "m", "n", "o", "p", "q", "r",
  341. 			"s", "t", "u", "v", "w", "x", "y", "z",
  342. 			"{", "|";
  343.  
  344. 		setarray .mapModifiers$[0], "", "zeny", "gm", "woe", "job", "upper", "gender", "blvl", "mapUsers", "flag", "function";
  345. 		setarray .tempModPtrs$[0], ".@badData$", ".@node_zeny", ".@node_gm", ".@node_woe", ".@node_job", ".@node_upper", ".@node_gender", ".@node_blvl", ".@node_mapUsers$", ".@node_flag$", ".@node_function$";
  346.  
  347. 		//define index lookups for modifiers
  348. 		while(.@i < getarraysize(.mapModifiers$)) {
  349. 			setd(".modifier_" + .mapModifiers$[.@i], .@i);
  350. 			set .@i, .@i + 1;
  351. 		}
  352.  
  353. 		//define index lookups for jobs
  354. 		setarray .@jobLookup_0[0], Job_Novice, Job_SuperNovice;
  355. 		setarray .@jobLookup_1[0], Job_Swordman;
  356. 		setarray .@jobLookup_2[0], Job_Mage;
  357. 		setarray .@jobLookup_3[0], Job_Archer;
  358. 		setarray .@jobLookup_4[0], Job_Acolyte;
  359. 		setarray .@jobLookup_5[0], Job_Merchant;
  360. 		setarray .@jobLookup_6[0], Job_Thief;
  361. 		setarray .@jobLookup_7[0], Job_Knight;
  362. 		setarray .@jobLookup_8[0], Job_Priest;
  363. 		setarray .@jobLookup_9[0], Job_Wizard;
  364. 		setarray .@jobLookup_10[0], Job_Blacksmith;
  365. 		setarray .@jobLookup_11[0], Job_Hunter;
  366. 		setarray .@jobLookup_12[0], Job_Assassin;
  367. 		setarray .@jobLookup_14[0], Job_Crusader;
  368. 		setarray .@jobLookup_15[0], Job_Monk;
  369. 		setarray .@jobLookup_16[0], Job_Sage;
  370. 		setarray .@jobLookup_18[0], Job_Alchemist;
  371. 		setarray .@jobLookup_19[0], Job_Bard, Job_Dancer;
  372. 		setarray .@jobLookup_21[0], Job_Taekwon;
  373. 		setarray .@jobLookup_22[0], Job_Star_Gladiator;
  374. 		setarray .@jobLookup_23[0], Job_Soul_Linker;
  375. 		setarray .@jobLookup_24[0], Job_Gunslinger;
  376. 		setarray .@jobLookup_25[0], Job_Ninja;
  377.  
  378. 		set .@i, 0;
  379. 		while(.@i < 25) {
  380. 			set .@jobsPtr$, ".@jobLookup_" + .@i;
  381. 			set .@k, getarraysize(getd(.@jobsPtr$));
  382. 			while(.@k > 0) {
  383. 				set .@k, .@k - 1;
  384. 				setd(".jobLookUp_" + getd(.@jobsPtr$ + "[" + .@k + "]"), .@i);
  385. 			}
  386. 			set .@i, .@i + 1;
  387. 		}
  388.  
  389. 		callsub(LoadData);
  390. 	end;
  391.  
  392. 	LoadData:
  393. 		//reset data;
  394. 		set .nodeCount, 0;
  395. 		set .mapCount, 1;
  396. 		cleararray(.buildStack$[0], "", 128);
  397. 		setarray .buildStack$[0], ".menu_0$";
  398.  
  399. 		//default mod values
  400. 		setarray .stack_zeny[0], 0;
  401. 		setarray .stack_gm[0], 0;
  402. 		setarray .stack_woe[0], 3;
  403. 		setarray .stack_job[0], 0x03FFFFFF;
  404. 		setarray .stack_upper[0], 119;
  405. 		setarray .stack_gender[0], 2;
  406. 		setarray .stack_blvl[0], 0;
  407. 		setarray .stack_mapUsers$[0], "";
  408. 		setarray .stack_flag$[0], "";
  409. 		setarray .stack_function$[0], "";
  410.  
  411. 		set .stackLevel, 1;
  412.  
  413. 		set .gotoCount, 0;
  414. 		sleep(1);
  415. 		set .@startLoadTime, gettimetick(0);
  416.  
  417. 		AddLastWarpsNode();
  418. 		StartNode("Towns");
  419. 			AddMap("Alberta", "alberta", 28, 234);
  420. 			AddMap("Aldebaran", "aldebaran", 140, 131);
  421. 			AddMap("Amatsu", "amatsu", 198, 84);
  422. 			AddMap("Ayothaya", "ayothaya", 150, 163);
  423. 			AddMap("Comodo", "comodo", 209, 143);
  424. 			AddMap("Einbech (Mining Village);", "einbech", 70, 95);
  425. 			AddMap("Einbroch", "einbroch", 64, 200);
  426. 			AddMap("Geffen", "geffen", 119, 59);
  427. 			AddMap("Gonryun", "gonryun", 160, 121);
  428. 			AddMap("Hugel", "hugel", 96, 145);
  429. 			AddMap("Izlude", "izlude", 128, 114);
  430. 			AddMap("Jawaii", "jawaii", 213, 230);
  431. 			AddMap("Lighthalzen", "lighthalzen", 158, 92);
  432. 			AddMap("Louyang", "louyang", 210, 108);
  433. 			AddMap("Lutie", "xmas", 147, 134);
  434. 			AddMap("Moscovia", "moscovia", 214, 183);
  435. 			AddMap("Morroc", "morocc", 156, 93);
  436. 			AddMap("Nameless Island", "nameless_n", 256, 215);
  437. 			AddMap("Niflheim", "niflheim", 85, 154);
  438. 			AddMap("Payon", "payon", 152, 75);
  439. 			AddMap("Prontera", "prontera", 155, 183);
  440. 			AddMap("Rachel", "rachel", 130, 137);
  441. 			AddMap("Thor Camp", "thor_camp", 254, 90);
  442. 			AddMap("Veins", "veins", 216, 123);
  443. 			AddMap("Yuno", "yuno", 157, 51);
  444. 			AddMap("Umbala", "umbala", 145, 155);
  445. 		EndNode();
  446. 		StartNode("Fields");
  447. 			StartNode("Amatsu Fields");
  448. 				AddMap("Amatsu Field 1", "ama_fild01", 190, 197);
  449. 			EndNode();
  450. 			StartNode("Ayothaya Fields");
  451. 				AddMap("Ayothaya Field 1", "ayo_fild01", 173, 134);
  452. 				AddMap("Ayothaya Field 2", "ayo_fild02", 212, 150);
  453. 			EndNode();
  454. 			StartNode("Comodo Fields");
  455. 				AddMap("Comodo Field 1", "cmd_fild01", 180, 178);
  456. 				AddMap("Comodo Field 2", "cmd_fild02", 231, 160);
  457. 				AddMap("Comodo Field 3", "cmd_fild03", 191, 172);
  458. 				AddMap("Comodo Field 4", "cmd_fild04", 228, 194);
  459. 				AddMap("Comodo Field 5", "cmd_fild05", 224, 203);
  460. 				AddMap("Comodo Field 6", "cmd_fild06", 190, 223);
  461. 				AddMap("Comodo Field 7", "cmd_fild07", 234, 177);
  462. 				AddMap("Comodo Field 8", "cmd_fild08", 194, 175);
  463. 				AddMap("Comodo Field 9", "cmd_fild09", 172, 172);
  464. 			EndNode();
  465. 			StartNode("Einbroch Fields");
  466. 				AddMap("Einbroch Field 1", "ein_fild01", 142, 225);
  467. 				AddMap("Einbroch Field 2", "ein_fild02", 182, 141);
  468. 				AddMap("Einbroch Field 3", "ein_fild03", 187, 228);
  469. 				AddMap("Einbroch Field 4", "ein_fild04", 185, 173);
  470. 				AddMap("Einbroch Field 5", "ein_fild05", 216, 173);
  471. 				AddMap("Einbroch Field 6", "ein_fild06", 195, 148);
  472. 				AddMap("Einbroch Field 7", "ein_fild07", 272, 220);
  473. 				AddMap("Einbroch Field 8", "ein_fild08", 173, 214);
  474. 				AddMap("Einbroch Field 9", "ein_fild09", 207, 174);
  475. 				AddMap("Einbroch Field 10", "ein_fild10", 196, 200);
  476. 			EndNode();
  477. 			StartNode("Geffen Fields");
  478. 				AddMap("Geffen Field 0", "gef_fild00", 46, 199);
  479. 				AddMap("Geffen Field 1", "gef_fild01", 213, 204);
  480. 				AddMap("Geffen Field 2", "gef_fild02", 195, 212);
  481. 				AddMap("Geffen Field 3", "gef_fild03", 257, 192);
  482. 				AddMap("Geffen Field 4", "gef_fild04", 188, 171);
  483. 				AddMap("Geffen Field 5", "gef_fild05", 166, 263);
  484. 				AddMap("Geffen Field 6", "gef_fild06", 248, 158);
  485. 				AddMap("Geffen Field 7", "gef_fild07", 195, 191);
  486. 				AddMap("Geffen Field 8", "gef_fild08", 186, 183);
  487. 				AddMap("Geffen Field 9", "gef_fild09", 221, 117);
  488. 				AddMap("Geffen Field 10", "gef_fild10", 178, 218);
  489. 				AddMap("Geffen Field 11", "gef_fild11", 136, 328);
  490. 				AddMap("Geffen Field 12", "gef_fild12", 240, 181);
  491. 				AddMap("Geffen Field 13", "gef_fild13", 235, 235);
  492. 				AddMap("Geffen Field 14", "gef_fild14", 211, 185);
  493. 			EndNode();
  494. 			StartNode("Gonryun Fields");
  495. 				AddMap("Gonryun Field 1", "gon_fild01", 220, 227);
  496. 			EndNode();
  497. 			StartNode("Hugel Fields");
  498. 				AddMap("Hugel Field 1", "hu_fild01", 268, 101);
  499. 				AddMap("Hugel Field 2", "hu_fild02", 222, 193);
  500. 				AddMap("Hugel Field 3", "hu_fild03", 232, 185);
  501. 				AddMap("Hugel Field 4", "hu_fild04", 252, 189);
  502. 				AddMap("Hugel Field 5", "hu_fild05", 196, 106);
  503. 				AddMap("Hugel Field 6", "hu_fild06", 216, 220);
  504. 				AddMap("Hugel Field 7", "hu_fild07", 227, 197);
  505. 			EndNode();
  506. 			StartNode("Lighthalzen Fields");
  507. 				AddMap("Lighthalzen Field 1", "lhz_fild01", 240, 179);
  508. 				AddMap("Lighthalzen Field 2", "lhz_fild02", 185, 235);
  509. 				AddMap("Lighthalzen Field 3", "lhz_fild03", 240, 226);
  510. 			EndNode();
  511. 			StartNode("Louyang Field");
  512. 				AddMap("Louyang Field 1", "lou_fild01", 229, 187);
  513. 			EndNode();
  514. 			StartNode("Lutie Field");
  515. 				AddMap("Lutie Field 1", "xmas_fild01", 115, 145);
  516. 			EndNode();
  517. 			StartNode("Manuk Fields");
  518. 				AddMap("Manuk Field 1", "man_fild01", 200, 210);
  519. 				AddMap("Manuk Field 2", "man_fild02", 206, 219);
  520. 			EndNode();
  521. 			StartNode("Mjolnir Fields");
  522. 				AddMap("Mjolnir Field 1", "mjolnir_01", 204, 120);
  523. 				AddMap("Mjolnir Field 2", "mjolnir_02", 175, 193);
  524. 				AddMap("Mjolnir Field 3", "mjolnir_03", 208, 213);
  525. 				AddMap("Mjolnir Field 4", "mjolnir_04", 179, 180);
  526. 				AddMap("Mjolnir Field 5", "mjolnir_05", 181, 240);
  527. 				AddMap("Mjolnir Field 6", "mjolnir_06", 195, 270);
  528. 				AddMap("Mjolnir Field 7", "mjolnir_07", 235, 202);
  529. 				AddMap("Mjolnir Field 8", "mjolnir_08", 188, 215);
  530. 				AddMap("Mjolnir Field 9", "mjolnir_09", 205, 144);
  531. 				AddMap("Mjolnir Field 10", "mjolnir_10", 245, 223);
  532. 				AddMap("Mjolnir Field 11", "mjolnir_11", 180, 206);
  533. 				AddMap("Mjolnir Field 12", "mjolnir_12", 196, 208);
  534. 			EndNode();
  535. 			StartNode("Moscovia Fields");
  536. 				AddMap("Okrestnosti of Moscovia Field 1", "mosk_fild01", 82, 104);
  537. 				AddMap("Okrestnosti of Moscovia 2", "mosk_fild02", 131, 147);
  538. 			EndNode();
  539. 			StartNode("Niflheim Fields");
  540. 				AddMap("Niflheim Field 1", "nif_fild01", 215, 229);
  541. 				AddMap("Niflheim Field 2", "nif_fild02", 167, 234);
  542. 			EndNode();
  543. 			StartNode("Odin Temple");
  544. 				AddMap("Odin Temple 1", "odin_tem01", 298, 167);
  545. 				AddMap("Odin Temple 2", "odin_tem02", 224, 149);
  546. 				AddMap("Odin Temple 3", "odin_tem03", 266, 280);
  547. 			EndNode();
  548. 			StartNode("Payon Forests");
  549. 				AddMap("Payon Forest 1", "pay_fild01", 158, 206);
  550. 				AddMap("Payon Forest 2", "pay_fild02", 151, 219);
  551. 				AddMap("Payon Forest 3", "pay_fild03", 205, 148);
  552. 				AddMap("Payon Forest 4", "pay_fild04", 186, 247);
  553. 				AddMap("Payon Forest 5", "pay_fild05", 134, 204);
  554. 				AddMap("Payon Forest 6", "pay_fild06", 193, 235);
  555. 				AddMap("Payon Forest 7", "pay_fild07", 200, 177);
  556. 				AddMap("Payon Forest 8", "pay_fild08", 137, 189);
  557. 				AddMap("Payon Forest 9", "pay_fild09", 201, 224);
  558. 				AddMap("Payon Forest 10", "pay_fild10", 160, 205);
  559. 				AddMap("Payon Forest 11", "pay_fild11", 194, 150);
  560. 			EndNode();
  561. 			StartNode("Prontera Fields");
  562. 				AddMap("Prontera Field 0", "prt_fild00", 184, 235);
  563. 				AddMap("Prontera Field 1", "prt_fild01", 190, 206);
  564. 				AddMap("Prontera Field 2", "prt_fild02", 240, 206);
  565. 				AddMap("Prontera Field 3", "prt_fild03", 190, 143);
  566. 				AddMap("Prontera Field 4", "prt_fild04", 307, 252);
  567. 				AddMap("Prontera Field 5", "prt_fild05", 239, 213);
  568. 				AddMap("Prontera Field 6", "prt_fild06", 185, 188);
  569. 				AddMap("Prontera Field 7", "prt_fild07", 193, 194);
  570. 				AddMap("Prontera Field 8", "prt_fild08", 187, 218);
  571. 				AddMap("Prontera Field 9", "prt_fild09", 210, 183);
  572. 				AddMap("Prontera Field 10", "prt_fild10", 195, 149);
  573. 				AddMap("Prontera Field 11", "prt_fild11", 198, 164);
  574. 			EndNode();
  575. 			StartNode("Rachel Fields");
  576. 				AddMap("Rachel Field 1", "ra_fild01", 192, 162);
  577. 				AddMap("Rachel Field 2", "ra_fild02", 235, 166);
  578. 				AddMap("Rachel Field 3", "ra_fild03", 202, 206);
  579. 				AddMap("Rachel Field 4", "ra_fild04", 202, 208);
  580. 				AddMap("Rachel Field 5", "ra_fild05", 225, 202);
  581. 				AddMap("Rachel Field 6", "ra_fild06", 202, 214);
  582. 				AddMap("Rachel Field 7", "ra_fild07", 263, 196);
  583. 				AddMap("Rachel Field 8", "ra_fild08", 217, 201);
  584. 				AddMap("Rachel Field 9", "ra_fild09", 87, 121);
  585. 				AddMap("Rachel Field 10", "ra_fild10", 277, 181);
  586. 				AddMap("Rachel Field 11", "ra_fild11", 221, 185);
  587. 				AddMap("Rachel Field 12", "ra_fild12", 175, 200);
  588. 				AddMap("Rachel Field 13", "ra_fild13", 174, 197);
  589. 			EndNode();
  590. 			StartNode("Sograt Deserts");
  591. 				AddMap("Sograt Desert 1", "moc_fild01", 219, 205);
  592. 				AddMap("Sograt Desert 2", "moc_fild02", 177, 206);
  593. 				AddMap("Sograt Desert 3", "moc_fild03", 194, 182);
  594. 				//AddMap("Sograt Desert 4", "moc_fild04", 184, 217);
  595. 				//AddMap("Sograt Desert 5", "moc_fild05", 203, 213);
  596. 				//AddMap("Sograt Desert 6", "moc_fild06", 213, 208);
  597. 				AddMap("Sograt Desert 7", "moc_fild07", 224, 170);
  598. 				//AddMap("Sograt Desert 8", "moc_fild08", 229, 177);
  599. 				//AddMap("Sograt Desert 9", "moc_fild09", 195, 198);
  600. 				//AddMap("Sograt Desert 10", "moc_fild10", 209, 168);
  601. 				AddMap("Sograt Desert 11", "moc_fild11", 198, 216);
  602. 				AddMap("Sograt Desert 12", "moc_fild12", 156, 187);
  603. 				AddMap("Sograt Desert 13", "moc_fild13", 185, 263);
  604. 				//AddMap("Sograt Desert 14", "moc_fild14", 209, 219);
  605. 				//AddMap("Sograt Desert 15", "moc_fild15", 223, 188);
  606. 				AddMap("Sograt Desert 16", "moc_fild16", 206, 228);
  607. 				AddMap("Sograt Desert 17", "moc_fild17", 208, 238);
  608. 				AddMap("Sograt Desert 18", "moc_fild18", 209, 223);
  609. 				AddMap("Sograt Desert 19", "moc_fild19", 85, 97);
  610. 				AddMap("Sograt Desert 20", "moc_fild20", 85, 97);
  611. 				AddMap("Sograt Desert 21", "moc_fild21", 85, 97);
  612. 				AddMap("Sograt Desert 22", "moc_fild22", 85, 97);
  613. 			EndNode();
  614. 			StartNode("Splendide Fields");
  615. 				AddMap("Splendide Field 1", "spl_fild01", 175, 186);
  616. 				AddMap("Splendide Field 2", "spl_fild02", 236, 184);
  617. 				AddMap("Splendide Field 3", "spl_fild03", 188, 204);
  618. 			EndNode();
  619. 			StartNode("Umbala Fields");
  620. 				AddMap("Umbala Field 1", "um_fild01", 217, 206);
  621. 				AddMap("Umbala Field 2", "um_fild02", 223, 221);
  622. 				AddMap("Umbala Field 3", "um_fild03", 237, 215);
  623. 				AddMap("Umbala Field 4", "um_fild04", 202, 197);
  624. 			EndNode();
  625. 			StartNode("Veins Fields");
  626. 				AddMap("Veins Field 1", "ve_fild01", 186, 175);
  627. 				AddMap("Veins Field 2", "ve_fild02", 196, 370);
  628. 				AddMap("Veins Field 3", "ve_fild03", 222, 45);
  629. 				AddMap("Veins Field 4", "ve_fild04", 51, 250);
  630. 				AddMap("Veins Field 5", "ve_fild05", 202, 324);
  631. 				AddMap("Veins Field 6", "ve_fild06", 150, 223);
  632. 				AddMap("Veins Field 7", "ve_fild07", 149, 307);
  633. 			EndNode();
  634. 			StartNode("Yuno Fields");
  635. 				AddMap("Yuno Field 1", "yuno_fild01", 189, 224);
  636. 				AddMap("Yuno Field 2", "yuno_fild02", 192, 207);
  637. 				AddMap("Yuno Field 3", "yuno_fild03", 221, 157);
  638. 				AddMap("Yuno Field 4", "yuno_fild04", 226, 199);
  639. 				AddMap("Yuno Field 5", "yuno_fild05", 223, 177);
  640. 				AddMap("Yuno Field 6", "yuno_fild06", 187, 232);
  641. 				AddMap("Yuno Field 7", "yuno_fild07", 231, 174);
  642. 				AddMap("Yuno Field 8", "yuno_fild08", 196, 203);
  643. 				AddMap("Yuno Field 9", "yuno_fild09", 183, 214);
  644. 				AddMap("Yuno Field 10", "yuno_fild10", 200, 124);
  645. 				AddMap("Yuno Field 11", "yuno_fild11", 195, 226);
  646. 				AddMap("Yuno Field 12", "yuno_fild12", 210, 304);
  647. 			EndNode();
  648. 		EndNode();
  649. 		StartNode("Dungeons");
  650. 			StartNode("Abbey, Cursed Monastery");
  651. 				AddMap("Abbey, Cursed Monastery - Lvl 1", "abbey01", 51, 14);
  652. 				AddMap("Abbey, Cursed Monastery - Lvl 2", "abbey02", 150, 11);
  653. 				AddMap("Abbey, Cursed Monastery - Lvl 3", "abbey03", 120, 10);
  654. 			EndNode();
  655. 			StartNode("Abyss Lakes");
  656. 				AddMap("Abyss Lakes - Lvl 1", "abyss_01", 192, 207);
  657. 				AddMap("Abyss Lakes - Lvl 2", "abyss_02", 275, 270);
  658. 				AddMap("Abyss Lakes - Lvl 3", "abyss_03", 116, 27);
  659. 			EndNode();
  660. 			StartNode("Amatsu Dungeon");
  661. 				AddMap("Amatsu Dungeon - Lvl 1", "ama_dun01", 228, 11);
  662. 				AddMap("Amatsu Dungeon - Lvl 2", "ama_dun02", 34, 41);
  663. 				AddMap("Amatsu Dungeon - Lvl 3", "ama_dun03", 119, 14);
  664. 			EndNode();
  665. 			StartNode("Anthell");
  666. 				AddMap("Anthell - Lvl 1", "anthell01", 35, 262);
  667. 				AddMap("Anthell - Lvl 2", "anthell02", 168, 170);
  668. 			EndNode();
  669. 			StartNode("Beach Dungeon");
  670. 				AddMap("Beach Dungeon - Lvl 1", "beach_dun", 266, 67);
  671. 				AddMap("Beach Dungeon - Lvl 2", "beach_dun2", 255, 244);
  672. 				AddMap("Beach Dungeon - Lvl 3", "beach_dun3", 23, 260);
  673. 			EndNode();
  674. 			StartNode("Ayothaya Dungeons");
  675. 				AddMap("Ancient Shrine Maze", "ayo_dun01", 275, 19);
  676. 				AddMap("Inside Ancient Shrine", "ayo_dun02", 24, 26);
  677. 			EndNode();
  678. 			StartNode("Byalan Dungeon");
  679. 				AddMap("Byalan Dungeon - Lvl 1", "iz_dun00", 168, 168);
  680. 				AddMap("Byalan Dungeon - Lvl 2", "iz_dun01", 253, 252);
  681. 				AddMap("Byalan Dungeon - Lvl 3", "iz_dun02", 236, 204);
  682. 				AddMap("Byalan Dungeon - Lvl 4", "iz_dun03", 32, 63);
  683. 				AddMap("Byalan Dungeon - Lvl 5", "iz_dun04", 26, 27);
  684. 			EndNode();
  685. 			StartNode("Clock Tower");
  686. 				AddMap("Clock Tower - Lvl 1", "c_tower1", 199, 159);
  687. 				AddMap("Clock Tower - Lvl 2", "c_tower2", 148, 283);
  688. 				AddMap("Clock Tower - Lvl 3", "c_tower3", 65, 147);
  689. 				AddMap("Clock Tower - Lvl 4", "c_tower4", 56, 155);
  690. 				AddMap("Clock Tower - Basement 1", "alde_dun01", 297, 25);
  691. 				AddMap("Clock Tower - Basement 2", "alde_dun02", 127, 169);
  692. 				AddMap("Clock Tower - Basement 3", "alde_dun03", 277, 178);
  693. 				AddMap("Clock Tower - Basement 4", "alde_dun04", 268, 74);
  694. 			EndNode();
  695. 			StartNode("Coal Mines");
  696. 				AddMap("Coal Mines - Lvl 1", "mjo_dun01", 52, 17);
  697. 				AddMap("Coal Mines - Lvl 2", "mjo_dun02", 381, 343);
  698. 				AddMap("Coal Mines - Lvl 3", "mjo_dun03", 302, 262);
  699. 			EndNode();
  700. 			StartNode("Culverts");
  701. 				AddMap("Culverts - Lvl 1", "prt_sewb1", 131, 247);
  702. 				AddMap("Culverts - Lvl 2", "prt_sewb2", 19, 19);
  703. 				AddMap("Culverts - Lvl 3", "prt_sewb3", 180, 169);
  704. 				AddMap("Culverts - Lvl 4", "prt_sewb4", 100, 92);
  705. 			EndNode();
  706. 			StartNode("Einbroch Dungeons");
  707. 				AddMap("Einbroch Dungeons - Lvl 1", "ein_dun01", 22, 14);
  708. 				AddMap("Einbroch Dungeons - Lvl 2", "ein_dun02", 292, 290);
  709. 			EndNode();
  710. 			StartNode("Gefenia");
  711. 				AddMap("Gefenia - Lvl 1", "gefenia01", 40, 103);
  712. 				AddMap("Gefenia - Lvl 2", "gefenia02", 203, 34);
  713. 				AddMap("Gefenia - Lvl 3", "gefenia03", 266, 168);
  714. 				AddMap("Gefenia - Lvl 4", "gefenia04", 130, 272);
  715. 			EndNode();
  716. 			StartNode("Geffen Dungeon");
  717. 				AddMap("Geffen Dungeon - Lvl 1", "gef_dun00", 104, 99);
  718. 				AddMap("Geffen Dungeon - Lvl 2", "gef_dun01", 115, 236);
  719. 				AddMap("Geffen Dungeon - Lvl 3", "gef_dun02", 106, 132);
  720. 				AddMap("Geffen Dungeon - Lvl 4", "gef_dun03", 203, 200);
  721. 			EndNode();
  722. 			StartNode("Glast Heim");
  723. 				AddMap("Glast Heim - Entrance", "glast_01", 375, 304);
  724. 				AddMap("Glast Heim - Castle 1", "gl_cas01", 199, 29);
  725. 				AddMap("Glast Heim - Castle 2", "gl_cas02", 104, 25);
  726. 				AddMap("Glast Heim - Chivalry 1", "gl_knt01", 150, 15);
  727. 				AddMap("Glast Heim - Chivalry 2", "gl_knt02", 157, 287);
  728. 				AddMap("Glast Heim - Churchyard", "gl_chyard", 147, 15);
  729. 				AddMap("Glast Heim - Culvert 1", "gl_sew01", 258, 255);
  730. 				AddMap("Glast Heim - Culvert 2", "gl_sew02", 108, 291);
  731. 				AddMap("Glast Heim - Culvert 3", "gl_sew03", 171, 283);
  732. 				AddMap("Glast Heim - Culvert 4", "gl_sew04", 68, 277);
  733. 				AddMap("Glast Heim - St.Abbey", "gl_church", 156, 7);
  734. 				AddMap("Glast Heim - Staircase Dungeon", "gl_step", 12, 7);
  735. 				AddMap("Glast Heim - UG Cave 1", "gl_dun01", 133, 271);
  736. 				AddMap("Glast Heim - UG Cave 2", "gl_dun02", 224, 274);
  737. 				AddMap("Glast Heim - UG Prison 1", "gl_prison", 14, 70);
  738. 				AddMap("Glast Heim - UG Prison 2", "gl_prison1", 150, 14);
  739. 			EndNode();
  740. 			StartNode("Gonryun Dungeon");
  741. 				AddMap("Gonryun Dungeon - Lvl 1", "gon_dun01", 153, 53);
  742. 				AddMap("Gonryun Dungeon - Lvl 2", "gon_dun02", 28, 113);
  743. 				AddMap("Gonryun Dungeon - Lvl 3", "gon_dun03", 68, 16);
  744. 			EndNode();
  745. 			StartNode("Hidden Dungeon");
  746. 				AddMap("Hidden Dungeon - Lvl 1", "prt_maze01", 176, 7);
  747. 				AddMap("Hidden Dungeon - Lvl 2", "prt_maze02", 94, 9);
  748. 				AddMap("Hidden Dungeon - Lvl 3", "prt_maze03", 23, 8);
  749. 			EndNode();
  750. 			StartNode("Ice Dungeon");
  751. 				AddMap("Ice Dungeon - Lvl 1", "ice_dun01", 157, 14);
  752. 				AddMap("Ice Dungeon - Lvl 2", "ice_dun02", 151, 155);
  753. 				AddMap("Ice Dungeon - Lvl 3", "ice_dun03", 149, 22);
  754. 				AddMap("Ice Dungeon - Lvl 4", "ice_dun04", 33, 158);
  755. 			EndNode();
  756. 			StartNode("Juperos Dungeons");
  757. 				AddMap("Juperos Dungeons - Lvl 1", "juperos_01", 53, 247);
  758. 				AddMap("Juperos Dungeons - Lvl 2", "juperos_02", 37, 63);
  759. 				AddMap("Juperos Dungeons - Core", "jupe_core", 150, 285);
  760. 			EndNode();
  761. 			StartNode("Kiel Dungeons");
  762. 				AddMap("Kiel Dungeons - Lvl 1", "kh_dun01", 28, 226);
  763. 				AddMap("Kiel Dungeons - Lvl 2", "kh_dun02", 41, 198);
  764. 			EndNode();
  765. 			StartNode("Lighthalzen Dungeons");
  766. 				AddMap("Lighthalzen Dungeons - Lvl 1", "lhz_dun01", 150, 288);
  767. 				AddMap("Lighthalzen Dungeons - Lvl 2", "lhz_dun02", 150, 18);
  768. 				AddMap("Lighthalzen Dungeons - Lvl 3", "lhz_dun03", 140, 130);
  769. 			EndNode();
  770. 			StartNode("Louyang Dungeons");
  771. 				AddMap("The Royal Tomb", "lou_dun01", 218, 196);
  772. 				AddMap("Inside the Royal Tomb", "lou_dun02", 282, 20);
  773. 				AddMap("Suei Long Gon", "lou_dun03", 165, 38);
  774. 			EndNode();
  775. 			StartNode("Magma Dungeon");
  776. 				AddMap("Magma Dungeon - Lvl 1", "mag_dun01", 126, 68);
  777. 				AddMap("Magma Dungeon - Lvl 2", "mag_dun02", 47, 30);
  778. 			EndNode();
  779. 			StartNode("Moscovia Dungeons");
  780. 				AddMap("Les Forest", "mosk_dun01", 132, 124);
  781. 				AddMap("Temny Forest", "mosk_dun02", 155, 123);
  782. 				AddMap("Dremuci Forest", "mosk_dun03", 122, 130);
  783. 			EndNode();
  784. 			StartNode("Orc Dungeon");
  785. 				AddMap("Orc Dungeon - Lvl 1", "orcsdun01", 32, 170);
  786. 				AddMap("Orc Dungeon - Lvl 2", "orcsdun02", 21, 185);
  787. 			EndNode();
  788. 			StartNode("Payon Dungeon");
  789. 				AddMap("Payon Dungeon - Lvl 1", "pay_dun00", 21, 183);
  790. 				AddMap("Payon Dungeon - Lvl 2", "pay_dun01", 19, 33);
  791. 				AddMap("Payon Dungeon - Lvl 3", "pay_dun02", 19, 63);
  792. 				AddMap("Payon Dungeon - Lvl 4", "pay_dun03", 155, 159);
  793. 				AddMap("Payon Dungeon - Lvl 5", "pay_dun04", 201, 204);
  794. 			EndNode();
  795. 			StartNode("Pyramids");
  796. 				AddMap("Pyramids - Lvl 1", "moc_pryd01", 192, 9);
  797. 				AddMap("Pyramids - Lvl 2", "moc_pryd02", 10, 192);
  798. 				AddMap("Pyramids - Lvl 3", "moc_pryd03", 100, 92);
  799. 				AddMap("Pyramids - Lvl 4", "moc_pryd04", 181, 11);
  800. 				AddMap("Pyramids - Basement 1", "moc_pryd05", 94, 96);
  801. 				AddMap("Pyramids - Basement 2", "moc_pryd06", 192, 8);
  802. 			EndNode();
  803. 			StartNode("Rachel Sanctuary");
  804. 				AddMap("Rachel Sanctuary - Lvl 1", "ra_san01", 140, 11);
  805. 				AddMap("Rachel Sanctuary - Lvl 2", "ra_san02", 32, 21);
  806. 				AddMap("Rachel Sanctuary - Lvl 3", "ra_san03", 4, 149);
  807. 				AddMap("Rachel Sanctuary - Lvl 4", "ra_san04", 204, 218);
  808. 				AddMap("Rachel Sanctuary - Lvl 5", "ra_san05", 150, 9);
  809. 			EndNode();
  810. 			StartNode("Sphinx");
  811. 				AddMap("Sphinx - Lvl 1", "in_sphinx1", 288, 9);
  812. 				AddMap("Sphinx - Lvl 2", "in_sphinx2", 149, 81);
  813. 				AddMap("Sphinx - Lvl 3", "in_sphinx3", 210, 54);
  814. 				AddMap("Sphinx - Lvl 4", "in_sphinx4", 10, 222);
  815. 				AddMap("Sphinx - Lvl 5", "in_sphinx5", 100, 99);
  816. 			EndNode();
  817. 			StartNode("Sunken Ship");
  818. 				AddMap("Sunken Ship - Lvl 1", "treasure01", 69, 24);
  819. 				AddMap("Sunken Ship - Lvl 2", "treasure02", 102, 27);
  820. 			EndNode();
  821. 			StartNode("Thanatos Tower");
  822. 				AddMap("Thanatos Tower - Lvl 1", "tha_t01", 150, 39);
  823. 				AddMap("Thanatos Tower - Lvl 2", "tha_t02", 150, 136);
  824. 				AddMap("Thanatos Tower - Lvl 3", "tha_t03", 220, 158);
  825. 				AddMap("Thanatos Tower - Lvl 4", "tha_t04", 59, 143);
  826. 				AddMap("Thanatos Tower - Lvl 5", "tha_t05", 62, 11);
  827. 				AddMap("Thanatos Tower - Lvl 6", "tha_t06", 89, 221);
  828. 				AddMap("Thanatos Tower - Lvl 7", "tha_t07", 35, 166);
  829. 				AddMap("Thanatos Tower - Lvl 8", "tha_t08", 93, 148);
  830. 				AddMap("Thanatos Tower - Lvl 9", "tha_t09", 29, 107);
  831. 				AddMap("Thanatos Tower - Lvl 10", "tha_t10", 159, 138);
  832. 				AddMap("Thanatos Tower - Lvl 11", "tha_t11", 19, 20);
  833. 				AddMap("Thanatos Tower - Lvl 12", "tha_t12", 130, 52);
  834. 			EndNode();
  835. 			StartNode("Thor Volcano");
  836. 				AddMap("Thor Volcano - Lvl 1", "thor_v01", 21, 228);
  837. 				AddMap("Thor Volcano - Lvl 2", "thor_v02", 75, 205);
  838. 				AddMap("Thor Volcano - Lvl 3", "thor_v03", 34, 272);
  839. 			EndNode();
  840. 			StartNode("Toy Factory");
  841. 				AddMap("Toy Factory - Lvl 1", "xmas_dun01", 205, 15);
  842. 				AddMap("Toy Factory - Lvl 2", "xmas_dun02", 129, 133);
  843. 			EndNode();
  844. 			StartNode("Turtle Dungeon");
  845. 				AddMap("Turtle Dungeon - Entrance", "tur_dun01", 154, 49);
  846. 				AddMap("Turtle Dungeon - Lvl 1", "tur_dun02", 148, 261);
  847. 				AddMap("Turtle Dungeon - Lvl 2", "tur_dun03", 132, 189);
  848. 				AddMap("Turtle Dungeon - Lvl 3", "tur_dun04", 100, 192);
  849. 			EndNode();
  850. 			StartNode("Umbala Dungeons");
  851. 				AddMap("Carpenter's Shop in the Tree", "um_dun01", 42, 31);
  852. 				AddMap("Passage to a Foreign World", "um_dun01", 48, 30);
  853. 				AddMap("Hvergermil's Fountain", "yggdrasil01", 204, 78);
  854. 			EndNode();
  855. 		EndNode();
  856. 		StartNode("Guild Dungeons");
  857. 			AddMap("Baldur Guild Dungeon", "gld_dun01", 119, 93);
  858. 			AddMap("Luina Guild Dungeon", "gld_dun02", 39, 161);
  859. 			AddMap("Valkyrie Guild Dungeon", "gld_dun03", 50, 44);
  860. 			AddMap("Britoniah Guild Dungeon", "gld_dun04", 116, 45);
  861. 		EndNode();
  862. 		StartNode("Castles");
  863. 			StartNode("Aldebaran Castles");
  864. 				AddMap("Neuschwanstein(Aldebaran)", "alde_gld", 48, 83, "mapUsers", "aldeg_cas01");
  865. 				AddMap("Hohenschwangau(Aldebaran)", "alde_gld", 95, 249, "mapUsers", "aldeg_cas02");
  866. 				AddMap("Nuenberg(Aldebaran)", "alde_gld", 142, 85, "mapUsers", "aldeg_cas03");
  867. 				AddMap("Wuerzburg(Aldebaran)", "alde_gld", 239, 242, "mapUsers", "aldeg_cas04");
  868. 				AddMap("Rothenburg(Aldebaran)", "alde_gld", 264, 90, "mapUsers", "aldeg_cas05");
  869. 			EndNode();
  870. 			StartNode("Geffen Castles");
  871. 				AddMap("Repherion(Geffen)", "gef_fild13", 214, 75, "mapUsers", "gefg_cas01");
  872. 				AddMap("Eeyolbriggar(Geffen)", "gef_fild13", 308, 240, "mapUsers", "gefg_cas02");
  873. 				AddMap("Yesnelph(Geffen)", "gef_fild13", 143, 240, "mapUsers", "gefg_cas03");
  874. 				AddMap("Bergel(Geffen)", "gef_fild13", 193, 278, "mapUsers", "gefg_cas04");
  875. 				AddMap("Mersetzdeitz(Geffen)", "gef_fild13", 305, 87, "mapUsers", "gefg_cas05");
  876. 			EndNode();
  877. 			StartNode("Payon Castles");
  878. 				AddMap("Bright Arbor(Payon)", "pay_gld", 121, 233, "mapUsers", "payg_cas01");
  879. 				AddMap("Scarlet Palace(Payon)", "pay_gld", 295, 116, "mapUsers", "payg_cas02");
  880. 				AddMap("Holy Shadow(Payon)", "pay_gld", 317, 293, "mapUsers", "payg_cas03");
  881. 				AddMap("Sacred Altar(Payon)", "pay_gld", 140, 160, "mapUsers", "payg_cas04");
  882. 				AddMap("Bamboo Grove Hill(Payon)", "pay_gld", 204, 266, "mapUsers", "payg_cas05");
  883. 			EndNode();
  884. 			StartNode("Prontera Castles");
  885. 				AddMap("Kriemhild(Prontera)", "prt_gld", 134, 65, "mapUsers", "prtg_cas01");
  886. 				AddMap("Swanhild(Prontera)", "prt_gld", 240, 128, "mapUsers", "prtg_cas02");
  887. 				AddMap("Fadhgridh(Prontera)", "prt_gld", 153, 137, "mapUsers", "prtg_cas03");
  888. 				AddMap("Skoegul(Prontera)", "prt_gld", 111, 240, "mapUsers", "prtg_cas04");
  889. 				AddMap("Gondul(Prontera)", "prt_gld", 208, 240, "mapUsers", "prtg_cas05");
  890. 			EndNode();
  891. 			StartNode("Schwaltzvalt Castles");
  892. 				AddMap("Himinn(Schwaltzvalt)", "sch_gld", 293, 100, "mapUsers", "schg_cas01");
  893. 				AddMap("Andlangr(Schwaltzvalt)", "sch_gld", 288, 252, "mapUsers", "schg_cas02");
  894. 				AddMap("Viblainn(Schwaltzvalt)", "sch_gld", 97, 196, "mapUsers", "schg_cas03");
  895. 				AddMap("Hljod(Schwaltzvalt)", "sch_gld", 137, 90, "mapUsers", "schg_cas04");
  896. 				AddMap("Skidbladnir(Schwaltzvalt)", "sch_gld", 71, 315, "mapUsers", "schg_cas05");
  897. 			EndNode();
  898. 			StartNode("Arunafeltz Castles");
  899. 				AddMap("Mardol(Arunafeltz)", "aru_gld", 158, 272, "mapUsers", "arug_cas01");
  900. 				AddMap("Cyr(Arunafeltz)", "aru_gld", 83, 47, "mapUsers", "arug_cas02");
  901. 				AddMap("Horn(Arunafeltz)", "aru_gld", 68, 155, "mapUsers", "arug_cas03");
  902. 				AddMap("Gefn(Arunafeltz)", "aru_gld", 299, 345, "mapUsers", "arug_cas04");
  903. 				AddMap("Bandis(Arunafeltz)", "aru_gld", 292, 107, "mapUsers", "arug_cas05");
  904. 			EndNode();
  905. 		StartNode("Other");
  906. 			AddMap("Casino", "cmd_in02", 179, 129);
  907. 		EndNode();
  908.  
  909. 		debugmes "TOASTYWARPER - Map Data Loaded: " + .mapCount + " maps, " + (gettimetick(0) - .@startLoadTime) + "ms";
  910. 		cleararray(.buildStack$[0], "", 128);
  911. 		//debugmes "gotos: " + .gotoCount;
  912. 		sleep(1);
  913. 	end;
  914.  
  915. 	//-----------------------------------------------------------
  916. 	//TEST FUNCTIONS
  917. 	//-----------------------------------------------------------
  918. 	function TestMenus {
  919. 		sleep2(1);
  920. 		set @gotoCount, 1;
  921. 		while(.@i < .nodeCount) {
  922.  
  923. 			set .@nodePtr$, ".menu_" + .@i + "$";
  924. 			set .@menu$, ComputeMenu(.@nodePtr$);
  925. 			if(getstrlen(.@menu$) >= 2000) {
  926. 				set .@check, 1;
  927. 				mes "Menu (" + getd(.@nodePtr$ + "[0]") + ") may overflow (" + getstrlen(.@menu$) + " chars)";
  928. 			}
  929. 			set .@i, .@i + 1;
  930.  
  931. 			set @gotoCount, @gotoCount + 2;
  932. 			sleep2(@gotoCount >= .gotoLimit);
  933. 			set @gotoCount, @gotoCount * (@gotoCount < .gotoLimit);
  934. 		}
  935. 		if(.@check == 0)
  936. 			mes "No overflows detected";
  937.  
  938. 		next;
  939. 	}
  940.  
  941. 	//-----------------------------------------------------------
  942. 	//TREE MAPPING FUNCTIONS
  943. 	//-----------------------------------------------------------
  944.  
  945. 	function AddLastWarpsNode {
  946. 		set .@parentNodePtr$, .buildStack$[.stackLevel - 1];
  947.  
  948. 		//add to parent node
  949. 		setd(.@parentNodePtr$ + "[1]", getd(.@parentNodePtr$ + "[1]") + "Last Warp" + ":");
  950. 		setd(.@parentNodePtr$ + "[" + getarraysize(getd(.@parentNodePtr$)) + "]", .mapOffset);
  951.  
  952. 		//infinte loop check
  953. 		set .gotoCount, .gotoCount + 3;
  954. 		sleep(.gotoCount >= .gotoLimit);
  955. 		set .gotoCount, .gotoCount * (.gotoCount < .gotoLimit);
  956. 	}
  957.  
  958. 	function StartNode {
  959. 		set .@header$, getarg(0, "");
  960.  
  961. 		set .nodeCount, .nodeCount + 1;
  962. 		set .@nodePtr$, ".menu_" + .nodeCount + "$";
  963.  
  964. 		set .@parentNodePtr$, .buildStack$[.stackLevel - 1];
  965.  
  966. 		//clear the node just in case there was something in it
  967. 		cleararray(getd(.@nodePtr$), "", 128);
  968.  
  969. 		//add to parent node
  970. 		setd(.@parentNodePtr$ + "[1]", getd(.@parentNodePtr$ + "[1]") + .@header$ + ":");
  971. 		setd(.@parentNodePtr$ + "[" + getarraysize(getd(.@parentNodePtr$)) + "]", .nodeCount);
  972. 		setd(.@nodePtr$ + "[0]", .@header$);
  973.  
  974. 		//carry down node data
  975. 		set .@node_zeny, .stack_zeny[.stackLevel - 1];
  976. 		set .@node_gm, .stack_gm[.stackLevel - 1];
  977. 		set .@node_woe, .stack_woe[.stackLevel - 1];
  978. 		set .@node_job, .stack_job[.stackLevel - 1];
  979. 		set .@node_upper, .stack_upper[.stackLevel - 1];
  980. 		set .@node_gender, .stack_gender[.stackLevel - 1];
  981. 		set .@node_blvl, .stack_blvl[.stackLevel - 1];
  982. 		set .@node_mapUsers$, .stack_mapUsers$[.stackLevel - 1];
  983. 		set .@node_flag$, .stack_flag$[.stackLevel - 1];
  984. 		set .@node_function$, .stack_function$[.stackLevel - 1];
  985.  
  986. 		//check for modifiers
  987. 		set .@i, 1;
  988. 		while((getarg(.@i, "") + "") != "" && (getarg(.@i + 1, "") + "") != "") {
  989. 			set .@modIndex, getd(".modifier_" + getarg(.@i));
  990. 			setd(.tempModPtrs$[.@modIndex], getarg(.@i + 1));
  991.  
  992. 			set .@i, .@i + 2;
  993. 			set .gotoCount, .gotoCount + 1;
  994. 		}
  995. 		set .gotoCount, .gotoCount + 1;
  996.  
  997. 		setarray .buildStack$[.stackLevel], .@nodePtr$;	//add to stack
  998.  
  999. 		//push data to stack
  1000. 		setarray .stack_zeny[.stackLevel], .@node_zeny;
  1001. 		setarray .stack_gm[.stackLevel], .@node_gm;
  1002. 		setarray .stack_woe[.stackLevel], .@node_woe;
  1003. 		setarray .stack_job[.stackLevel], .@node_job;
  1004. 		setarray .stack_upper[.stackLevel], .@node_upper;
  1005. 		setarray .stack_gender[.stackLevel], .@node_gender;
  1006. 		setarray .stack_blvl[.stackLevel], .@node_blvl;
  1007. 		setarray .stack_mapUsers$[.stackLevel], .@node_mapUsers$;
  1008. 		setarray .stack_flag$[.stackLevel], .@node_flag$;
  1009. 		setarray .stack_function$[.stackLevel], .@node_function$;
  1010.  
  1011. 		//store node applicable mods
  1012. 		set .@a$, "_" + (.nodeCount / 128) + "[" + (.nodeCount % 128) + "]";
  1013. 		set .@b$, "_" + (.nodeCount / 128) + "$[" + (.nodeCount % 128) + "]";
  1014. 		setd(".menus_gm" + .@a$, .@node_gm);
  1015. 		setd(".menus_woe" + .@a$, .@node_woe);
  1016. 		setd(".menus_job" + .@a$, .@node_job);
  1017. 		setd(".menus_upper" + .@a$, .@node_upper);
  1018. 		setd(".menus_gender" + .@a$, .@node_gender);
  1019. 		setd(".menus_blvl" + .@a$, .@node_blvl);
  1020. 		setd(".menus_flag" + .@b$, .@node_flag$);
  1021. 		setd(".menus_function" + .@b$, .@node_function$);
  1022.  
  1023. 		set .stackLevel, .stackLevel + 1;
  1024.  
  1025. 		//infinte loop check
  1026. 		set .gotoCount, .gotoCount + 3;
  1027. 		sleep(.gotoCount >= .gotoLimit);
  1028. 		set .gotoCount, .gotoCount * (.gotoCount < .gotoLimit);
  1029. 	}
  1030.  
  1031. 	function EndNode {
  1032. 		set .stackLevel, .stackLevel - 1;
  1033. 		set .@nodePtr$, .buildStack$[.stackLevel];
  1034. 		setd(.@nodePtr$ + "[1]", getd(.@nodePtr$ + "[1]") + "Back");	//add back option to menu
  1035.  
  1036. 		setarray .buildStack$[.stackLevel], "";	//remove from stack
  1037.  
  1038. 		//pop the stack
  1039. 		setarray .stack_zeny[.stackLevel], .@node_zeny;
  1040. 		setarray .stack_gm[.stackLevel], 0;
  1041. 		setarray .stack_woe[.stackLevel], 0;
  1042. 		setarray .stack_job[.stackLevel], 0x0FFFFFFF;
  1043. 		setarray .stack_upper[.stackLevel], 8;
  1044. 		setarray .stack_gender[.stackLevel], 2;
  1045. 		setarray .stack_blvl[.stackLevel], 0;
  1046. 		setarray .stack_mapUsers$[.stackLevel], "";
  1047. 		setarray .stack_flag$[.stackLevel], "";
  1048. 		setarray .stack_function$[.stackLevel], "";
  1049.  
  1050. 		//infinte loop check
  1051. 		set .gotoCount, .gotoCount + 2;
  1052. 		sleep(.gotoCount >= .gotoLimit);
  1053. 		set .gotoCount, .gotoCount * (.gotoCount < .gotoLimit);
  1054. 	}
  1055.  
  1056. 	function AddMap {
  1057. 		set .@nodePtr$, .buildStack$[.stackLevel - 1];
  1058.  
  1059. 		if(getmapusers(getarg(1)) >= 0) { //makes sure it's a real map
  1060. 			//add to map arrays (basically 4x SetArrayValue calls..but put inline to prevent infinite loop error)
  1061. 			set .@a$, "_" + (.mapCount / 128) + "[" + (.mapCount % 128) + "]";
  1062. 			set .@b$, "_" + (.mapCount / 128) + "$[" + (.mapCount % 128) + "]";
  1063.  
  1064. 			setd ".maps_name" + .@b$, getarg(0);
  1065. 			setd ".maps_map" + .@b$, getarg(1);
  1066. 			setd ".maps_x" + .@a$, getarg(2);
  1067. 			setd ".maps_y" + .@a$, getarg(3);
  1068.  
  1069. 			//carry down node data
  1070. 			set .@node_zeny, .stack_zeny[.stackLevel - 1];
  1071. 			set .@node_gm, .stack_gm[.stackLevel - 1];
  1072. 			set .@node_woe, .stack_woe[.stackLevel - 1];
  1073. 			set .@node_job, .stack_job[.stackLevel - 1];
  1074. 			set .@node_upper, .stack_upper[.stackLevel - 1];
  1075. 			set .@node_gender, .stack_gender[.stackLevel - 1];
  1076. 			set .@node_blvl, .stack_blvl[.stackLevel - 1];
  1077. 			set .@node_mapUsers$, .stack_mapUsers$[.stackLevel - 1];
  1078. 			set .@node_flag$, .stack_flag$[.stackLevel - 1];
  1079. 			set .@node_function$, .stack_function$[.stackLevel - 1];
  1080.  
  1081. 			//check for modifiers
  1082. 			set .@i, 4;
  1083. 			while((getarg(.@i, "") + "") != "" && (getarg(.@i + 1, "") + "") != "") {
  1084. 				set .@modIndex, getd(".modifier_" + getarg(.@i));
  1085. 				setd(.tempModPtrs$[.@modIndex], getarg(.@i + 1));
  1086. 				set .@i, .@i + 2;
  1087. 				set .gotoCount, .gotoCount + 1;
  1088. 			}
  1089. 			set .gotoCount, .gotoCount + 1;
  1090.  
  1091. 			//store map applicable modifiers
  1092. 			setd(".maps_zeny" + .@a$, .@node_zeny);
  1093. 			setd(".maps_gm" + .@a$, .@node_gm);
  1094. 			setd(".maps_woe" + .@a$, .@node_woe);
  1095. 			setd(".maps_job" + .@a$, .@node_job);
  1096. 			setd(".maps_upper" + .@a$, .@node_upper);
  1097. 			setd(".maps_gender" + .@a$, .@node_gender);
  1098. 			setd(".maps_blvl" + .@a$, .@node_blvl);
  1099. 			setd(".maps_mapUsers" + .@b$, .@node_mapUsers$);
  1100. 			setd(".maps_flag" + .@b$, .@node_flag$);
  1101. 			setd(".maps_function" + .@b$, .@node_function$);
  1102.  
  1103. 			//add to parent node
  1104. 			setd(.@nodePtr$ + "[1]", getd(.@nodePtr$ + "[1]") + "- " + getarg(0) + ":");
  1105. 			setd(.@nodePtr$ + "[" + getarraysize(getd(.@nodePtr$)) + "]", .mapCount + .mapOffset);
  1106.  
  1107. 			//set index lookup for map
  1108. 			setd(".map_" + getarg(1), .mapCount); 
  1109.  
  1110. 			set .mapCount, .mapCount + 1;
  1111. 		} else {
  1112. 			debugmes("TOASTYWARPER - BADMAP: " + getarg(0) + " - " + getarg(1));
  1113. 		}
  1114.  
  1115. 		//infinte loop check
  1116. 		set .gotoCount, .gotoCount + 3;
  1117. 		sleep(.gotoCount >= .gotoLimit);
  1118. 		set .gotoCount, .gotoCount * (.gotoCount < .gotoLimit);
  1119. 	}
  1120.  
  1121. 	//-----------------------------------------------------------
  1122. 	//INFINITE ARRAY FUNCTIONS
  1123. 	//-----------------------------------------------------------
  1124. 	function SetArrayValue {// <arrayname>, <index>, <value>{, <isString> = 0}
  1125. 		//debugmes("setarrayvalue: " + (getarg(0) + "_" + (getarg(1) / 128) + "[" + (getarg(1) % 128) + "]"));
  1126. 		setd getarg(0) + "_" + (getarg(1) / 128) + (getarg(3, 0)?"$":"") + "[" + (getarg(1) % 128) + "]", getarg(2);
  1127. 		return;
  1128. 	}
  1129.  
  1130. 	function GetArrayValue {	// <arrayname>, <index>{, <isString> = 0}
  1131. 		//debugmes("getarrayvalue: " + getarg(0) + "_" + (getarg(1) / 128) + (getarg(2, 0)?"$":"") + "[" + (getarg(1) % 128) + "]");
  1132. 		return getd(getarg(0) + "_" + (getarg(1) / 128) + (getarg(2, 0)?"$":"") + "[" + (getarg(1) % 128) + "]");
  1133. 	}
  1134.  
  1135. 	function WipeArray {		//<arrayname>, <num_indices>{{, <value> = 0}, <isString> = 0}
  1136. 		set .@count, getarg(1) / 128 + 1;
  1137. 		for(set .@i, 0; .@i < .@count; set .@i, .@i + 1)
  1138. 			cleararray(getd(getarg(0) + "_" + .@i + (getarg(3, 0)?"$":"") + "[0]"), getarg(2, 0), 128);
  1139. 		return;
  1140. 	}
  1141.  
  1142. 	//-----------------------------------------------------------
  1143. 	//LAST WARPS STORAGE FUNCTIONS
  1144. 	//-----------------------------------------------------------
  1145.  
  1146. 	function PrepLastWarpsMenu {
  1147. 		set @menu_lastwarps$[0], "Last Warps";
  1148.  
  1149. 		while(.@i < 128 && .@count < .numLastWarps) {
  1150. 			set .@map, @toasty_savedMaps[(@toasty_stackStart + .@i) % 128] - 1;
  1151. 			if(.@map > 0 && .@map < .mapCount) {
  1152. 				set .@mapName$, getd(".maps_name_" + (.@map / 128) + "$" + "[" + (.@map % 128) + "]");
  1153. 				set @menu_lastwarps$[.@count + 2], .@map + .mapOffset;
  1154.  
  1155. 				set .@count, .@count + 1;
  1156. 				set .@menu$, .@menu$ + .@mapName$ + ":";
  1157. 			}
  1158. 			set .@i, .@i + 1;
  1159. 		}
  1160. 		set @menu_lastwarps$[1], .@menu$ + "Back";
  1161. 		return;
  1162. 	}
  1163.  
  1164. 	function InitialiseMapData {
  1165. 		while(.@i < getarraysize(@toasty_savedMaps)) {
  1166. 			setd("@toasty_map" + @toasty_savedMaps[.@i], (@toasty_savedMaps[.@i] > 0)?.@i + 1:0);
  1167. 			set .@i, .@i + 1;
  1168. 		}
  1169. 		PrepLastWarpsMenu();
  1170. 		return;
  1171. 	}
  1172.  
  1173. 	function AddMapToList { //<mapIndex>
  1174. 		set .@map, getarg(0);
  1175.  
  1176. 		if(getd("@toasty_map" + .@map) > 0) {
  1177. 			if(@toasty_savedMaps[getd("@toasty_map" + .@map) - 1] == .@map) { //double checking
  1178. 				set @toasty_savedMaps[getd("@toasty_map" + .@map) - 1], 0;
  1179. 			}
  1180. 		}
  1181. 		set @toasty_stackStart, (@toasty_stackStart + 127) % 128;
  1182.  
  1183. 		set @toasty_savedMaps[@toasty_stackStart], .@map;
  1184. 		setd("@toasty_map" + .@map, @toasty_stackStart + 1);
  1185.  
  1186. 		set toasty_mapSave$, GenerateMapSaveString();
  1187. 		return;
  1188. 	}
  1189.  
  1190. 	function ListMaps { //debug
  1191. 		while(.@i < 128 && .@count < .numLastWarps) {
  1192. 			if( @toasty_savedMaps[(@toasty_stackStart + .@i) % 128] > 0) {
  1193. 				set .@count, .@count + 1;
  1194. 				set .@out$, .@out$ + @toasty_savedMaps[(@toasty_stackStart + .@i) % 128] + ", ";
  1195. 			}
  1196. 			set .@i, .@i + 1;
  1197. 		}
  1198. 		return .@out$;
  1199. 	}
  1200.  
  1201. 	function GenerateMapSaveString {
  1202. 		while(.@i < 128 && .@count < .numLastWarps) {
  1203. 			set .@index, (@toasty_stackStart + .@i) % 128;
  1204. 			if( @toasty_savedMaps[(@toasty_stackStart + .@i) % 128] > 0) {
  1205. 				set .@count, .@count + 1;
  1206. 				set .@out$, .@out$ + .char$[(@toasty_savedMaps[.@index] % 64)] + .char$[(@toasty_savedMaps[.@index] / 64)];
  1207. 			}
  1208. 			set .@i, .@i + 1;
  1209. 		}
  1210. 		return .@out$;
  1211. 	}
  1212.  
  1213. 	function ConvertStringToChrArray {
  1214. 		if ( getstrlen( getarg(0) ) > 128 ) return 0;
  1215. 			set .@charsize, getarraysize(.char$);
  1216. 			set .@str$, getarg(0);
  1217. 			set .@len, getstrlen(.@str$);
  1218.  
  1219. 			sleep2 1;
  1220.  
  1221. 			do {
  1222. 				set .@range[0], .@charsize;
  1223. 				set .@range[1], 0;
  1224.  
  1225. 				//ignore repetiton, it keeps the gotos down
  1226. 				set .@range[(.@str$ > (.@temp$ + .char$[(.@range[0] + .@range[1]) / 2] + "ˇ"))], (.@range[0] + .@range[1]) / 2;
  1227. 				set .@range[(.@str$ > (.@temp$ + .char$[(.@range[0] + .@range[1]) / 2] + "ˇ"))], (.@range[0] + .@range[1]) / 2;
  1228. 				set .@range[(.@str$ > (.@temp$ + .char$[(.@range[0] + .@range[1]) / 2] + "ˇ"))], (.@range[0] + .@range[1]) / 2;
  1229. 				set .@range[(.@str$ > (.@temp$ + .char$[(.@range[0] + .@range[1]) / 2] + "ˇ"))], (.@range[0] + .@range[1]) / 2;
  1230. 				set .@range[(.@str$ > (.@temp$ + .char$[(.@range[0] + .@range[1]) / 2] + "ˇ"))], (.@range[0] + .@range[1]) / 2;
  1231. 				set .@range[(.@str$ > (.@temp$ + .char$[(.@range[0] + .@range[1]) / 2] + "ˇ"))], (.@range[0] + .@range[1]) / 2;
  1232. 				set .@range[(.@str$ > (.@temp$ + .char$[(.@range[0] + .@range[1]) / 2] + "ˇ"))], (.@range[0] + .@range[1]) / 2;
  1233.  
  1234. 				set .@charIndex, (.@range[0] + .@range[1]) / 2 + (.@str$ > (.@temp$ + .char$[(.@range[0] + .@range[1]) / 2] + "ˇ"));
  1235.  
  1236. 				set .@temp$, .@temp$ + .char$[.@charIndex];
  1237. 				set .@arr[.@i / 2], .@arr[.@i / 2] + .@charIndex * (1 + 63 * (.@i % 2));
  1238.  
  1239. 				set .@i, .@i + 1;
  1240. 			} while( .@i < .@len );
  1241.  
  1242. 			sleep2 1; //used alot of gotos..sleep for good measure
  1243.  
  1244. 			deletearray getd(getarg(1));
  1245. 			copyarray getd(getarg(1)), .@arr, .@len / 2;
  1246.  
  1247. 			return .@len / 2;
  1248. 	}
  1249. 	end;
  1250. }
  1251.  
  1252. prontera,151,186,5	script	Warper#toasty	721,{
  1253. 	doevent "toastywarperbase::OnStartNPC";
  1254. }
  1255.  
  1256. rachel.gat,122,148,4	duplicate(Warper#toasty)	Warper#toasty2-2	721
  1257. alberta,110,137,4	duplicate(Warper#toasty)	Warper#toasty3-1	721
  1258. aldebaran,147,117,4	duplicate(Warper#toasty)	Warper#toasty4-1	721
  1259. amatsu,190,86,1	duplicate(Warper#toasty)	Warper#toasty5-1	721
  1260. ayothaya,147,123,6	duplicate(Warper#toasty)	Warper#toasty6-1	721
  1261. comodo,206,77,4	duplicate(Warper#toasty)	Warper#toasty7-1	721
  1262. einbech,196,83,4	duplicate(Warper#toasty)	Warper#toasty8-1	721
  1263. einbroch,182,172,4	duplicate(Warper#toasty)	Warper#toasty9-1	721
  1264. einbroch,243,189,2	duplicate(Warper#toasty)	Warper#toasty9-2	721
  1265. hugel,88,151,5	duplicate(Warper#toasty)	Warper#toasty10-1	721
  1266. lighthalzen,165,94,6	duplicate(Warper#toasty)	Warper#toasty11-1	721
  1267. geffen,116,59,0	duplicate(Warper#toasty)	Warper#toasty12-1	721
  1268. izlude,122,94,3	duplicate(Warper#toasty)	Warper#toasty13-1	721
  1269. xmas,149,136,4	duplicate(Warper#toasty)	Warper#toasty14-1	721
  1270. morocc,156,95,4	duplicate(Warper#toasty)	Warper#toasty15-1	721
  1271. payon,148,228,4	duplicate(Warper#toasty)	Warper#toasty16-1	721
  1272. yuno,160,170,4	duplicate(Warper#toasty)	Warper#toasty17-1	721
  1273. moc_fild04.gat,207,331,4	duplicate(Warper#toasty)	Warper#toasty18-1	721
  1274. izlu2dun.gat,104,82,4	duplicate(Warper#toasty)	Warper#toasty19-1	721
  1275. mjolnir_02.gat,85,363,4	duplicate(Warper#toasty)	Warper#toasty20-1	721
  1276. prt_fild05.gat,273,215,4	duplicate(Warper#toasty)	Warper#toasty21-1	721
  1277. glast_01.gat,370,308,4	duplicate(Warper#toasty)	Warper#toasty22-1	721
  1278. yuno_fild03.gat,37,135,4	duplicate(Warper#toasty)	Warper#toasty23-1	721
  1279. gef_fild10.gat,71,339,4	duplicate(Warper#toasty)	Warper#toasty24-1	721
  1280. pay_arche.gat,39,135,4	duplicate(Warper#toasty)	Warper#toasty25-1	721
  1281. moc_ruins.gat,64,166,4	duplicate(Warper#toasty)	Warper#toasty26-1	721
  1282. moc_fild19.gat,106,97,4	duplicate(Warper#toasty)	Warper#toasty27-1	721
  1283. alb2trea.gat,73,101,4	duplicate(Warper#toasty)	Warper#toasty28-1	721
  1284. tur_dun01.gat,148,239,4	duplicate(Warper#toasty)	Warper#toasty29-1	721
  1285. gonryun,162,122,4	duplicate(Warper#toasty)	Warper#toasty30-1	721
  1286. louyang,221,120,4	duplicate(Warper#toasty)	Warper#toasty31-1	721
  1287. umbala,95,164,4	duplicate(Warper#toasty)	Warper#toasty32-1	721
  1288. moscovia,220,198,4	duplicate(Warper#toasty)	Warper#toasty33-1	721
  1289. veins,217,127,4	duplicate(Warper#toasty)	Warper#toasty34-1	721
  1290. rachel,133,115,4	duplicate(Warper#toasty)	Warper#toasty35-1	721
Viewed 895 times, submitted by Guest.