当前位置: 首页>>代码示例>>C++>>正文


C++ DelObject函数代码示例

本文整理汇总了C++中DelObject函数的典型用法代码示例。如果您正苦于以下问题:C++ DelObject函数的具体用法?C++ DelObject怎么用?C++ DelObject使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了DelObject函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: DelObject

bool BattlegroundNA::PreUpdateImpl(uint32 diff)
{
    if (doordelete)
    {
        if (doordelete <= diff)
        {
            for (uint32 i = BG_NA_OBJECT_DOOR_1; i <= BG_NA_OBJECT_DOOR_2; ++i)
                DelObject(i);
            doordelete = 0;
        }
        else
            doordelete -= diff;
    }
    return true;
}
开发者ID:Rastrian,项目名称:CataCore,代码行数:15,代码来源:BattlegroundNA.cpp

示例2: DelObject

void OPvPCapturePointEP_NPT::SummonGO(uint32 team)
{
    if (m_SummonedGOSide != team)
    {
        m_SummonedGOSide = team;
        DelObject(EP_NPT_BUFF);
        AddObject(EP_NPT_BUFF, EP_NPT_LordaeronShrine.entry, EP_NPT_LordaeronShrine.map, EP_NPT_LordaeronShrine.pos, EP_NPT_LordaeronShrine.rot);

        Map* map = sMapMgr->FindMap(0, 0);
        auto bounds = map->GetGameObjectBySpawnIdStore().equal_range(m_Objects[EP_NPT_BUFF]);
        for (auto itr = bounds.first; itr != bounds.second; ++itr)
            if (GameObject* go = itr->second)
                go->SetFaction(team == ALLIANCE ? FACTION_ALLIANCE_GENERIC : FACTION_HORDE_GENERIC);
    }
}
开发者ID:Refuge89,项目名称:TrinityCore,代码行数:15,代码来源:OutdoorPvPEP.cpp

示例3: DelObject

void BattleGroundNA::Update(time_t diff)
{
    BattleGround::Update(diff);

    if (GetStatus() == STATUS_IN_PROGRESS)
    {
        m_TimeElapsedSinceBeggining += diff;

        if (m_TimeElapsedSinceBeggining >= BG_NA_DOOR_DESPAWN_TIMER && !m_doorDespawned)
        {
            m_doorDespawned = true;
            for (uint32 i = BG_NA_OBJECT_DOOR_1; i <= BG_NA_OBJECT_DOOR_2; i++)
                DelObject(i);
        }
    }
}
开发者ID:Blumfield,项目名称:TBCPvP,代码行数:16,代码来源:BattlegroundNA.cpp

示例4: GetClosestGraveYard

void BattlegroundIC::_NodeDeOccupied(uint8 node)
{
    if(!m_BgCreatures[node] || !GetBGCreature(node))
        return;

    std::vector<uint64> ghost_list = m_ReviveQueue[m_BgCreatures[node]];
    if (!ghost_list.empty())
    {
        WorldSafeLocsEntry const *ClosestGrave = NULL;
        for (std::vector<uint64>::const_iterator itr = ghost_list.begin(); itr != ghost_list.end(); ++itr)
        {
            Player* plr = sObjectMgr.GetPlayer(*itr);
            if (!plr)
                continue;

            if (!ClosestGrave)                              // cache
                ClosestGrave = GetClosestGraveYard(plr);

            if (ClosestGrave)
                plr->TeleportTo(GetMapId(), ClosestGrave->x, ClosestGrave->y, ClosestGrave->z, plr->GetOrientation());
        }
    }
    //Remove spiritguide
    DelCreature(node);

    switch(node)
    {
    case BG_IC_NODE_WORKSHOP:
        DeSpawnNpcType(IC_TYPE_DEMOLISSER_H);
        DeSpawnNpcType(IC_TYPE_SIEGE_H);
        DeSpawnNpcType(IC_TYPE_DEMOLISSER_A);
        DeSpawnNpcType(IC_TYPE_SIEGE_A);
        break ;
    case BG_IC_NODE_DOCK:
        //pop de catapulte et lanceur de glaive
        DeSpawnNpcType(IC_TYPE_DOCKVEHICLE_A);
        DeSpawnNpcType(IC_TYPE_DOCKVEHICLE_H);
        break ;
    case BG_IC_NODE_HANGAR:
        for (int i = 0 ; i < MAX_BG_IC_OBJ; ++i)
        {
            if(BG_IC_OBJ[i].type == IC_TYPE_GUNSHIPTELEPORTER)
                DelObject(BG_IC_OBJ[i].id);
        }        
        break ;
    }
}
开发者ID:sensibob,项目名称:tempestcore,代码行数:47,代码来源:BattlegroundIC.cpp

示例5: DelObject

void OPvPCapturePointEP_NPT::SummonGO(uint32 team) {
	if (m_SummonedGOSide != team) {
		m_SummonedGOSide = 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);
		GameObject * go = HashMapHolder<GameObject>::Find(
				m_Objects[EP_NPT_BUFF]);
		if (go)
			go->SetUInt32Value(GAMEOBJECT_FACTION,
					(team == ALLIANCE ? 84 : 83));
	}
}
开发者ID:Bootz,项目名称:DeepshjirRepack,代码行数:17,代码来源:OutdoorPvPEP.cpp

示例6: getGateIdFromDamagedOrDestroyEventId

void BattlegroundSA::DestroyGate(Player* player, GameObject* go)
{
    uint32 i = getGateIdFromDamagedOrDestroyEventId(go->GetGOInfo()->building.destroyedEvent);
    if (!GateStatus[i])
        return;

    if (GameObject* g = GetBGObject(i))
    {
        if (g->GetGOValue()->Building.Health == 0)
        {
            GateStatus[i] = BG_SA_GATE_DESTROYED;
            uint32 uws = getWorldStateFromGateId(i);
            if (uws)
                UpdateWorldState(uws, GateStatus[i]);
            bool rewardHonor = true;
            gateDestroyed = true;
            switch (i)
            {
                case BG_SA_GREEN_GATE:
                    if (GateStatus[BG_SA_BLUE_GATE] == BG_SA_GATE_DESTROYED)
                        rewardHonor = false;
                    break;
                case BG_SA_BLUE_GATE:
                    if (GateStatus[BG_SA_GREEN_GATE] == BG_SA_GATE_DESTROYED)
                        rewardHonor = false;
                    break;
                case BG_SA_RED_GATE:
                    if (GateStatus[BG_SA_PURPLE_GATE] == BG_SA_GATE_DESTROYED)
                        rewardHonor = false;
                    break;
                case BG_SA_PURPLE_GATE:
                    if (GateStatus[BG_SA_RED_GATE] == BG_SA_GATE_DESTROYED)
                        rewardHonor = false;
                    break;
                default:
                    break;
            }

            if (i < 5)
                DelObject(i + 14);
            UpdatePlayerScore(player, SCORE_DESTROYED_WALL, 1);
            if (rewardHonor)
                UpdatePlayerScore(player, SCORE_BONUS_HONOR, GetBonusHonorFromKill(1));
        }
    }
}
开发者ID:Ayik0,项目名称:DeathCore_5.4.8,代码行数:46,代码来源:BattlegroundSA.cpp

示例7: switch

void BattleGroundSA::DestroyGate(uint32 i, Player* pl)
{
    if (!GateStatus[i])
        return;

    if (GameObject* g = GetBGObject(i))
    {
        if (g->GetGOValue()->building.health == 0)
        {
            GateStatus[i] = BG_SA_GATE_DESTROYED;
            uint32 uws = 0;
            switch(i)
            {
            case 0:
                uws = BG_SA_GREEN_GATEWS;
                break;
            case 1:
                uws = BG_SA_YELLOW_GATEWS;
                break;
            case 2:
                uws = BG_SA_BLUE_GATEWS;
                break;
            case 3:
                uws = BG_SA_RED_GATEWS;
                break;
            case 4:
                uws = BG_SA_PURPLE_GATEWS;
                break;
            case 5:
                uws = BG_SA_ANCIENT_GATEWS;
                break;
            default:
                ASSERT(false);
                break;
            }

            if (i < 5)
                DelObject(i+9);
            UpdateWorldState(uws, GateStatus[i]);
            UpdatePlayerScore(pl,SCORE_DESTROYED_WALL, 1);
        }
    }
}
开发者ID:Rhyuk,项目名称:Dev,代码行数:43,代码来源:BattleGroundSA.cpp

示例8: GetGateIDFromDestroyEventID

void BattlegroundSA::DestroyGate(Player* pl, GameObject* /*go*/, uint32 destroyedEvent)
{
    uint32 i = GetGateIDFromDestroyEventID(destroyedEvent);
    if (!GateStatus[i])
        return;

    if (GameObject* g = GetBGObject(i))
    {
        if (g->GetGOValue()->building.health == 0)
        {
            GateStatus[i] = BG_SA_GATE_DESTROYED;
            uint32 uws = GetWorldStateFromGateID(i);
            if (uws)
                UpdateWorldState(uws, GateStatus[i]);
            bool rewardHonor = true;
            switch(i)
            {
                case BG_SA_GREEN_GATE:
                    if (GateStatus[BG_SA_BLUE_GATE] == BG_SA_GATE_DESTROYED)
                        rewardHonor = false;
                    break;
                case BG_SA_BLUE_GATE:
                    if (GateStatus[BG_SA_GREEN_GATE] == BG_SA_GATE_DESTROYED)
                        rewardHonor = false;
                    break;
                case BG_SA_RED_GATE:
                    if (GateStatus[BG_SA_PURPLE_GATE] == BG_SA_GATE_DESTROYED)
                        rewardHonor = false;
                    break;
                case BG_SA_PURPLE_GATE:
                    if (GateStatus[BG_SA_RED_GATE] == BG_SA_GATE_DESTROYED)
                        rewardHonor = false;
                    break;
            }

            if (i < 5)
                DelObject(i+9);
            UpdatePlayerScore(pl,SCORE_DESTROYED_WALL, 1);
            if (rewardHonor)
                UpdatePlayerScore(pl,SCORE_BONUS_HONOR,(GetBonusHonorFromKill(1)));
        }
    }
}
开发者ID:mmihail,项目名称:trinitycore10353,代码行数:43,代码来源:BattlegroundSA.cpp

示例9: notifyDeleted

void
WeakHandleable::removeHandle()
{
	bool bDeleteSelf = false;
	{
		SyncHandle;

		m_iNumHandles--;

		if (m_iNumHandles == 0)
		{
			notifyDeleted();
			if (m_iNumHandles == 0)
				bDeleteSelf = true;
		}
	}

	if (bDeleteSelf)
		DelObject(this);
}
开发者ID:tomazos,项目名称:Folderscope,代码行数:20,代码来源:WeakHandleable.cpp

示例10: OnLButtonDblclk

LRESULT OnLButtonDblclk(HWND hWnd,WPARAM wParam,LPARAM lParam)
{
    int TempSel;
    TCHAR *pText;

    TempSel=FindObject(LOWORD(lParam),HIWORD(lParam));
    if (TempSel == -1) {
        return 0;
    }
    if (arObj[TempSel]->Type == DT_TEXT) {
        pText=arObj[TempSel]->Text;
        if (DialogBoxParam(g_hInst, MAKEINTRESOURCE(IDD_TEXT),hWnd,
                           TextDlgProc,(LPARAM)&pText) == IDOK) {
            if (lstrlen(pText) == 0) {
                DelObject(TempSel);
            } else {
                arObj[arNum-1]->Text=pText;
                arObj[arNum-1]->Len=lstrlen(pText)+1;
            }
            InvalidateRect(hWndMain,NULL,TRUE);
        }
    }
    return 0;
}
开发者ID:MaybeS,项目名称:when_i_was_a_kid,代码行数:24,代码来源:ApiDraw.cpp

示例11: if

void OPvPCapturePointEP_NPT::ChangeState() {
	// if changing from controlling alliance to horde or vice versa
	if (m_OldState == OBJECTIVESTATE_ALLIANCE && m_OldState != m_State) {
		sWorld->SendZoneText(
				EP_GraveYardZone,
				sObjectMgr->GetArkCoreStringForDBCLocale(
						LANG_OPVP_EP_LOOSE_NPT_A));
		((OutdoorPvPEP*) m_PvP)->EP_Controls[EP_NPT] = 0;
	} else if (m_OldState == OBJECTIVESTATE_HORDE && m_OldState != m_State) {
		sWorld->SendZoneText(
				EP_GraveYardZone,
				sObjectMgr->GetArkCoreStringForDBCLocale(
						LANG_OPVP_EP_LOOSE_NPT_H));
		((OutdoorPvPEP*) m_PvP)->EP_Controls[EP_NPT] = 0;
	}

	uint32 artkit = 21;

	switch (m_State) {
	case OBJECTIVESTATE_ALLIANCE:
		m_TowerState = EP_TS_A;
		artkit = 2;
		SummonGO(ALLIANCE);
		((OutdoorPvPEP*) m_PvP)->EP_Controls[EP_NPT] = ALLIANCE;
		if (m_OldState != m_State)
			sWorld->SendZoneText(
					EP_GraveYardZone,
					sObjectMgr->GetArkCoreStringForDBCLocale(
							LANG_OPVP_EP_CAPTURE_NPT_A));
		break;
	case OBJECTIVESTATE_HORDE:
		m_TowerState = EP_TS_H;
		artkit = 1;
		SummonGO(HORDE);
		((OutdoorPvPEP*) m_PvP)->EP_Controls[EP_NPT] = HORDE;
		if (m_OldState != m_State)
			sWorld->SendZoneText(
					EP_GraveYardZone,
					sObjectMgr->GetArkCoreStringForDBCLocale(
							LANG_OPVP_EP_CAPTURE_NPT_H));
		break;
	case OBJECTIVESTATE_NEUTRAL:
		m_TowerState = EP_TS_N;
		m_SummonedGOSide = 0;
		DelObject(EP_NPT_BUFF);
		break;
	case OBJECTIVESTATE_NEUTRAL_ALLIANCE_CHALLENGE:
		m_TowerState = EP_TS_N_A;
		break;
	case OBJECTIVESTATE_HORDE_ALLIANCE_CHALLENGE:
		m_TowerState = EP_TS_N_A;
		m_SummonedGOSide = 0;
		DelObject(EP_NPT_BUFF);
		break;
	case OBJECTIVESTATE_NEUTRAL_HORDE_CHALLENGE:
		m_TowerState = EP_TS_N_H;
		break;
	case OBJECTIVESTATE_ALLIANCE_HORDE_CHALLENGE:
		m_TowerState = EP_TS_N_H;
		m_SummonedGOSide = 0;
		DelObject(EP_NPT_BUFF);
		break;
	}

	GameObject* flag = HashMapHolder<GameObject>::Find(m_capturePointGUID);
	GameObject* flag2 = HashMapHolder<GameObject>::Find(
			m_Objects[EP_NPT_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_NPT_CM, 0);
}
开发者ID:Bootz,项目名称:DeepshjirRepack,代码行数:80,代码来源:OutdoorPvPEP.cpp

示例12: SendTransportsRemove

bool BattlegroundSA::ResetObjs()
{
    /*for (BattlegroundPlayerMap::const_iterator itr = GetPlayers().begin(); itr != GetPlayers().end(); ++itr)
        if (Player* player = ObjectAccessor::FindPlayer(itr->first))
            SendTransportsRemove(player);*/

    uint32 atF = BG_SA_Factions[Attackers];
    uint32 defF = BG_SA_Factions[Attackers ? TEAM_ALLIANCE : TEAM_HORDE];

    for (uint8 i = 0; i < BG_SA_MAXOBJ; i++)
        DelObject(i);

    for (uint8 i = 0; i < BG_SA_MAXNPC; i++)
        DelCreature(i);

    for (uint8 i = BG_SA_MAXNPC; i < BG_SA_MAXNPC + BG_SA_MAX_GY; i++)
        DelCreature(i);

    for (uint8 i = 0; i < 6; i++)
        GateStatus[i] = BG_SA_GATE_OK;

    for (uint8 i = 0; i <= BG_SA_PORTAL_DEFFENDER_RED; i++)
    {
        if (!AddObject(i, BG_SA_ObjEntries[i], BG_SA_ObjSpawnlocs[i][0], BG_SA_ObjSpawnlocs[i][1], BG_SA_ObjSpawnlocs[i][2], BG_SA_ObjSpawnlocs[i][3], 0, 0, 0, 0, RESPAWN_ONE_DAY))
            return false;
    }

    /*for (uint8 i = BG_SA_BOAT_ONE; i <= BG_SA_BOAT_TWO; i++)
    {
        uint32 boatid = 0;
        switch (i)
        {
            case BG_SA_BOAT_ONE:
                boatid = Attackers ? BG_SA_BOAT_ONE_H : BG_SA_BOAT_ONE_A;
                break;
            case BG_SA_BOAT_TWO:
                boatid = Attackers ? BG_SA_BOAT_TWO_H : BG_SA_BOAT_TWO_A;
                break;
            default:
                break;
        }
        if (!AddObject(i, boatid, BG_SA_ObjSpawnlocs[i][0],
          BG_SA_ObjSpawnlocs[i][1],
          BG_SA_ObjSpawnlocs[i][2]+(Attackers ? -3.750f: 0),
          BG_SA_ObjSpawnlocs[i][3], 0, 0, 0, 0, RESPAWN_ONE_DAY))
            return false;
    }*/

    for (uint8 i = BG_SA_SIGIL_1; i <= BG_SA_LEFT_FLAGPOLE; i++)
    {
        if (!AddObject(i, BG_SA_ObjEntries[i],
            BG_SA_ObjSpawnlocs[i][0], BG_SA_ObjSpawnlocs[i][1],
            BG_SA_ObjSpawnlocs[i][2], BG_SA_ObjSpawnlocs[i][3],
            0, 0, 0, 0, RESPAWN_ONE_DAY))
        return false;
    }

    // MAD props for Kiper for discovering those values - 4 hours of his work.
    //GetBGObject(BG_SA_BOAT_ONE)->UpdateRotationFields(1.0f, 0.0002f);
    //GetBGObject(BG_SA_BOAT_TWO)->UpdateRotationFields(1.0f, 0.00001f);
    //SpawnBGObject(BG_SA_BOAT_ONE, RESPAWN_IMMEDIATELY);
    //SpawnBGObject(BG_SA_BOAT_TWO, RESPAWN_IMMEDIATELY);

    //Cannons and demolishers - NPCs are spawned
    //By capturing GYs.
    for (uint8 i = 0; i < BG_SA_DEMOLISHER_5; i++)
    {
        if (!AddCreature(BG_SA_NpcEntries[i], i, (Attackers == TEAM_ALLIANCE ? TEAM_HORDE : TEAM_ALLIANCE),
              BG_SA_NpcSpawnlocs[i][0], BG_SA_NpcSpawnlocs[i][1],
              BG_SA_NpcSpawnlocs[i][2], BG_SA_NpcSpawnlocs[i][3], 600))
        return false;
    }

    OverrideGunFaction();
    DemolisherStartState(true);

    for (uint8 i = 0; i <= BG_SA_PORTAL_DEFFENDER_RED; i++)
    {
        SpawnBGObject(i, RESPAWN_IMMEDIATELY);
        GetBGObject(i)->SetUInt32Value(GAMEOBJECT_FIELD_FACTION_TEMPLATE, defF);
    }

    GetBGObject(BG_SA_TITAN_RELIC)->SetUInt32Value(GAMEOBJECT_FIELD_FACTION_TEMPLATE, atF);
    GetBGObject(BG_SA_TITAN_RELIC)->Refresh();

    for (uint8 i = 0; i <= 5; i++)
        GateStatus[i] = BG_SA_GATE_OK;

    TotalTime = 0;
    ShipsStarted = false;
    gateDestroyed = false;

    //Graveyards
    for (uint8 i = 0; i < BG_SA_MAX_GY; i++)
    {
        WorldSafeLocsEntry const* sg = NULL;
        sg = sWorldSafeLocsStore.LookupEntry(BG_SA_GYEntries[i]);

        if (!sg)
            return false;
//.........这里部分代码省略.........
开发者ID:cooler-SAI,项目名称:PandaFire,代码行数:101,代码来源:BattlegroundSA.cpp

示例13: switch

void BattlegroundSA::ProcessEvent(WorldObject* obj, uint32 eventId, WorldObject* invoker /*= NULL*/)
{
    if (GameObject* go = obj->ToGameObject())
    {
        switch (go->GetGoType())
        {
            case GAMEOBJECT_TYPE_GOOBER:
                if (invoker)
                    if (eventId == BG_SA_EVENT_TITAN_RELIC_ACTIVATED)
                        TitanRelicActivated(invoker->ToPlayer());
                break;
            case GAMEOBJECT_TYPE_DESTRUCTIBLE_BUILDING:
            {
                if (GateInfo const* gate = GetGate(obj->GetEntry()))
                {
                    uint8 gateId = gate->GateId;

                    // damaged
                    if (eventId == go->GetGOInfo()->building.damagedEvent)
                    {
                        GateStatus[gateId] = BG_SA_GATE_DAMAGED;

                        if (Creature* c = obj->FindNearestCreature(NPC_WORLD_TRIGGER, 500.0f))
                            SendChatMessage(c, gate->DamagedText, invoker);

                        PlaySoundToAll(Attackers == TEAM_ALLIANCE ? SOUND_WALL_ATTACKED_ALLIANCE : SOUND_WALL_ATTACKED_HORDE);
                    }
                    // destroyed
                    else if (eventId == go->GetGOInfo()->building.destroyedEvent)
                    {
                        GateStatus[gate->GateId] = BG_SA_GATE_DESTROYED;
                        _gateDestroyed = true;

                        if (gateId < 5)
                            DelObject(gateId + 14);

                        if (Creature* c = obj->FindNearestCreature(NPC_WORLD_TRIGGER, 500.0f))
                            SendChatMessage(c, gate->DestroyedText, invoker);

                        PlaySoundToAll(Attackers == TEAM_ALLIANCE ? SOUND_WALL_DESTROYED_ALLIANCE : SOUND_WALL_DESTROYED_HORDE);

                        bool rewardHonor = true;
                        switch (gateId)
                        {
                            case BG_SA_GREEN_GATE:
                                if (GateStatus[BG_SA_BLUE_GATE] == BG_SA_GATE_DESTROYED)
                                    rewardHonor = false;
                                break;
                            case BG_SA_BLUE_GATE:
                                if (GateStatus[BG_SA_GREEN_GATE] == BG_SA_GATE_DESTROYED)
                                    rewardHonor = false;
                                break;
                            case BG_SA_RED_GATE:
                                if (GateStatus[BG_SA_PURPLE_GATE] == BG_SA_GATE_DESTROYED)
                                    rewardHonor = false;
                                break;
                            case BG_SA_PURPLE_GATE:
                                if (GateStatus[BG_SA_RED_GATE] == BG_SA_GATE_DESTROYED)
                                    rewardHonor = false;
                                break;
                            default:
                                break;
                        }

                        if (invoker)
                        {
                            if (Unit* unit = invoker->ToUnit())
                            {
                                if (Player* player = unit->GetCharmerOrOwnerPlayerOrPlayerItself())
                                {
                                    UpdatePlayerScore(player, SCORE_DESTROYED_WALL, 1);
                                    if (rewardHonor)
                                        UpdatePlayerScore(player, SCORE_BONUS_HONOR, GetBonusHonorFromKill(1));
                                }
                            }
                        }
                    }
                    else
                        break;

                    UpdateWorldState(gate->WorldState, GateStatus[gateId]);
                }
                break;
            }
            default:
                break;
        }
    }
}
开发者ID:redlaine,项目名称:TrinityCore,代码行数:89,代码来源:BattlegroundSA.cpp

示例14: GetNextBanner

void BattlegroundIC::EventPlayerClickedOnFlag(Player* player, GameObject* target_obj)
{
    if (GetStatus() != STATUS_IN_PROGRESS)
        return;

    // All the node points are iterated to find the clicked one
    for (uint8 i = 0; i < MAX_NODE_TYPES; ++i)
    {
        if (nodePoint[i].gameobject_entry == target_obj->GetEntry())
        {
            // THIS SHOULD NEEVEER HAPPEN
            if (nodePoint[i].faction == player->GetTeamId())
                return;

            uint32 nextBanner = GetNextBanner(&nodePoint[i], player->GetTeamId(), false);

            // we set the new settings of the nodePoint
            nodePoint[i].faction = player->GetTeamId();
            nodePoint[i].last_entry = nodePoint[i].gameobject_entry;
            nodePoint[i].gameobject_entry = nextBanner;

            // this is just needed if the next banner is grey
            if (nodePoint[i].banners[BANNER_A_CONTESTED] == nextBanner ||
                nodePoint[i].banners[BANNER_H_CONTESTED] == nextBanner)
            {
                nodePoint[i].timer = BANNER_STATE_CHANGE_TIME; // 1 minute for last change (real faction banner)
                nodePoint[i].needChange = true;

                RealocatePlayers(nodePoint[i].nodeType);

                // if we are here means that the point has been lost, or it is the first capture

                if (nodePoint[i].nodeType != NODE_TYPE_REFINERY && nodePoint[i].nodeType != NODE_TYPE_QUARRY)
                    if (BgCreatures[BG_IC_NPC_SPIRIT_GUIDE_1+(nodePoint[i].nodeType)-2])
                        DelCreature(BG_IC_NPC_SPIRIT_GUIDE_1+(nodePoint[i].nodeType)-2);

                UpdatePlayerScore(player, SCORE_BASES_ASSAULTED, 1);

                SendMessage2ToAll(LANG_BG_IC_TEAM_ASSAULTED_NODE_1, CHAT_MSG_BG_SYSTEM_NEUTRAL, player, nodePoint[i].string);
                SendMessage2ToAll(LANG_BG_IC_TEAM_ASSAULTED_NODE_2, CHAT_MSG_BG_SYSTEM_NEUTRAL, player, nodePoint[i].string, (player->GetTeamId() == TEAM_ALLIANCE ? LANG_BG_IC_ALLIANCE : LANG_BG_IC_HORDE));
                HandleContestedNodes(&nodePoint[i]);
            } else if (nextBanner == nodePoint[i].banners[BANNER_A_CONTROLLED] ||
                       nextBanner == nodePoint[i].banners[BANNER_H_CONTROLLED])
                       // if we are going to spawn the definitve faction banner, we dont need the timer anymore
            {
                nodePoint[i].timer = BANNER_STATE_CHANGE_TIME;
                nodePoint[i].needChange = false;
                SendMessage2ToAll(LANG_BG_IC_TEAM_DEFENDED_NODE, CHAT_MSG_BG_SYSTEM_NEUTRAL, player, nodePoint[i].string);
                HandleCapturedNodes(&nodePoint[i], true);
                UpdatePlayerScore(player, SCORE_BASES_DEFENDED, 1);
            }

            GameObject* banner = GetBGObject(nodePoint[i].gameobject_type);

            if (!banner) // this should never happen
                return;

            float cords[4] = {banner->GetPositionX(), banner->GetPositionY(), banner->GetPositionZ(), banner->GetOrientation() };

            DelObject(nodePoint[i].gameobject_type);
            AddObject(nodePoint[i].gameobject_type, nodePoint[i].gameobject_entry, cords[0], cords[1], cords[2], cords[3], 0, 0, 0, 0, RESPAWN_ONE_DAY);

            GetBGObject(nodePoint[i].gameobject_type)->SetUInt32Value(GAMEOBJECT_FACTION, nodePoint[i].faction == TEAM_ALLIANCE ? BG_IC_Factions[1] : BG_IC_Factions[0]);

            if (nodePoint[i].nodeType == NODE_TYPE_WORKSHOP)
            {
                DelObject(BG_IC_GO_SEAFORIUM_BOMBS_1);
                DelObject(BG_IC_GO_SEAFORIUM_BOMBS_2);
            }

            UpdateNodeWorldState(&nodePoint[i]);
            // we dont need iterating if we are here
            // If the needChange bool was set true, we will handle the rest in the Update Map function.
            return;
        }
    }
}
开发者ID:8Infinity8,项目名称:InfinityCore,代码行数:77,代码来源:BattlegroundIC.cpp

示例15: if


//.........这里部分代码省略.........
            del = NA_DESTROYED_ROOST_S;
            add = NA_ROOST_S;
            add2 = NA_BOMB_WAGON_S;
            if (m_ControllingFaction == HORDE)
                m_WyvernStateSouth = WYVERN_ALLIANCE;
            else
                m_WyvernStateSouth = WYVERN_HORDE;
            UpdateWyvernRoostWorldState(NA_ROOST_S);
            break;
        case NA_DESTROYED_ROOST_N:
            del = NA_DESTROYED_ROOST_N;
            add = NA_ROOST_N;
            add2 = NA_BOMB_WAGON_N;
            if (m_ControllingFaction == HORDE)
                m_WyvernStateNorth = WYVERN_ALLIANCE;
            else
                m_WyvernStateNorth = WYVERN_HORDE;
            UpdateWyvernRoostWorldState(NA_ROOST_N);
            break;
        case NA_DESTROYED_ROOST_W:
            del = NA_DESTROYED_ROOST_W;
            add = NA_ROOST_W;
            add2 = NA_BOMB_WAGON_W;
            if (m_ControllingFaction == HORDE)
                m_WyvernStateWest = WYVERN_ALLIANCE;
            else
                m_WyvernStateWest = WYVERN_HORDE;
            UpdateWyvernRoostWorldState(NA_ROOST_W);
            break;
        case NA_DESTROYED_ROOST_E:
            del = NA_DESTROYED_ROOST_E;
            add = NA_ROOST_E;
            add2 = NA_BOMB_WAGON_E;
            if (m_ControllingFaction == HORDE)
                m_WyvernStateEast = WYVERN_ALLIANCE;
            else
                m_WyvernStateEast = WYVERN_HORDE;
            UpdateWyvernRoostWorldState(NA_ROOST_E);
            break;
        case NA_BOMB_WAGON_S:
            del = NA_BOMB_WAGON_S;
            del2 = NA_ROOST_S;
            add = NA_DESTROYED_ROOST_S;
            if (m_ControllingFaction == HORDE)
                m_WyvernStateSouth = WYVERN_NEU_ALLIANCE;
            else
                m_WyvernStateSouth = WYVERN_NEU_HORDE;
            UpdateWyvernRoostWorldState(NA_ROOST_S);
            break;
        case NA_BOMB_WAGON_N:
            del = NA_BOMB_WAGON_N;
            del2 = NA_ROOST_N;
            add = NA_DESTROYED_ROOST_N;
            if (m_ControllingFaction == HORDE)
                m_WyvernStateNorth = WYVERN_NEU_ALLIANCE;
            else
                m_WyvernStateNorth = WYVERN_NEU_HORDE;
            UpdateWyvernRoostWorldState(NA_ROOST_N);
            break;
        case NA_BOMB_WAGON_W:
            del = NA_BOMB_WAGON_W;
            del2 = NA_ROOST_W;
            add = NA_DESTROYED_ROOST_W;
            if (m_ControllingFaction == HORDE)
                m_WyvernStateWest = WYVERN_NEU_ALLIANCE;
            else
                m_WyvernStateWest = WYVERN_NEU_HORDE;
            UpdateWyvernRoostWorldState(NA_ROOST_W);
            break;
        case NA_BOMB_WAGON_E:
            del = NA_BOMB_WAGON_E;
            del2 = NA_ROOST_E;
            add = NA_DESTROYED_ROOST_E;
            if (m_ControllingFaction == HORDE)
                m_WyvernStateEast = WYVERN_NEU_ALLIANCE;
            else
                m_WyvernStateEast = WYVERN_NEU_HORDE;
            UpdateWyvernRoostWorldState(NA_ROOST_E);
            break;
        default:
            return -1;
            break;
        }

        if (del>-1)
            DelObject(del);

        if (del2>-1)
            DelObject(del2);

        if (add>-1)
            AddObject(add, gos[add].entry, gos[add].map, gos[add].x, gos[add].y, gos[add].z, gos[add].o, gos[add].rot0, gos[add].rot1, gos[add].rot2, gos[add].rot3);

        if (add2>-1)
            AddObject(add2, gos[add2].entry, gos[add2].map, gos[add2].x, gos[add2].y, gos[add2].z, gos[add2].o, gos[add2].rot0, gos[add2].rot1, gos[add2].rot2, gos[add2].rot3);

        return retval;
    }
    return -1;
}
开发者ID:AvariusProject,项目名称:AvariusCore,代码行数:101,代码来源:OutdoorPvPNA.cpp


注:本文中的DelObject函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。