diff options
author | j-tkay <j-tkay@54d463be-8e91-2dee-dedb-b68131a5f0ec> | 2012-08-08 15:17:41 +0000 |
---|---|---|
committer | j-tkay <j-tkay@54d463be-8e91-2dee-dedb-b68131a5f0ec> | 2012-08-08 15:17:41 +0000 |
commit | 9ded688e9e43a57cf4ea7d66e5ff42be45af2c84 (patch) | |
tree | df62593a05551988bf72534cacc0d7f56d7ff361 /npc/kafras | |
parent | 89624356dcf2f846fe66e5d05d3c5d63a88cca37 (diff) | |
download | hercules-9ded688e9e43a57cf4ea7d66e5ff42be45af2c84.tar.gz hercules-9ded688e9e43a57cf4ea7d66e5ff42be45af2c84.tar.bz2 hercules-9ded688e9e43a57cf4ea7d66e5ff42be45af2c84.tar.xz hercules-9ded688e9e43a57cf4ea7d66e5ff42be45af2c84.zip |
- Optimized kafras/functions_kafras.txt.
git-svn-id: https://rathena.svn.sourceforge.net/svnroot/rathena/trunk@16609 54d463be-8e91-2dee-dedb-b68131a5f0ec
Diffstat (limited to 'npc/kafras')
-rw-r--r-- | npc/kafras/functions_kafras.txt | 550 |
1 files changed, 223 insertions, 327 deletions
diff --git a/npc/kafras/functions_kafras.txt b/npc/kafras/functions_kafras.txt index f57c9c371..aab5325ff 100644 --- a/npc/kafras/functions_kafras.txt +++ b/npc/kafras/functions_kafras.txt @@ -5,9 +5,9 @@ //= Darlskies, Darkchild, Syrus22, Lupus, kobra_k88 (2.0) //= L0ne_W0lf //===== Current Version: ===================================== -//= 6.4 +//= 6.5 //===== Compatible With: ===================================== -//= rAthena 1.0 +//= rAthena SVN //===== Description: ========================================= //= These functions handle save, storage, cart rental, teleport, //= and Free Teleport/Warp/Rent Cart options for all Kafra NPCs. @@ -59,10 +59,10 @@ //= 6.2 Updated/Fixed warp cords. [Kisuka] //= 6.3 #kafra_code is now stored as is. [brianluau] //= 6.4 Removed unofficial Guide function. [Daegaladh] +//= 6.5 Optimized. [Joseph] //============================================================ - -// Main Function =========================================================== +//=== Main Function ======================================================== //= arg(0): Used to determine which welcome message to show. //= arg(1): Used to determine which menu to display. //= arg(2): Used to determine if the info menu is shown in F_KafInfo. @@ -70,13 +70,12 @@ //= arg(4): Cost to Rent a Pushcart //========================================================================== function script F_Kafra { - callfunc "F_ClearGarbage"; //Clear outdated, unused variables - - //Display Kafra Welcome Message + callfunc "F_ClearGarbage"; // Clear outdated, unused variables + // Display Kafra Welcome Message switch(getarg(0)){ - //Default message (obsolete) default: case 0: + // Default message (obsolete) mes "[Kafra Employee]"; mes "Welcome to the"; mes "Kafra Corporation."; @@ -84,135 +83,82 @@ function script F_Kafra { mes "are always on your side."; mes "How may I assist you?"; break; - - //Niflheim specific message case 1: + // Niflheim specific message mes "[Kafra Employee]"; mes "^666666W-weeeelc-c-come"; mes "to th-the K-kaaafrrrra"; mes "C-coorpoor-r-ratioooonn...^000000"; break; - - //Guild Castle Kafra message case 2: + // Guild Castle Kafra message set @GID,getcharid(2); mes "[Kafra Employee]"; mes "Welcome. ^ff0000" + GetGuildName(@GID) + "^000000 Member."; mes "The Kafra Coporation will stay with you wherever you go."; break; - - //Amatsu specific message (obsolete) case 3: + // Amatsu specific message (obsolete) mes "[Kafra Employee]"; mes "So, have you come from a faraway land to study our culture, or are you just sightseeing?"; mes "In either case, why not stay awhile?"; mes "The air is eternally heavy with the"; mes "scent of pleasant wildflowers."; - break; - - //Louyang and Ayothaya specific message (obsolete) + break; case 4: + // Louyang and Ayothaya specific message (obsolete) mes "[Kafra Employee]"; mes "With our many Kafra"; mes "service locations, you're never"; mes "far from home."; - break; - - //NPC has it's own welcome message. (Display nothing) - case 5: - break; - } - next; - - M_Menu: - cleararray @K_Menu0$[0],"",7; - switch(getarg(1)){ - // Save and Storage only - case 1: - setarray @K_Menu0$[0],"Save","Use Storage","Cancel"; - break; - - // Storage only - case 2: - setarray @K_Menu0$[0],"Use Storage","Cancel"; - break; - - // No Teleport (Common) - case 3: - setarray @K_Menu0$[0],"Save","Use Storage","Rent a Pushcart","Check Other Information","Cancel"; - break; - - // Case 4 is Einbroch no tele message. - - // No save, or teleport. (Common) + break; case 5: - setarray @K_Menu0$[0],"Use Storage","Rent a Pushcart","Check Other Information","Cancel"; - break; - - // Storage and Check Other Information only. - case 6: - setarray @K_Menu0$[0],"Use Storage","Check Other Information","Cancel"; + // NPC has it's own welcome message. (Display nothing) break; - - // Save, Storage, and Pushcart only (Kafra Warehouse) - case 7: - setarray @K_Menu0$[0],"Save","Use Storage","Rent a Pushcart","Cancel"; - break; - - // Save, Storage, Other Check information. (Turbo track) - case 8: - setarray @K_Menu0$[0],"Save","Use Storage","Check Other Information","Cancel"; - break; - - // Common Kafra Employee - default: - setarray @K_Menu0$[0],"Save","Use Storage","Use Teleport Service","Rent a Pushcart","Check Other Information","Cancel"; - break; - } - - // Guild Kafra Menu override (free Teleport, free Storage, Free Cart) - if(getarg(0)==2) { - cleararray @K_Menu0$[0],"",7; - setarray @K_Menu0$[0],"Use Storage","Use Guild Storage","Rent a Pushcart","Use Teleport Service","Cancel"; } - menu @K_Menu0$[0],K_Menu0,@K_Menu0$[1],K_Menu1,@K_Menu0$[2],K_Menu2, - @K_Menu0$[3],K_Menu3,@K_Menu0$[4],K_Menu4,@K_Menu0$[5],K_Menu5, - @K_Menu0$[6],K_Menu6,@K_Menu0$[7],K_Menu7; - K_Menu0: - set @num,0; - goto K_Menuf; - K_Menu1: - set @num,1; - goto K_Menuf; - K_Menu2: - set @num,2; - goto K_Menuf; - K_Menu3: - set @num,3; - goto K_Menuf; - K_Menu4: - set @num,4; - goto K_Menuf; - K_Menu5: - set @num,5; - goto K_Menuf; - K_Menu6: - set @num,6; - goto K_Menuf; - K_Menu7: - set @num,7; - K_Menuf: - if (@K_Menu0$[@num] == "Save") return; - if (@K_Menu0$[@num] == "Use Storage"){ - // Do not charge for Guild Storage - if(getarg(0) == 2) callfunc "F_KafStor",2,0,0; - else callfunc "F_KafStor",0,getarg(3),getarg(0); - next; - goto M_Menu; + while (1) { + next; + deletearray @K_Menu0$[0],getarraysize(@K_Menu0$); + if (getarg(0) == 2) { + // Guild Kafra Menu override (free Teleport, free Storage, Free Cart) + setarray @K_Menu0$[0],"Use Storage","Use Guild Storage","Rent a Pushcart","Use Teleport Service","Cancel"; + } else { + switch(getarg(1)){ + // Save and Storage only + case 1: setarray @K_Menu0$[0],"Save","Use Storage","Cancel"; break; + // Storage only + case 2: setarray @K_Menu0$[0],"Use Storage","Cancel"; break; + // No Teleport (Common) + case 3: setarray @K_Menu0$[0],"Save","Use Storage","Rent a Pushcart","Check Other Information","Cancel"; break; + // Case 4 is Einbroch no tele message. + // No save, or teleport. (Common) + case 5: setarray @K_Menu0$[0],"Use Storage","Rent a Pushcart","Check Other Information","Cancel"; break; + // Storage and Check Other Information only. + case 6: setarray @K_Menu0$[0],"Use Storage","Check Other Information","Cancel"; break; + // Save, Storage, and Pushcart only (Kafra Warehouse) + case 7: setarray @K_Menu0$[0],"Save","Use Storage","Rent a Pushcart","Cancel"; break; + // Save, Storage, Other Check information. (Turbo track) + case 8: setarray @K_Menu0$[0],"Save","Use Storage","Check Other Information","Cancel"; break; + // Default message (obsolete) + default: setarray @K_Menu0$[0],"Save","Use Storage","Use Teleport Service","Rent a Pushcart","Check Other Information","Cancel"; break; + } } - if (@K_Menu0$[@num] == "Use Teleport Service"){ + set .@menu$,""; + for (set .@i, 0; .@i < getarraysize(@K_Menu0$); set .@i, .@i + 1) + set .@menu$, .@menu$ + @K_Menu0$[.@i] + ":"; + set .@j, select (.@menu$) - 1; + if (@K_Menu0$[.@j] == "Save") { + return; + } else if (@K_Menu0$[.@j] == "Use Storage") { + // Do not charge for Guild Storage + if(getarg(0) == 2) + callfunc "F_KafStor",2,0,0; + else + callfunc "F_KafStor",0,getarg(3),getarg(0); + } else if (@K_Menu0$[.@j] == "Use Teleport Service") { // Display Einbroch "No Teleport Service" notice. - if(getarg(1) == 4){ + if(getarg(1) != 4) callfunc "F_KafTele",getarg(0); + else { mes "[Kafra Employee]"; mes "Because of the ^FF0000Limited"; mes "Transport Agreement^000000, the"; @@ -225,38 +171,26 @@ function script F_Kafra { mes "use the Airship Service"; mes "instead. Thank you for your"; mes "understanding and cooperation."; - next; - goto M_Menu; } - callfunc "F_KafTele",getarg(0); - goto M_Menu; - } - if (@K_Menu0$[@num] == "Rent a Pushcart"){ - if(callfunc("F_KafCart",getarg(0),getarg(4)) == 1) next; - goto M_Menu; - } - if (@K_Menu0$[@num] == "Check Other Information"){ + } else if (@K_Menu0$[.@j] == "Rent a Pushcart") { + if(callfunc("F_KafCart",getarg(0),getarg(4)) == 1) + next; + } else if (@K_Menu0$[.@j] == "Check Other Information") { callfunc "F_KafInfo",getarg(2); - goto M_Menu; - } - if (@K_Menu0$[@num] == "Cancel"){ + } else if (@K_Menu0$[.@j] == "Cancel"){ callfunc "F_KafEnd",getarg(0),0; end; - } - if (@K_Menu0$[@num] == "Use Guild Storage"){ + } else if (@K_Menu0$[.@j] == "Use Guild Storage") { callfunc "F_KafStor",1,0; - next; - goto M_Menu; } - + } } - -// Storage Function ======================================================= +// === Storage Function ============================================================ function script F_KafStor { // Unable to access Guild Storage (Busy) if(getarg(0) == 1){ - if(guildopenstorage() == 1){ + if(guildopenstorage()){ mes "[Kafra Employee]"; mes "I'm sorry but another guild member is using the guild storage"; mes "right now. Please wait until that person is finished."; @@ -267,7 +201,6 @@ function script F_KafStor { cutin "", 255; close; } - // Unable to access Normal Storage (Insufficient Basic Skills) if(basicskillcheck() && getskilllv("NV_BASIC") < 6){ mes "[Kafra Employee]"; @@ -285,7 +218,6 @@ function script F_KafStor { mes "use the Storage Service."; return; } - // Accessing Normal Storage (Skipped if accessing Storage from Guild castle) if(getarg(0) != 2){ // Consume "Free Ticket for Kafra Storage" if available. @@ -302,7 +234,7 @@ function script F_KafStor { mes "Ergh! T-taking bl-blood~!^000000"; return; } - //Standard Message + // Standard Message mes "I'm sorry, but you don't"; mes "have enough zeny to use"; mes "the Storage Service. Our"; @@ -320,11 +252,8 @@ function script F_KafStor { if (getarg(2) == 1) { percentheal 0,-10; mes "[Kafra Employee]"; - mes "^666666Thank you.. for... using..."; - mes "Thank you.. for... using..."; - mes "Thank you.. for... using..."; - mes "Thank you.. for... using..."; - mes "Thank you.. for... using...^000000"; + for (set .@i, 0; .@i < 5; set .@i, .@i + 1) + mes "^666666Thank you.. for... using...^000000"; } // Normal message else { @@ -336,89 +265,65 @@ function script F_KafStor { } } callfunc("F_CheckKafCode"); //check your storage password, if set - close2; openstorage; cutin "", 255; end; } - -// Teleport Function ================================================== +// === Teleport Function ================================================== function script F_KafTele { mes "[Kafra Employee]"; mes "Please choose"; mes "your destination."; next; - - menu @wrpC$[0],M_Wrp0, @wrpC$[1],M_Wrp1, @wrpC$[2],M_Wrp2, @wrpC$[3],M_Wrp3, - @wrpC$[4],M_Wrp4, @wrpC$[5],M_Wrp5, @wrpC$[6],M_Wrp6; - - M_Wrp0: - set @num, 0; - goto L_Warp; - M_Wrp1: - set @num, 1; - goto L_Warp; - M_Wrp2: - set @num, 2; - goto L_Warp; - M_Wrp3: - set @num, 3; - goto L_Warp; - M_Wrp4: - set @num, 4; - goto L_Warp; - M_Wrp5: - set @num, 5; - goto L_Warp; - M_Wrp6: - set @num, 6; - - L_Warp: - if (@wrpC$[@num] == "Cancel") return; - // Consume "Free Ticket for Kafra Transportation" if available. - // Do not consume if in Guild castle - if(countitem(7060) > 0 && getarg(0) != 2) delitem 7060,1; - else { - if (Zeny<@wrpP[@num]){ - mes "[Kafra Employee]"; - mes "I'm sorry, but you don't have"; - mes "enough zeny for the Teleport"; - mes "Service. The fee to teleport"; - mes "to "+@wrpD$[@num]+" is "+@wrpP[@num]+" zeny."; - close2; - cutin "", 255; - end; - } - set Zeny, Zeny-@wrpP[@num]; - set RESRVPTS, RESRVPTS + (@wrpP[@num]/16); - } - if (@wrpD$[@num] == "Alberta") warp "alberta", 117, 56; - if (@wrpD$[@num] == "Al De Baran") warp "aldebaran",168,112; - if (@wrpD$[@num] == "Aldebaran") warp "aldebaran",168,112; - if (@wrpD$[@num] == "Comodo") warp "comodo", 209, 143; - if (@wrpD$[@num] == "Izlude") { - if(checkre(0)) - warp "izlude", 128, 98; - else - warp "izlude", 91, 105; + set .@menu$, ""; + for (set .@i, 0; .@i <= 6; set .@i, .@i + 1) + set .@menu$, .@menu$ + @wrpC$[.@i] + ":"; + set .@j, select (.@menu$) - 1; + if (@wrpC$[.@j] == "Cancel") return; + // Consume "Free Ticket for Kafra Transportation" if available. + // Do not consume if in Guild castle + if(countitem(7060) > 0 && getarg(0) != 2) delitem 7060,1; + else { + if (Zeny<@wrpP[.@j]){ + mes "[Kafra Employee]"; + mes "I'm sorry, but you don't have"; + mes "enough zeny for the Teleport"; + mes "Service. The fee to teleport"; + mes "to "+@wrpD$[.@j]+" is "+@wrpP[.@j]+" zeny."; + close2; + cutin "", 255; + end; } - if (@wrpD$[@num] == "Geffen") warp "geffen", 120, 39; - if (@wrpD$[@num] == "Morroc") warp "morocc", 156, 46; - if (@wrpD$[@num] == "Payon") warp "payon", 161, 58; - if (@wrpD$[@num] == "Prontera") warp "prontera", 116, 72; - if (@wrpD$[@num] == "Mjolnir Dead Pit") warp "mjolnir_02", 99, 351; - if (@wrpD$[@num] == "Comodo Pharos Beacon") warp "cmd_fild07", 127, 134; - if (@wrpD$[@num] == "Orc Dungeon") warp "gef_fild10", 52, 326; - if (@wrpD$[@num] == "Umbala") warp "umbala", 100, 154; - if (@wrpD$[@num] == "Juno") warp "yuno", 158, 125; - cutin "", 255; - end; + set Zeny, Zeny - @wrpP[.@j]; + set RESRVPTS, RESRVPTS + (@wrpP[.@j]/16); + } + if (@wrpD$[.@j] == "Alberta") warp "alberta", 117, 56; + if (@wrpD$[.@j] == "Al De Baran") warp "aldebaran",168,112; + if (@wrpD$[.@j] == "Aldebaran") warp "aldebaran",168,112; + if (@wrpD$[.@j] == "Comodo") warp "comodo", 209, 143; + if (@wrpD$[.@j] == "Izlude") { + if (checkre(0)) + warp "izlude", 128, 98; + else + warp "izlude", 91, 105; + } + if (@wrpD$[.@j] == "Geffen") warp "geffen", 120, 39; + if (@wrpD$[.@j] == "Morroc") warp "morocc", 156, 46; + if (@wrpD$[.@j] == "Payon") warp "payon", 161, 58; + if (@wrpD$[.@j] == "Prontera") warp "prontera", 116, 72; + if (@wrpD$[.@j] == "Mjolnir Dead Pit") warp "mjolnir_02", 99, 351; + if (@wrpD$[.@j] == "Comodo Pharos Beacon") warp "cmd_fild07", 127, 134; + if (@wrpD$[.@j] == "Orc Dungeon") warp "gef_fild10", 52, 326; + if (@wrpD$[.@j] == "Umbala") warp "umbala", 100, 154; + if (@wrpD$[.@j] == "Juno") warp "yuno", 158, 125; + cutin "", 255; + end; } -// Cart Function ======================================================== +// === Cart Function ======================================================== function script F_KafCart { // Ensure that the class wanting to rent a pushcart is a merchant if(baseClass != Job_Merchant){ @@ -440,7 +345,6 @@ function script F_KafCart { mes "each customer at a time."; return 1; } - // Consume "Free Ticket for the Cart Service" if available. // Do not consume if in Guild castle. if(countitem(7061) > 0 && getarg(0) != 2) delitem 7061,1; @@ -450,7 +354,7 @@ function script F_KafCart { mes "fee is "+getarg(1)+" zeny. Would"; mes "you like to rent a Pushcart?"; next; - menu "Rent a Pushcart.",-, "Cancel.",M_End; + if (select("Rent a Pushcart.:Cancel") == 2) return 0; if(Zeny<getarg(1)){ mes "[Kafra Employee]"; mes "I'm sorry, but you"; @@ -464,93 +368,77 @@ function script F_KafCart { } setcart; return 1; - -M_End: - return 0; } -// Special Reserve Points Function =========================================== +// === Special Reserve Points Function ================================================================================= function script F_KafInfo { - - sM_Menu: -//Uncomment next line to block Kafra Storage Protection -// if(getarg(0) == 0) menu "Check Special Reserve Points.",sM_ResChk, "Kafra Employee Locations",sM_KafLoc, "Cancel",sM_End; - if(getarg(0) == 0) menu "Check Special Reserve Points.",sM_ResChk, "Storage Password Service",sM_KafCode, "Kafra Employee Locations",sM_KafLoc, "Cancel",sM_End; - - sM_ResChk: - mes "[Kafra Employee]"; - mes "Let's see..."; - mes strcharinfo(0) + "..."; - mes "Ah, you have a total of"; - mes RESRVPTS+ " Special Reserve Points."; - next; - mes "[Kafra Employee]"; - mes "You can exchange your"; - mes "Special Reserve Points for"; - mes "rewards at the Kafra Main Office in Al De Baran. Please use our"; - mes "convenient services to see the benefits of our rewards program."; - next; - if(getarg(0) == 1) return; - goto sM_Menu; - - sM_KafLoc: - viewpoint 1,@viewpX[0],@viewpY[0],1,0xFF00FF; - viewpoint 1,@viewpX[1],@viewpY[1],2,0xFF00FF; - viewpoint 1,@viewpX[2],@viewpY[2],3,0xFF00FF; - viewpoint 1,@viewpX[3],@viewpY[3],4,0xFF00FF; - next; - viewpoint 2,@viewpX[0],@viewpY[0],1,0xFF00FF; - viewpoint 2,@viewpX[1],@viewpY[1],2,0xFF00FF; - viewpoint 2,@viewpX[2],@viewpY[2],3,0xFF00FF; - viewpoint 2,@viewpX[3],@viewpY[3],4,0xFF00FF; - goto sM_Menu; - - sM_KafCode: - callfunc("F_SetKafCode","[Kafra Employee]","Kafra Services"); - - sM_End: - return; + // Uncomment next line to block Kafra Storage Protection + // set .@block, 1; + setarray .@m$, "Check Special Reserve Points.","Storage Password Service","Kafra Employee Locations","Cancel"; + if (.@block) deletearray .@m$[1],1; + while (1) { + set .@j, select(implode(.@m$,":")) - 1; + if (.@m$[.@j] == "Check Special Reserve Points.") { + mes "[Kafra Employee]"; + mes "Let's see..."; + mes strcharinfo(0) + "..."; + mes "Ah, you have a total of"; + mes RESRVPTS+ " Special Reserve Points."; + next; + mes "[Kafra Employee]"; + mes "You can exchange your"; + mes "Special Reserve Points for"; + mes "rewards at the Kafra Main Office in Al De Baran. Please use our"; + mes "convenient services to see the benefits of our rewards program."; + next; + if(getarg(0) == 1) return; + } else if (.@m$[.@j] == "Kafra Employee Locations") { + for (set .@i, 0; .@i <= 3; set .@i, .@i + 1) + viewpoint 1,@viewpX[.@i],@viewpY[.@i],(.@i+1),0xFF00FF; + next; + for (set .@i, 0; .@i <= 3; set .@i, .@i + 1) + viewpoint 2,@viewpX[.@i],@viewpY[.@i],(.@i+1),0xFF00FF; + } else if (.@m$[.@j] == "Storage Password Service") { + callfunc("F_SetKafCode","[Kafra Employee]","Kafra Services"); + } else { + return; + } + } } - -// End Function ===================================================== +// === End Function ================================================== // arg(0): used to determine what message to display. // arg(1): used to determine if save message is displayed. // arg(2): used to display the name of the area you're saving in. //=================================================================== function script F_KafEnd { mes "[Kafra Employee]"; - //Save - if(getarg(1)==1) { + if(getarg(1)==1) { + // Save mes "Your Respawn Point"; mes "has been saved here"; mes getarg(2)+"."; mes "Thank you for using"; mes "the Kafra Services."; - } - - // Generic End - else if(getarg(0)==0 || getarg(0)==5) { + } else if(getarg(0)==0 || getarg(0)==5) { + // Generic End mes "We, here at Kafra Corporation,"; mes "are always endeavoring to provide you with the best services. We hope that we meet your adventuring needs and standards of excellence."; - } - - // Niflheim End - else if(getarg(0)==1) { + } else if(getarg(0)==1) { + // Niflheim End percentheal 0,- 25; mes "^666666Kaffffra n-never"; mes "diiiiiiiiiiiiiies. On..."; mes "On y-yooour siiiiide~^000000"; } - close2; cutin "", 255; end; } -// Check Storage Password Function ==================== +// === Check Storage Password Function === function script F_CheckKafCode { - if(#kafra_code==0) return; + if(!#kafra_code) return; mes "Enter your storage password:"; set @code_,0; input @code_; @@ -565,91 +453,99 @@ function script F_CheckKafCode { return; } -// Set / Change / Clear Storage Password Function ==================== -// getarg(0) = NPC Name, getarg(1) = Company Name +// === Set / Change / Clear Storage Password Function === +// getarg(0): NPC Name +// getarg(1): Company Name +//======================================================= function script F_SetKafCode { mes getarg(0); if(#kafra_code) { mes "Your storage is protected with a password. What would you do now?"; next; - menu "Change old password -> 5000z",-, - "Remove storage password -> 1000z",M_CLEAR, - "Cancel",M_END; + switch (select("Change old password -> 5000z:Remove storage password -> 1000z:Cancel")) { + Case 1: + mes getarg(0); + mes "At first, please enter your ^0000FFold password^000000."; + set @code,callfunc("F_EntKafCode"); + if(!@code || @code != #kafra_code) { + mes "Wrong password. You can't set a new password."; + emotion e_hmm; + break; + } + next; + callsub S_SET,getarg(0),getarg(1); + break; + Case 2: + mes getarg(0); + mes "Please, enter your password before its removal."; + set @code,callfunc("F_EntKafCode"); + if(!@code) { + mes "The password hasn't been removed."; + emotion e_hmm; + break; + } + next; + mes getarg(0); + if(Zeny < 1000) { + mes "You don't have enough zeny."; + emotion e_cash; + break; + } + set Zeny,Zeny-1000; + //set RESRVPTS, RESRVPTS + (1000/50); //hardcoded password doesn't add pts + if(@code == #kafra_code) { + set #kafra_code,0; + mes "You've successfully cleared your storage password."; + mes "Thank you for using "+getarg(1)+"."; + emotion e_thx; + } else { + mes "Wrong password. We won't return your 1000z."; + mes "Please, next time enter correct password."; + emotion e_sry; + } + break; + Case 3: + break; + } } else { - mes ""+getarg(1)+" proudly presents you a new service:"; + mes getarg(1)+" proudly presents you a new service:"; mes "Additional storage protection with a password."; next; - menu "Set new password -> 5000z",M_SET, - "Cancel",M_END; - } - - mes getarg(0); - mes "At first, please enter your ^0000FFold password^000000."; - set @code,callfunc("F_EntKafCode"); - if(@code==0 || @code != #kafra_code) { - mes "Wrong password. You can't set a new password."; - emotion e_hmm; - goto M_END; + switch (select("Set new password -> 5000z:Cancel")) { + Case 1: callsub S_SET,getarg(0),getarg(1); break; + Case 2: break; + } } - next; + close2; + cutin "",255; + end; -M_SET: +S_SET: mes getarg(0); mes "Now enter your ^FF0000new password^000000 to protect your storage from thieves."; set @code,callfunc("F_EntKafCode"); - if(@code==0) { + if(!@code) { mes "The password hasn't been changed."; emotion e_hmm; - goto M_END; + return; } next; mes getarg(0); - if(Zeny < 5000) goto L_ZENY; + if(Zeny < 5000) { + mes "You don't have enough zeny."; + emotion e_cash; + return; + } set Zeny,Zeny-5000; - //set RESRVPTS, RESRVPTS + (5000/50); //hardcoded password doesn't add pts - + // set RESRVPTS, RESRVPTS + (5000/50); //hardcoded password doesn't add pts set #kafra_code,@code; mes "You've protected your storage with a secret password."; mes "Thank you for using "+getarg(1)+"."; emotion e_thx; - goto M_END; - -M_CLEAR: - mes getarg(0); - mes "Please, enter your password before its removal."; - set @code,callfunc("F_EntKafCode"); - if(@code==0) { - mes "The password hasn't been removed."; - emotion e_hmm; - goto M_END; - } - next; - mes getarg(0); - if(Zeny < 1000) goto L_ZENY; - set Zeny,Zeny-1000; - //set RESRVPTS, RESRVPTS + (1000/50); //hardcoded password doesn't add pts - if(@code == #kafra_code) { - set #kafra_code,0; - mes "You've successfully cleared your storage password."; - mes "Thank you for using "+getarg(1)+"."; - emotion e_thx; - } else { - mes "Wrong password. We won't return your 1000z."; - mes "Please, next time enter correct password."; - emotion e_sry; - } - goto M_END; - -L_ZENY: - mes "You don't have enough zeny."; - emotion e_cash; -M_END: - close2; - cutin "",255; - end; + return; } -// Basic Password Validation Function ==================== +// === Basic Password Validation Function ==================== function script F_EntKafCode { mes "Enter a number 1000~10000000:"; set @code_,0; @@ -667,4 +563,4 @@ function script F_EntKafCode { return 0; } return @code_; -} +}
\ No newline at end of file |