// TMW-2 Script // Author: // Jesusalva // Description: // Vault Utilities function script getvaultid { // FIXME: Make this False if (debug || !debug) return ##VAULT; else return 0; } function script getvaultexp { .@exp=getarg(0); if (.@exp > 100) Exception("ILLEGAL VAULT EXPERIENCE, FIXME URGENTLY. STOPPING SCRIPT BY FORCE WHILE DOING NOTHING.", RB_DEBUGMES | RB_IRCBROADCAST | RB_GLOBALANNOUNCE | RB_ISFATAL); if (getvaultid()) { ##VAULT_EXP+=.@exp; debugmes("Granting %d Soul Exp to %d under Jande's authority.", .@exp, ##VAULT); } return; } function script vaultOnLogin { // Mirror Lake functionality if (getvaultid() && !getstatus(SC_JAILED)) { .@gto=get_byte(##00_INFO, 3); .@mlp=get_nibble(##00_INFO, 5); // Work only on new chars, or chars which cleared Tulimshar. if (.@gto == WORLD_ID) { // Warp to the proper Mirror Lake switch (.@mlp) { //case 1: somewhere default: warp "013-2", 37, 23; LOCATION$ = "Hurns"; break; } // Send debug information debugmes("Vault User %d moved to lake %d.", getvaultid(), .@mlp); // Handle new user (non-native) accounts - automatic tutorial skip if (QL_BEGIN < 8) { if (!TUT_var) { callfunc "GameRules"; next; closeclientdialog; adddefaultskills(); getitem Knife, 1; getitem SlingShot, 1; getitem SlingBullet, 500; getitem HitchhikersTowel, 1; getitem CottonShirt, 1; getitem RaggedShorts, 1; set Zeny, Zeny + 35; // tanisha gives 5 Zeny equip(CottonShirt); equip(RaggedShorts); equip(Knife); } QL_BEGIN = 8; dispbottom l("Mirror Lake : Obtain help with Sorfina in Candor."); } // Unset the target lake/world set_byte(##00_INFO, 3, 0); set_nibble(##00_INFO, 5, 0); } else if (.@gto) { // Heading somewhere which is not here! mesc l("WARNING: If you use any Mirror Lake feature on this world, the current Mirror Lake Quest will be marked as \"Failed\"."), 1; mesc l("If this is undesired, select the correct world, and if needed create a new char on it."), 1; ##VAULT_GOTO=.@gto; ##VAULT_MLTO=.@mlp; next; closeclientdialog; } } return; } function script vaultOnLogout { // Send updates to Vault API if (getvaultid()) { .@api$=json_encode("UID", ##VAULT, "GID", getcharid(3), "VAR1N", "TMWQUEST", "VAR1V", ##01_TMWQUEST, "VAR2N", "TMWGLOBAL", "VAR2V", ##01_TMWGLOBAL, "VEXP", ##VAULT_EXP, "GOTO", ##VAULT_GOTO, "MLTO", ##VAULT_MLTO); ##VAULT_EXP=0; ##VAULT_GOTO=0; ##VAULT_MLTO=0; api_send(API_FLUSHVAULT, .@api$); } return; } // MirrorLakeSendTo(World, Lake) function script MirrorLakeSendTo { .@w=getarg(0); .@t=getarg(1); ##VAULT_GOTO=.@w; ##VAULT_MLTO=.@t; closeclientdialog; dispbottom l("Darkness fills your vision..."); sleep2(1000); kick(getcharid(3), 7); // 7 is not a valid kick reason end; }