Advertisement
Guest User

Untitled

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