void WintergraspWorkshopData::OnBattleStart() { // Update graveyard UpdateGraveyard(); // Show Engineer if (Creature* pEngineer = m_WG->GetCreature(m_Engineer[m_TeamControl])) m_WG->ShowNpc(pEngineer, false); if (m_workshopId < BATTLEFIELD_WG_WORKSHOP_KEEP_WEST) { // Reset creatures for (GuidSet::const_iterator itr = m_CreatureOnPoint[m_TeamControl].begin(); itr != m_CreatureOnPoint[m_TeamControl].end(); ++itr) if (Creature* pCreature = m_WG->GetCreature(*itr)) pCreature->SetPosition(pCreature->GetHomePosition()); // Show rocket launchers for (GuidSet::const_iterator itr = m_RocketLauncherOnPoint.begin(); itr != m_RocketLauncherOnPoint.end(); ++itr) { if (Creature* pCreature = m_WG->GetCreature(*itr)) { m_WG->ShowNpc(pCreature, false); pCreature->setFaction(WintergraspFaction[GetTeam()]); } } // Spawning Factory Banner WintergraspObjectPositionData factory = CapturableWorkshops[m_workshopId].GameObjectMain[1]; GameObject* pFactory = m_WG->SpawnGameObject(factory.entryHorde, factory.x, factory.y, factory.z, factory.o); if (!pFactory) return; // Create and Add Capturable Point WintergraspCapturePoint* capturePoint = new WintergraspCapturePoint(m_WG, TeamId(m_TeamControl)); if (!capturePoint) return; capturePoint->SetCapturePointData(pFactory); capturePoint->LinkToWorkshop(this); m_WG->AddCapturablePoint(capturePoint); // Save factory banner guid and entry m_FactoryGUID = pFactory->GetGUID(); m_FactoryEntry = pFactory->GetEntry(); // Update GameObject ArtKit of the Factory Banner (only outside workshops) GameObject::SetGoArtKit(m_TeamControl ? GO_ARTKIT_FACTORY_HORDE : GO_ARTKIT_FACTORY_ALLIANCE, pFactory, pFactory->GetGUIDLow()); } }
void BattlefieldWG::OnGameObjectCreate(GameObject* go) { bool isWorkshop = false; uint8 workshopId = 0; switch (go->GetEntry()) { case GO_WINTERGRASP_FACTORY_BANNER_NE: isWorkshop = true; workshopId = BATTLEFIELD_WG_WORKSHOP_NE; break; case GO_WINTERGRASP_FACTORY_BANNER_NW: isWorkshop = true; workshopId = BATTLEFIELD_WG_WORKSHOP_NW; break; case GO_WINTERGRASP_FACTORY_BANNER_SE: isWorkshop = true; workshopId = BATTLEFIELD_WG_WORKSHOP_SE; break; case GO_WINTERGRASP_FACTORY_BANNER_SW: isWorkshop = true; workshopId = BATTLEFIELD_WG_WORKSHOP_SW; break; } if (!isWorkshop) return; for (Workshop::const_iterator itr = WorkshopsList.begin(); itr != WorkshopsList.end(); ++itr) { if (WGWorkshop* workshop = (*itr)) { if (workshop->workshopId == workshopId) { WintergraspCapturePoint* capturePoint = new WintergraspCapturePoint(this, GetAttackerTeam()); capturePoint->SetCapturePointData(go); capturePoint->LinkToWorkshop(workshop); AddCapturePoint(capturePoint); break; } } } }