bool BattleGroundAV::PlayerCanDoMineQuest(int32 GOId, Team team) { if (GOId == BG_AV_OBJECTID_MINE_N) return (m_Mine_Owner[BG_AV_NORTH_MINE] == GetTeamIndex(team)); if (GOId == BG_AV_OBJECTID_MINE_S) return (m_Mine_Owner[BG_AV_SOUTH_MINE] == GetTeamIndex(team)); return true; // cause it's no mine'object it is ok if this is true }
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); } }
void BattleGroundAV::HandleKillUnit(Creature *creature, Player *killer) { DEBUG_LOG("BattleGroundAV: HandleKillUnit %i", creature->GetEntry()); if (GetStatus() != STATUS_IN_PROGRESS) return; uint8 event1 = (sBattleGroundMgr.GetCreatureEventIndex(creature->GetGUIDLow())).event1; if (event1 == BG_EVENT_NONE) return; switch(event1) { case BG_AV_BOSS_A: CastSpellOnTeam(BG_AV_BOSS_KILL_QUEST_SPELL, HORDE); // this is a spell which finishes a quest where a player has to kill the boss RewardReputationToTeam(BG_AV_FACTION_H, m_RepBoss, HORDE); RewardHonorToTeam(GetBonusHonorFromKill(BG_AV_KILL_BOSS), HORDE); SendYellToAll(LANG_BG_AV_A_GENERAL_DEAD, LANG_UNIVERSAL, GetSingleCreatureGuid(BG_AV_HERALD, 0)); EndBattleGround(HORDE); break; case BG_AV_BOSS_H: CastSpellOnTeam(BG_AV_BOSS_KILL_QUEST_SPELL, ALLIANCE); // this is a spell which finishes a quest where a player has to kill the boss RewardReputationToTeam(BG_AV_FACTION_A, m_RepBoss, ALLIANCE); RewardHonorToTeam(GetBonusHonorFromKill(BG_AV_KILL_BOSS), ALLIANCE); SendYellToAll(LANG_BG_AV_H_GENERAL_DEAD, LANG_UNIVERSAL, GetSingleCreatureGuid(BG_AV_HERALD, 0)); EndBattleGround(ALLIANCE); break; case BG_AV_CAPTAIN_A: if (IsActiveEvent(BG_AV_NodeEventCaptainDead_A, 0)) return; RewardReputationToTeam(BG_AV_FACTION_H, m_RepCaptain, HORDE); RewardHonorToTeam(GetBonusHonorFromKill(BG_AV_KILL_CAPTAIN), HORDE); RewardXpToTeam(0, 0.91f, HORDE); UpdateScore(TEAM_INDEX_ALLIANCE, (-1) * BG_AV_RES_CAPTAIN); // spawn destroyed aura SpawnEvent(BG_AV_NodeEventCaptainDead_A, 0, true); break; case BG_AV_CAPTAIN_H: if (IsActiveEvent(BG_AV_NodeEventCaptainDead_H, 0)) return; RewardReputationToTeam(BG_AV_FACTION_A, m_RepCaptain, ALLIANCE); RewardHonorToTeam(GetBonusHonorFromKill(BG_AV_KILL_CAPTAIN), ALLIANCE); RewardXpToTeam(0, 0.91f, ALLIANCE); UpdateScore(TEAM_INDEX_HORDE, (-1) * BG_AV_RES_CAPTAIN); // spawn destroyed aura SpawnEvent(BG_AV_NodeEventCaptainDead_H, 0, true); break; case BG_AV_MINE_BOSSES_NORTH: ChangeMineOwner(BG_AV_NORTH_MINE, GetTeamIndex(killer->GetTeam())); break; case BG_AV_MINE_BOSSES_SOUTH: ChangeMineOwner(BG_AV_SOUTH_MINE, GetTeamIndex(killer->GetTeam())); break; } }
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; } }
void BattleGroundAV::EventPlayerAssaultsPoint(Player* player, BG_AV_Nodes node) { // TODO implement quest 7101, 7081 TeamIndex teamIdx = GetTeamIndex(player->GetTeam()); DEBUG_LOG("BattleGroundAV: player assaults node %i", node); if (m_Nodes[node].Owner == TeamIndex(teamIdx) || TeamIndex(teamIdx) == m_Nodes[node].TotalOwner) return; AssaultNode(node, teamIdx); // update nodeinfo variables UpdateNodeWorldState(node); // send mapicon PopulateNode(node); if (IsTower(node)) { SendYell2ToAll(LANG_BG_AV_TOWER_ASSAULTED, LANG_UNIVERSAL, GetSingleCreatureGuid(BG_AV_HERALD, 0), GetNodeName(node), ( teamIdx == TEAM_INDEX_ALLIANCE ) ? LANG_BG_ALLY:LANG_BG_HORDE); UpdatePlayerScore(player, SCORE_TOWERS_ASSAULTED, 1); } else { SendYell2ToAll(LANG_BG_AV_GRAVE_ASSAULTED, LANG_UNIVERSAL, GetSingleCreatureGuid(BG_AV_HERALD, 0), GetNodeName(node), ( teamIdx == TEAM_INDEX_ALLIANCE ) ? LANG_BG_ALLY:LANG_BG_HORDE); // update the statistic for the assaulting player UpdatePlayerScore(player, SCORE_GRAVEYARDS_ASSAULTED, 1); } PlaySoundToAll((teamIdx == TEAM_INDEX_ALLIANCE) ? BG_AV_SOUND_ALLIANCE_ASSAULTS : BG_AV_SOUND_HORDE_ASSAULTS); }
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; }
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]; }
WorldSafeLocsEntry const* BattleGroundAV::GetClosestGraveYard(Player *plr) { float x = plr->GetPositionX(); float y = plr->GetPositionY(); TeamIndex teamIdx = GetTeamIndex(plr->GetTeam()); WorldSafeLocsEntry const* good_entry = NULL; if (GetStatus() == STATUS_IN_PROGRESS) { // Is there any occupied node for this team? float mindist = 9999999.0f; for (uint8 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) continue; WorldSafeLocsEntry const * entry = sWorldSafeLocsStore.LookupEntry( BG_AV_GraveyardIds[i] ); if (!entry) continue; float dist = (entry->x - x) * (entry->x - x) + (entry->y - y) * (entry->y - y); if (mindist > dist) { mindist = dist; good_entry = entry; } } } // If not, place ghost in the starting-cave if (!good_entry) good_entry = sWorldSafeLocsStore.LookupEntry( BG_AV_GraveyardIds[teamIdx + 7] ); return good_entry; }
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; }
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); } } }
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; }
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; }
void BattleGroundAV::HandleKillPlayer(Player *player, Player *killer) { if (GetStatus() != STATUS_IN_PROGRESS) return; BattleGround::HandleKillPlayer(player, killer); UpdateScore(GetTeamIndex(player->GetTeam()), -1); }
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(); }
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); }
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; }
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; } }
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; } }
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"); }
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; }
void CWarMap::DecMember(LPCHARACTER ch) { if (!ch->IsPC()) return; sys_log(0, "WarMap::DecMember"); DWORD gid = 0; if (ch->GetGuild()) gid = ch->GetGuild()->GetID(); if (!ch->IsObserverMode()) { if (gid == m_TeamData[0].dwID) m_TeamData[0].RemoveMember(ch); else if (gid == m_TeamData[1].dwID) m_TeamData[1].RemoveMember(ch); if (m_kMapInfo.bType == WAR_MAP_TYPE_FLAG) { CAffect * pkAff = ch->FindAffect(AFFECT_WAR_FLAG); if (pkAff) { BYTE idx; if (GetTeamIndex(pkAff->lApplyValue, idx)) AddFlag(idx, ch->GetX(), ch->GetY()); ch->RemoveAffect(AFFECT_WAR_FLAG); } } sys_log(0, "WarMap -m %u(cur:%d, acc:%d) vs %u(cur:%d, acc:%d)", m_TeamData[0].dwID, m_TeamData[0].GetCurJointerCount(), m_TeamData[0].GetAccumulatedJoinerCount(), m_TeamData[1].dwID, m_TeamData[1].GetCurJointerCount(), m_TeamData[1].GetAccumulatedJoinerCount()); CheckWarEnd(); ch->SetQuestFlag("war.is_war_member", 0); } else { --m_iObserverCount; sys_log(0, "WarMap -o %d", m_iObserverCount); ch->SetObserverMode(false); } UpdateUserCount(); m_set_pkChr.erase(ch); }
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); }
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(); } }
void BattleGroundSA::SendMessageSA(Player *player, uint32 type, uint32 name) { uint32 entryMSG = 0; TeamIndex teamIndex = GetTeamIndex(player->GetTeam()); switch (type) { case 0: entryMSG = LANG_BG_SA_GATE_ATTACK; break; case 1: entryMSG = LANG_BG_SA_GATE_DAMAGE; break; case 2: entryMSG = LANG_BG_SA_GATE_DETROYED; break; } if (teamIndex == TEAM_INDEX_ALLIANCE) SendMessage2ToAll(entryMSG,CHAT_MSG_BG_SYSTEM_ALLIANCE, player, name); else SendMessage2ToAll(entryMSG,CHAT_MSG_BG_SYSTEM_HORDE, player, name); }
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); }
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(); }
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); } }
void ARealmEnablerShield::OnShieldBeginOverlap(AActor* otherActor, UPrimitiveComponent* otherComp, int32 otherBodyInd, bool bFromSweep, const FHitResult& sweepResult) { //dont run on clients if (Role < ROLE_Authority) return; //debuff any enemies that enter the shield AGameCharacter* gc = Cast<AGameCharacter>(otherActor); if (IsValid(gc) && gc->IsAlive() && gc->GetTeamIndex() != GetTeamIndex()) { TArray<float> stats; TArray<TEnumAsByte<EStat> > statTypes; //cut the units defenses in half stats.Add(gc->GetCurrentValueForStat(EStat::ES_Def) / -2.f); stats.Add(gc->GetCurrentValueForStat(EStat::ES_SpDef) / -2.f); statTypes.Add(EStat::ES_Def); statTypes.Add(EStat::ES_SpDef); gc->AddEffect(LOCTEXT("enablershieldname", "Interference Signal"), LOCTEXT("enablershielddesc", "This unit is in the shield radius of an enemy Enabler Shield. Its Defense and Special Defense are greatly reduced."), statTypes, stats, 0.f, "enablershieldaura"); } }
WorldSafeLocsEntry const* BattleGroundIC::GetClosestGraveYard(Player* player) { TeamIndex teamIndex = GetTeamIndex(player->GetTeam()); // Is there any occupied node for this team? std::vector<uint8> nodes; for (uint8 i = 0; i < BG_IC_NODES_MAX; ++i) if (m_Nodes[i] == teamIndex + 3) nodes.push_back(i); 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( BG_IC_GraveyardIds[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( BG_IC_GraveyardIds[teamIndex+5] ); return good_entry; }
void BattleGroundWS::EventPlayerDroppedFlag(Player* source) { if (GetStatus() != STATUS_IN_PROGRESS) { // if not running, do not cast things at the dropper player (prevent spawning the "dropped" flag), neither send unnecessary messages // just take off the aura if (source->GetTeam() == ALLIANCE) { if (!IsHordeFlagPickedUp()) return; if (GetHordeFlagCarrierGuid() == source->GetObjectGuid()) { ClearHordeFlagCarrier(); source->RemoveAurasDueToSpell(BG_WS_SPELL_WARSONG_FLAG); } } else { if (!IsAllianceFlagPickedUp()) return; if (GetAllianceFlagCarrierGuid() == source->GetObjectGuid()) { ClearAllianceFlagCarrier(); source->RemoveAurasDueToSpell(BG_WS_SPELL_SILVERWING_FLAG); } } return; } bool set = false; if (source->GetTeam() == ALLIANCE) { if (!IsHordeFlagPickedUp()) return; if (GetHordeFlagCarrierGuid() == source->GetObjectGuid()) { ClearHordeFlagCarrier(); source->RemoveAurasDueToSpell(BG_WS_SPELL_WARSONG_FLAG); m_FlagState[TEAM_INDEX_HORDE] = BG_WS_FLAG_STATE_ON_GROUND; source->CastSpell(source, BG_WS_SPELL_WARSONG_FLAG_DROPPED, true); set = true; } } else { if (!IsAllianceFlagPickedUp()) return; if (GetAllianceFlagCarrierGuid() == source->GetObjectGuid()) { ClearAllianceFlagCarrier(); source->RemoveAurasDueToSpell(BG_WS_SPELL_SILVERWING_FLAG); m_FlagState[TEAM_INDEX_ALLIANCE] = BG_WS_FLAG_STATE_ON_GROUND; source->CastSpell(source, BG_WS_SPELL_SILVERWING_FLAG_DROPPED, true); set = true; } } if (set) { UpdateFlagState(source->GetTeam(), 1); if (source->GetTeam() == ALLIANCE) { SendMessageToAll(LANG_BG_WS_DROPPED_HF, CHAT_MSG_BG_SYSTEM_HORDE, source); UpdateWorldState(BG_WS_FLAG_UNK_HORDE, uint32(-1)); } else { SendMessageToAll(LANG_BG_WS_DROPPED_AF, CHAT_MSG_BG_SYSTEM_ALLIANCE, source); UpdateWorldState(BG_WS_FLAG_UNK_ALLIANCE, uint32(-1)); } m_FlagsDropTimer[GetOtherTeamIndex(GetTeamIndex(source->GetTeam()))] = BG_WS_FLAG_DROP_TIME; } }