Advertisement
Guest User

Untitled

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