本文整理汇总了C++中GetTeamIndex函数的典型用法代码示例。如果您正苦于以下问题:C++ GetTeamIndex函数的具体用法?C++ GetTeamIndex怎么用?C++ GetTeamIndex使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了GetTeamIndex函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。
示例1: GetWorld
void ARealmEnabler::OnDeath(float KillingDamage, struct FDamageEvent const& DamageEvent, class APawn* InstigatingPawn, class AActor* DamageCauser, FRealmDamage& realmDamage)
{
Super::OnDeath(KillingDamage, DamageEvent, InstigatingPawn, DamageCauser, realmDamage);
if (Role == ROLE_Authority && GetWorld()->GetAuthGameMode<ARealmGameMode>())
{
if (GetTeamIndex() == 0)
GetWorld()->GetAuthGameMode<ARealmGameMode>()->EnablerDestroyed(this, 1);
else if (GetTeamIndex() == 1)
GetWorld()->GetAuthGameMode<ARealmGameMode>()->EnablerDestroyed(this, 0);
}
}
开发者ID:MatrIsCool,项目名称:Mythos-Realm,代码行数:12,代码来源:RealmEnabler.cpp
示例2: sys_log
void CWarMap::OnKill(LPCHARACTER killer, LPCHARACTER ch)
{
if (m_bEnded)
return;
DWORD dwKillerGuild = 0;
DWORD dwDeadGuild = 0;
if (killer->GetGuild())
dwKillerGuild = killer->GetGuild()->GetID();
if (ch->GetGuild())
dwDeadGuild = ch->GetGuild()->GetID();
BYTE idx;
sys_log(0, "WarMap::OnKill %u %u", dwKillerGuild, dwDeadGuild);
if (!GetTeamIndex(dwKillerGuild, idx))
return;
if (!GetTeamIndex(dwDeadGuild, idx))
return;
switch (m_kMapInfo.bType)
{
case WAR_MAP_TYPE_NORMAL:
SendGuildWarScore(dwKillerGuild, dwDeadGuild, 1, ch->GetLevel());
break;
case WAR_MAP_TYPE_FLAG:
{
CAffect * pkAff = ch->FindAffect(AFFECT_WAR_FLAG);
if (pkAff)
{
if (GetTeamIndex(pkAff->lApplyValue, idx))
AddFlag(idx, ch->GetX(), ch->GetY());
ch->RemoveAffect(AFFECT_WAR_FLAG);
}
}
break;
default:
sys_err("unknown war map type %u index %d", m_kMapInfo.bType, m_kMapInfo.lMapIndex);
break;
}
}
开发者ID:adi97ida,项目名称:Server,代码行数:49,代码来源:war_map.cpp
示例3: memset
const char *CTeamplayRules::TeamWithFewestPlayers( void )
{
int i;
int minPlayers = MAX_TEAMS;
int teamCount[ MAX_TEAMS ];
char *pTeamName = NULL;
memset( teamCount, 0, MAX_TEAMS * sizeof(int) );
// loop through all clients, count number of players on each team
for ( i = 1; i <= gpGlobals->maxClients; i++ )
{
CBaseEntity *plr = UTIL_PlayerByIndex( i );
if ( plr )
{
int team = GetTeamIndex( plr->TeamID() );
if ( team >= 0 )
teamCount[team] ++;
}
}
// Find team with least players
for ( i = 0; i < num_teams; i++ )
{
if ( teamCount[i] < minPlayers )
{
minPlayers = teamCount[i];
pTeamName = team_names[i];
}
}
return pTeamName;
}
开发者ID:Baer42,项目名称:Source-SDK-2014,代码行数:34,代码来源:teamplay_gamerules.cpp
示例4: GetPlayerInfo
void CHudStatusBar::ParseStatusString(int line_num)
{
int indexval;
indexval = m_iStatusValues[1];
GetPlayerInfo(indexval, &g_PlayerInfoList[indexval]);
if(g_PlayerInfoList[indexval].name != NULL)
{
strncpy(m_szName[line_num], g_PlayerInfoList[indexval].name, MAX_PLAYER_NAME_LENGTH);
}
else
{
strncpy(m_szName[line_num], "******", MAX_PLAYER_NAME_LENGTH);
}
g_iNameColors = GetTeamIndex(indexval);
indexval = m_iStatusValues[2];
sprintf(m_szHealth[line_num], ":%d", indexval);
indexval = m_iStatusValues[3];
sprintf(m_szArmor[line_num], ":%d", indexval);
m_iTeamMate[line_num] = m_iStatusValues[5];
}
开发者ID:Sh1ft0x0EF,项目名称:HLSDKRevamp,代码行数:27,代码来源:statusbar.cpp
示例5: return
BOOL CHalfLifeTeamplay::IsValidTeam( const char *pTeamName )
{
if ( !m_teamLimit ) // Any team is valid if the teamlist isn't set
return TRUE;
return ( GetTeamIndex( pTeamName ) != -1 ) ? TRUE : FALSE;
}
开发者ID:Arkshine,项目名称:NS,代码行数:7,代码来源:teamplay_gamerules.cpp
示例6: OnTargetsUpdate
void ARealmEnabler::OnTargetsUpdate()
{
for (TActorIterator<APlayerCharacter> plyitr(GetWorld()); plyitr; ++plyitr)
{
APlayerCharacter* pc = (*plyitr);
if (!IsValid(pc) || !pc->IsAlive() || pc->GetTeamIndex() != GetTeamIndex())
continue;
float distanceSq = (pc->GetActorLocation() - GetActorLocation()).SizeSquared2D();
if (distanceSq > FMath::Square(auraRange))
{
if (IsValid(pc->GetStatsManager()) && protectedPlayers.Contains(pc) && protectedPlayers.Remove(pc) > 0)
EnablerEffectFinished(pc);
}
else if (!protectedPlayers.Contains(pc) && protectedPlayers.AddUnique(pc) >= 0)
{
enablerAuraEffect = GetWorld()->SpawnActor<AEffect>(AEffect::StaticClass());
//effect descriptions
enablerAuraEffect->uiName = LOCTEXT("enablereffect", "Enabler Protection Aura");
enablerAuraEffect->description = LOCTEXT("enablereffectdesc", "This unit is under protection from their Enabler and has increased Health and Flare regeneration.");
enablerAuraEffect->keyName = "enablerprotection";
enablerAuraEffect->bCanBeInflictedMultipleTimes = false;
//effect stat changes
enablerAuraEffect->stats.AddUnique(EStat::ES_HPRegen);
enablerAuraEffect->stats.AddUnique(EStat::ES_FlareRegen);
enablerAuraEffect->amounts.Add(50.f);
enablerAuraEffect->amounts.Add(50.f);
pc->GetStatsManager()->AddCreatedEffect(enablerAuraEffect);
}
}
}
开发者ID:MatrIsCool,项目名称:Mythos-Realm,代码行数:35,代码来源:RealmEnabler.cpp
示例7: return
bool CTeamplayRules::IsValidTeam( const char *pTeamName )
{
if ( !m_teamLimit ) // Any team is valid if the teamlist isn't set
return true;
return ( GetTeamIndex( pTeamName ) != -1 ) ? true : false;
}
开发者ID:Baer42,项目名称:Source-SDK-2014,代码行数:7,代码来源:teamplay_gamerules.cpp
示例8: GetTeamIndex
WorldSafeLocsEntry const* BattleGroundTP::GetClosestGraveYard(Player* player)
{
//if status in progress, it returns main or central graveyards with spiritguides
//else it will return the graveyard in the flagroom - this is especially good
//if a player dies in preparation phase - then the player can't cheat
//and teleport to the graveyard outside the flagroom
//and start running around, while the doors are still closed
if (GetStatus() == STATUS_WAIT_JOIN)
{
if (player->GetTeam() == ALLIANCE)
return sWorldSafeLocsStore.LookupEntry(TP_GRAVEYARD_FLAGROOM_ALLIANCE);
else
return sWorldSafeLocsStore.LookupEntry(TP_GRAVEYARD_FLAGROOM_HORDE);
}
TeamIndex teamIndex = GetTeamIndex(player->GetTeam());
// Is there any occupied node for this team?
std::vector<uint32> nodes;
if (teamIndex == TEAM_INDEX_ALLIANCE)
{
nodes.push_back(TP_GRAVEYARD_MAIN_ALLIANCE);
nodes.push_back(TP_GRAVEYARD_CENTER_ALLIANCE);
}
else
{
nodes.push_back(TP_GRAVEYARD_MAIN_HORDE);
nodes.push_back(TP_GRAVEYARD_CENTER_HORDE);
}
WorldSafeLocsEntry const* good_entry = NULL;
// If so, select the closest node to place ghost on
if (!nodes.empty())
{
float plr_x = player->GetPositionX();
float plr_y = player->GetPositionY();
float mindist = 999999.0f;
for (uint8 i = 0; i < nodes.size(); ++i)
{
WorldSafeLocsEntry const*entry = sWorldSafeLocsStore.LookupEntry(nodes[i]);
if (!entry)
continue;
float dist = (entry->x - plr_x) * (entry->x - plr_x) + (entry->y - plr_y) * (entry->y - plr_y);
if (mindist > dist)
{
mindist = dist;
good_entry = entry;
}
}
nodes.clear();
}
// If not, place ghost on starting location
if (!good_entry)
good_entry = sWorldSafeLocsStore.LookupEntry(teamIndex == TEAM_INDEX_ALLIANCE ? TP_GRAVEYARD_FLAGROOM_ALLIANCE : TP_GRAVEYARD_FLAGROOM_HORDE);
return good_entry;
}
开发者ID:Calixa,项目名称:murlocs_434,代码行数:59,代码来源:BattleGroundTP.cpp
示例9: GetActorLocation
void ATurret::TargetOutofRange()
{
if (!IsValid(this))
return;
TArray<FHitResult> hits;
FVector start = GetActorLocation();
FVector end = start;
end.Z += 5.f;
TArray<AGameCharacter*> possibleTargets;
GetWorld()->SweepMultiByChannel(hits, start, end, GetActorRotation().Quaternion(), ECC_Visibility, FCollisionShape::MakeSphere(GetCurrentValueForStat(EStat::ES_AARange)));
for (FHitResult hit : hits)
{
AGameCharacter* gc = Cast<AGameCharacter>(hit.GetActor());
if (IsValid(gc) && gc->IsAlive() && GetTeamIndex() != gc->GetTeamIndex())
possibleTargets.AddUnique(gc);
}
//first aggro any minions first
for (AGameCharacter* gc : possibleTargets)
{
if (gc->IsA(AMinionCharacter::StaticClass()))
{
SetCurrentTarget(gc);
StartAutoAttack();
return;
}
}
//then aggro an objective if we can
for (AGameCharacter* gc : possibleTargets)
{
if (gc->IsA(ARealmObjective::StaticClass()))
{
SetCurrentTarget(gc);
StartAutoAttack();
return;
}
}
//lastly aggro any mythos
for (AGameCharacter* gc : possibleTargets)
{
if (gc->IsA(APlayerCharacter::StaticClass()))
{
SetCurrentTarget(gc);
StartAutoAttack();
return;
}
}
StopAutoAttack();
}
开发者ID:ericliuchina,项目名称:Mythos-Realm,代码行数:58,代码来源:RealmTurret.cpp
示例10: RewardReputationToTeam
void BattleGroundAV::EndBattleGround(Team winner)
{
// calculate bonuskills for both teams:
uint32 tower_survived[PVP_TEAM_COUNT] = {0, 0};
uint32 graves_owned[PVP_TEAM_COUNT] = {0, 0};
uint32 mines_owned[PVP_TEAM_COUNT] = {0, 0};
// towers all not destroyed:
for (BG_AV_Nodes i = BG_AV_NODES_DUNBALDAR_SOUTH; i <= BG_AV_NODES_STONEHEART_BUNKER; ++i)
if (m_Nodes[i].State == POINT_CONTROLLED)
if (m_Nodes[i].TotalOwner == TEAM_INDEX_ALLIANCE)
++tower_survived[TEAM_INDEX_ALLIANCE];
for (BG_AV_Nodes i = BG_AV_NODES_ICEBLOOD_TOWER; i <= BG_AV_NODES_FROSTWOLF_WTOWER; ++i)
if (m_Nodes[i].State == POINT_CONTROLLED)
if (m_Nodes[i].TotalOwner == TEAM_INDEX_HORDE)
++tower_survived[TEAM_INDEX_HORDE];
// graves all controlled
for (BG_AV_Nodes i = BG_AV_NODES_FIRSTAID_STATION; i < BG_AV_NODES_MAX; ++i)
if (m_Nodes[i].State == POINT_CONTROLLED && m_Nodes[i].Owner != TEAM_INDEX_NEUTRAL)
++graves_owned[m_Nodes[i].Owner];
for (uint8 i = 0; i < BG_AV_MAX_MINES; ++i)
if (m_Mine_Owner[i] != TEAM_INDEX_NEUTRAL)
++mines_owned[m_Mine_Owner[i]];
// now we have the values give the honor/reputation to the teams:
Team team[PVP_TEAM_COUNT] = { ALLIANCE, HORDE };
uint32 faction[PVP_TEAM_COUNT] = { BG_AV_FACTION_A, BG_AV_FACTION_H };
for (uint8 i = 0; i < PVP_TEAM_COUNT; ++i)
{
if (tower_survived[i])
{
RewardReputationToTeam(faction[i], tower_survived[i] * m_RepSurviveTower, team[i]);
RewardHonorToTeam(GetBonusHonorFromKill(tower_survived[i] * BG_AV_KILL_SURVIVING_TOWER), team[i]);
}
DEBUG_LOG("BattleGroundAV: EndbattleGround: bgteam: %u towers:%u honor:%u rep:%u", i, tower_survived[i], GetBonusHonorFromKill(tower_survived[i] * BG_AV_KILL_SURVIVING_TOWER), tower_survived[i] * BG_AV_REP_SURVIVING_TOWER);
if (graves_owned[i])
RewardReputationToTeam(faction[i], graves_owned[i] * m_RepOwnedGrave, team[i]);
if (mines_owned[i])
RewardReputationToTeam(faction[i], mines_owned[i] * m_RepOwnedMine, team[i]);
// captain survived?:
if (!IsActiveEvent(BG_AV_NodeEventCaptainDead_A + GetTeamIndex(team[i]), 0))
{
RewardReputationToTeam(faction[i], m_RepSurviveCaptain, team[i]);
RewardHonorToTeam(GetBonusHonorFromKill(BG_AV_KILL_SURVIVING_CAPTAIN), team[i]);
}
}
// both teams:
if (m_HonorMapComplete)
{
RewardHonorToTeam(m_HonorMapComplete, ALLIANCE);
RewardHonorToTeam(m_HonorMapComplete, HORDE);
}
BattleGround::EndBattleGround(winner);
}
开发者ID:wuzhupc,项目名称:mangos,代码行数:56,代码来源:BattleGroundAV.cpp
示例11: GetTeamIndex
WorldSafeLocsEntry const* BattleGroundSA::GetClosestGraveYard(Player* player)
{
TeamIndex teamIndex = GetTeamIndex(player->GetTeam());
// Is there any occupied node for this team?
std::vector<uint8> gyd;
for (uint8 i = 0; i <= BG_SA_GRY_MAX; ++i)
// players should be able to ressurect at their faction's contested/occupied graveyards too
if ((m_Gyd[i] == teamIndex + BG_SA_GRAVE_STATUS_CONTESTED) || (m_Gyd[i] == teamIndex + BG_SA_GRAVE_STATUS_OCCUPIED))
gyd.push_back(i);
WorldSafeLocsEntry const* good_entry = NULL;
// If so, select the closest node to place ghost on
if (!gyd.empty())
{
float plr_x = player->GetPositionX();
float plr_y = player->GetPositionY();
float mindist = 999999.0f;
for (uint8 i = 0; i < gyd.size(); ++i)
{
WorldSafeLocsEntry const*entry = sWorldSafeLocsStore.LookupEntry(BG_SA_GraveyardIdsPhase[gyd[i]]);
if (!entry)
continue;
float dist = (entry->x - plr_x)*(entry->x - plr_x)+(entry->y - plr_y)*(entry->y - plr_y);
if (mindist > dist)
{
mindist = dist;
good_entry = entry;
}
}
gyd.clear();
}
// If not, place ghost on starting location
if (!good_entry)
{
if (GetDefender() == HORDE)
{
if (teamIndex == 0)
good_entry = sWorldSafeLocsStore.LookupEntry(BG_SA_GraveyardIds[1]);
else
good_entry = sWorldSafeLocsStore.LookupEntry(BG_SA_GraveyardIds[0]);
}
if (GetDefender() == ALLIANCE)
{
if (teamIndex == 0)
good_entry = sWorldSafeLocsStore.LookupEntry(BG_SA_GraveyardIds[0]);
else
good_entry = sWorldSafeLocsStore.LookupEntry(BG_SA_GraveyardIds[1]);
}
}
return good_entry;
}
开发者ID:Sar777,项目名称:mangos,代码行数:55,代码来源:BattleGroundSA.cpp
示例12: BG_SA_Events
void BattleGroundSA::EventPlayerClickedOnFlag(Player *source, GameObject* target_obj)
{
if (GetStatus() != STATUS_IN_PROGRESS)
return;
uint8 objectEvent = (sBattleGroundMgr.GetGameObjectEventIndex(target_obj->GetGUIDLow())).event1;
if (objectEvent >= BG_SA_GRY_MAX) // not a node
return;
BG_SA_Events gyd = BG_SA_Events(objectEvent);
TeamIndex teamIndex = GetTeamIndex(source->GetTeam());
//make the new banner not capturable by defenders
m_Gyd[gyd] = BG_SA_GRAVE_STATUS_OCCUPIED + teamIndex;
// create new occupied banner
_CreateBanner(gyd, (GetDefender() == ALLIANCE ? BG_SA_GRAVE_STATUS_HORDE_OCCUPIED : BG_SA_GRAVE_STATUS_ALLY_OCCUPIED), teamIndex, true);
// make the new occupied banner not clickable by anyone
MakeInteractive(gyd, (GetDefender() == ALLIANCE) ? BG_SA_GRAVE_STATUS_HORDE_OCCUPIED : BG_SA_GRAVE_STATUS_ALLY_OCCUPIED, false);
_GydOccupied(gyd, (teamIndex == 0) ? ALLIANCE : HORDE);
RewardHonorToTeam(85, (teamIndex == 0) ? ALLIANCE : HORDE);
RewardXpToTeam(0, 0.6f, (teamIndex == 0) ? ALLIANCE : HORDE);
if (teamIndex == TEAM_INDEX_ALLIANCE)
{
SendWarningToAllSA(gyd, ALLIANCE);
PlaySoundToAll(BG_SA_SOUND_GYD_CAPTURED_ALLIANCE);
}
else
{
SendWarningToAllSA(gyd, HORDE);
PlaySoundToAll(BG_SA_SOUND_GYD_CAPTURED_HORDE);
}
switch(gyd)
{
// east base
case SA_EVENT_ADD_GRAVE_E:
SpawnEvent(SA_EVENT_ADD_VECH_E, 0, true);
SpawnEvent(SA_EVENT_ADD_BOMB_E, (GetDefender() == ALLIANCE) ? BG_SA_GRAVE_STATUS_HORDE_OCCUPIED : BG_SA_GRAVE_STATUS_ALLY_OCCUPIED, true);
break;
// west base
case SA_EVENT_ADD_GRAVE_W:
SpawnEvent(SA_EVENT_ADD_VECH_W, 0, true);
SpawnEvent(SA_EVENT_ADD_BOMB_W, (GetDefender() == ALLIANCE) ? BG_SA_GRAVE_STATUS_HORDE_OCCUPIED : BG_SA_GRAVE_STATUS_ALLY_OCCUPIED, true);
break;
// central base
case SA_EVENT_ADD_GRAVE_C:
SpawnEvent(SA_EVENT_ADD_BOMB_C, (GetDefender() == ALLIANCE) ? BG_SA_GRAVE_STATUS_HORDE_OCCUPIED : BG_SA_GRAVE_STATUS_ALLY_OCCUPIED, true);
break;
default:
break;
}
}
开发者ID:Sar777,项目名称:mangos,代码行数:54,代码来源:BattleGroundSA.cpp
示例13: GetTeamIndex
void BattleGroundEY::AddPoints(Team team, uint32 points)
{
TeamIndex team_index = GetTeamIndex(team);
m_TeamScores[team_index] += points;
m_honorScoreTicks[team_index] += points;
if (m_honorScoreTicks[team_index] >= m_honorTicks)
{
RewardHonorToTeam(GetBonusHonorFromKill(1), team);
m_honorScoreTicks[team_index] -= m_honorTicks;
}
}
开发者ID:Sar777,项目名称:mangos,代码行数:11,代码来源:BattleGroundEY.cpp
示例14: OnShieldEndOverlap
void ARealmEnablerShield::OnShieldEndOverlap(AActor* otherActor, UPrimitiveComponent* otherComp, int32 otherBodyInd)
{
//dont run on clients
if (Role < ROLE_Authority)
return;
//remove the debuff from any enemies that entered the shield
AGameCharacter* gc = Cast<AGameCharacter>(otherActor);
if (IsValid(gc) && gc->IsAlive() && gc->GetTeamIndex() != GetTeamIndex())
gc->EndEffect("enablershieldaura");
}
开发者ID:MatrIsCool,项目名称:Mythos-Realm,代码行数:11,代码来源:RealmEnablerShield.cpp
示例15: GetGuildOpponent
DWORD CWarMap::GetGuildOpponent(LPCHARACTER ch)
{
if (ch->GetGuild())
{
DWORD gid = ch->GetGuild()->GetID();
BYTE idx;
if (GetTeamIndex(gid, idx))
return m_TeamData[!idx].dwID;
}
return 0;
}
开发者ID:adi97ida,项目名称:Server,代码行数:12,代码来源:war_map.cpp
示例16: _NodeOccupied
void BattleGroundAB::_NodeOccupied(uint8 node, Team team)
{
uint8 capturedNodes = 0;
for (uint8 i = 0; i < BG_AB_NODES_MAX; ++i)
{
if (m_Nodes[node] == GetTeamIndex(team) + BG_AB_NODE_TYPE_OCCUPIED && !m_NodeTimers[i])
++capturedNodes;
}
if (capturedNodes >= 5)
CastSpellOnTeam(SPELL_AB_QUEST_REWARD_5_BASES, team);
if (capturedNodes >= 4)
CastSpellOnTeam(SPELL_AB_QUEST_REWARD_4_BASES, team);
}
开发者ID:Jojo2323,项目名称:mangos3,代码行数:13,代码来源:BattleGroundAB.cpp
示例17: OnSeePawn
void ATurret::OnSeePawn(APawn* OtherActor)
{
AGameCharacter* gc = Cast<AGameCharacter>(OtherActor);
if (gc && (!gc->IsAlive() || gc->GetTeamIndex() == GetTeamIndex()))
return;
if (!currentTarget && IsValid(gc))
{
SetCurrentTarget(gc);
StartAutoAttack();
}
}
开发者ID:ericliuchina,项目名称:Mythos-Realm,代码行数:13,代码来源:RealmTurret.cpp
示例18: UpdateTeamScore
void BattleGroundEY::UpdateTeamScore(Team team)
{
uint32 score = m_TeamScores[GetTeamIndex(team)];
if (score >= EY_MAX_TEAM_SCORE)
{
score = EY_MAX_TEAM_SCORE;
EndBattleGround(team);
}
if (team == ALLIANCE)
UpdateWorldState(WORLD_STATE_EY_RESOURCES_ALLIANCE, score);
else
UpdateWorldState(WORLD_STATE_EY_RESOURCES_HORDE, score);
}
开发者ID:Sar777,项目名称:mangos,代码行数:15,代码来源:BattleGroundEY.cpp
示例19: SendScorePacket
void CWarMap::UpdateScore(DWORD g1, int score1, DWORD g2, int score2)
{
BYTE idx;
if (GetTeamIndex(g1, idx))
{
if (m_TeamData[idx].iScore != score1)
{
m_TeamData[idx].iScore = score1;
SendScorePacket(idx);
}
}
if (GetTeamIndex(g2, idx))
{
if (m_TeamData[idx].iScore != score2)
{
m_TeamData[idx].iScore = score2;
SendScorePacket(idx);
}
}
CheckScore();
}
开发者ID:adi97ida,项目名称:Server,代码行数:24,代码来源:war_map.cpp
示例20: MANGOS_ASSERT
void BattleGroundAV::EventPlayerDefendsPoint(Player* player, BG_AV_Nodes node)
{
MANGOS_ASSERT(GetStatus() == STATUS_IN_PROGRESS);
TeamIndex teamIdx = GetTeamIndex(player->GetTeam());
if (m_Nodes[node].Owner == TeamIndex(teamIdx) || m_Nodes[node].State != POINT_ASSAULTED)
return;
if (m_Nodes[node].TotalOwner == TEAM_INDEX_NEUTRAL) // initial snowfall capture
{
// until snowfall doesn't belong to anyone it is better handled in assault - code (best would be to have a special function
// for neutral nodes.. but doing this just for snowfall will be a bit to much i think
MANGOS_ASSERT(node == BG_AV_NODES_SNOWFALL_GRAVE); // currently the only neutral grave
EventPlayerAssaultsPoint(player, node);
return;
}
DEBUG_LOG("BattleGroundAV: player defends node: %i", node);
if (m_Nodes[node].PrevOwner != TeamIndex(teamIdx))
{
sLog.outError("BattleGroundAV: player defends point which doesn't belong to his team %i", node);
return;
}
DefendNode(node, teamIdx); // set the right variables for nodeinfo
PopulateNode(node); // spawn node-creatures (defender for example)
UpdateNodeWorldState(node); // send new mapicon to the player
if (IsTower(node))
{
SendYell2ToAll(LANG_BG_AV_TOWER_DEFENDED, LANG_UNIVERSAL, GetSingleCreatureGuid(BG_AV_HERALD, 0),
GetNodeName(node),
(teamIdx == TEAM_INDEX_ALLIANCE) ? LANG_BG_ALLY : LANG_BG_HORDE);
UpdatePlayerScore(player, SCORE_TOWERS_DEFENDED, 1);
PlaySoundToAll(BG_AV_SOUND_BOTH_TOWER_DEFEND);
}
else
{
SendYell2ToAll(LANG_BG_AV_GRAVE_DEFENDED, LANG_UNIVERSAL, GetSingleCreatureGuid(BG_AV_HERALD, 0),
GetNodeName(node),
(teamIdx == TEAM_INDEX_ALLIANCE) ? LANG_BG_ALLY : LANG_BG_HORDE);
UpdatePlayerScore(player, SCORE_GRAVEYARDS_DEFENDED, 1);
player->UpdateAchievementCriteria(ACHIEVEMENT_CRITERIA_TYPE_BG_OBJECTIVE_CAPTURE, 1, 65);
// update the statistic for the defending player
PlaySoundToAll((teamIdx == TEAM_INDEX_ALLIANCE) ? BG_AV_SOUND_ALLIANCE_GOOD : BG_AV_SOUND_HORDE_GOOD);
}
}
开发者ID:wuzhupc,项目名称:mangos,代码行数:48,代码来源:BattleGroundAV.cpp
注:本文中的GetTeamIndex函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论