Пример #1
0
void Arena::OnStart()
{
	/* remove arena readyness buff */
	for(uint32 i = 0; i < 2; i++) {
		for(set<Player*  >::iterator itr = m_players[i].begin(); itr != m_players[i].end(); itr++) {
			Player* plr = *itr;
			plr->RemoveAura(ARENA_PREPARATION);
		}
	}

	/* open gates */
	for(set< GameObject* >::iterator itr = m_gates.begin(); itr != m_gates.end(); itr++)
	{
		(*itr)->SetUInt32Value(GAMEOBJECT_FLAGS, 64);
		(*itr)->SetByte(GAMEOBJECT_BYTES_1,GAMEOBJECT_BYTES_STATE, 0);
	}

	m_started = true;

	/* Incase all players left */
	UpdatePlayerCounts();

	// soundz!
	PlaySoundToAll(SOUND_BATTLEGROUND_BEGIN);
}
Пример #2
0
void Arena::OnStart()
{
	int i;

	/* remove arena readyness buff */
	for(i = 0; i < 2; ++i) {
		for(set<Player*>::iterator itr = m_players[i].begin(); itr != m_players[i].end(); ++itr) 
		{
			(*itr)->RemoveAura(ARENA_PREPARATION);
		}
	}

	/* open gates */
	for(set<GameObject*>::iterator itr = m_gates.begin(); itr != m_gates.end(); ++itr)
	{
		(*itr)->SetUInt32Value(GAMEOBJECT_FLAGS, 64);
		(*itr)->SetUInt32Value(GAMEOBJECT_STATE, 0);
	}

	m_started = true;

	/* Incase all players left */
	UpdatePlayerCounts();

	// soundz!
	PlaySoundToAll(SOUND_BATTLEGROUND_BEGIN);

	sEventMgr.RemoveEvents(this, EVENT_ARENA_SHADOW_SIGHT);
	sEventMgr.AddEvent(((CBattleground*)this), &CBattleground::HookOnShadowSight, EVENT_ARENA_SHADOW_SIGHT, 90000, 1,0);
}
Пример #3
0
void Arena::HookOnPlayerKill(Player* plr, Unit* pVictim)
{
	if( !pVictim->IsPlayer() )
		return;

	plr->m_bgScore.KillingBlows++;
	UpdatePlayerCounts();
}
Пример #4
0
void Arena::HookOnPlayerDeath(PlayerPointer plr)
{
	ASSERT(plr != NULL);

	if (hashmap_get(m_playersAlive, plr->GetLowGUID(), NULL) == MAP_OK) {
		m_playersCount[plr->GetTeam()]--;
		UpdatePlayerCounts();
		hashmap_remove(m_playersAlive, plr->GetLowGUID());
	}
}
Пример #5
0
void Arena::OnStart()
{
	int i;

	/* remove arena readiness buff */
	for(i = 0; i < 2; ++i)
	{
		for(set<Player*>::iterator itr = m_players[i].begin(); itr != m_players[i].end(); ++itr)
		{
			Player* plr = *itr;
			plr->RemoveAura(ARENA_PREPARATION);
			m_players2[i].insert(plr->GetLowGUID());

			/* update arena team stats */
			if(rated_match && plr->m_arenaTeams[m_arenateamtype] != NULL)
			{
				m_teams[i] = plr->m_arenaTeams[m_arenateamtype];
				ArenaTeamMember* tp = m_teams[i]->GetMember(plr->getPlayerInfo());
				if(tp != NULL)
				{
					tp->Played_ThisWeek++;
					tp->Played_ThisSeason++;
				}
			}
		}
	}

	for(i = 0; i < 2; i++)
	{
		if(m_teams[i] == NULL) continue;

		m_teams[i]->m_stat_gamesplayedseason++;
		m_teams[i]->m_stat_gamesplayedweek++;
		m_teams[i]->SaveToDB();
	}

	/* open gates */
	for(set<GameObject*>::iterator itr = m_gates.begin(); itr != m_gates.end(); ++itr)
	{
		(*itr)->SetUInt32Value(GAMEOBJECT_FLAGS, 64);
		(*itr)->SetByte(GAMEOBJECT_BYTES_1, 0, 0);
	}

	m_started = true;

	/* Incase all players left */
	UpdatePlayerCounts();

	// WHEEEE
	PlaySoundToAll(SOUND_BATTLEGROUND_BEGIN);

	sEventMgr.RemoveEvents(this, EVENT_ARENA_SHADOW_SIGHT);
	sEventMgr.AddEvent(TO< CBattleground* >(this), &CBattleground::HookOnShadowSight, EVENT_ARENA_SHADOW_SIGHT, 90000, 1, EVENT_FLAG_DO_NOT_EXECUTE_IN_WORLD_CONTEXT);
}
Пример #6
0
void Arena::HookOnPlayerDeath(Player* plr)
{
	ASSERT(plr != NULL);

	if (m_playersAlive.find(plr->GetLowGUID()) != m_playersAlive.end())
	{
		m_playersCount[plr->GetTeam()]--;
		UpdatePlayerCounts();
		m_playersAlive.erase(plr->GetLowGUID());
	}
}
Пример #7
0
void Arena::OnRemovePlayer(Player * plr)
{
	/* remove arena readyness buff */
	plr->m_deathVision = false;
	plr->RemoveAura(ARENA_PREPARATION);
	UpdatePlayerCounts();
	
	plr->RemoveAura(32725-plr->m_bgTeam);
	if(plr->HasFlag(PLAYER_FLAGS, PLAYER_FLAG_FREE_FOR_ALL_PVP))
		plr->RemoveFlag(PLAYER_FLAGS, PLAYER_FLAG_FREE_FOR_ALL_PVP);
}
Пример #8
0
void Arena::OnAddPlayer(Player * plr)
{
	if (plr == NULL) return;

	if( !m_started )
	{
		/* cast arena readyness buff */
		if(plr->isDead())
			plr->ResurrectPlayer();

		plr->SetUInt32Value(UNIT_FIELD_HEALTH, plr->GetUInt32Value(UNIT_FIELD_MAXHEALTH));
		plr->SetUInt32Value(UNIT_FIELD_POWER1, plr->GetUInt32Value(UNIT_FIELD_MAXPOWER1));
		plr->SetUInt32Value(UNIT_FIELD_POWER4, plr->GetUInt32Value(UNIT_FIELD_MAXPOWER4));
		sEventMgr.AddEvent(plr, &Player::FullHPMP, EVENT_PLAYER_UPDATE, 500, 1, 0);
		sEventMgr.AddEvent(plr, &Player::ResetAllCooldowns, EVENT_PLAYER_UPDATE, 500, 1, 0);
	}

	plr->m_deathVision = true;

	// remove all buffs (exclude talents, include flasks)
	for(uint32 x=0;x<MAX_AURAS;x++)
	{
		if(plr->m_auras[x])
		{
			if(plr->m_auras[x] && !plr->m_auras[x]->GetSpellProto()->DurationIndex && plr->m_auras[x]->GetSpellProto()->AttributesExC & CAN_PERSIST_AND_CASTED_WHILE_DEAD)
				continue;
			else
			{
				plr->m_auras[x]->Remove();
			}
		}
	}
	plr->GetItemInterface()->RemoveAllConjured();
	plr->ResetAllCooldowns();

	if( !m_started )
		plr->CastSpell(plr, ARENA_PREPARATION, true);

//	m_playersCount[plr->GetTeam()]++;
	UpdatePlayerCounts();

	if (plr->m_bgIsQueued)
		plr->m_bgIsQueued = false;

	/* Add the green/gold team flag */
	Aura * aura = AuraPool.PooledNew();
	aura->Init(dbcSpell.LookupEntry(32724+plr->m_bgTeam), -1, plr, plr);
	plr->AddAura(aura);
	
	/* Set FFA PvP Flag */
	if(!plr->HasFlag(PLAYER_FLAGS, PLAYER_FLAG_FREE_FOR_ALL_PVP))
		plr->SetFlag(PLAYER_FLAGS, PLAYER_FLAG_FREE_FOR_ALL_PVP);
}
Пример #9
0
void Arena::OnAddPlayer(Player* plr)
{
	if(plr == NULL)
		return;

	plr->m_deathVision = true;

	// remove all buffs (exclude talents, include flasks)
	for(uint32 x = MAX_REMOVABLE_AURAS_START; x < MAX_REMOVABLE_AURAS_END; x++)
	{
		if(plr->m_auras[x])
		{
			if(plr->m_auras[x] && !plr->m_auras[x]->GetSpellProto()->DurationIndex && plr->m_auras[x]->GetSpellProto()->AttributesExC & CAN_PERSIST_AND_CASTED_WHILE_DEAD)
				continue;
			else
			{
				plr->m_auras[x]->Remove();
			}
		}
	}
	// On arena start all conjured items are removed
	plr->GetItemInterface()->RemoveAllConjured();
	// On arena start remove all temp enchants
	plr->RemoveTempEnchantsOnArena();

	// Before the arena starts all your cooldowns are reset
	if(!m_started  && plr->IsInWorld())
		plr->ResetAllCooldowns();

	// if( plr->m_isGmInvisible == false )
	// Make sure the player isn't a GM an isn't invisible (monitoring?)
	if(!plr->m_isGmInvisible)
	{
		if(!m_started  && plr->IsInWorld())
			plr->CastSpell(plr, ARENA_PREPARATION, true);

		m_playersCount[plr->GetTeam()]++;
		UpdatePlayerCounts();
	}
	// If they're still queued for the arena, remove them from the queue
	if(plr->m_bgIsQueued)
		plr->m_bgIsQueued = false;

	/* Add the green/gold team flag */
	Aura* aura = sSpellFactoryMgr.NewAura(dbcSpell.LookupEntry((plr->GetTeamInitial()) ? 35775 - plr->m_bgTeam : 32725 - plr->m_bgTeam), -1, plr, plr, true);
	plr->AddAura(aura);

	/* Set FFA PvP Flag */
	plr->SetFFAPvPFlag();

	m_playersAlive.insert(plr->GetLowGUID());
}
Пример #10
0
void Arena::HookOnPlayerDeath(Player* plr)
{
	ARCEMU_ASSERT(plr != NULL);

	if(plr->m_isGmInvisible == true) return;

	if(m_playersAlive.find(plr->GetLowGUID()) != m_playersAlive.end())
	{
		m_playersCount[plr->GetTeam()]--;
		UpdatePlayerCounts();
		m_playersAlive.erase(plr->GetLowGUID());
	}
}
Пример #11
0
void Arena::OnAddPlayer(PlayerPointer plr)
{
	plr->m_deathVision = true;

	if( plr->m_isGmInvisible )
		return;

	// remove all buffs (exclude talents, include flasks)
	for(uint32 x=0;x<MAX_AURAS;x++)
	{
		if(plr->m_auras[x])
		{
			if(plr->m_auras[x] && !plr->m_auras[x]->GetSpellProto()->DurationIndex && plr->m_auras[x]->GetSpellProto()->Flags4 & CAN_PERSIST_AND_CASTED_WHILE_DEAD)
				continue;
			else
			{
				plr->m_auras[x]->Remove();
			}
		}
	}
	plr->GetItemInterface()->RemoveAllConjured();
	plr->ResetAllCooldowns();

	if( !m_started )
		plr->CastSpell(plr, ARENA_PREPARATION, true);

	m_playersCount[plr->GetTeam()]++;
	UpdatePlayerCounts();

	/* Add the green/gold team flag */
	AuraPointer aura(new Aura(dbcSpell.LookupEntry(32724+plr->m_bgTeam), -1, plr, plr));
	plr->AddAura(aura);
	
	/* Set FFA PvP Flag */
	plr->SetFFAPvPFlag();

	hashmap_put(m_playersAlive, plr->GetLowGUID(), (any_t)1);
	if(Rated())
	{
		// Store the players who join so that we can change their rating even if they leave before arena finishes
		hashmap_put(m_players2[plr->GetTeam()], plr->GetLowGUID(), (any_t)1);
		if(m_teams[plr->GetTeam()] == -1 && plr->m_playerInfo && plr->m_playerInfo->arenaTeam[m_arenateamtype] != NULL)
		{
			m_teams[plr->GetTeam()] = plr->m_playerInfo->arenaTeam[m_arenateamtype]->m_id;
		}
	}
}
Пример #12
0
void Arena::OnStart()
{
	/* remove arena readyness buff */
	for(uint32 i = 0; i < 2; ++i) {
		for(set<uint32>::iterator itr = m_players[i].begin(); itr != m_players[i].end(); ++itr) {
			Player *plr = objmgr.GetPlayer(*itr);
			if ( plr != NULL )
				plr->RemoveAura(ARENA_PREPARATION);
		}
	}

	/* open gates */
	for(set<GameObject*>::iterator itr = m_gates.begin(); itr != m_gates.end(); ++itr)
	{
		(*itr)->SetUInt32Value(GAMEOBJECT_FLAGS, 64);
		(*itr)->SetUInt32Value(GAMEOBJECT_STATE, 0);
	}

	m_started = true;

	/* Incase all players left */
	UpdatePlayerCounts();
}
Пример #13
0
void Arena::OnAddPlayer(Player* plr)
{
	plr->m_deathVision = true;

	if( plr->m_isGmInvisible )
		return;

	// remove all buffs (exclude talents, include flasks)
	plr->m_AuraInterface.RemoveAllExpiringAuras();
	plr->GetItemInterface()->RemoveAllConjured();
	plr->ResetAllCooldowns();

	if( !m_started )
		plr->CastSpell(plr, ARENA_PREPARATION, true);

	m_playersCount[plr->GetTeam()]++;
	UpdatePlayerCounts();

	/* Add the green/gold team flag */
	Aura* aura(new Aura(dbcSpell.LookupEntry(32724+plr->m_bgTeam), -1, plr, plr));
	plr->AddAura(aura);

	/* Set FFA PvP Flag */
	plr->SetFFAPvPFlag();

	m_playersAlive.insert(plr->GetLowGUID());
	if(Rated())
	{
		// Store the players who join so that we can change their rating even if they leave before arena finishes
		m_players2[plr->GetTeam()].insert(plr->GetLowGUID());
		if(m_teams[plr->GetTeam()] == -1 && plr->m_playerInfo && plr->m_playerInfo->arenaTeam[m_arenateamtype] != NULL)
		{
			m_teams[plr->GetTeam()] = plr->m_playerInfo->arenaTeam[m_arenateamtype]->m_id;
		}
	}
}
Пример #14
0
void Arena::OnAddPlayer(Player * plr)
{
	if( !m_started )
	{
		/* cast arena readyness buff */
		if(plr->isDead())
			plr->ResurrectPlayer();

		plr->SetUInt32Value(UNIT_FIELD_HEALTH, plr->GetUInt32Value(UNIT_FIELD_MAXHEALTH));
		plr->SetUInt32Value(UNIT_FIELD_POWER1, plr->GetUInt32Value(UNIT_FIELD_MAXPOWER1));
		plr->SetUInt32Value(UNIT_FIELD_POWER4, plr->GetUInt32Value(UNIT_FIELD_MAXPOWER4));
		sEventMgr.AddEvent(plr, &Player::FullHPMP, EVENT_PLAYER_UPDATE, 500, 1, 0);
		sEventMgr.AddEvent(plr, &Player::ResetAllCooldowns, EVENT_PLAYER_UPDATE, 500, 1, 0);
	}

	plr->m_deathVision = true;

	// remove all buffs (exclude talents, include flasks)
	for(uint32 x=0;x<MAX_AURAS;x++)
	{
		if(plr->m_auras[x])
		{
			if(plr->m_auras[x] && !plr->m_auras[x]->GetSpellProto()->DurationIndex && plr->m_auras[x]->GetSpellProto()->Flags4 & CAN_PERSIST_AND_CASTED_WHILE_DEAD)
				continue;
			else
			{
				plr->m_auras[x]->Remove();
			}
		}
	}
	plr->GetItemInterface()->RemoveAllConjured();
	plr->ResetAllCooldowns();

	if( !m_started )
		plr->CastSpell(plr, ARENA_PREPARATION, true);

	UpdatePlayerCounts();

	/* Add the green/gold team flag */
	Aura * aura = new Aura(dbcSpell.LookupEntry(32725-plr->m_bgTeam), -1, plr, plr);
	plr->AddAura(aura);
	
	/* Set FFA PvP Flag */
	if(!plr->HasFlag(PLAYER_FLAGS, PLAYER_FLAG_FREE_FOR_ALL_PVP))
		plr->SetFlag(PLAYER_FLAGS, PLAYER_FLAG_FREE_FOR_ALL_PVP);

	/* update arena team stats */
	if(rated_match && plr->m_arenaTeams[m_arenateamtype] != NULL)
	{
		ArenaTeam * t = plr->m_arenaTeams[m_arenateamtype];
		if ( t != NULL && inscribe_teams[plr->m_bgTeam] == 0 )
		{
			t->m_stat_gamesplayedseason++;
			t->m_stat_gamesplayedweek++;
			inscribe_teams[plr->m_bgTeam] = t->m_id;
		}

		ArenaTeamMember * tp = t->GetMember(plr->m_playerInfo);
		if(tp != NULL)
		{
			tp->Played_ThisWeek++;
			tp->Played_ThisSeason++;
		}

		t->SaveToDB();
	}
}
Пример #15
0
void Arena::HookOnPlayerKill(Player * plr, Unit * pVictim)
{
	plr->m_bgScore.KillingBlows++;
	UpdatePlayerCounts();
}