Hello,I’m trying to make a PvP title system that only choose the 44 players with the most yesterdayHonorPoint and gives them a title upgrade if they can.
But i’m a total noob in c++ i hope you’ll help me understand a few things here /emoticons/default_smile.png
This is what i’ve got so far :
[CODE]{
QueryResult result = CharacterDatabase.Query(“SELECT guid,knowTitles FROM characters WHERE yesterdayHonorPoints>‘100’ ORDER BY yesterdayHonorPoints DESC LIMIT 44”);
if(!result)
return false;
Field * fields = NULL;
fields = result->Fetch();
uint16 guid = fields[0].GetUInt16();
string knowTitles = fields[1].GetString(); //Not sure i should use string for this ? can i do a uint64 and only use the 1st number ? I think spaces would fuck things up
SetUInt32Value(PLAYER_FIELD_YESTERDAY_CONTRIBUTION, 0); //Reset Yesterday Honor once you got the title.
}
break;[/CODE]
First i want to assing a rank to each result like so :
1 = RANK_14
2 = RANK_13
3 = RANK_12
4 = RANK_11
5 = RANK_10
6 - 7 = RANK_9
8 - 9 = RANK_8
10 - 11 = RANK_7
12 - 14 = RANK_6
15 - 17 = RANK_5
18 - 20 = RANK_4
21 - 26 = RANK_3
27 - 34 = RANK_2
35 - 44 = RANK_1
Then findout what is the player current highest rank they got and what faction they are, i figured i could found wich rank they got by looking at the first number into ‘knownTitles’ but i have no clues how to do it.
[CODE]2 0 0 0 0 0 //2 0 0 0 0 0 = Private
6 0 0 0 0 0 //4 0 0 0 0 0 = Corporal
14 0 0 0 0 0 //8 0 0 0 0 0 = Sergeant
30 0 0 0 0 0 //16 0 0 0 0 0 = Master Sergeant
62 0 0 0 0 0 //32 0 0 0 0 0 = Sergeant Major
126 0 0 0 0 0 //64 0 0 0 0 0 = Knight
254 0 0 0 0 0 //128 0 0 0 0 0 = Knight Lieutenant
510 0 0 0 0 0 //256 0 0 0 0 0 = Knight Captain
1022 0 0 0 0 0 //512 0 0 0 0 0 = Knight Champion
2046 0 0 0 0 0 //1024 0 0 0 0 0 = Lieutenant Commander
4094 0 0 0 0 0 //2048 0 0 0 0 0 = Commander
8190 0 0 0 0 0 //4096 0 0 0 0 0 = Marshal
16382 0 0 0 0 0 //8192 0 0 0 0 0 = Field Marshal
32766 0 0 0 0 0 //16384 0 0 0 0 0 = Grand Marshal
32768 0 0 0 0 0 //32768 0 0 0 0 0 = Scout
98304 0 0 0 0 0 //65536 0 0 0 0 0 = Grunt
229376 0 0 0 0 0 //131072 0 0 0 0 0 = Sergeant
491520 0 0 0 0 0 //262144 0 0 0 0 0 = Senior Sergeant
1015808 0 0 0 0 0 //524288 0 0 0 0 0 = First Sergeant
2064384 0 0 0 0 0 //1048576 0 0 0 0 0 = Stone Guard
4161536 0 0 0 0 0 //2097152 0 0 0 0 0 = Blood Guard
8355840 0 0 0 0 0 //4194304 0 0 0 0 0 = Legionnaire
16744448 0 0 0 0 0 //8388608 0 0 0 0 0 = Centurion
33521664 0 0 0 0 0 //16777216 0 0 0 0 0 = Champion
67076096 0 0 0 0 0 //33554432 0 0 0 0 0 = Lieutenant General
134184960 0 0 0 0 0 //67108864 0 0 0 0 0 = General
268402688 0 0 0 0 0 //134217728 0 0 0 0 0 = Warlord
536838144 0 0 0 0 0 //268435456 0 0 0 0 0 = High Warlord[/CODE]
Now let’s give you an exemple of what i want to do :
let’s say the result 16 of the sql query is :
Guid = 5435
knownTitles = 6 0 0 0 0 0
I would know the guid 5435 is actualy a Corporal and is RANK_5 so i would grant him +1 Rank so Sergeant
Now i don’t want ppl to became instantly rank_5, the idea is to progress rank by rank so if you was previously only corporal (so rank2 you can get higer than rank3)
How ever to make so ppl want to be in the top 5, i would say that being RANK_14 can make you increase up to +3 rank at once and RANK_13 to RANK_10 would be +2 rank
So i hope you understoud what i’m trying to do and please tell me if i’m not doing it in a good way /emoticons/default_smile.png