示例#1
0
void BattlefieldWG::OnBattleStart()
{
    // Spawn titan relic
    m_relic = SpawnGameObject(BATTLEFIELD_WG_GAMEOBJECT_TITAN_RELIC, 5440.0f, 2840.8f, 430.43f, 0);
    if (m_relic)
    {
        // Update faction of relic, only attacker can click on
        m_relic->SetUInt32Value(GAMEOBJECT_FACTION, WintergraspFaction[GetAttackerTeam()]);
        // Set in use (not allow to click on before last door is broken)
        m_relic->SetFlag(GAMEOBJECT_FLAGS, GO_FLAG_IN_USE);
    }
    else
        sLog->outError("WG: Failed to spawn titan relic.");

    // Update tower visibility and update faction
    for (GuidSet::const_iterator itr = CanonList.begin(); itr != CanonList.end(); ++itr)
    {
        if (Unit* unit = ObjectAccessor::FindUnit(*itr))
        {
            if (Creature* creature = unit->ToCreature())
            {
                ShowNpc(creature, true);
                creature->setFaction(WintergraspFaction[GetDefenderTeam()]);
            }
        }
    }

    // Rebuild all wall
    for (GameObjectBuilding::const_iterator itr = BuildingsInZone.begin(); itr != BuildingsInZone.end(); ++itr)
    {
        if (*itr)
        {
            (*itr)->Rebuild();
            (*itr)->UpdateTurretAttack(false);
        }
    }

    m_Data32[BATTLEFIELD_WG_DATA_BROKEN_TOWER_ATT] = 0;
    m_Data32[BATTLEFIELD_WG_DATA_BROKEN_TOWER_DEF] = 0;
    m_Data32[BATTLEFIELD_WG_DATA_DAMAGED_TOWER_ATT] = 0;
    m_Data32[BATTLEFIELD_WG_DATA_DAMAGED_TOWER_DEF] = 0;

    // Update graveyard (in no war time all graveyard is to deffender, in war time, depend of base)
    for (WorkShop::const_iterator itr = WorkShopList.begin(); itr != WorkShopList.end(); ++itr)
    {
        if (*itr)
            (*itr)->UpdateGraveYardAndWorkshop();
    }

    for (uint8 team = 0; team < 2; ++team)
        for (GuidSet::const_iterator itr = m_players[team].begin(); itr != m_players[team].end(); ++itr)
        {
            // Kick player in orb room, TODO: offline player ?
            if (Player* player = ObjectAccessor::FindPlayer(*itr))
            {
                float x, y, z;
                player->GetPosition(x, y, z);
                if (5500 > x && x > 5392 && y < 2880 && y > 2800 && z < 480)
                    player->TeleportTo(571, 5349.8686f, 2838.481f, 409.240f, 0.046328f);
                SendInitWorldStatesTo(player);
            }
        }
    // Initialize vehicle counter
    UpdateCounterVehicle(true);
    // Send start warning to all players
    SendWarningToAllInZone(BATTLEFIELD_WG_TEXT_START);
}
示例#2
0
bool BattlefieldWG::SetupBattlefield()
{
    InitStalker(BATTLEFIELD_WG_NPC_STALKER, WintergraspStalkerPos[0], WintergraspStalkerPos[1], WintergraspStalkerPos[2], WintergraspStalkerPos[3]);

    m_TypeId = BATTLEFIELD_WG;                              // See enum BattlefieldTypes
    m_BattleId = BATTLEFIELD_BATTLEID_WG;
    m_ZoneId = BATTLEFIELD_WG_ZONEID;
    _MapId = BATTLEFIELD_WG_MAPID;

    m_MaxPlayer = sWorld->getIntConfig(CONFIG_WINTERGRASP_PLAYER_MAX);
    m_enable = sWorld->getBoolConfig(CONFIG_WINTERGRASP_ENABLE);
    m_MinPlayer = sWorld->getIntConfig(CONFIG_WINTERGRASP_PLAYER_MIN);
    m_MinLevel = sWorld->getIntConfig(CONFIG_WINTERGRASP_PLAYER_MIN_LVL);
    m_BattleTime = sWorld->getIntConfig(CONFIG_WINTERGRASP_BATTLETIME) * MINUTE * IN_MILLISECONDS;
    m_NoWarBattleTime = sWorld->getIntConfig(CONFIG_WINTERGRASP_NOBATTLETIME) * MINUTE * IN_MILLISECONDS;
    m_RestartAfterCrash = sWorld->getIntConfig(CONFIG_WINTERGRASP_RESTART_AFTER_CRASH) * MINUTE * IN_MILLISECONDS;

    m_TimeForAcceptInvite = 20;
    m_StartGroupingTimer = 15 * MINUTE * IN_MILLISECONDS;
    m_StartGrouping = false;

    m_tenacityStack = 0;

    KickPosition.Relocate(5728.117f, 2714.346f, 697.733f, 0);
    KickPosition.m_mapId = _MapId;

    RegisterZone(m_ZoneId);

    m_Data32.resize(BATTLEFIELD_WG_DATA_MAX);

    m_saveTimer = 60000;

    // Init GraveYards
    SetGraveyardNumber(BATTLEFIELD_WG_GY_MAX);

    // Load from db
    if ((sWorld->getWorldState(BATTLEFIELD_WG_WORLD_STATE_ACTIVE) == 0) && (sWorld->getWorldState(BATTLEFIELD_WG_WORLD_STATE_DEFENDER) == 0)
            && (sWorld->getWorldState(ClockWorldState[0]) == 0))
    {
        sWorld->setWorldState(BATTLEFIELD_WG_WORLD_STATE_ACTIVE, false);
        sWorld->setWorldState(BATTLEFIELD_WG_WORLD_STATE_DEFENDER, urand(0, 1));
        sWorld->setWorldState(ClockWorldState[0], m_NoWarBattleTime);
    }

    m_BattlefieldActive = sWorld->getWorldState(BATTLEFIELD_WG_WORLD_STATE_ACTIVE);
    m_DefenderTeam = TeamId(sWorld->getWorldState(BATTLEFIELD_WG_WORLD_STATE_DEFENDER));

    m_Timer = sWorld->getWorldState(ClockWorldState[0]);
    if (m_BattlefieldActive)
    {
        m_BattlefieldActive = false;
        m_Timer = m_RestartAfterCrash;
    }

    for (uint8 i = 0; i < BATTLEFIELD_WG_GY_MAX; i++)
    {
        BfGraveYardWG *gy = new BfGraveYardWG(this);
        if (WGGraveYard[i].startcontrol == TEAM_NEUTRAL) // When between games, the graveyard is controlled by the defending team
            gy->Init(NPC_TAUNKA_SPIRIT_GUIDE, NPC_DWARVEN_SPIRIT_GUIDE, WGGraveYard[i].x, WGGraveYard[i].y, WGGraveYard[i].z, WGGraveYard[i].o, m_DefenderTeam, WGGraveYard[i].gyid);
        else
            gy->Init(NPC_TAUNKA_SPIRIT_GUIDE, NPC_DWARVEN_SPIRIT_GUIDE, WGGraveYard[i].x, WGGraveYard[i].y, WGGraveYard[i].z, WGGraveYard[i].o, WGGraveYard[i].startcontrol, WGGraveYard[i].gyid);
        gy->SetTextId(WGGraveYard[i].textid);
        m_GraveYardList[i] = gy;
    }

    // Spawn workshop creatures and gameobjects
    for (uint8 i = 0; i < WG_MAX_WORKSHOP; i++)
    {
        BfWGWorkShopData *ws = new BfWGWorkShopData(this);      // Create new object
        // Init:setup variable
        ws->Init(WGWorkShopDataBase[i].worldstate, WGWorkShopDataBase[i].type, WGWorkShopDataBase[i].nameid);
        // Spawn associate npc on this point (Guard/Engineer)
        for (uint8 c = 0; c < WGWorkShopDataBase[i].nbcreature; c++)
            ws->AddCreature(WGWorkShopDataBase[i].CreatureData[c]);

        // Spawn associate gameobject on this point (Horde/Alliance flags)
        for (uint8 g = 0; g < WGWorkShopDataBase[i].nbgob; g++)
            ws->AddGameObject(WGWorkShopDataBase[i].GameObjectData[g]);

        // Create PvPCapturePoint
        if (WGWorkShopDataBase[i].type < BATTLEFIELD_WG_WORKSHOP_KEEP_WEST)
        {
            ws->ChangeControl(GetAttackerTeam(), true);     // Update control of this point
            // Create Object
            BfCapturePointWG *workshop = new BfCapturePointWG(this, GetAttackerTeam());
            // Spawn gameobject associate (see in OnGameObjectCreate, of OutdoorPvP for see association)
            workshop->SetCapturePointData(WGWorkShopDataBase[i].CapturePoint.entryh, 571,
                                          WGWorkShopDataBase[i].CapturePoint.x, WGWorkShopDataBase[i].CapturePoint.y, WGWorkShopDataBase[i].CapturePoint.z, 0);
            workshop->LinkToWorkShop(ws);                   // Link our point to the capture point (for faction changement)
            AddCapturePoint(workshop);                      // Add this capture point to list for update this (view in Update() of OutdoorPvP)
        }
        else
            ws->ChangeControl(GetDefenderTeam(), true);     // Update control of this point (Keep workshop= to deffender team)

        WorkShopList.insert(ws);
    }
    // Spawning npc in keep
    for (uint8 i = 0; i < WG_MAX_KEEP_NPC; i++)
    {
        // Horde npc
        if (Creature* creature = SpawnCreature(WGKeepNPC[i].entryh, WGKeepNPC[i].x, WGKeepNPC[i].y, WGKeepNPC[i].z, WGKeepNPC[i].o, TEAM_HORDE))
            KeepCreature[TEAM_HORDE].insert(creature->GetGUID());
        // Alliance npc
        if (Creature* creature = SpawnCreature(WGKeepNPC[i].entrya, WGKeepNPC[i].x, WGKeepNPC[i].y, WGKeepNPC[i].z, WGKeepNPC[i].o, TEAM_ALLIANCE))
            KeepCreature[TEAM_ALLIANCE].insert(creature->GetGUID());
    }
    // Hide keep npc
    for (GuidSet::const_iterator itr = KeepCreature[GetAttackerTeam()].begin(); itr != KeepCreature[GetAttackerTeam()].end(); ++itr)
        if (Unit* unit = ObjectAccessor::FindUnit(*itr))
            if (Creature* creature = unit->ToCreature())
                HideNpc(creature);
    // Spawn out of keep npc
    // Horde npc
    for (uint8 i = 0; i < WG_OUTSIDE_ALLIANCE_NPC; i++)
        if (Creature* creature = SpawnCreature(WGOutsideNPC[i].entryh, WGOutsideNPC[i].x, WGOutsideNPC[i].y, WGOutsideNPC[i].z, WGOutsideNPC[i].o, TEAM_HORDE))
            OutsideCreature[TEAM_HORDE].insert(creature->GetGUID());
    // Alliance npc
    for (uint8 i = WG_OUTSIDE_ALLIANCE_NPC; i < WG_MAX_OUTSIDE_NPC; i++)
        if (Creature* creature = SpawnCreature(WGOutsideNPC[i].entrya, WGOutsideNPC[i].x, WGOutsideNPC[i].y, WGOutsideNPC[i].z, WGOutsideNPC[i].o, TEAM_ALLIANCE))
            OutsideCreature[TEAM_ALLIANCE].insert(creature->GetGUID());
    // Hide outside npc
    for (GuidSet::const_iterator itr = OutsideCreature[GetDefenderTeam()].begin(); itr != OutsideCreature[GetDefenderTeam()].end(); ++itr)
        if (Unit* unit = ObjectAccessor::FindUnit(*itr))
            if (Creature* creature = unit->ToCreature())
                HideNpc(creature);
    for (uint8 i = 0; i < WG_MAX_TURRET; i++)
    {
        if (Creature* creature = SpawnCreature(28366, WGTurret[i].x, WGTurret[i].y, WGTurret[i].z, WGTurret[i].o, TeamId(0)))
        {
            CanonList.insert(creature->GetGUID());
            HideNpc(creature);
        }
    }
    // Spawning Buiding
    for (uint8 i = 0; i < WG_MAX_OBJ; i++)
    {
        GameObject* go =
            SpawnGameObject(WGGameObjectBuillding[i].entry, WGGameObjectBuillding[i].x, WGGameObjectBuillding[i].y, WGGameObjectBuillding[i].z, WGGameObjectBuillding[i].o);
        BfWGGameObjectBuilding *b = new BfWGGameObjectBuilding(this);
        b->Init(go, WGGameObjectBuillding[i].type, WGGameObjectBuillding[i].WorldState, WGGameObjectBuillding[i].nameid);
        BuildingsInZone.insert(b);
    }
    // Spawning portal defender
    for (uint8 i = 0; i < WG_MAX_TELEPORTER; i++)
    {
        GameObject* go = SpawnGameObject(WGPortalDefenderData[i].entry, WGPortalDefenderData[i].x, WGPortalDefenderData[i].y, WGPortalDefenderData[i].z, WGPortalDefenderData[i].o);
        DefenderPortalList.insert(go);
        go->SetUInt32Value(GAMEOBJECT_FACTION, WintergraspFaction[GetDefenderTeam()]);
    }

    // Spawn banner in keep
    for (uint8 i = 0; i < WG_KEEPGAMEOBJECT_MAX; i++)
    {
        if (GameObject* go = SpawnGameObject(WGKeepGameObject[i].entryh, WGKeepGameObject[i].x, WGKeepGameObject[i].y, WGKeepGameObject[i].z, WGKeepGameObject[i].o))
        {
            go->SetRespawnTime(GetDefenderTeam()? RESPAWN_ONE_DAY : RESPAWN_IMMEDIATELY);
            m_KeepGameObject[1].insert(go);
        }
        if (GameObject* go = SpawnGameObject(WGKeepGameObject[i].entrya, WGKeepGameObject[i].x, WGKeepGameObject[i].y, WGKeepGameObject[i].z, WGKeepGameObject[i].o))
        {
            go->SetRespawnTime(GetDefenderTeam()? RESPAWN_IMMEDIATELY : RESPAWN_ONE_DAY);
            m_KeepGameObject[0].insert(go);
        }
    }

    // Show defender banner in keep
    for (GameObjectSet::const_iterator itr = m_KeepGameObject[GetDefenderTeam()].begin(); itr != m_KeepGameObject[GetDefenderTeam()].end(); ++itr)
        (*itr)->SetRespawnTime(RESPAWN_IMMEDIATELY);

    // Hide attackant banner in keep
    for (GameObjectSet::const_iterator itr = m_KeepGameObject[GetAttackerTeam()].begin(); itr != m_KeepGameObject[GetAttackerTeam()].end(); ++itr)
        (*itr)->SetRespawnTime(RESPAWN_ONE_DAY);

    UpdateCounterVehicle(true);
    return true;
}
示例#3
0
void ArathiBasin::SpawnControlPoint(uint32 Id, uint32 Type)
{
	GameObjectInfo * gi, * gi_aura;
	gi = GameObjectNameStorage.LookupEntry(ControlPointGoIds[Id][Type]);
	if(gi == NULL)
		return;

	gi_aura = gi->Button.LinkedTrap ? GameObjectNameStorage.LookupEntry(gi->Button.LinkedTrap) : NULL;
	if(m_controlPoints[Id] == NULL)
	{
		m_controlPoints[Id] = SpawnGameObject(gi->ID, ControlPointCoordinates[Id][0], ControlPointCoordinates[Id][1],
			ControlPointCoordinates[Id][2], ControlPointCoordinates[Id][3], 0, 35, 1.0f);

		m_controlPoints[Id]->SetByte(GAMEOBJECT_BYTES_1,GAMEOBJECT_BYTES_STATE, 1);
		m_controlPoints[Id]->SetByte(GAMEOBJECT_BYTES_1,GAMEOBJECT_BYTES_TYPE_ID, gi->Type);
		m_controlPoints[Id]->SetByte(GAMEOBJECT_BYTES_1,GAMEOBJECT_BYTES_ANIMPROGRESS, 100);
		m_controlPoints[Id]->SetUInt32Value(GAMEOBJECT_DYNAMIC, 1);
		m_controlPoints[Id]->SetUInt32Value(GAMEOBJECT_DISPLAYID, gi->DisplayID);

		switch(Type)
		{
		case AB_SPAWN_TYPE_ALLIANCE_ASSAULT:
		case AB_SPAWN_TYPE_ALLIANCE_CONTROLLED:
			m_controlPoints[Id]->SetUInt32Value(GAMEOBJECT_FACTION, 2);
			break;

		case AB_SPAWN_TYPE_HORDE_ASSAULT:
		case AB_SPAWN_TYPE_HORDE_CONTROLLED:
			m_controlPoints[Id]->SetUInt32Value(GAMEOBJECT_FACTION, 1);
			break;

		default:
			m_controlPoints[Id]->SetUInt32Value(GAMEOBJECT_FACTION, 35);		// neutral
			break;
		}

		m_controlPoints[Id]->bannerslot = Id;
		m_controlPoints[Id]->PushToWorld(m_mapMgr);
	}
	else
	{
		if(m_controlPoints[Id]->IsInWorld())
			m_controlPoints[Id]->RemoveFromWorld(false);

		// assign it a new guid (client needs this to see the entry change?)
		m_controlPoints[Id]->SetNewGuid(m_mapMgr->GenerateGameobjectGuid());
		m_controlPoints[Id]->SetUInt32Value(OBJECT_FIELD_ENTRY, gi->ID);
		m_controlPoints[Id]->SetUInt32Value(GAMEOBJECT_DISPLAYID, gi->DisplayID);
		m_controlPoints[Id]->SetByte(GAMEOBJECT_BYTES_1,GAMEOBJECT_BYTES_TYPE_ID, gi->Type);

		switch(Type)
		{
		case AB_SPAWN_TYPE_ALLIANCE_ASSAULT:
		case AB_SPAWN_TYPE_ALLIANCE_CONTROLLED:
			m_controlPoints[Id]->SetUInt32Value(GAMEOBJECT_FACTION, 2);
			break;

		case AB_SPAWN_TYPE_HORDE_ASSAULT:
		case AB_SPAWN_TYPE_HORDE_CONTROLLED:
			m_controlPoints[Id]->SetUInt32Value(GAMEOBJECT_FACTION, 1);
			break;

		default:
			m_controlPoints[Id]->SetUInt32Value(GAMEOBJECT_FACTION, 35);		// neutral
			break;
		}

		m_controlPoints[Id]->SetInfo(gi);
		m_controlPoints[Id]->PushToWorld(m_mapMgr);
	}

	if(gi_aura == NULL)
	{
		// remove it if it exists
		if(m_controlPointAuras[Id]!=NULL && m_controlPointAuras[Id]->IsInWorld())
			m_controlPointAuras[Id]->RemoveFromWorld(false);

		return;
	}

	if(m_controlPointAuras[Id] == NULL)
	{
		m_controlPointAuras[Id] = SpawnGameObject(gi_aura->ID, ControlPointCoordinates[Id][0], ControlPointCoordinates[Id][1],
			ControlPointCoordinates[Id][2], ControlPointCoordinates[Id][3], 0, 35, 5.0f);

		m_controlPointAuras[Id]->SetByte(GAMEOBJECT_BYTES_1,GAMEOBJECT_BYTES_STATE, 1);
		m_controlPointAuras[Id]->SetByte(GAMEOBJECT_BYTES_1,GAMEOBJECT_BYTES_TYPE_ID, 6);
		m_controlPointAuras[Id]->SetByte(GAMEOBJECT_BYTES_1,GAMEOBJECT_BYTES_ANIMPROGRESS, 100);
		m_controlPointAuras[Id]->bannerauraslot = Id;
		m_controlPointAuras[Id]->PushToWorld(m_mapMgr);
	}
	else
	{
		if(m_controlPointAuras[Id]->IsInWorld())
			m_controlPointAuras[Id]->RemoveFromWorld(false);

		// re-spawn the aura
		m_controlPointAuras[Id]->SetNewGuid(m_mapMgr->GenerateGameobjectGuid());
		m_controlPointAuras[Id]->SetUInt32Value(OBJECT_FIELD_ENTRY, gi_aura->ID);
		m_controlPointAuras[Id]->SetUInt32Value(GAMEOBJECT_DISPLAYID, gi_aura->DisplayID);
		m_controlPointAuras[Id]->SetInfo(gi_aura);
		m_controlPointAuras[Id]->PushToWorld(m_mapMgr);
	}
}
示例#4
0
void ArathiBasin::OnCreate()
{
	// Alliance Gate
	GameObject* gate = SpawnGameObject(180255, 1284.597290f, 1281.166626f, -15.977916f, 0.76f, 32, 114, 1.5799990f);
	gate->SetByte(GAMEOBJECT_BYTES_1,GAMEOBJECT_BYTES_ANIMPROGRESS, 100);
	gate->PushToWorld(m_mapMgr);
	m_gates.push_back(gate);

	// horde gate
	gate = SpawnGameObject(180256, 708.0902710f, 708.4479370f, -17.3898964f, 3.92f, 32, 114, 1.5699990f);
	gate->SetByte(GAMEOBJECT_BYTES_1,GAMEOBJECT_BYTES_ANIMPROGRESS, 100);
	gate->PushToWorld(m_mapMgr);
	m_gates.push_back(gate);

	// spawn (default) control points
	SpawnControlPoint(AB_CONTROL_POINT_STABLE,		AB_SPAWN_TYPE_NEUTRAL);
	SpawnControlPoint(AB_CONTROL_POINT_BLACKSMITH,	AB_SPAWN_TYPE_NEUTRAL);
	SpawnControlPoint(AB_CONTROL_POINT_LUMBERMILL,	AB_SPAWN_TYPE_NEUTRAL);
	SpawnControlPoint(AB_CONTROL_POINT_MINE,		AB_SPAWN_TYPE_NEUTRAL);
	SpawnControlPoint(AB_CONTROL_POINT_FARM,		AB_SPAWN_TYPE_NEUTRAL);

	// spawn buffs
	SpawnBuff(AB_BUFF_STABLES);
	SpawnBuff(AB_BUFF_BLACKSMITH);
	SpawnBuff(AB_BUFF_LUMBERMILL);
	SpawnBuff(AB_BUFF_MINE);
	SpawnBuff(AB_BUFF_FARM);

	// spawn the h/a base spirit guides
	AddSpiritGuide(SpawnSpiritGuide(NoBaseGYLocations[0][0],NoBaseGYLocations[0][1],NoBaseGYLocations[0][2], 0.0f, 0));
	AddSpiritGuide(SpawnSpiritGuide(NoBaseGYLocations[1][0],NoBaseGYLocations[1][1],NoBaseGYLocations[1][2], 0.0f, 1));

	// w00t
	WorldStateManager &sm = m_mapMgr->GetStateManager();

	// urrrgh worldstates
	sm.CreateWorldState(0x8D8, 0x00);
	sm.CreateWorldState(0x8D7, 0x00);
	sm.CreateWorldState(0x8D6, 0x00);
	sm.CreateWorldState(0x8D5, 0x00);
	sm.CreateWorldState(0x8D4, 0x00);
	sm.CreateWorldState(0x8D3, 0x00);

	// AB world state's
	// unknowns, need more research
	sm.CreateWorldState(0x7A3, 1800); // unknown
	sm.CreateWorldState(0x745, 0x02); // unknown

	// Icon stuff for on the map
	sm.CreateWorldState(WORLDSTATE_AB_SHOW_BACKSMITH_ICON, 			 0x01);
	sm.CreateWorldState(WORLDSTATE_AB_SHOW_FARM_ICON, 				  0x01);
	sm.CreateWorldState(WORLDSTATE_AB_SHOW_LUMBERMILL_ICON, 			0x01);
	sm.CreateWorldState(WORLDSTATE_AB_SHOW_GOLDMINE_ICON, 			 0x01);
	sm.CreateWorldState(WORLDSTATE_AB_SHOW_STABLE_ICON, 			0x01);

	// LumberMill
	sm.CreateWorldState(WORLDSTATE_AB_CAPTURING_LUMBERMILL_HORDE, 	   0x00);
	sm.CreateWorldState(WORLDSTATE_AB_CAPTURING_LUMBERMILL_ALLIANCE, 	0x00);
	sm.CreateWorldState(WORLDSTATE_AB_CAPTURED_LUMBERMILL_HORDE, 		0x00);
	sm.CreateWorldState(WORLDSTATE_AB_CAPTURED_LUMBERMILL_ALLIANCE, 	 0x00);

	// GoldMine
	sm.CreateWorldState(WORLDSTATE_AB_CAPTURING_GOLDMINE_HORDE, 		 0x00);
	sm.CreateWorldState(WORLDSTATE_AB_CAPTURING_GOLDMINE_ALLIANCE, 	  0x00);
	sm.CreateWorldState(WORLDSTATE_AB_CAPTURED_GOLDMINE_HORDE, 		  0x00);
	sm.CreateWorldState(WORLDSTATE_AB_CAPTURED_GOLDMINE_ALLIANCE, 	   0x00);

	// BlackSmith
	sm.CreateWorldState(WORLDSTATE_AB_CAPTURING_BLACKSMITH_HORDE, 	   0x00);
	sm.CreateWorldState(WORLDSTATE_AB_CAPTURING_BLACKSMITH_ALLIANCE, 	0x00);
	sm.CreateWorldState(WORLDSTATE_AB_CAPTURED_BLACKSMITH_HORDE, 		0x00);
	sm.CreateWorldState(WORLDSTATE_AB_CAPTURED_BLACKSMITH_ALLIANCE, 	 0x00);

	sm.CreateWorldState(WORLDSTATE_AB_MAX_SCORE, 						RESOURCES_WINVAL);
	sm.CreateWorldState(WORLDSTATE_AB_ALLIANCE_CAPTUREBASE, 			 0x00);
	sm.CreateWorldState(WORLDSTATE_AB_HORDE_CAPTUREBASE, 				0x00);
	sm.CreateWorldState(WORLDSTATE_AB_HORDE_RESOURCES, 				  0x00);
	sm.CreateWorldState(WORLDSTATE_AB_ALLIANCE_RESOURCES, 			   0x00);

	// Farm
	sm.CreateWorldState(WORLDSTATE_AB_CAPTURING_FARM_ALLIANCE, 		 0x00);
	sm.CreateWorldState(WORLDSTATE_AB_CAPTURING_FARM_HORDE, 			 0x00);
	sm.CreateWorldState(WORLDSTATE_AB_CAPTURED_FARM_HORDE, 			  0x00);
	sm.CreateWorldState(WORLDSTATE_AB_CAPTURED_FARM_ALLIANCE, 		   0x00);

	// Stables
	sm.CreateWorldState(WORLDSTATE_AB_CAPTURING_STABLES_HORDE, 		  0x00);
	sm.CreateWorldState(WORLDSTATE_AB_CAPTURING_STABLES_ALLIANCE, 	   0x00);
	sm.CreateWorldState(WORLDSTATE_AB_CAPTURED_STABLES_HORDE, 		   0x00);
	sm.CreateWorldState(WORLDSTATE_AB_CAPTURED_STABLES_ALLIANCE, 		0x00);
}
示例#5
0
bool BattlefieldTB::SetupBattlefield()
{
    m_TypeId                     = BATTLEFIELD_TB;    //View enum BattlefieldTypes
    m_BattleId                   = BATTLEFIELD_BATTLEID_TB;
    m_ZoneId                     = 5095; // Tol Barad
    _MapId                       = 732;  // Map X
    m_MaxPlayer                  = sWorld->getIntConfig(CONFIG_TOL_BARAD_PLR_MAX);
    m_enable                     = sWorld->getBoolConfig(CONFIG_TOL_BARAD_ENABLE);
    m_MinPlayer                  = sWorld->getIntConfig(CONFIG_TOL_BARAD_PLR_MIN);
    m_MinLevel                   = sWorld->getIntConfig(CONFIG_TOL_BARAD_PLR_MIN_LVL);
    m_BattleTime                 = sWorld->getIntConfig(CONFIG_TOL_BARAD_BATTLETIME)*60*1000;   // Time of battle (in ms)
    m_NoWarBattleTime            = sWorld->getIntConfig(CONFIG_TOL_BARAD_NOBATTLETIME)*60*1000; // Time between to battle (in ms)
    m_TimeForAcceptInvite        = 20; // in second
    m_StartGroupingTimer         = 15*60*1000; // in ms
    m_StartGrouping=false;
    KickPositionA.Relocate(-363.897f, 1047.931f, 22, 0);
    KickPositionA.m_mapId        = _MapId;
    KickPositionH.Relocate(-609.336f, 1392.194f, 21.5f, 0);
    KickPositionH.m_mapId        = _MapId;
    RegisterZone(m_ZoneId);
    m_Data32.resize(BATTLEFIELD_TB_DATA_MAX);
    m_saveTimer                  = 60000;

    // Init GraveYards
    SetGraveyardNumber(BATTLEFIELD_TB_GY_MAX);

    //Load from db
    if(( sWorld->getWorldState(5387) == 0 ) && (sWorld->getWorldState(5384) == 0) && (sWorld->getWorldState(TBClockWorldState[0]) == 0 ))
    {
        sWorld->setWorldState(5387, false);
        sWorld->setWorldState(5384, urand(0, 1));
        sWorld->setWorldState(TBClockWorldState[0], m_NoWarBattleTime);
    }

        m_WarTime                = sWorld->getWorldState(5387);
        m_DefenderTeam           = (TeamId)sWorld->getWorldState(5384);
        m_Timer                  = sWorld->getWorldState(TBClockWorldState[0]);
    if (m_WarTime)
    {
        m_WarTime = false;
        m_Timer = 10 * 60 * 1000;
    }

    for (uint8 i=0; i<BATTLEFIELD_TB_GY_MAX; i++)
    {
        BfGraveYardTB* gy = new BfGraveYardTB(this);
        if (TBGraveYard[i].startcontrol == TEAM_NEUTRAL)
        {
            // In no war time Gy is control by defender
            gy->Init(45079, 45066, TBGraveYard[i].x, TBGraveYard[i].y, TBGraveYard[i].z, TBGraveYard[i].o, m_DefenderTeam, TBGraveYard[i].guid);
        }
        else
            gy->Init(45079, 45066, TBGraveYard[i].x, TBGraveYard[i].y, TBGraveYard[i].z, TBGraveYard[i].o, TBGraveYard[i].startcontrol, TBGraveYard[i].guid);
        gy->SetTextId(TBGraveYard[i].textid);
        m_GraveYardList[i] = gy;
    }

    // Pop des gameobject et creature du TBWorkShop
    for (uint8 i = 0; i<TB_MAX_WORKSHOP; i++)
    {
        BfTBWorkShopData* ws = new BfTBWorkShopData(this); // Create new object
        // Init:setup variable
        ws->Init(TBCapturePointDataBase[i].worldstate, TBCapturePointDataBase[i].type, TBCapturePointDataBase[i].nameid);
        // Spawn associate gameobject on this point (Horde/Alliance flags)
        for (int g = 0; g<TBCapturePointDataBase[i].nbgob; g++)
        {
            ws->AddGameObject(TBCapturePointDataBase[i].GameObjectData[g]);
        }

        // Create PvPCapturePoint
        if (TBCapturePointDataBase[i].type < BATTLEFIELD_TB_FORT_MAX)
        {
            ws->ChangeControl(GetAttackerTeam(), true); // Update control of this point
            m_Data32[BATTLEFIELD_TB_DATA_CAPTURED_FORT_ATT]++;
            m_Data32[BATTLEFIELD_TB_DATA_CAPTURED_FORT_DEF]--;
            // Create Object
            BfCapturePointTB* TBWorkShop = new BfCapturePointTB(this, GetAttackerTeam());
            // Spawn gameobject associate (see in OnGameObjectCreate, of OutdoorPvP for see association)
            if (TBWorkShop->SetCapturePointData(TBCapturePointDataBase[i].CapturePoint.entryh, 732,
                TBCapturePointDataBase[i].CapturePoint.x,
                TBCapturePointDataBase[i].CapturePoint.y,
                TBCapturePointDataBase[i].CapturePoint.z,
                0))
            {
                TBWorkShop->LinkToWorkShop(ws);   // Link our point to the capture point (for faction changement)
                AddCapturePoint(TBWorkShop);      // Add this capture point to list for update this (view in Update() of OutdoorPvP)
            }
        }
        else
        {
            m_Data32[BATTLEFIELD_TB_DATA_CAPTURED_FORT_ATT]--;
            m_Data32[BATTLEFIELD_TB_DATA_CAPTURED_FORT_DEF]++;
            ws->ChangeControl(GetDefenderTeam(), true); // Update control of this point (Keep TBWorkShop= to deffender team)
        }
        WorkShopList.insert(ws);
    }

    // Spawning npc in keep
    for (uint8 i = 0; i<TB_MAX_KEEP_NPC; i++)
    {
        // Horde npc
        if (Creature* creature = SpawnCreature(TBKeepNPC[i].entryh, TBKeepNPC[i].x, TBKeepNPC[i].y, TBKeepNPC[i].z, TBKeepNPC[i].o, TEAM_HORDE))
            KeepCreature[TEAM_HORDE].insert(creature->GetGUID());
        // Alliance npc
        if (Creature* creature = SpawnCreature(TBKeepNPC[i].entrya, TBKeepNPC[i].x, TBKeepNPC[i].y, TBKeepNPC[i].z, TBKeepNPC[i].o, TEAM_ALLIANCE))
            KeepCreature[TEAM_ALLIANCE].insert(creature->GetGUID());
    }

    // Hide keep npc
    for (GuidSet::const_iterator itr = KeepCreature[GetAttackerTeam()].begin(); itr != KeepCreature[GetAttackerTeam()].end(); ++itr)
        if (Unit* unit = ObjectAccessor::FindUnit((*itr)))
            if (Creature* creature = unit->ToCreature())
                HideNpc(creature);

    // Spawning battle npcs
    for (uint8 i = 0; i<TB_MAX_WAR_NPC; i++)
    {
        // Horde npc
        if (Creature* creature = SpawnCreature(TBWarNPC[i].entryh, TBWarNPC[i].x, TBWarNPC[i].y, TBWarNPC[i].z, TBWarNPC[i].o, TEAM_HORDE))
            WarCreature[TEAM_HORDE].insert(creature->GetGUID());
        // Alliance npc
        if (Creature* creature = SpawnCreature(TBWarNPC[i].entrya, TBWarNPC[i].x, TBWarNPC[i].y, TBWarNPC[i].z, TBWarNPC[i].o, TEAM_ALLIANCE))
            WarCreature[TEAM_ALLIANCE].insert(creature->GetGUID());
    }

    // Hide battle npcs
    for (GuidSet::const_iterator itr = WarCreature[GetDefenderTeam()].begin(); itr != WarCreature[GetDefenderTeam()].end(); ++itr)
        if (Unit* unit = ObjectAccessor::FindUnit((*itr)))
            if (Creature* creature = unit->ToCreature())
                HideNpc(creature);

    for (GuidSet::const_iterator itr = WarCreature[GetAttackerTeam()].begin(); itr != WarCreature[GetAttackerTeam()].end(); ++itr)
        if (Unit* unit = ObjectAccessor::FindUnit((*itr)))
            if (Creature* creature = unit->ToCreature())
                HideNpc(creature);

    //Spawning Buiding
    for (uint8 i = 0; i<TB_MAX_OBJ; i++)
    {
        GameObject* go = SpawnGameObject(TBGameObjectBuillding[i].entry, TBGameObjectBuillding[i].x, TBGameObjectBuillding[i].y, TBGameObjectBuillding[i].z, TBGameObjectBuillding[i].o);
        if (go)
        {
            BfTBGameObjectBuilding* b = new BfTBGameObjectBuilding(this);
            b->Init(go, TBGameObjectBuillding[i].type, TBGameObjectBuillding[i].WorldState, TBGameObjectBuillding[i].nameid);
            BuildingsInZone.insert(b);
        }
    }
    return true;
}
bool BattlefieldWG::SetupBattlefield()
{
    InitStalker(BATTLEFIELD_WG_NPC_STALKER, WintergraspStalkerPos[0], WintergraspStalkerPos[1], WintergraspStalkerPos[2], WintergraspStalkerPos[3]);

    m_TypeId = BATTLEFIELD_WG;                              // See enum BattlefieldTypes
    m_BattleId = BATTLEFIELD_BATTLEID_WG;
    m_ZoneId = BATTLEFIELD_WG_ZONEID;
    m_MapId = BATTLEFIELD_WG_MAPID;
    m_Map = sMapMgr->FindMap(m_MapId, 0);
    m_Guid = MAKE_NEW_GUID((m_BattleId ^ 0x20000), 0, HIGHGUID_BATTLEGROUND);

    m_MaxPlayer = sWorld->getIntConfig(CONFIG_WINTERGRASP_PLR_MAX);
    m_IsEnabled = sWorld->getBoolConfig(CONFIG_WINTERGRASP_ENABLE);
    m_MinPlayer = sWorld->getIntConfig(CONFIG_WINTERGRASP_PLR_MIN);
    m_MinLevel = sWorld->getIntConfig(CONFIG_WINTERGRASP_PLR_MIN_LVL);
    m_BattleTime = sWorld->getIntConfig(CONFIG_WINTERGRASP_BATTLETIME) * MINUTE * IN_MILLISECONDS;
    //m_NoWarBattleTime = sWorld->getIntConfig(CONFIG_WINTERGRASP_NOBATTLETIME) * MINUTE * IN_MILLISECONDS;
    m_NoWarBattleTime = 10 * MINUTE * IN_MILLISECONDS;
    m_RestartAfterCrash = sWorld->getIntConfig(CONFIG_WINTERGRASP_RESTART_AFTER_CRASH) * MINUTE * IN_MILLISECONDS;

    m_TimeForAcceptInvite = 20;
    m_StartGroupingTimer = 5 * MINUTE * IN_MILLISECONDS; //original was 15
    m_StartGrouping = false;

    m_tenacityStack = 0;

    KickPosition.Relocate(5728.117f, 2714.346f, 697.733f, 0);
    KickPosition.m_mapId = m_MapId;

    RegisterZone(m_ZoneId);

    m_Data32.resize(BATTLEFIELD_WG_DATA_MAX);

    m_saveTimer = 60000;

    // Init GraveYards
    SetGraveyardNumber(BATTLEFIELD_WG_GRAVEYARD_MAX);

    // Load from db
    if ((sWorld->getWorldState(BATTLEFIELD_WG_WORLD_STATE_ACTIVE) == 0) && (sWorld->getWorldState(BATTLEFIELD_WG_WORLD_STATE_DEFENDER) == 0)
            && (sWorld->getWorldState(ClockWorldState[0]) == 0))
    {
        sWorld->setWorldState(BATTLEFIELD_WG_WORLD_STATE_ACTIVE, uint64(false));
        sWorld->setWorldState(BATTLEFIELD_WG_WORLD_STATE_DEFENDER, uint64(urand(0, 1)));
        sWorld->setWorldState(ClockWorldState[0], uint64(m_NoWarBattleTime));
    }

    m_isActive = bool(sWorld->getWorldState(BATTLEFIELD_WG_WORLD_STATE_ACTIVE));
    m_DefenderTeam = TeamId(sWorld->getWorldState(BATTLEFIELD_WG_WORLD_STATE_DEFENDER));

    m_Timer = sWorld->getWorldState(ClockWorldState[0]);
    if (m_isActive)
    {
        m_isActive = false;
        m_Timer = m_RestartAfterCrash;
    }

    for (uint8 i = 0; i < BATTLEFIELD_WG_GRAVEYARD_MAX; i++)
    {
        BfGraveyardWG* graveyard = new BfGraveyardWG(this);

        // When between games, the graveyard is controlled by the defending team
        if (WGGraveYard[i].startcontrol == TEAM_NEUTRAL)
            graveyard->Initialize(m_DefenderTeam, WGGraveYard[i].gyid);
        else
            graveyard->Initialize(WGGraveYard[i].startcontrol, WGGraveYard[i].gyid);

        graveyard->SetTextId(WGGraveYard[i].textid);
        m_GraveyardList[i] = graveyard;
    }


    // Spawn workshocreatures and gameobjects
    for (uint8 i = 0; i < WG_MAX_WORKSHOP; i++)
    {
        WGWorkshop* workshop = new WGWorkshop(this, i);
        if (i < BATTLEFIELD_WG_WORKSHOP_KEEP_WEST)
            workshop->GiveControlTo(GetAttackerTeam(), true);
        else
            workshop->GiveControlTo(GetDefenderTeam(), true);

        // Note: Capture point is added once the gameobject is created.
        WorkshopsList.insert(workshop);
    }

    // Spawn NPCs in the defender's keep, both Horde and Alliance
    for (uint8 i = 0; i < WG_MAX_KEEP_NPC; i++)
    {
        // Horde npc
        if (Creature* creature = SpawnCreature(WGKeepNPC[i].entryHorde, WGKeepNPC[i].x, WGKeepNPC[i].y, WGKeepNPC[i].z, WGKeepNPC[i].o, TEAM_HORDE))
            KeepCreature[TEAM_HORDE].insert(creature->GetGUID());
        // Alliance npc
        if (Creature* creature = SpawnCreature(WGKeepNPC[i].entryAlliance, WGKeepNPC[i].x, WGKeepNPC[i].y, WGKeepNPC[i].z, WGKeepNPC[i].o, TEAM_ALLIANCE))
            KeepCreature[TEAM_ALLIANCE].insert(creature->GetGUID());
    }

    // Hide NPCs from the Attacker's team in the keep
    for (GuidSet::const_iterator itr = KeepCreature[GetAttackerTeam()].begin(); itr != KeepCreature[GetAttackerTeam()].end(); ++itr)
        if (Creature* creature = GetCreature(*itr))
            HideNpc(creature);

    // Spawn Horde NPCs outside the keep
    for (uint8 i = 0; i < WG_OUTSIDE_ALLIANCE_NPC; i++)
        if (Creature* creature = SpawnCreature(WGOutsideNPC[i].entryHorde, WGOutsideNPC[i].x, WGOutsideNPC[i].y, WGOutsideNPC[i].z, WGOutsideNPC[i].o, TEAM_HORDE))
            OutsideCreature[TEAM_HORDE].insert(creature->GetGUID());

    // Spawn Alliance NPCs outside the keep
    for (uint8 i = WG_OUTSIDE_ALLIANCE_NPC; i < WG_MAX_OUTSIDE_NPC; i++)
        if (Creature* creature = SpawnCreature(WGOutsideNPC[i].entryAlliance, WGOutsideNPC[i].x, WGOutsideNPC[i].y, WGOutsideNPC[i].z, WGOutsideNPC[i].o, TEAM_ALLIANCE))
            OutsideCreature[TEAM_ALLIANCE].insert(creature->GetGUID());

    // Hide units outside the keep that are defenders
    for (GuidSet::const_iterator itr = OutsideCreature[GetDefenderTeam()].begin(); itr != OutsideCreature[GetDefenderTeam()].end(); ++itr)
        if (Creature* creature = GetCreature(*itr))
            HideNpc(creature);

    // Spawn turrets and hide them per default
    for (uint8 i = 0; i < WG_MAX_TURRET; i++)
    {
        Position towerCannonPos = WGTurret[i].GetPosition();
        if (Creature* creature = SpawnCreature(NPC_WINTERGRASP_TOWER_CANNON, towerCannonPos, TEAM_ALLIANCE))
        {
            CanonList.insert(creature->GetGUID());
            HideNpc(creature);
        }
    }

    // Spawn all gameobjects
    for (uint8 i = 0; i < WG_MAX_OBJ; i++)
    {
        if (GameObject* go = SpawnGameObject(WGGameObjectBuilding[i].entry, WGGameObjectBuilding[i].x, WGGameObjectBuilding[i].y, WGGameObjectBuilding[i].z, WGGameObjectBuilding[i].o))
        {
            BfWGGameObjectBuilding* b = new BfWGGameObjectBuilding(this);
            b->Init(go, WGGameObjectBuilding[i].type, WGGameObjectBuilding[i].WorldState, WGGameObjectBuilding[i].nameId);
            if (!IsEnabled() && go->GetEntry() == GO_WINTERGRASP_VAULT_GATE)
                go->SetDestructibleState(GO_DESTRUCTIBLE_DESTROYED);
            BuildingsInZone.insert(b);
        }
    }

    // Spawning portal defender
    for (uint8 i = 0; i < WG_MAX_TELEPORTER; i++)
    {
        if (GameObject* go = SpawnGameObject(WGPortalDefenderData[i].entry, WGPortalDefenderData[i].x, WGPortalDefenderData[i].y, WGPortalDefenderData[i].z, WGPortalDefenderData[i].o))
        {
            DefenderPortalList.insert(go->GetGUID());
            go->SetFaction(WintergraspFaction[GetDefenderTeam()]);
        }
    }

    UpdateCounterVehicle(true);
    return true;
}
示例#7
0
void AlteracValley::SpawnBattleground()
{
		
	// Alliance Gate
	/*GameObject *gate = SpawnGameObject(180255, 529, 1284.597290, 1281.166626, -15.977916, 0.706859, 32, 114, 1.5799990);
	gate->SetFloatValue(GAMEOBJECT_ROTATION,0.0129570);
	gate->SetFloatValue(GAMEOBJECT_ROTATION_01,-0.0602880);
	gate->SetFloatValue(GAMEOBJECT_ROTATION_02,0.3449600);
	gate->SetFloatValue(GAMEOBJECT_ROTATION_03,0.9365900);
	m_Gates.insert(gate);
	
	// Horde Gate
	gate = SpawnGameObject(180256, 529, 708.0902710, 708.4479370, -17.3898964, -2.3910990, 32, 114, 1.5699990);
	gate->SetFloatValue(GAMEOBJECT_ROTATION,0.0502910);
	gate->SetFloatValue(GAMEOBJECT_ROTATION_01,0.0151270);
	gate->SetFloatValue(GAMEOBJECT_ROTATION_02,0.9292169);
	gate->SetFloatValue(GAMEOBJECT_ROTATION_03,-0.3657840);
	m_Gates.insert(gate);*/
	
	// -- Places Banners --
	
	// Frostworlf gravyard
	GameObject *pbanner = SpawnGameObject(178393 ,30 ,-1083.244385 ,-345.994507 ,55.124435 ,4.596910, 32, 84, 1);
	pbanner->SetUInt32Value(GAMEOBJECT_STATE, 1);
	pbanner->SetUInt32Value(GAMEOBJECT_TYPE_ID, 1);
	pbanner->SetUInt32Value(GAMEOBJECT_ANIMPROGRESS, 100);
	pbanner->AddToWorld();
	
	if(pbanner->GetInfo()->sound3)
	{
		pbanner->pcbannerAura = SpawnGameObject(pbanner->GetInfo()->sound3, 30, pbanner->GetPositionX(), pbanner->GetPositionY(), pbanner->GetPositionZ(), pbanner->GetOrientation(), 32, 114, 5);
		pbanner->pcbannerAura->SetFloatValue(GAMEOBJECT_ROTATION_02,pbanner->GetFloatValue(GAMEOBJECT_ROTATION_02));
		pbanner->pcbannerAura->SetFloatValue(GAMEOBJECT_ROTATION_03,pbanner->GetFloatValue(GAMEOBJECT_ROTATION_03));
		pbanner->pcbannerAura->SetUInt32Value(GAMEOBJECT_STATE, 1);
		pbanner->pcbannerAura->SetUInt32Value(GAMEOBJECT_TYPE_ID, 6);
		pbanner->pcbannerAura->SetUInt32Value(GAMEOBJECT_ANIMPROGRESS, 100);
		pbanner->pcbannerAura->AddToWorld();
	}
	
	pbanner->bannerslot = 0;
	
	// Iceblood graveyard
	pbanner = SpawnGameObject(178393, 30 ,-612.329285 ,-396.660095 ,60.858463 ,2.916166, 32, 84, 1);
	pbanner->SetUInt32Value(GAMEOBJECT_STATE, 1);
	pbanner->SetUInt32Value(GAMEOBJECT_TYPE_ID, 1);
	pbanner->SetUInt32Value(GAMEOBJECT_ANIMPROGRESS, 100);
	pbanner->AddToWorld();
	
	if(pbanner->GetInfo()->sound3)
	{
		pbanner->pcbannerAura = SpawnGameObject(pbanner->GetInfo()->sound3, 30, pbanner->GetPositionX(), pbanner->GetPositionY(), pbanner->GetPositionZ(), pbanner->GetOrientation(), 32, 114, 5);
		pbanner->pcbannerAura->SetFloatValue(GAMEOBJECT_ROTATION_02,pbanner->GetFloatValue(GAMEOBJECT_ROTATION_02));
		pbanner->pcbannerAura->SetFloatValue(GAMEOBJECT_ROTATION_03,pbanner->GetFloatValue(GAMEOBJECT_ROTATION_03));
		pbanner->pcbannerAura->SetUInt32Value(GAMEOBJECT_STATE, 1);
		pbanner->pcbannerAura->SetUInt32Value(GAMEOBJECT_TYPE_ID, 6);
		pbanner->pcbannerAura->SetUInt32Value(GAMEOBJECT_ANIMPROGRESS, 100);
		pbanner->pcbannerAura->AddToWorld();
	}
	
	pbanner->bannerslot = 1;
	
	// Stormpike gravyard
	pbanner = SpawnGameObject(178389, 30 ,669.968567 ,-293.467468 ,30.283821 ,3.152932, 32, 83, 1);
	pbanner->SetUInt32Value(GAMEOBJECT_STATE, 1);
	pbanner->SetUInt32Value(GAMEOBJECT_TYPE_ID, 1);
	pbanner->SetUInt32Value(GAMEOBJECT_ANIMPROGRESS, 100);
	pbanner->AddToWorld();
	
	if(pbanner->GetInfo()->sound3)
	{
		pbanner->pcbannerAura = SpawnGameObject(pbanner->GetInfo()->sound3, 30, pbanner->GetPositionX(), pbanner->GetPositionY(), pbanner->GetPositionZ(), pbanner->GetOrientation(), 32, 114, 5);
		pbanner->pcbannerAura->SetFloatValue(GAMEOBJECT_ROTATION_02,pbanner->GetFloatValue(GAMEOBJECT_ROTATION_02));
		pbanner->pcbannerAura->SetFloatValue(GAMEOBJECT_ROTATION_03,pbanner->GetFloatValue(GAMEOBJECT_ROTATION_03));
		pbanner->pcbannerAura->SetUInt32Value(GAMEOBJECT_STATE, 1);
		pbanner->pcbannerAura->SetUInt32Value(GAMEOBJECT_TYPE_ID, 6);
		pbanner->pcbannerAura->SetUInt32Value(GAMEOBJECT_ANIMPROGRESS, 100);
		pbanner->pcbannerAura->AddToWorld();
	}
	
	pbanner->bannerslot = 2;
	
	// Stoneheart gravyard
	pbanner = SpawnGameObject(178389, 30 ,78.205989 ,-405.1715 ,47.11583 ,1.535766, 32, 83, 1);
	pbanner->SetUInt32Value(GAMEOBJECT_STATE, 1);
	pbanner->SetUInt32Value(GAMEOBJECT_TYPE_ID, 1);
	pbanner->SetUInt32Value(GAMEOBJECT_ANIMPROGRESS, 100);
	pbanner->AddToWorld();
	
	if(pbanner->GetInfo()->sound3)
	{
		pbanner->pcbannerAura = SpawnGameObject(pbanner->GetInfo()->sound3, 30, pbanner->GetPositionX(), pbanner->GetPositionY(), pbanner->GetPositionZ(), pbanner->GetOrientation(), 32, 114, 5);
		pbanner->pcbannerAura->SetFloatValue(GAMEOBJECT_ROTATION_02,pbanner->GetFloatValue(GAMEOBJECT_ROTATION_02));
		pbanner->pcbannerAura->SetFloatValue(GAMEOBJECT_ROTATION_03,pbanner->GetFloatValue(GAMEOBJECT_ROTATION_03));
		pbanner->pcbannerAura->SetUInt32Value(GAMEOBJECT_STATE, 1);
		pbanner->pcbannerAura->SetUInt32Value(GAMEOBJECT_TYPE_ID, 6);
		pbanner->pcbannerAura->SetUInt32Value(GAMEOBJECT_ANIMPROGRESS, 100);
		pbanner->pcbannerAura->AddToWorld();
	}
	
	pbanner->bannerslot = 3;
		   
	// Relief hunt
	pbanner = SpawnGameObject(178393, 30 ,-1403.875000 ,-309.393738 ,89.372269 ,0.204413, 32, 84, 1);
	pbanner->SetUInt32Value(GAMEOBJECT_STATE, 1);
	pbanner->SetUInt32Value(GAMEOBJECT_TYPE_ID, 1);
	pbanner->SetUInt32Value(GAMEOBJECT_ANIMPROGRESS, 100);
	pbanner->AddToWorld();
	
	if(pbanner->GetInfo()->sound3)
	{
		pbanner->pcbannerAura = SpawnGameObject(pbanner->GetInfo()->sound3, 30, pbanner->GetPositionX(), pbanner->GetPositionY(), pbanner->GetPositionZ(), pbanner->GetOrientation(), 32, 114, 5);
		pbanner->pcbannerAura->SetFloatValue(GAMEOBJECT_ROTATION_02,pbanner->GetFloatValue(GAMEOBJECT_ROTATION_02));
		pbanner->pcbannerAura->SetFloatValue(GAMEOBJECT_ROTATION_03,pbanner->GetFloatValue(GAMEOBJECT_ROTATION_03));
		pbanner->pcbannerAura->SetUInt32Value(GAMEOBJECT_STATE, 1);
		pbanner->pcbannerAura->SetUInt32Value(GAMEOBJECT_TYPE_ID, 6);
		pbanner->pcbannerAura->SetUInt32Value(GAMEOBJECT_ANIMPROGRESS, 100);
		pbanner->pcbannerAura->AddToWorld();
	}
	
	pbanner->bannerslot = 4;
	
	// Stormpike aid station
	pbanner = SpawnGameObject(178389, 30 ,639.348206 ,-31.571268 ,46.222248 ,4.638909, 32, 83, 1);
	pbanner->SetUInt32Value(GAMEOBJECT_STATE, 1);
	pbanner->SetUInt32Value(GAMEOBJECT_TYPE_ID, 1);
	pbanner->SetUInt32Value(GAMEOBJECT_ANIMPROGRESS, 100);
	pbanner->AddToWorld();
	
	if(pbanner->GetInfo()->sound3)
	{
		pbanner->pcbannerAura = SpawnGameObject(pbanner->GetInfo()->sound3, 30, pbanner->GetPositionX(), pbanner->GetPositionY(), pbanner->GetPositionZ(), pbanner->GetOrientation(), 32, 114, 5);
		pbanner->pcbannerAura->SetFloatValue(GAMEOBJECT_ROTATION_02,pbanner->GetFloatValue(GAMEOBJECT_ROTATION_02));
		pbanner->pcbannerAura->SetFloatValue(GAMEOBJECT_ROTATION_03,pbanner->GetFloatValue(GAMEOBJECT_ROTATION_03));
		pbanner->pcbannerAura->SetUInt32Value(GAMEOBJECT_STATE, 1);
		pbanner->pcbannerAura->SetUInt32Value(GAMEOBJECT_TYPE_ID, 6);
		pbanner->pcbannerAura->SetUInt32Value(GAMEOBJECT_ANIMPROGRESS, 100);
		pbanner->pcbannerAura->AddToWorld();
	}
	
	pbanner->bannerslot = 5;
	
	// iceblood tower
	pbanner = SpawnGameObject(178946, 30 ,-571.080994 ,-263.751007 ,75.092003 ,5.410520, 32, 84, 1);
	pbanner->SetUInt32Value(GAMEOBJECT_STATE, 1);
	pbanner->SetUInt32Value(GAMEOBJECT_TYPE_ID, 1);
	pbanner->SetUInt32Value(GAMEOBJECT_ANIMPROGRESS, 100);
	pbanner->AddToWorld();
	
	pbanner->bannerslot = 6;
	
	// Stoneheart bunker
	pbanner = SpawnGameObject(178935, 30 ,-149.734329 ,-441.907593 ,40.386887 ,4.147903, 32, 83, 1);
	pbanner->SetUInt32Value(GAMEOBJECT_STATE, 1);
	pbanner->SetUInt32Value(GAMEOBJECT_TYPE_ID, 1);
	pbanner->SetUInt32Value(GAMEOBJECT_ANIMPROGRESS, 100);
	pbanner->AddToWorld();
	
	pbanner->bannerslot = 7;
	   
	// Icewing bunker
	pbanner = SpawnGameObject(178935, 30 ,204.959793 ,-357.945190 ,56.377651 ,5.133710, 32, 83, 1);
	pbanner->SetUInt32Value(GAMEOBJECT_STATE, 1);
	pbanner->SetUInt32Value(GAMEOBJECT_TYPE_ID, 1);
	pbanner->SetUInt32Value(GAMEOBJECT_ANIMPROGRESS, 100);
	pbanner->AddToWorld();
	
	pbanner->bannerslot = 8;
	   
	// stormpike north bunker
	pbanner = SpawnGameObject(178935, 30 ,670.908020 ,-142.491776 ,63.662659 ,0.876855, 32, 83, 1);
	pbanner->SetUInt32Value(GAMEOBJECT_STATE, 1);
	pbanner->SetUInt32Value(GAMEOBJECT_TYPE_ID, 1);
	pbanner->SetUInt32Value(GAMEOBJECT_ANIMPROGRESS, 100);
	pbanner->AddToWorld();
	
	pbanner->bannerslot = 9;
	   
	// stormpike south bunker
	pbanner = SpawnGameObject(178935, 30 ,555.507324 ,-76.193176 ,51.934444 ,4.996268, 32, 83, 1);
	pbanner->SetUInt32Value(GAMEOBJECT_STATE, 1);
	pbanner->SetUInt32Value(GAMEOBJECT_TYPE_ID, 1);
	pbanner->SetUInt32Value(GAMEOBJECT_ANIMPROGRESS, 100);
	pbanner->AddToWorld();
	
	pbanner->bannerslot = 10;
	   
	bSpawned = true;
}
示例#8
0
GameObject* CBattleground::SpawnGameObject( uint32 entry, LocationVector &v, uint32 flags, uint32 faction, float scale ){
	return SpawnGameObject( entry, m_mapMgr->GetMapId(), v.x, v.y, v.z, v.o, flags, faction, scale );
}
示例#9
0
void Arena::OnCreate()
{
	GameObject* obj;
	WorldStateManager &sm = m_mapMgr->GetStateManager();

	switch(m_mapMgr->GetMapId())
	{
		/* loraedeon */
	case 572:
		{
			obj = SpawnGameObject(185917, 1278.647705f, 1730.556641f, 31.605574f, 1.68f, 32, 1375, 1.0f);
			obj->SetByte(GAMEOBJECT_BYTES_1,GAMEOBJECT_BYTES_STATE, 1);
			obj->SetByte(GAMEOBJECT_BYTES_1,GAMEOBJECT_BYTES_ANIMPROGRESS, 100);
			m_gates.insert(obj);

			obj = SpawnGameObject(185918, 1293.560791f, 1601.937988f, 31.605574f, 4.86f, 32, 1375, 1.0f);
			obj->SetByte(GAMEOBJECT_BYTES_1,GAMEOBJECT_BYTES_STATE, 1);
			obj->SetByte(GAMEOBJECT_BYTES_1,GAMEOBJECT_BYTES_ANIMPROGRESS, 100);
			m_gates.insert(obj);

			m_pcWorldStates[GREEN_TEAM] = WORLDSTATE_ARENA_LORDAERON_GREEN_PLAYER_COUNT;
			m_pcWorldStates[GOLD_TEAM] = WORLDSTATE_ARENA_LORDAERON_GOLD_PLAYER_COUNT;
			sm.CreateWorldState(WORLDSTATE_ARENA_LORDAERON_SCORE_SHOW, 1);
		}break;

		/* blades edge arena */
	case 562:
		{
			obj = SpawnGameObject(183972, 6177.707520f, 227.348145f, 3.604374f, -2.260201f, 32, 1375, 1.0f);
			obj->SetByte(GAMEOBJECT_BYTES_1,GAMEOBJECT_BYTES_STATE, 1);
			obj->SetByte(GAMEOBJECT_BYTES_1,GAMEOBJECT_BYTES_ANIMPROGRESS, 100);
			obj->PushToWorld(m_mapMgr);

			obj = SpawnGameObject(183973, 6189.546387f, 241.709854f, 3.101481f, 0.881392f, 32, 1375, 1.0f);
			obj->SetByte(GAMEOBJECT_BYTES_1,GAMEOBJECT_BYTES_STATE, 1);
			obj->SetByte(GAMEOBJECT_BYTES_1,GAMEOBJECT_BYTES_ANIMPROGRESS, 100);
			m_gates.insert(obj);

			obj = SpawnGameObject(183970, 6299.115723f, 296.549438f, 3.308032f, 0.881392f, 32, 1375, 1.0f);
			obj->SetByte(GAMEOBJECT_BYTES_1,GAMEOBJECT_BYTES_STATE, 1);
			obj->SetByte(GAMEOBJECT_BYTES_1,GAMEOBJECT_BYTES_ANIMPROGRESS, 100);
			obj->PushToWorld(m_mapMgr);

			obj = SpawnGameObject(183971, 6287.276855f, 282.187714f, 3.810925f, -2.260201f, 32, 1375, 1.0f);
			obj->SetByte(GAMEOBJECT_BYTES_1,GAMEOBJECT_BYTES_STATE, 1);
			obj->SetByte(GAMEOBJECT_BYTES_1,GAMEOBJECT_BYTES_ANIMPROGRESS, 100);
			m_gates.insert(obj);

			m_pcWorldStates[GREEN_TEAM] = WORLDSTATE_ARENA_BLADESEDGE_GREEN_PLAYER_COUNT;
			m_pcWorldStates[GOLD_TEAM] = WORLDSTATE_ARENA_BLADESEDGE_GOLD_PLAYER_COUNT;
			sm.CreateWorldState(WORLDSTATE_ARENA_BLADESEDGE_SCORE_SHOW, 1);
		}break;

		/* nagrand arena */
	case 559:
		{
			obj = SpawnGameObject(183979, 4090.064453f, 2858.437744f, 10.236313f, 0.492805f, 32, 1375, 1.0f);
			obj->SetByte(GAMEOBJECT_BYTES_1,GAMEOBJECT_BYTES_STATE, 1);
			obj->SetByte(GAMEOBJECT_BYTES_1,GAMEOBJECT_BYTES_ANIMPROGRESS, 100);
			obj->PushToWorld(m_mapMgr);

			obj = SpawnGameObject(183980, 4081.178955f, 2874.970459f, 12.391714f, 0.492805f, 32, 1375, 1.0f);
			obj->SetByte(GAMEOBJECT_BYTES_1,GAMEOBJECT_BYTES_STATE, 1);
			obj->SetByte(GAMEOBJECT_BYTES_1,GAMEOBJECT_BYTES_ANIMPROGRESS, 100);
			m_gates.insert(obj);

			obj = SpawnGameObject(183977, 4023.709473f, 2981.776611f, 10.701169f, -2.648788f, 32, 1375, 1.0f);
			obj->SetByte(GAMEOBJECT_BYTES_1,GAMEOBJECT_BYTES_STATE, 1);
			obj->SetByte(GAMEOBJECT_BYTES_1,GAMEOBJECT_BYTES_ANIMPROGRESS, 100);
			obj->PushToWorld(m_mapMgr);

			obj = SpawnGameObject(183978, 4031.854248f, 2966.833496f, 12.646200f, -2.648788f, 32, 1375, 1.0f);
			obj->SetByte(GAMEOBJECT_BYTES_1,GAMEOBJECT_BYTES_STATE, 1);
			obj->SetByte(GAMEOBJECT_BYTES_1,GAMEOBJECT_BYTES_ANIMPROGRESS, 100);
			m_gates.insert(obj);

			m_pcWorldStates[GREEN_TEAM] = WORLDSTATE_ARENA_NAGRAND_GREEN_PLAYER_COUNT;
			m_pcWorldStates[GOLD_TEAM] = WORLDSTATE_ARENA_NAGRAND_GOLD_PLAYER_COUNT;
			sm.CreateWorldState(WORLDSTATE_ARENA_NAGRAND_SCORE_SHOW, 1);
		}break;
		/* Dalaran Sewers */
	case 617:
		{
			obj = SpawnGameObject(192643, 1256.33996582031f, 770.06201171875f, 20.5f, 0.0f, 32, 1375, 1.29783f);
			if(obj)
			{
				obj->SetByte(GAMEOBJECT_BYTES_1,GAMEOBJECT_BYTES_STATE, 1);
				obj->SetByte(GAMEOBJECT_BYTES_1,GAMEOBJECT_BYTES_ANIMPROGRESS, 100);
				m_gates.insert(obj);
			}
			
			obj = SpawnGameObject(192642, 1327.2099609375f, 813.239990234375f, 20.5f, 0.0f, 32, 1375, 1.29783f);
			if(obj)
			{
				obj->SetByte(GAMEOBJECT_BYTES_1,GAMEOBJECT_BYTES_STATE, 1);
				obj->SetByte(GAMEOBJECT_BYTES_1,GAMEOBJECT_BYTES_ANIMPROGRESS, 100);
				m_gates.insert(obj);
			}

			// not rly blizzlike, should be spawn later, not on create, but who cares, will fix it later
			obj = SpawnGameObject(191877, 1291.974487f, 791.844666f, 9.339742f, 3.116816f, 32, 1375, 1.0f);
			if(obj)
				obj->PushToWorld(m_mapMgr);

			m_pcWorldStates[GREEN_TEAM] = WORLDSTATE_ARENA_WOTLK_GREEN_PLAYER_COUNT;
			m_pcWorldStates[GOLD_TEAM] = WORLDSTATE_ARENA_WOTLK_GOLD_PLAYER_COUNT;
			sm.CreateWorldState(WORLDSTATE_ARENA_WOTLK_SCORE_SHOW, 1);
		}break;
		/* The Ring of Valor */
	case 618:
		{
			/*TODO:
			 * - fix these elevators, i ran out of ideas, lost few hours...
			 * - spawn rest of those stupid gameobj, im too lazy to get their coords
			 * - that moving things shouldn't move all the time...
			 */

			//elevators
			obj = SpawnGameObject(194030, 763.93f, -295.0f, 26.0f/*0.0f*/, 0.0f, 40, 1375, 1.0f);
			if(obj)
			{
				obj->SetByte(GAMEOBJECT_BYTES_1, GAMEOBJECT_BYTES_TYPE_ID, 5);
				obj->PushToWorld(m_mapMgr);
			}

			obj = SpawnGameObject(194031, 763.93f, -274.0f, 26.0f/*0.0f*/, 0.0f, 40, 1375, 1.0f);
			if(obj)
			{
				obj->SetByte(GAMEOBJECT_BYTES_1, GAMEOBJECT_BYTES_TYPE_ID, 5);
				obj->PushToWorld(m_mapMgr);
			}
		
			//moving 'things'
			obj = SpawnGameObject(193458, 763.630f, -261.783f, 26.0f, 0.0f, 40, 1375, 1.0f);
			if(obj)
				obj->PushToWorld(m_mapMgr);

			obj = SpawnGameObject(193459, 763.761f, -306.230f, 26.0f, 0.0f, 40, 1375, 1.0f);
			if(obj)
				obj->PushToWorld(m_mapMgr);

			obj = SpawnGameObject(193460, 802.313f, -284.349f, 24.6f, 0.0f, 40, 1375, 1.0f);
			if(obj)
				obj->PushToWorld(m_mapMgr);

			obj = SpawnGameObject(193461, 723.522f, -284.428f, 24.6f, 0.0f, 40, 1375, 1.0f);
			if(obj)	
				obj->PushToWorld(m_mapMgr);

			//gates
			obj = SpawnGameObject(192392, 763.93f, -295.0f, 27.0f, 0.0f, 32, 1375, 1.0f);
			if(obj)
			{
				obj->SetByte(GAMEOBJECT_BYTES_1,GAMEOBJECT_BYTES_STATE, 1);
				obj->SetByte(GAMEOBJECT_BYTES_1,GAMEOBJECT_BYTES_ANIMPROGRESS, 100);
				m_gates.insert(obj);
			}

			obj = SpawnGameObject(192391, 763.93f, -274.0f, 27.0f, 0.0f, 32, 1375, 1.0f);
			if(obj)
			{
				obj->SetByte(GAMEOBJECT_BYTES_1,GAMEOBJECT_BYTES_STATE, 1);
				obj->SetByte(GAMEOBJECT_BYTES_1,GAMEOBJECT_BYTES_ANIMPROGRESS, 100);
				m_gates.insert(obj);
			}

			m_pcWorldStates[GREEN_TEAM] = WORLDSTATE_ARENA_WOTLK_GREEN_PLAYER_COUNT;
			m_pcWorldStates[GOLD_TEAM] = WORLDSTATE_ARENA_WOTLK_GOLD_PLAYER_COUNT;
			sm.CreateWorldState(WORLDSTATE_ARENA_WOTLK_SCORE_SHOW, 1);
		}break;
	}

	/* push gates into world */
	for(set< GameObject* >::iterator itr = m_gates.begin(); itr != m_gates.end(); ++itr)
		(*itr)->PushToWorld(m_mapMgr);

	
	// known world states
	sm.CreateWorldState(m_pcWorldStates[GREEN_TEAM], 0);
	sm.CreateWorldState(m_pcWorldStates[GOLD_TEAM], 0);

	// unknown world states
	sm.CreateWorldState(0x08D4	,0x0000);
	sm.CreateWorldState(0x08D8	,0x0000);
	sm.CreateWorldState(0x08D7	,0x0000);
	sm.CreateWorldState(0x08D6	,0x0000);
	sm.CreateWorldState(0x08D5	,0x0000);
	sm.CreateWorldState(0x08D3	,0x0000);
	sm.CreateWorldState(0x0C0D	,0x017B);
}
示例#10
0
void AlteracValley::HandleBanner(Player *p_caster,GameObject *go,uint32 spellid)
{
	int32 bannerslot = go->bannerslot;
		
	// spawn contest banner
	if(bannerslot > -1 && bannerslot < MAXOFBANNERS)
	{	
		sEventMgr.RemoveEvents(this,EVENT_BATTLEGROUND_AV_CAPTURE_BASE + bannerslot);
		
		// If whe contest a horde/alliance flag, he loses the base
		/*uint32 rbasesfield = p_caster->m_bgTeam ? AB_ALLIANCE_CAPTUREBASE : AB_HORDE_CAPTUREBASE;
		if(go->GetEntry() == 180078 || go->GetEntry() == 180076)
		{
			uint64 guid = p_caster->GetGUID();
			std::map<uint64, BattlegroundScore>::iterator itr = m_PlayerScores.find(guid);
			if(itr == m_PlayerScores.end())
			{
				SendMessageToPlayer(p_caster, "INTERNAL ERROR: Could not find in internal player score map!", true);
				return;
			}
			itr->second.FlagReturns++;
			UpdatePVPData();
			SetWorldStateValue(rbasesfield,WorldStateVars[rbasesfield]-1);
		}*/
		uint32 goentry = 0;
		if(bannerslot < 6) // outside flags are diferent
			goentry = p_caster->m_bgTeam ? 180420:180419;
		else
			goentry = p_caster->m_bgTeam ? 179435:178940;
			
		gcbanner[bannerslot] = SpawnGameObject(goentry, 30, go->GetPositionX(), go->GetPositionY(), go->GetPositionZ(), go->GetOrientation(), 32, 83, 1);
		GameObject *pcbanner = gcbanner[bannerslot];
		pcbanner->SetFloatValue(GAMEOBJECT_ROTATION_02,go->GetFloatValue(GAMEOBJECT_ROTATION_02));
		pcbanner->SetFloatValue(GAMEOBJECT_ROTATION_03,go->GetFloatValue(GAMEOBJECT_ROTATION_03));
		pcbanner->SetUInt32Value(GAMEOBJECT_STATE, 1);
		pcbanner->SetUInt32Value(GAMEOBJECT_TYPE_ID, 1);
		pcbanner->SetUInt32Value(GAMEOBJECT_ANIMPROGRESS, 100);
		pcbanner->SetUInt32Value(GAMEOBJECT_DYN_FLAGS,1);
		pcbanner->bannerslot = bannerslot;
		pcbanner->AddToWorld();
		
		if(pcbanner->GetInfo()->sound3)
		{		
			pcbanner->pcbannerAura = SpawnGameObject(pcbanner->GetInfo()->sound3, 30, go->GetPositionX(), go->GetPositionY(), go->GetPositionZ(), go->GetOrientation(), 32, 114, 5);
			pcbanner->pcbannerAura->SetFloatValue(GAMEOBJECT_ROTATION_02,go->GetFloatValue(GAMEOBJECT_ROTATION_02));
			pcbanner->pcbannerAura->SetFloatValue(GAMEOBJECT_ROTATION_03,go->GetFloatValue(GAMEOBJECT_ROTATION_03));
			pcbanner->pcbannerAura->SetUInt32Value(GAMEOBJECT_STATE, 1);
			pcbanner->pcbannerAura->SetUInt32Value(GAMEOBJECT_TYPE_ID, 6);
			pcbanner->pcbannerAura->SetUInt32Value(GAMEOBJECT_ANIMPROGRESS, 100);
			pcbanner->pcbannerAura->AddToWorld();
		}
		
		if(go->pcbannerAura)
		{
			if( go->pcbannerAura->IsInWorld() )
				go->pcbannerAura->RemoveFromWorld();
			delete go->pcbannerAura;
		
		}
		
				
		if( go->IsInWorld() )
			go->RemoveFromWorld();
		delete go;


		char message[300];   
		static char *resnames[11] = {"Frostworlf Gravyard","Iceblood Graveyard","Stormpike Gravyard",
									"Stoneheart gravyard","Relief Hunt","Stormpike Aid Station",
									"Iceblood Tower","Stoneheart Bunker","Icewing Bunker",
									"Stormpike North Bunker","Stormpike South Bunker"};
				
		snprintf(message, 300, "$N claims the %s! If left unchallenged, the %s will control it in 1 minute!", resnames[bannerslot] , p_caster->m_bgTeam ? "Horde" : "Alliance" );
		
		WorldPacket *data = BuildMessageChat(p_caster->m_bgTeam ? 0x54:0x53, 0, message, 0,p_caster->GetGUID());
		SendPacketToAll(data);
		delete data;
		
		sEventMgr.AddEvent(this, &AlteracValley::EventCaptureBase, p_caster, (uint32)bannerslot, EVENT_BATTLEGROUND_AV_CAPTURE_BASE + bannerslot, 60000, 1);
	}
	
}
示例#11
0
void IsleOfConquest::SpawnControlPoint(uint32 Id, uint32 Type)
{
	if( Id >= IOC_NUM_CONTROL_POINTS )
		return;

        GameObjectInfo * gi, * gi_aura;
        gi = GameObjectNameStorage.LookupEntry(ControlPointGoIds[Id][Type]);
        if(gi == NULL)
                return;

		controlpoint[ Id ].state = ControlPointTypes( Type );
		// remove old worldstate
		if( controlpoint[ Id ].worldstate != 0 )
			SetWorldState( controlpoint[ Id ].worldstate, 0 );

        gi_aura = gi->sound3 ? GameObjectNameStorage.LookupEntry(gi->sound3) : NULL;

		if( controlpoint[ Id ].banner == NULL)
        {
                controlpoint[ Id ].banner = SpawnGameObject(gi->ID, m_mapMgr->GetMapId(), ControlPointCoordinates[Id][0], ControlPointCoordinates[Id][1],
                ControlPointCoordinates[Id][2], ControlPointCoordinates[Id][3], 0, 35, 1.0f);

                controlpoint[ Id ].banner->SetByte(GAMEOBJECT_BYTES_1,GAMEOBJECT_BYTES_STATE, 1);
                controlpoint[ Id ].banner->SetByte(GAMEOBJECT_BYTES_1,GAMEOBJECT_BYTES_TYPE_ID, gi->Type);
                controlpoint[ Id ].banner->SetByte(GAMEOBJECT_BYTES_1,GAMEOBJECT_BYTES_ANIMPROGRESS, 100);
                controlpoint[ Id ].banner->SetUInt32Value(8+8, 1);
                controlpoint[ Id ].banner->SetUInt32Value(GAMEOBJECT_DISPLAYID, gi->DisplayID);

                switch(Type)
                {
                case IOC_SPAWN_TYPE_ALLIANCE_ASSAULT:
                case IOC_SPAWN_TYPE_ALLIANCE_CONTROLLED:
                        controlpoint[ Id ].banner->SetUInt32Value(GAMEOBJECT_FACTION, 2);
                        break;

                case IOC_SPAWN_TYPE_HORDE_ASSAULT:
                case IOC_SPAWN_TYPE_HORDE_CONTROLLED:
                        controlpoint[ Id ].banner->SetUInt32Value(GAMEOBJECT_FACTION, 1);
                        break;

                default:
                        controlpoint[ Id ].banner->SetUInt32Value(GAMEOBJECT_FACTION, 35);         // neutral
                        break;
                }

                controlpoint[ Id ].banner->bannerslot = static_cast<uint8>( Id );
                controlpoint[ Id ].banner->PushToWorld(m_mapMgr);
        }
        else
        {
                if(controlpoint[ Id ].banner->IsInWorld())
                        controlpoint[ Id ].banner->RemoveFromWorld(false);

                // assign it a new guid (client needs this to see the entry change?)
                controlpoint[ Id ].banner->SetNewGuid(m_mapMgr->GenerateGameobjectGuid());
                controlpoint[ Id ].banner->SetUInt32Value(OBJECT_FIELD_ENTRY, gi->ID);
                controlpoint[ Id ].banner->SetUInt32Value(GAMEOBJECT_DISPLAYID, gi->DisplayID);
                controlpoint[ Id ].banner->SetByte(GAMEOBJECT_BYTES_1,GAMEOBJECT_BYTES_TYPE_ID, gi->Type);

                switch(Type)
                {
                case IOC_SPAWN_TYPE_ALLIANCE_ASSAULT:
                case IOC_SPAWN_TYPE_ALLIANCE_CONTROLLED:
                        controlpoint[ Id ].banner->SetUInt32Value(GAMEOBJECT_FACTION, 2);
                        break;

                case IOC_SPAWN_TYPE_HORDE_ASSAULT:
                case IOC_SPAWN_TYPE_HORDE_CONTROLLED:
                        controlpoint[ Id ].banner->SetUInt32Value(GAMEOBJECT_FACTION, 1);
                        break;

                default:
                        controlpoint[ Id ].banner->SetUInt32Value(GAMEOBJECT_FACTION, 35);         // neutral
                        break;
                }

                controlpoint[ Id ].banner->SetInfo(gi);
                controlpoint[ Id ].banner->PushToWorld(m_mapMgr);
        }

		switch( Type ){
			case IOC_SPAWN_TYPE_NEUTRAL:
				controlpoint[ Id ].worldstate = NeutralFields[ Id ];
				break;

			case IOC_SPAWN_TYPE_ALLIANCE_ASSAULT:
				controlpoint[ Id ].worldstate = AssaultFields[ Id ][ TEAM_ALLIANCE ];
				break;

			case IOC_SPAWN_TYPE_HORDE_ASSAULT:
				controlpoint[ Id ].worldstate = AssaultFields[ Id ][ TEAM_HORDE ];
				break;

			case IOC_SPAWN_TYPE_ALLIANCE_CONTROLLED:
				controlpoint[ Id ].worldstate = OwnedFields[ Id ][ TEAM_ALLIANCE ];
				SpawnGraveyard( cptogy[ Id ], TEAM_ALLIANCE );
				break;

			case IOC_SPAWN_TYPE_HORDE_CONTROLLED:
				controlpoint[ Id ].worldstate = OwnedFields[ Id ][ TEAM_HORDE ];
				SpawnGraveyard( cptogy[ Id ], TEAM_HORDE );
				break;
		}

		// set new worldstate
		SetWorldState( controlpoint[ Id ].worldstate, 1 );

        if(gi_aura==NULL)
        {
                // remove it if it exists
                if(controlpoint[ Id ].aura!=NULL && controlpoint[ Id ].aura->IsInWorld())
                        controlpoint[ Id ].aura->RemoveFromWorld(false);
                        
                return;
        }

        if(controlpoint[ Id ].aura == NULL)
        {
                controlpoint[ Id ].aura = SpawnGameObject(gi_aura->ID, 628, ControlPointCoordinates[Id][0], ControlPointCoordinates[Id][1],
                ControlPointCoordinates[Id][2], ControlPointCoordinates[Id][3], 0, 35, 5.0f);

                controlpoint[ Id ].aura->SetByte(GAMEOBJECT_BYTES_1,GAMEOBJECT_BYTES_STATE, 1);
                controlpoint[ Id ].aura->SetByte(GAMEOBJECT_BYTES_1,GAMEOBJECT_BYTES_TYPE_ID, 6);
                controlpoint[ Id ].aura->SetByte(GAMEOBJECT_BYTES_1,GAMEOBJECT_BYTES_ANIMPROGRESS, 100);
                controlpoint[ Id ].aura->bannerauraslot = Id;
                controlpoint[ Id ].aura->PushToWorld(m_mapMgr);
        }
        else
        {
                if(controlpoint[ Id ].aura->IsInWorld())
                        controlpoint[ Id ].aura->RemoveFromWorld(false);

                // re-spawn the aura
                controlpoint[ Id ].aura->SetNewGuid(m_mapMgr->GenerateGameobjectGuid());
                controlpoint[ Id ].aura->SetUInt32Value(OBJECT_FIELD_ENTRY, gi_aura->ID);
                controlpoint[ Id ].aura->SetUInt32Value(GAMEOBJECT_DISPLAYID, gi_aura->DisplayID);
                controlpoint[ Id ].aura->SetInfo(gi_aura);
                controlpoint[ Id ].aura->PushToWorld(m_mapMgr);
        }       
}
示例#12
0
void IsleOfConquest::OnCreate()
{
	// generals/leaders!
	SpawnCreature(34924, 214.77f, -830.73f, 60.81f, 0.07f);	// High Commander Halford Wyrmbane (ALLIANCE)
	SpawnCreature(34922, 1296.57f, -765.78f, 69.98f, 6.22f);	// Overlord Agmar (HORDE)

	// Spawn const spiritguides
	AddSpiritGuide(SpawnSpiritGuide(NoBaseGYLocations[0][0], NoBaseGYLocations[0][1], NoBaseGYLocations[0][2], NoBaseGYLocations[0][3], 0));
	AddSpiritGuide(SpawnSpiritGuide(NoBaseGYLocations[1][0], NoBaseGYLocations[1][1], NoBaseGYLocations[1][2], NoBaseGYLocations[1][3], 1));


	// Spawn Teleporters
	for(uint32 i = 0; i < 6; i++)	// Alliance
	{
		m_teleporters[i] = SpawnGameObject(IOC_TRANSPORTER, iocTransporterLocation[i][0], iocTransporterLocation[i][1], iocTransporterLocation[i][2], iocTransporterLocation[i][3], 0, 1, 1.0f);
		m_teleporters[i]->PushToWorld(m_mapMgr);
		m_teleeffect[i] = SpawnGameObject(TELEPORTER_EFFECT_A, iocTransporterLocation[i][0], iocTransporterLocation[i][1], iocTransporterLocation[i][2], iocTransporterLocation[i][3], 0, 1, 1.0f);
		m_teleeffect[i]->PushToWorld(m_mapMgr);
	}
	for(uint32 i = 6; i < 12; i++)	// Horde
	{
		m_teleporters[i] = SpawnGameObject(IOC_TRANSPORTER, iocTransporterLocation[i][0], iocTransporterLocation[i][1], iocTransporterLocation[i][2], iocTransporterLocation[i][3], 0, 2, 1.0f);
		m_teleporters[i]->PushToWorld(m_mapMgr);
		m_teleeffect[i] = SpawnGameObject(TELEPORTER_EFFECT_H, iocTransporterLocation[i][0], iocTransporterLocation[i][1], iocTransporterLocation[i][2], iocTransporterLocation[i][3], 0, 1, 1.0f);
		m_teleeffect[i]->PushToWorld(m_mapMgr);
	}

	// Spawn Gates
	for(uint32 x = 0; x < 3; x++)
	{
		m_desgates[x] = SpawnGameObject(gatesIds[x], iocGatesLocation[x][0],  iocGatesLocation[x][1], iocGatesLocation[x][2], iocGatesLocation[x][3], 0, 1, 1.0f);
		m_desgates[x]->PushToWorld(m_mapMgr);
		m_desgates[x]->bannerslot = x;
		m_ogates[x] = SpawnGameObject(IOC_DYNAMIC_DOOR_A, iocGatesLocation[x][0],  iocGatesLocation[x][1], iocGatesLocation[x][2], iocGatesLocation[x][3], 0, 1, 1.0f);
		m_ogates[x]->SetUInt32Value(GAMEOBJECT_FLAGS, 32);
		m_ogates[x]->SetUInt32Value(GAMEOBJECT_DYNAMIC, 4294901760);
		m_ogates[x]->SetUInt32Value(GAMEOBJECT_FACTION, 1);
		m_ogates[x]->SetUInt32Value(GAMEOBJECT_BYTES_1, 4278190081);
		m_ogates[x]->PushToWorld(m_mapMgr);
	}

	for(uint32 x = 3; x < 6; x++)
	{
		m_desgates[x] = SpawnGameObject(gatesIds[x], iocGatesLocation[x][0],  iocGatesLocation[x][1], iocGatesLocation[x][2], iocGatesLocation[x][3], 0, 2, 1.0f);
		m_desgates[x]->PushToWorld(m_mapMgr);
		m_desgates[x]->bannerslot = x;
		m_ogates[x] = SpawnGameObject(IOC_DYNAMIC_DOOR_H, iocGatesLocation[x][0],  iocGatesLocation[x][1], iocGatesLocation[x][2], iocGatesLocation[x][3], 0, 2, 1.0f);
		m_ogates[x]->SetUInt32Value(GAMEOBJECT_FLAGS, 32);
		m_ogates[x]->SetUInt32Value(GAMEOBJECT_DYNAMIC, 4294901760);
		m_ogates[x]->SetUInt32Value(GAMEOBJECT_FACTION, 5);
		m_ogates[x]->SetUInt32Value(GAMEOBJECT_BYTES_1, 4278190081);
		m_ogates[x]->PushToWorld(m_mapMgr);
	}

	// Flagpole
	for(uint32 i = 0; i < IOC_NUM_CONTROL_POINTS; i++)
	{
		m_flagpole[i] = SpawnGameObject(IOC_FLAGPOLE, ControlPointCoordinates[i][0], ControlPointCoordinates[i][1], ControlPointCoordinates[i][2], ControlPointCoordinates[i][3], 0, 35, 1.0f);
		m_flagpole[i]->PushToWorld(m_mapMgr);
	}

	SpawnControlPoint(IOC_CONTROL_POINT_OILDERRICK,		IOC_SPAWN_TYPE_NEUTRAL);
	SpawnControlPoint(IOC_CONTROL_POINT_COBALTMINE,		IOC_SPAWN_TYPE_NEUTRAL);
	SpawnControlPoint(IOC_CONTROL_POINT_DOCKS,			IOC_SPAWN_TYPE_NEUTRAL);
	SpawnControlPoint(IOC_CONTROL_POINT_AIRSHIPHANGAR,	IOC_SPAWN_TYPE_NEUTRAL);
	SpawnControlPoint(IOC_CONTROL_POINT_SIEGEWORKSHOP,	IOC_SPAWN_TYPE_NEUTRAL);
	SpawnControlPoint(IOC_CONTROL_POINT_ALLIANCE_KEEP,	IOC_SPAWN_TYPE_ALLIANCE_CONTROLLED);
	SpawnControlPoint(IOC_CONTROL_POINT_HORDE_KEEP,		IOC_SPAWN_TYPE_HORDE_CONTROLLED);
}
示例#13
0
bool BattlefieldTB::SetupBattlefield()
{
    m_TypeId                    = BATTLEFIELD_TB;
    m_BattleId                  = BATTLEFIELD_BATTLEID_TB;
    m_ZoneId                    = BATTLEFIELD_TB_ZONEID;
    m_MapId                     = BATTLEFIELD_TB_MAPID;

    m_MaxPlayer                 = sWorld->getIntConfig(CONFIG_TOL_BARAD_PLR_MAX);
    m_IsEnabled                 = sWorld->getBoolConfig(CONFIG_TOL_BARAD_ENABLE);
    m_MinPlayer                 = sWorld->getIntConfig(CONFIG_TOL_BARAD_PLR_MIN);
    m_MinLevel                  = sWorld->getIntConfig(CONFIG_TOL_BARAD_PLR_MIN_LVL);
    m_BattleTime                = sWorld->getIntConfig(CONFIG_TOL_BARAD_BATTLETIME) * MINUTE * IN_MILLISECONDS;
    m_NoWarBattleTime           = sWorld->getIntConfig(CONFIG_TOL_BARAD_NOBATTLETIME) * MINUTE * IN_MILLISECONDS;
    m_RestartAfterCrash         = sWorld->getIntConfig(CONFIG_TOL_BARAD_RESTART_AFTER_CRASH) * MINUTE * IN_MILLISECONDS;

    m_TimeForAcceptInvite       = 20;
    m_StartGroupingTimer        = 15 * MINUTE * IN_MILLISECONDS;
    m_StartGrouping             = false;

    KickPosition.Relocate(-630.460f, 1184.504f, 95.766f, 0);
    KickPosition.m_mapId        = m_MapId;

    RegisterZone(m_ZoneId);

    m_Data32.resize(BATTLEFIELD_TB_DATA_MAX);

    m_Data32[BATTLEFIELD_TB_DATA_CAPTURED] = 0;

    m_saveTimer                 = 60000;

    SetGraveyardNumber(BATTLEFIELD_TB_GY_MAX);

    if ((sWorld->getWorldState(WS_TB_NEXT_BATTLE_TIMER_ENABLED) == 0) && (sWorld->getWorldState(WS_TB_HORDE_DEFENCE) == 0) && (sWorld->getWorldState(ClockBTWorldState[0]) == 0))
    {
        sWorld->setWorldState(WS_TB_NEXT_BATTLE_TIMER_ENABLED, uint64(false));
        sWorld->setWorldState(WS_TB_HORDE_DEFENCE, uint64(urand(0, 1)));
        sWorld->setWorldState(ClockBTWorldState[0], uint64(m_NoWarBattleTime));
    }

    if (sWorld->getWorldState(WS_TB_UNK) == 0)
        sWorld->setWorldState(WS_TB_UNK, urand(1, 3));

    if (sWorld->getWorldState(WS_TB_UNK_2) == 0)
        sWorld->setWorldState(WS_TB_UNK_2, time(NULL) + 86400);

    m_isActive = bool(sWorld->getWorldState(WS_TB_NEXT_BATTLE_TIMER_ENABLED));
    m_DefenderTeam = (TeamId)sWorld->getWorldState(WS_TB_HORDE_DEFENCE);

    m_Timer = sWorld->getWorldState(ClockBTWorldState[0]);

    if (m_isActive)
    {
        m_isActive = false;
        m_Timer = m_RestartAfterCrash;
    }

    for (uint8 i = 0; i < BATTLEFIELD_TB_GY_MAX; i++)
    {
        BfGraveyardTB* graveyard = new BfGraveyardTB(this);
        graveyard->Initialize(TBGraveYard[i].entryh, TBGraveYard[i].entrya, TBGraveYard[i].x, TBGraveYard[i].y,  TBGraveYard[i].z, TBGraveYard[i].o, m_DefenderTeam, TBGraveYard[i].gyid);
        m_GraveyardList[i] = graveyard;
    }

    for (uint8 i = 0; i < TB_MAX_WORKSHOP; i++)
    {
        BfTBWorkShopData* workshop = new BfTBWorkShopData(this);

        workshop->Init(TBWorkShopDataBase[i].worldstate, TBWorkShopDataBase[i].type, TBWorkShopDataBase[i].nameid);
        workshop->ChangeControl(GetDefenderTeam(),true);

        BfCapturePointTB* point = new BfCapturePointTB(this, GetDefenderTeam());

        point->SetCapturePointData(GetDefenderTeam() == TEAM_ALLIANCE ? TBWorkShopDataBase[i].CapturePoint.entrya : TBWorkShopDataBase[i].CapturePoint.entryh, BATTLEFIELD_TB_MAPID,
            TBWorkShopDataBase[i].CapturePoint.x, TBWorkShopDataBase[i].CapturePoint.y, TBWorkShopDataBase[i].CapturePoint.z, 0);
        point->LinkToWorkShop(workshop);
        AddCapturePoint(point);

        CapturePoints.insert(point);

        WorkShopList.insert(workshop);
    }

    for (uint8 i = 0; i < TB_MAX_DESTROY_MACHINE_NPC; i++)
    {
        if (Creature* creature = SpawnCreature(TBDestroyMachineNPC[i].entrya, TBDestroyMachineNPC[i].x, TBDestroyMachineNPC[i].y, TBDestroyMachineNPC[i].z, TBDestroyMachineNPC[i].o, GetAttackerTeam()))
        {
            HideNpc(creature);
            Vehicles.insert(creature->GetGUID());
        }
    }

    for (uint8 i = 0; i < TB_MAX_OBJ; i++)
    {
        GameObject* go = SpawnGameObject(TBGameObjectBuillding[i].entry, BATTLEFIELD_TB_MAPID, TBGameObjectBuillding[i].x, TBGameObjectBuillding[i].y, TBGameObjectBuillding[i].z, TBGameObjectBuillding[i].o);
        BfTBGameObjectBuilding* b = new BfTBGameObjectBuilding(this);
        b->Init(go,TBGameObjectBuillding[i].type,TBGameObjectBuillding[i].WorldState,TBGameObjectBuillding[i].nameid);
        b->m_State = BATTLEFIELD_TB_OBJECTSTATE_ALLIANCE_INTACT - (GetDefenderTeam() * 3);
        BuildingsInZone.insert(b);
    }

    for (uint8 i = 0; i < 4; i++)
    {
        if (Creature* creature = SpawnCreature(QuestGivers[i].entrya, QuestGivers[i].x, QuestGivers[i].y, QuestGivers[i].z, QuestGivers[i].o, TEAM_ALLIANCE))
        {
            HideNpc(creature);
            creature->setFaction(TolBaradFaction[TEAM_ALLIANCE]);
            questgiversA.insert(creature->GetGUID());
        }
    }

    for (uint8 i = 0; i < 4; i++)
    {
        if (Creature* creature = SpawnCreature(QuestGivers[i].entryh, QuestGivers[i].x, QuestGivers[i].y, QuestGivers[i].z, QuestGivers[i].o, TEAM_HORDE))
        {
            HideNpc(creature);
            creature->setFaction(TolBaradFaction[TEAM_HORDE]);
            questgiversH.insert(creature->GetGUID());
        }
    }

    {
        int i = 0;
        GuidSet questgivers = (GetDefenderTeam() == TEAM_ALLIANCE ? questgiversA : questgiversH);
        for (GuidSet::const_iterator itr = questgivers.begin(); itr != questgivers.end(); ++itr)
        {
            if (Unit* unit = sObjectAccessor->FindUnit((*itr)))
            {
                if (Creature* creature = unit->ToCreature())
                {
                    if (!i || i == sWorld->getWorldState(WS_TB_UNK))
                        if (!m_isActive)
                            ShowNpc(creature, true);
                    i++;
                }
            }
        }
    }

    for (uint8 i = 0; i < 23; i++)
    {
        if (Creature* creature = SpawnCreature(AllianceSpawnNPC[i].entrya, AllianceSpawnNPC[i].x, AllianceSpawnNPC[i].y, AllianceSpawnNPC[i].z, AllianceSpawnNPC[i].o, TEAM_ALLIANCE))
        {
            creature->setFaction(TolBaradFaction[TEAM_ALLIANCE]);
            npcAlliance.insert(creature->GetGUID());
        }
    }

    for (uint8 i = 0; i < 23; i++)
    {
        if (Creature* creature = SpawnCreature(HordeSpawnNPC[i].entrya, HordeSpawnNPC[i].x, HordeSpawnNPC[i].y, HordeSpawnNPC[i].z, HordeSpawnNPC[i].o, TEAM_HORDE))
        {
            creature->setFaction(TolBaradFaction[TEAM_HORDE]);
            npcHorde.insert(creature->GetGUID());
        }
    }

    for (uint8 i = 0; i < 130; i++)
    {
        if (Creature* creature = SpawnCreature(TbOldNpcStructure[i].entrya, TbOldNpcStructure[i].x, TbOldNpcStructure[i].y, TbOldNpcStructure[i].z, TbOldNpcStructure[i].o, TEAM_NEUTRAL))
        {
            creature->SetRespawnRadius(15.0f);
            creature->SetDefaultMovementType(RANDOM_MOTION_TYPE);
            creature->GetMotionMaster()->Initialize();
            npcOld.insert(creature->GetGUID());
        }
    }

    for (uint8 i = 0; i < 4; i++)
    {
        if (GameObject* go = SpawnGameObject(TBGameobjectsDoor[i].entrya, BATTLEFIELD_TB_MAPID, TBGameobjectsDoor[i].x, TBGameobjectsDoor[i].y, TBGameobjectsDoor[i].z, TBGameobjectsDoor[i].o))
        {
            go->ToGameObject()->SetLootState(GO_READY);
            go->ToGameObject()->UseDoorOrButton();
            goDoors.insert(go);
        }
    }
    return true;
}
示例#14
0
void IsleOfConquest::OnCreate()
{
    // generals/leaders!
    generals[TEAM_ALLIANCE] = SpawnCreature(34924, 214.77f, -830.73f, 60.81f, 0.07f, 1); // High Commander Halford Wyrmbane (ALLIANCE)
    generals[TEAM_HORDE] = SpawnCreature(34922, 1296.57f, -765.78f, 69.98f, 6.22f, 2); // Overlord Agmar (not sure this is the good general) (HORDE)

    // Spawn const spiritguides
    SpawnGraveyard(IOC_GY_ALLIANCE, TEAM_ALLIANCE);
    SpawnGraveyard(IOC_GY_HORDE, TEAM_HORDE);

    // Spawn Teleporters
    for (uint8 i = 0; i < 3; i++)
    {
        teleporter[i].teleporter = SpawnGameObject(IOC_TELEPORTER_A_IN, 628, iocTransporterLocation[i][0], iocTransporterLocation[i][1], iocTransporterLocation[i][2], iocTransporterLocation[i][3], 0, 1, 1.0f);
        teleporter[i].teleporter->PushToWorld(m_mapMgr);
    }

    for (uint8 i = 3; i < 6; i++)
    {
        teleporter[i].teleporter = SpawnGameObject(IOC_TELEPORTER_A_OUT, 628, iocTransporterLocation[i][0], iocTransporterLocation[i][1], iocTransporterLocation[i][2], iocTransporterLocation[i][3], 0, 1, 1.0f);
        teleporter[i].teleporter->PushToWorld(m_mapMgr);
    }

    for (uint8 i = 6; i < 9; i++)
    {
        teleporter[i].teleporter = SpawnGameObject(IOC_TELEPORTER_H_IN, 628, iocTransporterLocation[i][0], iocTransporterLocation[i][1], iocTransporterLocation[i][2], iocTransporterLocation[i][3], 0, 2, 1.0f);
        teleporter[i].teleporter->PushToWorld(m_mapMgr);
    }

    for (uint8 i = 9; i < 12; i++)
    {
        teleporter[i].teleporter = SpawnGameObject(IOC_TELEPORTER_H_OUT, 628, iocTransporterLocation[i][0], iocTransporterLocation[i][1], iocTransporterLocation[i][2], iocTransporterLocation[i][3], 0, 2, 1.0f);
        teleporter[i].teleporter->PushToWorld(m_mapMgr);
    }

    // spawn teleporter effects
    for (uint8 i = 0; i < 6; i++)
    {
        teleporter[i].effect = SpawnGameObject(TELEPORTER_EFFECT_A, 628, iocTransporterLocation[i][0], iocTransporterLocation[i][1], iocTransporterLocation[i][2], iocTransporterLocation[i][3], 0, 1, 1.0f);
        teleporter[i].effect->PushToWorld(m_mapMgr);
    }

    for (uint8 i = 6; i < 12; i++)
    {
        teleporter[i].effect = SpawnGameObject(TELEPORTER_EFFECT_H, 628, iocTransporterLocation[i][0], iocTransporterLocation[i][1], iocTransporterLocation[i][2], iocTransporterLocation[i][3], 0, 1, 1.0f);
        teleporter[i].effect->PushToWorld(m_mapMgr);
    }

    // Spawn Alliance gates
    for (uint8 i = 0; i < 3; i++)
    {
        gates[TEAM_ALLIANCE][i].gate = SpawnGameObject(allygateids[i], 628, allygatelocations[i][0], allygatelocations[i][1], allygatelocations[i][2], allygatelocations[i][3], 0, 1, 1.0f);
        gates[TEAM_ALLIANCE][i].gate->PushToWorld(m_mapMgr);
        gates[TEAM_ALLIANCE][i].dyngate = SpawnGameObject(IOC_DYNAMIC_GATE_ALLY, 628, allygatelocations[i][0], allygatelocations[i][1], allygatelocations[i][2], allygatelocations[i][3], 0, 1, 1.0f);
        gates[TEAM_ALLIANCE][i].dyngate->SetFlags(GO_FLAG_UNTARGETABLE);
        gates[TEAM_ALLIANCE][i].dyngate->PushToWorld(m_mapMgr);
    }

    //Spawn Horde gates
    for (uint8 i = 0; i < 3; i++)
    {
        gates[TEAM_HORDE][i].gate = SpawnGameObject(hordegateids[i], 628, hordegatelocations[i][0], hordegatelocations[i][1], hordegatelocations[i][2], hordegatelocations[i][3], 0, 2, 1.0f);
        gates[TEAM_HORDE][i].gate->PushToWorld(m_mapMgr);
        gates[TEAM_HORDE][i].dyngate = SpawnGameObject(IOC_DYNAMIC_GATE_HORDE, 628, hordegatelocations[i][0], hordegatelocations[i][1], hordegatelocations[i][2], hordegatelocations[i][3], 0, 2, 1.0f);
        gates[TEAM_HORDE][i].dyngate->SetFlags(GO_FLAG_UNTARGETABLE);
        gates[TEAM_HORDE][i].dyngate->PushToWorld(m_mapMgr);
    }

    //Spawn ally towergates
    for (uint8 i = 0; i < 2; i++)
    {
        towergates[TEAM_ALLIANCE][i] = SpawnGameObject(195436, AllyTowerGates[i], 0, 35, 1.0f);
        towergates[TEAM_ALLIANCE][i]->SetFlags(GO_FLAG_UNTARGETABLE);
        towergates[TEAM_ALLIANCE][i]->PushToWorld(m_mapMgr);
    }

    //Spawn horde towergates
    for (uint8 i = 0; i < 2; i++)
    {
        towergates[TEAM_HORDE][i] = SpawnGameObject(195437, HordeTowerGates[i], 0, 35, 0.5f);
        towergates[TEAM_HORDE][i]->SetFlags(GO_FLAG_UNTARGETABLE);
        towergates[TEAM_HORDE][i]->PushToWorld(m_mapMgr);
    }

    //Spawn Alliance keep canons
    for (uint8 i = 0; i < 12; i++)
        SpawnCreature(34944, AllyKeepCanons[i], 1);

    //Spawn Horde keep canons
    for (uint8 i = 0; i < 13; i++)
        SpawnCreature(34944, HordeKeepCanons[i], 2);

    //Spawn Alliance Keep guards
    for (uint8 i = 0; i < 4; i++)
        SpawnCreature(34919, AllyGuards[i], 1);

    //Spawn Horde Keep guards
    for (uint8 i = 0; i < 4; i++)
        SpawnCreature(34918, HordeGuards[i], 2);

    // Flagpole
    for (uint8 i = 0; i < IOC_NUM_CONTROL_POINTS; ++i)
    {
        controlpoint[i].pole = SpawnGameObject(IOC_FLAGPOLE, 628, ControlPointCoordinates[i][0], ControlPointCoordinates[i][1], ControlPointCoordinates[i][2], ControlPointCoordinates[i][3], 0, 35, 1.0f);
        controlpoint[i].pole->PushToWorld(m_mapMgr);
    }

    SpawnControlPoint(IOC_CONTROL_POINT_REFINERY, IOC_SPAWN_TYPE_NEUTRAL);
    SpawnControlPoint(IOC_CONTROL_POINT_QUARRY, IOC_SPAWN_TYPE_NEUTRAL);
    SpawnControlPoint(IOC_CONTROL_POINT_DOCKS, IOC_SPAWN_TYPE_NEUTRAL);
    SpawnControlPoint(IOC_CONTROL_POINT_HANGAR, IOC_SPAWN_TYPE_NEUTRAL);
    SpawnControlPoint(IOC_CONTROL_POINT_WORKSHOP, IOC_SPAWN_TYPE_NEUTRAL);
    SpawnControlPoint(IOC_CONTROL_POINT_ALLIANCE_KEEP, IOC_SPAWN_TYPE_ALLIANCE_CONTROLLED);
    SpawnControlPoint(IOC_CONTROL_POINT_HORDE_KEEP, IOC_SPAWN_TYPE_HORDE_CONTROLLED);
}
示例#15
0
void ArathiBasin::SpawnControlPoint(uint32 Id, uint32 Type)
{
    GameObjectInfo* gi, * gi_aura;
    gi = GameObjectNameStorage.LookupEntry(ControlPointGoIds[Id][Type]);
    if(gi == NULL)
        return;

    gi_aura = gi->sound3 ? GameObjectNameStorage.LookupEntry(gi->sound3) : NULL;

    if(m_controlPoints[Id] == NULL)
    {
        m_controlPoints[Id] = SpawnGameObject(gi->ID, m_mapMgr->GetMapId(), ControlPointCoordinates[Id][0], ControlPointCoordinates[Id][1],
                                              ControlPointCoordinates[Id][2], ControlPointCoordinates[Id][3], 0, 35, 1.0f);

        m_controlPoints[Id]->SetParentRotation(2, ControlPointRotations[Id][0]);
        m_controlPoints[Id]->SetParentRotation(3, ControlPointRotations[Id][1]);
        m_controlPoints[Id]->SetState(GAMEOBJECT_STATE_CLOSED);
        m_controlPoints[Id]->SetType(static_cast<uint8>(gi->Type));
        m_controlPoints[Id]->SetAnimProgress(100);
        m_controlPoints[Id]->Activate();
        m_controlPoints[Id]->SetDisplayId(gi->DisplayID);

        switch(Type)
        {
            case AB_SPAWN_TYPE_ALLIANCE_ASSAULT:
            case AB_SPAWN_TYPE_ALLIANCE_CONTROLLED:
                m_controlPoints[Id]->SetFaction(2);
                break;

            case AB_SPAWN_TYPE_HORDE_ASSAULT:
            case AB_SPAWN_TYPE_HORDE_CONTROLLED:
                m_controlPoints[Id]->SetFaction(1);
                break;

            default:
                m_controlPoints[Id]->SetFaction(35);        // neutral
                break;
        }

        m_controlPoints[Id]->bannerslot = static_cast<uint8>(Id);
        m_controlPoints[Id]->PushToWorld(m_mapMgr);
    }
    else
    {
        if(m_controlPoints[Id]->IsInWorld())
            m_controlPoints[Id]->RemoveFromWorld(false);

        // assign it a new guid (client needs this to see the entry change?)
        m_controlPoints[Id]->SetNewGuid(m_mapMgr->GenerateGameobjectGuid());
        m_controlPoints[Id]->SetEntry(gi->ID);
        m_controlPoints[Id]->SetDisplayId(gi->DisplayID);
        m_controlPoints[Id]->SetType(static_cast<uint8>(gi->Type));

        switch(Type)
        {
            case AB_SPAWN_TYPE_ALLIANCE_ASSAULT:
            case AB_SPAWN_TYPE_ALLIANCE_CONTROLLED:
                m_controlPoints[Id]->SetFaction(2);
                break;

            case AB_SPAWN_TYPE_HORDE_ASSAULT:
            case AB_SPAWN_TYPE_HORDE_CONTROLLED:
                m_controlPoints[Id]->SetFaction(1);
                break;

            default:
                m_controlPoints[Id]->SetFaction(35);        // neutral
                break;
        }

        m_controlPoints[Id]->SetInfo(gi);
        m_controlPoints[Id]->PushToWorld(m_mapMgr);
    }

    if(gi_aura == NULL)
    {
        // remove it if it exists
        if(m_controlPointAuras[Id] != NULL && m_controlPointAuras[Id]->IsInWorld())
            m_controlPointAuras[Id]->RemoveFromWorld(false);

        return;
    }

    if(m_controlPointAuras[Id] == NULL)
    {
        m_controlPointAuras[Id] = SpawnGameObject(gi_aura->ID, m_mapMgr->GetMapId(), ControlPointCoordinates[Id][0], ControlPointCoordinates[Id][1],
                                  ControlPointCoordinates[Id][2], ControlPointCoordinates[Id][3], 0, 35, 1.0f);

        m_controlPointAuras[Id]->SetParentRotation(2, ControlPointRotations[Id][0]);
        m_controlPointAuras[Id]->SetParentRotation(3, ControlPointRotations[Id][1]);
        m_controlPointAuras[Id]->SetState(GAMEOBJECT_STATE_CLOSED);
        m_controlPointAuras[Id]->SetType(GAMEOBJECT_TYPE_TRAP);
        m_controlPointAuras[Id]->SetAnimProgress(100);
        m_controlPointAuras[Id]->bannerauraslot = static_cast<uint8>(Id);
        m_controlPointAuras[Id]->PushToWorld(m_mapMgr);
    }
    else
    {
        if(m_controlPointAuras[Id]->IsInWorld())
            m_controlPointAuras[Id]->RemoveFromWorld(false);

        // re-spawn the aura
        m_controlPointAuras[Id]->SetNewGuid(m_mapMgr->GenerateGameobjectGuid());
        m_controlPointAuras[Id]->SetEntry(gi_aura->ID);
        m_controlPointAuras[Id]->SetDisplayId(gi_aura->DisplayID);
        m_controlPointAuras[Id]->SetInfo(gi_aura);
        m_controlPointAuras[Id]->PushToWorld(m_mapMgr);
    }
}
示例#16
0
void IsleOfConquest::SpawnControlPoint(uint32 Id, uint32 Type)
{
    if (Id >= IOC_NUM_CONTROL_POINTS)
        return;

    auto gameobject_info = sMySQLStore.GetGameObjectInfo(ControlPointGoIds[Id][Type]);
    if (gameobject_info == nullptr)
        return;

    controlpoint[Id].state = ControlPointTypes(Type);
    // remove old worldstate
    if (controlpoint[Id].worldstate != 0)
        SetWorldState(controlpoint[Id].worldstate, 0);

    auto gi_aura = gameobject_info->raw.parameter_3 ? sMySQLStore.GetGameObjectInfo(gameobject_info->raw.parameter_3) : nullptr;

    if (controlpoint[Id].banner == nullptr)
    {
        controlpoint[Id].banner = SpawnGameObject(gameobject_info->entry, m_mapMgr->GetMapId(), ControlPointCoordinates[Id][0], ControlPointCoordinates[Id][1],
            ControlPointCoordinates[Id][2], ControlPointCoordinates[Id][3], 0, 35, 1.0f);

        controlpoint[Id].banner->SetState(GO_STATE_CLOSED);
        controlpoint[Id].banner->SetType(static_cast<uint8>(gameobject_info->type));
        controlpoint[Id].banner->SetAnimProgress(100);
        controlpoint[Id].banner->Activate();
        controlpoint[Id].banner->SetDisplayId(gameobject_info->display_id);

        switch (Type)
        {
            case IOC_SPAWN_TYPE_ALLIANCE_ASSAULT:
            case IOC_SPAWN_TYPE_ALLIANCE_CONTROLLED:
                controlpoint[Id].banner->SetFaction(2);
                break;

            case IOC_SPAWN_TYPE_HORDE_ASSAULT:
            case IOC_SPAWN_TYPE_HORDE_CONTROLLED:
                controlpoint[Id].banner->SetFaction(1);
                break;

            default:
                controlpoint[Id].banner->SetFaction(35);         // neutral
                break;
        }

        controlpoint[Id].banner->PushToWorld(m_mapMgr);
    }
    else
    {
        if (controlpoint[Id].banner->IsInWorld())
            controlpoint[Id].banner->RemoveFromWorld(false);

        // assign it a new guid (client needs this to see the entry change?)
        controlpoint[Id].banner->SetNewGuid(m_mapMgr->GenerateGameobjectGuid());
        controlpoint[Id].banner->SetEntry(gameobject_info->entry);
        controlpoint[Id].banner->SetDisplayId(gameobject_info->display_id);
        controlpoint[Id].banner->SetType(static_cast<uint8>(gameobject_info->type));

        switch (Type)
        {
            case IOC_SPAWN_TYPE_ALLIANCE_ASSAULT:
            case IOC_SPAWN_TYPE_ALLIANCE_CONTROLLED:
                controlpoint[Id].banner->SetUInt32Value(GAMEOBJECT_FACTION, 2);
                break;

            case IOC_SPAWN_TYPE_HORDE_ASSAULT:
            case IOC_SPAWN_TYPE_HORDE_CONTROLLED:
                controlpoint[Id].banner->SetUInt32Value(GAMEOBJECT_FACTION, 1);
                break;

            default:
                controlpoint[Id].banner->SetUInt32Value(GAMEOBJECT_FACTION, 35);         // neutral
                break;
        }

        controlpoint[Id].banner->SetInfo(gameobject_info);
        controlpoint[Id].banner->PushToWorld(m_mapMgr);
    }

    switch (Type)
    {
        case IOC_SPAWN_TYPE_NEUTRAL:
            controlpoint[Id].worldstate = NeutralFields[Id];
            break;

        case IOC_SPAWN_TYPE_ALLIANCE_ASSAULT:
            controlpoint[Id].worldstate = AssaultFields[Id][TEAM_ALLIANCE];
            break;

        case IOC_SPAWN_TYPE_HORDE_ASSAULT:
            controlpoint[Id].worldstate = AssaultFields[Id][TEAM_HORDE];
            break;

        case IOC_SPAWN_TYPE_ALLIANCE_CONTROLLED:
            controlpoint[Id].worldstate = OwnedFields[Id][TEAM_ALLIANCE];
            SpawnGraveyard(cptogy[Id], TEAM_ALLIANCE);
            break;

        case IOC_SPAWN_TYPE_HORDE_CONTROLLED:
            controlpoint[Id].worldstate = OwnedFields[Id][TEAM_HORDE];
            SpawnGraveyard(cptogy[Id], TEAM_HORDE);
            break;
    }

    // set new worldstate
    SetWorldState(controlpoint[Id].worldstate, 1);

    if (gi_aura == nullptr)
    {
        // remove it if it exists
        if (controlpoint[Id].aura != nullptr && controlpoint[Id].aura->IsInWorld())
            controlpoint[Id].aura->RemoveFromWorld(false);

        return;
    }

    if (controlpoint[Id].aura == nullptr)
    {
        controlpoint[Id].aura = SpawnGameObject(gi_aura->entry, 628, ControlPointCoordinates[Id][0], ControlPointCoordinates[Id][1],
            ControlPointCoordinates[Id][2], ControlPointCoordinates[Id][3], 0, 35, 5.0f);

        controlpoint[Id].aura->SetState(GO_STATE_CLOSED);
        controlpoint[Id].aura->SetType(GAMEOBJECT_TYPE_TRAP);
        controlpoint[Id].aura->SetAnimProgress(100);
        controlpoint[Id].aura->PushToWorld(m_mapMgr);
    }
    else
    {
        if (controlpoint[Id].aura->IsInWorld())
            controlpoint[Id].aura->RemoveFromWorld(false);

        // re-spawn the aura
        controlpoint[Id].aura->SetNewGuid(m_mapMgr->GenerateGameobjectGuid());
        controlpoint[Id].aura->SetEntry(gi_aura->entry);
        controlpoint[Id].aura->SetDisplayId(gi_aura->display_id);
        controlpoint[Id].aura->SetInfo(gi_aura);
        controlpoint[Id].aura->PushToWorld(m_mapMgr);
    }
}
示例#17
0
文件: Arenas.cpp 项目: Chero/abcwow
void Arena::OnCreate()
{
	GameObject * obj;
	switch(m_mapMgr->GetMapId())
	{
		/* loraedeon */
	case 572: {
		obj = SpawnGameObject(185917, 572, 1278.647705f, 1730.556641f, 31.605574f, 1.684245f, 32, 1375, 1.0f);
		obj->SetUInt32Value(GAMEOBJECT_STATE, 1);
		obj->SetFloatValue(GAMEOBJECT_ROTATION_02, 0.746058f);
		obj->SetFloatValue(GAMEOBJECT_ROTATION_03, 0.665881f);
		m_gates.insert(obj);

		obj = SpawnGameObject(185918, 572, 1293.560791f, 1601.937988f, 31.605574f, -1.457349f, 32, 1375, 1.0f);
		obj->SetUInt32Value(GAMEOBJECT_STATE, 1);
		obj->SetFloatValue(GAMEOBJECT_ROTATION_02, -0.665881f);
		obj->SetFloatValue(GAMEOBJECT_ROTATION_03, 0.746058f);
		m_gates.insert(obj);

			  }break;

		/* blades edge arena */
	case 562: {
		obj = SpawnGameObject(183972, 562, 6177.707520f, 227.348145f, 3.604374f, -2.260201f, 32, 1375, 1.0f);
		obj->SetUInt32Value(GAMEOBJECT_STATE, 1);
		obj->SetFloatValue(GAMEOBJECT_ROTATION_02, 0.90445f);
		obj->SetFloatValue(GAMEOBJECT_ROTATION_03, -0.426569f);
		obj->PushToWorld(m_mapMgr);

		obj = SpawnGameObject(183973, 562, 6189.546387f, 241.709854f, 3.101481f, 0.881392f, 32, 1375, 1.0f);
		obj->SetUInt32Value(GAMEOBJECT_STATE, 1);
		obj->SetFloatValue(GAMEOBJECT_ROTATION_02, 0.426569f);
		obj->SetFloatValue(GAMEOBJECT_ROTATION_03, 0.904455f);
		m_gates.insert(obj);

		obj = SpawnGameObject(183970, 562, 6299.115723f, 296.549438f, 3.308032f, 0.881392f, 32, 1375, 1.0f);
		obj->SetUInt32Value(GAMEOBJECT_STATE, 1);
		obj->SetFloatValue(GAMEOBJECT_ROTATION_02, 0.426569f);
		obj->SetFloatValue(GAMEOBJECT_ROTATION_03, 0.904455f);
		obj->PushToWorld(m_mapMgr);

		obj = SpawnGameObject(183971, 562, 6287.276855f, 282.187714f, 3.810925f, -2.260201f, 32, 1375, 1.0f);
		obj->SetUInt32Value(GAMEOBJECT_STATE, 1);
		obj->SetFloatValue(GAMEOBJECT_ROTATION_02, 0.904455f);
		obj->SetFloatValue(GAMEOBJECT_ROTATION_03, -0.426569f);
		m_gates.insert(obj);
			  }break;

		/* nagrand arena */
	case 559: {
		obj = SpawnGameObject(183979, 559, 4090.064453f, 2858.437744f, 10.236313f, 0.492805f, 32, 1375, 1.0f);
		obj->SetUInt32Value(GAMEOBJECT_STATE, 1);
		obj->SetFloatValue(GAMEOBJECT_ROTATION_02, 0.243916f);
		obj->SetFloatValue(GAMEOBJECT_ROTATION_03, 0.969796f);
		obj->PushToWorld(m_mapMgr);

		obj = SpawnGameObject(183980, 559, 4081.178955f, 2874.970459f, 12.391714f, 0.492805f, 32, 1375, 1.0f);
		obj->SetUInt32Value(GAMEOBJECT_STATE, 1);
		obj->SetFloatValue(GAMEOBJECT_ROTATION_02, 0.243916f);
		obj->SetFloatValue(GAMEOBJECT_ROTATION_03, 0.969796f);
		m_gates.insert(obj);

		obj = SpawnGameObject(183977, 559, 4023.709473f, 2981.776611f, 10.701169f, -2.648788f, 32, 1375, 1.0f);
		obj->SetUInt32Value(GAMEOBJECT_STATE, 1);
		obj->SetFloatValue(GAMEOBJECT_ROTATION_02, 0.969796f);
		obj->SetFloatValue(GAMEOBJECT_ROTATION_03, -0.243916f);
		obj->PushToWorld(m_mapMgr);

		obj = SpawnGameObject(183978, 559, 4031.854248f, 2966.833496f, 12.646200f, -2.648788f, 32, 1375, 1.0f);
		obj->SetUInt32Value(GAMEOBJECT_STATE, 1);
		obj->SetFloatValue(GAMEOBJECT_ROTATION_02, 0.969796f);
		obj->SetFloatValue(GAMEOBJECT_ROTATION_03, -0.243916f);
		m_gates.insert(obj);

			  }break;
	}

	/* push gates into world */
	for(set<GameObject*>::iterator itr = m_gates.begin(); itr != m_gates.end(); ++itr)
		(*itr)->PushToWorld(m_mapMgr);

	SetWorldState(0x08D4	,0x0000);
	SetWorldState(0x08D8	,0x0000);
	SetWorldState(0x08D7	,0x0000);
	SetWorldState(0x08D6	,0x0000);
	SetWorldState(0x08D5	,0x0000);
	SetWorldState(0x08D3	,0x0000);
	SetWorldState(0x09F1	,0x0000);
	SetWorldState(0x09F0	,0x0000);
	SetWorldState(0x0C0D	,0x017B);
	SetWorldState(0x09F3	,0x0001);
}