[Patch] admin_level in /who query

EQ2Emulator Development forum.

Moderator: Team Members

paulgh
Retired
Posts: 51
Joined: Sun Jul 27, 2008 8:48 pm

[Patch] admin_level in /who query

Post by paulgh » Wed Jun 03, 2009 9:29 pm

I've been playing with the /who command, and have made a preliminary patch to make it a tiny bit more 'Live'-like.

Code: Select all

diff -Bruw EQ2Emu/Config Files/World Structs/WorldStructs.xml EQ2EmuPGH/Config Files/World Structs/WorldStructs.xml
--- EQ2Emu/Config Files/World Structs/WorldStructs.xml  2009-06-02 09:46:35.206774000 -0700
+++ EQ2EmuPGH/Config Files/World Structs/WorldStructs.xml       2009-06-03 20:36:12.427551000 -0700
@@ -2369,7 +2369,8 @@
 <Data ElementName="characters_array" Type="Array" ArraySizeVariable="num_characters">
        <Data ElementName="char_name" Type="char" Size="40" />
        <Data ElementName="unknown3" Type="int8" Size="1" />
-       <Data ElementName="level" Type="int16" Size="1" />
+       <Data ElementName="level" Type="int8" Size="1" />
+       <Data ElementName="admin_level" Type="int8" Size="1" />
        <Data ElementName="class" Type="int16" Size="1" />
        <Data ElementName="unknown4" Type="int8" />
        <Data ElementName="race" Type="int8" Size="1" />
diff -Bruw EQ2Emu/Source/World/Player.cpp EQ2EmuPGH/Source/World/Player.cpp
--- EQ2Emu/Source/World/Player.cpp      2009-06-02 09:46:34.847415100 -0700
+++ EQ2EmuPGH/Source/World/Player.cpp   2009-06-03 20:52:43.334962900 -0700
@@ -2384,3 +2384,7 @@
        }
        return true;
 }
\ No newline at end of file
+
+int8 GetAdminLevel(char *name){
+       return 0;
+}
\ No newline at end of file
diff -Bruw EQ2Emu/Source/World/Player.h EQ2EmuPGH/Source/World/Player.h
--- EQ2Emu/Source/World/Player.h        2009-06-02 09:46:34.847415100 -0700
+++ EQ2EmuPGH/Source/World/Player.h     2009-06-03 20:47:44.051863100 -0700
@@ -99,6 +99,8 @@

 // JA: Next set of STAT_* defines will be Guild - but no need for those yet

+int8 GetAdminLevel(char *name);
+
 struct SpellBookEntry{
        int32 spell_id;
        int8  tier;
diff -Bruw EQ2Emu/Source/World/World.cpp EQ2EmuPGH/Source/World/World.cpp
--- EQ2Emu/Source/World/World.cpp       2009-06-02 09:46:34.847415100 -0700
+++ EQ2EmuPGH/Source/World/World.cpp    2009-06-03 20:42:45.065680700 -0700
@@ -752,6 +752,7 @@
                        player = *spawn_iter;
                        packet->setArrayDataByName("char_name", player->GetName(), i);
                        packet->setArrayDataByName("level", player->GetLevel(), i);
+                       packet->setArrayDataByName("admin_level", GetAdminLevel(player->GetName()), i);
                        packet->setArrayDataByName("class", player->GetAdventureClass(), i);
                        packet->setArrayDataByName("unknown4", 0xFF, i); //probably tradeskill class
                        packet->setArrayDataByName("race", player->GetRace(), i);
I have tested this on my server, and it seems to work fine. Of course, right now it doesn't really do anything.
The client recognizes 17 values for admin_level, -1:Banned Player 0:Player and 15 levels of admin, from 1:Apprentice Guide to 15 GM-Mgmt. What do you think would be the best mapping from admin_status to admin_level? LE, JA, etc, any thoughts?

LethalEncounter
Team: Zombie
Posts: 2717
Joined: Wed Jul 25, 2007 10:10 pm

Re: [Patch] admin_level in /who query

Post by LethalEncounter » Thu Jun 04, 2009 2:54 pm

Cool :)

We can always adjust our admin levels to match the client. Would make it less confusing in the long run.

User avatar
John Adams
Retired
Posts: 9684
Joined: Thu Jul 26, 2007 6:27 am
EQ2Emu Server: EQ2Emulator Test Center
Characters: John
Location: Arizona
Contact:

Re: [Patch] admin_level in /who query

Post by John Adams » Thu Jun 04, 2009 7:12 pm

Indeed. Any idea what "rights" the different admin levels are granted in Live? We got a list of GM levels a while ago, but there were certainly not 15 of them... interesting.

I'd like to see where you go with this. My workaround was going to use Titles, but then, titles stopped working ;)

paulgh
Retired
Posts: 51
Joined: Sun Jul 27, 2008 8:48 pm

Re: [Patch] admin_level in /who query

Post by paulgh » Fri Jun 05, 2009 6:53 am

Here is an updated patch that does something:

Code: Select all

diff -Bruw EQ2Emu/Config Files/World Structs/WorldStructs.xml EQ2EmuPGH/Config Files/World Structs/WorldStructs.xml
--- EQ2Emu/Config Files/World Structs/WorldStructs.xml	Tue Jun  2 09:46:35 2009
+++ EQ2EmuPGH/Config Files/World Structs/WorldStructs.xml	Wed Jun  3 20:36:12 2009
@@ -2369,7 +2369,8 @@
 <Data ElementName="characters_array" Type="Array" ArraySizeVariable="num_characters">
 	<Data ElementName="char_name" Type="char" Size="40" />
 	<Data ElementName="unknown3" Type="int8" Size="1" />
-	<Data ElementName="level" Type="int16" Size="1" />
+	<Data ElementName="level" Type="int8" Size="1" />
+	<Data ElementName="admin_level" Type="int8" Size="1" />
 	<Data ElementName="class" Type="int16" Size="1" />
 	<Data ElementName="unknown4" Type="int8" />
 	<Data ElementName="race" Type="int8" Size="1" />
diff -Bruw EQ2Emu/Source/World/Player.cpp EQ2EmuPGH/Source/World/Player.cpp
--- EQ2Emu/Source/World/Player.cpp	Tue Jun  2 09:46:35 2009
+++ EQ2EmuPGH/Source/World/Player.cpp	Fri Jun  5 06:44:36 2009
@@ -2384,3 +2384,21 @@
 	}
 	return true;
 }
\ No newline at end of file
+
+int32 GetAdminLevel(char *name){
+	Query query;
+	MYSQL_ROW row;
+	MYSQL_RES* result = query.RunQuery2(Q_SELECT, "SELECT admin_status from characters where name = '%s'", name);
+	int32 admin_level = 0;
+	if(result){
+		row = mysql_fetch_row(result);
+		admin_level = strtoul(row[0], NULL, 0);
+	}
+
+/* Temporary fix to adjust admin_status to admin_level.
+ * admin_level must be [0 .. 15] or -1
+ */
+	admin_level = (admin_level >> 4);
+
+	return admin_level;
+}
diff -Bruw EQ2Emu/Source/World/Player.h EQ2EmuPGH/Source/World/Player.h
--- EQ2Emu/Source/World/Player.h	Tue Jun  2 09:46:35 2009
+++ EQ2EmuPGH/Source/World/Player.h	Fri Jun  5 06:19:51 2009
@@ -99,6 +99,8 @@
 
 // JA: Next set of STAT_* defines will be Guild - but no need for those yet
 
+int32 GetAdminLevel(char *name);
+
 struct SpellBookEntry{
 	int32 spell_id;
 	int8  tier;
diff -Bruw EQ2Emu/Source/World/World.cpp EQ2EmuPGH/Source/World/World.cpp
--- EQ2Emu/Source/World/World.cpp	Tue Jun  2 09:46:35 2009
+++ EQ2EmuPGH/Source/World/World.cpp	Wed Jun  3 20:42:45 2009
@@ -752,6 +752,7 @@
 			player = *spawn_iter;
 			packet->setArrayDataByName("char_name", player->GetName(), i);
 			packet->setArrayDataByName("level", player->GetLevel(), i);
+			packet->setArrayDataByName("admin_level", GetAdminLevel(player->GetName()), i);
 			packet->setArrayDataByName("class", player->GetAdventureClass(), i);
 			packet->setArrayDataByName("unknown4", 0xFF, i); //probably tradeskill class
 			packet->setArrayDataByName("race", player->GetRace(), i);
admin_level is currently admin_status/16 until a final mapping is decided.
For reference, the admin levels are:
1 Apprentice Guide
2 Guide
3 Senior Guide
4 Elder Guide
5 GM-External
6 GM-Support
7 GM-Staff
8 GM-Admin
9 GM-Lead
10 GM-QAExternal
11 GM-QA
12 GM-QAMgmt
13 GM-SOEMgmt
14 GM-DevTeam
15 GM-Mgmt

User avatar
ilythor
Retired
Posts: 436
Joined: Sun Oct 14, 2007 3:44 am
EQ2Emu Server: TessEq2
Location: Australia, mate!
Contact:

Re: [Patch] admin_level in /who query

Post by ilythor » Fri Jun 05, 2009 9:07 am

I can see about 8 of them that aren't really Necessary. I know Sony really like organization, but isn't that a LITTLE over the top? or is it just me?
"Everytime you pull the trigger in space, you will ruin someone's day, somewhere, and eventually, some time."

Image
Retired
Posts: 251
Joined: Sun Oct 26, 2008 10:07 am

Re: [Patch] admin_level in /who query

Post by Image » Fri Jun 05, 2009 1:08 pm

They are really proud of their titles :D

LethalEncounter
Team: Zombie
Posts: 2717
Joined: Wed Jul 25, 2007 10:10 pm

Re: [Patch] admin_level in /who query

Post by LethalEncounter » Fri Jun 05, 2009 4:48 pm

We can easily get rid of the QAs, I mean are they really needed?



j/k John :P

User avatar
Zcoretri
Team Member
Posts: 1642
Joined: Fri Jul 27, 2007 12:55 pm
Location: SoCal

Re: [Patch] admin_level in /who query

Post by Zcoretri » Fri Jun 05, 2009 5:28 pm

LethalEncounter wrote:We can easily get rid of the QAs, I mean are they really needed?



j/k John :P

LOL...just about spit out my soda that I had been sipping on all over my keyboard when I read this...good one LE :mrgreen:

Image
Retired
Posts: 251
Joined: Sun Oct 26, 2008 10:07 am

Re: [Patch] admin_level in /who query

Post by Image » Fri Jun 05, 2009 5:54 pm

Would actually be cool if we could keep some for the contributors of the project.. enough titles to go around anyway right? (Referring to the externals)

User avatar
Scatman
Retired
Posts: 1688
Joined: Wed Apr 16, 2008 5:44 am
EQ2Emu Server: Scatman's Word
Characters: Scatman
Location: New Jersey

Re: [Patch] admin_level in /who query

Post by Scatman » Sat Jun 06, 2009 1:00 am

Zcoretri wrote:LOL...just about spit out my soda that I had been sipping on all over my keyboard when I read this...good one LE :mrgreen:
Be a man. Don't sip your soda. Drink it like you mean it.

User avatar
John Adams
Retired
Posts: 9684
Joined: Thu Jul 26, 2007 6:27 am
EQ2Emu Server: EQ2Emulator Test Center
Characters: John
Location: Arizona
Contact:

Re: [Patch] admin_level in /who query

Post by John Adams » Sat Jun 06, 2009 8:00 am

LethalEncounter wrote:We can easily get rid of the QAs, I mean are they really needed?
:shock: :cry: :!: :!: :!:

As for these titles, does this list comes from the client? If so, is it safe to assume that if the client is told I am admin level 12, that when someone does a /who on me, they will see (hard-coded, unchangable) GM-QAMgmt in my name?


[11 Guardian] (GM-QAMgmt) John (Barbarian) <QA Gods> Zone: Graystone


I see no harm keeping the pre-existing titles. You just don't have to use them. Plus, once our "titles" function returns, we could simply override these names with our own. I hope.

LethalEncounter
Team: Zombie
Posts: 2717
Joined: Wed Jul 25, 2007 10:10 pm

Re: [Patch] admin_level in /who query

Post by LethalEncounter » Sat Jun 06, 2009 8:28 am

It looks like it would be an either/or thing since we cannot change the titles. Either we use the existing system or we add the data directly to the who results when printed. I'm in favor of the EQLive system. I don't see a need to create custom titles for the /who command.

User avatar
John Adams
Retired
Posts: 9684
Joined: Thu Jul 26, 2007 6:27 am
EQ2Emu Server: EQ2Emulator Test Center
Characters: John
Location: Arizona
Contact:

Re: [Patch] admin_level in /who query

Post by John Adams » Sat Jun 06, 2009 9:00 am

Ohh, so "Titles" in EQ2 Live do not show on /who, only above the players head?

Then yeah. One thing I would like to request in this though... unlike EQEmu... i would like the option to hide your Admin title from /who if you choose to. I think later revs of EQEmu eventually did this, but I always hated going out to spy on my players and they could do a /who and see [GM-Impossible] in their zone ;)

We could address that later though, after paulgh finishes the implementation, as a feature request.

paulgh
Retired
Posts: 51
Joined: Sun Jul 27, 2008 8:48 pm

Re: [Patch] admin_level in /who query

Post by paulgh » Sat Jun 06, 2009 1:19 pm

A /who result for an admin look like this:
[1 Conjuror] Icenia (Human) *GM-Mgmt* Zone: Queen's Colony

All of the titles are hard-coded into the client (sorry, can't change them).

The actual implementation,as I envisioned it, is complete. I'm going to try to tidy everything up and add in the changes to the /who command that makes use of this, probably Sunday.

About hiding your GM status, there is a flag called 'hidden', which should do the trick, but I need to test it. Of course, that would require support for all the flags (LFW, LFG, ANON, RP, AFK, HIDDEN). I'd love to add that, but it appears to be a little beyond my current skills. Unless it's very simple, or I have an example I can copy, paste, and edit, myeyes cross and my brain overloads whenever I see templates and/or inheritance in C++.

User avatar
John Adams
Retired
Posts: 9684
Joined: Thu Jul 26, 2007 6:27 am
EQ2Emu Server: EQ2Emulator Test Center
Characters: John
Location: Arizona
Contact:

Re: [Patch] admin_level in /who query

Post by John Adams » Sat Jun 06, 2009 1:29 pm

Hehe, no worries paulgh. Thanks for the additions in advance. We'll sort out the sneaky GM'ness later ;)

Post Reply

Who is online

Users browsing this forum: No registered users and 0 guests