Skip to content

Commit

Permalink
[181] Other WG updates.
Browse files Browse the repository at this point in the history
  • Loading branch information
Myh committed Jul 29, 2010
1 parent 7f0d2ee commit de4523f
Show file tree
Hide file tree
Showing 9 changed files with 162 additions and 2 deletions.
8 changes: 8 additions & 0 deletions src/server/game/Chat/Chat.h
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
23 changes: 23 additions & 0 deletions src/server/game/Miscellaneous/Language.h
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
16 changes: 16 additions & 0 deletions src/server/game/Server/Protocol/Handlers/CharacterHandler.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,8 @@
#include "UpdateMask.h"
#include "Util.h"
#include "ScriptMgr.h"
#include "OutdoorPvPWG.h"
#include "OutdoorPvPMgr.h"

class LoginQueryHolder : public SqlQueryHolder
{
Expand Down Expand Up @@ -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());
Expand Down
5 changes: 4 additions & 1 deletion src/server/game/Spells/Spell.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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)

Expand Down Expand Up @@ -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))
{
Expand Down Expand Up @@ -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;
Expand Down
38 changes: 38 additions & 0 deletions src/server/game/World/World.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down Expand Up @@ -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);
Expand Down Expand Up @@ -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());
}
}
}
1 change: 1 addition & 0 deletions src/server/scripts/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion src/server/shared/revision_nr.h
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#ifndef __REVISION_NR_H__
#define __REVISION_NR_H__
#define REVISION_NR "180"
#define REVISION_NR "181"
#endif // __REVISION_NR_H__
59 changes: 59 additions & 0 deletions src/server/worldserver/worldserver.conf.dist
Original file line number Diff line number Diff line change
Expand Up @@ -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
#
Expand Down
12 changes: 12 additions & 0 deletions win/VC90/game.vcproj
Original file line number Diff line number Diff line change
Expand Up @@ -666,6 +666,14 @@
RelativePath="..\..\src\server\game\OutdoorPvP\Zones\OutdoorPvPZM.h"
>
</File>
<File
RelativePath="..\..\src\server\game\OutdoorPvP\Zones\OutdoorPvPWG.cpp"
>
</File>
<File
RelativePath="..\..\src\server\game\OutdoorPvP\Zones\OutdoorPvPWG.h"
>
</File>
</Filter>
</Filter>
<Filter
Expand Down Expand Up @@ -2211,6 +2219,10 @@
RelativePath="..\..\src\server\scripts\Northrend\wintergrasp.cpp"
>
</File>
<File
RelativePath="..\..\src\server\scripts\Northrend\wintergrasp.cpp"
>
</File>
<File
RelativePath="..\..\src\server\scripts\Northrend\zuldrak.cpp"
>
Expand Down

0 comments on commit de4523f

Please sign in to comment.