diff options
-rw-r--r-- | src/game/Wintergrasp.cpp | 119 | ||||
-rw-r--r-- | src/game/Wintergrasp.h | 5 | ||||
-rw-r--r-- | src/game/World.cpp | 18 | ||||
-rw-r--r-- | src/game/World.h | 2 | ||||
-rw-r--r-- | src/trinitycore/trinitycore.conf.dist | 30 |
5 files changed, 122 insertions, 52 deletions
diff --git a/src/game/Wintergrasp.cpp b/src/game/Wintergrasp.cpp index 42f5e6f4e2f..37ff0f6607f 100644 --- a/src/game/Wintergrasp.cpp +++ b/src/game/Wintergrasp.cpp @@ -84,6 +84,7 @@ bool OPvPWintergrasp::SetupOutdoorPvP() m_workshopCount[TEAM_ALLIANCE] = 0; m_workshopCount[TEAM_HORDE] = 0; m_towerCount = 3; + m_towerDamagedCount = 0; // Select POI AreaPOIList areaPOIs; @@ -321,16 +322,7 @@ void OPvPWintergrasp::ProcessEvent(GameObject *obj, uint32 eventId) state->damageState = DAMAGE_DAMAGED; if (state->type == BUILDING_TOWER) - { - if (sWorld.getConfig(CONFIG_OUTDOORPVP_WINTERGRASP_CUSTOM_HONOR)) - { - for (PlayerSet::const_iterator itr = m_players[m_defender].begin(); itr != m_players[m_defender].end(); ++itr) - if ((*itr)->HasAura(SPELL_LIEUTENANT) && ((*itr)->getLevel() > 69)) - (*itr)->ModifyHonorPoints(m_customHonorReward[DAMAGED_TOWER]); - } - else - LieutenantCastSpell(m_defender, SPELL_DAMAGED_TOWER); - } + ++m_towerDamagedCount; } else if (eventId == obj->GetGOInfo()->building.destroyedEvent) { @@ -339,20 +331,13 @@ void OPvPWintergrasp::ProcessEvent(GameObject *obj, uint32 eventId) if (state->type == BUILDING_WORKSHOP) ModifyWorkshopCount(state->GetTeam(), false); else if (state->type == BUILDING_TOWER) - { if (!m_towerCount) sLog.outError("OPvPWintergrasp::ProcessEvent: negative tower count!"); else { --m_towerCount; - if (sWorld.getConfig(CONFIG_OUTDOORPVP_WINTERGRASP_CUSTOM_HONOR)) - for (PlayerSet::const_iterator itr = m_players[m_defender].begin(); itr != m_players[m_defender].end(); ++itr) - if ((*itr)->HasAura(SPELL_LIEUTENANT) && ((*itr)->getLevel() > 69)) - (*itr)->ModifyHonorPoints(m_customHonorReward[DESTROYED_TOWER]); - else - LieutenantCastSpell(m_defender, SPELL_DESTROYED_TOWER); + --m_towerDamagedCount; } - } } BroadcastStateChange(state); } @@ -493,7 +478,9 @@ void OPvPWintergrasp::OnCreatureCreate(Creature *creature, bool add) } break; case CREATURE_TURRET: - creature->setFaction(WintergraspFaction[m_defender]); + if (add) m_turrets.insert(creature); + else m_turrets.erase(creature); + UpdateCreatureInfo(creature); break; default: if (m_creEntryPair.find(entry) != m_creEntryPair.end()) // guards and npc @@ -542,6 +529,8 @@ void OPvPWintergrasp::UpdateAllWorldObject() UpdateGameObjectInfo(*itr); for (CreatureSet::iterator itr = m_creatures.begin(); itr != m_creatures.end(); ++itr) UpdateCreatureInfo(*itr); + for (CreatureSet::iterator itr = m_turrets.begin(); itr != m_turrets.end(); ++itr) + UpdateCreatureInfo(*itr); // rebuild and update building states RebuildAllBuildings(); @@ -615,14 +604,24 @@ void OPvPWintergrasp::BroadcastStateChange(BuildingState *state) const state->SendUpdate(*p_itr); } +// Called at Start and Battle End bool OPvPWintergrasp::UpdateCreatureInfo(Creature *creature) const { if (GetCreatureType(creature->GetEntry()) == CREATURE_TURRET) { if (!creature->isAlive()) - creature->Respawn(true); - creature->setFaction(WintergraspFaction[m_defender]); - return true; + creature->Respawn(true); + if (m_wartime) + { + creature->SetVisibility(VISIBILITY_ON); + creature->setFaction(WintergraspFaction[m_defender]); + } + else + { + creature->SetVisibility(VISIBILITY_OFF); + creature->setFaction(35); + } + return false; } TeamPairMap::const_iterator itr = m_creEntryPair.find(creature->GetCreatureData()->id); @@ -953,25 +952,42 @@ void OPvPWintergrasp::EndBattle() veh->setDeathState(JUST_DIED); } + if (m_players[team].empty()) + continue; + // calculate rewards uint32 intactNum = 0; uint32 damagedNum = 0; for (OutdoorPvP::OPvPCapturePointMap::const_iterator itr = m_capturePoints.begin(); itr != m_capturePoints.end(); ++itr) - { if (SiegeWorkshop *workshop = dynamic_cast<SiegeWorkshop*>(itr->second)) if (workshop->m_buildingState->GetTeam() == team) if (workshop->m_buildingState->damageState == DAMAGE_DAMAGED) ++damagedNum; else if (workshop->m_buildingState->damageState == DAMAGE_INTACT) ++intactNum; - } - // give rewards - uint32 honor = ( team == m_defender ? m_customHonorReward[WIN_BATTLE] : m_customHonorReward[LOSE_BATTLE] ); - for (uint32 i = 0; i < intactNum; ++i) - honor += m_customHonorReward[INTACT_BUILDING]; - for (uint32 i = 0; i < damagedNum; ++i) - honor += m_customHonorReward[DAMAGED_BUILDING]; + uint32 spellRewardId = (team == m_defender) ? SPELL_VICTORY_REWARD : SPELL_DEFEAT_REWARD; + int32 honor; + uint32 marks; + + if (sWorld.getConfig(CONFIG_OUTDOORPVP_WINTERGRASP_CUSTOM_HONOR)) + { + if (team == m_defender) + { + honor = m_customHonorReward[WIN_BATTLE]; + marks = m_customHonorReward[WIN_BATTLE_MARKS]; + honor += (m_customHonorReward[DAMAGED_TOWER] * m_towerDamagedCount); + honor += (m_customHonorReward[DESTROYED_TOWER] * (3 - m_towerCount)); + } + else + { + honor = m_customHonorReward[LOSE_BATTLE]; + marks = m_customHonorReward[LOSE_BATTLE_MARKS];; + } + honor += (m_customHonorReward[INTACT_BUILDING] * intactNum); + honor += (m_customHonorReward[DAMAGED_BUILDING] * damagedNum); + honor = int32(honor / m_players[team].size()); + } for (PlayerSet::iterator itr = m_players[team].begin(); itr != m_players[team].end(); ++itr) { @@ -981,18 +997,31 @@ void OPvPWintergrasp::EndBattle() (*itr)->ResurrectPlayer(1.0f); ObjectAccessor::Instance().ConvertCorpseForPlayer((*itr)->GetGUID()); } - if ((*itr)->HasAura(SPELL_LIEUTENANT)) + + // give rewards + if ((*itr)->HasAura(SPELL_LIEUTENANT) && (*itr)->getLevel() > 69) { if (!sWorld.getConfig(CONFIG_OUTDOORPVP_WINTERGRASP_CUSTOM_HONOR)) { - (*itr)->CastSpell(*itr, team == m_defender ? SPELL_VICTORY_REWARD : SPELL_DEFEAT_REWARD, true); + (*itr)->CastSpell(*itr, spellRewardId, true); for (uint32 i = 0; i < intactNum; ++i) (*itr)->CastSpell(*itr, SPELL_INTACT_BUILDING, true); for (uint32 i = 0; i < damagedNum; ++i) (*itr)->CastSpell(*itr, SPELL_DAMAGED_BUILDING, true); + if (team == m_defender) + { + for (uint32 i = 0; i < m_towerDamagedCount; ++i) + (*itr)->CastSpell(*itr, SPELL_DAMAGED_TOWER, true); + for (uint32 i = 3; i > m_towerCount; --i) + (*itr)->CastSpell(*itr, SPELL_DESTROYED_TOWER, true); + } } - else if (sWorld.getConfig(CONFIG_OUTDOORPVP_WINTERGRASP_CUSTOM_HONOR)) + else + { (*itr)->ModifyHonorPoints(honor); + (*itr)->GetAchievementMgr().UpdateAchievementCriteria(ACHIEVEMENT_CRITERIA_TYPE_BE_SPELL_TARGET, spellRewardId); + RewardMarkOfHonor(*itr, marks); + } } REMOVE_WARTIME_AURAS(*itr); REMOVE_TENACITY_AURA(*itr); @@ -1031,6 +1060,30 @@ uint32 OPvPWintergrasp::GetData(uint32 id) return 0; } +void OPvPWintergrasp::RewardMarkOfHonor(Player *plr, uint32 count) +{ + // 'Inactive' this aura prevents the player from gaining honor points and battleground tokens + if (plr->HasAura(SPELL_AURA_PLAYER_INACTIVE)) + return; + + ItemPosCountVec dest; + uint32 no_space_count = 0; + uint8 msg = plr->CanStoreNewItem(NULL_BAG, NULL_SLOT, dest, WG_MARK_OF_HONOR, count, &no_space_count); + + if (msg == EQUIP_ERR_ITEM_NOT_FOUND) + { + sLog.outErrorDb("Wintergrasp reward item (Entry %u) not exist in `item_template`.", WG_MARK_OF_HONOR); + return; + } + + if (msg != EQUIP_ERR_OK) // convert to possible store amount + count -= no_space_count; + + if (count != 0 && !dest.empty()) // can add some + if (Item* item = plr->StoreNewItem(dest, WG_MARK_OF_HONOR, true, 0)) + plr->SendNewItem(item, count, true, false); +} + SiegeWorkshop *OPvPWintergrasp::GetWorkshop(uint32 lowguid) const { if (OPvPCapturePoint *cp = GetCapturePoint(lowguid)) diff --git a/src/game/Wintergrasp.h b/src/game/Wintergrasp.h index 1f73127f0c3..33f7f546811 100644 --- a/src/game/Wintergrasp.h +++ b/src/game/Wintergrasp.h @@ -63,6 +63,8 @@ enum WintergraspRewardEvent DESTROYED_TOWER, DAMAGED_BUILDING, INTACT_BUILDING, + WIN_BATTLE_MARKS, + LOSE_BATTLE_MARKS, WG_REWARD_EVENT_MAX }; @@ -204,6 +206,7 @@ class OPvPWintergrasp : public OutdoorPvP BuildingState *m_gate; CreatureSet m_creatures; + CreatureSet m_turrets; CreatureSet m_vehicles[2]; GameObjectSet m_gobjects; @@ -215,6 +218,7 @@ class OPvPWintergrasp : public OutdoorPvP uint32 m_clock[5]; uint32 m_workshopCount[2]; uint32 m_towerCount; + uint32 m_towerDamagedCount; uint32 m_customHonorReward[WG_REWARD_EVENT_MAX]; SiegeWorkshop *GetWorkshop(uint32 lowguid) const; @@ -243,6 +247,7 @@ class OPvPWintergrasp : public OutdoorPvP void SendInitWorldStatesTo(Player *player = NULL) const; void RemoveOfflinePlayerWGAuras(); + void RewardMarkOfHonor(Player *player, uint32 count); }; class SiegeWorkshop : public OPvPCapturePoint diff --git a/src/game/World.cpp b/src/game/World.cpp index 706400652b0..f3f409b3173 100644 --- a/src/game/World.cpp +++ b/src/game/World.cpp @@ -1168,19 +1168,21 @@ void World::LoadConfigSettings(bool reload) m_configs[CONFIG_PVP_TOKEN_COUNT] = sConfig.GetIntDefault("PvPToken.ItemCount", 1); if (m_configs[CONFIG_PVP_TOKEN_COUNT] < 1) m_configs[CONFIG_PVP_TOKEN_COUNT] = 1; - + m_configs[CONFIG_OUTDOORPVP_WINTERGRASP_ENABLED] = sConfig.GetBoolDefault("OutdoorPvP.Wintergrasp.Enabled", true); m_configs[CONFIG_OUTDOORPVP_WINTERGRASP_START_TIME] = sConfig.GetIntDefault("OutdoorPvP.Wintergrasp.StartTime", 30); m_configs[CONFIG_OUTDOORPVP_WINTERGRASP_BATTLE_TIME] = sConfig.GetIntDefault("OutdoorPvP.Wintergrasp.BattleTime", 30); m_configs[CONFIG_OUTDOORPVP_WINTERGRASP_INTERVAL] = sConfig.GetIntDefault("OutdoorPvP.Wintergrasp.Interval", 150); m_configs[CONFIG_OUTDOORPVP_WINTERGRASP_CUSTOM_HONOR] = sConfig.GetBoolDefault("OutdoorPvP.Wintergrasp.CustomHonorRewards", false); - m_configs[CONFIG_OUTDOORPVP_WINTERGRASP_CUSTOM_HONOR_0] = sConfig.GetIntDefault("OutdoorPvP.Wintergrasp.CustomHonorBattleWin", 0); - m_configs[CONFIG_OUTDOORPVP_WINTERGRASP_CUSTOM_HONOR_1] = sConfig.GetIntDefault("OutdoorPvP.Wintergrasp.CustomHonorBattleLose", 0); - m_configs[CONFIG_OUTDOORPVP_WINTERGRASP_CUSTOM_HONOR_2] = sConfig.GetIntDefault("OutdoorPvP.Wintergrasp.CustomHonorDamageTower", 0); - m_configs[CONFIG_OUTDOORPVP_WINTERGRASP_CUSTOM_HONOR_3] = sConfig.GetIntDefault("OutdoorPvP.Wintergrasp.CustomHonorDestroyedTower", 0); - m_configs[CONFIG_OUTDOORPVP_WINTERGRASP_CUSTOM_HONOR_4] = sConfig.GetIntDefault("OutdoorPvP.Wintergrasp.CustomHonorDamagedBuilding", 0); - m_configs[CONFIG_OUTDOORPVP_WINTERGRASP_CUSTOM_HONOR_5] = sConfig.GetIntDefault("OutdoorPvP.Wintergrasp.CustomHonorIntactBuilding", 0); - + m_configs[CONFIG_OUTDOORPVP_WINTERGRASP_CUSTOM_HONOR_0] = sConfig.GetIntDefault("OutdoorPvP.Wintergrasp.CustomHonorBattleWin", 3000); + m_configs[CONFIG_OUTDOORPVP_WINTERGRASP_CUSTOM_HONOR_1] = sConfig.GetIntDefault("OutdoorPvP.Wintergrasp.CustomHonorBattleLose", 1250); + m_configs[CONFIG_OUTDOORPVP_WINTERGRASP_CUSTOM_HONOR_2] = sConfig.GetIntDefault("OutdoorPvP.Wintergrasp.CustomHonorDamageTower", 750); + m_configs[CONFIG_OUTDOORPVP_WINTERGRASP_CUSTOM_HONOR_3] = sConfig.GetIntDefault("OutdoorPvP.Wintergrasp.CustomHonorDestroyedTower", 750); + m_configs[CONFIG_OUTDOORPVP_WINTERGRASP_CUSTOM_HONOR_4] = sConfig.GetIntDefault("OutdoorPvP.Wintergrasp.CustomHonorDamagedBuilding", 750); + m_configs[CONFIG_OUTDOORPVP_WINTERGRASP_CUSTOM_HONOR_5] = sConfig.GetIntDefault("OutdoorPvP.Wintergrasp.CustomHonorIntactBuilding", 1500); + m_configs[CONFIG_OUTDOORPVP_WINTERGRASP_CUSTOM_HONOR_6] = sConfig.GetIntDefault("OutdoorPvP.Wintergrasp.CustomHonorBattleWinMarks", 3); + m_configs[CONFIG_OUTDOORPVP_WINTERGRASP_CUSTOM_HONOR_7] = sConfig.GetIntDefault("OutdoorPvP.Wintergrasp.CustomHonorBattleLoseMarks", 1); + m_configs[CONFIG_NO_RESET_TALENT_COST] = sConfig.GetBoolDefault("NoResetTalentsCost", false); m_configs[CONFIG_SHOW_KICK_IN_WORLD] = sConfig.GetBoolDefault("ShowKickInWorld", false); m_configs[CONFIG_INTERVAL_LOG_UPDATE] = sConfig.GetIntDefault("RecordUpdateTimeDiffInterval", 60000); diff --git a/src/game/World.h b/src/game/World.h index 02fd7a6cf22..6a4e79939bb 100644 --- a/src/game/World.h +++ b/src/game/World.h @@ -248,6 +248,8 @@ enum WorldConfigs CONFIG_OUTDOORPVP_WINTERGRASP_CUSTOM_HONOR_3, CONFIG_OUTDOORPVP_WINTERGRASP_CUSTOM_HONOR_4, CONFIG_OUTDOORPVP_WINTERGRASP_CUSTOM_HONOR_5, + CONFIG_OUTDOORPVP_WINTERGRASP_CUSTOM_HONOR_6, + CONFIG_OUTDOORPVP_WINTERGRASP_CUSTOM_HONOR_7, CONFIG_NO_RESET_TALENT_COST, CONFIG_SHOW_KICK_IN_WORLD, CONFIG_INTERVAL_LOG_UPDATE, diff --git a/src/trinitycore/trinitycore.conf.dist b/src/trinitycore/trinitycore.conf.dist index ebb817bd2df..04cb3ca29c2 100644 --- a/src/trinitycore/trinitycore.conf.dist +++ b/src/trinitycore/trinitycore.conf.dist @@ -1,7 +1,7 @@ ########################################## # Trinity Core worldd configuration file # ########################################## -ConfVersion=2009100601 +ConfVersion=2009101501 ################################################################################################################### # CONNECTIONS AND DIRECTORIES @@ -1922,16 +1922,22 @@ Ra.Secure = 1 # Defines the amount of honor points that should be given to the team losing the Wintergrasp Battle. Requires OutdoorPvP.Wintergrasp.CustomHonorRewards = 1. # # OutdoorPvP.Wintergrasp.CustomHonorDamageTower -# Defines the amount of honor points that should be given for damaging a tower. Requires OutdoorPvP.Wintergrasp.CustomHonorRewards = 1. +# Defines the amount of honor points that should be given to the team for damaging a tower. Requires OutdoorPvP.Wintergrasp.CustomHonorRewards = 1. # # OutdoorPvP.Wintergrasp.CustomHonorDestroyedTower -# Defines the amount of honor points that should be given for destroying a tower. Requires OutdoorPvP.Wintergrasp.CustomHonorRewards = 1. +# Defines the amount of honor points that should be given fto the team or destroying a tower. Requires OutdoorPvP.Wintergrasp.CustomHonorRewards = 1. # # OutdoorPvP.Wintergrasp.CustomHonorDamagedBuilding -# Defines the amount of honor points that should be given for damaged buildings after the battle. Requires OutdoorPvP.Wintergrasp.CustomHonorRewards = 1. +# Defines the amount of honor points that should be given to the team for damaged buildings after the battle. Requires OutdoorPvP.Wintergrasp.CustomHonorRewards = 1. # # OutdoorPvP.Wintergrasp.CustomHonorIntactBuilding -# Defines the amount of honor points that should be given for intact buildings after the battle. Requires OutdoorPvP.Wintergrasp.CustomHonorRewards = 1. +# Defines the amount of honor points that should be given to the team for intact buildings after the battle. Requires OutdoorPvP.Wintergrasp.CustomHonorRewards = 1. +# +# OutdoorPvP.Wintergrasp.CustomHonorBattleWinMarks +# Defines the amount of wintergrasp reward marks that should be given to the team winning the Wintergrasp Battle. Requires OutdoorPvP.Wintergrasp.CustomHonorRewards = 1. +# +# OutdoorPvP.Wintergrasp.CustomHonorBattleLoseMarks +# Defines the amount of wintergrasp reward marks that should be given to the team losing the Wintergrasp Battle. Requires OutdoorPvP.Wintergrasp.CustomHonorRewards = 1. # # ForbiddenMaps # map ids that users below SEC_GAMEMASTER cannot enter, with delimiter ',' @@ -1985,12 +1991,14 @@ OutdoorPvP.Wintergrasp.StartTime = 30 OutdoorPvP.Wintergrasp.BattleTime = 30 OutdoorPvP.Wintergrasp.Interval = 150 OutdoorPvP.Wintergrasp.CustomHonorRewards = 0 -OutdoorPvP.Wintergrasp.CustomHonorBattleWin = 0 -OutdoorPvP.Wintergrasp.CustomHonorBattleLose = 0 -OutdoorPvP.Wintergrasp.CustomHonorDamageTower = 0 -OutdoorPvP.Wintergrasp.CustomHonorDestroyedTower = 0 -OutdoorPvP.Wintergrasp.CustomHonorDamagedBuilding = 0 -OutdoorPvP.Wintergrasp.CustomHonorIntactBuilding = 0 +OutdoorPvP.Wintergrasp.CustomHonorBattleWin = 3000 +OutdoorPvP.Wintergrasp.CustomHonorBattleLose = 1250 +OutdoorPvP.Wintergrasp.CustomHonorDamageTower = 750 +OutdoorPvP.Wintergrasp.CustomHonorDestroyedTower = 750 +OutdoorPvP.Wintergrasp.CustomHonorDamagedBuilding = 750 +OutdoorPvP.Wintergrasp.CustomHonorIntactBuilding = 1500 +OutdoorPvP.Wintergrasp.CustomHonorBattleWinMarks = 3 +OutdoorPvP.Wintergrasp.CustomHonorBattleLoseMarks = 1 NoResetTalentsCost = 0 ShowKickInWorld = 0 RecordUpdateTimeDiffInterval = 60000 |