diff --git a/src/server/game/Chat/Chat.h b/src/server/game/Chat/Chat.h index bdb4942..b81a712 100644 --- a/src/server/game/Chat/Chat.h +++ b/src/server/game/Chat/Chat.h @@ -500,6 +500,14 @@ class ChatHandler bool HandleWintergraspSwitchTeamCommand(const char *args); bool HandleWintergraspTimerCommand(const char *args); + bool HandleWintergraspStatusCommand(const char *args); + bool HandleWintergraspStartCommand(const char *args); + bool HandleWintergraspStopCommand(const char *args); + bool HandleWintergraspEnableCommand(const char *args); + bool HandleWintergraspSwitchTeamCommand(const char *args); + bool HandleWintergraspTimerCommand(const char *args); + + bool HandleHelpCommand(const char* args); bool HandleCommandsCommand(const char* args); bool HandleStartCommand(const char* args); diff --git a/src/server/game/Miscellaneous/Language.h b/src/server/game/Miscellaneous/Language.h index 5678499..b30cd57 100644 --- a/src/server/game/Miscellaneous/Language.h +++ b/src/server/game/Miscellaneous/Language.h @@ -641,6 +641,29 @@ enum TrinityStrings LANG_BG_EY_CAPTURED_FLAG_H = 685, LANG_BG_EY_DROPPED_FLAG = 686, LANG_BG_EY_RESETED_FLAG = 687, + + LANG_BG_WG_BATTLE_STARTS = 756, + LANG_BG_WG_DEFENDED = 757, + LANG_BG_WG_CAPTURED = 758, + LANG_BG_WG_WORKSHOP_DAMAGED = 759, + LANG_BG_WG_WORKSHOP_DESTROYED = 760, + LANG_BG_WG_TOWER_DAMAGED = 761, + LANG_BG_WG_TOWER_DESTROYED = 762, + LANG_BG_WG_FORTRESS_UNDER_ATTACK = 763, + LANG_BG_WG_SWITCH_FACTION = 764, + LANG_BG_WG_CHANGE_TIMER = 765, + LANG_BG_WG_BATTLE_FORCE_START = 766, + LANG_BG_WG_BATTLE_FORCE_STOP = 767, + LANG_BG_WG_STATUS = 768, + LANG_BG_WG_DISABLE = 769, + LANG_BG_WG_ENABLE = 770, + LANG_BG_WG_RANK1 = 771, + LANG_BG_WG_RANK2 = 772, + + LANG_BG_WG_WORLD_ANNOUNCE_30 = 780, + LANG_BG_WG_WORLD_ANNOUNCE_10 = 781, + LANG_BG_WG_WORLD_NO_DEF = 782, + LANG_BG_WG_WORLD_NO_ATK = 783, LANG_BG_WG_BATTLE_STARTS = 756, LANG_BG_WG_DEFENDED = 757, diff --git a/src/server/game/Server/Protocol/Handlers/CharacterHandler.cpp b/src/server/game/Server/Protocol/Handlers/CharacterHandler.cpp index 1fbf30b..c232a3b 100644 --- a/src/server/game/Server/Protocol/Handlers/CharacterHandler.cpp +++ b/src/server/game/Server/Protocol/Handlers/CharacterHandler.cpp @@ -43,6 +43,8 @@ #include "UpdateMask.h" #include "Util.h" #include "ScriptMgr.h" +#include "OutdoorPvPWG.h" +#include "OutdoorPvPMgr.h" class LoginQueryHolder : public SqlQueryHolder { @@ -722,6 +724,20 @@ void WorldSession::HandlePlayerLogin(LoginQueryHolder * holder) sObjectAccessor.AddObject(pCurrChar); //sLog.outDebug("Player %s added to Map.",pCurrChar->GetName()); + if (OutdoorPvPWG *pvpWG = (OutdoorPvPWG*)sOutdoorPvPMgr.GetOutdoorPvPToZoneId(4197)) + { + if (pvpWG->isWarTime()) + { + // "Battle in progress" + pCurrChar->SendUpdateWorldState(ClockWorldState[1], (time(NULL))); + } else + // Time to next battle + { + pvpWG->SendInitWorldStatesTo(pCurrChar); + pCurrChar->SendUpdateWorldState(ClockWorldState[1], (time(NULL) + pvpWG->GetTimer())); + } + } + pCurrChar->SendInitialPacketsAfterAddToMap(); CharacterDatabase.PExecute("UPDATE characters SET online = 1 WHERE guid = '%u'", pCurrChar->GetGUIDLow()); diff --git a/src/server/game/Spells/Spell.cpp b/src/server/game/Spells/Spell.cpp index 5d25708..f2893d3 100644 --- a/src/server/game/Spells/Spell.cpp +++ b/src/server/game/Spells/Spell.cpp @@ -53,6 +53,8 @@ #include "ConditionMgr.h" #include "DisableMgr.h" #include "SpellScript.h" +#include "OutdoorPvPWG.h" +#include "OutdoorPvPMgr.h" #define SPELL_CHANNEL_UPDATE_INTERVAL (1 * IN_MILLISECONDS) @@ -4577,6 +4579,7 @@ void Spell::TriggerSpell() SpellCastResult Spell::CheckCast(bool strict) { + OutdoorPvPWG *pvpWG = (OutdoorPvPWG*)sOutdoorPvPMgr.GetOutdoorPvPToZoneId(4197); // check cooldowns to prevent cheating if (m_caster->GetTypeId() == TYPEID_PLAYER && !(m_spellInfo->Attributes & SPELL_ATTR_PASSIVE)) { @@ -5550,7 +5553,7 @@ SpellCastResult Spell::CheckCast(bool strict) if (m_originalCaster && m_originalCaster->GetTypeId() == TYPEID_PLAYER && m_originalCaster->isAlive()) { if (AreaTableEntry const* pArea = GetAreaEntryByAreaID(m_originalCaster->GetAreaId())) - if (pArea->flags & AREA_FLAG_NO_FLY_ZONE) + if ((pArea->flags & AREA_FLAG_NO_FLY_ZONE) || (m_originalCaster->GetZoneId() == 4197 && pvpWG->isWarTime())) return m_IsTriggeredSpell ? SPELL_FAILED_DONT_REPORT : SPELL_FAILED_NOT_HERE; } break; diff --git a/src/server/game/World/World.cpp b/src/server/game/World/World.cpp index ed95ea5..17126d3 100644 --- a/src/server/game/World/World.cpp +++ b/src/server/game/World/World.cpp @@ -50,6 +50,7 @@ #include "CreatureAIRegistry.h" #include "BattleGroundMgr.h" #include "OutdoorPvPMgr.h" +#include "OutdoorPvPWG.h" #include "TemporarySummon.h" #include "AuctionHouseBot.h" #include "WaypointMovementGenerator.h" @@ -1240,6 +1241,17 @@ void World::LoadConfigSettings(bool reload) 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_WIN_BATTLE] = sConfig.GetIntDefault("OutdoorPvP.Wintergrasp.CustomHonorBattleWin", 3000); + m_configs[CONFIG_OUTDOORPVP_WINTERGRASP_LOSE_BATTLE] = sConfig.GetIntDefault("OutdoorPvP.Wintergrasp.CustomHonorBattleLose", 1250); + m_configs[CONFIG_OUTDOORPVP_WINTERGRASP_DAMAGED_TOWER] = sConfig.GetIntDefault("OutdoorPvP.Wintergrasp.CustomHonorDamageTower", 750); + m_configs[CONFIG_OUTDOORPVP_WINTERGRASP_DESTROYED_TOWER] = sConfig.GetIntDefault("OutdoorPvP.Wintergrasp.CustomHonorDestroyedTower", 750); + m_configs[CONFIG_OUTDOORPVP_WINTERGRASP_DAMAGED_BUILDING] = sConfig.GetIntDefault("OutdoorPvP.Wintergrasp.CustomHonorDamagedBuilding", 750); + m_configs[CONFIG_OUTDOORPVP_WINTERGRASP_INTACT_BUILDING] = sConfig.GetIntDefault("OutdoorPvP.Wintergrasp.CustomHonorIntactBuilding", 1500); 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); @@ -2780,3 +2792,29 @@ uint64 World::getWorldState(uint32 index) const WorldStatesMap::const_iterator it = m_worldstates.find(index); return it != m_worldstates.end() ? it->second : 0; } + +void World::SendWintergraspState() +{ + OutdoorPvPWG *pvpWG = (OutdoorPvPWG*)sOutdoorPvPMgr.GetOutdoorPvPToZoneId(4197); + if (!pvpWG) + return; + + for (SessionMap::const_iterator itr = m_sessions.begin(); itr != m_sessions.end(); ++itr) + { + if (!itr->second || !itr->second->GetPlayer() || !itr->second->GetPlayer()->IsInWorld()) + continue; + + if (pvpWG->isWarTime()) + { + // "Battle in progress" + itr->second->GetPlayer()->SendUpdateWorldState(ClockWorldState[1], (time(NULL))); + } else + // Time to next battle + { + pvpWG->SendInitWorldStatesTo(itr->second->GetPlayer()); + itr->second->GetPlayer()->SendUpdateWorldState(ClockWorldState[1], (time(NULL) + pvpWG->GetTimer())); + // Hide unneeded info which in center of screen + itr->second->GetPlayer()->SendInitWorldStates(itr->second->GetPlayer()->GetZoneId(), itr->second->GetPlayer()->GetAreaId()); + } + } +} \ No newline at end of file diff --git a/src/server/scripts/CMakeLists.txt b/src/server/scripts/CMakeLists.txt index 936d3ec..2a230f6 100644 --- a/src/server/scripts/CMakeLists.txt +++ b/src/server/scripts/CMakeLists.txt @@ -108,6 +108,7 @@ include_directories( ${CMAKE_SOURCE_DIR}/src/server/game/Movement/Waypoints ${CMAKE_SOURCE_DIR}/src/server/game/Opcodes ${CMAKE_SOURCE_DIR}/src/server/game/OutdoorPvP + ${CMAKE_SOURCE_DIR}/src/server/game/OutdoorPvP/Zones ${CMAKE_SOURCE_DIR}/src/server/game/Pools ${CMAKE_SOURCE_DIR}/src/server/game/PrecompiledHeaders ${CMAKE_SOURCE_DIR}/src/server/game/Quests diff --git a/src/server/shared/revision_nr.h b/src/server/shared/revision_nr.h index afbc9dd..e566238 100644 --- a/src/server/shared/revision_nr.h +++ b/src/server/shared/revision_nr.h @@ -1,4 +1,4 @@ #ifndef __REVISION_NR_H__ #define __REVISION_NR_H__ - #define REVISION_NR "180" + #define REVISION_NR "181" #endif // __REVISION_NR_H__ diff --git a/src/server/worldserver/worldserver.conf.dist b/src/server/worldserver/worldserver.conf.dist index 460bedb..bb7981f 100644 --- a/src/server/worldserver/worldserver.conf.dist +++ b/src/server/worldserver/worldserver.conf.dist @@ -2209,6 +2209,65 @@ CharDelete.KeepDays = 30 # PvPToken.ItemCount # Modify the item ID count - Default: 1 # +# OutdoorPvP.Wintergrasp.Enabled +# Determines whether the Wintergrasp battle is enabled or not. +# Default: 0 = Disable +# 1 = Enable +# +# OutdoorPvP.Wintergrasp.StartTime +# The start time of the first battle after server starts (in minutes) +# Default: 30 +# +# OutdoorPvP.Wintergrasp.BattleTime +# Time limit of a battle (in minutes) +# Default: 30 +# +# OutdoorPvP.Wintergrasp.Interval +# Interval between battles (in minutes) +# Default: 150 +# +# OutdoorPvP.Wintergrasp.CustomHonorRewards +# Defines whether custom honor rewards should be given to player +# for partaking in the Wintergrasp Battle. +# Default: 0 = Disable +# 1 = Enable +# +# OutdoorPvP.Wintergrasp.CustomHonorBattleWin +# Defines the amount of honor points that should be given to the +# team winning the Wintergrasp Battle. +# Requires OutdoorPvP.Wintergrasp.CustomHonorRewards = 1. +# Default: 3000 +# +# OutdoorPvP.Wintergrasp.CustomHonorBattleLose +# Defines the amount of honor points that should be given to the +# team losing the Wintergrasp Battle. +# Requires OutdoorPvP.Wintergrasp.CustomHonorRewards = 1. +# Default: 1250 +# +# OutdoorPvP.Wintergrasp.CustomHonorDamageTower +# Defines the amount of honor points that should be given to the +# team for damaging a tower. +# Requires OutdoorPvP.Wintergrasp.CustomHonorRewards = 1. +# Default: 750 +# +# OutdoorPvP.Wintergrasp.CustomHonorDestroyedTower +# Defines the amount of honor points that should be given to the +# team for destroying a tower. +# Requires OutdoorPvP.Wintergrasp.CustomHonorRewards = 1. +# Default: 750 +# +# OutdoorPvP.Wintergrasp.CustomHonorDamagedBuilding +# Defines the amount of honor points that should be given to the +# team for damaged buildings after the battle. +# Requires OutdoorPvP.Wintergrasp.CustomHonorRewards = 1. +# Default: 750 +# +# OutdoorPvP.Wintergrasp.CustomHonorIntactBuilding +# Defines the amount of honor points that should be given to the +# team for intact buildings after the battle. +# Requires OutdoorPvP.Wintergrasp.CustomHonorRewards = 1. +# Default: 1500 +# # NoResetTalentsCost # Enable or disable no cost when reseting talents # diff --git a/win/VC90/game.vcproj b/win/VC90/game.vcproj index b0647f4..e1e57c2 100644 --- a/win/VC90/game.vcproj +++ b/win/VC90/game.vcproj @@ -666,6 +666,14 @@ RelativePath="..\..\src\server\game\OutdoorPvP\Zones\OutdoorPvPZM.h" > + + + + + +