diff options
-rw-r--r-- | sql/updates/world/2012_08_16_00_world_spell_dbc.sql | 3 | ||||
-rw-r--r-- | sql/updates/world/2012_08_17_00_world_spell_dbc.sql | 1 | ||||
-rwxr-xr-x | src/server/game/Battlegrounds/Battleground.cpp | 8 | ||||
-rw-r--r-- | src/server/game/Globals/ObjectMgr.cpp | 3 | ||||
-rw-r--r-- | src/server/game/Guilds/GuildMgr.cpp | 1 | ||||
-rw-r--r-- | src/server/game/Server/Protocol/PacketLog.cpp | 62 | ||||
-rw-r--r-- | src/server/game/Server/Protocol/PacketLog.h | 50 | ||||
-rw-r--r-- | src/server/game/Server/WorldSocket.cpp | 54 | ||||
-rw-r--r-- | src/server/worldserver/worldserver.conf.dist | 18 |
9 files changed, 144 insertions, 56 deletions
diff --git a/sql/updates/world/2012_08_16_00_world_spell_dbc.sql b/sql/updates/world/2012_08_16_00_world_spell_dbc.sql new file mode 100644 index 00000000000..248674d17a5 --- /dev/null +++ b/sql/updates/world/2012_08_16_00_world_spell_dbc.sql @@ -0,0 +1,3 @@ +DELETE FROM `spell_dbc` WHERE `Id`=35009; +INSERT INTO `spell_dbc` (`Id`,`Attributes`,`AttributesEx`,`AttributesEx2`,`AttributesEx3`,`Targets`,`CastingTimeIndex`,`ProcCharges`,`SpellLevel`,`RangeIndex`,`Effect1`,`EffectDieSides1`,`EffectBasePoints1`,`EffectImplicitTargetA1`,`EffectImplicitTargetB1`,`EffectRadiusIndex1`,`SpellFamilyName`,`SpellFamilyFlags2`,`DmgMultiplier1`,`SchoolMask`,`Comment`) VALUES +(35009,134545792,1024,268435460,65536,64,1,101,1,13,125,1,-11,22,16,27,10,4,1,6,'Invisibility - Reducing threat'); diff --git a/sql/updates/world/2012_08_17_00_world_spell_dbc.sql b/sql/updates/world/2012_08_17_00_world_spell_dbc.sql new file mode 100644 index 00000000000..ee6d2d2f3b6 --- /dev/null +++ b/sql/updates/world/2012_08_17_00_world_spell_dbc.sql @@ -0,0 +1 @@ +UPDATE `spell_dbc` SET `ProcChance`=101,`ProcCharges`=0,`SpellFamilyName`=3,`SpellFamilyFlags2`=0 WHERE `Id`=35009; diff --git a/src/server/game/Battlegrounds/Battleground.cpp b/src/server/game/Battlegrounds/Battleground.cpp index 6b9cdad9272..d10e6a5dd90 100755 --- a/src/server/game/Battlegrounds/Battleground.cpp +++ b/src/server/game/Battlegrounds/Battleground.cpp @@ -773,17 +773,17 @@ void Battleground::EndBattleground(uint32 winner) winner_matchmaker_rating = GetArenaMatchmakerRating(winner); winner_matchmaker_change = winner_arena_team->WonAgainst(winner_matchmaker_rating, loser_matchmaker_rating, winner_change); loser_matchmaker_change = loser_arena_team->LostAgainst(loser_matchmaker_rating, winner_matchmaker_rating, loser_change); - sLog->outDebug(LOG_FILTER_BATTLEGROUND, "match Type: %u --- Winner: old rating: %u, rating gain: %d, old MMR: %u, MMR gain: %d --- Loser: old rating: %u, rating loss: %d, old MMR: %u, MMR loss: %d ---", m_ArenaType, winner_team_rating, winner_change, winner_matchmaker_rating, + sLog->outDebug(LOG_FILTER_ARENAS, "match Type: %u --- Winner: old rating: %u, rating gain: %d, old MMR: %u, MMR gain: %d --- Loser: old rating: %u, rating loss: %d, old MMR: %u, MMR loss: %d ---", m_ArenaType, winner_team_rating, winner_change, winner_matchmaker_rating, winner_matchmaker_change, loser_team_rating, loser_change, loser_matchmaker_rating, loser_matchmaker_change); SetArenaMatchmakerRating(winner, winner_matchmaker_rating + winner_matchmaker_change); SetArenaMatchmakerRating(GetOtherTeam(winner), loser_matchmaker_rating + loser_matchmaker_change); SetArenaTeamRatingChangeForTeam(winner, winner_change); SetArenaTeamRatingChangeForTeam(GetOtherTeam(winner), loser_change); - sLog->outDebug(LOG_FILTER_BATTLEGROUND, "Arena match Type: %u for Team1Id: %u - Team2Id: %u ended. WinnerTeamId: %u. Winner rating: +%d, Loser rating: %d", m_ArenaType, m_ArenaTeamIds[BG_TEAM_ALLIANCE], m_ArenaTeamIds[BG_TEAM_HORDE], winner_arena_team->GetId(), winner_change, loser_change); + sLog->outDebug(LOG_FILTER_ARENAS, "Arena match Type: %u for Team1Id: %u - Team2Id: %u ended. WinnerTeamId: %u. Winner rating: +%d, Loser rating: %d", m_ArenaType, m_ArenaTeamIds[BG_TEAM_ALLIANCE], m_ArenaTeamIds[BG_TEAM_HORDE], winner_arena_team->GetId(), winner_change, loser_change); if (sWorld->getBoolConfig(CONFIG_ARENA_LOG_EXTENDED_INFO)) for (Battleground::BattlegroundScoreMap::const_iterator itr = GetPlayerScoresBegin(); itr != GetPlayerScoresEnd(); ++itr) if (Player* player = ObjectAccessor::FindPlayer(itr->first)) - sLog->outDebug(LOG_FILTER_BATTLEGROUND, "Statistics match Type: %u for %s (GUID: " UI64FMTD ", Team: %d, IP: %s): %u damage, %u healing, %u killing blows", m_ArenaType, player->GetName(), itr->first, player->GetArenaTeamId(m_ArenaType == 5 ? 2 : m_ArenaType == 3), player->GetSession()->GetRemoteAddress().c_str(), itr->second->DamageDone, itr->second->HealingDone, itr->second->KillingBlows); + sLog->outDebug(LOG_FILTER_ARENAS, "Statistics match Type: %u for %s (GUID: " UI64FMTD ", Team: %d, IP: %s): %u damage, %u healing, %u killing blows", m_ArenaType, player->GetName(), itr->first, player->GetArenaTeamId(m_ArenaType == 5 ? 2 : m_ArenaType == 3), player->GetSession()->GetRemoteAddress().c_str(), itr->second->DamageDone, itr->second->HealingDone, itr->second->KillingBlows); } // Deduct 16 points from each teams arena-rating if there are no winners after 45+2 minutes else @@ -1120,7 +1120,7 @@ void Battleground::StartBattleground() // and it doesn't matter if we call StartBattleground() more times, because m_Battlegrounds is a map and instance id never changes sBattlegroundMgr->AddBattleground(GetInstanceID(), GetTypeID(), this); if (m_IsRated) - sLog->outDebug(LOG_FILTER_BATTLEGROUND, "Arena match type: %u for Team1Id: %u - Team2Id: %u started.", m_ArenaType, m_ArenaTeamIds[BG_TEAM_ALLIANCE], m_ArenaTeamIds[BG_TEAM_HORDE]); + sLog->outDebug(LOG_FILTER_ARENAS, "Arena match type: %u for Team1Id: %u - Team2Id: %u started.", m_ArenaType, m_ArenaTeamIds[BG_TEAM_ALLIANCE], m_ArenaTeamIds[BG_TEAM_HORDE]); } void Battleground::AddPlayer(Player* player) diff --git a/src/server/game/Globals/ObjectMgr.cpp b/src/server/game/Globals/ObjectMgr.cpp index b1566fd3fb1..cd3cca4ac5e 100644 --- a/src/server/game/Globals/ObjectMgr.cpp +++ b/src/server/game/Globals/ObjectMgr.cpp @@ -2564,7 +2564,6 @@ void ObjectMgr::LoadItemTemplateAddon() ++count; } while (result->NextRow()); } - sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded %u item addon templates in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); } @@ -2593,7 +2592,6 @@ void ObjectMgr::LoadItemScriptNames() sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded %u item script names in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); } - ItemTemplate const* ObjectMgr::GetItemTemplate(uint32 entry) { ItemTemplateContainer::const_iterator itr = _itemTemplateStore.find(entry); @@ -8610,7 +8608,6 @@ void ObjectMgr::LoadHotfixData() info.Entry = fields[0].GetUInt32(); info.Type = fields[1].GetUInt32(); info.Timestamp = fields[2].GetUInt64(); - _hotfixData.push_back(info); ++count; } diff --git a/src/server/game/Guilds/GuildMgr.cpp b/src/server/game/Guilds/GuildMgr.cpp index 584d32b12d5..4d7e2ebd4c6 100644 --- a/src/server/game/Guilds/GuildMgr.cpp +++ b/src/server/game/Guilds/GuildMgr.cpp @@ -398,7 +398,6 @@ void GuildMgr::LoadGuilds() PreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_SEL_GUILD_ACHIEVEMENT); stmt->setUInt32(0, itr->first); achievementResult = CharacterDatabase.Query(stmt); - stmt = CharacterDatabase.GetPreparedStatement(CHAR_SEL_GUILD_ACHIEVEMENT_CRITERIA); stmt->setUInt32(0, itr->first); criteriaResult = CharacterDatabase.Query(stmt); diff --git a/src/server/game/Server/Protocol/PacketLog.cpp b/src/server/game/Server/Protocol/PacketLog.cpp new file mode 100644 index 00000000000..cb6dcdbdb9e --- /dev/null +++ b/src/server/game/Server/Protocol/PacketLog.cpp @@ -0,0 +1,62 @@ +/* + * Copyright (C) 2008-2012 TrinityCore <http://www.trinitycore.org/> + * + * This program is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License as published by the + * Free Software Foundation; either version 2 of the License, or (at your + * option) any later version. + * + * This program is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for + * more details. + * + * You should have received a copy of the GNU General Public License along + * with this program. If not, see <http://www.gnu.org/licenses/>. + */ + +#include "PacketLog.h" +#include "Config.h" +#include "ByteBuffer.h" +#include "WorldPacket.h" + +PacketLog::PacketLog() : _file(NULL) +{ + Initialize(); +} + +PacketLog::~PacketLog() +{ + if (_file) + fclose(_file); + + _file = NULL; +} + +void PacketLog::Initialize() +{ + std::string logsDir = ConfigMgr::GetStringDefault("LogsDir", ""); + + if (!logsDir.empty()) + if ((logsDir.at(logsDir.length()-1) != '/') && (logsDir.at(logsDir.length()-1) != '\\')) + logsDir.push_back('/'); + + std::string logname = ConfigMgr::GetStringDefault("PacketLogFile", ""); + if (!logname.empty()) + _file = fopen((logsDir + logname).c_str(), "wb"); +} + +void PacketLog::LogPacket(WorldPacket const& packet, Direction direction) +{ + ByteBuffer data(4+4+4+1+packet.size()); + data << int32(packet.GetOpcode()); + data << int32(packet.size()); + data << uint32(time(NULL)); + data << uint8(direction); + + for (uint32 i = 0; i < packet.size(); i++) + data << const_cast<WorldPacket&>(packet)[i]; + + fwrite(data.contents(), 1, data.size(), _file); + fflush(_file); +} diff --git a/src/server/game/Server/Protocol/PacketLog.h b/src/server/game/Server/Protocol/PacketLog.h new file mode 100644 index 00000000000..b899daae198 --- /dev/null +++ b/src/server/game/Server/Protocol/PacketLog.h @@ -0,0 +1,50 @@ +/* + * Copyright (C) 2008-2012 TrinityCore <http://www.trinitycore.org/> + * + * This program is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License as published by the + * Free Software Foundation; either version 2 of the License, or (at your + * option) any later version. + * + * This program is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for + * more details. + * + * You should have received a copy of the GNU General Public License along + * with this program. If not, see <http://www.gnu.org/licenses/>. + */ + +#ifndef TRINITY_PACKETLOG_H +#define TRINITY_PACKETLOG_H + +#include "Common.h" +#include <ace/Singleton.h> + +enum Direction +{ + CLIENT_TO_SERVER, + SERVER_TO_CLIENT +}; + +class WorldPacket; + +class PacketLog +{ + friend class ACE_Singleton<PacketLog, ACE_Thread_Mutex>; + + private: + PacketLog(); + ~PacketLog(); + + public: + void Initialize(); + bool CanLogPacket() const { return (_file != NULL); } + void LogPacket(WorldPacket const& packet, Direction direction); + + private: + FILE* _file; +}; + +#define sPacketLog ACE_Singleton<PacketLog, ACE_Thread_Mutex>::instance() +#endif diff --git a/src/server/game/Server/WorldSocket.cpp b/src/server/game/Server/WorldSocket.cpp index a30702ded14..783d53562a2 100644 --- a/src/server/game/Server/WorldSocket.cpp +++ b/src/server/game/Server/WorldSocket.cpp @@ -42,6 +42,7 @@ #include "WorldSession.h" #include "WorldSocketMgr.h" #include "Log.h" +#include "PacketLog.h" #include "ScriptMgr.h" #include "AccountMgr.h" @@ -159,30 +160,8 @@ int WorldSocket::SendPacket(WorldPacket const& pct) return -1; // Dump outgoing packet - if (sLog->ShouldLog(LOG_FILTER_NETWORKIO, LOG_LEVEL_TRACE)) - { - char buff[250]; - snprintf(buff, 250, "SERVER:\nSOCKET: %u\nLENGTH: %u\nOPCODE: %s (0x%.4X)\nDATA:\n", - uint32(get_handle()), - uint32(pct.size()), - LookupOpcodeName (pct.GetOpcode()), - pct.GetOpcode()); - - std::string data(buff); - uint32 p = 0; - while (p < pct.size()) - { - for (uint32 j = 0; j < 16 && p < pct.size(); j++) - { - snprintf(buff, 250, "%.2X ", const_cast<WorldPacket&>(pct)[p++]); - data.append(buff); - } - data.append("\n"); - } - - data.append("\n"); - sLog->outTrace(LOG_FILTER_NETWORKIO, "%s", data.c_str()); - } + if (sPacketLog->CanLogPacket()) + sPacketLog->LogPacket(pct, SERVER_TO_CLIENT); WorldPacket const* pkt = &pct; @@ -694,30 +673,9 @@ int WorldSocket::ProcessIncoming(WorldPacket* new_pct) if (closing_) return -1; - if (sLog->ShouldLog(LOG_FILTER_NETWORKIO, LOG_LEVEL_TRACE)) - { - char buff[250]; - snprintf(buff, 250, "CLIENT:\nSOCKET: %u\nLENGTH: %u\nOPCODE: %s (0x%.4X)\nDATA:\n", - uint32(get_handle()), - uint32(new_pct->size()), - LookupOpcodeName (new_pct->GetOpcode()), - new_pct->GetOpcode()); - - std::string data(buff); - uint32 p = 0; - while (p < new_pct->size()) - { - for (uint32 j = 0; j < 16 && p < new_pct->size(); j++) - { - snprintf(buff, 250, "%.2X ", const_cast<WorldPacket&>(*new_pct)[p++]); - data.append(buff); - } - data.append("\n"); - } - - data.append("\n"); - sLog->outTrace(LOG_FILTER_NETWORKIO, "%s", data.c_str()); - } + // Dump received packet. + if (sPacketLog->CanLogPacket()) + sPacketLog->LogPacket(*new_pct, CLIENT_TO_SERVER); sLog->outInfo(LOG_FILTER_OPCODES, "C->S: %s 0x%.4X (%u)", LookupOpcodeName(Opcodes(opcode)), uint32(Opcodes(opcode)), uint32(Opcodes(opcode))); diff --git a/src/server/worldserver/worldserver.conf.dist b/src/server/worldserver/worldserver.conf.dist index cba2bb8b700..28bd8aecaf3 100644 --- a/src/server/worldserver/worldserver.conf.dist +++ b/src/server/worldserver/worldserver.conf.dist @@ -404,6 +404,15 @@ PersistentCharacterCleanFlags = 0 PidFile = "" # +# PacketLogFile +# Description: Binary packet logging file for the world server. +# Filename extension must be .bin to be parsable with WowPacketParser. +# Example: "World.bin" - (Enabled) +# Default: "" - (Disabled) + +PacketLogFile = "" + +# # ChatLogs.Channel # Description: Log custom channel chat. # Default: 0 - (Disabled) @@ -2261,6 +2270,15 @@ Arena.ArenaStartPersonalRating = 0 Arena.ArenaStartMatchmakerRating = 1500 # +# ArenaLog.ExtendedInfo +# Description: Include extended info to ArenaLogFile for each player after rated arena +# matches (guid, name, team, IP, healing/damage done, killing blows). +# Default: 0 - (Disabled) +# 1 - (Enabled) + +ArenaLog.ExtendedInfo = 0 + +# ################################################################################################### ################################################################################################### |