forked from insider42/scriptdev2
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathsc_outdoor_pvp.cpp
More file actions
40 lines (34 loc) · 1.39 KB
/
sc_outdoor_pvp.cpp
File metadata and controls
40 lines (34 loc) · 1.39 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
/* Copyright (C) 2006 - 2011 ScriptDev2 <https://scriptdev2.svn.sourceforge.net/>
* This program is free software licensed under GPL version 2
* Please see the included DOCS/LICENSE.TXT for more information */
#include "precompiled.h"
void OutdoorPvP::DoUpdateWorldState(PlayerSet sPlayerSet, uint32 uiStateId, uint32 uiStateData)
{
for(PlayerSet::const_iterator itr = sPlayerSet.begin(); itr != sPlayerSet.end(); ++itr)
{
if (Player* pPlayer = instance->GetPlayer(*itr))
pPlayer->SendUpdateWorldState(uiStateId, uiStateData);
}
}
Player* OutdoorPvP::GetPlayerInMap(bool bOnlyAlive /*=false*/, bool bCanBeGamemaster /*=true*/)
{
Map::PlayerList const& lPlayers = instance->GetPlayers();
for(Map::PlayerList::const_iterator itr = lPlayers.begin(); itr != lPlayers.end(); ++itr)
{
Player* pPlayer = itr->getSource();
if (pPlayer && (!bOnlyAlive || pPlayer->isAlive()) && (bCanBeGamemaster || !pPlayer->isGameMaster()))
return pPlayer;
}
return NULL;
}
void OutdoorPvP::DoApplyTeamBuff(PlayerSet sPlayerSet, Team uiTeamId, uint32 uiSpellId)
{
for(PlayerSet::const_iterator itr = sPlayerSet.begin(); itr != sPlayerSet.end(); ++itr)
{
if (Player* pPlayer = instance->GetPlayer(*itr))
{
if (pPlayer->GetTeam() == uiTeamId)
pPlayer->CastSpell(pPlayer, uiSpellId, true);
}
}
}