本文整理汇总了C++中RewardReputationToTeam函数的典型用法代码示例。如果您正苦于以下问题:C++ RewardReputationToTeam函数的具体用法?C++ RewardReputationToTeam怎么用?C++ RewardReputationToTeam使用的例子?那么, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了RewardReputationToTeam函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: GetAVTeamIndexByTeamId
//.........这里部分代码省略.........
switch (questid)
{
case BG_AV_QUEST_A_SCRAPS1:
case BG_AV_QUEST_A_SCRAPS2:
case BG_AV_QUEST_H_SCRAPS1:
case BG_AV_QUEST_H_SCRAPS2:
m_Team_QuestStatus[teamIdx][0] += 20;
reputation = 1;
if (m_Team_QuestStatus[teamIdx][0] == 500 || m_Team_QuestStatus[teamIdx][0] == 1000 || m_Team_QuestStatus[teamIdx][0] == 1500) // 25,50,75 turn ins
{
DEBUG_LOG("BattleGroundAV: Quest %i completed starting with unit upgrading..", questid);
for (BG_AV_Nodes i = BG_AV_NODES_FIRSTAID_STATION; i <= BG_AV_NODES_FROSTWOLF_HUT; ++i)
if (m_Nodes[i].Owner == teamIdx && m_Nodes[i].State == POINT_CONTROLLED)
{ PopulateNode(i); }
}
break;
case BG_AV_QUEST_A_COMMANDER1:
case BG_AV_QUEST_H_COMMANDER1:
m_Team_QuestStatus[teamIdx][1]++;
reputation = 1;
if (m_Team_QuestStatus[teamIdx][1] == 120)
{ DEBUG_LOG("BattleGroundAV: Quest %i completed (need to implement some events here", questid); }
break;
case BG_AV_QUEST_A_COMMANDER2:
case BG_AV_QUEST_H_COMMANDER2:
m_Team_QuestStatus[teamIdx][2]++;
reputation = 2;
if (m_Team_QuestStatus[teamIdx][2] == 60)
{ DEBUG_LOG("BattleGroundAV: Quest %i completed (need to implement some events here", questid); }
break;
case BG_AV_QUEST_A_COMMANDER3:
case BG_AV_QUEST_H_COMMANDER3:
m_Team_QuestStatus[teamIdx][3]++;
reputation = 5;
if (m_Team_QuestStatus[teamIdx][1] == 30)
{ DEBUG_LOG("BattleGroundAV: Quest %i completed (need to implement some events here", questid); }
break;
case BG_AV_QUEST_A_BOSS1:
case BG_AV_QUEST_H_BOSS1:
m_Team_QuestStatus[teamIdx][4] += 4; // there are 2 quests where you can turn in 5 or 1 item.. ( + 4 cause +1 will be done some lines below)
reputation = 4;
case BG_AV_QUEST_A_BOSS2:
case BG_AV_QUEST_H_BOSS2:
m_Team_QuestStatus[teamIdx][4]++;
reputation += 1;
if (m_Team_QuestStatus[teamIdx][4] >= 200)
{ DEBUG_LOG("BattleGroundAV: Quest %i completed (need to implement some events here", questid); }
break;
case BG_AV_QUEST_A_NEAR_MINE:
case BG_AV_QUEST_H_NEAR_MINE:
m_Team_QuestStatus[teamIdx][5]++;
reputation = 2;
if (m_Team_QuestStatus[teamIdx][5] == 28)
{
DEBUG_LOG("BattleGroundAV: Quest %i completed (need to implement some events here", questid);
if (m_Team_QuestStatus[teamIdx][6] == 7)
{ DEBUG_LOG("BattleGroundAV: Quest %i completed (need to implement some events here - ground assault ready", questid); }
}
break;
case BG_AV_QUEST_A_OTHER_MINE:
case BG_AV_QUEST_H_OTHER_MINE:
m_Team_QuestStatus[teamIdx][6]++;
reputation = 3;
if (m_Team_QuestStatus[teamIdx][6] == 7)
{
DEBUG_LOG("BattleGroundAV: Quest %i completed (need to implement some events here", questid);
if (m_Team_QuestStatus[teamIdx][5] == 20)
{ DEBUG_LOG("BattleGroundAV: Quest %i completed (need to implement some events here - ground assault ready", questid); }
}
break;
case BG_AV_QUEST_A_RIDER_HIDE:
case BG_AV_QUEST_H_RIDER_HIDE:
m_Team_QuestStatus[teamIdx][7]++;
reputation = 1;
if (m_Team_QuestStatus[teamIdx][7] == 25)
{
DEBUG_LOG("BattleGroundAV: Quest %i completed (need to implement some events here", questid);
if (m_Team_QuestStatus[teamIdx][8] == 25)
{ DEBUG_LOG("BattleGroundAV: Quest %i completed (need to implement some events here - rider assault ready", questid); }
}
break;
case BG_AV_QUEST_A_RIDER_TAME:
case BG_AV_QUEST_H_RIDER_TAME:
m_Team_QuestStatus[teamIdx][8]++;
reputation = 1;
if (m_Team_QuestStatus[teamIdx][8] == 25)
{
DEBUG_LOG("BattleGroundAV: Quest %i completed (need to implement some events here", questid);
if (m_Team_QuestStatus[teamIdx][7] == 25)
{ DEBUG_LOG("BattleGroundAV: Quest %i completed (need to implement some events here - rider assault ready", questid); }
}
break;
default:
DEBUG_LOG("BattleGroundAV: Quest %i completed but is not interesting for us", questid);
return;
break;
}
if (reputation)
{ RewardReputationToTeam((player->GetTeam() == ALLIANCE) ? BG_AV_FACTION_A : BG_AV_FACTION_H, reputation, player->GetTeam()); }
}
示例2: SetHordeFlagPicker
void BattleGroundWS::EventPlayerCapturedFlag(Player *Source)
{
if (GetStatus() != STATUS_IN_PROGRESS)
return;
uint32 winner = 0;
Source->RemoveAurasWithInterruptFlags(AURA_INTERRUPT_FLAG_ENTER_PVP_COMBAT);
if (Source->GetTeam() == ALLIANCE)
{
if (!IsHordeFlagPickedup())
return;
SetHordeFlagPicker(0); // must be before aura remove to prevent 2 events (drop+capture) at the same time
// horde flag in base (but not respawned yet)
m_FlagState[BG_TEAM_HORDE] = BG_WS_FLAG_STATE_WAIT_RESPAWN;
// Drop Horde Flag from Player
Source->RemoveAurasDueToSpell(BG_WS_SPELL_WARSONG_FLAG);
if (GetTeamScore(ALLIANCE) < BG_WS_MAX_TEAM_SCORE)
AddPoint(ALLIANCE, 1);
PlaySoundToAll(BG_WS_SOUND_FLAG_CAPTURED_ALLIANCE);
RewardReputationToTeam(890, m_ReputationCapture, ALLIANCE);
}
else
{
if (!IsAllianceFlagPickedup())
return;
SetAllianceFlagPicker(0); // must be before aura remove to prevent 2 events (drop+capture) at the same time
// alliance flag in base (but not respawned yet)
m_FlagState[BG_TEAM_ALLIANCE] = BG_WS_FLAG_STATE_WAIT_RESPAWN;
// Drop Alliance Flag from Player
Source->RemoveAurasDueToSpell(BG_WS_SPELL_SILVERWING_FLAG);
if (GetTeamScore(HORDE) < BG_WS_MAX_TEAM_SCORE)
AddPoint(HORDE, 1);
PlaySoundToAll(BG_WS_SOUND_FLAG_CAPTURED_HORDE);
RewardReputationToTeam(889, m_ReputationCapture, HORDE);
}
//for flag capture is reward 2 honorable kills
RewardHonorToTeam(GetBonusHonorFromKill(2), Source->GetTeam());
SpawnBGObject(BG_WS_OBJECT_H_FLAG, BG_WS_FLAG_RESPAWN_TIME);
SpawnBGObject(BG_WS_OBJECT_A_FLAG, BG_WS_FLAG_RESPAWN_TIME);
if (Source->GetTeam() == ALLIANCE)
SendMessageToAll(LANG_BG_WS_CAPTURED_HF, CHAT_MSG_BG_SYSTEM_ALLIANCE, Source);
else
SendMessageToAll(LANG_BG_WS_CAPTURED_AF, CHAT_MSG_BG_SYSTEM_HORDE, Source);
UpdateFlagState(Source->GetTeam(), 1); // flag state none
UpdateTeamScore(Source->GetTeam());
// only flag capture should be updated
UpdatePlayerScore(Source, SCORE_FLAG_CAPTURES, 1); // +1 flag captures
if (GetTeamScore(ALLIANCE) == BG_WS_MAX_TEAM_SCORE)
winner = ALLIANCE;
if (GetTeamScore(HORDE) == BG_WS_MAX_TEAM_SCORE)
winner = HORDE;
if (winner)
{
UpdateWorldState(BG_WS_FLAG_UNK_ALLIANCE, 0);
UpdateWorldState(BG_WS_FLAG_UNK_HORDE, 0);
UpdateWorldState(BG_WS_FLAG_STATE_ALLIANCE, 1);
UpdateWorldState(BG_WS_FLAG_STATE_HORDE, 1);
EndBattleGround(winner);
}
else
{
m_FlagsTimer[GetTeamIndexByTeamId(Source->GetTeam()) ? 0 : 1] = BG_WS_FLAG_RESPAWN_TIME;
}
}
示例3: ClearHordeFlagCarrier
void BattleGroundWS::EventPlayerCapturedFlag(Player* source)
{
if (GetStatus() != STATUS_IN_PROGRESS)
return;
source->RemoveAurasWithInterruptFlags(AURA_INTERRUPT_FLAG_ENTER_PVP_COMBAT);
if (source->GetTeam() == ALLIANCE)
{
if (!IsHordeFlagPickedUp())
return;
ClearHordeFlagCarrier(); // must be before aura remove to prevent 2 events (drop+capture) at the same time
// horde flag in base (but not respawned yet)
m_FlagState[BG_TEAM_HORDE] = BG_WS_FLAG_STATE_WAIT_RESPAWN;
// Drop Horde Flag from Player
source->RemoveAurasDueToSpell(BG_WS_SPELL_WARSONG_FLAG);
if (m_TeamScores[BG_TEAM_ALLIANCE] < BG_WS_MAX_TEAM_SCORE)
m_TeamScores[BG_TEAM_ALLIANCE] += 1;
PlaySoundToAll(BG_WS_SOUND_FLAG_CAPTURED_ALLIANCE);
RewardReputationToTeam(890, m_ReputationCapture, ALLIANCE);
}
else
{
if (!IsAllianceFlagPickedUp())
return;
ClearAllianceFlagCarrier(); // must be before aura remove to prevent 2 events (drop+capture) at the same time
// alliance flag in base (but not respawned yet)
m_FlagState[BG_TEAM_ALLIANCE] = BG_WS_FLAG_STATE_WAIT_RESPAWN;
// Drop Alliance Flag from Player
source->RemoveAurasDueToSpell(BG_WS_SPELL_SILVERWING_FLAG);
if (m_TeamScores[BG_TEAM_HORDE] < BG_WS_MAX_TEAM_SCORE)
m_TeamScores[BG_TEAM_HORDE] += 1;
PlaySoundToAll(BG_WS_SOUND_FLAG_CAPTURED_HORDE);
RewardReputationToTeam(889, m_ReputationCapture, HORDE);
}
// for flag capture is reward distributed according level range
RewardHonorToTeam(BG_WSG_FlagCapturedHonor[GetBracketId()], source->GetTeam());
// despawn flags
SpawnEvent(WS_EVENT_FLAG_A, 0, false);
SpawnEvent(WS_EVENT_FLAG_H, 0, false);
if (source->GetTeam() == ALLIANCE)
SendMessageToAll(LANG_BG_WS_CAPTURED_HF, CHAT_MSG_BG_SYSTEM_ALLIANCE, source);
else
SendMessageToAll(LANG_BG_WS_CAPTURED_AF, CHAT_MSG_BG_SYSTEM_HORDE, source);
UpdateFlagState(source->GetTeam(), 1); // flag state none
UpdateTeamScore(source->GetTeam());
// only flag capture should be updated
UpdatePlayerScore(source, SCORE_FLAG_CAPTURES, 1); // +1 flag captures
Team winner = TEAM_NONE;
if (m_TeamScores[BG_TEAM_ALLIANCE] == BG_WS_MAX_TEAM_SCORE)
winner = ALLIANCE;
else if (m_TeamScores[BG_TEAM_HORDE] == BG_WS_MAX_TEAM_SCORE)
winner = HORDE;
if (winner)
{
UpdateWorldState(BG_WS_FLAG_UNK_ALLIANCE, 0);
UpdateWorldState(BG_WS_FLAG_UNK_HORDE, 0);
UpdateWorldState(BG_WS_FLAG_STATE_ALLIANCE, 1);
UpdateWorldState(BG_WS_FLAG_STATE_HORDE, 1);
EndBattleGround(winner);
}
else
{
m_FlagsTimer[GetOtherTeamIndex(GetTeamIndexByTeamId(source->GetTeam()))] = BG_WS_FLAG_RESPAWN_TIME;
}
}
示例4: SetHordeFlagPicker
void BattleGroundWS::EventPlayerCapturedFlag(Player *Source)
{
if (GetStatus() != STATUS_IN_PROGRESS)
return;
m_LastCapturedFlagTeam = Source->GetTeam();
uint32 winner = 0;
Source->RemoveAurasWithInterruptFlags(AURA_INTERRUPT_FLAG_ENTER_PVP_COMBAT);
if (Source->HasAura(BG_WS_SPELL_FOCUSED_ASSAULT))
Source->RemoveAurasDueToSpell(BG_WS_SPELL_FOCUSED_ASSAULT);
if (Source->HasAura(BG_WS_SPELL_BRUTAL_ASSAULT))
Source->RemoveAurasDueToSpell(BG_WS_SPELL_BRUTAL_ASSAULT);
if (Source->GetTeam() == ALLIANCE)
{
if (!IsHordeFlagPickedup())
return;
SetHordeFlagPicker(0); // must be before aura remove to prevent 2 events (drop+capture) at the same time
// horde flag in base (but not respawned yet)
m_FlagState[BG_TEAM_HORDE] = BG_WS_FLAG_STATE_WAIT_RESPAWN;
// Drop Horde Flag from Player
Source->RemoveAurasDueToSpell(BG_WS_SPELL_WARSONG_FLAG);
if (GetTeamScore(ALLIANCE) < BG_WS_MAX_TEAM_SCORE)
AddPoint(ALLIANCE, 1);
PlaySoundToAll(BG_WS_SOUND_FLAG_CAPTURED_ALLIANCE);
RewardReputationToTeam(BATTLEGROUND_WS, m_ReputationCapture, ALLIANCE);
}
else
{
if (!IsAllianceFlagPickedup())
return;
SetAllianceFlagPicker(0); // must be before aura remove to prevent 2 events (drop+capture) at the same time
// alliance flag in base (but not respawned yet)
m_FlagState[BG_TEAM_ALLIANCE] = BG_WS_FLAG_STATE_WAIT_RESPAWN;
// Drop Alliance Flag from Player
Source->RemoveAurasDueToSpell(BG_WS_SPELL_SILVERWING_FLAG);
if (GetTeamScore(HORDE) < BG_WS_MAX_TEAM_SCORE)
AddPoint(HORDE, 1);
PlaySoundToAll(BG_WS_SOUND_FLAG_CAPTURED_HORDE);
RewardReputationToTeam(BATTLEGROUND_WS, m_ReputationCapture, HORDE);
}
//for flag capture is reward 2 honorable kills
RewardHonorToTeam(GetBonusHonorFromKill(sWorld.getConfig(CONFIG_UINT32_BONUS_HONOR_FLAG_WSG)), Source->GetTeam());
RewardXpToTeam(0, 0.6f, Source->GetTeam());
//flag carrier gets another 2 honorable kills
Source->RewardHonor(NULL, 0, GetBonusHonorFromKill(sWorld.getConfig(CONFIG_UINT32_BONUS_HONOR_FLAG_WSG)));
// despawn flags
SpawnEvent(WS_EVENT_FLAG_A, 0, false);
SpawnEvent(WS_EVENT_FLAG_H, 0, false);
if (Source->GetTeam() == ALLIANCE)
SendMessageToAll(LANG_BG_WS_CAPTURED_HF, CHAT_MSG_BG_SYSTEM_ALLIANCE, Source);
else
SendMessageToAll(LANG_BG_WS_CAPTURED_AF, CHAT_MSG_BG_SYSTEM_HORDE, Source);
UpdateFlagState(Source->GetTeam(), 1); // flag state none
UpdateTeamScore(Source->GetTeam());
// only flag capture should be updated
UpdatePlayerScore(Source, SCORE_FLAG_CAPTURES, 1); // +1 flag captures
Source->UpdateAchievementCriteria(ACHIEVEMENT_CRITERIA_TYPE_BG_OBJECTIVE_CAPTURE,1);
if (GetTeamScore(ALLIANCE) == BG_WS_MAX_TEAM_SCORE)
winner = ALLIANCE;
if (GetTeamScore(HORDE) == BG_WS_MAX_TEAM_SCORE)
winner = HORDE;
if (winner)
{
UpdateWorldState(BG_WS_FLAG_UNK_ALLIANCE, 0);
UpdateWorldState(BG_WS_FLAG_UNK_HORDE, 0);
UpdateWorldState(BG_WS_FLAG_STATE_ALLIANCE, 1);
UpdateWorldState(BG_WS_FLAG_STATE_HORDE, 1);
EndBattleGround(winner);
}
else
{
m_FlagsTimer[GetTeamIndexByTeamId(Source->GetTeam()) ? 0 : 1] = BG_WS_FLAG_RESPAWN_TIME;
}
}
示例5: SetHordeFlagPicker
void BattlegroundTP::EventPlayerCapturedFlag(Player* Source)
{
if (GetStatus() != STATUS_IN_PROGRESS)
return;
uint32 winner = 0;
Source->RemoveAurasWithInterruptFlags(AURA_INTERRUPT_FLAG_ENTER_PVP_COMBAT);
if (Source->GetTeam() == ALLIANCE)
{
if (!IsHordeFlagPickedup())
return;
SetHordeFlagPicker(0); // must be before aura remove to prevent 2 events (drop+capture) at the same time
// horde flag in base (but not respawned yet)
_flagState[TEAM_HORDE] = BG_TP_FLAG_STATE_WAIT_RESPAWN;
// Drop Horde Flag from Player
Source->RemoveAurasDueToSpell(BG_TP_SPELL_HORDE_FLAG);
if (_flagDebuffState == 1)
Source->RemoveAurasDueToSpell(TP_SPELL_FOCUSED_ASSAULT);
if (_flagDebuffState == 2)
Source->RemoveAurasDueToSpell(TP_SPELL_BRUTAL_ASSAULT);
if (GetTeamScore(TEAM_ALLIANCE) < BG_TP_MAX_TEAM_SCORE)
AddPoint(ALLIANCE, 1);
PlaySoundToAll(BG_TP_SOUND_FLAG_CAPTURED_ALLIANCE);
RewardReputationToTeam(1174, m_ReputationCapture, ALLIANCE);
}
else
{
if (!IsAllianceFlagPickedup())
return;
SetAllianceFlagPicker(0); // must be before aura remove to prevent 2 events (drop+capture) at the same time
// alliance flag in base (but not respawned yet)
_flagState[TEAM_ALLIANCE] = BG_TP_FLAG_STATE_WAIT_RESPAWN;
// Drop Alliance Flag from Player
Source->RemoveAurasDueToSpell(BG_TP_SPELL_ALLIANCE_FLAG);
if (_flagDebuffState == 1)
Source->RemoveAurasDueToSpell(TP_SPELL_FOCUSED_ASSAULT);
if (_flagDebuffState == 2)
Source->RemoveAurasDueToSpell(TP_SPELL_BRUTAL_ASSAULT);
if (GetTeamScore(TEAM_HORDE) < BG_TP_MAX_TEAM_SCORE)
AddPoint(HORDE, 1);
PlaySoundToAll(BG_TP_SOUND_FLAG_CAPTURED_HORDE);
RewardReputationToTeam(1172, m_ReputationCapture, HORDE);
}
//for flag capture is reward 2 honorable kills
RewardHonorToTeam(GetBonusHonorFromKill(2), Source->GetTeam());
SpawnBGObject(BG_TP_OBJECT_H_FLAG, BG_TP_FLAG_RESPAWN_TIME);
SpawnBGObject(BG_TP_OBJECT_A_FLAG, BG_TP_FLAG_RESPAWN_TIME);
if (Source->GetTeam() == ALLIANCE)
SendMessageToAll(LANG_BG_TP_CAPTURED_HF, CHAT_MSG_BG_SYSTEM_ALLIANCE, Source);
else
SendMessageToAll(LANG_BG_TP_CAPTURED_AF, CHAT_MSG_BG_SYSTEM_HORDE, Source);
UpdateFlagState(Source->GetTeam(), 1); // flag state none
UpdateTeamScore(Source->GetTeamId());
// only flag capture should be updated
UpdatePlayerScore(Source, SCORE_FLAG_CAPTURES, 1); // +1 flag captures
// update last flag capture to be used if teamscore is equal
SetLastFlagCapture(Source->GetTeam());
if (GetTeamScore(TEAM_ALLIANCE) == BG_TP_MAX_TEAM_SCORE)
winner = ALLIANCE;
if (GetTeamScore(TEAM_HORDE) == BG_TP_MAX_TEAM_SCORE)
winner = HORDE;
if (winner)
{
UpdateWorldState(BG_TP_FLAG_UNK_ALLIANCE, 0);
UpdateWorldState(BG_TP_FLAG_UNK_HORDE, 0);
UpdateWorldState(BG_TP_FLAG_STATE_ALLIANCE, 1);
UpdateWorldState(BG_TP_FLAG_STATE_HORDE, 1);
UpdateWorldState(BG_TP_STATE_TIMER_ACTIVE, 0);
RewardHonorToTeam(BG_TP_Honor[m_HonorMode][BG_TP_WIN], winner);
EndBattleground(winner);
}
else
{
_flagsTimer[GetTeamIndexByTeamId(Source->GetTeam()) ? 0 : 1] = BG_TP_FLAG_RESPAWN_TIME;
}
}
示例6: SetHordeFlagPicker
void BattleGroundWS::EventPlayerCapturedFlag(Player *Source)
{
if (GetStatus() != STATUS_IN_PROGRESS)
return;
uint8 type = 0;
uint32 winner = 0;
const char *message = "";
//TODO FIX reputation and honor gains for low level players!
Source->RemoveAurasWithInterruptFlags(AURA_INTERRUPT_FLAG_ENTER_PVP_COMBAT);
if (Source->GetBGTeam() == ALLIANCE)
{
if (!this->IsHordeFlagPickedup())
return;
SetHordeFlagPicker(0); // must be before aura remove to prevent 2 events (drop+capture) at the same time
// horde flag in base (but not respawned yet)
m_FlagState[BG_TEAM_HORDE] = BG_WS_FLAG_STATE_WAIT_RESPAWN;
// Drop Horde Flag from Player
Source->RemoveAurasDueToSpell(BG_WS_SPELL_WARSONG_FLAG);
if (m_FlagDebuffState == 1)
Source->RemoveAurasDueToSpell(WS_SPELL_FOCUSED_ASSAULT);
if (m_FlagDebuffState == 2)
Source->RemoveAurasDueToSpell(WS_SPELL_BRUTAL_ASSAULT);
message = GetTrinityString(LANG_BG_WS_CAPTURED_HF);
type = CHAT_MSG_BG_SYSTEM_ALLIANCE;
if (GetTeamScore(ALLIANCE) < BG_WS_MAX_TEAM_SCORE)
AddPoint(ALLIANCE, 1);
PlaySoundToAll(BG_WS_SOUND_FLAG_CAPTURED_ALLIANCE);
RewardReputationToTeam(890, BG_WSG_Reputation[m_HonorMode][BG_WSG_FLAG_CAP], ALLIANCE); // +35 reputation
RewardHonorToTeam(BG_WSG_Honor[m_HonorMode][BG_WSG_FLAG_CAP], ALLIANCE); // +40 bonushonor
}
else
{
if (!this->IsAllianceFlagPickedup())
return;
SetAllianceFlagPicker(0); // must be before aura remove to prevent 2 events (drop+capture) at the same time
// alliance flag in base (but not respawned yet)
m_FlagState[BG_TEAM_ALLIANCE] = BG_WS_FLAG_STATE_WAIT_RESPAWN;
// Drop Alliance Flag from Player
Source->RemoveAurasDueToSpell(BG_WS_SPELL_SILVERWING_FLAG);
if (m_FlagDebuffState == 1)
Source->RemoveAurasDueToSpell(WS_SPELL_FOCUSED_ASSAULT);
if (m_FlagDebuffState == 2)
Source->RemoveAurasDueToSpell(WS_SPELL_BRUTAL_ASSAULT);
message = GetTrinityString(LANG_BG_WS_CAPTURED_AF);
type = CHAT_MSG_BG_SYSTEM_HORDE;
if (GetTeamScore(HORDE) < BG_WS_MAX_TEAM_SCORE)
AddPoint(HORDE, 1);
PlaySoundToAll(BG_WS_SOUND_FLAG_CAPTURED_HORDE);
RewardReputationToTeam(889, BG_WSG_Reputation[m_HonorMode][BG_WSG_FLAG_CAP], HORDE); // +35 reputation
RewardHonorToTeam(BG_WSG_Honor[m_HonorMode][BG_WSG_FLAG_CAP], HORDE); // +40 bonushonor
}
SpawnBGObject(BG_WS_OBJECT_H_FLAG, BG_WS_FLAG_RESPAWN_TIME);
SpawnBGObject(BG_WS_OBJECT_A_FLAG, BG_WS_FLAG_RESPAWN_TIME);
WorldPacket data;
ChatHandler::FillMessageData(&data, Source->GetSession(), type, LANG_UNIVERSAL, NULL, Source->GetGUID(), message, NULL);
SendPacketToAll(&data);
UpdateFlagState(Source->GetBGTeam(), 1); // flag state none
UpdateTeamScore(Source->GetBGTeam());
// only flag capture should be updated
UpdatePlayerScore(Source, SCORE_FLAG_CAPTURES, 1); // +1 flag captures...
if (GetTeamScore(ALLIANCE) == BG_WS_MAX_TEAM_SCORE)
winner = ALLIANCE;
if (GetTeamScore(HORDE) == BG_WS_MAX_TEAM_SCORE)
winner = HORDE;
if (winner)
{
UpdateWorldState(BG_WS_FLAG_UNK_ALLIANCE, 0);
UpdateWorldState(BG_WS_FLAG_UNK_HORDE, 0);
UpdateWorldState(BG_WS_FLAG_STATE_ALLIANCE, 1);
UpdateWorldState(BG_WS_FLAG_STATE_HORDE, 1);
RewardHonorToTeam(BG_WSG_Honor[m_HonorMode][BG_WSG_WIN], winner);
EndBattleGround(winner);
}
else
{
m_FlagsTimer[GetTeamIndexByTeamId(Source->GetBGTeam()) ? 0 : 1] = BG_WS_FLAG_RESPAWN_TIME;
}
}
示例7: _CreateBanner
void BattlegroundBG::Update(uint32 diff) // PostUpdateImpl...
{
Battleground::Update(diff);
if (GetStatus() == STATUS_IN_PROGRESS)
{
int team_points[BG_TEAMS_COUNT] = { 0, 0 };
for (int node = 0; node < GILNEAS_BG_DYNAMIC_NODES_COUNT; ++node)
{
// 3sec delay to spawn new a banner instead previous despawned one.
if (_BannerTimers[node].timer)
{
if (_BannerTimers[node].timer > diff)
_BannerTimers[node].timer -= diff;
else
{
_BannerTimers[node].timer = 0;
_CreateBanner(node, _BannerTimers[node].type, _BannerTimers[node].teamIndex, false);
}
}
// 1 minute cap timer on each node from a contested state.
if (_NodeTimers[node])
{
if (_NodeTimers[node] > diff)
_NodeTimers[node] -= diff;
else
{
_NodeTimers[node] = 0;
// Change from contested to occupied !
uint8 teamIndex = _Nodes[node]-1;
_prevNodes[node] = _Nodes[node];
_Nodes[node] += 2;
// burn current contested banner
_DelBanner(node, GILNEAS_BG_NODE_TYPE_CONTESTED, teamIndex);
// create new occupied banner
_CreateBanner(node, GILNEAS_BG_NODE_TYPE_OCCUPIED, teamIndex, true);
_SendNodeUpdate(node);
_NodeOccupied(node, (teamIndex == 0) ? ALLIANCE:HORDE);
// Message to chatlog
if (teamIndex == 0)
{
// FIXME: need to fix Locales for team and nodes names.
SendMessage2ToAll(LANGUAGE_BG_BG_NODE_TAKEN, CHAT_MSG_BG_SYSTEM_ALLIANCE, NULL, LANGUAGE_BG_BG_ALLY, _GetNodeNameId(node));
PlaySoundToAll(GILNEAS_BG_SOUND_NODE_CAPTURED_ALLIANCE);
}
else
{
// FIXME: team and node names not localized
SendMessage2ToAll(LANGUAGE_BG_BG_NODE_TAKEN, CHAT_MSG_BG_SYSTEM_HORDE, NULL, LANGUAGE_BG_BG_HORDE, _GetNodeNameId(node));
PlaySoundToAll(GILNEAS_BG_SOUND_NODE_CAPTURED_HORDE);
}
}
}
for (int team = 0; team < BG_TEAMS_COUNT; ++team)
if (_Nodes[node] == team + GILNEAS_BG_NODE_TYPE_OCCUPIED)
++team_points[team];
}
// Accumulate points
for (int team = 0; team < BG_TEAMS_COUNT; ++team)
{
int points = team_points[team];
if (!points)
continue;
_lastTick[team] += diff;
if (_lastTick[team] > GILNEAS_BG_TickIntervals[points])
{
_lastTick[team] -= GILNEAS_BG_TickIntervals[points];
_TeamScores[team] += GILNEAS_BG_TickPoints[points];
_HonorScoreTicks[team] += GILNEAS_BG_TickPoints[points];
_ReputationScoreTicks[team] += GILNEAS_BG_TickPoints[points];
if (_ReputationScoreTicks[team] >= _ReputationTicks)
{
(team == BG_TEAM_ALLIANCE) ? RewardReputationToTeam(509, 10, ALLIANCE) : RewardReputationToTeam(510, 10, HORDE);
_ReputationScoreTicks[team] -= _ReputationTicks;
}
if (_HonorScoreTicks[team] >= _HonorTicks)
{
RewardHonorToTeam(GetBonusHonorFromKill(1), (team == BG_TEAM_ALLIANCE) ? ALLIANCE : HORDE);
_HonorScoreTicks[team] -= _HonorTicks;
}
if (!_IsInformedNearVictory && _TeamScores[team] > GILNEAS_BG_WARNING_NEAR_VICTORY_SCORE)
{
if (team == BG_TEAM_ALLIANCE)
SendMessageToAll(LANGUAGE_BG_BG_A_NEAR_VICTORY, CHAT_MSG_BG_SYSTEM_NEUTRAL);
else
SendMessageToAll(LANGUAGE_BG_BG_H_NEAR_VICTORY, CHAT_MSG_BG_SYSTEM_NEUTRAL);
PlaySoundToAll(GILNEAS_BG_SOUND_NEAR_VICTORY);
_IsInformedNearVictory = true;
//.........这里部分代码省略.........
示例8: SetHordeFlagPicker
void BattleGroundWS::EventPlayerCapturedFlag(Player *Source)
{
if (GetStatus() != STATUS_IN_PROGRESS)
return;
uint8 type = 0;
uint32 winner = 0;
const char *message = "";
Source->RemoveAurasWithInterruptFlags(AURA_INTERRUPT_FLAG_ENTER_PVP_COMBAT);
if (Source->GetTeam() == ALLIANCE)
{
if (!IsHordeFlagPickedup())
return;
SetHordeFlagPicker(0); // must be before aura remove to prevent 2 events (drop+capture) at the same time
// horde flag in base (but not respawned yet)
m_FlagState[BG_TEAM_HORDE] = BG_WS_FLAG_STATE_WAIT_RESPAWN;
// Drop Horde Flag from Player
Source->RemoveAurasDueToSpell(BG_WS_SPELL_WARSONG_FLAG);
message = GetMangosString(LANG_BG_WS_CAPTURED_HF);
type = CHAT_MSG_BG_SYSTEM_ALLIANCE;
if (GetTeamScore(ALLIANCE) < BG_WS_MAX_TEAM_SCORE)
AddPoint(ALLIANCE, 1);
PlaySoundToAll(BG_WS_SOUND_FLAG_CAPTURED_ALLIANCE);
RewardReputationToTeam(890, m_ReputationCapture, ALLIANCE);
}
else
{
if (!IsAllianceFlagPickedup())
return;
SetAllianceFlagPicker(0); // must be before aura remove to prevent 2 events (drop+capture) at the same time
// alliance flag in base (but not respawned yet)
m_FlagState[BG_TEAM_ALLIANCE] = BG_WS_FLAG_STATE_WAIT_RESPAWN;
// Drop Alliance Flag from Player
Source->RemoveAurasDueToSpell(BG_WS_SPELL_SILVERWING_FLAG);
message = GetMangosString(LANG_BG_WS_CAPTURED_AF);
type = CHAT_MSG_BG_SYSTEM_HORDE;
if (GetTeamScore(HORDE) < BG_WS_MAX_TEAM_SCORE)
AddPoint(HORDE, 1);
PlaySoundToAll(BG_WS_SOUND_FLAG_CAPTURED_HORDE);
RewardReputationToTeam(889, m_ReputationCapture, HORDE);
}
//for flag capture is reward distributed according level range
RewardHonorToTeamDepOnLvl(BG_WSG_FlagCapturedHonor, Source->GetTeam());
// despawn flags
SpawnEvent(WS_EVENT_FLAG_A, 0, false);
SpawnEvent(WS_EVENT_FLAG_H, 0, false);
WorldPacket data;
ChatHandler::FillMessageData(&data, Source->GetSession(), type, LANG_UNIVERSAL, NULL, Source->GetGUID(), message, NULL);
SendPacketToAll(&data);
UpdateFlagState(Source->GetTeam(), 1); // flag state none
UpdateTeamScore(Source->GetTeam());
// only flag capture should be updated
UpdatePlayerScore(Source, SCORE_FLAG_CAPTURES, 1); // +1 flag captures
if (GetTeamScore(ALLIANCE) == BG_WS_MAX_TEAM_SCORE)
winner = ALLIANCE;
if (GetTeamScore(HORDE) == BG_WS_MAX_TEAM_SCORE)
winner = HORDE;
if (winner)
{
UpdateWorldState(BG_WS_FLAG_UNK_ALLIANCE, 0);
UpdateWorldState(BG_WS_FLAG_UNK_HORDE, 0);
UpdateWorldState(BG_WS_FLAG_STATE_ALLIANCE, 1);
UpdateWorldState(BG_WS_FLAG_STATE_HORDE, 1);
EndBattleGround(winner);
}
else
{
m_FlagsTimer[GetTeamIndexByTeamId(Source->GetTeam()) ? 0 : 1] = BG_WS_FLAG_RESPAWN_TIME;
}
}
示例9: while
void BattlegroundAB::PostUpdateImpl(uint32 diff)
{
if (GetStatus() == STATUS_IN_PROGRESS)
{
_bgEvents.Update(diff);
while (uint32 eventId =_bgEvents.ExecuteEvent())
switch (eventId)
{
case BG_AB_EVENT_UPDATE_BANNER_STABLE:
case BG_AB_EVENT_UPDATE_BANNER_FARM:
case BG_AB_EVENT_UPDATE_BANNER_BLACKSMITH:
case BG_AB_EVENT_UPDATE_BANNER_LUMBERMILL:
case BG_AB_EVENT_UPDATE_BANNER_GOLDMINE:
CreateBanner(eventId - BG_AB_EVENT_UPDATE_BANNER_STABLE, false);
break;
case BG_AB_EVENT_CAPTURE_STABLE:
case BG_AB_EVENT_CAPTURE_FARM:
case BG_AB_EVENT_CAPTURE_BLACKSMITH:
case BG_AB_EVENT_CAPTURE_LUMBERMILL:
case BG_AB_EVENT_CAPTURE_GOLDMINE:
{
uint8 node = eventId - BG_AB_EVENT_CAPTURE_STABLE;
TeamId teamId = _capturePointInfo[node]._state == BG_AB_NODE_STATE_ALLY_CONTESTED ? TEAM_ALLIANCE : TEAM_HORDE;
DeleteBanner(node);
_capturePointInfo[node]._ownerTeamId = teamId;
_capturePointInfo[node]._state = teamId == TEAM_ALLIANCE ? BG_AB_NODE_STATE_ALLY_OCCUPIED : BG_AB_NODE_STATE_HORDE_OCCUPIED;
_capturePointInfo[node]._captured = true;
CreateBanner(node, false);
NodeOccupied(node);
SendNodeUpdate(node);
SendMessage2ToAll(LANG_BG_AB_NODE_TAKEN, teamId == TEAM_ALLIANCE ? CHAT_MSG_BG_SYSTEM_ALLIANCE : CHAT_MSG_BG_SYSTEM_HORDE, NULL, teamId == TEAM_ALLIANCE ? LANG_BG_AB_ALLY : LANG_BG_AB_HORDE, LANG_BG_AB_NODE_STABLES + node);
PlaySoundToAll(teamId == TEAM_ALLIANCE ? BG_AB_SOUND_NODE_CAPTURED_ALLIANCE : BG_AB_SOUND_NODE_CAPTURED_HORDE);
break;
}
case BG_AB_EVENT_ALLIANCE_TICK:
case BG_AB_EVENT_HORDE_TICK:
{
TeamId teamId = TeamId(eventId - BG_AB_EVENT_ALLIANCE_TICK);
uint8 controlledPoints = _controlledPoints[teamId];
if (controlledPoints == 0)
{
_bgEvents.ScheduleEvent(eventId, 3000);
break;
}
uint8 honorRewards = uint8(m_TeamScores[teamId] / _honorTics);
uint8 reputationRewards = uint8(m_TeamScores[teamId] / _reputationTics);
uint8 information = uint8(m_TeamScores[teamId] / BG_AB_WARNING_NEAR_VICTORY_SCORE);
m_TeamScores[teamId] += BG_AB_TickPoints[controlledPoints];
if (m_TeamScores[teamId] > BG_AB_MAX_TEAM_SCORE)
m_TeamScores[teamId] = BG_AB_MAX_TEAM_SCORE;
if (honorRewards < uint8(m_TeamScores[teamId] / _honorTics))
RewardHonorToTeam(GetBonusHonorFromKill(1), teamId);
if (reputationRewards < uint8(m_TeamScores[teamId] / _reputationTics))
RewardReputationToTeam(teamId == TEAM_ALLIANCE ? 509 : 510, 10, teamId);
if (information < uint8(m_TeamScores[teamId] / BG_AB_WARNING_NEAR_VICTORY_SCORE))
{
SendMessageToAll(teamId == TEAM_ALLIANCE ? LANG_BG_AB_A_NEAR_VICTORY : LANG_BG_AB_H_NEAR_VICTORY, CHAT_MSG_BG_SYSTEM_NEUTRAL);
PlaySoundToAll(BG_AB_SOUND_NEAR_VICTORY);
}
UpdateWorldState(teamId == TEAM_ALLIANCE ? BG_AB_OP_RESOURCES_ALLY : BG_AB_OP_RESOURCES_HORDE, m_TeamScores[teamId]);
if (m_TeamScores[teamId] > m_TeamScores[GetOtherTeamId(teamId)] + 500)
_teamScores500Disadvantage[GetOtherTeamId(teamId)] = true;
if (m_TeamScores[teamId] >= BG_AB_MAX_TEAM_SCORE)
EndBattleground(teamId);
_bgEvents.ScheduleEvent(eventId, BG_AB_TickIntervals[controlledPoints]);
break;
}
}
}
}
示例10: _CreateBanner
void BattleGroundAB::Update(uint32 diff)
{
BattleGround::Update(diff);
if (GetStatus() == STATUS_IN_PROGRESS)
{
int team_points[BG_TEAMS_COUNT] = { 0, 0 };
for (int node = 0; node < BG_AB_NODES_MAX; ++node)
{
// 3 sec delay to spawn new banner instead previous despawned one
if (m_BannerTimers[node].timer)
{
if (m_BannerTimers[node].timer > diff)
m_BannerTimers[node].timer -= diff;
else
{
m_BannerTimers[node].timer = 0;
_CreateBanner(node, m_BannerTimers[node].type, m_BannerTimers[node].teamIndex, false);
}
}
// 1-minute to occupy a node from contested state
if (m_NodeTimers[node])
{
if (m_NodeTimers[node] > diff)
m_NodeTimers[node] -= diff;
else
{
m_NodeTimers[node] = 0;
// Change from contested to occupied !
uint8 teamIndex = m_Nodes[node]-1;
m_prevNodes[node] = m_Nodes[node];
m_Nodes[node] += 2;
// create new occupied banner
_CreateBanner(node, BG_AB_NODE_TYPE_OCCUPIED, teamIndex, true);
_SendNodeUpdate(node);
_NodeOccupied(node,(teamIndex == 0) ? ALLIANCE:HORDE);
// Message to chatlog
if (teamIndex == 0)
{
SendMessage2ToAll(LANG_BG_AB_NODE_TAKEN,CHAT_MSG_BG_SYSTEM_ALLIANCE,NULL,LANG_BG_ALLY,_GetNodeNameId(node));
PlaySoundToAll(BG_AB_SOUND_NODE_CAPTURED_ALLIANCE);
}
else
{
SendMessage2ToAll(LANG_BG_AB_NODE_TAKEN,CHAT_MSG_BG_SYSTEM_HORDE,NULL,LANG_BG_HORDE,_GetNodeNameId(node));
PlaySoundToAll(BG_AB_SOUND_NODE_CAPTURED_HORDE);
}
}
}
for (int team = 0; team < BG_TEAMS_COUNT; ++team)
if (m_Nodes[node] == team + BG_AB_NODE_TYPE_OCCUPIED)
++team_points[team];
}
// Accumulate points
for (int team = 0; team < BG_TEAMS_COUNT; ++team)
{
int points = team_points[team];
if (!points)
continue;
m_lastTick[team] += diff;
if (m_lastTick[team] > BG_AB_TickIntervals[points])
{
m_lastTick[team] -= BG_AB_TickIntervals[points];
m_TeamScores[team] += BG_AB_TickPoints[points];
m_HonorScoreTics[team] += BG_AB_TickPoints[points];
m_ReputationScoreTics[team] += BG_AB_TickPoints[points];
m_ExperiencesTicks[team] += BG_AB_TickPoints[points];
if (m_ReputationScoreTics[team] >= m_ReputationTics)
{
RewardReputationToTeam(BATTLEGROUND_AB, 10, team == BG_TEAM_ALLIANCE ? ALLIANCE :HORDE);
m_ReputationScoreTics[team] -= m_ReputationTics;
}
if (m_HonorScoreTics[team] >= m_HonorTics)
{
RewardHonorToTeam(GetBonusHonorFromKill(sWorld.getConfig(CONFIG_UINT32_BONUS_HONOR_FLAG_AB)), (team == BG_TEAM_ALLIANCE) ? ALLIANCE : HORDE);
m_HonorScoreTics[team] -= m_HonorTics;
}
if (!m_IsInformedNearVictory && m_TeamScores[team] > BG_AB_WARNING_NEAR_VICTORY_SCORE)
{
if (team == BG_TEAM_ALLIANCE)
SendMessageToAll(LANG_BG_AB_A_NEAR_VICTORY, CHAT_MSG_BG_SYSTEM_NEUTRAL);
else
SendMessageToAll(LANG_BG_AB_H_NEAR_VICTORY, CHAT_MSG_BG_SYSTEM_NEUTRAL);
PlaySoundToAll(BG_AB_SOUND_NEAR_VICTORY);
m_IsInformedNearVictory = true;
}
if (m_ExperiencesTicks[team] >= BG_AB_ExperiencesTicks)
{
RewardXpToTeam(0, 0.8, (team == BG_TEAM_ALLIANCE) ? ALLIANCE : HORDE);
m_ExperiencesTicks[team] -= BG_AB_ExperiencesTicks;
}
if (m_TeamScores[team] > BG_AB_MAX_TEAM_SCORE)
m_TeamScores[team] = BG_AB_MAX_TEAM_SCORE;
if (team == BG_TEAM_ALLIANCE)
//.........这里部分代码省略.........
示例11: GetTeamIndexByTeamId
void BattleGroundSA::EventPlayerDamageGO(Player *player, GameObject* target_obj, uint32 eventId)
{
BattleGroundTeamIndex teamIndex = GetTeamIndexByTeamId(player->GetTeam());
uint32 type = NULL;
switch (target_obj->GetEntry())
{
case BG_SA_GO_GATES_ROOM_ANCIENT_SHRINE:
{
type = BG_SA_GO_GATES_T_ROOM_ANCIENT_SHRINE;
switch (eventId)
{
case 21630:
if (!GateRoomAncientShrineDamaged)
{
SendMessageSA(player, BG_SA_ATTACK, _GatesName(target_obj));
GateRoomAncientShrineDamaged = true;
}
break;
case 19836:
// SendMessageSA(player, BG_SA_DAMAGE, _GatesName(target_obj));
SendWarningToAllSA(NULL, NULL, TEAM_NONE, true, type);
UpdateWorldState(BG_SA_GateStatus[type], GateStatus[type] = BG_SA_GO_GATES_DAMAGE);
break;
case 19837:
// SendMessageSA(player, BG_SA_DESTROY, _GatesName(target_obj));
SendWarningToAllSA(NULL, NULL, TEAM_NONE, true, type, true);
UpdateWorldState(BG_SA_GateStatus[type], GateStatus[type] = BG_SA_GO_GATES_DESTROY);
UpdatePlayerScore(player, SCORE_GATES_DESTROYED, 1);
RewardHonorToTeam(100, (teamIndex == 0) ? ALLIANCE:HORDE);
RewardReputationToTeam((teamIndex == 0) ? 1050:1085, 75, (teamIndex == 0) ? ALLIANCE:HORDE);
relicGateDestroyed = true;
break;
}
break;
}
case BG_SA_GO_GATES_GREEN_EMERALD:
{
type = BG_SA_GO_GATES_T_GREEN_EMERALD;
switch (eventId)
{
case 21630:
if (!GateGreenEmeraldDamaged)
{
SendMessageSA(player, BG_SA_ATTACK, _GatesName(target_obj));
GateGreenEmeraldDamaged = true;
}
break;
case 19041:
// SendMessageSA(player, BG_SA_DAMAGE, _GatesName(target_obj));
SendWarningToAllSA(NULL, NULL, TEAM_NONE, true, type);
UpdateWorldState(BG_SA_GateStatus[type], GateStatus[type] = BG_SA_GO_GATES_DAMAGE);
break;
case 19046:
// SendMessageSA(player, BG_SA_DESTROY, _GatesName(target_obj));
SendWarningToAllSA(NULL, NULL, TEAM_NONE, true, type, true);
UpdateWorldState(BG_SA_GateStatus[type], GateStatus[type] = BG_SA_GO_GATES_DESTROY);
UpdatePlayerScore(player, SCORE_GATES_DESTROYED, 1);
RewardHonorToTeam(85, (teamIndex == 0) ? ALLIANCE:HORDE);
RewardReputationToTeam((teamIndex == 0) ? 1050:1085, 65, (teamIndex == 0) ? ALLIANCE:HORDE);
break;
}
break;
}
case BG_SA_GO_GATES_BLUE_SAPHIRE:
{
type = BG_SA_GO_GATES_T_BLUE_SAPHIRE;
switch (eventId)
{
case 21630:
if (!GateBlueSaphireDamaged)
{
SendMessageSA(player, BG_SA_ATTACK, _GatesName(target_obj));
GateBlueSaphireDamaged = true;
}
break;
case 19040:
// SendMessageSA(player, BG_SA_DAMAGE, _GatesName(target_obj));
SendWarningToAllSA(NULL, NULL, TEAM_NONE, true, type);
UpdateWorldState(BG_SA_GateStatus[type], GateStatus[type] = BG_SA_GO_GATES_DAMAGE);
break;
case 19045:
// SendMessageSA(player, BG_SA_DESTROY, _GatesName(target_obj));
SendWarningToAllSA(NULL, NULL, TEAM_NONE, true, type, true);
UpdateWorldState(BG_SA_GateStatus[type], GateStatus[type] = BG_SA_GO_GATES_DESTROY);
UpdatePlayerScore(player, SCORE_GATES_DESTROYED, 1);
RewardHonorToTeam(85, (teamIndex == 0) ? ALLIANCE:HORDE);
RewardReputationToTeam((teamIndex == 0) ? 1050:1085, 65, (teamIndex == 0) ? ALLIANCE:HORDE);
break;
}
break;
}
case BG_SA_GO_GATES_MAUVE_AMETHYST:
{
type = BG_SA_GO_GATES_T_MAUVE_AMETHYST;
switch (eventId)
{
case 21630:
if (!GateMauveAmethystDamaged)
{
//.........这里部分代码省略.........
示例12: StartShips
void BattleGroundSA::Update(uint32 diff)
{
BattleGround::Update(diff);
if (GetStatus() == STATUS_WAIT_JOIN && !shipsStarted)
if (Phase == SA_ROUND_ONE) // Round one not started yet
if (shipsTimer <= diff)
StartShips();
else
shipsTimer -= diff;
if (GetStatus() == STATUS_IN_PROGRESS) // Battleground already in progress
{
if (Round_timer >= BG_SA_ROUNDLENGTH)
{
if(Phase == SA_ROUND_ONE) // Timeout of first round
{
PlaySoundToAll(BG_SA_SOUND_GYD_VICTORY);
SendMessageToAll(defender == ALLIANCE ? LANG_BG_SA_ALLIANCE_TIMEOUT_END_1ROUND : LANG_BG_SA_HORDE_TIMEOUT_END_1ROUND, CHAT_MSG_BG_SYSTEM_NEUTRAL, NULL);
RoundScores[0].winner = GetDefender();
RoundScores[0].time = 601000;
for (BattleGroundPlayerMap::const_iterator itr = GetPlayers().begin(); itr != GetPlayers().end(); ++itr)
{
if (Player *plr = sObjectMgr.GetPlayer(itr->first))
plr->GetAchievementMgr().UpdateAchievementCriteria(ACHIEVEMENT_CRITERIA_TYPE_BE_SPELL_TARGET, 52459);
}
ResetBattle(0, defender);
}
else // Timeout of second round
{
SendMessageToAll(defender == ALLIANCE ? LANG_BG_SA_ALLIANCE_TIMEOUT_END_2ROUND : LANG_BG_SA_HORDE_TIMEOUT_END_2ROUND, CHAT_MSG_BG_SYSTEM_NEUTRAL, NULL);
RoundScores[1].winner = GetDefender();
RoundScores[1].time = 601000;
for (BattleGroundPlayerMap::const_iterator itr = GetPlayers().begin(); itr != GetPlayers().end(); ++itr)
{
if (Player *plr = sObjectMgr.GetPlayer(itr->first))
plr->GetAchievementMgr().UpdateAchievementCriteria(ACHIEVEMENT_CRITERIA_TYPE_BE_SPELL_TARGET, 52459);
}
BattleGroundSA::EndBattleGround(defender);
return;
}
}
else
Round_timer += diff;
for (int gyd = 0; gyd < BG_SA_GRY_MAX; ++gyd)
{
// 3 sec delay to spawn new banner instead previous despawned one
if (m_BannerTimers[gyd].timer)
{
if (m_BannerTimers[gyd].timer > diff)
m_BannerTimers[gyd].timer -= diff;
else
{
m_BannerTimers[gyd].timer = 0;
_CreateBanner(gyd, m_BannerTimers[gyd].type, m_BannerTimers[gyd].teamIndex, false);
}
}
// 1-minute to occupy a node from contested state
if (m_GydTimers[gyd])
{
if (m_GydTimers[gyd] > diff)
m_GydTimers[gyd] -= diff;
else
{
m_GydTimers[gyd] = 0;
// Change from contested to occupied !
uint8 teamIndex = m_Gyd[gyd]-1;
m_prevGyd[gyd] = m_Gyd[gyd];
m_Gyd[gyd] += 2;
// create new occupied banner
_CreateBanner(gyd, BG_SA_GARVE_TYPE_OCCUPIED, teamIndex, true);
SpawnEvent(gyd+11, teamIndex, true);
//_SendNodeUpdate(node);
_GydOccupied(gyd,(teamIndex == 0) ? ALLIANCE:HORDE);
// Message to chatlog
RewardHonorToTeam(85, (teamIndex == 0) ? ALLIANCE:HORDE);
RewardXpToTeam(0, 0.6f, (teamIndex == 0) ? ALLIANCE:HORDE);
RewardReputationToTeam((teamIndex == 0) ? 1050:1085, 65, (teamIndex == 0) ? ALLIANCE:HORDE);
switch(gyd)
{
case 0: SpawnEvent(SA_EVENT_ADD_VECH_W, 0, true);break;
case 1: SpawnEvent(SA_EVENT_ADD_VECH_E, 0, true);break;
}
if (teamIndex == 0)
{
// SendMessage2ToAll(LANG_BG_SA_AH_SEIZES_GRAVEYARD,CHAT_MSG_BG_SYSTEM_ALLIANCE,NULL,LANG_BG_ALLY,_GydName(gyd));
PlaySoundToAll(BG_SA_SOUND_GYD_CAPTURED_ALLIANCE);
SendWarningToAllSA(gyd, STATUS_CONQUESTED, ALLIANCE);
}
else
{
// SendMessage2ToAll(LANG_BG_SA_AH_SEIZES_GRAVEYARD,CHAT_MSG_BG_SYSTEM_HORDE,NULL,LANG_BG_HORDE,_GydName(gyd));
PlaySoundToAll(BG_SA_SOUND_GYD_CAPTURED_HORDE);
SendWarningToAllSA(gyd, STATUS_CONQUESTED, HORDE);
}
//.........这里部分代码省略.........
示例13: _CreateBanner
void BattlegroundAB::PostUpdateImpl(uint32 diff)
{
if (GetStatus() == STATUS_IN_PROGRESS)
{
int team_points[BG_TEAMS_COUNT] = { 0, 0 };
for (int node = 0; node < BG_AB_DYNAMIC_NODES_COUNT; ++node)
{
// 3 sec delay to spawn new banner instead previous despawned one
if (m_BannerTimers[node].timer)
{
if (m_BannerTimers[node].timer > diff)
m_BannerTimers[node].timer -= diff;
else
{
m_BannerTimers[node].timer = 0;
_CreateBanner(node, m_BannerTimers[node].type, m_BannerTimers[node].teamIndex, false);
}
}
// 1-minute to occupy a node from contested state
if (m_NodeTimers[node])
{
if (m_NodeTimers[node] > diff)
m_NodeTimers[node] -= diff;
else
{
m_NodeTimers[node] = 0;
// Change from contested to occupied !
uint8 teamIndex = m_Nodes[node]-1;
m_prevNodes[node] = m_Nodes[node];
m_Nodes[node] += 2;
// burn current contested banner
_DelBanner(node, BG_AB_NODE_TYPE_CONTESTED, teamIndex);
// create new occupied banner
_CreateBanner(node, BG_AB_NODE_TYPE_OCCUPIED, teamIndex, true);
_SendNodeUpdate(node);
_NodeOccupied(node, (teamIndex == 0) ? ALLIANCE:HORDE);
// Message to chatlog
if (teamIndex == 0)
{
// FIXME: team and node names not localized
SendMessage2ToAll(LANG_BG_AB_NODE_TAKEN, CHAT_MSG_BG_SYSTEM_ALLIANCE, NULL, LANG_BG_AB_ALLY, _GetNodeNameId(node));
PlaySoundToAll(BG_AB_SOUND_NODE_CAPTURED_ALLIANCE);
}
else
{
// FIXME: team and node names not localized
SendMessage2ToAll(LANG_BG_AB_NODE_TAKEN, CHAT_MSG_BG_SYSTEM_HORDE, NULL, LANG_BG_AB_HORDE, _GetNodeNameId(node));
PlaySoundToAll(BG_AB_SOUND_NODE_CAPTURED_HORDE);
}
}
}
for (int team = 0; team < BG_TEAMS_COUNT; ++team)
if (m_Nodes[node] == team + BG_AB_NODE_TYPE_OCCUPIED)
++team_points[team];
}
// Accumulate points
for (int team = 0; team < BG_TEAMS_COUNT; ++team)
{
int points = team_points[team];
if (!points)
continue;
m_lastTick[team] += diff;
if (m_lastTick[team] > BG_AB_TickIntervals[points])
{
m_lastTick[team] -= BG_AB_TickIntervals[points];
m_TeamScores[team] += BG_AB_TickPoints[points];
m_HonorScoreTics[team] += BG_AB_TickPoints[points];
m_ReputationScoreTics[team] += BG_AB_TickPoints[points];
if (m_ReputationScoreTics[team] >= m_ReputationTics)
{
RewardReputationToTeam(509, 510, 10, team == ALLIANCE ? ALLIANCE : HORDE);
m_ReputationScoreTics[team] -= m_ReputationTics;
}
if (m_HonorScoreTics[team] >= m_HonorTics)
{
RewardHonorToTeam(GetBonusHonorFromKill(1), (team == TEAM_ALLIANCE) ? ALLIANCE : HORDE);
m_HonorScoreTics[team] -= m_HonorTics;
}
if (!m_IsInformedNearVictory && m_TeamScores[team] > BG_AB_WARNING_NEAR_VICTORY_SCORE)
{
if (team == TEAM_ALLIANCE)
SendMessageToAll(LANG_BG_AB_A_NEAR_VICTORY, CHAT_MSG_BG_SYSTEM_NEUTRAL);
else
SendMessageToAll(LANG_BG_AB_H_NEAR_VICTORY, CHAT_MSG_BG_SYSTEM_NEUTRAL);
PlaySoundToAll(BG_AB_SOUND_NEAR_VICTORY);
m_IsInformedNearVictory = true;
}
if (m_TeamScores[team] > BG_AB_MAX_TEAM_SCORE)
m_TeamScores[team] = BG_AB_MAX_TEAM_SCORE;
//.........这里部分代码省略.........
示例14: ModifyStartDelayTime
//.........这里部分代码省略.........
int team_points[2] = { 0, 0 };
for (int node = 0; node < BG_AB_DYNAMIC_NODES_COUNT; ++node)
{
// 3 sec delay to spawn new banner instead previous despawned one
if (m_BannerTimers[node].timer )
{
if (m_BannerTimers[node].timer > diff )
m_BannerTimers[node].timer -= diff;
else
{
m_BannerTimers[node].timer = 0;
_CreateBanner(node, m_BannerTimers[node].type, m_BannerTimers[node].teamIndex, false);
}
}
// 1-minute to occupy a node from contested state
if (m_NodeTimers[node] )
{
if (m_NodeTimers[node] > diff )
m_NodeTimers[node] -= diff;
else
{
m_NodeTimers[node] = 0;
// Change from contested to occupied !
uint8 teamIndex = m_Nodes[node]-1;
m_prevNodes[node] = m_Nodes[node];
m_Nodes[node] += 2;
// burn current contested banner
_DelBanner(node, BG_AB_NODE_TYPE_CONTESTED, teamIndex);
// create new occupied banner
_CreateBanner(node, BG_AB_NODE_TYPE_OCCUPIED, teamIndex, true);
_SendNodeUpdate(node);
_NodeOccupied(node,(teamIndex == 0) ? ALLIANCE:HORDE);
// Message to chatlog
char buf[256];
uint8 type = (teamIndex == 0) ? CHAT_MSG_BG_SYSTEM_ALLIANCE : CHAT_MSG_BG_SYSTEM_HORDE;
sprintf(buf, GetNeoString(LANG_BG_AB_NODE_TAKEN), (teamIndex == 0) ? GetNeoString(LANG_BG_AB_ALLY) : GetNeoString(LANG_BG_AB_HORDE), _GetNodeName(node));
WorldPacket data;
ChatHandler::FillMessageData(&data, NULL, type, LANG_UNIVERSAL, NULL, 0, buf, NULL);
SendPacketToAll(&data);
PlaySoundToAll((teamIndex == 0) ? SOUND_NODE_CAPTURED_ALLIANCE : SOUND_NODE_CAPTURED_HORDE);
}
}
for (int team = 0; team < 2; ++team)
if (m_Nodes[node] == team + BG_AB_NODE_TYPE_OCCUPIED )
++team_points[team];
}
// Accumulate points
for (int team = 0; team < 2; ++team)
{
int points = team_points[team];
if (!points )
continue;
m_lastTick[team] += diff;
if (m_lastTick[team] > BG_AB_TickIntervals[points] )
{
m_lastTick[team] -= BG_AB_TickIntervals[points];
m_TeamScores[team] += BG_AB_TickPoints[points];
m_score[team] = m_TeamScores[team];
m_HonorScoreTics[team] += BG_AB_TickPoints[points];
m_ReputationScoreTics[team] += BG_AB_TickPoints[points];
if (m_ReputationScoreTics[team] >= BG_AB_ReputationScoreTicks[m_HonorMode] )
{
(team == BG_TEAM_ALLIANCE) ? RewardReputationToTeam(509, 10, ALLIANCE) : RewardReputationToTeam(510, 10, HORDE);
m_ReputationScoreTics[team] -= BG_AB_ReputationScoreTicks[m_HonorMode];
}
if (m_HonorScoreTics[team] >= BG_AB_HonorScoreTicks[m_HonorMode] )
{
(team == BG_TEAM_ALLIANCE) ? RewardHonorToTeam(20, ALLIANCE) : RewardHonorToTeam(20, HORDE);
m_HonorScoreTics[team] -= BG_AB_HonorScoreTicks[m_HonorMode];
}
if (!m_IsInformedNearVictory && m_TeamScores[team] > 1800 )
{
if (team == BG_TEAM_ALLIANCE )
SendMessageToAll(GetNeoString(LANG_BG_AB_A_NEAR_VICTORY));
else
SendMessageToAll(GetNeoString(LANG_BG_AB_H_NEAR_VICTORY));
PlaySoundToAll(SOUND_NEAR_VICTORY);
m_IsInformedNearVictory = true;
}
if (m_TeamScores[team] > 2000 )
m_TeamScores[team] = 2000;
if (team == BG_TEAM_ALLIANCE )
UpdateWorldState(BG_AB_OP_RESOURCES_ALLY, m_TeamScores[team]);
if (team == BG_TEAM_HORDE )
UpdateWorldState(BG_AB_OP_RESOURCES_HORDE, m_TeamScores[team]);
}
}
// Test win condition
if (m_TeamScores[BG_TEAM_ALLIANCE] >= 2000 )
EndBattleGround(ALLIANCE);
if (m_TeamScores[BG_TEAM_HORDE] >= 2000 )
EndBattleGround(HORDE);
}
}
示例15: _CreateBanner
void BattleGroundAB::Update(time_t diff)
{
BattleGround::Update(diff);
if (GetStatus() == STATUS_IN_PROGRESS)
{
int team_points[BG_TEAMS_COUNT] = { 0, 0 };
for (int node = 0; node < BG_AB_NODES_MAX; ++node)
{
// 3 sec delay to spawn new banner instead previous despawned one
if (m_BannerTimers[node].timer)
{
if (m_BannerTimers[node].timer > int32(diff))
m_BannerTimers[node].timer -= diff;
else
{
m_BannerTimers[node].timer = 0;
_CreateBanner(node, m_BannerTimers[node].type, m_BannerTimers[node].teamIndex, false);
}
}
// 1-minute to occupy a node from contested state
if (m_NodeTimers[node])
{
if (m_NodeTimers[node] > int32(diff))
m_NodeTimers[node] -= diff;
else
{
m_NodeTimers[node] = 0;
// Change from contested to occupied !
uint8 teamIndex = m_Nodes[node]-1;
m_prevNodes[node] = m_Nodes[node];
m_Nodes[node] += 2;
// burn current contested banner
_DelBanner(node, BG_AB_NODE_TYPE_CONTESTED, teamIndex);
// create new occupied banner
_CreateBanner(node, BG_AB_NODE_TYPE_OCCUPIED, teamIndex, true);
_SendNodeUpdate(node);
_NodeOccupied(node,(teamIndex == 0) ? ALLIANCE:HORDE);
// Message to chatlog
if (teamIndex == 0)
{
SendMessage2ToAll(LANG_BG_AB_NODE_TAKEN, CHAT_MSG_BG_SYSTEM_ALLIANCE, NULL, LANG_BG_AB_ALLY, _GetNodeNameId(node));
PlaySoundToAll(BG_AB_SOUND_NODE_CAPTURED_ALLIANCE);
}
else
{
SendMessage2ToAll(LANG_BG_AB_NODE_TAKEN, CHAT_MSG_BG_SYSTEM_HORDE, NULL, LANG_BG_AB_HORDE, _GetNodeNameId(node));
PlaySoundToAll(BG_AB_SOUND_NODE_CAPTURED_HORDE);
}
}
}
for (int team = 0; team < BG_TEAMS_COUNT; ++team)
if (m_Nodes[node] == team + BG_AB_NODE_TYPE_OCCUPIED)
++team_points[team];
}
// Accumulate points
for (int team = 0; team < BG_TEAMS_COUNT; ++team)
{
int points = team_points[team];
if (!points)
continue;
m_lastTick[team] += diff;
if (m_lastTick[team] > BG_AB_TickIntervals[points])
{
m_lastTick[team] -= BG_AB_TickIntervals[points];
m_TeamScores[team] += BG_AB_TickPoints[points];
m_score[team] = m_TeamScores[team];
m_HonorScoreTics[team] += BG_AB_TickPoints[points];
m_ReputationScoreTics[team] += BG_AB_TickPoints[points];
if (m_ReputationScoreTics[team] >= BG_AB_ReputationScoreTicks[m_HonorMode])
{
(team == BG_TEAM_ALLIANCE) ? RewardReputationToTeam(509, 10, ALLIANCE) : RewardReputationToTeam(510, 10, HORDE);
m_ReputationScoreTics[team] -= BG_AB_ReputationScoreTicks[m_HonorMode];
}
if (m_HonorScoreTics[team] >= BG_AB_HonorScoreTicks[m_HonorMode])
{
(team == BG_TEAM_ALLIANCE) ? RewardHonorToTeam(20, ALLIANCE) : RewardHonorToTeam(20, HORDE);
m_HonorScoreTics[team] -= BG_AB_HonorScoreTicks[m_HonorMode];
}
if (!m_IsInformedNearVictory && m_TeamScores[team] > BG_AB_WARNING_NEAR_VICTORY_SCORE)
{
if (team == BG_TEAM_ALLIANCE)
SendMessageToAll(LANG_BG_AB_A_NEAR_VICTORY, CHAT_MSG_BG_SYSTEM_NEUTRAL);
else
SendMessageToAll(LANG_BG_AB_H_NEAR_VICTORY, CHAT_MSG_BG_SYSTEM_NEUTRAL);
PlaySoundToAll(BG_AB_SOUND_NEAR_VICTORY);
m_IsInformedNearVictory = true;
}
if (m_TeamScores[team] > BG_AB_MAX_TEAM_SCORE)
m_TeamScores[team] = BG_AB_MAX_TEAM_SCORE;
if (team == BG_TEAM_ALLIANCE)
UpdateWorldState(BG_AB_OP_RESOURCES_ALLY, m_TeamScores[team]);
if (team == BG_TEAM_HORDE)
UpdateWorldState(BG_AB_OP_RESOURCES_HORDE, m_TeamScores[team]);
//.........这里部分代码省略.........