Example #1
0
void
Spell::Effect_Transmitted(uint32 i)
{
    float fx,fy;
	WorldPacket data;

    float dis = GetRadius(sSpellRadius.LookupEntry(m_spellInfo->EffectRadiusIndex[i]));
    fx = m_caster->GetPositionX() + dis * cos(m_caster->GetOrientation());
    fy = m_caster->GetPositionY() + dis * sin(m_caster->GetOrientation());

	GameObject* pGameObj = new GameObject();
	uint32 name_id = m_spellInfo->EffectMiscValue[i];
	
	pGameObj->Create(
		objmgr.GenerateLowGuid(HIGHGUID_GAMEOBJECT),
		name_id,m_caster->GetMapId(), 
		fx, fy, m_caster->GetPositionZ(), 
		m_caster->GetOrientation(), 0, 0, 0, 0);

		
	pGameObj->SetUInt32Value(OBJECT_FIELD_ENTRY, m_spellInfo->EffectMiscValue[i] );
	pGameObj->SetUInt32Value(OBJECT_FIELD_TYPE, 33 );
	pGameObj->SetUInt32Value(OBJECT_FIELD_CREATED_BY, m_caster->GetGUIDLow() );
	pGameObj->SetUInt32Value(GAMEOBJECT_ROTATION+1, 0x3F63BB3C );  
	pGameObj->SetUInt32Value(GAMEOBJECT_ROTATION+2, 0xBEE9E017 );
	pGameObj->SetUInt32Value(GAMEOBJECT_LEVEL, m_caster->GetLevel() );

	pGameObj->PlaceOnMap();
	pGameObj->AddToWorld();

    data.Initialize(SMSG_GAMEOBJECT_SPAWN_ANIM);
    data << (uint64)pGameObj->GetGUID();
    m_caster->SendMessageToSet(&data,true);
}
void SpawnObjects(MapMgr *pmgr)
{
	if(pmgr->GetMapId() != 530)
		return;

	const static sgodata godata[] = {
		{ 182173, -290.016f, 3702.42f, 56.6729f, 0.0349066f, 0, 0, 0.0174524f, 0.999848f, 1, 32, 0, 1 },			// stadium
		{ 182174, -184.889f, 3476.93f, 38.205f, -0.0174535f, 0, 0, 0.00872664f, -0.999962f, 1, 32, 0, 1 },			// overlook
		{ 182175, -471.462f, 3451.09f, 34.6432f, 0.174533f, 0, 0, 0.0871557f, 0.996195f, 1, 32, 0, 1 },				// brokenhill
		{ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 },
	};

	const static sgodata godata_banner[] = {
		{ 183515, -289.61f, 3696.83f, 75.9447f, 3.12414f, 0, 0, 0.999962f, 0.00872656f, 1, 32, 1375, 1 },					// stadium
		{ 182525, -187.887f, 3459.38f, 60.0403f, -3.12414f, 0, 0, 0.999962f, -0.00872653f, 1, 32, 1375, 1 },				// overlook
		{ 183514, -467.078f, 3528.17f, 64.7121f, 3.14159f, 0, 0, 1, -4.37114E-8f, 1, 32, 1375, 1 },						// brokenhill
		{ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 },
	};

	for(uint32 i = 0; i < 3; ++i)
	{
		GameObject *pGo = pmgr->GetInterface()->SpawnGameObject(godata[i].entry, godata[i].posx, godata[i].posy, godata[i].posz, godata[i].facing, false, 0, 0);
		if(pGo == NULL)
			continue;

		GameObject *pGo2 = pmgr->GetInterface()->SpawnGameObject(godata_banner[i].entry, godata_banner[i].posx, godata_banner[i].posy, godata_banner[i].posz, godata_banner[i].facing, false, 0, 0);
		if(pGo2 == NULL)
		{
			pGo->Delete();
			continue;
		}

		pGo->SetUInt32Value(GAMEOBJECT_STATE, godata[i].state);
		pGo->SetUInt32Value(GAMEOBJECT_FLAGS, godata[i].flags);
		pGo->SetUInt32Value(GAMEOBJECT_FACTION, godata[i].faction);

		pGo2->SetUInt32Value(GAMEOBJECT_STATE, godata_banner[i].state);
		pGo2->SetUInt32Value(GAMEOBJECT_FLAGS, godata_banner[i].flags);
		pGo2->SetUInt32Value(GAMEOBJECT_FACTION, godata_banner[i].faction);

		for(uint32 j = 0; j < 4; ++j)
		{
			pGo->SetFloatValue(GAMEOBJECT_ROTATION + j, godata[i].orientation[j]);
			pGo2->SetFloatValue(GAMEOBJECT_ROTATION + j, godata_banner[i].orientation[j]);
		}

		// now make his script
		pGo->SetScript(new HellfirePeninsulaBannerAI(pGo));
		dynamic_cast<HellfirePeninsulaBannerAI*>(pGo->GetScript())->pBanner = pGo2;

		pGo->AddToWorld(pmgr);
		pGo2->AddToWorld(pmgr);

		dynamic_cast<HellfirePeninsulaBannerAI*>(pGo->GetScript())->SetupGo(pmgr);
	}
}
Example #3
0
void Arena::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);
	gate->AddToWorld();
	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);
	gate->AddToWorld();
	m_Gates.insert(gate);

	bSpawned = true;
}
Example #4
0
bool OutdoorPvPObjective::AddCapturePoint(uint32 entry, uint32 map, float x, float y, float z, float o, float rotation0, float rotation1, float rotation2, float rotation3)
{
    Map * pMap = MapManager::Instance().FindMap(map);
    if(!pMap)
        return false;

    GameObject* go = new GameObject;
    if (!go->Create(sObjectMgr.GenerateLowGuid(HIGHGUID_GAMEOBJECT), entry, pMap,
        PHASEMASK_NORMAL, x, y, z, o, rotation0, rotation1, rotation2, rotation3, 100, GO_STATE_READY))
    {
        sLog.outError("OutdoorPvP: Gameobject template %u not found in database.", entry);
        delete go;
        // TODO: Should we return here?
        //return false;
    }
    else
        go->AddToWorld();

    Creature* pCreature = new Creature;
    if (!pCreature->Create(sObjectMgr.GenerateLowGuid(HIGHGUID_UNIT), pMap,PHASEMASK_NORMAL, OPVP_TRIGGER_CREATURE_ENTRY, 0))
    {
        sLog.outError("OutdoorPvP: Can't create creature entry: %u",entry);
        delete pCreature;
        return false;
    }

    pCreature->Relocate(x, y, z, o);
    if (!pCreature->IsPositionValid())
    {
        sLog.outError("OutdoorPvP: Creature (guidlow %d, entry %d) not added to opvp. Suggested coordinates isn't valid (X: %f Y: %f)",pCreature->GetGUIDLow(),pCreature->GetEntry(),pCreature->GetPositionX(),pCreature->GetPositionY());
        delete pCreature;
        return false;
    }

    pCreature->AIM_Initialize();

    pMap->Add(pCreature);

    m_CapturePointCreature = MAKE_NEW_GUID(pCreature->GetGUID(), OPVP_TRIGGER_CREATURE_ENTRY, HIGHGUID_UNIT);
    m_CapturePoint = MAKE_NEW_GUID(go->GetGUID(), entry, HIGHGUID_GAMEOBJECT);

    // TODO: Use proper outdoor PvP GO type.
    GameObjectInfo const* goinfo = go->GetGOInfo();
    m_ShiftMaxPhase = goinfo->raw.data[17];
    m_ShiftMaxCaptureSpeed = m_ShiftMaxPhase / float(goinfo->raw.data[16]);
    m_NeutralValue = goinfo->raw.data[12];

    return true;
}
Example #5
0
bool OutdoorPvPObjective::AddObject(uint32 type, uint32 entry, uint32 map, float x, float y, float z, float o, float rotation0, float rotation1, float rotation2, float rotation3)
{
    Map * pMap = MapManager::Instance().FindMap(map);
    if (!pMap)
        return false;

    GameObject* go = new GameObject;
    if (!go->Create(sObjectMgr.GenerateLowGuid(HIGHGUID_GAMEOBJECT), entry, pMap,
        PHASEMASK_NORMAL, x, y, z, o, rotation0, rotation1, rotation2, rotation3, 100, GO_STATE_READY))
    {
        sLog.outError("OutdoorPvP: Gameobject template %u not found in database.", entry);
        delete go;
        return false;
     }
    m_Objects[type] = MAKE_NEW_GUID(go->GetGUID(), entry, HIGHGUID_GAMEOBJECT);
    m_ObjectTypes[m_Objects[type]] = type;
    go->AddToWorld();

    return true;
}
Example #6
0
bool BattleGround::AddObject(uint32 type, uint32 entry, float x, float y, float z, float o, float rotation0, float rotation1, float rotation2, float rotation3, uint32 /*respawnTime*/)
{
    // must be created this way, adding to godatamap would add it to the base map of the instance
    // and when loading it (in go::LoadFromDB()), a new guid would be assigned to the object, and a new object would be created
    // so we must create it specific for this instance
    GameObject * go = new GameObject;
    if(!go->Create(sObjectMgr.GenerateLowGuid(HIGHGUID_GAMEOBJECT),entry, GetBgMap(),x,y,z,o,rotation0,rotation1,rotation2,rotation3,100,GO_STATE_READY))
    {
        sLog.outErrorDb("Gameobject template %u not found in database! BattleGround not created!", entry);
        sLog.outError("Cannot create gameobject template %u! BattleGround not created!", entry);
        delete go;
        return false;
    }
/*
    uint32 guid = go->GetGUIDLow();

    // without this, UseButtonOrDoor caused the crash, since it tried to get go info from godata
    // iirc that was changed, so adding to go data map is no longer required if that was the only function using godata from GameObject without checking if it existed
    GameObjectData& data = objmgr.NewGOData(guid);

    data.id             = entry;
    data.mapid          = GetMapId();
    data.posX           = x;
    data.posY           = y;
    data.posZ           = z;
    data.orientation    = o;
    data.rotation0      = rotation0;
    data.rotation1      = rotation1;
    data.rotation2      = rotation2;
    data.rotation3      = rotation3;
    data.spawntimesecs  = respawnTime;
    data.spawnMask      = 1;
    data.animprogress   = 100;
    data.go_state       = 1;
*/
    // add to world, so it can be later looked up from HashMapHolder
    go->AddToWorld();
    m_BgObjects[type] = go->GetGUID();
    return true;
}
Example #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;
}
Example #8
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);
	}
	
}
Example #9
0
void AlteracValley::EventCaptureBase(Player *src,uint32 bannerslot)
{
	if(!gcbanner[bannerslot])
		return;
		
	   /*uint64 guid = src->GetGUID();
	std::map<uint64, BattlegroundScore>::iterator itr = m_PlayerScores.find(guid);
	if(itr == m_PlayerScores.end())
	{
		SendMessageToPlayer(src, "INTERNAL ERROR: Could not find in internal player score map!", true);
		return;
	}
	itr->second.FlagCaptures++;
	UpdatePVPData();*/
			
	//uint32 rbasesfield = src->m_bgTeam ? AB_HORDE_CAPTUREBASE : AB_ALLIANCE_CAPTUREBASE;
	   
	uint32 goentry = 0;
	if(bannerslot < 6) // outside flags are diferent
		goentry = src->m_bgTeam ? 178393:178389;
	else
		goentry = src->m_bgTeam ? 178946:178935;

	GameObject *pcbanner = src->GetCurrentBattleground()->SpawnGameObject(goentry, 30, gcbanner[bannerslot]->GetPositionX(), gcbanner[bannerslot]->GetPositionY(), gcbanner[bannerslot]->GetPositionZ(), gcbanner[bannerslot]->GetOrientation(), 32, src->m_bgTeam ?84:83, 1);
	pcbanner->SetFloatValue(GAMEOBJECT_ROTATION_02,gcbanner[bannerslot]->GetFloatValue(GAMEOBJECT_ROTATION_02));
	pcbanner->SetFloatValue(GAMEOBJECT_ROTATION_03,gcbanner[bannerslot]->GetFloatValue(GAMEOBJECT_ROTATION_03));
	pcbanner->SetUInt32Value(GAMEOBJECT_STATE, 1);
	pcbanner->SetUInt32Value(GAMEOBJECT_TYPE_ID, 1);
	pcbanner->SetUInt32Value(GAMEOBJECT_ANIMPROGRESS, 100);
	pcbanner->AddToWorld();
	
	if(pcbanner->GetInfo()->sound3)
	{
		pcbanner->pcbannerAura = src->GetCurrentBattleground()->SpawnGameObject(pcbanner->GetInfo()->sound3, 30, pcbanner->GetPositionX(), pcbanner->GetPositionY(), pcbanner->GetPositionZ(), pcbanner->GetOrientation(), 32, 114, 5);
		pcbanner->pcbannerAura->SetFloatValue(GAMEOBJECT_ROTATION_02,pcbanner->GetFloatValue(GAMEOBJECT_ROTATION_02));
		pcbanner->pcbannerAura->SetFloatValue(GAMEOBJECT_ROTATION_03,pcbanner->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(gcbanner[bannerslot]->pcbannerAura)
	{
		if( gcbanner[bannerslot]->pcbannerAura->IsInWorld() )
			gcbanner[bannerslot]->pcbannerAura->RemoveFromWorld();
		delete gcbanner[bannerslot]->pcbannerAura;
	}
	
	if( gcbanner[bannerslot]->IsInWorld() )
			gcbanner[bannerslot]->RemoveFromWorld();
	delete gcbanner[bannerslot];
	
	gcbanner[bannerslot] = NULL;
	
	// Play sound
	WorldPacket pkt;
	pkt.Initialize(SMSG_PLAY_SOUND);
	pkt << uint32(src->m_bgTeam ? SOUND_HORDE_CAPTURE : SOUND_ALLIANCE_CAPTURE);
	SendPacketToAll(&pkt);
	
	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, "The %s has taken the %s!", src->m_bgTeam ? "Horde" : "Alliance" , resnames[bannerslot] );
		
	WorldPacket *data = BuildMessageChat(src->m_bgTeam ? 0x54:0x53, 0x27, message, 0);
	SendPacketToAll(data);
	delete data;
}
Example #10
0
void GameEventMgr::ProcessObjectsAndScriptsProc(QueryResultVector & results, uint32 id)
{
	// process scripts
	if(QueryResult *query = results[0].result)
	{
		do
		{
			Field * f = query->Fetch();
			uint32 mapid = f[1].GetUInt32();
			uint32 sql_id = f[2].GetUInt32();
			uint8 type = f[3].GetUInt8();
			uint32 data1 = f[4].GetUInt32();
			uint32 data2 = f[5].GetUInt32();
			uint32 data3 = f[6].GetUInt32();
			char * say = strdup(f[7].GetString());

			DoScript(id, sql_id, type, data1, data2, data3, say, mapid);
		}
		while(query->NextRow());
	}

	// waypoints -- the created objects will be deleted automatically by creature class on despawn
	std::map<uint32, std::map<uint32, std::list<WayPoint *>>> waypoints;
	if(QueryResult *query = results[1].result)
	{
		do
		{
			Field * f = query->Fetch();

			WayPoint *wp = new WayPoint;
			//uint32 event = f[0].GetUInt32();
			uint32 spawnid = f[1].GetUInt32();
			wp->id = f[2].GetUInt32();
			wp->x = f[3].GetFloat();
			wp->y = f[4].GetFloat();
			wp->z = f[5].GetFloat();
			wp->waittime = f[6].GetUInt32();
			wp->flags = f[7].GetUInt32();
			wp->forwardemoteoneshot = f[8].GetBool();
			wp->forwardemoteid = f[9].GetUInt32();
			wp->backwardemoteoneshot = f[10].GetBool();
			wp->backwardemoteid = f[11].GetUInt32();
			wp->forwardskinid = f[12].GetUInt32();
			wp->backwardskinid = f[13].GetUInt32();

			waypoints[id][spawnid].push_back(wp);
		}
		while(query->NextRow());
	}

	// creature spawns
	if(QueryResult *query = results[2].result)
	{
		do
		{
			Field * f = query->Fetch();

			CreatureSpawn spawn;
			//uint32 event = f[0].GetUInt32();
			uint32 spawn_id = f[1].GetUInt32();
			spawn.id = 0;
			spawn.entry = f[2].GetUInt32();
			uint32 mapid = f[3].GetUInt32();
			spawn.x = f[4].GetFloat();
			spawn.y = f[5].GetFloat();
			spawn.z = f[6].GetFloat();
			spawn.o = f[7].GetFloat();
			spawn.form = NULL;
			spawn.movetype = f[8].GetUInt8();
			spawn.displayid = f[9].GetUInt32();
			spawn.factionid = f[10].GetUInt32();
			spawn.flags = f[11].GetUInt32();
			spawn.bytes0 = f[12].GetUInt32();
			spawn.bytes1 = f[13].GetUInt32();
			spawn.bytes2 = f[14].GetUInt32();
			spawn.emote_state = f[15].GetUInt32();
			//uint32 npc_respawn_link = f[17].GetUInt32();
			spawn.channel_spell = f[17].GetUInt16();
			spawn.channel_target_go = f[18].GetUInt32();
			spawn.channel_target_creature = f[19].GetUInt32();
			spawn.stand_state = f[20].GetUInt16();
			spawn.death_state = f[21].GetUInt32();
			spawn.MountedDisplayID = f[22].GetUInt32();
			spawn.Item1SlotDisplay = f[23].GetUInt32();
			spawn.Item2SlotDisplay = f[24].GetUInt32();
			spawn.Item3SlotDisplay = f[25].GetUInt32();
			spawn.CanFly = f[26].GetUInt32();
			spawn.phase = f[27].GetUInt32();
			if(spawn.phase == 0) spawn.phase = 0xFFFFFFFF;

			CreatureProto* proto = CreatureProtoStorage.LookupEntry(spawn.entry);
			CreatureInfo* info = CreatureNameStorage.LookupEntry(spawn.entry);
			if(proto == NULL || info == NULL)
			{
				continue;
			}

			// get mapmgr for spawn
			MapMgr * mgr = sInstanceMgr.GetMapMgr(mapid);
			if(mgr == NULL)
			{
				// So this is a really interesting situation!
				Log.Success("GameEvent","Failed to spawn creature spawn %u for event %u on nonexistant map %u", spawn.id, id, mapid);
				continue;
			}

			// spawn the creature
			//Creature * crt = mgr->GetInterface()->SpawnCreature(&spawn, true);
			Creature * crt = mgr->CreateCreature(spawn.entry);
			if(crt == NULL)
			{
				// we didnt succeed creating the creature! Print a warning and go on
 				Log.Success("GameEvent","Failed to spawn creature spawn %u for event %u", spawn.id, id);
				continue;
			}

			crt->Load(&spawn, 0, mgr->GetMapInfo());

			crt->spawnid = 0;
			crt->m_spawn = NULL;

			// add waypoints
			crt->m_custom_waypoint_map = new WayPointMap();
			for(std::list<WayPoint *>::iterator itr = waypoints[id][spawn_id].begin(); itr != waypoints[id][spawn_id].end(); itr++)
			{
				// use custom waypoint map, so we avoid saving it to database
				crt->m_custom_waypoint_map->push_back(*itr);
			}

			crt->GetAIInterface()->SetWaypointMap(crt->m_custom_waypoint_map);
			crt->AddToWorld(mgr);

			m_creaturespawns[id][mapid].push_back(crt->GetUIdFromGUID());
		}
		while(query->NextRow());
	}

	// gameobject spawns
	if(QueryResult *query = results[3].result)
	{
		do
		{
			Field * f = query->Fetch();

			GOSpawn spawn;
			//uint32 event = f[0].GetUInt32();
			uint32 spawn_id = f[1].GetUInt32();
			// generate new ingame sql id
			spawn.id = /*objmgr.GenerateCreatureSpawnID()*/0;
			spawn.entry = f[2].GetUInt32();
			uint32 mapid = f[3].GetUInt32();
			spawn.x = f[4].GetFloat();
			spawn.y = f[5].GetFloat();
			spawn.z = f[6].GetFloat();
			spawn.facing = f[7].GetFloat();
			spawn.o = f[8].GetFloat();
			spawn.o1 = f[9].GetFloat();
			spawn.o2 = f[10].GetFloat();
			spawn.o3 = f[11].GetFloat();
			spawn.state = f[12].GetUInt32();
			spawn.flags = f[13].GetUInt32();
			spawn.faction = f[14].GetUInt32();
			spawn.scale = f[15].GetFloat();
			//uint32 state_npc_link = fields[16].GetUInt32();
			spawn.phase = f[17].GetUInt32();
			if(spawn.phase == 0) spawn.phase = 0xFFFFFFFF;
			spawn.overrides = f[18].GetUInt32();

			// get mapmgr for spawn
			MapMgr * mgr = sInstanceMgr.GetMapMgr(mapid);
			if(mgr == NULL)
			{
				// So this is a really interesting situation!
				Log.Success("GameEvent","Failed to spawn gameobject spawn %u for event %u on nonexistant map %u", spawn.id, id, mapid);
				continue;
			}

			// spawn the creature
			GameObject * go = mgr->CreateGameObject(spawn.entry);
			if(go == NULL)
			{
				// we didnt succeed creating the creature! Print a warning and go on
 				Log.Success("GameEvent","Failed to spawn gameobject spawn %u for event %u", spawn.id, id);
				continue;
			}

			go->Load(&spawn);

			go->m_spawn = NULL;

			go->AddToWorld(mgr);

			m_gameobjectspawns[id][mapid].push_back(go->GetUIdFromGUID());
		}
		while(query->NextRow());
	}

	Log.Success("GameEvent","event %u spawned.", id);
}