BattleGrounds reward for win

345 Views Asked by At

If BattleGround is won by an alliance, all players in the alliance (on BG) will receive a 305047 item. If a horde wins a BattleGround, all players in the hordes (on BG) receive a 305048 item.

These are the items of the award chests. Can you tell me how to do this?

Maybe it can be done in LUA using Eluna?

if (player->GetTeamId(TEAM_HORDE))
    player->AddItem(305047, 1);
else
    player->AddItem(305048, 1);

upd2: This code works but not correctly. It gives out awards everywhere. At Arena and BG. I need the award to be given only on BG.

3

There are 3 best solutions below

0
iThorgrim On
local H2Item = ;
local A2Item = ;

local function onBattlegroundEnd(event, bg, bgId, instanceId, winner)
    for k, player in ipair(GetPlayersInWorld()) do
        if player:GetInstanceId() == instanceId then
            if winner == 1 and player:IsHorde() == 1 then
                player:AddItem(H2Item)
            elseif winner == 0 and player:IsHorde() == 0 then
                player:AddItem(A2Item)
            end
        end
    end
end
RegisterBGEvent(2, onBattlegroundEnd)

It's ok for this ?

1
Poszer On

you can do this with C++, editing existing file battleground.cpp and at the line 985 use this:

if (bgTeamId == winnerTeamId)
    {
        if (TEAM_ALLIANCE == winnerTeamId)
            player->AddItem(XXXXX, 1); // Here add Item for Alliance players to get on BG End
        else
            if (TEAM_HORDE == winnerTeamId)
            {
                player->AddItem(XXXXX, 1); // Here add Item For Horde players to get on BG end
            }
0
Mehdi Zaidi On
if (!isArena()) {
  if (bgTeamId == winnerTeamId) {
    if (TEAM_ALLIANCE == winnerTeamId) {
      player->AddItem(XXXXX, 1); // Here add Item for Alliance players to get on BG End
    } else {
      if (TEAM_HORDE == winnerTeamId) {
        player->AddItem(XXXXX, 1); // Here add Item For Horde players to get on BG end
      }
    }
  }

Then just use that