Question about .account set gmlevel

Hello , i have custom ranks (like 9 gm levels) . The question is: is possible to modify the command to be able to set account gm level higher than 3 ?

everything is possible.

I just don’t see the point on having 9 GM levels… Well… I see the point if you have VIP system in place.

i like complicated things , this is why i have 9 GM levels

and i like to have ranks like Owner , Co-Owner , Head Admin etc. than Mod,GM and Admin.

No idea how to do it at src level, but i’m bored and my tooth hurt so can’t sleep and i came out with bash script ;p

if you are a windows user, ignore the post.

first, open a file called addgm.shin a text editor of choice, lets say nano.

nano addgm.sh

now copy the code into it:

[CODE]#!/bin/sh

addgm.sh: add / modify account security level from shell prompt

(c) [email protected] 2012

please note:this script DOES NOT control your input at all, be careful

usege: sh addgm.sh [account name] [account level] [realm id]

if account allready exists in account_access, gmlevel and realmids will be overriden

user realm id -1 just like in trinity core to add a gm access at all realms

CONFIG

DBNAME=‘TC_authdb’ # auth database

DBUSER=‘root’ # database username

DBPASS=‘123456’ # database password

DBHOST=‘localhost’ # database hostname

Query for userdata:

USER_DATA=$(echo “USE “$DBNAME”; SELECT account.id, account.username, account_access.id, account_access.gmlevel FROM account LEFT JOIN account_access ON account.id = account_access.id WHERE username = '”$1"';" | mysql -u$DBUSER -p$DBPASS | tail -1)

User ID: used later on other querys and to check if account actually exists

USER_ID=$(echo $USER_DATA | awk ‘{print $1}’)

Is GM? used to determinate shall we insert or update a row in account_access

IS_GM=$(echo $USER_DATA | awk ‘{print $4}’) # NULL: not a gm, anything else corresponds to gmlevel

if [ “$3” = “-1” ] # are we operating on a specific realm or all of them ?

then # all realms

	REALMNAME='All Realms';

else # specific realm, get the name so echo's would look neat

	REALMNAME=$(echo "USE "$DBNAME"; SELECT name FROM realmlist WHERE id = '"$3"';" | mysql -u$DBUSER -p$DBPASS | tail -1 )

fi

Determinate string to print and query to run and the end

if [ $IS_GM = ‘NULL’ ] # User is not a GM, prepare things to insert

then

	STRING='\tAdding new game master:\n\t'$(tput setaf 2)$1$(tput sgr0)' (gmlevel '$2')\n\tOn Realm: '$REALMNAME;

	QUERY="USE "$DBNAME"; INSERT INTO account_access (id,gmlevel,RealmID) VALUES ("$USER_ID","$2","$3");"

else # User is a GM already, prepare things to update

	STRING='\tUpdating gmlevel for game master:\n\t'$(tput setaf 2)$1$(tput sgr0)' (from '$IS_GM' to '$2')\n\tOn Realm: '$REALMNAME;

	QUERY="USE "$DBNAME"; UPDATE account_access SET gmlevel = '"$2"', RealmID = '"$3"' WHERE id ='"$USER_ID"';"

fi

output the string: action that is going to be performed

echo “\n”$STRING

perform the action and write result to $RESULT

RESULT=$(echo $QUERY | mysql -vvv -u$DBUSER -p$DBPASS | head -5 | tail -1)

and finally output the results

echo ‘\n\tMySQL said: ‘$RESULT’\n’;[/code]

Edit db connection data at the begining and save the file. Make it executable:

[/CODE][code]chmod +x addgm.sh
Now your ready to go, syntax is:

addgm.sh account_name realm_id gm_level

$ ./addgm.sh root 5 1

example output:

[CODE]rkm@sbc-dev:~$ ./addgm.sh root 5 1

Updating gmlevel for game master:

root (from 9 to 5)

On Realm: Trinity

MySQL said: Query OK, 1 row affected (0.00 sec)

[/CODE]

lol i actually posted my mysql password ;-p

ignored

time to hit the wayback machine or google cache /emoticons/default_smile.png

Just joking, I’m sure neither one will actually work…

I thought the command worked automatically … hmm …?

I have a foggy memory of adding a rank and using the command to make myself GM rank 4.

The core has max ranks defined, so why wouldnt the command be scripted to scale with it ??

Of course the database info message will be wrong, since its in the database and would need updating (not really needed for the command to function)

Checked fast and it seems that it is coded as I expected, making .account set addon to work with custom GM levels (added to core) automatically.

Of course if you ignored the comment in core and added them after console, then its your own problem.