Skip to content
Permalink
master
Switch branches/tags
Go to file
 
 
Cannot retrieve contributors at this time
//===== rAthena Script =======================================
//= In-Game Control Panel
//===== By ===================================================
//= llchrisll
//===== Version ==============================================
//= 1.0 - Initial Version
// - Added Reset Equip
// - Added Change Slot
// - Fixed Change Slot Bug
// Changed from Menu > input
//= 1.1 - Fixxed minor Bugs
//= 1.2 - Fixxed small bug, Showing Online Player was bugged
// - Also reversed order of menu outputs (was pissing me off q.q)
//= 1.3 - Script Optimization
// - Exchanged Edit Gender of Account to Char specific
// - Added .char_gender to set delay for change gender per Character
// - Fixxed Reset Equip, which didn't work because of getarg(0)
//===== Tested With =========================================
//= rAthena SQL 07/16-2017 Revision
//===== Description ==========================================
//= This Script allows Player's editing their Account in-Game
// like an Control Panel.
//= For GM's over Level 40:
//- View Server Statistic
//- View your own Account - Same as Player
//- View other Char's Account Details by typing
// the name of an character bounded to it; such us E-Mail, IP,
// for GM's with Level 80 and higher Username and Account ID as well
//===== Comments =============================================
//= .max_ch: Max Characters per Account, please
// put the number you have or the Slot Change Part
// won't work like it should.
// For Renewal Servers : src/common/mmo.h > #define MAX_CHARS
// Don't know for older servers anymore though.
//===== ToDO =================================================
//= Adding an feature to delete accounts
//============================================================
prontera,147,166,6 script In-Game CP 110,{
mes .n$;
mes "Hello, " + strcharinfo(0);
mes "I can tell you your Account";
mes "Settings, as well I can";
mes "change them for you.";
mes "What do you like to do?";
next;
if(getgroupid() >= 40) goto GM_Menu;
if(select("- Show my Info:- Nothing") == 1) goto CP_My;
close;
//================== GM_Menu ==================
GM_Menu:
switch(select("- View Players Account's:- View my Account:- View Server Statistic")) {
//===================== View other Player's Account =====================
case 1:
mes .n$;
mes "Please type the character name you want and I'll find the Account bounded to it.";
input .@s_char$;
next;
mes .n$;
if(.@s_char$ == "") { mes "Character Name is invalid."; close;}
query_sql "SELECT `account_id` FROM `char` WHERE `name` = '"+.@s_char$+"'",.@s_accid;
if(!.@s_accid) { mes "Character Name is invalid."; close;}
query_sql "SELECT `userid` , `sex` , `email` , `logincount` , `last_ip` FROM `login` WHERE `account_id` = '"+.@s_accid+"'",.@user$,.@sex$,.@email$,.@login,.@last_ip$;
if(getgmlevel() >= 80) {
mes "Username: " + .@user$;
mes "Account ID: " + .@s_accid;
}
mes "Gender: " + .@sex$;
mes "E-Mail: " + .@email$;
mes "Login Count: " + .@login;
mes "Last IP: " + .@last_ip$;
mes " ";
mes "Duo user protection";
mes ((getgmlevel() >= 80) ? "the Password" : "the Username, Account ID and Password");
mes "won't be shown.";
close;
//===================================================
//================= View my Account =============
case 2:
CP_My:
query_sql "SELECT `userid` , `sex` , `email` , `logincount` , `last_ip` FROM `login` WHERE `account_id` = '"+getcharid(3)+"'",.@user$,.@sex$,.@email$,.@login,.@last_ip$;
mes .n$;
mes "Username: " + .@user$;
mes "Account ID: " + getcharid(3);
mes "Gender: " + .@sex$;
mes "E-Mail: " + .@email$;
mes "Login Count: " + .@login;
mes "Your IP: " + .@last_ip$;
mes " ";
mes "Duo user protection";
mes "the password won't be shown.";
mes "What now?";
next;
switch(select("- View Char's:- Edit E-Mail:- Nothing")) {
//============== View Char's ============
case 1:
mes .n$;
mes "Choose a character, if you";
mes "want to change something.";
query_sql "SELECT `char_id` , `char_num` , `name` , `class` , `base_level` , `job_level` , `zeny` , `str` , `agi` , `vit` , `int` , `dex` , `luk` , `last_map` , `last_x` , `last_y` , `save_map` , `save_x` , `save_y` FROM `char` WHERE `account_id` = '"+getcharid(3)+"' ORDER BY `base_level` DESC",.@char_id,.@char_num,.@name$,.@class,.@base_level,.@job_level,.@zeny,.@str,.@agi,.@int,.@vit,.@dex,.@luk,.@last_map$,.@last_x,.@last_y,.@save_map$,.@save_x,.@save_y;
mes " ";
for( set .@a,0; .@a < getarraysize(.@name$); set .@a,.@a + 1) {
mes "^FF0000~ "+.@name$[.@a]+" ~^000000";
mes "---------------------";
mes "[Base/Job: " + .@base_level[.@a] + "/" + .@job_level[.@a] + "]";
mes "(Class: " + jobname(.@class[.@a]) + ")";
mes "=====================";
set .@menu$,.@menu$ + "- " + .@name$[.@a] + ( (.@name$[.@a] != "")?":":"");
}
next;
set .@m,select(.@menu$) - 1;
mes .n$;
mes "You have chosen:";
mes "^FF0000~ "+.@name$[.@m]+" ~^000000";
mes "Base/Job: " + .@base_level[.@m] + "/" + .@job_level[.@m];
mes "Class: " + jobname(.@class[.@m]);
mes "Zeny: " + .@zeny[.@m];
mes " ";
mes "Strenght: " + .@str[.@m];
mes "Agility: " + .@agi[.@m];
mes "Vitality: " + .@vit[.@m];
mes "Intelligence: " + .@int[.@m];
mes "Dexterity: " + .@dex[.@m];
mes "Luck: " + .@luk[.@m];
mes " ";
mes "Position:";
mes "Current Map: " + .@last_map$[.@m];
mes "Cooardinates x: " + .@last_x[.@m] + ", y: " + .@last_y[.@m];
mes " ";
mes "Savepoint:";
mes "Map: "+ .@save_map$[.@m] + " x: " + .@save_x[.@m] + ", y: " + .@save_y[.@m];
mes "What do you want to do?";
next;
switch(select("- Reset Position:- Reset Style:- Change Slot:- Reset Equip:- Edit Gender:- Nothing")) {
//=============================== Reset Position ============================
case 1:
mes .n$;
query_sql "SELECT `online` FROM `char` WHERE `name` = '"+escape_sql(.@name$[.@m])+"'",.@on;
if(.@on) {
mes "I'm sorry, but I can't reset the";
mes "position of the chosen character";
mes "while you are logged-in on it.";
close;
}
mes "I will reset the position now.";
query_sql "UPDATE `char` SET `last_map` = '"+.@save_map$[.@m]+"' , `last_x` = '"+.@save_x[.@m]+"' , `last_y` = '"+.@save_y[.@m]+"' WHERE `name` = '"+escape_sql(.@name$[.@m])+"'";
break;
//=============================== Reset Style ============================
case 2:
mes .n$;
mes "This will reset your";
mes "whole style.";
if(select("- Proceed:- Stop!!") - 1) close;
next;
mes .n$;
query_sql "SELECT `online` FROM `char` WHERE `name` = '"+escape_sql(.@name$[.@m])+"'",.@on;
if(.@on) {
mes "I'm sorry, but I can't reset the";
mes "style of the chosen character";
mes "while you are logged-in on it.";
close;
}
query_sql "UPDATE `char` SET `hair` = '0' , `hair_color` = '0' , `clothes_color` = '0' WHERE `name` = '"+escape_sql(.@name$[.@m])+"'";
mes "Your request has been completed.";
break;
//=============================== Change Character Slot ============================
case 3:
mes .n$;
mes "The slots, which are used:";
mes " ";
for( set .@num,0; .@num < getarraysize(.@char_num); set .@num,.@num + 1) {
mes .@char_num[.@num] + ". " + .@name$[.@num];
}
mes "Free Slots: "+.max_ch - getarraysize(.@char_num);
mes " ";
mes "Into which Slot do you want to change?";
next;
input .@num_ch;
mes .n$;
if(.@num_ch > .max_ch) {
mes "I'm sorry, but you";
mes "have put an invalid";
mes "number. Try again please.";
close;
}
mes "You have chosen:";
mes .@num_ch + ".";
mes " ";
mes "I will change the slot now.";
mes "Is that correct?";
if(select("- Yes, continue:- No, wrong") - 1) close;
next;
mes .n$;
query_sql "SELECT `online` FROM `char` WHERE `name` = '"+escape_sql(.@name$[.@m])+"'",.@on;
if(.@on) {
mes "I'm sorry, but I can't change the";
mes "Slot of the chosen character";
mes "while you are logged-in on it.";
close;
}
for(set @n_ct,0; @n_ct < getarraysize(.@char_num); set @n_ct,@n_ct + 1)
if(.@char_num[@n_ct] == .@num_ch) {
mes "I'm sorry, but this";
mes "Slot is in use already.";
mes "Try again please.";
close;
}
query_sql "UPDATE `char` SET `char_num` = '"+.@num_ch+"' WHERE `name` = '"+escape_sql(.@name$[.@m])+"'";
mes "Your request has been completed.";
break;
//================================ Reset Equip ===============================
case 4:
mes .n$;
mes "Wanna reset your Equip?";
if(select("- Yes, please:- No, thanks") - 1) close;
next;
mes .n$;
query_sql "SELECT `online` FROM `char` WHERE `name` = '"+.@name$[.@m]+"'",.@on;
if(.@on) {
mes "I'm sorry, but I can't reset";
mes "your equipment of this character";
mes "while you are logged-in on it.";
close;
}
mes "I will start now.";
query_sql "UPDATE `inventory` SET `equip` = '0' WHERE `char_id` = '"+.@char_id[.@m]+"'";
query_sql "UPDATE `char` SET `weapon` = '0' , `shield` = '0' , `head_top` = '0' , `head_mid` = '0' , `head_bottom` = '0' WHERE `name` = '"+escape_sql(.@name$[.@m])+"'";
next;
mes .n$;
mes "Your request has been completed.";
break;
//================================ Edit Gender ===============================
case 5:
mes .n$;
if(getgroupid() > 0)
if(select("- Reset Gender Delay:- Nothing") == 1)
set char_gender,0;
if(gettimetick(2) < char_gender) {
mes "You can't change your";
mes "gender again. The time left:";
mes ""+callfunc("Time2Str",char_gender);
close;
}
mes "Do you want to change your characters gender?";
mes "Note: Delay between changing your gender again is:";
mes ""+callfunc("Time2Str",.char_gender+gettimetick(2));
if(select("- Yes:- No") - 1) close;
next;
mes .n$;
mes "Gender will be changed after you close this window.";
mes "If you are online on the chosen character you will be kicked.";
close2;
set char_gender,gettimetick(2) + .char_gender;
changecharsex(.@char_id[.@m]);
end;
//===================== Nothing =====================
case 6:
break;
} // Edit Char - End
break;
//============== Edit Mail ============
case 2:
mes .n$;
mes "Now input the new E-Mail";
mes "Address:";
mes "Note: Type 'Cancel' for";
mes "aborting your attempt.";
next;
input .@mail_n$;
if(.@mail_n$ == "Cancel") goto CP_Quit;
mes .n$;
mes "Old E-Mail:" +.@email$;
mes "New E-Mail:" +.@mail_n$;
mes " ";
mes "Is that correct?";
next;
if(select("- Yes, proceed please:- No, cancel it") - 1) {
mes .n$;
mes "As you wish.";
mes "Your request has been canceled.";
close;
} else {
mes .n$;
mes "You're E-Mail will be changed now.";
next;
query_sql "UPDATE `login` SET `email` = '"+escape_sql(.@mail_n$)+"' WHERE `account_id` = '"+getcharid(3)+"'";
mes .n$;
mes "Your request has been completed.";
close;
}
//===================== Nothing =====================
case 3:
break;
}
break;
//=============== Server Statistic ===================
case 3:
query_sql "SELECT count(*) FROM `login` WHERE `account_id` > 1",.@count_acc;
query_sql "SELECT count(*) FROM `char`",.@count_char;
query_sql "SELECT `zeny` FROM `char` WHERE `zeny` > 0",.@count_zeny;
for( set .@z,0; .@z < getarraysize(.@count_zeny); set .@z,.@z + 1)
set .@total_zeny,.@total_zeny + .@count_zeny[.@z];
next;
mes .n$;
mes "Total Accounts: " + .@count_acc;
mes "Total Characters: " + .@count_char;
mes "Total Zeny: " + .@total_zeny;
next;
if(select("Show Online Players:- Nothing") - 1) break;
mes .n$;
mes "I will now show the list of the";
mes "Online Players in your Chat Box.";
close2;
dispbottom "======~-[)* Online <†> Players *(]~-========";
query_sql "SELECT `name` , `class` , `base_level` , `job_level` FROM `char` WHERE `online` = '1'",.@name$,.@class,.@b_level,.@j_level;
for( set .@a,0; .@a < getarraysize(.@name$); set .@a,.@a + 1)
dispbottom .@name$[.@a] + " [Base/Job: " + .@b_level[.@a] + "/" + .@j_level[.@a] + "] (Class: " + jobname(.@class[.@a]) + ")";
end;
}
//=================== Quit Message ==================
next;
mes .n$;
mes "Farewell, " + strcharinfo(0);
close;
OnInit:
set .n$,"^55AA88[Control Panel]^000000";
set .max_ch,9; // Max Characters per Account
set .char_gender,2592000; // Delay for next Gender change for Character
end;
//============== End of Script ===================
}