[Help] Arena Rating Distribution

Hello, TrinityCore users and devs.

Okay so, I would like to Inject Rating point into a 5v5 arena Team. My idea was to add it into Battleground.cpp, then when player win or lose a battleground he get somes rating point into his team.

Here is my code :

if (team == winner)
{
switch(player->GetZoneId())
{
case 3277: // Warsong Gulch
if (GetArenaType() == ARENA_TYPE_5v5)
{
CharacterDatabase.PExecute(“UPDATE arena_team SET rating = (WeekGames+1) AND weekWins = (weekWins+1) AND SeasonWins = (SeasonWins+1) AND SeasonGames = (SeasonGames+1) AND Rating = (Rating+14) WHERE captainGuid = ‘%u’”, player->GetGUID());

	}
	 }
	}
	else
	{
		if (GetArenaType() == ARENA_TYPE_5v5) 
	 {
	CharacterDatabase.PExecute("UPDATE arena_team SET rating = (WeekGames+1) AND weekWins = (weekWins+1) AND SeasonWins = (SeasonWins+1) AND SeasonGames = (SeasonGames+1) AND Rating = (Rating+6) WHERE captainGuid = '%u'", player->GetGUID());
	
	 }
	}
		break;
	};

It’s compiling but not working. no one get an idea?

(I Assume i don’t know nothing about Rating System…)

20 Views and no one got an idea how it’s work?

This code is not even logical.

You do one single switch - mind you, a “switch” that compares if the Arenatype is ARENA_TYPE_5v5… Just to have that again. What do you even want to do?

If player get arena team 5v5 and if player win or lose battleground (Warsong here) he get somes rating into this team.

So basically you want sort of a “Battleground” Team rating, correct ?

Yup. but into a 5v5 arena not into a custom table.

I think Battleground::EndBattleGround is exactly what you want. More accurately, “if (winner == Alliance)”, etc.

i’m looking for the rigft code to select the player with a 5v5 team. And inject rating on it. nothing else :9

Especially why I point you to that function. You can modify it and add an iterator to the winning team function to change the rating for each player according to your preferences.

Okay So finaly i just insert it on an item.

But now i have an other problem

CharacterDatabase.PExecute(“UPDATE arena_team SET WeekGames = (WeekGames+1), weekWins = (weekWins+1), SeasonWins = (SeasonWins+1), SeasonGames = (SeasonGames+1), Rating = (Rating+14) WHERE captainguid = ‘%u’ AND type = 5”, winner->GetGUID());

CharacterDatabase.PExecute("UPDATE arena_Team_member SET WeekGames = (WeekGames+1), weekWins = (weekWins+1), SeasonWins = (SeasonWins+1), SeasonGames = (SeasonGames+1), personalRating = (personalRating+14) WHERE guid = ‘%u’ ", winner->GetGUID());

First Execution is Okay She update the database.

But the second. Update ALL Team and not only the 5v5 but there is no “Type” into Arena_Team_member