From b27d189868e08f4459d324fcdc71d996b4ba84ae Mon Sep 17 00:00:00 2001 From: Jesusaves Date: Mon, 16 Jul 2018 23:01:47 -0300 Subject: User Control Panel (@ucp) --- npc/commands/super-menu.txt | 17 +----------- npc/commands/ucp.txt | 67 +++++++++++++++++++++++++++++++++++++++++++++ npc/functions/main.txt | 7 +++++ npc/scripts.conf | 1 + 4 files changed, 76 insertions(+), 16 deletions(-) create mode 100644 npc/commands/ucp.txt (limited to 'npc') diff --git a/npc/commands/super-menu.txt b/npc/commands/super-menu.txt index a14f26bc3..9bb3b9365 100644 --- a/npc/commands/super-menu.txt +++ b/npc/commands/super-menu.txt @@ -49,8 +49,7 @@ function script SuperMenu { OnCall: - if (!debug && !is_gm()) - { + if (!debug && !is_gm()) { dispbottom l("You do not have the required access privileges to use the Super Menu."); end; } @@ -59,20 +58,6 @@ OnCall: closedialog; end; -OnPCLoginEvent: - .@debug_skill = getskilllv(EVOL_SUPER_MENU); - - if (.@debug_skill > 0 && !debug) - { - skill EVOL_SUPER_MENU, 0, 0; // remove debug skill - } - - else if (.@debug_skill < 1 && debug) - { - skill EVOL_SUPER_MENU, 1, 0; // give debug skill - } - end; - OnInit: bindatcmd "super", "@super::OnCall", 80, 99, 0; //bindatcmd "numa", "@super::OnCall", 80, 99, 0; // alias for those used to TMW's @numa - none at the moment, iirc diff --git a/npc/commands/ucp.txt b/npc/commands/ucp.txt new file mode 100644 index 000000000..dbdf06221 --- /dev/null +++ b/npc/commands/ucp.txt @@ -0,0 +1,67 @@ +function script UserCtrlPanel { + do + { + clear; + setnpcdialogtitle l("User Control Panel"); + mes l("This menu gives you some options which affect your account."); + mes l("In some cases, your pincode will be required."); + mes ""; + mes l("What do you want to access?"); + next; + select + l("Rules"), + l("Game News"), + l("Account Information"), + l("Quit"); + + switch (@menu) + { + case 1: GameRules; break; + case 2: GameNews; break; + case 3: + if (!validatepin()) + break; + query_sql("SELECT email,logincount,last_ip FROM `login` WHERE account_id="+getcharid(3)+"' LIMIT 2", .@email$, .@lgc, .@ip$); + mes l("Char Name: @@", strcharinfo(0)); + mes l("Party Name: @@", strcharinfo(1)); + mes l("Guild Name: @@", strcharinfo(2)); + mes l("Clan Name: @@", strcharinfo(4)); + mes ""; + mes l("Email: @@", .@email$[0]); + if (Sex) + mes l("Male"); + else + mes l("Female"); + mes l("Last IP: @@", .@ip$[0]); + mes l("Total Logins: @@", .@lgc[0]); + next; + query_sql("SELECT name,last_login,last_map,partner_id FROM `char` WHERE account_id="+getcharid(3)+"' LIMIT 9", .@name$, .@lastlogin$, .@map$, .@married); + for (.@i = 1; .@i < getarraysize(.@name$); .@i++) { + mesn .@name$[i-1]; + mes l("Last Seen: @@", .@lastlogin$[i-1]); + mes l("Last map: @@", .@map$[i-1]); + if (.@married[i-1]) + mes l("Married with @@", gf_charname(.@married[i-1])); + mes ""; + } + next; + break; + case 7: close; break; + } + } while (1); +} + + + +- script @ucp 32767,{ + end; + +OnCall: + + UserCtrlPanel; + closedialog; + end; + +OnInit: + bindatcmd "ucp", "@ucp::OnCall", 0, 99, 0; +} diff --git a/npc/functions/main.txt b/npc/functions/main.txt index 0318ce69e..d290bac63 100644 --- a/npc/functions/main.txt +++ b/npc/functions/main.txt @@ -248,6 +248,13 @@ function script gf_accid { return .@value[0]; } +// Get some char name from char ID, even if offline +// ( Name ) +function script gf_charname { + .@nb = query_sql("SELECT name FROM `char` WHERE char_id="+escape_sql(getarg(0))+" LIMIT 2", .@value$); + return .@value$[0]; +} + // Request pincode and validate it. Use any non-4-digits code to cancel. Failure will dc you. // Returns 1 if pin check is OK. function script validatepin { diff --git a/npc/scripts.conf b/npc/scripts.conf index b02cc7157..5dca6e73c 100644 --- a/npc/scripts.conf +++ b/npc/scripts.conf @@ -76,6 +76,7 @@ "npc/commands/super-menu.txt", "npc/commands/warp.txt", "npc/commands/wgm.txt", +"npc/commands/ucp.txt", // config script "npc/config/hairstyle_config.txt", -- cgit v1.2.3-60-g2f50