//=== Author: =============================================================================// //= ____ __ =// //= /'\_/`\ __/\ _`\ /\ \ =// //= /\ \ __ __ ____/\_\ \ \/\_\\ \ \___ _ __ ___ ___ ___ ____ =// //= \ \ \__\ \/\ \/\ \ /',__\/\ \ \ \/_/_\ \ _ `\/\`'__\/ __`\ /' _ `\ / __`\ /',__\ =// //= \ \ \_/\ \ \ \_\ \/\__, `\ \ \ \ \L\ \\ \ \ \ \ \ \//\ \L\ \/\ \/\ \/\ \L\ \/\__, `\ =// //= \ \_\\ \_\ \____/\/\____/\ \_\ \____/ \ \_\ \_\ \_\\ \____/\ \_\ \_\ \____/\/\____/ =// //= \/_/ \/_/\/___/ \/___/ \/_/\/___/ \/_/\/_/\/_/ \/___/ \/_/\/_/\/___/ \/___/ =// //=== Version: ============================================================================// //= 1.1 [ 17.10.2012 ] =// //=== Notes: ==============================================================================// //= Note 1: To configure go to "CONFIGURATION - START". Instrcutions how to do this can =// //= be found at: //=== License: ============================================================================// //= None. Use it, change it, say thank you, comment, and please give credit when someone =// //= asks, where this warper is coming from. =// //=== Changelog: ==========================================================================// //= 1.1 Changed Cascading System (more ram use, less cpu) [ 17.10.2012 ] =// //= 1.0.1 Minor Bugfixes =// //= 1.0 Release [ 17.09.2012 ] =// //=========================================================================================// - script dynamic_warper -1,{ OnInit: function addType; function addMain; function addMap; function genMenu; function getSave; function setSave; function moveSave; function addSave; function remSave; function menu2id; function eaj2base; function isVisited; function getDestUsers; function modifierSetup; function modifierCascade; function modifierCheck; function checkSingleMod; function storeCharData; function loadCharData; function string2int; function int2string; function char2id; modifierSetup(); set .typeCounter,0; set .typeMenuSize,10; //10 ~= - Cancel set .setup,1; //=== CONFIGURATION - START ===============================================================// //=== Name of the warper: =================================================================// set .name$,"[^00FF00Warper^000000]"; //=== Party-Warping: ======================================================================// //= Set to 1 to enable party-warping. This means the party leader can take his members on =// //= the same map with him. They have 15 econds to agree, or to disagree. =// set .partyWarp,1; //=== Special-Effect: =====================================================================// //= A special effect shown when players get warped. (wind, turning around) =// set .specialeffect,1; //=== Warp Confirmation: ==================================================================// //= Enable, so the warper shows the costs for the warp, and asks for a confirmation. =// //= For the moment you need to enable this menu to allow people to add maps to favorites! =// set .warpConfirm,1; //=== Language-Settings: ==================================================================// set .t_welcome$,"Welcome to the ^990000Warp-Service^000000!"; set .t_choose$,"Please choose where to go:"; set .t_explainred$,"^333333(Places you cannot attain will be shown ^990000red^333333)"; set .t_notallowed$,"Sorry, you are ^AA0000not allowed^000000 to do this!"; set .t_bye$,"Thank you, come again!"; set .t_noentries$,"^993300There are no entries!^000000"; set .t_nowarpall$,"Sorry, you are ^AA0000not allowed ^000000 to head for ^003399%s^000000!"; set .t_warpto$,"Do you want to warp to ^0033CC%s^000000?"; set .t_cost$,"Warping-fee: ^226666%d ^000000Zeny"; set .t_cost_item$," - %d x ^008888%s^000000"; set .t_itemstart$,"You will have to pay:"; set .t_takeparty$,"Should your party-members on this map be warped whith you?"; set .t_eachmemfee$,"^FF0000Each ^000000member will have to pay the warping fee."; set .t_instance_error$,"^FF000000[Instancing Error]^000000 Report this to your Admin please!"; set .t_members$,"Your party members:"; set .t_checkparty$,"Checking you party members status and awaiting their responses..."; set .t_checkedin$,"^CC3300%d ^000000of ^663300%d ^000000members have checked in!"; set .t_proceed$,"Proceed Warping?"; set .t_error$,"You could not be warped to %s, sorry:"; set .t_errorserv$,"You are not allowed to use this service:"; set .t_visit$,"You visited %s, so you will be able to warp here with the Warp-Service."; set .t_warpwith$,"Do you want to warp to ^003399%s ^000000with your Party-Leader ^CC0000%s^000000?"; set .t_waitinst$,"You will be warped in an instance!"; set .t_timeout$,"Your Check time is over, sorry..."; set .t_semaphore$,"^FF0000Party Network is overused. Please wait a moment.^000000"; set .m_back$,"- Back"; set .m_warp$,"- Warp"; set .m_favo$,"- Add Map to ^0000CCFavourites^000000:- Warp and add Map to ^0000CCFavourites^000000"; set .m_delfavo$,"- Delete Map from ^0000CCFavourites^000000"; set .m_cancel$,"- Cancel"; set .m_yes$,"- Yes"; set .m_no$,"- No"; set .e_online$,"^00FF00Online^000000"; set .e_wrongmap$,"^992222Not on Map^000000"; set .e_offline$,"^FF0000Offline^000000"; set .e_checkin$,"^00FF00checked in^000000"; set .e_checkout$,"^FF0000checked out^000000"; setarray .e_dispb$[0], "You don't have the permission to go on.", "Due to the actuall WoE-Status, you are not allowed to perform this action for the moment!", "Your class is not allowed to do this.", "Your upper is not allowed to attain this point.", "You need to visit this place on your own once, to warp there.", "You are too strong.", "You are too weak.", "You don't have the permission to do this.", "You don't have enough money.", "You don't have the items to pay this."; setarray .e_party$[0], "GM-Level too low", "WoE restriction", "Class not allowed", "Upper not allowed", "Place not visited", "Too strong", "Too weak", "Not allowed", "Not enough money", "Not enough items"; //=== End of Language-Settings: ===========================================================// //=== Item paying: ========================================================================// //= List of items, you can combine to warping-costs. The list can contain up to 32 Items. // setarray .priceItems[0], //item-id, amount, // ID 512, 10, // 1 513, 10, // 2 514, 5, // 4 515, 20; // 8 //=== Flags: ==============================================================================// //= Here you can add conditions to warps with given Vars. You need the vars name, the =// //= limit, and what the value has to be compared with the given value. =// setarray .flags$[0], // 1 = smaller, 2 = equal , 4 = bigger //flagname, true-val, option // ID "special_quest_var", "1", "6", // 1 "#another_var", "1", "6"; // 2 //=== Price-Reductions ===================================================================// //= Have to be implemented for the moment... set .price_baselevel, 100; // percent per Baselevel (100 = 1%) set .price_rebirth, 100; // zeny per rebirth set .price_partymember, -1000; //=== Map-Configuration: =================================================================// addType("Favourites",4,"favourites",6); addType("Last Warps",5,"lastwarps",6); addType("Citys",1); addMain("Alberta",1); //addMap("Alberta","alberta",1) is generated automatically for the position of npc dw_1_1 addMain("Aldebaran",2); addMain("Amatsu",3); addMain("Ayothaya",4); addMain("Comodo",5); addMain("Einbech",6); addMain("Einbroch",7); addMain("Geffen",8); addMain("Gonryun",9); addMain("Hugel",10); addMain("Izlude",11); addMain("Jawaii",12); addMain("Lighthalzen",13); addMain("Louyang",14); addMain("Lutie",15); addMain("Morocc",16); addMain("Moscovia",17); addMain("Nameless Island",18); addMain("Novice Grounds",19); addMain("Niflheim",20); addMain("Payon",21); addMain("Prontera",22); addMain("Rachel",23); addMain("Splendide",24); addMain("Thor Camp",25); addMain("Umbala",26); addMain("Yuno",27); addMain("Veins",28); addType("Dungeons",2); addMain("Abbey Dungeon",1); addMap("Abbey Dungeon Entrance","nameless_n",1,"srcmap","abbey01"); addMain("Abyss-Lake",2); addMap("Abyss Lake Entrance","abyss_01",1); addMain("Amatsu Dungeon",3); addMap("Amatsu Dungeon Entrance","ama_dun01",1); addMain("Anthell",4); addMap("Anthell Entrance","anthell01",1); addMain("Ayothaya Dungeon",5); addMap("Ayothaya Dungeon Entrance","ayo_fild02",1,"srcmap","ayo_dun01"); addMain("Beach Dungeon",6); addMap("Beach Dungeon Entrance","beach_dun2",1,"srcmap","beach_dun"); addMain("Byalan Dungeon",7); addMap("Baylan Dungeon Entrance","izlu2dun",1,"srcmap","iz_dun00"); addMain("Clock Tower",8); addMap("Clock Tower Entrance","c_tower1",1); addMain("Coal Mines",9); addMap("Coal Mines Entrance","mjolnir_02",1,"srcmap","mjo_dun01"); addMain("Culverts",10); addMap("Culverts Entrance","prt_fild05",1,"srcmap","prt_sewb1"); addMain("Einbroch Dungeon",11); addMap("Einbroch Dungeon Entrance","einbech",1,"srcmap","ein_dun01"); addMain("Geffen Dungeon",12); addMap("Geffen Dungeon Entrance","gef_tower",1,"srcmap","gef_dun00"); addMain("Gefenia",13); addMap("Gefenia Entrance","gefenia01",1); addMain("Glast Heim",14); addMap("Glast Heim Entrance","glast_01",1); addMain("Gonryun Dungeon",15); addMap("Gonryun Dungeon Entrance","gonryun",1,"srcmap","gon_dun01"); addMain("Hidden Dungeon",16); addMap("Hidden Dungeon Entrance","prt_fild01",1,"srcmap","prt_maze01"); addMain("Ice Dungeon",17); addMap("Ice Dungeon Entrance","ra_fild01",1,"srcmap","ice_dun01"); addMain("Juperos Dungeon",18); addMap("Juperos Dungeon Entrance","jupe_cave",1,"srcmap","juperos_01"); addMain("Kiel Dungeon",19); addMap("Kiel Dungeon Entrance","yuno_fild08",1,"srcmap","kh_dun01"); addMain("Lighthalzen Dungeon",20); addMap("Lighthalzen Dungeon Entrance","lhz_dun01",1); addMain("Magma Dungeon",21); addMap("Magma Dungeon Entrance","yuno_fild03",1,"srcmap","mag_dun01"); addMain("Moscovia Dungeon",22); addMap("Moscovia Dungeon Entrance","mosk_fild02",1,"srcmap","mosk_dun01"); addMain("Odin Temple",23); addMap("Odin Temple Entrance","odin_tem01",1); addMain("Orc Dungeon",24); addMap("Orc Dungeon Entrance","gef_fild10",1,"srcmap","orcsdun01"); addMain("Payon Dungeon",25); addMap("Payon Dungeon Entrance","pay_arche",1,"srcmap","pay_dun00"); addMain("Pyramids",26); addMap("Pyramids Entrance","moc_ruins",1,"srcmap","moc_pryd01"); addMain("Rachel Sanctuary",27); addMap("Rachel Sanctuary Entrance","ra_temin",1,"srcmap","ra_san01"); addMain("Royal Tomb",28); addMap("Royal Tomb Entrance","louyang",1,"srcmap","lou_dun01"); addMain("Sphinx",29); addMap("Sphinx Entrance","moc_fild19",1,"srcmap","in_sphinx1"); addMain("Sunken Ship",30); addMap("Sunken Ship Entrance","alb2trea",1,"srcmap","treasure01"); addMain("Thanatos Tower",31); addMap("Thanatos Tower Entrance","tha_scene01",1,"srcmap","tha_t01"); addMain("Thor Volcano",32); addMap("Thor Volcano Entrance","ve_fild03",1,"srcmap","thor_v01"); addMain("Toy Factory",33); addMap("Toy Factory Entrance","xmas",1,"srcmap","xmas_dun01"); addMain("Turtle Dungeon",34); addMap("Turtle Dungeon Entrance","tur_dun01",1); addMain("Umbala Dungeon",35); addMap("Umbala Dungeon Entrance","umbala",1,"srcmap","um_dun01"); addType("Castles",3); addMain("Aldebaran Castles",1); addMap("Aldebaran Guild","alde_gld",1); addMap("Neuschwanstein (Aldebaran)", "alde_gld",2,"x",48,"y",83, "srcmap", "aldeg_cas01"); addMap("Hohenschwangau (Aldebaran)", "alde_gld",3,"x",95,"y",249, "srcmap", "aldeg_cas02"); addMap("Nuenberg (Aldebaran)", "alde_gld",4,"x",142,"y",85, "srcmap", "aldeg_cas03"); addMap("Wuerzburg (Aldebaran)", "alde_gld",5,"x",239,"y",242, "srcmap", "aldeg_cas04"); addMap("Rothenburg (Aldebaran)", "alde_gld",6,"x",264,"y",90, "srcmap", "aldeg_cas05"); addMain("Geffen Castles",2); addMap("Geffen Guild","gef_fild13",1); addMap("Repherion (Geffen)", "gef_fild13",2,"x",214,"y",75, "srcmap", "gefg_cas01"); addMap("Eeyolbriggar (Geffen)", "gef_fild13",3,"x",308,"y",240, "srcmap", "gefg_cas02"); addMap("Yesnelph (Geffen)", "gef_fild13",4,"x",143,"y",240, "srcmap", "gefg_cas03"); addMap("Bergel (Geffen)", "gef_fild13",5,"x",193,"y",278, "srcmap", "gefg_cas04"); addMap("Mersetzdeitz (Geffen)", "gef_fild13",6,"x",305,"y",87, "srcmap", "gefg_cas05"); addMain("Payon Castles",3); addMap("Payon Guild","pay_gld",1); addMap("Bright Arbor (Payon)", "pay_gld",2,"x",121,"y",233, "srcmap", "payg_cas01"); addMap("Scarlet Palace (Payon)", "pay_gld",3,"x",295,"y",116, "srcmap", "payg_cas02"); addMap("Holy Shadow (Payon)", "pay_gld",4,"x",317,"y",293, "srcmap", "payg_cas03"); addMap("Sacred Altar (Payon)", "pay_gld",5,"x",140,"y",160, "srcmap", "payg_cas04"); addMap("Bamboo Grove Hill (Payon)", "pay_gld",6,"x",204,"y",266, "srcmap", "payg_cas05"); addMain("Prontera Castles",4); addMap("Prontera Guild","prt_gld",1); addMap("Kriemhild (Prontera)", "prt_gld",2,"x",134,"y",65, "srcmap", "prtg_cas01"); addMap("Swanhild (Prontera)", "prt_gld",3,"x",240,"y",128, "srcmap", "prtg_cas02"); addMap("Fadhgridh (Prontera)", "prt_gld",4,"x",153,"y",137, "srcmap", "prtg_cas03"); addMap("Skoegul (Prontera)", "prt_gld",5,"x",111,"y",240, "srcmap", "prtg_cas04"); addMap("Gondul (Prontera)", "prt_gld",6,"x",208,"y",240, "srcmap", "prtg_cas05"); addMain("Schwaltzvalt Castles",5); addMap("Yuno Guild","sch_gld",1); addMap("Himinn (Schwaltzvalt)", "sch_gld",2,"x",293,"y",100, "srcmap", "schg_cas01"); addMap("Andlangr (Schwaltzvalt)", "sch_gld",3,"x",288,"y",252, "srcmap", "schg_cas02"); addMap("Viblainn (Schwaltzvalt)", "sch_gld",4,"x",97,"y",196, "srcmap", "schg_cas03"); addMap("Hljod (Schwaltzvalt)", "sch_gld",5,"x",137,"y",90, "srcmap", "schg_cas04"); addMap("Skidbladnir (Schwaltzvalt)", "sch_gld",6,"x",71,"y",315, "srcmap", "schg_cas05"); addMain("Arunafeltz Castles",6); addMap("Rachel Guild","aru_gld",1); addMap("Mardol (Arunafeltz)", "aru_gld",2,"x",158,"y",272, "srcmap", "arug_cas01"); addMap("Cyr (Arunafeltz)", "aru_gld",3,"x",83,"y",47, "srcmap", "arug_cas02"); addMap("Horn (Arunafeltz)", "aru_gld",4,"x",68,"y",155, "srcmap", "arug_cas03"); addMap("Gefn (Arunafeltz)", "aru_gld",5,"x",299,"y",345, "srcmap", "arug_cas04"); addMap("Bandis (Arunafeltz)", "aru_gld",6,"x",292,"y",107, "srcmap", "arug_cas05"); addMain("Novice Castles",7,"class",1); //=== END of Configuration ================================================================// addType("dw_end"); if(!.typeCounter) { debugmes "[Dynamic Warper/Warning]: No active Warping-Type!"; } else { debugmes "[Dynamic Warper]: Successfully loaded "+.allLoadedMaps+" of "+.allMaps+" Maps ("+.autoMaps+" automatically generated)"; if(.mapflags) { debugmes "[Dynamic Warper]: Activated "+.mapflags+" Questwarp-Mapflags."; } if(.typeMenuSize > 2000) { debugmes "[Dynamic Warper/Warning] The types-menu could cause a Client crash containing about "+.typeMenuSize+" Chars!"; } } set .warpTypes,.typeCounter; set .setup,0; end; OnWarperStart: if(.setup) end; set .@layer,1; while( .@layer == 1) { if(.warpTypes > 1) { mes .name$; mes .t_choose$; //choose a type mes .t_explainred$; next; set .@menu$,genMenu(0); set .@type,(@dw_tempInt)?@dw_tempInt:select(.@menu$); if(.@type > .warpTypes) { mes .name$; mes .t_bye$; close; } } else { set .@type,1; } set .@typeID,menu2id(0,.@type); set .@service,(getd(".typeMod_favourites_"+.@typeID))?2: ((getd(".typeMod_lastwarps_"+.@typeID))?4:0); if(modifierCheck(0,.modifier_showInMenu,1+.@service,.@typeID)) { //check up to other checks,and show messages mes .name$; mes .t_notallowed$; close; } set .@layer,2; while( .@layer == 2) { if(.@service) { mes .name$; mes .t_choose$; next; if( .@service == 2 ) { set .@specialMod$,"favourites"; set .@specModVal,getd(".typeMod_favourites_"+.@typeID); set .@specPos,0; } else { set .@specialMod$,"lastwarps"; set .@specModVal,getd(".typeMod_lastwarps_"+.@typeID); set .@specPos,1; } if(modifierCheck(0,.modifier_allChecks,3,.@typeID)) { mes .name$; mes .t_notallowed$; close; } set .@specAmount,getSave(dw_infoSave,5,.@specPos); set .@menu$,""; for( set .@i,0; .@i < .@specAmount; set .@i,.@i+1 ) { set .@TypeID,getSave(getd("@dw_"+.@specialMod$+"_"+(.@i/2)),0,.@i%2); set .@MainID,getSave(getd("@dw_"+.@specialMod$+"_"+(.@i/2)),1,.@i%2); set .@mapID, getSave(getd("@dw_"+.@specialMod$+"_"+(.@i/2)),2,.@i%2); set .@postID$,.@typeID+"_"+.@mainID; if(getd(".mapSign_"+.@postID$+"_"+.@mapID+"$") == "") { set .@specAmount,.@specAmount-1; remSave(.@specialMod$,.@i); set .@i,.@i-1; continue; } set .@temp$,getd(".mapName_"+.@postID$+"_"+.@mapID+"$"); set .@add$,(.@temp$ == "")?getd(".mainName_"+.@postID$+"$"):.@temp$; if(!modifierCheck(2,.modifier_dontShowInMenu,0,.@typeID,.@mainID,.@mapID)) { //if it can be shown if(!modifierCheck(2,.modifier_showInMenu,0,.@typeID,.@mainID,.@mapID)) { //if allowed, show in black, else red set .@menu$,.@menu$+"- "+.@add$; } else { set .@menu$,.@menu$+"- ^FF0000"+.@add$+"^000000"; } } set .@menu$,.@menu$+":"; } set .@menu$,.@menu$+((.@specAmount)?.m_back$:.t_noentries$); set .@sel,select(.@menu$)-1; if( .@sel >= .@specAmount ) { //BACK set .@layer,1; break; } set .@typeID,getSave(getd("@dw_"+.@specialMod$+"_"+(.@sel/2)),0,.@sel%2); set .@mainID,getSave(getd("@dw_"+.@specialMod$+"_"+(.@sel/2)),1,.@sel%2); set .@mapID ,getSave(getd("@dw_"+.@specialMod$+"_"+(.@sel/2)),2,.@sel%2); set .@layer,3; } else {// else, normal warp =) if(getd(".typeMains_"+.@type) > 1) { mes .name$; mes .t_choose$; next; set .@menu$,genMenu(1,.@type); set .@main,(@dw_tempInt)?@dw_tempInt:select(.@menu$); if(.@main > getd(".typeMains_"+.@type)) { set .@layer,1; break; } } else { set .@main,1; } set .@mainID,menu2id(1,.@type,.@main); if(modifierCheck(1,.modifier_showInMenu,1,.@typeID,.@mainID)) { //check up to other checks mes .name$; mes .t_notallowed$; close; } if(getd(".mainMaps_"+.@type+"_"+.@main) > 1) { //if there is only one choice warp directly mes .name$; mes .t_choose$; next; set .@menu$,genMenu(2,.@type,.@main); set .@map,(@dw_tempInt)?@dw_tempInt:select(.@menu$); if(.@map > getd(".mainMaps_"+.@type+"_"+.@main)) { continue; //jump to layer 2 } } else { set .@map,1; } set .@mapID ,menu2id(2,.@type,.@main,.@map); set .@layer,3; } } if(.@layer < 3) continue; //=== WARPING ===// set .@mapFullID,setSave(".@temp",0,1,.@typeID,.@mainID,.@mapID); set .@postID$,.@typeID+"_"+.@mainID+"_"+.@mapID; set .@temp$,getd(".mapName_"+.@postID$+"$"); set .@destination$,(.@temp$ == "")?getd(".mainName_"+.@typeID+"_"+.@mainID+"$"):.@temp$; set .@mapname$,getd(".mapSign_"+.@postID$+"$"); set .@x,getd(".mapMod_x_"+.@postID$); set .@y,getd(".mapMod_y_"+.@postID$); set .@price,getd(".mapMod_price_"+.@typeID+"_"+.@mainID+"_"+.@mapID); //getModValue("price",.@modifier,.@typeID,.@mainID,.@mapID); set .@priceItem,getd(".mapMod_priceItem_"+.@typeID+"_"+.@mainID+"_"+.@mapID); // reductions if(.warpConfirm) { mes .name$; mes sprintf(.t_warpto$,.@destination$); if(.@price) { mes sprintf(.t_cost$,.@price); } if(.@priceItem) { mes .t_itemstart$; for(set .@i,0; .@i < getarraysize(.priceItems) && (1<<(.@i/2)) <= .@priceItem; set .@i,.@i+2) { if(.@priceItem&(1<<(.@i/2))) { mes sprintf(.t_cost_item$,.priceItems[.@i+1],getitemname(.priceItems[.@i])); } } } next; set .@addF,select(.m_warp$,(.favourites)?.m_favo$:":",(.@service&2)?.m_delfavo$:":",.m_cancel$); if(.@addF&6) { if(.@addF&2) addSave("favourites",.@mapFullID,0); // 0 = on top if(.@addF&4) remSave("favourites",.@sel,0); storeCharData("favourites"); } if(!(.@addF&1)) { set .@layer,1; continue; } } if(modifierCheck(2,.modifier_allChecks,1,.@typeID,.@mainID,.@mapID)) { //check up all checks (not price), and show messages mes .name$; mes sprintf(.t_nowarpall$,.@destination$); close; } if( .partyWarp && getpartyleader(getcharid(1),2) == getcharid(0) ) { mes .name$; mes .t_takeparty$; if(.@price) { mes .t_eachmemfee$; } next; if(select(.m_no$,.m_yes$)-1) { //creating instance & activating semaphore lock if possible! if($@dw_semaphore) { for( set .@i,1; $@dw_semaphore; set .@i,.@i+1) { sleep2 20; if(.@i%50 == 0) { mes .t_semaphore$; } if(.@i > 150) { //impossible...force the process break; } } } set $@dw_semaphore,1; set .@partywarp,1; if( instance_id(1) ) { instance_destroy(instance_id(1)); } set .@iID,instance_create("WarpMyParty",getcharid(1)); if(.@iID < 0) { set $@dw_semaphore,0; mes .name$; mes .t_instance_error$; debugmes "[Warper/Error] Instance Error No. "+.@iID+" occured!"; //should only be -3 ==> max instances close; } instance_attach(.@iID); instance_set_timeout(20,20,.@iID); getpartymember(getcharid(1),2); //generating member info-arrays copyarray .@partymem[0],$@partymemberaid[0],$@partymembercount; getpartymember(getcharid(1),0); copyarray .@partymemname$[0],$@partymembername$[0],$@partymembercount; set .@leaderID,getcharid(3); set 'warpDest$,.@destination$; //using instance vars set 'price,.@price; set 'priceItem,.@priceItem; //ask each player if he wants to warp mes .name$; mes .t_members$; getmapxy .@map_current$,.@x_current,.@y_current,0; set .@j,0; for( set .@i,0; .@i < getarraysize(.@partymem); set .@i,.@i+1 ) { set .@map_party$,""; getmapxy .@map_party$,.@x_party,.@y_party,0,.@partymemname$[.@i]; if( .@map_party$ == .@map_current$ ) { set .@check,0; detachrid; if(attachrid(.@partymem[.@i])) { set .@check,modifierCheck(2,.modifier_allChecks,1,.@typeID,.@mainID,.@mapID); //check, incl. price and dispbottom detachrid; } if(!attachrid(.@leaderID)) { end; } if(!.@check) { set 'warpID[.@j],.@partymem[.@i]; if('warpID[.@j] != .@leaderID) { set 'warpCheck[.@j],0; set $@dw_partypipe[.@j],'warpID[.@j]; set $@dw_partypipe_check[.@j],1; donpcevent("dynamic_warper::OnPartyWarp"); } else { set 'warpCheck[.@j],1; } mes .@partymemname$[.@i]+": "+.e_online$; set .@j,.@j+1; } else { mes .@partymemname$[.@i]+": ^FF8800"+.e_party$[.@check-1]+"^000000"; } } else if( .@map_party$ == "" ) { mes .@partymemname$[.@i]+": "+.e_offline$; } else { mes .@partymemname$[.@i]+": "+.e_wrongmap$;; } } set $@dw_semaphore,0; mes "==============="; set .@count,0; set .@k,0; for( set .@i,0; .@i < 16 && (.@count+.@k) < getarraysize('warpID); set .@i,.@i+1 ) { if(.@i) sleep2 1000; showdigit 15-.@i,0; for( set .@j,0; .@j < getarraysize('warpID); set .@j,.@j+1 ) { if('warpCheck[.@j] == 1) { set 'warpCheck[.@j],2; set .@checkedID[.@count],'warpID[.@j]; mes rid2name('warpID[.@j])+" "+.e_checkin$; set .@count,.@count+1; } else if ('warpCheck[.@j] == 3) { set 'warpCheck[.@j],2; mes rid2name('warpID[.@j])+" "+.e_checkout$; set .@k,.@k+1; } } } showdigit 0,3; mes sprintf(.t_checkedin$,.@count,getarraysize('warpID)); instance_destroy(.@iID); if(.@price) { mes sprintf(.t_cost$,.@price); } mes .t_proceed$; next; if(select(.m_yes$,.m_no$)-1) { mes .name$; mes .t_bye$; close; } } } close2; //here we need a 2nd check, to prevent cheating... (only for price reduction...) if( .specialeffect ) { set .@i,0; do { if(.@partywarp) { detachrid; if(!attachrid(.@checkedID[.@i])) { deletearray .@checkedID[.@i],1; continue; } if(modifierCheck(2,.modifier_allChecks,1,.@typeID,.@mainID,.@mapID)) { deletearray .@checkedID[.@i],1; continue; } set .@i,.@i+1; } specialeffect2 460; specialeffect2 501; } while(.@partywarp && .@i < getarraysize(.@checkedID)); sleep2 1000; } set .@x_main,.@x; set .@y_main,.@y; set .@i,0; do { if(.@partywarp) { detachrid; if(!attachrid(.@checkedID[.@i])) { set .@i,.@i+1; continue; } } if(!.@partywarp || (.@partywarp && isloggedin(.@checkedID[.@i]))) { if(!modifierCheck(2,.modifier_allChecks,1,.@typeID,.@mainID,.@mapID)) { set zeny,zeny-.@price; for(set .@j,0; .@j < getarraysize(.priceItems) && (1<<(.@j/2)) <= .@priceItem; set .@j,.@j+2) { if(.@priceItem&(1<<(.@j/2))) { delitem .priceItems[.@j],.priceItems[.@j+1]; } } if(.specialeffect) specialeffect2 778; if(!.@x_main && !.@y_main) { //when random warp, set new coordinates warp .@mapname$,0,0; getmapxy .@mapname_new$,.@x_new,.@y_new,0; set .@mapname$,.@mapname_new$; set .@x_main,.@x_new; set .@y_main,.@y_new; } else { // else generate random coordinates around the dest.-warper freeloop(1); do { set .@x,.@x_main+(rand(0,1)?(-1):1)*rand(1,2); set .@y,.@y_main+(rand(0,1)?(-1):1)*rand(1,2); } while( !checkcell(.@mapname$,.@x,.@y,cell_chkpass) ); freeloop(0); warp .@mapname$,.@x,.@y; } if(.lastwarps) { addSave("lastwarps",.@mapFullID,0); // 0 = on top storeCharData("lastwarps"); } } } if(.@partywarp) { set .@i,.@i+1; } } while (.@partywarp && .@i < getarraysize(.@checkedID)); end; } while(.@layer > 0); //====================// // ADDING FUNCTIONS //====================// function addType { if(.typeCounter) { set .@postMenuID$,(.typeCounter); set .@postID$,""+menu2id(0,.typeCounter); //0=type if(!getd(".typeMod_favourites_"+.@postID$) && !getd(".typeMod_lastwarps_"+.@postID$)) { addMain("dw_end"); //final "bracket" if( !.mainCounter ) { //if there are no entries debugmes "[Dynamic Warper/Error] Type "+getd(".typeName_"+.@postID$+"$")+" is empty and removed."; set .typeCounter,.typeCounter-1; } else { if(.mainMenuSize > 2000) { debugmes "[Dynamic Warper/Warning] Type "+getd(".typeName_"+.@postID$+"$")+" could cause a Client crash in its menu containing about "+.mainMenuSize+" Chars!"; } set getd(".typeMains_"+.@postMenuID$),.mainCounter; } } } set .mainCounter,0; set .mainMenuSize,getstrlen(.m_back$); set .@name$,getarg(0,""); set .@id,getarg(1,0); if(.@name$ == "dw_end") { // ending return; } if(.@name$ == "") { //if no valid type debugmes "[Dynamic Warper/Error] Types have to be named!"; return; } if(.@id == 0) { debugmes "[Dynamic Warper/Error] ID 0 is no valid Type-ID for "+.@name$; return; } freeloop(1); for(set .@i,1; .@i <= .typeCounter; set .@i,.@i+1) { //check if ID was doubled if(menu2id(0,.@i) == .@id) { debugmes "[Dynamic Warper/Error] ID "+.@id+" of Type "+.@name$+" does already exist!"; return; } } freeloop(0); set .@postMenuID$,""+(.typeCounter+1); set .@postID$,""+.@id; set getd(".typeID_"+.@postMenuID$),.@id; set getd(".typeName_"+.@postID$+"$"),.@name$; // Check Modifiers: freeloop(1); for( set .@i,2; getarg(.@i,"") != ""; set .@i,.@i+2 ) { set .@mod,getd(".modifier_"+getarg(.@i)); if(.@mod) { set getd(".typeMod_"+getarg(.@i)+"_"+.@postID$),getarg(.@i+1,0); if( getarg(.@i) == "favourites" || getarg(.@i) == "lastwarps" ) { set getd("."+getarg(.@i)),getarg(.@i+1,0); continue; //no need to cascade up or down ~ } set .@tempMod,.@tempMod|.@mod; } else { debugmes "[Dynamic Warper/Error] Modifier "+getarg(.@i)+" does not exist!"; } } freeloop(0); set getd(".typeMod_"+.@postID$),.@tempMod; set .typeCounter,.typeCounter+1; set .typeMenuSize,.typeMenuSize + getstrlen(.@name$) + 17 //17 = - ^FF0000^000000: + ((modifierCheck(0,.modifier_mapusers,0,.@id,0,0))?6:0); //6 = _[xxx] return; } function addMain { sleep 1; if(.mainCounter) { set .@postMenuID$,(.typeCounter)+"_"+(.mainCounter); set .@postID$,menu2id(0,.typeCounter)+"_"+menu2id(1,.typeCounter,.mainCounter); if( !.mapCounter ) { //look for NPC with the type-ID_main-ID getmapxy .@map$,.@x,.@y,1,"dw_"+.@postID$; if(addMap("dw_empty",.@map$,1)){ set .autoMaps,.autoMaps+1; } } if( !.mapCounter ) { //if there are no entries debugmes "[Dynamic Warper/Error] Main Menu "+getd(".mainName_"+.@postID$+"$")+" has got no maps and will be removed!"; set .mainCounter,.mainCounter-1; } else { if(.mapMenuSize > 2000) { debugmes "[Dynamic Warper/Warning] Main "+getd(".mainName_"+.@postID$+"$")+" could cause a Client crash in its menu containing about "+.mapMenuSize+" Chars!"; } set getd(".mainMaps_"+.@postMenuID$),.mapCounter; } } set .mapCounter,0; set .mapMenuSize,getstrlen(.m_back$); set .@name$,getarg(0,""); set .@id,getarg(1,0); if(.@name$ == "dw_end") { // ending return; } if(.@name$ == "") { //if no valid main name debugmes "[Dynamic Warper/Error] Mains have to be named!"; return; } if(.@id == 0) { debugmes "[Dynamic Warper/Error] ID 0 is no valid Main-ID for "+.@name$; return; } freeloop(1); for(set .@i,1; .@i <= .mainCounter; set .@i,.@i+1) { //check if ID was doubled if(menu2id(1,.typeCounter,.@i) == getarg(1)) { debugmes "[Dynamic Warper/Error] ID "+getarg(1,0)+" of Main "+getarg(0,"")+" does already exist!"; return; } } freeloop(0); set .@typeID,menu2id(0,.typeCounter); set .@postMenuID$,.typeCounter+"_"+(.mainCounter+1); set .@postID$,.@typeID+"_"+.@id; set getd(".mainID_"+.@postMenuID$),.@id; set getd(".mainName_"+.@postID$+"$"),.@name$; freeloop(1); for( set .@i,2; getarg(.@i,"") != ""; set .@i,.@i+2 ) { set .@mod,getd(".modifier_"+getarg(.@i)); if(.@mod) { set getd(".mainMod_"+getarg(.@i)+"_"+.@postID$),getarg(.@i+1,0); set .@tempMod,.@tempMod|.@mod; } else { debugmes "[Dynamic Warper/Error] Modifier "+getarg(.@i)+" does not exist!"; } } freeloop(0); set getd(".mainMod_"+.@postID$),modifierCascade(.@tempMod,.@typeID,.@id); set .mainCounter,.mainCounter+1; set .mainMenuSize,.mainMenuSize + getstrlen(.@name$) + 17 //17 = - ^FF0000^000000: + ((modifierCheck(1,.modifier_mapusers,0,.@typeID,.@id,0))?6:0); //6 = _[xxx] return; } function addMap { set .allMaps,.allMaps+1; set .@typeID,menu2id(0,.typeCounter); set .@mainID,menu2id(1,.typeCounter,.mainCounter); set .@postID$,.@typeID+"_"+.@mainID; set .@name$,getarg(0,""); set .@sign$,getarg(1,""); set .@id,getarg(2,0); if(getmapusers(.@sign$) < 0) { debugmes "[Dynamic Warper/Error] Map "+.@sign$+" was not found!"; return 0; } if(.@name$ == "") { //if no name is given debugmes "[Dynamic Warper/Error] Maps have to be named!"; return 0; } if(.@id <= 0) { debugmes "[Dynamic Warper/Error] ID "+.@id+" is no valid Map-ID for "+.@name$; return 0; } freeloop(1); for(set .@i,1; .@i <= .mapCounter; set .@i,.@i+1) { //check if ID was doubled if(menu2id(2,.typeCounter,.mainCounter,.@i) == .@id) { debugmes "[Dynamic Warper/Error] ID "+.@id+" of Map "+.@sign$+" does already exist!"; return 0; } } freeloop(0); if(.@id == 1) { //id 1 is special, and will look for specific coordinates getmapxy .@map$,.@x,.@y,1,"dw_"+.@postID$; if(.@sign$ == .@map$) { set getd(".mapMod_x_"+.@postID$+"_"+.@id),.@x; set getd(".mapMod_y_"+.@postID$+"_"+.@id),.@y; } else if(.@map$ != "") { debugmes "[Dynamic Warper/Error] Found Warp-NPC dw_"+.@postID$+" standing on map "+.@map$+" instead of "+.@sign$+"."; } } set .@postID$,.@postID$+"_"+.@id; set .@postMenuID$,.typeCounter+"_"+.mainCounter+"_"+(.mapCounter+1); set getd(".mapID_"+.@postMenuID$),.@id; if(.@name$ != "dw_empty") { set getd(".mapName_"+.@postID$+"$"),.@name$; } set getd(".mapSign_"+.@postID$+"$"),.@sign$; freeloop(1); for( set .@i,3; getarg(.@i,"") != ""; set .@i,.@i+2 ) { set .@mod,getd(".modifier_"+getarg(.@i)); if(.@mod) { if( getarg(.@i) == "srcmap" ) { if(getmapusers(getarg(.@i+1,"")) < 0) { debugmes "[Dynamic Warper/Error] Source-Map "+getarg(.@i+1,"")+" was not found!"; continue; } set getd(".mapMod_"+getarg(.@i)+"_"+.@postID$+"$"),getarg(.@i+1); set .@sign$,getarg(.@i+1); } else { set getd(".mapMod_"+getarg(.@i)+"_"+.@postID$),getarg(.@i+1,0); } if(.@mod == 1<<31) { continue; //special mods, no cascade needed! } set .@tempMod,.@tempMod|.@mod; } else { debugmes "[Dynamic Warper/Error] Modifier "+getarg(.@i)+" does not exist!"; } } freeloop(0); set .@tempMod,modifierCascade(.@tempMod,.@typeID,.@mainID,.@id); set getd(".mapMod_"+.@postID$),.@tempMod; set .@quest,getd(".mapMod_questwarp_"+.@typeID+"_"+.@mainID+"_"+.@id); //getModValue("questwarp",.@tempMod,.@typeID,.@mainID,.@id); if(.@quest) { //if questwarp is acitvated && add maps starting with id 1, else 2 if(.@quest&1 && !getd(".mapMod_blindmap_"+.@postID$)) { setmapflag .@sign$,mf_loadevent; //saving type&main-ID in the map name, and the questwarp information, 16 bits left set getd("$@dw_maps_"+.@sign$+"$"),setSave(".@temp",0,1,.@typeID,.@mainID,.@quest); set .mapflags,.mapflags+1; } } set .mapCounter,.mapCounter+1; if(.@name$ == "dw_empty" ||.@name$ == "") { set .@name$,getd(".mainName_"+.@typeID+"_"+.@mainID+"$"); } set .mapMenuSize,.mapMenuSize + getstrlen(.@name$) + 17 //17 = - ^FF0000^000000: + ((modifierCheck(2,.modifier_mapusers,0,.@typeID,.@mainID,.@id))?6:0); //6 = _[xxx] set .allLoadedMaps,.allLoadedMaps+1; return 1; } function genMenu { set .@menu$,""; set .@postID$,""; set .@postMenuID$,""; freeloop(1); switch(getarg(0)) { case 2: //mapmenu set .@mainID,menu2id(1,getarg(1),getarg(2)); set .@postID$,"_"+.@mainID; set .@postMenuID$,"_"+getarg(2); case 1: //mainmenu set .@typeID,menu2id(0,getarg(1)); set .@postID$,"_"+.@typeID+""+.@postID$; set .@postMenuID$,"_"+getarg(1)+""+.@postMenuID$; case 0: //typemenu break; } switch(getarg(0)) { case 0: set .@count,.warpTypes; set .@typeStr$,"type"; break; case 1: set .@count,getd(".typeMains"+.@postMenuID$); set .@typeStr$,"main"; break; case 2: set .@count,getd(".mainMaps"+.@postMenuID$); set .@typeStr$,"map"; break; } for( set .@i,1; .@i <= .@count; set .@i,.@i+1 ) { set .@id,menu2id(getarg(0),getarg(1,.@i),getarg(2,.@i),.@i); switch(getarg(0)) { case 0: set .@typeID,.@id; break; case 1: set .@mainID,.@id; break; case 2: set .@mapID,.@id; break; } if(!modifierCheck(getarg(0),.modifier_dontShowInMenu,0,.@typeID,.@mainID,.@mapID)) { // 0 , check, if all "hide" types are fulfilled //if getmapusers is activated set .@mapuser$,modifierCheck(getarg(0),.modifier_mapusers,0,.@typeID,.@mainID,.@mapID)?(" ["+getDestUsers(getarg(0),getarg(1,.@i),getarg(2,.@i),.@i)+"]"):""; if(!modifierCheck(getarg(0),.modifier_showInMenu,0,.@typeID,.@mainID,.@mapID)) { // 1, check if all "in menu checks are fulfilled set .@menu$,.@menu$+"- "+getd("."+.@typeStr$+"Name"+.@postID$+"_"+.@id+"$")+.@mapuser$; set @dw_tempInt,(.@i>0)?0:(.@i+1); } else { //if not, show, but colored! set .@menu$,.@menu$+"- ^FF0000"+getd("."+.@typeStr$+"Name"+.@postID$+"_"+.@id+"$")+"^000000"+.@mapuser$; set @dw_tempInt,0; } } else { set @dw_tempInt,0; } set .@menu$,.@menu$+":"; } return .@menu$+((getarg(0))?.m_back$:.m_cancel$); } //type = 0, main = 1, map = 2 ~~~~ 0 gets left, 1 gets right // *getsave(,,) function getSave { if(getarg(1) == 7) { //questwarp amount save, 0 = left data return (getarg(0) << (4*getarg(2))) >> (28-4*getarg(2)); } setarray .@nums[0],4,7, 5,4,6, 6,16; setarray .@sums[0],0,4,11,0,4,10, 0; return ( getarg(0) << (16*getarg(2)+.@sums[getarg(1)]) ) >> (32-.@nums[getarg(1)]); } // setsave( ,,,,, function setSave { // type 0:mapsave, 1: ? ; var 1 or 2: 0 = left, 1 = right switch(getarg(1)) { //erase old data | new data case 0: set getd(getarg(0)),(getd(getarg(0))&(((1<<16)-1)<<(16*getarg(2)))) | (((getarg(3)<<12)|(getarg(4)<<5)|getarg(5))<<(16*((getarg(2)%2)+1))); break; case 1: set getd(getarg(0)),(getd(getarg(0))&(((1<<16)-1)<<(16*getarg(2)))) | (((getarg(3)<<12)|(getarg(4)<<6)|getarg(5))<<(16*((getarg(2)%2)+1))); break; case 2: set getd(getarg(0)),(getd(getarg(0))&(((1<<16)-1)<<(16*getarg(2)))) | ( getarg(3)<<(16*((getarg(2)%2)+1))); break; } return getd(getarg(0)); } //moveSave(,,<+/-moves>) function moveSave { set .@pos,(getarg(0) == "lastwarps")?1:0; //lastwarp,else favourites set .@amo,getSave(dw_infoSave,5,.@pos); if(!.@amo) return; set .@mover,(getarg(2)<0)?-1:1; set .@moves,((getarg(2)<0)?(-getarg(2)):getarg(2))%.@amo; set .@pointer,getarg(1)%.@amo; set .@save,getSave(getd("@dw_"+getarg(0)+"_"+(.@pointer/2)),6,.@pointer%2); for( set .@i,0; .@i < .@moves; set .@i,.@i+1 ) { set .@pointerTo,(.@pointer+.@amo+(.@mover*.@i))%.@amo; set .@pointerFrom,(.@pointerTo+.@amo+.@mover)%.@amo; setSave("@dw_"+getarg(0)+"_"+(.@pointerTo/2),2,.@pointerTo%2, getSave(getd("@dw_"+getarg(0)+"_"+(.@pointerFrom/2)),6,.@pointerFrom%2)); } set .@pointerTo,(.@pointer+.@amo+(.@mover*.@moves))%.@amo; setSave("@dw_"+getarg(0)+"_"+(.@pointerTo/2),2,.@pointerTo%2,.@save); return; } // *addSave("typestring",addingvalue{,top(0)/down(1)}) function addSave { set .@pos,(getarg(0) == "lastwarps")?1:0; //lastwarp,else favourites set .@type$,getarg(0); set .@save,getarg(1); set .@amo,getSave(dw_infoSave,5,.@pos); if(.@amo) { for( set .@j,0; .@j < .@amo; set .@j,.@j+1 ) { if(getSave(getd("@dw_"+.@type$+"_"+(.@j/2)),6,.@j%2)==.@save) { moveSave(.@type$,.@j,-.@j); break; } } if(.@j >= .@amo) { //no duplicate *_* if(.@amo < getd("."+.@type$)) { set .@amo,.@amo+1; setSave("dw_infoSave",1,.@pos,0,0,.@amo); } moveSave(.@type$,.@amo-1,-(.@amo-1)); //moves all entry 1 down setSave("@dw_"+.@type$+"_0",2,0,.@save); } } else { setSave("@dw_"+.@type$+"_0",2,0,.@save); set .@amo,.@amo+1; } setSave("dw_infoSave",1,.@pos,0,0,.@amo); return; } // *remSave("typestr",deleteID) function remSave { set .@pos,(getarg(0) == "lastwarps")?1:0; set .@type$,getarg(0); set .@id,getarg(1); set .@amo,getSave(dw_infoSave,5,.@pos); if(.@id < .@amo) { //should always happen moveSave(.@type$,.@id,.@amo-(.@id+1)); //move entry to last position setSave("dw_infoSave",1,.@pos,0,0,.@amo-1); //unevaluate last entry } return; } // menu2id(,{,main{,map}}); // returns the the uniqueID of the menu-point function menu2id { set .@temp$,""; freeloop(1); switch(getarg(0)) { case 2: set .@temp$,"_"+getarg(3); case 1: set .@temp$,"_"+getarg(2)+""+.@temp$; case 0: set .@temp$,"_"+getarg(1)+""+.@temp$; } switch(getarg(0)) { case 0: return getd(".typeID"+.@temp$); case 1: return getd(".mainID"+.@temp$); case 2: return getd(".mapID"+.@temp$); } freeloop(0); } //getDestUsers(type,typeMenuID{,mainMenuID{,mapMenuID}}) function getDestUsers { set .@count,0; set .@typeMenuID,getarg(1); set .@typeID,menu2id(0,.@typeMenuID); set .@countMains,(getarg(0) < 1)?getd(".typeMains_"+.@typeMenuID):1; freeloop(1); for( set .@i,0; .@i < .@countMains; set .@i,.@i+1) { set .@mainMenuID,(getarg(0) < 1)?(.@i+1):getarg(2); set .@mainID,menu2id(1,.@typeMenuID,.@mainMenuID); set .@countMaps,(getarg(0) < 2)?getd(".mainMaps_"+.@typeMenuID+"_"+.@mainMenuID):1; for( set .@j,0; .@j < .@countMaps; set .@j, .@j+1 ) { set .@mapMenuID,(getarg(0) < 2)?(.@j+1):getarg(3); set .@mapID,menu2id(2,.@typeMenuID,.@mainMenuID,.@mapMenuID); set .@postID$,.@typeID+"_"+.@mainID+"_"+.@mapID; if(getd(".mapMod_blindmap_"+.@postID$)) continue; set .@count,.@count+getmapusers(getd((getstrlen(getd(".mapMod_srcmap_"+.@postID$+"$"))? (".mapMod_srcmap_"+.@postID$+"$"):(".mapSign_"+.@postID$+"$")))); } } freeloop(0); return .@count; } function modifierSetup { setarray .modNames$, "gm", //0 "woe", "class", "upper", "questwarp", "bmaxlvl", "bminlvl", "flag", "price", "priceItem", "price_red", "mapusers"; // 10 //"posses item" for( set .@i,0; .@i < getarraysize(.modNames$); set .@i,.@i+1 ) { set getd(".modifier_"+.modNames$[.@i]),1 << (.@i*2); } //the following is special stuff, uses 31, to prevent admin mistakes with this modifiers =) set .modifier_blindmap, 1 << 31; //only map set .modifier_srcmap, 1 << 31; //only map set .modifier_x, 1 << 31; //only map set .modifier_y, 1 << 31; //only map set .modifier_lastwarps, 1 << 31; //only type set .modifier_favourites, 1 << 31; //only type //= settings: modifier groups START //= if one of these conditions is not fullfied, the menu point won't be shown in the menu set .modifier_dontShowInMenu,.modifier_gm|.modifier_woe|.modifier_class; //= those conditions will be shown red, when not fullfied set .modifier_showInMenu,.modifier_upper|.modifier_bmaxlvl|.modifier_bminlvl|.modifier_flag|.modifier_questwarp; //= settings: modifier groups END set .modifier_otherChecks,.modifier_price|.modifier_priceItem; //checked after menu set .modifier_other,.modifier_mapusers|.modifier_price_red; set .modifier_menuChecks,.modifier_dontShowInMenu|.modifier_showInMenu; set .modifier_allChecks,.modifier_menuChecks|.modifier_otherChecks; set .modifier_allMods,.modifier_allChecks|.modifier_other; setarray .char$[0], // "!", "#", "$", "%", "&", "(", ")", "*", "+", "-", // "0", "1", "2", "3", "4", "5", "6", "7", "8", "9", //10 // "<", "=", ">", "?", "@", // "A", "B", "C", "D", "E", "F", "G", "H", "I", //19 "J", "K", "L", "M", "N", "O", "P", "Q", "R", //28 "S", "T", "U", "V", "W", "X", "Y", "Z", //36 "[", "]",// "^", "_", //38 "a", "b", "c", "d", "e", "f", "g", "h", "i", //47 "j", "k", "l", "m", "n", "o", "p", "q", "r", //56 "s", "t", "u", "v", "w", "x", "y", "z"; //64 // "{", "|", "}", "~"; // return; } function checkSingleMod { // check if getarg(2) contains getarg(1) and return result // 1 = old , 2 = new // getarg(1) = player-val set .@type, getarg(0); if(.@type == .modifier_gm || .@type == .modifier_bminlvl || .@type == .modifier_price) { if(getarg(1) == getarg(2)) return 1; if(getarg(1) > getarg(2)) return 2; return 0; } // 1: off when woe on // 2: off when woe off // 4: off when woe2 on // 8: off when woe2 off //16: off when not guild member //32: off when gvg active //64: off when gvg inactive if(.@type == .modifier_woe) { //0xF000000 is > ea_maxint and will return '0' instead of binary: 1111 0000 .... if(getarg(1)&(0xF<<28)) { // type saved, no cascading if((getarg(2)&0x100 && agitcheck()) || (getarg(2)&0x200 && !agitcheck())) return 1; if((getarg(2)&0x400 && agitcheck2()) || (getarg(2)&0x800 && !agitcheck2())) return 1; if(!(getarg(1)&0xF0000)) { //for checks concerning non-maps (for menu purposes) if(getarg(2)&0xF000) return 1; //a submap could fullfill the condition! } else { //if there are any map options to check (gvg, leader) set .@post$,"_"+getSave(getarg(1),0,0)+"_"+getSave(getarg(1),1,0)+"_"+getSave(getarg(1),2,0)+"$"; set .@sign$,((getstrlen(getd(".mapMod_srcmap"+.@post$)))?getd(".mapMod_srcmap"+.@post$):getd(".mapSign"+.@post$)); if((getarg(2)&0x1000 && getmapflag(.@sign$,mf_gvg)) || (getarg(2)&0x2000 && !getmapflag(.@sign$,mf_gvg))) return 1; if(getarg(2)&0x4000 && getstrlen(getcastlename(.@sign$))) if(getcastledata(.@sign$,1) && (getcastledata(.@sign$,1) == getcharid(2))) return 1; } if((getarg(2)&1 && agitcheck()) || (getarg(2)&2 && !agitcheck())) return 0; if((getarg(2)&4 && agitcheck2()) || (getarg(2)&8 && !agitcheck2())) return 0; if(!(getarg(1)&0x1F0000)) return 1; //if type != map if((getarg(2)&0x10 && getmapflag(.@sign$,mf_gvg)) || (getarg(2)&0x20 && !getmapflag(.@sign$,mf_gvg))) return 0; if(getarg(2)&0x40 && getstrlen(getcastlename(.@sign$))) if(getcastledata(.@sign$,1) && (getcastledata(.@sign$,1) != getcharid(2))) return 0; return 1; } if( getarg(2)&0xF000 || (getarg(2)&getarg(1)&0x0F00)!=(getarg(1)&0x0F00) || !(getarg(2)&0xF) || !(getarg(1)&0xF) || (getarg(2)&getarg(1)&0x0F00)!=(getarg(2)&0x0F00) ) return 2; return 0; } if(.@type == .modifier_class || .@type == .modifier_upper) { if(getarg(1) == getarg(2)) return 1; if(getarg(2)&getarg(1) && getarg(1) > getarg(2)) return 2; return 0; } if(.@type == .modifier_bmaxlvl) { if(getarg(1) == getarg(2)) return 1; if(getarg(1) < getarg(2)) return 2; return 0; } //mainvar + mapvar if(.@type == .modifier_flag) { if(getarg(1)&(1<<31)) { // no cascading for( set .@i,0; .@i < getarraysize(.flags$) && (1<<(.@i/3)) <= getarg(2); set .@i,.@i+3 ) { if(getarg(2)&(1<<(.@i/3))) { set .@opt,atoi(.flags$[.@i+2]); set .@val,atoi(.flags$[.@i+1]); set .@pVal,getd(.flags$[.@i]); if(.@opt&1) if(.@pVal < .@val) continue; if(.@opt&2) if(.@pVal == .@val) continue; if(.@opt&4) if(.@pVal > .@val) continue; return 0; } } return 1; } if(getarg(1)&getarg(2) == getarg(2)) return 0; return 2; } if(.@type == .modifier_questwarp) { //type,main,map , if(getarg(1)&0xF000) { //if there is a "type" saved, we are not cascading if(isVisited(getSave(getarg(1),0,1),getSave(getarg(1),1,1),getarg(2)&2,0)) { return 1; } return 0; } return 0; //never cascading "down" } if(.@type == .modifier_priceItem) { if(getarg(1)&(1<<31)) { // no cascading for( set .@i,0; .@i < getarraysize(.priceItems) && (1<<(.@i/2)) <= getarg(2); set .@i,.@i+2 ) { if(getarg(2)&(1<<(.@i/2))) { if(countitem(.priceItems[.@i]) < .priceItems[.@i+1]) { return 0; } } } return 1; } if(getarg(1)&getarg(2) == getarg(2)) return 0; return 2; } if(.@type == .modifier_mapusers) { //no need to ever cascade downwards if(getarg(2)&getarg(1)) return 0; //0, because mapusers have to be shown, when an "error" occures, otherwise the always would be shown, if no setting is given! return 1; } return 0; } function modifierCascade { //modifierCascade(.@tempMod,.@typeID,.@mainID{,.@mapID}); set .@tempMod, getarg(0); set .@typeID, getarg(1); set .@mainID, getarg(2); set .@mapID,getarg(3,0); // won't be 0, when cascade from map set .@typeMod,getd(".typeMod_"+.@typeID); //former upMod if(.@mapID) { set .@mainMod,getd(".mainMod_"+.@typeID+"_"+.@mainID); //former upMod2 } freeloop(1); for( set .@i,0; (1<<.@i) <= .modifier_allMods && .@i<31; set .@i,.@i+2 ) { set .@temp$,.modNames$[.@i/2]+"_"+.@typeID; if( .@tempMod&(3<<.@i) == (1<<.@i) ) { //if map has own value, or main has own value and still no "down" value test if needed! if(.@mapID) { if(.@mainMod&(3<<.@i)==(1<<.@i) && 2 == checkSingleMod(1<<.@i,getd(".mainMod_"+.@temp$+"_"+.@mainID),getd(".mapMod_"+.@temp$+"_"+.@mainID+"_"+.@mapID))) { set .@mainMod,.@mainMod|(2<<.@i); } if(.@typeMod&(3<<.@i)==(1<<.@i) && 2 == checkSingleMod(1<<.@i,getd(".typeMod_"+.@temp$),getd(".mapMod_"+.@temp$+"_"+.@mainID+"_"+.@mapID))) { set .@typeMod,.@typeMod|(2<<.@i); } } else { //cascading main if(.@typeMod&(3<<.@i)==(1<<.@i) && 2 == checkSingleMod(1<<.@i,getd(".typeMod_"+.@temp$),getd(".mainMod_"+.@temp$+"_"+.@mainID))) { set .@typeMod,.@typeMod|(2<<.@i); } } continue; //has got own value, no need to search further } if(.@mapID) { if(.@mainMod&(1<<.@i)) { //when main has own value, use it set .@tempMod,.@tempMod|(1<<.@i); //has own value now set getd(".mapMod_"+.@temp$+"_"+.@mainID+"_"+.@mapID),getd(".mainMod_"+.@temp$+"_"+.@mainID); } else if(.@typeMod&(1<<.@i)) { //else try to find one at type set .@tempMod,.@tempMod|(1<<.@i); set getd(".mapMod_"+.@temp$+"_"+.@mainID+"_"+.@mapID),getd(".typeMod_"+.@temp$); } } else { //cascading main if(.@typeMod&(1<<.@i)) { set .@tempMod,.@tempMod|(1<<.@i); // has own value now set getd(".mainMod_"+.@temp$+"_"+.@mainID),getd(".typeMod_"+.@temp$); //getting own value } } } freeloop(0); set getd(".typeMod_"+.@typeID),.@typeMod; if(.@mapID) { set getd(".mainMod_"+.@typeID+"_"+.@mainID),.@mainMod; } return .@tempMod; } function modifierCheck { set .@menuType,getarg(0); set .@checkType,getarg(1); set .@showErr,getarg(2); // 1 = show errors ==> check ALL; 2 = favourites; 4 = lastwarps set .@typeID,getarg(3); set .@mainID,getarg(4,0); set .@mapID,getarg(5,0); freeloop(1); switch(getarg(0)) { case 2: set .@postID$,"_"+.@mapID; set .@postUpperID$,"_"+.@mainID; case 1: set .@postID$,"_"+.@mainID+""+.@postID$; set .@postUpperID$,"_"+.@typeID+""+.@postUpperID$; case 0: set .@postID$,"_"+.@typeID+""+.@postID$; } switch(getarg(0)) { case 0: set .@str$,"type"; break; case 1: set .@str$,"main"; set .@strUpper$,"type"; break; case 2: set .@str$,"map"; set .@strUpper$,"main"; break; } set .@mod,getd("."+.@str$+"Mod"+.@postID$); set .@error,0; for( set .@i,0; (1<<(.@i*2)) <= .@checkType; set .@i, .@i+1 ) { set .@temp1,1<<(.@i*2); if(!(.@temp1&.@checkType)) continue; // is not going to be checked if(!(.@temp1&.@mod)) continue; //hasn't got any own value to check set .@temp2,.@temp1<<1; if(.@temp2&.@mod) continue; // downlink, because there is a lower permission in a submenu set .@temp3,.@temp1|.@temp2; if(.@temp1 == .modifier_gm) set .@playerVal,getgmlevel(); else if(.@temp1 == .modifier_woe) set .@playerVal,setSave(".@temp",0,0,.@typeID,.@mainID,.@mapID); else if(.@temp1 == .modifier_class) set .@playerVal,eaj2base(BaseJob); else if(.@temp1 == .modifier_upper) set .@playerVal,1< Job_Soul_Linker) return 1<<.@temp; switch(.@temp) { case Job_SuperNovice: return 1<<0; case Job_Dancer: return 1<<19; case Job_Soul_Linker: return 1<<23; default: return 1<<(.@temp-4025); } } function isVisited { set .@typeID,getarg(0); set .@mainID,getarg(1); set .@pre$,(getarg(2))?"#":""; set .@write,getarg(3); set .@page,(.@mainID-1)/32; set .@bit,1 << ((.@mainID-1)%32); set .@temp,getd(.@pre$+"dw_questwarp_"+.@typeID+"_"+.@page); if(.@temp&.@bit) { //if visited return 1; } if(.@write) { set getd(.@pre$+"dw_questwarp_"+.@typeID+"_"+.@page),.@temp|.@bit; announce sprintf(.t_visit$,getd(".mainName_"+.@typeID+"_"+.@mainID+"$")),bc_self,"0x00BFFF"; return 2; //map is now visited } return 0; //map not visited } //===================================================================================== //= Compressing and Decompressing Data //===================================================================================== // storeCharData("favourites/lastwarps") function storeCharData { set .@type$,getarg(0); set .@pos,(.@type$ == "lastwarps")?1:0; //lastwarp,else favourites set .@amo,getSave(dw_infoSave,5,.@pos); set .@temp_str$,""; for( set .@i,0; .@i < .@amo; set .@i,.@i+2 ) { set .@temp_str$,.@temp_str$+int2string(getd("@dw_"+.@type$+"_"+(.@i/2))); } set getd("dw_"+.@type$+"$"),.@temp_str$; return; } function loadCharData { set .@type$,getarg(0); set .@pos,(.@type$ == "lastwarps")?1:0; //lastwarp,else favourites set .@amo,getSave(dw_infoSave,5,.@pos); set .@temp_str$, getd("dw_"+.@type$+"$"); for( set .@i,0; .@i < .@amo; set .@i,.@i+2 ) { set getd("@dw_"+.@type$+"_"+(.@i/2)),string2int(substr(.@temp_str$,.@i*3,.@i*3+5)); } return; } // int2string(int); returns a string with length 6. function int2string { set .@int, getarg(0); set .@str$,.char$[.@int&3]; set .@int,.@int >> 2; for( set .@i, 0; .@i < 5; set .@i,.@i+1 ) { set .@str$,.char$[.@int&0x3F]+.@str$; set .@int, .@int >> 6; } return .@str$; } function string2int { //string2int("abcde"); set .@str$, getarg(0); for( set .@i,0; .@i < 5; set .@i,.@i+1 ) { set .@tempInt,(.@tempInt << 6) + char2id(charat(.@str$,.@i)); } return (.@tempInt << 2) + char2id(charat(.@str$,5)); } function char2id { // log[2](64) = 6 set .@chr$,getarg(0); set .@left,0; set .@right,63; set .@mid,31; //binary search for( set .@i,0; .@i < 6; set .@i,.@i+1 ) { if(.@chr$ >= .char$[.@mid]) { set .@left,.@mid; } else { set .@right,.@mid; } set .@mid,(.@left+.@right)/2; } return .@mid; } OnPCLoginEvent: loadCharData("lastwarps"); loadCharData("favourites"); end; OnPCLoadMapEvent: getmapxy .@map$,.@x,.@y,0; set .@mapinf,getd("$@dw_maps_"+.@map$+"$"); set .@quest,getsave(.@mapinf,2,1); if(.@quest&1) { //when questwarp activated isVisited(getSave(.@mapinf,0,1),getSave(.@mapinf,1,1),.@quest&2,1); } end; OnPartyWarp: for( set .@i,0; .@i < getarraysize($@dw_partypipe); set .@i, .@i+1 ) { if( $@dw_partypipe[.@i] && $@dw_partypipe_check[.@i]) { set $@dw_partypipe_check[.@i],0; set .@aID,$@dw_partypipe[.@i]; set $@dw_partypipe[.@i],0; break; } } attachrid(.@aID); showdigit 15,3; instance_attach(instance_id(1)); for(set .@i,0; .@i < getarraysize('warpID); set .@i,.@i+1) { if('warpID[.@i] == .@aID) { set .@num,.@i; break; } } mes .name$; mes sprintf(.t_warpwith$,'warpDest$,rid2name(getpartyleader(getcharid(1),1))); if('price) { mes sprintf(.t_cost$,'price); } if(.@priceItem) { mes .t_itemstart$; for(set .@i,0; .@i < getarraysize(.priceItems) && (1<<(.@i/2)) <= getarg(2); set .@i,.@i+2) { if(getarg(2)&(1<<(.@i/2))) { mes sprintf(.t_cost_item$,.priceItems[.@i+1],getitemname(.priceItems[.@i])); } } } next; if(prompt(.m_yes$,.m_no$) > 1) { if(instance_id(1)) { set 'warpCheck[.@num],3; } showdigit 0,3; close; } mes .name$; if(instance_id(1)) { showdigit 0,3; set 'warpCheck[.@num],1; mes .t_waitinst$; } else { mes .t_timeout$; } close; }