Exemplo n.º 1
0
bool OPvPCapturePoint::DelObject(uint32 type)
{
    if(!m_Objects[type])
        return false;

	Map* map = sMapMgr.FindMap(530);
	if(!map)
	{
		m_Objects[type] = 0;
        return false;
	}

    GameObject *obj = map->GetGameObject(m_Objects[type]);
    if(!obj)
    {
        m_Objects[type] = 0;
        return false;
    }
    uint32 guid = obj->GetDBTableGUIDLow();
    obj->SetRespawnTime(0);                                 // not save respawn time
    obj->Delete();
    sObjectMgr.DeleteGOData(guid);
    m_ObjectTypes[m_Objects[type]] = 0;
    m_Objects[type] = 0;
    return true;
}
Exemplo n.º 2
0
void BattleGroundWS::RespawnFlagAfterDrop(uint32 team)
{
    if (GetStatus() != STATUS_IN_PROGRESS)
        return;

    RespawnFlag(team,false);
    if (team == ALLIANCE)
    {
        SpawnBGObject(BG_WS_OBJECT_A_FLAG, RESPAWN_IMMEDIATELY);
        SendMessageToAll(GetTrinityString(LANG_BG_WS_ALLIANCE_FLAG_RESPAWNED));
    }
    else
    {
        SpawnBGObject(BG_WS_OBJECT_H_FLAG, RESPAWN_IMMEDIATELY);
        SendMessageToAll(GetTrinityString(LANG_BG_WS_HORDE_FLAG_RESPAWNED));
    }

    PlaySoundToAll(BG_WS_SOUND_FLAGS_RESPAWNED);

    Map * tmpMap = GetMap();

    if (!tmpMap)
        return;

    GameObject *obj = tmpMap->GetGameObject(GetDroppedFlagGUID(team));
    if (obj)
        obj->Delete();
    else
        sLog.outLog(LOG_DEFAULT, "ERROR: unknown droped flag bg, guid: %u",GUID_LOPART(GetDroppedFlagGUID(team)));

    SetDroppedFlagGUID(0,team);
    m_BothFlagsKept = false;
}
Exemplo n.º 3
0
bool OutdoorPvPObjective::DelCapturePoint()
{
    Map* map = m_PvP->GetMap();

    if (m_CapturePoint)
    {
        GameObject *obj = map->GetGameObject(m_CapturePoint);
        if (obj)
        {
            obj->SetRespawnTime(0);                                 // not save respawn time
            obj->Delete();
        }

        m_CapturePoint = 0;
    }
    if (m_CapturePointCreature)
    {
        Creature *cr = map->GetCreature(m_CapturePointCreature);
        if (cr)
            cr->AddObjectToRemoveList();

        m_CapturePointCreature = 0;
    }
    return true;
}
Exemplo n.º 4
0
void BattleGroundDS::DespawnBGObject(uint64 const& guid)
{
    Map* map = GetBgMap();

    GameObject *obj = map->GetGameObject(guid);
    if(obj)
        obj->Delete();
}
Exemplo n.º 5
0
void OutdoorPvPObjectiveEP_NPT::SummonGO(uint32 team)
{
    DelObject(EP_NPT_BUFF);
    AddObject(EP_NPT_BUFF,EP_NPT_LordaeronShrine.entry,EP_NPT_LordaeronShrine.map,EP_NPT_LordaeronShrine.x,EP_NPT_LordaeronShrine.y,EP_NPT_LordaeronShrine.z,EP_NPT_LordaeronShrine.o,EP_NPT_LordaeronShrine.rot0,EP_NPT_LordaeronShrine.rot1,EP_NPT_LordaeronShrine.rot2,EP_NPT_LordaeronShrine.rot3);

    Map* map = m_PvP->GetMap();
    GameObject * go = map->GetGameObject(m_Objects[EP_NPT_BUFF]);
    if(go)
    {
        go->SetUInt32Value(GAMEOBJECT_FACTION,(team == ALLIANCE ? 84 : 83));
    }
}
Exemplo n.º 6
0
    void OnDuelStart(Player* firstplayer, Player* secondplayer) override
    {
        Map* map = firstplayer->GetMap();
        if (map->IsDungeon())
            return;

        // Duel flag is used as duel center point
		GameObject* go = map->GetGameObject(ObjectGuid(firstplayer->GetUInt64Value(PLAYER_DUEL_ARBITER)));
        if (!go)
            return;

        // Get players from 100 yard radius ( duel radius is 40-50 yd )
        std::list<Player*> playerList;
        Trinity::AnyPlayerInObjectRangeCheck checker(go, 100.0f);
        Trinity::PlayerListSearcher<Trinity::AnyPlayerInObjectRangeCheck> searcher(go, playerList, checker);
        go->VisitNearbyWorldObject(100.0f, searcher);

        // insert players' phases to used phases, ignore GMs
        uint32 usedPhases = 0;
        if (!playerList.empty())
            for (std::list<Player*>::const_iterator it = playerList.begin(); it != playerList.end(); ++it)
                if (!(*it)->IsGameMaster())
                    usedPhases |= (*it)->GetPhaseMask();

        // loop all unique phases
        for (uint32 phase = 2; phase <= ULONG_MAX / 2; phase *= 2)
        {
            // If phase in use, skip
            if (usedPhases & phase)
                continue;

            // Phase players & pets, dont update visibility yet
            firstplayer->SetPhaseMask(phase, false);
            secondplayer->SetPhaseMask(phase, false);
            // Phase duel flag
            go->SetPhaseMask(phase, true);
            // Update visibility here so pets will be phased and wont despawn
            firstplayer->UpdateObjectVisibility();
            secondplayer->UpdateObjectVisibility();
            return;
        }

        // Couldnt find free unique phase
        firstplayer->GetSession()->SendNotification("There are no free phases");
        secondplayer->GetSession()->SendNotification("There are no free phases");
    }
Exemplo n.º 7
0
bool OutdoorPvPObjective::DelObject(uint32 type)
{
    if (!m_Objects[type])
        return false;

    Map* map = m_PvP->GetMap();
    GameObject *obj = map->GetGameObject(m_Objects[type]);
    if (!obj)
    {
        sLog.outError("OutdoorPvPObjective: Can't find gobject guid: %u", GUID_LOPART(m_Objects[type]));
        return false;
    }

    obj->SetRespawnTime(0);                                 // not save respawn time
    obj->Delete();
    m_ObjectTypes[m_Objects[type]] = 0;
    m_Objects[type] = 0;
    return true;
}
Exemplo n.º 8
0
bool OutdoorPvPObjective::HandleCaptureCreaturePlayerMoveInLos(Player * p, Creature * c)
{
    // check if guid matches
    if(c->GetGUID() != m_CapturePointCreature)
        return false;

    // check if capture point go is spawned
    Map* map = m_PvP->GetMap();
    GameObject * cp = map->GetGameObject(m_CapturePoint);
    if(!cp)
        return false;

    // check range and activity
    if(cp->IsWithinDistInMap(p,cp->GetGOInfo()->raw.data[0]) && p->IsOutdoorPvPActive())
        // data[8] will be used for player enter
        return HandleCapturePointEvent(p, cp->GetGOInfo()->raw.data[8]); //i_objective->HandlePlayerEnter((Player*)u);
    else
        // data[9] will be used for player leave
        return HandleCapturePointEvent(p, cp->GetGOInfo()->raw.data[9]); //i_objective->HandlePlayerLeave((Player*)u);
}
bool UseMeetingStoneAction::Execute(Event event)
{
    Player* master = GetMaster();
    if (!master)
        return false;

    WorldPacket p(event.getPacket());
    p.rpos(0);
    ObjectGuid guid;
    p >> guid;

    if (master->GetSelectedPlayer() && master->GetSelectedPlayer() != bot)
        return false;

    if (!master->GetSelectedPlayer() && master->GetGroup() != bot->GetGroup())
        return false;

    if (master->IsBeingTeleported())
        return false;

    if (bot->IsInCombat())
    {
        ai->TellMasterNoFacing("I am in combat");
        return false;
    }

    Map* map = master->GetMap();
    if (!map)
        return NULL;

    GameObject *gameObject = map->GetGameObject(guid);
    if (!gameObject)
        return false;

    const GameObjectTemplate* goInfo = gameObject->GetGOInfo();
    if (!goInfo || goInfo->type != GAMEOBJECT_TYPE_SUMMONING_RITUAL)
        return false;

    return Teleport();
}
Exemplo n.º 10
0
void BattleGround::SpawnBGObject(ObjectGuid guid, uint32 respawntime)
{
    Map* map = GetBgMap();

    GameObject* obj = map->GetGameObject(guid);
    if (!obj)
        return;
    if (respawntime == 0)
    {
        // we need to change state from GO_JUST_DEACTIVATED to GO_READY in case battleground is starting again
        if (obj->getLootState() == GO_JUST_DEACTIVATED)
            obj->SetLootState(GO_READY);
        obj->SetRespawnTime(0);
        map->Add(obj);
    }
    else
    {
        map->Add(obj);
        obj->SetRespawnTime(respawntime);
        obj->SetLootState(GO_JUST_DEACTIVATED);
    }
}
Exemplo n.º 11
0
bool OutdoorPvPObjectiveEP_PWT::Update(uint32 diff)
{
    if(OutdoorPvPObjective::Update(diff))
    {
        if(m_OldState != m_State || fabs(m_ShiftPhase) == m_ShiftMaxPhase)  // state won't change, only phase when maxed out!
        {
            // if changing from controlling alliance to horde or vice versa
            if( m_OldState == OBJECTIVESTATE_ALLIANCE )
            {
                sWorld.SendZoneText(EP_GraveYardZone,objmgr.GetMangosString(LANG_OPVP_EP_LOOSE_PWT_A,-1));
                ((OutdoorPvPEP*)m_PvP)->EP_Controls[EP_PWT] = 0;
            }
            else if ( m_OldState == OBJECTIVESTATE_HORDE )
            {
                sWorld.SendZoneText(EP_GraveYardZone,objmgr.GetMangosString(LANG_OPVP_EP_LOOSE_PWT_H,-1));
                ((OutdoorPvPEP*)m_PvP)->EP_Controls[EP_PWT] = 0;
            }

            uint8 artkit = 21;

            switch(m_State)
            {
                case OBJECTIVESTATE_ALLIANCE:
                    if(m_ShiftPhase == m_ShiftMaxPhase)
                    {
                        m_TowerState = EP_TS_A;
                        SummonFlightMaster(ALLIANCE);
                    }
                    else
                        m_TowerState = EP_TS_A_P;
                    artkit = 2;
                    ((OutdoorPvPEP*)m_PvP)->EP_Controls[EP_PWT] = ALLIANCE;
                    sWorld.SendZoneText(EP_GraveYardZone,objmgr.GetMangosString(LANG_OPVP_EP_CAPTURE_PWT_A,-1));
                    break;
                case OBJECTIVESTATE_HORDE:
                    if(m_ShiftPhase == -m_ShiftMaxPhase)
                    {
                        m_TowerState = EP_TS_H;
                        SummonFlightMaster(HORDE);
                    }
                    else
                        m_TowerState = EP_TS_H_P;
                    artkit = 1;
                    ((OutdoorPvPEP*)m_PvP)->EP_Controls[EP_PWT] = HORDE;
                    sWorld.SendZoneText(EP_GraveYardZone,objmgr.GetMangosString(LANG_OPVP_EP_CAPTURE_PWT_H,-1));
                    break;
                case OBJECTIVESTATE_NEUTRAL:
                    m_TowerState = EP_TS_N;
                    DelCreature(EP_PWT_FLIGHTMASTER);
                    break;
                case OBJECTIVESTATE_NEUTRAL_ALLIANCE_CHALLENGE:
                case OBJECTIVESTATE_HORDE_ALLIANCE_CHALLENGE:
                    m_TowerState = EP_TS_N_A;
                    break;
                case OBJECTIVESTATE_NEUTRAL_HORDE_CHALLENGE:
                case OBJECTIVESTATE_ALLIANCE_HORDE_CHALLENGE:
                    m_TowerState = EP_TS_N_H;
                    break;
            }

            Map* map = m_PvP->GetMap();
            GameObject* flag = map->GetGameObject(m_CapturePoint);
            GameObject* flag2 = map->GetGameObject(m_Objects[EP_PWT_FLAGS]);
            if(flag)
                flag->SetGoArtKit(artkit);
            if(flag2)
                flag2->SetGoArtKit(artkit);

            UpdateTowerState();

            // complete quest objective
            if(m_TowerState == EP_TS_A || m_TowerState == EP_TS_H)
                SendObjectiveComplete(EP_PWT_CM, 0);
        }

        if(m_ShiftPhase != m_OldPhase)
        {
            // send this too, sometimes the slider disappears, dunno why :(
            SendUpdateWorldState(EP_UI_TOWER_SLIDER_DISPLAY, 1);
            // send these updates to only the ones in this objective
            uint32 phase = (uint32)ceil(( m_ShiftPhase + m_ShiftMaxPhase) / ( 2 * m_ShiftMaxPhase ) * 100.0f);
            SendUpdateWorldState(EP_UI_TOWER_SLIDER_POS, phase);
            // send this too, sometimes it resets :S
            SendUpdateWorldState(EP_UI_TOWER_SLIDER_N, m_NeutralValue);
        }
        return true;
    }
    return false;
}
Exemplo n.º 12
0
bool OutdoorPvPObjectiveHP::Update(uint32 diff)
{
    // if status changed:
    if(OutdoorPvPObjective::Update(diff))
    {
        if(m_OldState != m_State)
        {
            uint32 field = 0;
            switch(m_OldState)
            {
                case OBJECTIVESTATE_NEUTRAL:
                    field = HP_MAP_N[m_TowerType];
                    break;
                case OBJECTIVESTATE_ALLIANCE:
                    field = HP_MAP_A[m_TowerType];
                    if(((OutdoorPvPHP*)m_PvP)->m_AllianceTowersControlled)
                        ((OutdoorPvPHP*)m_PvP)->m_AllianceTowersControlled--;
                    sWorld.SendZoneText(OutdoorPvPHPBuffZones[0],objmgr.GetMangosString(HP_LANG_LOOSE_A[m_TowerType],-1));
                    break;
                case OBJECTIVESTATE_HORDE:
                    field = HP_MAP_H[m_TowerType];
                    if(((OutdoorPvPHP*)m_PvP)->m_HordeTowersControlled)
                        ((OutdoorPvPHP*)m_PvP)->m_HordeTowersControlled--;
                    sWorld.SendZoneText(OutdoorPvPHPBuffZones[0],objmgr.GetMangosString(HP_LANG_LOOSE_H[m_TowerType],-1));
                    break;
                case OBJECTIVESTATE_NEUTRAL_ALLIANCE_CHALLENGE:
                    field = HP_MAP_N[m_TowerType];
                    break;
                case OBJECTIVESTATE_NEUTRAL_HORDE_CHALLENGE:
                    field = HP_MAP_N[m_TowerType];
                    break;
                case OBJECTIVESTATE_ALLIANCE_HORDE_CHALLENGE:
                    field = HP_MAP_A[m_TowerType];
                    break;
                case OBJECTIVESTATE_HORDE_ALLIANCE_CHALLENGE:
                    field = HP_MAP_H[m_TowerType];
                    break;
            }

            // send world state update
            if(field)
            {
                m_PvP->SendUpdateWorldState(field, 0);
                field = 0;
            }
            uint8 artkit = 21;
            uint8 artkit2 = HP_TowerArtKit_N[m_TowerType];
            switch(m_State)
            {
                case OBJECTIVESTATE_NEUTRAL:
                    field = HP_MAP_N[m_TowerType];
                    break;
                case OBJECTIVESTATE_ALLIANCE:
                    field = HP_MAP_A[m_TowerType];
                    artkit = 2;
                    artkit2 = HP_TowerArtKit_A[m_TowerType];
                    if(((OutdoorPvPHP*)m_PvP)->m_AllianceTowersControlled<3)
                        ((OutdoorPvPHP*)m_PvP)->m_AllianceTowersControlled++;
                    sWorld.SendZoneText(OutdoorPvPHPBuffZones[0],objmgr.GetMangosString(HP_LANG_CAPTURE_A[m_TowerType],-1));
                    break;
                case OBJECTIVESTATE_HORDE:
                    field = HP_MAP_H[m_TowerType];
                    artkit = 1;
                    artkit2 = HP_TowerArtKit_H[m_TowerType];
                    if(((OutdoorPvPHP*)m_PvP)->m_HordeTowersControlled<3)
                        ((OutdoorPvPHP*)m_PvP)->m_HordeTowersControlled++;
                    sWorld.SendZoneText(OutdoorPvPHPBuffZones[0],objmgr.GetMangosString(HP_LANG_CAPTURE_H[m_TowerType],-1));
                    break;
                case OBJECTIVESTATE_NEUTRAL_ALLIANCE_CHALLENGE:
                    field = HP_MAP_N[m_TowerType];
                    break;
                case OBJECTIVESTATE_NEUTRAL_HORDE_CHALLENGE:
                    field = HP_MAP_N[m_TowerType];
                    break;
                case OBJECTIVESTATE_ALLIANCE_HORDE_CHALLENGE:
                    field = HP_MAP_A[m_TowerType];
                    artkit = 2;
                    artkit2 = HP_TowerArtKit_A[m_TowerType];
                    break;
                case OBJECTIVESTATE_HORDE_ALLIANCE_CHALLENGE:
                    field = HP_MAP_H[m_TowerType];
                    artkit = 1;
                    artkit2 = HP_TowerArtKit_H[m_TowerType];
                    break;
            }

            Map* map = m_PvP->GetMap();
            GameObject* flag = map->GetGameObject(m_CapturePoint);
            GameObject* flag2 = map->GetGameObject(m_Objects[m_TowerType]);
            if(flag)
                flag->SetGoArtKit(artkit);
            if(flag2)
                flag2->SetGoArtKit(artkit2);

            // send world state update
            if(field)
                m_PvP->SendUpdateWorldState(field, 1);

            // complete quest objective
            if(m_State == OBJECTIVESTATE_ALLIANCE || m_State == OBJECTIVESTATE_HORDE)
                SendObjectiveComplete(HP_CREDITMARKER[m_TowerType], 0);
        }

        if(m_ShiftPhase != m_OldPhase)
        {
            SendUpdateWorldState(HP_UI_TOWER_SLIDER_N, m_NeutralValue);
            // send these updates to only the ones in this objective
            uint32 phase = (uint32)ceil(( m_ShiftPhase + m_ShiftMaxPhase) / ( 2 * m_ShiftMaxPhase ) * 100.0f);
            SendUpdateWorldState(HP_UI_TOWER_SLIDER_POS, phase);
            // send this too, sometimes the slider disappears, dunno why :(
            SendUpdateWorldState(HP_UI_TOWER_SLIDER_DISPLAY, 1);
        }
        return true;
    }
    return false;
}
Exemplo n.º 13
0
bool OutdoorPvPObjectiveNA::Update(uint32 diff)
{
    // let the controlling faction advance in phase
    bool capturable = false;
    if(m_ControllingFaction == ALLIANCE && m_AllianceActivePlayerCount > m_HordeActivePlayerCount)
        capturable = true;
    else if(m_ControllingFaction == HORDE && m_AllianceActivePlayerCount < m_HordeActivePlayerCount)
        capturable = true;

    if(m_GuardCheckTimer < diff)
    {
        m_GuardCheckTimer = NA_GUARD_CHECK_TIME;
        uint32 cnt = GetAliveGuardsCount();
        if(cnt != m_GuardsAlive)
        {
            m_GuardsAlive = cnt;
            if(m_GuardsAlive == 0)
                m_capturable = true;
            // update the guard count for the players in zone
            m_PvP->SendUpdateWorldState(NA_UI_GUARDS_LEFT,m_GuardsAlive);
        }
    } else m_GuardCheckTimer -= diff;

    if((m_capturable || capturable) && OutdoorPvPObjective::Update(diff))
    {
        if(m_RespawnTimer < diff)
        {
            // if the guards have been killed, then the challenger has one hour to take over halaa.
            // in case they fail to do it, the guards are respawned, and they have to start again.
            if(m_ControllingFaction)
                FactionTakeOver(m_ControllingFaction);
            m_RespawnTimer = NA_RESPAWN_TIME;
        } else m_RespawnTimer -= diff;

        if(m_OldState != m_State)
        {
            uint8 artkit = 21;
            switch(m_State)
            {
                case OBJECTIVESTATE_NEUTRAL:
                    m_HalaaState = HALAA_N;
                    break;
                case OBJECTIVESTATE_ALLIANCE:
                    m_HalaaState = HALAA_A;
                    FactionTakeOver(ALLIANCE);
                    artkit = 2;
                    break;
                case OBJECTIVESTATE_HORDE:
                    m_HalaaState = HALAA_H;
                    FactionTakeOver(HORDE);
                    artkit = 1;
                    break;
                case OBJECTIVESTATE_NEUTRAL_ALLIANCE_CHALLENGE:
                    m_HalaaState = HALAA_N_A;
                    break;
                case OBJECTIVESTATE_NEUTRAL_HORDE_CHALLENGE:
                    m_HalaaState = HALAA_N_H;
                    break;
                case OBJECTIVESTATE_ALLIANCE_HORDE_CHALLENGE:
                    m_HalaaState = HALAA_N_A;
                    artkit = 2;
                    break;
                case OBJECTIVESTATE_HORDE_ALLIANCE_CHALLENGE:
                    m_HalaaState = HALAA_N_H;
                    artkit = 1;
                    break;
            }

            Map* map = m_PvP->GetMap();
            GameObject* flag = map->GetGameObject(m_CapturePoint);
            if(flag)
                flag->SetGoArtKit(artkit);

            UpdateHalaaWorldState();
        }

        if(m_ShiftPhase != m_OldPhase)
        {
            // send this too, sometimes the slider disappears, dunno why :(
            SendUpdateWorldState(NA_UI_TOWER_SLIDER_DISPLAY, 1);
            // send these updates to only the ones in this objective
            uint32 phase = (uint32)ceil(( m_ShiftPhase + m_ShiftMaxPhase) / ( 2 * m_ShiftMaxPhase ) * 100.0f);
            SendUpdateWorldState(NA_UI_TOWER_SLIDER_POS, phase);
            SendUpdateWorldState(NA_UI_TOWER_SLIDER_N, m_NeutralValue);
        }
        return true;
    }
    return false;
}
Exemplo n.º 14
0
/* Invoked if a player used a banner as a gameobject */
void BattleGroundAB::EventPlayerClickedOnFlag(Player *source, GameObject* /*target_obj*/)
{
    if (GetStatus() != STATUS_IN_PROGRESS)
        return;

    uint8 node = BG_AB_NODE_STABLES;
    Map * tmpMap = source->GetMap();
    GameObject* obj = tmpMap->GetGameObject(m_BgObjects[node*8+7]);
    while ((node < BG_AB_DYNAMIC_NODES_COUNT) && ((!obj) || (!source->IsWithinDistInMap(obj,10))))
    {
        ++node;
        obj = tmpMap->GetGameObject(m_BgObjects[node*8+BG_AB_OBJECT_AURA_CONTESTED]);
    }

    if (node == BG_AB_DYNAMIC_NODES_COUNT)
    {
        // this means our player isn't close to any of banners - maybe cheater ??
        return;
    }

    uint8 teamIndex = GetTeamIndexByTeamId(source->GetBGTeam());

    // Message to chatlog
    char buf[256];
    uint8 type = (teamIndex == 0) ? CHAT_MSG_BG_SYSTEM_ALLIANCE : CHAT_MSG_BG_SYSTEM_HORDE;

    // Check if player really could use this banner, not cheated
    if (!(m_Nodes[node] == 0 || teamIndex == m_Nodes[node]%2))
        return;

    source->RemoveAurasWithInterruptFlags(AURA_INTERRUPT_FLAG_ENTER_PVP_COMBAT);
    uint32 sound = 0;
    // If node is neutral, change to contested
    if (m_Nodes[node] == BG_AB_NODE_TYPE_NEUTRAL)
    {
        UpdatePlayerScore(source, SCORE_BASES_ASSAULTED, 1);
        m_prevNodes[node] = m_Nodes[node];
        m_Nodes[node] = teamIndex + 1;
        // burn current neutral banner
        _DelBanner(node, BG_AB_NODE_TYPE_NEUTRAL, 0);
        // create new contested banner
        _CreateBanner(node, BG_AB_NODE_TYPE_CONTESTED, teamIndex, true);
        _SendNodeUpdate(node);
        m_NodeTimers[node] = BG_AB_FLAG_CAPTURING_TIME;
        sprintf(buf, GetTrinityString(LANG_BG_AB_NODE_CLAIMED), _GetNodeName(node), (teamIndex == 0) ? GetTrinityString(LANG_BG_AB_ALLY) : GetTrinityString(LANG_BG_AB_HORDE));
        sound = SOUND_NODE_CLAIMED;
        SendObjectiveComplete(BG_AB_CREDITMARKER[node], teamIndex,BG_AB_NodePositions[node][1],BG_AB_NodePositions[node][2]);
    }
    // If node is contested
    else if ((m_Nodes[node] == BG_AB_NODE_STATUS_ALLY_CONTESTED) || (m_Nodes[node] == BG_AB_NODE_STATUS_HORDE_CONTESTED))
    {
        // If last state is NOT occupied, change node to enemy-contested
        if (m_prevNodes[node] < BG_AB_NODE_TYPE_OCCUPIED)
        {
            UpdatePlayerScore(source, SCORE_BASES_ASSAULTED, 1);
            m_prevNodes[node] = m_Nodes[node];
            m_Nodes[node] = teamIndex + BG_AB_NODE_TYPE_CONTESTED;
            // burn current contested banner
            _DelBanner(node, BG_AB_NODE_TYPE_CONTESTED, !teamIndex);
            // create new contested banner
            _CreateBanner(node, BG_AB_NODE_TYPE_CONTESTED, teamIndex, true);
            _SendNodeUpdate(node);
            m_NodeTimers[node] = BG_AB_FLAG_CAPTURING_TIME;
            sprintf(buf, GetTrinityString(LANG_BG_AB_NODE_ASSAULTED), _GetNodeName(node));
            SendObjectiveComplete(BG_AB_CREDITMARKER[node], teamIndex,BG_AB_NodePositions[node][1],BG_AB_NodePositions[node][2]);
        }
        // If contested, change back to occupied
        else
        {
            UpdatePlayerScore(source, SCORE_BASES_DEFENDED, 1);
            m_prevNodes[node] = m_Nodes[node];
            m_Nodes[node] = teamIndex + BG_AB_NODE_TYPE_OCCUPIED;
            // burn current contested banner
            _DelBanner(node, BG_AB_NODE_TYPE_CONTESTED, !teamIndex);
            // create new occupied banner
            _CreateBanner(node, BG_AB_NODE_TYPE_OCCUPIED, teamIndex, true);
            _SendNodeUpdate(node);
            m_NodeTimers[node] = 0;
            _NodeOccupied(node,(teamIndex == 0) ? ALLIANCE:HORDE);
            sprintf(buf, GetTrinityString(LANG_BG_AB_NODE_DEFENDED), _GetNodeName(node));
        }
        sound = (teamIndex == 0) ? SOUND_NODE_ASSAULTED_ALLIANCE : SOUND_NODE_ASSAULTED_HORDE;
    }
    // If node is occupied, change to enemy-contested
    else
    {
        UpdatePlayerScore(source, SCORE_BASES_ASSAULTED, 1);
        m_prevNodes[node] = m_Nodes[node];
        m_Nodes[node] = teamIndex + BG_AB_NODE_TYPE_CONTESTED;
        // burn current occupied banner
        _DelBanner(node, BG_AB_NODE_TYPE_OCCUPIED, !teamIndex);
        // create new contested banner
        _CreateBanner(node, BG_AB_NODE_TYPE_CONTESTED, teamIndex, true);
        _SendNodeUpdate(node);
        _NodeDeOccupied(node);
        m_NodeTimers[node] = BG_AB_FLAG_CAPTURING_TIME;
        sprintf(buf, GetTrinityString(LANG_BG_AB_NODE_ASSAULTED), _GetNodeName(node));
        sound = (teamIndex == 0) ? SOUND_NODE_ASSAULTED_ALLIANCE : SOUND_NODE_ASSAULTED_HORDE;
        SendObjectiveComplete(BG_AB_CREDITMARKER[node], teamIndex,BG_AB_NodePositions[node][1],BG_AB_NodePositions[node][2]);
    }
    WorldPacket data;
    ChatHandler::FillMessageData(&data, source->GetSession(), type, LANG_UNIVERSAL, NULL, source->GetGUID(), buf, NULL);
    SendPacketToAll(&data);
    // If node is occupied again, send "X has taken the Y" msg.
    if (m_Nodes[node] >= BG_AB_NODE_TYPE_OCCUPIED)
    {
        sprintf(buf, GetTrinityString(LANG_BG_AB_NODE_TAKEN), (teamIndex == 0) ? GetTrinityString(LANG_BG_AB_ALLY) : GetTrinityString(LANG_BG_AB_HORDE), _GetNodeName(node));
        ChatHandler::FillMessageData(&data, NULL, type, LANG_UNIVERSAL, NULL, 0, buf, NULL);
        SendPacketToAll(&data);
    }
    PlaySoundToAll(sound);
}