doka2trade
doka2trade

Reputation: 47

BattleGrounds reward for win

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.

Upvotes: 0

Views: 393

Answers (3)

Mehdi Zaidi
Mehdi Zaidi

Reputation: 31

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

Upvotes: 3

Poszer
Poszer

Reputation: 78

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
            }

Upvotes: 0

iThorgrim
iThorgrim

Reputation: 101

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 ?

Upvotes: 2

Related Questions