//===== eAthena Script ======================================= //= Class Mastery System //===== By: ================================================== //= Euphy //===== Current Version: ===================================== //= 1.2 //===== Description: ========================================= //= An advanced job & build switcher. //== Classes either become available as they are mastered, //== or when purchased from an NPC. //============================================================ /* > item_db2.txt: 3333,Class_Manual,Class Manual,11,0,,0,,,,,0xFFFFFFFF,7,2,,,,,,{ callfunc "Class_Mastery"; },{},{} > item_trade.txt: 3333,123,100 > idnum2itemdisplaynametable.txt: 3333#Class_Manual# > idnum2itemresnametable.txt: 3333#∏∂π˝√•_π´# > idnum2itemdesctable.txt: 3333# ^0055FFAncient secrets lie within...^000000 ^ffffff_^000000 Weight :^777777 0^000000 # */ prontera,148,203,4 script Class Mastery::CMSys 405,{ set .@n$,"[Class Mastery]"; mes .@n$; mes "How may I assist you?"; next; switch(select(" ~ Purchase a manual: ~ Purchase classes: ~ ^777777Close^000000")) { case 1: mes .@n$; if (!.Mode[3]) { mes "It seems like we're out of stock"; mes "at the moment. My apologies."; close; } if (countitem(.ManualID)) { mes "We only allow one manual per character. Orders, orders..."; close; } mes "Manuals cost ^FF0000"+.Mode[3]+" Zeny^000000."; mes "Would you like one?"; next; switch(select(" ~ Sure!: ~ I'll think about it.")) { case 1: mes .@n$; if (Zeny < .Mode[3]) { mes "You don't appear to have"; mes "enough Zeny... These are very"; mes "valuable books, you know?"; close; } set Zeny, Zeny-.Mode[3]; getitem .ManualID,1; specialeffect2 441; mes "Enjoy!"; close; case 2: mes .@n$; mes "Okay. Take your time."; close; } case 2: mes .@n$; if (!.Mode[4]) { mes "No classes are available for"; mes "purchase. You'll have to earn"; mes "them manually, I suppose..."; close; } if (!countitem(.ManualID)) { mes "You'll need a manual first!"; close; } mes "Entries cost ^FF0000"+.Mode[4]+" Zeny^000000 each."; if (Zeny < .Mode[4]) { mes "Go earn some more!"; close; } set .@menu$,""; for(set .@i,1; .@i Quick Change: > Set Quick Change Options: > Switch Classes: > Manage Builds: > ^777777Close^000000")) { case 1: message strcharinfo(0),"Quick Change:"; set .@index, Get_Menu(1,getvariableofnpc(.BuildCount,"CMSys")); if (.@index == getvariableofnpc(.BuildCount,"CMSys")+1) break; if (!@QC1[.@index] && (!@QC2[.@index] || BaseLevel < getvariableofnpc(.MaxLevel,"CMSys"))) { message strcharinfo(0),"Class change failed."; close; } if (@QC1[.@index]) Class_Change(@QC1[.@index]); if (@QC2[.@index]) { if (BaseLevel < getvariableofnpc(.MaxLevel,"CMSys")) message strcharinfo(0),"Level requirement not met for build change."; else Load_Build(getd("Build_"+@QC2[.@index]+"$")); } close; case 2: setarray .@ar$[0],"*","a","b","c","d","e","f","g","h","i","j","k","l","m","n","o","p","q","r","s","t","u","v","w","x","y","z"; while(1) { message strcharinfo(0),"Set Quick Change Options:"; set .@index, Get_Menu(1,getvariableofnpc(.BuildCount,"CMSys")); if (.@index == getvariableofnpc(.BuildCount,"CMSys")+1) break; message strcharinfo(0),"Set Quick Change Options > Slot "+.@index+":"; switch(select(" > Edit job ("+((@QC1[.@index])?"^0055FF"+jobname(getvariableofnpc(.JobList[@QC1[.@index]],"CMSys")):"^777777none")+"^000000): > Edit build ("+((@QC2[.@index])?"^0055FF"+@QC2[.@index]:"^777777none")+"^000000): > ^777777Back^000000")) { case 1: message strcharinfo(0),"Set Quick Change Options > Slot "+.@index+" > Edit job:"; set .@i, Get_Menu(2,getarraysize(getvariableofnpc(.JobList,"CMSys"))); if (.@i == getarraysize(getvariableofnpc(.JobList,"CMSys"))) break; set @QC1[.@index], .@i; set QC1$,"_"; for(set .@i,1; .@i<=getvariableofnpc(.BuildCount,"CMSys"); set .@i,.@i+1) set QC1$, QC1$+.@ar$[@QC1[.@i]]; message strcharinfo(0),"Changes saved."; sleep2 250; break; case 2: message strcharinfo(0),"Set Quick Change Options > Slot "+.@index+" > Edit build:"; if (BaseLevel < getvariableofnpc(.MaxLevel,"CMSys")) { message strcharinfo(0),"You must be level "+getvariableofnpc(.MaxLevel,"CMSys")+" to use this."; sleep2 250; break; } set .@build, Get_Menu(3,getvariableofnpc(.BuildCount,"CMSys"),1); if (.@build == getvariableofnpc(.BuildCount,"CMSys")+2) break; if (getd("Build_"+.@build+"$")=="" && .@build != getvariableofnpc(.BuildCount,"CMSys")+1) { message strcharinfo(0),"No build info found."; sleep2 250; break; } else set @QC2[.@index], (((.@build == getvariableofnpc(.BuildCount,"CMSys")+1))?0:.@build); set QC2$,"_"; for(set .@i,1; .@i<=getvariableofnpc(.BuildCount,"CMSys"); set .@i,.@i+1) set QC2$, QC2$+.@ar$[@QC2[.@i]]; message strcharinfo(0),"Changes saved."; sleep2 250; break; case 3: break; } sleep2 250; } break; case 3: message strcharinfo(0),"Switch Classes:"; set .@i, Get_Menu(2,getarraysize(getvariableofnpc(.JobList,"CMSys"))); if (.@i == getarraysize(getvariableofnpc(.JobList,"CMSys"))) break; if (Class == getvariableofnpc(.JobList[.@i],"CMSys")) { message strcharinfo(0),"Class change failed."; close; } message strcharinfo(0),"Select '"+jobname(getvariableofnpc(.JobList[.@i],"CMSys"))+"'?"; if (select("Yes:No") == 2) break; Class_Change(.@i); close; case 4: if (BaseLevel < getvariableofnpc(.MaxLevel,"CMSys")) { message strcharinfo(0),"You must be level "+getvariableofnpc(.MaxLevel,"CMSys")+" to use this."; sleep2 250; break; } while(1) { message strcharinfo(0),"Build Manager:"; switch(select(" > Save Build...: > Load Build...: > Rename Build...: > ^777777Back^000000")) { case 1: message strcharinfo(0),"Build Manager > Save Build:"; set .@build, Get_Menu(3,getvariableofnpc(.BuildCount,"CMSys")); if (.@build == getvariableofnpc(.BuildCount,"CMSys")+1) break; if (getd("Build_"+.@build+"$")!="") { message strcharinfo(0),"Overwrite previous build #"+.@build+"?"; if(select("Save new build:Cancel")==2) break; } Save_Build(.@build); message strcharinfo(0),"Type a name for your build."; input getd("Build_"+.@build+"n$"); message strcharinfo(0),"Build #"+.@build+" ("+getd("Build_"+.@build+"n$")+") saved."; sleep2 250; break; case 2: message strcharinfo(0),"Build Manager > Load Build:"; set .@build, Get_Menu(3,getvariableofnpc(.BuildCount,"CMSys")); if (.@build == getvariableofnpc(.BuildCount,"CMSys")+1) break; if (getd("Build_"+.@build+"$")=="") { message strcharinfo(0),"No build info found."; sleep2 250; break; } Load_Build(getd("Build_"+.@build+"$")); message strcharinfo(0),"Build #"+.@build+" loaded."; sleep2 250; break; case 3: message strcharinfo(0),"Build Manager > Rename Build:"; set .@build, Get_Menu(3,getvariableofnpc(.BuildCount,"CMSys")); if (.@build == getvariableofnpc(.BuildCount,"CMSys")+1) break; if (getd("Build_"+.@build+"$")=="") { message strcharinfo(0),"No build info found."; sleep2 250; break; } message strcharinfo(0),"Type a new name for Build #"+.@build+" ("+getd("Build_"+.@build+"n$")+")."; input getd("Build_"+.@build+"n$"); message strcharinfo(0),"Build #"+.@build+" renamed."; sleep2 250; break; case 4: set .@j,1; break; } if (.@j) { set .@j,0; break; } sleep2 250; } break; case 5: close; } sleep2 250; } function Class_Change { specialeffect2 348; if (getvariableofnpc(.Interrupt,"CMSys")) { message strcharinfo(0),"Casting..."; initnpctimer "CMSys",1; progressbar "", getvariableofnpc(.CastTime,"CMSys"); } else for(set .@i,0; .@i "+((@QC1[.@i])?"^0055FF"+jobname(getvariableofnpc(.JobList[@QC1[.@i]],"CMSys")):"^777777no job")+"^000000 / build "+((@QC2[.@i])?"^0055FF"+@QC2[.@i]:"^777777empty")+"^000000:"; set .@menu$, .@menu$+" > ^777777Back^000000"; break; case 2: for(set .@i,1; .@i "+jobname(getvariableofnpc(.JobList[.@i],"CMSys")); set .@menu$, .@menu$+":"; } set .@menu$, .@menu$+" > ^777777Back^000000"; break; case 3: for(set .@i,1; .@i<=getarg(1); set .@i,.@i+1) set .@menu$, .@menu$+" > Slot "+.@i+" ("+((getd("Build_"+.@i+"n$")=="")?"^777777empty":"^0055FF"+getd("Build_"+.@i+"n$"))+"^000000):"; if (getarg(2,0)) set .@menu$, .@menu$+" > No build:"; set .@menu$, .@menu$+" > ^777777Back^000000"; break; } return select(.@menu$); } function Save_Build { setarray .@ar$[0],"a","b","c","d","e","f","g"; set .@s$,""; for(set .@i,0; .@i<7; set .@i,.@i+1) set .@s$,.@s$+.@ar$[.@i]+((.@i==6)?StatusPoint:readparam(.@i+13))+"|"; setd "Build_"+getarg(0)+"$", .@s$; return; } function Load_Build { setarray .@num$[0],"0","1","2","3","4","5","6","7","8","9"; setarray .@ar$[0],"a","b","c","d","e","f","g"; ResetStatus; for(set .@j,13; .@j<20; set .@j,.@j+1) { set .@var$,""; set .@s$,.@ar$[.@j-13]; while(1) { for(set .@i,0; .@i<10; set .@i,.@i+1) { if (compare(getarg(0),.@s$+.@num$[.@i])) { set .@var$,.@var$+.@num$[.@i]; set .@s$,.@s$+.@num$[.@i]; break; } } if (compare(getarg(0),.@s$+"|")) break; } if (.@j==19) set StatusPoint, atoi(.@var$); else statusup2 .@j, atoi(.@var$)-1; } return; } }