diff options
author | Vincent-Michael <Vincent_Michael@gmx.de> | 2014-07-30 22:26:59 +0200 |
---|---|---|
committer | Vincent-Michael <Vincent_Michael@gmx.de> | 2014-07-30 22:26:59 +0200 |
commit | a917b6599f599419767b8683b591a96d9cdb7092 (patch) | |
tree | 16af20ae09d8a13eca0f74d00e5027da6ed608be /src | |
parent | d89a5d2d176000535ca857ab6ce600607a747358 (diff) | |
parent | 01b733eb69691ccd1ac8e9884ff2a4cb4643a7cf (diff) |
Merge branch 'master' of github.com:TrinityCore/TrinityCore into 4.3.4
Conflicts:
src/server/game/Server/WorldSocket.cpp
src/server/scripts/OutdoorPvP/OutdoorPvPEP.cpp
src/server/scripts/OutdoorPvP/OutdoorPvPEP.h
Diffstat (limited to 'src')
34 files changed, 229 insertions, 637 deletions
diff --git a/src/server/authserver/Main.cpp b/src/server/authserver/Main.cpp index f5cc3bf2508..0b1a93b3d2a 100644 --- a/src/server/authserver/Main.cpp +++ b/src/server/authserver/Main.cpp @@ -70,18 +70,18 @@ int main(int argc, char** argv) if (vm.count("help")) return 0; - if (!sConfigMgr->LoadInitial(configFile)) + std::string configError; + if (!sConfigMgr->LoadInitial(configFile, configError)) { - printf("Invalid or missing configuration file : %s\n", configFile.c_str()); - printf("Verify that the file exists and has \'[authserver]\' written in the top of the file!\n"); + printf("Error in config file: %s\n", configError.c_str()); return 1; } TC_LOG_INFO("server.authserver", "%s (authserver)", _FULLVERSION); TC_LOG_INFO("server.authserver", "<Ctrl-C> to stop.\n"); TC_LOG_INFO("server.authserver", "Using configuration file %s.", configFile.c_str()); - TC_LOG_INFO("server.worldserver", "Using SSL version: %s (library: %s)", OPENSSL_VERSION_TEXT, SSLeay_version(SSLEAY_VERSION)); - TC_LOG_INFO("server.worldserver", "Using Boost version: %i.%i.%i", BOOST_VERSION / 100000, BOOST_VERSION / 100 % 1000, BOOST_VERSION % 100); + TC_LOG_INFO("server.authserver", "Using SSL version: %s (library: %s)", OPENSSL_VERSION_TEXT, SSLeay_version(SSLEAY_VERSION)); + TC_LOG_INFO("server.authserver", "Using Boost version: %i.%i.%i", BOOST_VERSION / 100000, BOOST_VERSION / 100 % 1000, BOOST_VERSION % 100); // authserver PID file creation std::string pidFile = sConfigMgr->GetStringDefault("PidFile", ""); diff --git a/src/server/authserver/Server/AuthSession.cpp b/src/server/authserver/Server/AuthSession.cpp index 6607e98fb3b..ac7c1cfaee5 100644 --- a/src/server/authserver/Server/AuthSession.cpp +++ b/src/server/authserver/Server/AuthSession.cpp @@ -108,8 +108,13 @@ typedef struct AUTH_RECONNECT_PROOF_C #pragma pack(pop) -#define BYTE_SIZE 32 -#define REALMLIST_SKIP_PACKETS 5 +enum class BufferSizes : uint32 +{ + SRP_6_V = 0x20, + SRP_6_S = 0x20, +}; + +#define REALM_LIST_PACKET_SIZE 5 #define XFER_ACCEPT_SIZE 1 #define XFER_RESUME_SIZE 9 #define XFER_CANCEL_SIZE 1 @@ -122,7 +127,7 @@ std::unordered_map<uint8, AuthHandler> AuthSession::InitHandlers() handlers[AUTH_LOGON_PROOF] = { STATUS_CONNECTED, sizeof(AUTH_LOGON_PROOF_C), &AuthSession::HandleLogonProof }; handlers[AUTH_RECONNECT_CHALLENGE] = { STATUS_CONNECTED, sizeof(AUTH_LOGON_CHALLENGE_C), &AuthSession::HandleReconnectChallenge }; handlers[AUTH_RECONNECT_PROOF] = { STATUS_CONNECTED, sizeof(AUTH_RECONNECT_PROOF_C), &AuthSession::HandleReconnectProof }; - handlers[REALM_LIST] = { STATUS_AUTHED, REALMLIST_SKIP_PACKETS, &AuthSession::HandleRealmList }; + handlers[REALM_LIST] = { STATUS_AUTHED, REALM_LIST_PACKET_SIZE, &AuthSession::HandleRealmList }; handlers[XFER_ACCEPT] = { STATUS_AUTHED, XFER_ACCEPT_SIZE, &AuthSession::HandleXferAccept }; handlers[XFER_RESUME] = { STATUS_AUTHED, XFER_RESUME_SIZE, &AuthSession::HandleXferResume }; handlers[XFER_CANCEL] = { STATUS_AUTHED, XFER_CANCEL_SIZE, &AuthSession::HandleXferCancel }; @@ -318,7 +323,7 @@ bool AuthSession::HandleLogonChallenge() TC_LOG_DEBUG("network", "database authentication values: v='%s' s='%s'", databaseV.c_str(), databaseS.c_str()); // multiply with 2 since bytes are stored as hexstring - if (databaseV.size() != BYTE_SIZE * 2 || databaseS.size() != BYTE_SIZE * 2) + if (databaseV.size() != size_t(BufferSizes::SRP_6_V) * 2 || databaseS.size() != size_t(BufferSizes::SRP_6_S) * 2) SetVSFields(rI); else { @@ -346,10 +351,10 @@ bool AuthSession::HandleLogonChallenge() // B may be calculated < 32B so we force minimal length to 32B pkt.append(B.AsByteArray(32).get(), 32); // 32 bytes pkt << uint8(1); - pkt.append(g.AsByteArray().get(), 1); + pkt.append(g.AsByteArray(1).get(), 1); pkt << uint8(32); pkt.append(N.AsByteArray(32).get(), 32); - pkt.append(s.AsByteArray().get(), s.GetNumBytes()); // 32 bytes + pkt.append(s.AsByteArray(int32(BufferSizes::SRP_6_S)).get(), size_t(BufferSizes::SRP_6_S)); // 32 bytes pkt.append(unk3.AsByteArray(16).get(), 16); uint8 securityFlags = 0; @@ -490,10 +495,10 @@ bool AuthSession::HandleLogonProof() sha.UpdateBigNumbers(&s, &A, &B, &K, NULL); sha.Finalize(); BigNumber M; - M.SetBinary(sha.GetDigest(), 20); + M.SetBinary(sha.GetDigest(), sha.GetLength()); // Check if SRP6 results match (password is correct), else send an error - if (!memcmp(M.AsByteArray().get(), logonProof->M1, 20)) + if (!memcmp(M.AsByteArray(sha.GetLength()).get(), logonProof->M1, 20)) { TC_LOG_DEBUG("server.authserver", "'%s:%d' User '%s' successfully authenticated", GetRemoteIpAddress().to_string().c_str(), GetRemotePort(), _login.c_str()); @@ -871,21 +876,19 @@ bool AuthSession::HandleXferAccept() // Make the SRP6 calculation from hash in dB void AuthSession::SetVSFields(const std::string& rI) { - s.SetRand(BYTE_SIZE * 8); + s.SetRand(int32(BufferSizes::SRP_6_S) * 8); BigNumber I; I.SetHexStr(rI.c_str()); // In case of leading zeros in the rI hash, restore them uint8 mDigest[SHA_DIGEST_LENGTH]; - memset(mDigest, 0, SHA_DIGEST_LENGTH); - if (I.GetNumBytes() <= SHA_DIGEST_LENGTH) - memcpy(mDigest, I.AsByteArray().get(), I.GetNumBytes()); + memcpy(mDigest, I.AsByteArray(SHA_DIGEST_LENGTH).get(), SHA_DIGEST_LENGTH); std::reverse(mDigest, mDigest + SHA_DIGEST_LENGTH); SHA1Hash sha; - sha.UpdateData(s.AsByteArray().get(), s.GetNumBytes()); + sha.UpdateData(s.AsByteArray(uint32(BufferSizes::SRP_6_S)).get(), (uint32(BufferSizes::SRP_6_S))); sha.UpdateData(mDigest, SHA_DIGEST_LENGTH); sha.Finalize(); BigNumber x; diff --git a/src/server/game/Achievements/AchievementMgr.cpp b/src/server/game/Achievements/AchievementMgr.cpp index 17db09eedfb..2bbdffc1e7b 100644 --- a/src/server/game/Achievements/AchievementMgr.cpp +++ b/src/server/game/Achievements/AchievementMgr.cpp @@ -61,7 +61,7 @@ namespace Trinity private: Player const* _player; ChatMsg _msgType; - int32 _textId; + uint32 _textId; uint32 _achievementId; }; } // namespace Trinity diff --git a/src/server/game/Chat/Channels/ChannelMgr.cpp b/src/server/game/Chat/Channels/ChannelMgr.cpp index 366b0eee59f..a3a4ef69e63 100644 --- a/src/server/game/Chat/Channels/ChannelMgr.cpp +++ b/src/server/game/Chat/Channels/ChannelMgr.cpp @@ -29,14 +29,16 @@ ChannelMgr::~ChannelMgr() ChannelMgr* ChannelMgr::forTeam(uint32 team) { + static ChannelMgr allianceChannelMgr; + static ChannelMgr hordeChannelMgr; if (sWorld->getBoolConfig(CONFIG_ALLOW_TWO_SIDE_INTERACTION_CHANNEL)) - return AllianceChannelMgr::instance(); // cross-faction + return &allianceChannelMgr; // cross-faction if (team == ALLIANCE) - return AllianceChannelMgr::instance(); + return &allianceChannelMgr; if (team == HORDE) - return HordeChannelMgr::instance(); + return &hordeChannelMgr; return NULL; } diff --git a/src/server/game/Chat/Channels/ChannelMgr.h b/src/server/game/Chat/Channels/ChannelMgr.h index f3ca9694176..fb93af2c310 100644 --- a/src/server/game/Chat/Channels/ChannelMgr.h +++ b/src/server/game/Chat/Channels/ChannelMgr.h @@ -35,13 +35,7 @@ class ChannelMgr ~ChannelMgr(); public: - static ChannelMgr* instance() - { - static ChannelMgr instance; - return &instance; - } - - static ChannelMgr * forTeam(uint32 team); + static ChannelMgr* forTeam(uint32 team); void setTeam(uint32 newTeam) { team = newTeam; } Channel* GetJoinChannel(std::string const& name, uint32 channel_id); @@ -55,7 +49,4 @@ class ChannelMgr void MakeNotOnPacket(WorldPacket* data, std::string const& name); }; -class AllianceChannelMgr : public ChannelMgr { }; -class HordeChannelMgr : public ChannelMgr { }; - #endif diff --git a/src/server/game/Conditions/ConditionMgr.cpp b/src/server/game/Conditions/ConditionMgr.cpp index 04ceaefb0d5..6083895ab26 100644 --- a/src/server/game/Conditions/ConditionMgr.cpp +++ b/src/server/game/Conditions/ConditionMgr.cpp @@ -1787,9 +1787,9 @@ bool ConditionMgr::isConditionTypeValid(Condition* cond) } if (cond->ConditionValue2) - TC_LOG_ERROR("sql.sql", "Spell condition has useless data in value2 (%u)!", cond->ConditionValue2); + TC_LOG_ERROR("sql.sql", "Spell condition has useless data (spell Id: %d) in value2 (%u)!", cond->ConditionValue1, cond->ConditionValue2); if (cond->ConditionValue3) - TC_LOG_ERROR("sql.sql", "Spell condition has useless data in value3 (%u)!", cond->ConditionValue3); + TC_LOG_ERROR("sql.sql", "Spell condition has useless data (spell Id: %d) in value3 (%u)!", cond->ConditionValue1, cond->ConditionValue3); break; } case CONDITION_LEVEL: diff --git a/src/server/game/Entities/Player/Player.cpp b/src/server/game/Entities/Player/Player.cpp index 73d87ef4774..21cb96ac048 100644 --- a/src/server/game/Entities/Player/Player.cpp +++ b/src/server/game/Entities/Player/Player.cpp @@ -3032,14 +3032,6 @@ void Player::GiveXP(uint32 xp, Unit* victim, float group_rate) sScriptMgr->OnGivePlayerXP(this, xp, victim); - // Favored experience increase START - uint32 zone = GetZoneId(); - float favored_exp_mult = 0; - if ((HasAura(32096) || HasAura(32098)) && (zone == 3483 || zone == 3562 || zone == 3836 || zone == 3713 || zone == 3714)) - favored_exp_mult = 0.05f; // Thrallmar's Favor and Honor Hold's Favor - xp = uint32(xp * (1 + favored_exp_mult)); - // Favored experience increase END - // XP to money conversion processed in Player::RewardQuest if (level >= sWorld->getIntConfig(CONFIG_MAX_PLAYER_LEVEL)) return; diff --git a/src/server/game/Handlers/ChannelHandler.cpp b/src/server/game/Handlers/ChannelHandler.cpp index 0ab5a8ab811..fd76b23087e 100644 --- a/src/server/game/Handlers/ChannelHandler.cpp +++ b/src/server/game/Handlers/ChannelHandler.cpp @@ -21,6 +21,8 @@ #include "Player.h" #include "WorldSession.h" +#include <cctype> + void WorldSession::HandleJoinChannel(WorldPacket& recvPacket) { uint32 channelId; @@ -52,6 +54,9 @@ void WorldSession::HandleJoinChannel(WorldPacket& recvPacket) if (channelName.empty()) return; + if (isdigit(channelName[0])) + return; + if (ChannelMgr* cMgr = ChannelMgr::forTeam(GetPlayer()->GetTeam())) { cMgr->setTeam(GetPlayer()->GetTeam()); diff --git a/src/server/game/Miscellaneous/Language.h b/src/server/game/Miscellaneous/Language.h index 68a0687dc24..0f917f43528 100644 --- a/src/server/game/Miscellaneous/Language.h +++ b/src/server/game/Miscellaneous/Language.h @@ -1145,59 +1145,6 @@ enum TrinityStrings // Use for not-in-offcial-sources patches // 10000-10999 - // opvp hp - LANG_OPVP_HP_CAPTURE_OVERLOOK_H = 10001, - LANG_OPVP_HP_CAPTURE_OVERLOOK_A = 10002, - LANG_OPVP_HP_CAPTURE_STADIUM_H = 10003, - LANG_OPVP_HP_CAPTURE_STADIUM_A = 10004, - LANG_OPVP_HP_CAPTURE_BROKENHILL_H = 10005, - LANG_OPVP_HP_CAPTURE_BROKENHILL_A = 10006, - LANG_OPVP_HP_LOSE_OVERLOOK_H = 10007, - LANG_OPVP_HP_LOSE_OVERLOOK_A = 10008, - LANG_OPVP_HP_LOSE_STADIUM_H = 10009, - LANG_OPVP_HP_LOSE_STADIUM_A = 10010, - LANG_OPVP_HP_LOSE_BROKENHILL_H = 10011, - LANG_OPVP_HP_LOSE_BROKENHILL_A = 10012, - // opvp zm - LANG_OPVP_ZM_CAPTURE_WEST_H = 10013, - LANG_OPVP_ZM_CAPTURE_WEST_A = 10014, - LANG_OPVP_ZM_CAPTURE_EAST_H = 10015, - LANG_OPVP_ZM_CAPTURE_EAST_A = 10016, - LANG_OPVP_ZM_CAPTURE_GY_H = 10017, - LANG_OPVP_ZM_CAPTURE_GY_A = 10018, - LANG_OPVP_ZM_LOSE_WEST_H = 10019, - LANG_OPVP_ZM_LOSE_WEST_A = 10020, - LANG_OPVP_ZM_LOSE_EAST_H = 10021, - LANG_OPVP_ZM_LOSE_EAST_A = 10022, - LANG_OPVP_ZM_LOSE_GY_H = 10023, - LANG_OPVP_ZM_LOSE_GY_A = 10024, - // opvp na - LANG_OPVP_NA_CAPTURE_H = 10025, - LANG_OPVP_NA_CAPTURE_A = 10026, - LANG_OPVP_NA_LOSE_H = 10027, - LANG_OPVP_NA_LOSE_A = 10028, - // opvp tf - LANG_OPVP_TF_CAPTURE_H = 10029, - LANG_OPVP_TF_CAPTURE_A = 10030, - LANG_OPVP_TF_LOSE_H = 10031, - LANG_OPVP_TF_LOSE_A = 10032, - // opvp ep - LANG_OPVP_EP_CAPTURE_NPT_H = 10033, - LANG_OPVP_EP_CAPTURE_NPT_A = 10034, - LANG_OPVP_EP_CAPTURE_EWT_H = 10035, - LANG_OPVP_EP_CAPTURE_EWT_A = 10036, - LANG_OPVP_EP_CAPTURE_CGT_H = 10037, - LANG_OPVP_EP_CAPTURE_CGT_A = 10038, - LANG_OPVP_EP_CAPTURE_PWT_H = 10039, - LANG_OPVP_EP_CAPTURE_PWT_A = 10040, - LANG_OPVP_EP_LOSE_NPT_H = 10041, - LANG_OPVP_EP_LOSE_NPT_A = 10042, - LANG_OPVP_EP_LOSE_EWT_H = 10043, - LANG_OPVP_EP_LOSE_EWT_A = 10044, - LANG_OPVP_EP_LOSE_CGT_H = 10045, - LANG_OPVP_EP_LOSE_CGT_A = 10046, - LANG_OPVP_EP_LOSE_PWT_H = 10047, - LANG_OPVP_EP_LOSE_PWT_A = 10048, // opvp si LANG_OPVP_SI_CAPTURE_H = 10049, LANG_OPVP_SI_CAPTURE_A = 10050, diff --git a/src/server/game/OutdoorPvP/OutdoorPvP.cpp b/src/server/game/OutdoorPvP/OutdoorPvP.cpp index cacec14d5e6..92a83f9d6f0 100644 --- a/src/server/game/OutdoorPvP/OutdoorPvP.cpp +++ b/src/server/game/OutdoorPvP/OutdoorPvP.cpp @@ -25,10 +25,29 @@ #include "WorldPacket.h" #include "GridNotifiers.h" #include "GridNotifiersImpl.h" -#include "GridNotifiers.h" -#include "GridNotifiersImpl.h" #include "CellImpl.h" +class DefenseMessageBuilder +{ + public: + DefenseMessageBuilder(uint32 zoneId, uint32 id) + : _zoneId(zoneId), _id(id) { } + + void operator()(WorldPacket& data, LocaleConstant locale) const + { + std::string text = sOutdoorPvPMgr->GetDefenseMessage(_zoneId, _id, locale); + + data.Initialize(SMSG_DEFENSE_MESSAGE, 4 + 4 + text.length()); + data.append<uint32>(_zoneId); + data.append<uint32>(text.length()); + data << text; + } + + private: + uint32 _zoneId; ///< ZoneId + uint32 _id; ///< BroadcastTextId +}; + OPvPCapturePoint::OPvPCapturePoint(OutdoorPvP* pvp): m_capturePointGUID(0), m_capturePoint(NULL), m_maxValue(0.0f), m_minValue(0.0f), m_maxSpeed(0), m_value(0), m_team(TEAM_NEUTRAL), m_OldState(OBJECTIVESTATE_NEUTRAL), @@ -616,3 +635,20 @@ void OutdoorPvP::OnGameObjectRemove(GameObject* go) if (OPvPCapturePoint *cp = GetCapturePoint(go->GetDBTableGUIDLow())) cp->m_capturePoint = NULL; } + +void OutdoorPvP::SendDefenseMessage(uint32 zoneId, uint32 id) +{ + DefenseMessageBuilder builder(zoneId, id); + Trinity::LocalizedPacketDo<DefenseMessageBuilder> localizer(builder); + BroadcastWorker(localizer, zoneId); +} + +template<class Worker> +void OutdoorPvP::BroadcastWorker(Worker& _worker, uint32 zoneId) +{ + for (uint32 i = 0; i < BG_TEAMS_COUNT; ++i) + for (PlayerSet::iterator itr = m_players[i].begin(); itr != m_players[i].end(); ++itr) + if (Player* player = ObjectAccessor::FindPlayer(*itr)) + if (player->GetZoneId() == zoneId) + _worker(player); +} diff --git a/src/server/game/OutdoorPvP/OutdoorPvP.h b/src/server/game/OutdoorPvP/OutdoorPvP.h index 577d70021a6..b7c08d51bda 100644 --- a/src/server/game/OutdoorPvP/OutdoorPvP.h +++ b/src/server/game/OutdoorPvP/OutdoorPvP.h @@ -260,6 +260,8 @@ class OutdoorPvP : public ZoneScript } } + void SendDefenseMessage(uint32 zoneId, uint32 id); + protected: // the map of the objectives belonging to this outdoorpvp @@ -299,6 +301,9 @@ class OutdoorPvP : public ZoneScript bool HasPlayer(Player const* player) const; void TeamCastSpell(TeamId team, int32 spellId); + + template<class Worker> + void BroadcastWorker(Worker& _worker, uint32 zoneId); }; #endif /*OUTDOOR_PVP_H_*/ diff --git a/src/server/game/OutdoorPvP/OutdoorPvPMgr.cpp b/src/server/game/OutdoorPvP/OutdoorPvPMgr.cpp index 2b05f7255f6..5306a3ca3c1 100644 --- a/src/server/game/OutdoorPvP/OutdoorPvPMgr.cpp +++ b/src/server/game/OutdoorPvP/OutdoorPvPMgr.cpp @@ -228,3 +228,12 @@ void OutdoorPvPMgr::HandlePlayerResurrects(Player* player, uint32 zoneid) if (itr->second->HasPlayer(player)) itr->second->HandlePlayerResurrects(player, zoneid); } + +std::string OutdoorPvPMgr::GetDefenseMessage(uint32 zoneId, uint32 id, LocaleConstant locale) const +{ + if (BroadcastText const* bct = sObjectMgr->GetBroadcastText(id)) + return bct->GetText(locale); + + TC_LOG_ERROR("outdoorpvp", "Can not find DefenseMessage (Zone: %u, Id: %u). BroadcastText (Id: %u) does not exist.", zoneId, id, id); + return ""; +} diff --git a/src/server/game/OutdoorPvP/OutdoorPvPMgr.h b/src/server/game/OutdoorPvP/OutdoorPvPMgr.h index 1a9db2b682e..bf2f14a291f 100644 --- a/src/server/game/OutdoorPvP/OutdoorPvPMgr.h +++ b/src/server/game/OutdoorPvP/OutdoorPvPMgr.h @@ -84,6 +84,8 @@ class OutdoorPvPMgr void HandleDropFlag(Player* player, uint32 spellId); + std::string GetDefenseMessage(uint32 zoneId, uint32 id, LocaleConstant locale) const; + private: typedef std::vector<OutdoorPvP*> OutdoorPvPSet; typedef std::map<uint32 /* zoneid */, OutdoorPvP*> OutdoorPvPMap; diff --git a/src/server/game/Server/Protocol/PacketLog.cpp b/src/server/game/Server/Protocol/PacketLog.cpp index a905b01c73c..0d0dd07edf9 100644 --- a/src/server/game/Server/Protocol/PacketLog.cpp +++ b/src/server/game/Server/Protocol/PacketLog.cpp @@ -38,11 +38,19 @@ struct LogHeader struct PacketHeader { + // used to uniquely identify a connection + struct OptionalData + { + uint8 SocketIPBytes[16]; + uint32 SocketPort; + }; + char Direction[4]; uint32 ConnectionId; uint32 ArrivalTicks; uint32 OptionalDataSize; uint32 Length; + OptionalData OptionalData; uint32 Opcode; }; @@ -89,14 +97,28 @@ void PacketLog::Initialize() } } -void PacketLog::LogPacket(WorldPacket const& packet, Direction direction) +void PacketLog::LogPacket(WorldPacket const& packet, Direction direction, boost::asio::ip::address addr, uint16 port) { PacketHeader header; *reinterpret_cast<uint32*>(header.Direction) = direction == CLIENT_TO_SERVER ? 0x47534d43 : 0x47534d53; header.ConnectionId = 0; header.ArrivalTicks = getMSTime(); - header.OptionalDataSize = 0; - header.Length = packet.size() + 4; + + header.OptionalDataSize = sizeof(header.OptionalData); + memset(header.OptionalData.SocketIPBytes, 0, sizeof(header.OptionalData.SocketIPBytes)); + if (addr.is_v4()) + { + auto bytes = addr.to_v4().to_bytes(); + memcpy(header.OptionalData.SocketIPBytes, bytes.data(), bytes.size()); + } + else if (addr.is_v6()) + { + auto bytes = addr.to_v6().to_bytes(); + memcpy(header.OptionalData.SocketIPBytes, bytes.data(), bytes.size()); + } + + header.OptionalData.SocketPort = port; + header.Length = packet.size() + sizeof(header.Opcode); header.Opcode = packet.GetOpcode(); fwrite(&header, sizeof(header), 1, _file); diff --git a/src/server/game/Server/Protocol/PacketLog.h b/src/server/game/Server/Protocol/PacketLog.h index 4f298fa3c50..b09e853236a 100644 --- a/src/server/game/Server/Protocol/PacketLog.h +++ b/src/server/game/Server/Protocol/PacketLog.h @@ -19,6 +19,7 @@ #define TRINITY_PACKETLOG_H #include "Common.h" +#include <boost/asio/ip/address.hpp> enum Direction { @@ -43,7 +44,7 @@ class PacketLog void Initialize(); bool CanLogPacket() const { return (_file != NULL); } - void LogPacket(WorldPacket const& packet, Direction direction); + void LogPacket(WorldPacket const& packet, Direction direction, boost::asio::ip::address addr, uint16 port); private: FILE* _file; diff --git a/src/server/game/Server/WorldSocket.cpp b/src/server/game/Server/WorldSocket.cpp index 9c46eac6896..e74e7806288 100644 --- a/src/server/game/Server/WorldSocket.cpp +++ b/src/server/game/Server/WorldSocket.cpp @@ -97,7 +97,7 @@ void WorldSocket::ReadDataHandler(boost::system::error_code error, size_t transf } if (sPacketLog->CanLogPacket()) - sPacketLog->LogPacket(packet, CLIENT_TO_SERVER); + sPacketLog->LogPacket(packet, CLIENT_TO_SERVER, GetRemoteIpAddress(), GetRemotePort()); TC_LOG_TRACE("network.opcode", "C->S: %s %s", (_worldSession ? _worldSession->GetPlayerInfo() : GetRemoteIpAddress().to_string()).c_str(), GetOpcodeNameForLogging(opcode).c_str()); @@ -177,7 +177,7 @@ void WorldSocket::ReadDataHandler(boost::system::error_code error, size_t transf void WorldSocket::AsyncWrite(WorldPacket& packet) { if (sPacketLog->CanLogPacket()) - sPacketLog->LogPacket(packet, SERVER_TO_CLIENT); + sPacketLog->LogPacket(packet, SERVER_TO_CLIENT, GetRemoteIpAddress(), GetRemotePort()); if (_worldSession && packet.size() > 0x400) packet.Compress(_worldSession->GetCompressionStream()); @@ -260,7 +260,7 @@ void WorldSocket::HandleAuthSession(WorldPacket& recvPacket) return; } - // Get the account information from the realmd database + // Get the account information from the auth database // 0 1 2 3 4 5 6 7 8 // SELECT id, sessionkey, last_ip, locked, expansion, mutetime, locale, recruiter, os FROM account WHERE username = ? PreparedStatement* stmt; @@ -311,7 +311,7 @@ void WorldSocket::HandleAuthSession(WorldPacket& recvPacket) // id has to be fetched at this point, so that first actual account response that fails can be logged id = fields[0].GetUInt32(); - ///- Re-check ip locking (same check as in realmd). + ///- Re-check ip locking (same check as in auth). if (fields[3].GetUInt8() == 1) // if ip is locked { if (strcmp(fields[2].GetCString(), address.c_str())) @@ -371,7 +371,7 @@ void WorldSocket::HandleAuthSession(WorldPacket& recvPacket) security = fields[0].GetUInt8(); } - // Re-check account ban (same check as in realmd) + // Re-check account ban (same check as in auth) stmt = LoginDatabase.GetPreparedStatement(LOGIN_SEL_BANS); stmt->setUInt32(0, id); diff --git a/src/server/game/World/World.cpp b/src/server/game/World/World.cpp index 14591db9eb6..3af21032cd5 100644 --- a/src/server/game/World/World.cpp +++ b/src/server/game/World/World.cpp @@ -411,9 +411,10 @@ void World::LoadConfigSettings(bool reload) { if (reload) { - if (!sConfigMgr->Reload()) + std::string configError; + if (!sConfigMgr->Reload(configError)) { - TC_LOG_ERROR("misc", "World settings reload fail: can't read settings from %s.", sConfigMgr->GetFilename().c_str()); + TC_LOG_ERROR("misc", "World settings reload fail: %s.", configError.c_str()); return; } sLog->LoadFromConfig(); diff --git a/src/server/scripts/EasternKingdoms/zone_eversong_woods.cpp b/src/server/scripts/EasternKingdoms/zone_eversong_woods.cpp index 82212972f45..9e20f6c5cb1 100644 --- a/src/server/scripts/EasternKingdoms/zone_eversong_woods.cpp +++ b/src/server/scripts/EasternKingdoms/zone_eversong_woods.cpp @@ -19,12 +19,11 @@ /* ScriptData SDName: Eversong_Woods SD%Complete: 95 -SDComment: Quest support: 8487, 8488, 8490 +SDComment: Quest support: 8490 SDCategory: Eversong Woods EndScriptData */ /* ContentData -npc_apprentice_mirveda npc_infused_crystal EndContentData */ @@ -34,152 +33,6 @@ EndContentData */ #include "ScriptedEscortAI.h" #include "Player.h" -enum UnexpectedResults -{ - // Quest - QUEST_CORRUPTED_SOIL = 8487, - QUEST_UNEXPECTED_RESULT = 8488, - - // Creatures - NPC_GHARZUL = 15958, // Quest 8488 - NPC_ANGERSHADE = 15656, // Quest 8488 - - // Factions - FACTION_NORMAL = 1604, // Quest 8488 - FACTION_COMBAT = 232, // Quest 8488 - - // Spells - SPELL_TEST_SOIL = 29535, // Quest 8487 - SPELL_FIREBALL = 20811, // Quest 8488 - - // Text - SAY_TEST_SOIL = 0, // Quest 8487 - - // Events - EVENT_TALK = 1, // Quest 8487 - EVENT_ADD_QUEST_GIVER_FLAG = 2, // Quest 8487 - EVENT_SUMMON = 3, // Quest 8488 - EVENT_FIREBALL = 4 // Quest 8488 -}; - -class npc_apprentice_mirveda : public CreatureScript -{ -public: - npc_apprentice_mirveda() : CreatureScript("npc_apprentice_mirveda") { } - - struct npc_apprentice_mirvedaAI : public ScriptedAI - { - npc_apprentice_mirvedaAI(Creature* creature) : ScriptedAI(creature), Summons(me) { } - - uint32 KillCount; - uint64 PlayerGUID; - SummonList Summons; - EventMap events; - - void Reset() override - { - SetCombatMovement(false); - KillCount = 0; - PlayerGUID = 0; - Summons.DespawnAll(); - } - - void sQuestReward(Player* /*player*/, Quest const* quest, uint32 /*opt*/) override - { - if (quest->GetQuestId() == QUEST_CORRUPTED_SOIL) - { - me->RemoveFlag(UNIT_NPC_FLAGS, UNIT_NPC_FLAG_QUESTGIVER); - events.ScheduleEvent(EVENT_TALK, 2000); - } - } - - void sQuestAccept(Player* player, Quest const* quest) override - { - if (quest->GetQuestId() == QUEST_UNEXPECTED_RESULT) - { - me->setFaction(FACTION_COMBAT); - me->RemoveFlag(UNIT_NPC_FLAGS, UNIT_NPC_FLAG_QUESTGIVER); - events.ScheduleEvent(EVENT_SUMMON, 1000); - PlayerGUID = player->GetGUID(); - } - } - - void EnterCombat(Unit* /*who*/) override - { - events.ScheduleEvent(EVENT_FIREBALL, 1000); - } - - void JustSummoned(Creature* summoned) override - { - // This is the best I can do because AttackStart does nothing - summoned->GetMotionMaster()->MovePoint(1, me->GetPositionX(), me->GetPositionY(), me->GetPositionZ()); - // summoned->AI()->AttackStart(me); - Summons.Summon(summoned); - } - - void SummonedCreatureDies(Creature* summoned, Unit* /*who*/) override - { - Summons.Despawn(summoned); - ++KillCount; - } - - void JustDied(Unit* /*killer*/) override - { - me->setFaction(FACTION_NORMAL); - - if (PlayerGUID) - if (Player* player = ObjectAccessor::GetPlayer(*me, PlayerGUID)) - player->FailQuest(QUEST_UNEXPECTED_RESULT); - } - - void UpdateAI(uint32 diff) override - { - if (KillCount >= 3 && PlayerGUID) - if (Player* player = ObjectAccessor::GetPlayer(*me, PlayerGUID)) - if (player->GetQuestStatus(QUEST_UNEXPECTED_RESULT) == QUEST_STATUS_INCOMPLETE) - { - player->CompleteQuest(QUEST_UNEXPECTED_RESULT); - me->setFaction(FACTION_NORMAL); - me->SetFlag(UNIT_NPC_FLAGS, UNIT_NPC_FLAG_QUESTGIVER); - } - - events.Update(diff); - - while (uint32 eventId = events.ExecuteEvent()) - { - switch (eventId) - { - case EVENT_TALK: - Talk(SAY_TEST_SOIL); - events.ScheduleEvent(EVENT_ADD_QUEST_GIVER_FLAG, 7000); - break; - case EVENT_ADD_QUEST_GIVER_FLAG: - me->SetFlag(UNIT_NPC_FLAGS, UNIT_NPC_FLAG_QUESTGIVER); - break; - case EVENT_SUMMON: - me->SummonCreature(NPC_GHARZUL, 8749.505f, -7132.595f, 35.31983f, 3.816502f, TEMPSUMMON_CORPSE_TIMED_DESPAWN, 180000); - me->SummonCreature(NPC_ANGERSHADE, 8755.38f, -7131.521f, 35.30957f, 3.816502f, TEMPSUMMON_CORPSE_TIMED_DESPAWN, 180000); - me->SummonCreature(NPC_ANGERSHADE, 8753.199f, -7125.975f, 35.31986f, 3.816502f, TEMPSUMMON_CORPSE_TIMED_DESPAWN, 180000); - break; - case EVENT_FIREBALL: - if (!UpdateVictim()) - continue; - DoCastVictim(SPELL_FIREBALL, true); // Not casting in combat - events.ScheduleEvent(EVENT_FIREBALL, 3000); - break; - default: - break; - } - } - DoMeleeAttackIfReady(); - } - }; - - CreatureAI* GetAI(Creature* creature) const override - { - return new npc_apprentice_mirvedaAI(creature); - } -}; /*###### ## npc_infused_crystal @@ -299,6 +152,5 @@ public: void AddSC_eversong_woods() { - new npc_apprentice_mirveda(); new npc_infused_crystal(); } diff --git a/src/server/scripts/Kalimdor/zone_bloodmyst_isle.cpp b/src/server/scripts/Kalimdor/zone_bloodmyst_isle.cpp index 05aab1ef723..81a175b57b7 100644 --- a/src/server/scripts/Kalimdor/zone_bloodmyst_isle.cpp +++ b/src/server/scripts/Kalimdor/zone_bloodmyst_isle.cpp @@ -19,14 +19,12 @@ /* ScriptData SDName: Bloodmyst_Isle SD%Complete: 80 -SDComment: Quest support: 9670, 9667 +SDComment: Quest support: 9670 SDCategory: Bloodmyst Isle EndScriptData */ /* ContentData npc_webbed_creature -npc_princess_stillpine -go_princess_stillpines_cage EndContentData */ #include "ScriptMgr.h" @@ -85,64 +83,7 @@ public: } }; -/*###### -## Quest 9667: Saving Princess Stillpine -######*/ - -enum Stillpine -{ - QUEST_SAVING_PRINCESS_STILLPINE = 9667, - NPC_PRINCESS_STILLPINE = 17682, - GO_PRINCESS_STILLPINES_CAGE = 181928, - SPELL_OPENING_PRINCESS_STILLPINE_CREDIT = 31003, - SAY_DIRECTION = 0 -}; - -class go_princess_stillpines_cage : public GameObjectScript -{ -public: - go_princess_stillpines_cage() : GameObjectScript("go_princess_stillpines_cage") { } - - bool OnGossipHello(Player* player, GameObject* go) override - { - go->SetGoState(GO_STATE_READY); - if (Creature* stillpine = go->FindNearestCreature(NPC_PRINCESS_STILLPINE, 25, true)) - { - stillpine->GetMotionMaster()->MovePoint(1, go->GetPositionX(), go->GetPositionY()-15, go->GetPositionZ()); - player->KilledMonsterCredit(NPC_PRINCESS_STILLPINE, stillpine->GetGUID()); - } - return true; - } -}; - -class npc_princess_stillpine : public CreatureScript -{ -public: - npc_princess_stillpine() : CreatureScript("npc_princess_stillpine") { } - - struct npc_princess_stillpineAI : public ScriptedAI - { - npc_princess_stillpineAI(Creature* creature) : ScriptedAI(creature) { } - - void MovementInform(uint32 type, uint32 id) override - { - if (type == POINT_MOTION_TYPE && id == 1) - { - Talk(SAY_DIRECTION); - me->DespawnOrUnsummon(); - } - } - }; - - CreatureAI* GetAI(Creature* creature) const override - { - return new npc_princess_stillpineAI(creature); - } -}; - void AddSC_bloodmyst_isle() { new npc_webbed_creature(); - new npc_princess_stillpine(); - new go_princess_stillpines_cage(); } diff --git a/src/server/scripts/OutdoorPvP/OutdoorPvPHP.cpp b/src/server/scripts/OutdoorPvP/OutdoorPvPHP.cpp index 99b782336ec..b3492b8334b 100644 --- a/src/server/scripts/OutdoorPvP/OutdoorPvPHP.cpp +++ b/src/server/scripts/OutdoorPvP/OutdoorPvPHP.cpp @@ -20,18 +20,12 @@ #include "OutdoorPvP.h" #include "OutdoorPvPMgr.h" #include "Player.h" -#include "WorldPacket.h" -#include "World.h" #include "ObjectMgr.h" -#include "Language.h" - -const uint32 HP_LANG_LOSE_A[HP_TOWER_NUM] = {LANG_OPVP_HP_LOSE_BROKENHILL_A, LANG_OPVP_HP_LOSE_OVERLOOK_A, LANG_OPVP_HP_LOSE_STADIUM_A}; - -const uint32 HP_LANG_LOSE_H[HP_TOWER_NUM] = {LANG_OPVP_HP_LOSE_BROKENHILL_H, LANG_OPVP_HP_LOSE_OVERLOOK_H, LANG_OPVP_HP_LOSE_STADIUM_H}; +#include "WorldPacket.h" -const uint32 HP_LANG_CAPTURE_A[HP_TOWER_NUM] = {LANG_OPVP_HP_CAPTURE_BROKENHILL_A, LANG_OPVP_HP_CAPTURE_OVERLOOK_A, LANG_OPVP_HP_CAPTURE_STADIUM_A}; +const uint32 HP_LANG_CAPTURE_A[HP_TOWER_NUM] = { TEXT_BROKEN_HILL_TAKEN_ALLIANCE, TEXT_OVERLOOK_TAKEN_ALLIANCE, TEXT_STADIUM_TAKEN_ALLIANCE }; -const uint32 HP_LANG_CAPTURE_H[HP_TOWER_NUM] = {LANG_OPVP_HP_CAPTURE_BROKENHILL_H, LANG_OPVP_HP_CAPTURE_OVERLOOK_H, LANG_OPVP_HP_CAPTURE_STADIUM_H}; +const uint32 HP_LANG_CAPTURE_H[HP_TOWER_NUM] = { TEXT_BROKEN_HILL_TAKEN_HORDE, TEXT_OVERLOOK_TAKEN_HORDE, TEXT_STADIUM_TAKEN_HORDE }; OPvPCapturePointHP::OPvPCapturePointHP(OutdoorPvP* pvp, OutdoorPvPHPTowerType type) : OPvPCapturePoint(pvp), m_TowerType(type) @@ -139,9 +133,7 @@ void OutdoorPvPHP::SendRemoveWorldStates(Player* player) player->SendUpdateWorldState(HP_UI_TOWER_DISPLAY_H, 0); player->SendUpdateWorldState(HP_UI_TOWER_COUNT_H, 0); player->SendUpdateWorldState(HP_UI_TOWER_COUNT_A, 0); - player->SendUpdateWorldState(HP_UI_TOWER_SLIDER_N, 0); - player->SendUpdateWorldState(HP_UI_TOWER_SLIDER_POS, 0); - player->SendUpdateWorldState(HP_UI_TOWER_SLIDER_DISPLAY, 0); + for (int i = 0; i < HP_TOWER_NUM; ++i) { player->SendUpdateWorldState(HP_MAP_N[i], 0); @@ -156,13 +148,9 @@ void OutdoorPvPHP::FillInitialWorldStates(WorldPacket &data) data << uint32(HP_UI_TOWER_DISPLAY_H) << uint32(1); data << uint32(HP_UI_TOWER_COUNT_A) << uint32(m_AllianceTowersControlled); data << uint32(HP_UI_TOWER_COUNT_H) << uint32(m_HordeTowersControlled); - data << uint32(HP_UI_TOWER_SLIDER_DISPLAY) << uint32(0); - data << uint32(HP_UI_TOWER_SLIDER_POS) << uint32(50); - data << uint32(HP_UI_TOWER_SLIDER_N) << uint32(100); + for (OPvPCapturePointMap::iterator itr = m_capturePoints.begin(); itr != m_capturePoints.end(); ++itr) - { itr->second->FillInitialWorldStates(data); - } } void OPvPCapturePointHP::ChangeState() @@ -177,13 +165,11 @@ void OPvPCapturePointHP::ChangeState() field = HP_MAP_A[m_TowerType]; if (uint32 alliance_towers = ((OutdoorPvPHP*)m_PvP)->GetAllianceTowersControlled()) ((OutdoorPvPHP*)m_PvP)->SetAllianceTowersControlled(--alliance_towers); - sWorld->SendZoneText(OutdoorPvPHPBuffZones[0], sObjectMgr->GetTrinityStringForDBCLocale(HP_LANG_LOSE_A[m_TowerType])); break; case OBJECTIVESTATE_HORDE: field = HP_MAP_H[m_TowerType]; if (uint32 horde_towers = ((OutdoorPvPHP*)m_PvP)->GetHordeTowersControlled()) ((OutdoorPvPHP*)m_PvP)->SetHordeTowersControlled(--horde_towers); - sWorld->SendZoneText(OutdoorPvPHPBuffZones[0], sObjectMgr->GetTrinityStringForDBCLocale(HP_LANG_LOSE_H[m_TowerType])); break; case OBJECTIVESTATE_NEUTRAL_ALLIANCE_CHALLENGE: field = HP_MAP_N[m_TowerType]; @@ -220,7 +206,7 @@ void OPvPCapturePointHP::ChangeState() uint32 alliance_towers = ((OutdoorPvPHP*)m_PvP)->GetAllianceTowersControlled(); if (alliance_towers < 3) ((OutdoorPvPHP*)m_PvP)->SetAllianceTowersControlled(++alliance_towers); - sWorld->SendZoneText(OutdoorPvPHPBuffZones[0], sObjectMgr->GetTrinityStringForDBCLocale(HP_LANG_CAPTURE_A[m_TowerType])); + m_PvP->SendDefenseMessage(OutdoorPvPHPBuffZones[0], HP_LANG_CAPTURE_A[m_TowerType]); break; } case OBJECTIVESTATE_HORDE: @@ -231,7 +217,7 @@ void OPvPCapturePointHP::ChangeState() uint32 horde_towers = ((OutdoorPvPHP*)m_PvP)->GetHordeTowersControlled(); if (horde_towers < 3) ((OutdoorPvPHP*)m_PvP)->SetHordeTowersControlled(++horde_towers); - sWorld->SendZoneText(OutdoorPvPHPBuffZones[0], sObjectMgr->GetTrinityStringForDBCLocale(HP_LANG_CAPTURE_H[m_TowerType])); + m_PvP->SendDefenseMessage(OutdoorPvPHPBuffZones[0], HP_LANG_CAPTURE_H[m_TowerType]); break; } case OBJECTIVESTATE_NEUTRAL_ALLIANCE_CHALLENGE: @@ -272,16 +258,6 @@ void OPvPCapturePointHP::ChangeState() SendObjectiveComplete(HP_CREDITMARKER[m_TowerType], 0); } -void OPvPCapturePointHP::SendChangePhase() -{ - SendUpdateWorldState(HP_UI_TOWER_SLIDER_N, m_neutralValuePct); - // send these updates to only the ones in this objective - uint32 phase = (uint32)ceil((m_value + m_maxValue) / (2 * m_maxValue) * 100.0f); - SendUpdateWorldState(HP_UI_TOWER_SLIDER_POS, phase); - // send this too, sometimes the slider disappears, dunno why :( - SendUpdateWorldState(HP_UI_TOWER_SLIDER_DISPLAY, 1); -} - void OPvPCapturePointHP::FillInitialWorldStates(WorldPacket &data) { switch (m_State) @@ -309,25 +285,6 @@ void OPvPCapturePointHP::FillInitialWorldStates(WorldPacket &data) } } -bool OPvPCapturePointHP::HandlePlayerEnter(Player* player) -{ - if (OPvPCapturePoint::HandlePlayerEnter(player)) - { - player->SendUpdateWorldState(HP_UI_TOWER_SLIDER_DISPLAY, 1); - uint32 phase = (uint32)ceil((m_value + m_maxValue) / (2 * m_maxValue) * 100.0f); - player->SendUpdateWorldState(HP_UI_TOWER_SLIDER_POS, phase); - player->SendUpdateWorldState(HP_UI_TOWER_SLIDER_N, m_neutralValuePct); - return true; - } - return false; -} - -void OPvPCapturePointHP::HandlePlayerLeave(Player* player) -{ - player->SendUpdateWorldState(HP_UI_TOWER_SLIDER_DISPLAY, 0); - OPvPCapturePoint::HandlePlayerLeave(player); -} - void OutdoorPvPHP::HandleKillImpl(Player* player, Unit* killed) { if (killed->GetTypeId() != TYPEID_PLAYER) @@ -362,11 +319,7 @@ void OutdoorPvPHP::SetHordeTowersControlled(uint32 count) class OutdoorPvP_hellfire_peninsula : public OutdoorPvPScript { public: - - OutdoorPvP_hellfire_peninsula() - : OutdoorPvPScript("outdoorpvp_hp") - { - } + OutdoorPvP_hellfire_peninsula() : OutdoorPvPScript("outdoorpvp_hp") { } OutdoorPvP* GetOutdoorPvP() const override { diff --git a/src/server/scripts/OutdoorPvP/OutdoorPvPHP.h b/src/server/scripts/OutdoorPvP/OutdoorPvPHP.h index fa78da4732d..5b81960b24f 100644 --- a/src/server/scripts/OutdoorPvP/OutdoorPvPHP.h +++ b/src/server/scripts/OutdoorPvP/OutdoorPvPHP.h @@ -20,6 +20,16 @@ #include "OutdoorPvP.h" +enum DefenseMessages +{ + TEXT_OVERLOOK_TAKEN_ALLIANCE = 14841, // '|cffffff00The Overlook has been taken by the Alliance!|r' + TEXT_OVERLOOK_TAKEN_HORDE = 14842, // '|cffffff00The Overlook has been taken by the Horde!|r' + TEXT_STADIUM_TAKEN_ALLIANCE = 14843, // '|cffffff00The Stadium has been taken by the Alliance!|r' + TEXT_STADIUM_TAKEN_HORDE = 14844, // '|cffffff00The Stadium has been taken by the Horde!|r' + TEXT_BROKEN_HILL_TAKEN_ALLIANCE = 14845, // '|cffffff00Broken Hill has been taken by the Alliance!|r' + TEXT_BROKEN_HILL_TAKEN_HORDE = 14846, // '|cffffff00Broken Hill has been taken by the Horde!|r' +}; + #define OutdoorPvPHPBuffZonesNum 6 // HP, citadel, ramparts, blood furnace, shattered halls, mag's lair const uint32 OutdoorPvPHPBuffZones[OutdoorPvPHPBuffZonesNum] = { 3483, 3563, 3562, 3713, 3714, 3836 }; @@ -52,11 +62,7 @@ enum OutdoorPvPHPWorldStates HP_UI_TOWER_DISPLAY_H = 0x9b9, HP_UI_TOWER_COUNT_H = 0x9ae, - HP_UI_TOWER_COUNT_A = 0x9ac, - - HP_UI_TOWER_SLIDER_N = 2475, - HP_UI_TOWER_SLIDER_POS = 2474, - HP_UI_TOWER_SLIDER_DISPLAY = 2473 + HP_UI_TOWER_COUNT_A = 0x9ac }; const uint32 HP_MAP_N[HP_TOWER_NUM] = {0x9b5, 0x9b2, 0x9a8}; @@ -88,28 +94,19 @@ const go_type HPTowerFlags[HP_TOWER_NUM] = class OPvPCapturePointHP : public OPvPCapturePoint { public: - OPvPCapturePointHP(OutdoorPvP* pvp, OutdoorPvPHPTowerType type); void ChangeState(); - void SendChangePhase(); - void FillInitialWorldStates(WorldPacket & data); - // used when player is activated/inactivated in the area - bool HandlePlayerEnter(Player* player); - void HandlePlayerLeave(Player* player); - private: - OutdoorPvPHPTowerType m_TowerType; }; class OutdoorPvPHP : public OutdoorPvP { public: - OutdoorPvPHP(); bool SetupOutdoorPvP(); @@ -132,7 +129,6 @@ class OutdoorPvPHP : public OutdoorPvP void SetHordeTowersControlled(uint32 count); private: - // how many towers are controlled uint32 m_AllianceTowersControlled; uint32 m_HordeTowersControlled; diff --git a/src/server/scripts/OutdoorPvP/OutdoorPvPNA.cpp b/src/server/scripts/OutdoorPvP/OutdoorPvPNA.cpp index 9008b0867d7..1b4828dec51 100644 --- a/src/server/scripts/OutdoorPvP/OutdoorPvPNA.cpp +++ b/src/server/scripts/OutdoorPvP/OutdoorPvPNA.cpp @@ -21,8 +21,6 @@ #include "ObjectMgr.h" #include "OutdoorPvPMgr.h" #include "WorldPacket.h" -#include "Language.h" -#include "World.h" OutdoorPvPNA::OutdoorPvPNA() { @@ -135,10 +133,6 @@ void OPvPCapturePointNA::FactionTakeOver(uint32 team) { if (m_ControllingFaction) sObjectMgr->RemoveGraveYardLink(NA_HALAA_GRAVEYARD, NA_HALAA_GRAVEYARD_ZONE, m_ControllingFaction, false); - if (m_ControllingFaction == ALLIANCE) - sWorld->SendZoneText(NA_HALAA_GRAVEYARD_ZONE, sObjectMgr->GetTrinityStringForDBCLocale(LANG_OPVP_NA_LOSE_A)); - else if (m_ControllingFaction == HORDE) - sWorld->SendZoneText(NA_HALAA_GRAVEYARD_ZONE, sObjectMgr->GetTrinityStringForDBCLocale(LANG_OPVP_NA_LOSE_H)); m_ControllingFaction = team; if (m_ControllingFaction) @@ -160,7 +154,7 @@ void OPvPCapturePointNA::FactionTakeOver(uint32 team) m_PvP->SendUpdateWorldState(NA_UI_HORDE_GUARDS_SHOW, 0); m_PvP->SendUpdateWorldState(NA_UI_ALLIANCE_GUARDS_SHOW, 1); m_PvP->SendUpdateWorldState(NA_UI_GUARDS_LEFT, m_GuardsAlive); - sWorld->SendZoneText(NA_HALAA_GRAVEYARD_ZONE, sObjectMgr->GetTrinityStringForDBCLocale(LANG_OPVP_NA_CAPTURE_A)); + m_PvP->SendDefenseMessage(NA_HALAA_GRAVEYARD_ZONE, TEXT_HALAA_TAKEN_ALLIANCE); } else { @@ -172,7 +166,7 @@ void OPvPCapturePointNA::FactionTakeOver(uint32 team) m_PvP->SendUpdateWorldState(NA_UI_HORDE_GUARDS_SHOW, 1); m_PvP->SendUpdateWorldState(NA_UI_ALLIANCE_GUARDS_SHOW, 0); m_PvP->SendUpdateWorldState(NA_UI_GUARDS_LEFT, m_GuardsAlive); - sWorld->SendZoneText(NA_HALAA_GRAVEYARD_ZONE, sObjectMgr->GetTrinityStringForDBCLocale(LANG_OPVP_NA_CAPTURE_H)); + m_PvP->SendDefenseMessage(NA_HALAA_GRAVEYARD_ZONE, TEXT_HALAA_TAKEN_HORDE); } UpdateWyvernRoostWorldState(NA_ROOST_S); UpdateWyvernRoostWorldState(NA_ROOST_N); @@ -180,25 +174,6 @@ void OPvPCapturePointNA::FactionTakeOver(uint32 team) UpdateWyvernRoostWorldState(NA_ROOST_E); } -bool OPvPCapturePointNA::HandlePlayerEnter(Player* player) -{ - if (OPvPCapturePoint::HandlePlayerEnter(player)) - { - player->SendUpdateWorldState(NA_UI_TOWER_SLIDER_DISPLAY, 1); - uint32 phase = (uint32)ceil((m_value + m_maxValue) / (2 * m_maxValue) * 100.0f); - player->SendUpdateWorldState(NA_UI_TOWER_SLIDER_POS, phase); - player->SendUpdateWorldState(NA_UI_TOWER_SLIDER_N, m_neutralValuePct); - return true; - } - return false; -} - -void OPvPCapturePointNA::HandlePlayerLeave(Player* player) -{ - player->SendUpdateWorldState(NA_UI_TOWER_SLIDER_DISPLAY, 0); - OPvPCapturePoint::HandlePlayerLeave(player); -} - OPvPCapturePointNA::OPvPCapturePointNA(OutdoorPvP* pvp) : OPvPCapturePoint(pvp), m_capturable(true), m_GuardsAlive(0), m_ControllingFaction(0), m_WyvernStateNorth(0), m_WyvernStateSouth(0), m_WyvernStateEast(0), m_WyvernStateWest(0), @@ -261,10 +236,6 @@ void OPvPCapturePointNA::FillInitialWorldStates(WorldPacket &data) data << NA_UI_GUARDS_MAX << NA_GUARDS_MAX; data << NA_UI_GUARDS_LEFT << uint32(m_GuardsAlive); - data << NA_UI_TOWER_SLIDER_DISPLAY << uint32(0); - data << NA_UI_TOWER_SLIDER_POS << uint32(50); - data << NA_UI_TOWER_SLIDER_N << uint32(100); - data << NA_MAP_WYVERN_NORTH_NEU_H << uint32((m_WyvernStateNorth & WYVERN_NEU_HORDE) != 0); data << NA_MAP_WYVERN_NORTH_NEU_A << uint32((m_WyvernStateNorth & WYVERN_NEU_ALLIANCE) != 0); data << NA_MAP_WYVERN_NORTH_H << uint32((m_WyvernStateNorth & WYVERN_HORDE) != 0); @@ -298,9 +269,6 @@ void OutdoorPvPNA::SendRemoveWorldStates(Player* player) player->SendUpdateWorldState(NA_UI_ALLIANCE_GUARDS_SHOW, 0); player->SendUpdateWorldState(NA_UI_GUARDS_MAX, 0); player->SendUpdateWorldState(NA_UI_GUARDS_LEFT, 0); - player->SendUpdateWorldState(NA_UI_TOWER_SLIDER_DISPLAY, 0); - player->SendUpdateWorldState(NA_UI_TOWER_SLIDER_POS, 0); - player->SendUpdateWorldState(NA_UI_TOWER_SLIDER_N, 0); player->SendUpdateWorldState(NA_MAP_WYVERN_NORTH_NEU_H, 0); player->SendUpdateWorldState(NA_MAP_WYVERN_NORTH_NEU_A, 0); player->SendUpdateWorldState(NA_MAP_WYVERN_NORTH_H, 0); @@ -608,16 +576,6 @@ void OPvPCapturePointNA::ChangeState() UpdateHalaaWorldState(); } -void OPvPCapturePointNA::SendChangePhase() -{ - // send this too, sometimes the slider disappears, dunno why :( - SendUpdateWorldState(NA_UI_TOWER_SLIDER_DISPLAY, 1); - // send these updates to only the ones in this objective - uint32 phase = (uint32)ceil((m_value + m_maxValue) / (2 * m_maxValue) * 100.0f); - SendUpdateWorldState(NA_UI_TOWER_SLIDER_POS, phase); - SendUpdateWorldState(NA_UI_TOWER_SLIDER_N, m_neutralValuePct); -} - void OPvPCapturePointNA::UpdateHalaaWorldState() { m_PvP->SendUpdateWorldState(NA_MAP_HALAA_NEUTRAL, uint32((m_HalaaState & HALAA_N) != 0)); @@ -661,11 +619,7 @@ void OPvPCapturePointNA::UpdateWyvernRoostWorldState(uint32 roost) class OutdoorPvP_nagrand : public OutdoorPvPScript { public: - - OutdoorPvP_nagrand() - : OutdoorPvPScript("outdoorpvp_na") - { - } + OutdoorPvP_nagrand() : OutdoorPvPScript("outdoorpvp_na") { } OutdoorPvP* GetOutdoorPvP() const override { diff --git a/src/server/scripts/OutdoorPvP/OutdoorPvPNA.h b/src/server/scripts/OutdoorPvP/OutdoorPvPNA.h index 011775e1715..aa52c8135e7 100644 --- a/src/server/scripts/OutdoorPvP/OutdoorPvPNA.h +++ b/src/server/scripts/OutdoorPvP/OutdoorPvPNA.h @@ -20,6 +20,16 @@ #include "OutdoorPvP.h" +enum DefenseMessages +{ + TEXT_ALL_GUARDS_DEFEATED = 15017, // (NYI) '|cffffff00All the guards have been defeated!|r' + TEXT_HALAA_TAKEN_ALLIANCE = 15018, // '|cffffff00The Alliance has taken control of Halaa!|r' + TEXT_HALAA_TAKEN_HORDE = 15019, // '|cffffff00The Horde has taken control of Halaa!|r' + TEXT_HALAA_DEFENSELESS = 15020, // (NYI) '|cffffff00Halaa is defenseless!|r' + TEXT_HALAA_GAINING_CONTROL_HORDE = 15493, // (NYI) '|cffffff00The Horde is gaining control of Halaa!|r' + TEXT_HALAA_GAINING_CONTROL_ALLIANCE = 15494 // (NYI) '|cffffff00The Alliance is gaining control of Halaa!|r' +}; + /// @todo "sometimes" set to neutral enum OutdoorPvPNASpells @@ -51,10 +61,6 @@ enum OutdoorPvPNAWorldStates NA_UI_GUARDS_MAX = 2493, NA_UI_GUARDS_LEFT = 2491, - NA_UI_TOWER_SLIDER_DISPLAY = 2495, - NA_UI_TOWER_SLIDER_POS = 2494, - NA_UI_TOWER_SLIDER_N = 2497, - NA_MAP_WYVERN_NORTH_NEU_H = 2762, NA_MAP_WYVERN_NORTH_NEU_A = 2662, NA_MAP_WYVERN_NORTH_H = 2663, @@ -253,21 +259,14 @@ class OutdoorPvPNA; class OPvPCapturePointNA : public OPvPCapturePoint { public: - OPvPCapturePointNA(OutdoorPvP* pvp); bool Update(uint32 diff); void ChangeState(); - void SendChangePhase(); - void FillInitialWorldStates(WorldPacket & data); - // used when player is activated/inactivated in the area - bool HandlePlayerEnter(Player* player); - void HandlePlayerLeave(Player* player); - bool HandleCustomSpell(Player* player, uint32 spellId, GameObject* go); int32 HandleOpenGo(Player* player, uint64 guid); @@ -276,7 +275,6 @@ class OPvPCapturePointNA : public OPvPCapturePoint uint32 GetControllingFaction() const; protected: - // called when a faction takes control void FactionTakeOver(uint32 team); @@ -290,7 +288,6 @@ class OPvPCapturePointNA : public OPvPCapturePoint void UpdateHalaaWorldState(); private: - bool m_capturable; uint32 m_GuardsAlive; @@ -312,7 +309,6 @@ class OPvPCapturePointNA : public OPvPCapturePoint class OutdoorPvPNA : public OutdoorPvP { public: - OutdoorPvPNA(); bool SetupOutdoorPvP(); @@ -329,7 +325,6 @@ class OutdoorPvPNA : public OutdoorPvP void HandleKillImpl(Player* player, Unit* killed); private: - OPvPCapturePointNA * m_obj; }; diff --git a/src/server/scripts/OutdoorPvP/OutdoorPvPSI.cpp b/src/server/scripts/OutdoorPvP/OutdoorPvPSI.cpp index b43904f2223..62108feaeeb 100644 --- a/src/server/scripts/OutdoorPvP/OutdoorPvPSI.cpp +++ b/src/server/scripts/OutdoorPvP/OutdoorPvPSI.cpp @@ -95,6 +95,7 @@ bool OutdoorPvPSI::HandleAreaTrigger(Player* player, uint32 trigger) if (m_Gathered_A >= SI_MAX_RESOURCES) { TeamApplyBuff(TEAM_ALLIANCE, SI_CENARION_FAVOR); + /// @todo: confirm this text sWorld->SendZoneText(OutdoorPvPSIBuffZones[0], sObjectMgr->GetTrinityStringForDBCLocale(LANG_OPVP_SI_CAPTURE_A)); m_LastController = ALLIANCE; m_Gathered_A = 0; @@ -120,6 +121,7 @@ bool OutdoorPvPSI::HandleAreaTrigger(Player* player, uint32 trigger) if (m_Gathered_H >= SI_MAX_RESOURCES) { TeamApplyBuff(TEAM_HORDE, SI_CENARION_FAVOR); + /// @todo: confirm this text sWorld->SendZoneText(OutdoorPvPSIBuffZones[0], sObjectMgr->GetTrinityStringForDBCLocale(LANG_OPVP_SI_CAPTURE_H)); m_LastController = HORDE; m_Gathered_A = 0; @@ -244,11 +246,7 @@ bool OutdoorPvPSI::HandleCustomSpell(Player* player, uint32 spellId, GameObject* class OutdoorPvP_silithus : public OutdoorPvPScript { public: - - OutdoorPvP_silithus() - : OutdoorPvPScript("outdoorpvp_si") - { - } + OutdoorPvP_silithus() : OutdoorPvPScript("outdoorpvp_si") { } OutdoorPvP* GetOutdoorPvP() const override { diff --git a/src/server/scripts/OutdoorPvP/OutdoorPvPSI.h b/src/server/scripts/OutdoorPvP/OutdoorPvPSI.h index 050bd6e8889..fdab0a292bd 100644 --- a/src/server/scripts/OutdoorPvP/OutdoorPvPSI.h +++ b/src/server/scripts/OutdoorPvP/OutdoorPvPSI.h @@ -54,7 +54,6 @@ enum SI_WorldStates class OutdoorPvPSI : public OutdoorPvP { public: - OutdoorPvPSI(); bool SetupOutdoorPvP(); @@ -77,7 +76,6 @@ class OutdoorPvPSI : public OutdoorPvP void UpdateWorldState(); private: - uint32 m_Gathered_A; uint32 m_Gathered_H; diff --git a/src/server/scripts/OutdoorPvP/OutdoorPvPTF.cpp b/src/server/scripts/OutdoorPvP/OutdoorPvPTF.cpp index c8c707a1958..e089dfdb7d5 100644 --- a/src/server/scripts/OutdoorPvP/OutdoorPvPTF.cpp +++ b/src/server/scripts/OutdoorPvP/OutdoorPvPTF.cpp @@ -22,8 +22,6 @@ #include "WorldPacket.h" #include "Player.h" #include "ObjectMgr.h" -#include "Language.h" -#include "World.h" OutdoorPvPTF::OutdoorPvPTF() { @@ -56,10 +54,6 @@ void OPvPCapturePointTF::FillInitialWorldStates(WorldPacket &data) void OutdoorPvPTF::FillInitialWorldStates(WorldPacket &data) { - data << TF_UI_TOWER_SLIDER_POS << uint32(50); - data << TF_UI_TOWER_SLIDER_N << uint32(100); - data << TF_UI_TOWER_SLIDER_DISPLAY << uint32(0); - data << TF_UI_TOWER_COUNT_H << m_HordeTowersControlled; data << TF_UI_TOWER_COUNT_A << m_AllianceTowersControlled; data << TF_UI_TOWERS_CONTROLLED_DISPLAY << uint32(!m_IsLocked); @@ -80,10 +74,6 @@ void OutdoorPvPTF::FillInitialWorldStates(WorldPacket &data) void OutdoorPvPTF::SendRemoveWorldStates(Player* player) { - player->SendUpdateWorldState(TF_UI_TOWER_SLIDER_POS, uint32(0)); - player->SendUpdateWorldState(TF_UI_TOWER_SLIDER_N, uint32(0)); - player->SendUpdateWorldState(TF_UI_TOWER_SLIDER_DISPLAY, uint32(0)); - player->SendUpdateWorldState(TF_UI_TOWER_COUNT_H, uint32(0)); player->SendUpdateWorldState(TF_UI_TOWER_COUNT_A, uint32(0)); player->SendUpdateWorldState(TF_UI_TOWERS_CONTROLLED_DISPLAY, uint32(0)); @@ -111,25 +101,6 @@ void OPvPCapturePointTF::UpdateTowerState() m_PvP->SendUpdateWorldState(uint32(TFTowerWorldStates[m_TowerType].a), uint32((m_TowerState & TF_TOWERSTATE_A) != 0)); } -bool OPvPCapturePointTF::HandlePlayerEnter(Player* player) -{ - if (OPvPCapturePoint::HandlePlayerEnter(player)) - { - player->SendUpdateWorldState(TF_UI_TOWER_SLIDER_DISPLAY, 1); - uint32 phase = (uint32)ceil((m_value + m_maxValue) / (2 * m_maxValue) * 100.0f); - player->SendUpdateWorldState(TF_UI_TOWER_SLIDER_POS, phase); - player->SendUpdateWorldState(TF_UI_TOWER_SLIDER_N, m_neutralValuePct); - return true; - } - return false; -} - -void OPvPCapturePointTF::HandlePlayerLeave(Player* player) -{ - player->SendUpdateWorldState(TF_UI_TOWER_SLIDER_DISPLAY, 0); - OPvPCapturePoint::HandlePlayerLeave(player); -} - bool OutdoorPvPTF::Update(uint32 diff) { bool changed = OutdoorPvP::Update(diff); @@ -286,14 +257,14 @@ void OPvPCapturePointTF::ChangeState() { if (uint32 alliance_towers = ((OutdoorPvPTF*)m_PvP)->GetAllianceTowersControlled()) ((OutdoorPvPTF*)m_PvP)->SetAllianceTowersControlled(--alliance_towers); - sWorld->SendZoneText(OutdoorPvPTFBuffZones[0], sObjectMgr->GetTrinityStringForDBCLocale(LANG_OPVP_TF_LOSE_A)); + m_PvP->SendDefenseMessage(OutdoorPvPTFBuffZones[0], TEXT_SPIRIT_TOWER_LOSE_ALLIANCE); } // if changing from controlling horde to alliance else if (m_OldState == OBJECTIVESTATE_HORDE) { if (uint32 horde_towers = ((OutdoorPvPTF*)m_PvP)->GetHordeTowersControlled()) ((OutdoorPvPTF*)m_PvP)->SetHordeTowersControlled(--horde_towers); - sWorld->SendZoneText(OutdoorPvPTFBuffZones[0], sObjectMgr->GetTrinityStringForDBCLocale(LANG_OPVP_TF_LOSE_H)); + m_PvP->SendDefenseMessage(OutdoorPvPTFBuffZones[0], TEXT_SPIRIT_TOWER_LOSE_HORDE); } uint32 artkit = 21; @@ -308,7 +279,7 @@ void OPvPCapturePointTF::ChangeState() if (alliance_towers < TF_TOWER_NUM) ((OutdoorPvPTF*)m_PvP)->SetAllianceTowersControlled(++alliance_towers); - sWorld->SendZoneText(OutdoorPvPTFBuffZones[0], sObjectMgr->GetTrinityStringForDBCLocale(LANG_OPVP_TF_CAPTURE_A)); + m_PvP->SendDefenseMessage(OutdoorPvPTFBuffZones[0], TEXT_SPIRIT_TOWER_TAKEN_ALLIANCE); for (PlayerSet::iterator itr = m_activePlayers[0].begin(); itr != m_activePlayers[0].end(); ++itr) if (Player* player = ObjectAccessor::FindPlayer(*itr)) @@ -323,7 +294,7 @@ void OPvPCapturePointTF::ChangeState() if (horde_towers < TF_TOWER_NUM) ((OutdoorPvPTF*)m_PvP)->SetHordeTowersControlled(++horde_towers); - sWorld->SendZoneText(OutdoorPvPTFBuffZones[0], sObjectMgr->GetTrinityStringForDBCLocale(LANG_OPVP_TF_CAPTURE_H)); + m_PvP->SendDefenseMessage(OutdoorPvPTFBuffZones[0], TEXT_SPIRIT_TOWER_TAKEN_HORDE); for (PlayerSet::iterator itr = m_activePlayers[1].begin(); itr != m_activePlayers[1].end(); ++itr) if (Player* player = ObjectAccessor::FindPlayer(*itr)) @@ -346,25 +317,10 @@ void OPvPCapturePointTF::ChangeState() UpdateTowerState(); } -void OPvPCapturePointTF::SendChangePhase() -{ - // send this too, sometimes the slider disappears, dunno why :( - SendUpdateWorldState(TF_UI_TOWER_SLIDER_DISPLAY, 1); - // send these updates to only the ones in this objective - uint32 phase = (uint32)ceil((m_value + m_maxValue) / (2 * m_maxValue) * 100.0f); - SendUpdateWorldState(TF_UI_TOWER_SLIDER_POS, phase); - // send this too, sometimes it resets :S - SendUpdateWorldState(TF_UI_TOWER_SLIDER_N, m_neutralValuePct); -} - class OutdoorPvP_terokkar_forest : public OutdoorPvPScript { public: - - OutdoorPvP_terokkar_forest() - : OutdoorPvPScript("outdoorpvp_tf") - { - } + OutdoorPvP_terokkar_forest() : OutdoorPvPScript("outdoorpvp_tf") { } OutdoorPvP* GetOutdoorPvP() const override { diff --git a/src/server/scripts/OutdoorPvP/OutdoorPvPTF.h b/src/server/scripts/OutdoorPvP/OutdoorPvPTF.h index 2c4ad0445be..ef400452e63 100644 --- a/src/server/scripts/OutdoorPvP/OutdoorPvPTF.h +++ b/src/server/scripts/OutdoorPvP/OutdoorPvPTF.h @@ -20,6 +20,16 @@ #include "OutdoorPvP.h" +enum DefenseMessages +{ + TEXT_BONE_WASTES_TAKEN_ALLIANCE = 16120, // (NYI) '|cffffff00The Alliance has taken control of The Bone Wastes!|r' + TEXT_BONE_WASTES_TAKEN_HORDE = 16119, // (NYI) '|cffffff00The Horde has taken control of The Bone Wastes!|r' + TEXT_SPIRIT_TOWER_TAKEN_ALLIANCE = 18285, // '|cffffff00The Alliance has taken control of a Spirit Tower!|r' + TEXT_SPIRIT_TOWER_TAKEN_HORDE = 18286, // '|cffffff00The Horde has taken control of a Spirit Tower!|r' + TEXT_SPIRIT_TOWER_LOSE_ALLIANCE = 18288, // '|cffffff00The Alliance has lost control of a Spirit Tower!|r' + TEXT_SPIRIT_TOWER_LOSE_HORDE = 18287 // '|cffffff00The Horde has lost control of a Spirit Tower!|r' +}; + const uint8 OutdoorPvPTFBuffZonesNum = 5; const uint32 OutdoorPvPTFBuffZones[OutdoorPvPTFBuffZonesNum] = @@ -98,10 +108,6 @@ const uint32 TFTowerPlayerLeaveEvents[TF_TOWER_NUM] = enum TFWorldStates { - TF_UI_TOWER_SLIDER_POS = 0xa41, - TF_UI_TOWER_SLIDER_N = 0xa40, - TF_UI_TOWER_SLIDER_DISPLAY = 0xa3f, - TF_UI_TOWER_COUNT_H = 0xa3e, TF_UI_TOWER_COUNT_A = 0xa3d, TF_UI_TOWERS_CONTROLLED_DISPLAY = 0xa3c, @@ -124,25 +130,17 @@ enum TFTowerStates class OPvPCapturePointTF : public OPvPCapturePoint { public: - OPvPCapturePointTF(OutdoorPvP* pvp, OutdoorPvPTF_TowerType type); bool Update(uint32 diff); void ChangeState(); - void SendChangePhase(); - void FillInitialWorldStates(WorldPacket & data); - // used when player is activated/inactivated in the area - bool HandlePlayerEnter(Player* player); - void HandlePlayerLeave(Player* player); - void UpdateTowerState(); protected: - OutdoorPvPTF_TowerType m_TowerType; uint32 m_TowerState; @@ -151,7 +149,6 @@ class OPvPCapturePointTF : public OPvPCapturePoint class OutdoorPvPTF : public OutdoorPvP { public: - OutdoorPvPTF(); bool SetupOutdoorPvP(); @@ -174,7 +171,6 @@ class OutdoorPvPTF : public OutdoorPvP bool IsLocked() const; private: - bool m_IsLocked; uint32 m_LockTimer; uint32 m_LockTimerUpdate; diff --git a/src/server/scripts/OutdoorPvP/OutdoorPvPZM.cpp b/src/server/scripts/OutdoorPvP/OutdoorPvPZM.cpp index d54a4f7d4d7..d6ee91ff2a9 100644 --- a/src/server/scripts/OutdoorPvP/OutdoorPvPZM.cpp +++ b/src/server/scripts/OutdoorPvP/OutdoorPvPZM.cpp @@ -24,7 +24,6 @@ #include "ObjectAccessor.h" #include "WorldPacket.h" #include "GossipDef.h" -#include "World.h" OPvPCapturePointZM_Beacon::OPvPCapturePointZM_Beacon(OutdoorPvP* pvp, ZM_BeaconType type) : OPvPCapturePoint(pvp), m_TowerType(type), m_TowerState(ZM_TOWERSTATE_N) @@ -52,25 +51,6 @@ void OPvPCapturePointZM_Beacon::UpdateTowerState() m_PvP->SendUpdateWorldState(uint32(ZMBeaconInfo[m_TowerType].map_tower_h), uint32((m_TowerState & ZM_TOWERSTATE_H) != 0)); } -bool OPvPCapturePointZM_Beacon::HandlePlayerEnter(Player* player) -{ - if (OPvPCapturePoint::HandlePlayerEnter(player)) - { - player->SendUpdateWorldState(ZMBeaconInfo[m_TowerType].slider_disp, 1); - uint32 phase = (uint32)ceil((m_value + m_maxValue) / (2 * m_maxValue) * 100.0f); - player->SendUpdateWorldState(ZMBeaconInfo[m_TowerType].slider_pos, phase); - player->SendUpdateWorldState(ZMBeaconInfo[m_TowerType].slider_n, m_neutralValuePct); - return true; - } - return false; -} - -void OPvPCapturePointZM_Beacon::HandlePlayerLeave(Player* player) -{ - player->SendUpdateWorldState(ZMBeaconInfo[m_TowerType].slider_disp, 0); - OPvPCapturePoint::HandlePlayerLeave(player); -} - void OPvPCapturePointZM_Beacon::ChangeState() { // if changing from controlling alliance to horde @@ -78,14 +58,12 @@ void OPvPCapturePointZM_Beacon::ChangeState() { if (uint32 alliance_towers = ((OutdoorPvPZM*)m_PvP)->GetAllianceTowersControlled()) ((OutdoorPvPZM*)m_PvP)->SetAllianceTowersControlled(--alliance_towers); - sWorld->SendZoneText(ZM_GRAVEYARD_ZONE, sObjectMgr->GetTrinityStringForDBCLocale(ZMBeaconLoseA[m_TowerType])); } // if changing from controlling horde to alliance else if (m_OldState == OBJECTIVESTATE_HORDE) { if (uint32 horde_towers = ((OutdoorPvPZM*)m_PvP)->GetHordeTowersControlled()) ((OutdoorPvPZM*)m_PvP)->SetHordeTowersControlled(--horde_towers); - sWorld->SendZoneText(ZM_GRAVEYARD_ZONE, sObjectMgr->GetTrinityStringForDBCLocale(ZMBeaconLoseH[m_TowerType])); } switch (m_State) @@ -96,7 +74,7 @@ void OPvPCapturePointZM_Beacon::ChangeState() uint32 alliance_towers = ((OutdoorPvPZM*)m_PvP)->GetAllianceTowersControlled(); if (alliance_towers < ZM_NUM_BEACONS) ((OutdoorPvPZM*)m_PvP)->SetAllianceTowersControlled(++alliance_towers); - sWorld->SendZoneText(ZM_GRAVEYARD_ZONE, sObjectMgr->GetTrinityStringForDBCLocale(ZMBeaconCaptureA[m_TowerType])); + m_PvP->SendDefenseMessage(ZM_GRAVEYARD_ZONE, ZMBeaconCaptureA[m_TowerType]); break; } case OBJECTIVESTATE_HORDE: @@ -105,7 +83,7 @@ void OPvPCapturePointZM_Beacon::ChangeState() uint32 horde_towers = ((OutdoorPvPZM*)m_PvP)->GetHordeTowersControlled(); if (horde_towers < ZM_NUM_BEACONS) ((OutdoorPvPZM*)m_PvP)->SetHordeTowersControlled(++horde_towers); - sWorld->SendZoneText(ZM_GRAVEYARD_ZONE, sObjectMgr->GetTrinityStringForDBCLocale(ZMBeaconCaptureH[m_TowerType])); + m_PvP->SendDefenseMessage(ZM_GRAVEYARD_ZONE, ZMBeaconCaptureH[m_TowerType]); break; } case OBJECTIVESTATE_NEUTRAL: @@ -120,16 +98,6 @@ void OPvPCapturePointZM_Beacon::ChangeState() UpdateTowerState(); } -void OPvPCapturePointZM_Beacon::SendChangePhase() -{ - // send this too, sometimes the slider disappears, dunno why :( - SendUpdateWorldState(ZMBeaconInfo[m_TowerType].slider_disp, 1); - // send these updates to only the ones in this objective - uint32 phase = (uint32)ceil((m_value + m_maxValue) / (2 * m_maxValue) * 100.0f); - SendUpdateWorldState(ZMBeaconInfo[m_TowerType].slider_pos, phase); - SendUpdateWorldState(ZMBeaconInfo[m_TowerType].slider_n, m_neutralValuePct); -} - bool OutdoorPvPZM::Update(uint32 diff) { bool changed = OutdoorPvP::Update(diff); @@ -220,8 +188,6 @@ int32 OPvPCapturePointZM_GraveYard::HandleOpenGo(Player* player, uint64 guid) { if (player->HasAura(ZM_BATTLE_STANDARD_A) && m_GraveYardState != ZM_GRAVEYARD_A) { - if (m_GraveYardState == ZM_GRAVEYARD_H) - sWorld->SendZoneText(ZM_GRAVEYARD_ZONE, sObjectMgr->GetTrinityStringForDBCLocale(LANG_OPVP_ZM_LOSE_GY_H)); m_GraveYardState = ZM_GRAVEYARD_A; DelObject(0); // only one gotype is used in the whole outdoor pvp, no need to call it a constant AddObject(0, ZM_Banner_A.entry, ZM_Banner_A.map, ZM_Banner_A.x, ZM_Banner_A.y, ZM_Banner_A.z, ZM_Banner_A.o, ZM_Banner_A.rot0, ZM_Banner_A.rot1, ZM_Banner_A.rot2, ZM_Banner_A.rot3); @@ -229,12 +195,10 @@ int32 OPvPCapturePointZM_GraveYard::HandleOpenGo(Player* player, uint64 guid) sObjectMgr->AddGraveYardLink(ZM_GRAVEYARD_ID, ZM_GRAVEYARD_ZONE, ALLIANCE, false); // add gy m_PvP->TeamApplyBuff(TEAM_ALLIANCE, ZM_CAPTURE_BUFF); player->RemoveAurasDueToSpell(ZM_BATTLE_STANDARD_A); - sWorld->SendZoneText(ZM_GRAVEYARD_ZONE, sObjectMgr->GetTrinityStringForDBCLocale(LANG_OPVP_ZM_CAPTURE_GY_A)); + m_PvP->SendDefenseMessage(ZM_GRAVEYARD_ZONE, TEXT_TWIN_SPIRE_RUINS_TAKEN_ALLIANCE); } else if (player->HasAura(ZM_BATTLE_STANDARD_H) && m_GraveYardState != ZM_GRAVEYARD_H) { - if (m_GraveYardState == ZM_GRAVEYARD_A) - sWorld->SendZoneText(ZM_GRAVEYARD_ZONE, sObjectMgr->GetTrinityStringForDBCLocale(LANG_OPVP_ZM_LOSE_GY_A)); m_GraveYardState = ZM_GRAVEYARD_H; DelObject(0); // only one gotype is used in the whole outdoor pvp, no need to call it a constant AddObject(0, ZM_Banner_H.entry, ZM_Banner_H.map, ZM_Banner_H.x, ZM_Banner_H.y, ZM_Banner_H.z, ZM_Banner_H.o, ZM_Banner_H.rot0, ZM_Banner_H.rot1, ZM_Banner_H.rot2, ZM_Banner_H.rot3); @@ -242,7 +206,7 @@ int32 OPvPCapturePointZM_GraveYard::HandleOpenGo(Player* player, uint64 guid) sObjectMgr->AddGraveYardLink(ZM_GRAVEYARD_ID, ZM_GRAVEYARD_ZONE, HORDE, false); // add gy m_PvP->TeamApplyBuff(TEAM_HORDE, ZM_CAPTURE_BUFF); player->RemoveAurasDueToSpell(ZM_BATTLE_STANDARD_H); - sWorld->SendZoneText(ZM_GRAVEYARD_ZONE, sObjectMgr->GetTrinityStringForDBCLocale(LANG_OPVP_ZM_CAPTURE_GY_H)); + m_PvP->SendDefenseMessage(ZM_GRAVEYARD_ZONE, TEXT_TWIN_SPIRE_RUINS_TAKEN_HORDE); } UpdateTowerState(); } @@ -415,20 +379,13 @@ void OutdoorPvPZM::SetHordeTowersControlled(uint32 count) void OutdoorPvPZM::FillInitialWorldStates(WorldPacket &data) { data << ZM_WORLDSTATE_UNK_1 << uint32(1); + for (OPvPCapturePointMap::iterator itr = m_capturePoints.begin(); itr != m_capturePoints.end(); ++itr) - { itr->second->FillInitialWorldStates(data); - } } void OutdoorPvPZM::SendRemoveWorldStates(Player* player) { - player->SendUpdateWorldState(ZM_UI_TOWER_SLIDER_N_W, 0); - player->SendUpdateWorldState(ZM_UI_TOWER_SLIDER_POS_W, 0); - player->SendUpdateWorldState(ZM_UI_TOWER_SLIDER_DISPLAY_W, 0); - player->SendUpdateWorldState(ZM_UI_TOWER_SLIDER_N_E, 0); - player->SendUpdateWorldState(ZM_UI_TOWER_SLIDER_POS_E, 0); - player->SendUpdateWorldState(ZM_UI_TOWER_SLIDER_DISPLAY_E, 0); player->SendUpdateWorldState(ZM_WORLDSTATE_UNK_1, 1); player->SendUpdateWorldState(ZM_UI_TOWER_EAST_N, 0); player->SendUpdateWorldState(ZM_UI_TOWER_EAST_H, 0); @@ -454,11 +411,7 @@ void OutdoorPvPZM::SendRemoveWorldStates(Player* player) class OutdoorPvP_zangarmarsh : public OutdoorPvPScript { public: - - OutdoorPvP_zangarmarsh() - : OutdoorPvPScript("outdoorpvp_zm") - { - } + OutdoorPvP_zangarmarsh() : OutdoorPvPScript("outdoorpvp_zm") { } OutdoorPvP* GetOutdoorPvP() const override { diff --git a/src/server/scripts/OutdoorPvP/OutdoorPvPZM.h b/src/server/scripts/OutdoorPvP/OutdoorPvPZM.h index fdd093a1bfe..eef1ff9cc3b 100644 --- a/src/server/scripts/OutdoorPvP/OutdoorPvPZM.h +++ b/src/server/scripts/OutdoorPvP/OutdoorPvPZM.h @@ -18,9 +18,22 @@ #ifndef OUTDOOR_PVP_ZM_ #define OUTDOOR_PVP_ZM_ -#include "Language.h" #include "OutdoorPvP.h" +enum DefenseMessages +{ + TEXT_WEST_BEACON_TAKEN_ALLIANCE = 15541, // '|cffffff00The Alliance has taken control of the West Beacon!|r' + TEXT_WEST_BEACON_TAKEN_HORDE = 15543, // '|cffffff00The Horde has taken control of the West Beacon!|r' + TEXT_EAST_BEACON_TAKEN_ALLIANCE = 15546, // '|cffffff00The Alliance has taken control of the East Beacon!|r' + TEXT_EAST_BEACON_TAKEN_HORDE = 15545, // '|cffffff00The Horde has taken control of the East Beacon!|r' + TEXT_TWIN_SPIRE_RUINS_TAKEN_ALLIANCE = 15591, // '|cffffff00The Alliance has taken control of Twin Spire Ruins!|r' + TEXT_TWIN_SPIRE_RUINS_TAKEN_HORDE = 15590, // '|cffffff00The Horde has taken control of Twin Spire Ruins!|r' + TEXT_BOTH_BEACONS_TAKEN_ALLIANCE = 16284, // (NYI) '|cffffff00The Alliance has taken control of both beacons!|r' + TEXT_BOTH_BEACONS_TAKEN_HORDE = 16285, // (NYI) '|cffffff00The Horde has taken control of both beacons!|r' + TEXT_BATTLE_STANDARDS_ALLIANCE = 16287, // (NYI) '|cffffff00The Alliance Field Scout is now issuing battle standards.|r' + TEXT_BATTLE_STANDARDS_HORDE = 16288 // (NYI) '|cffffff00The Horde Field Scout is now issuing battle standards.|r' +}; + const uint8 OutdoorPvPZMBuffZonesNum = 5; // the buff is cast in these zones @@ -66,9 +79,6 @@ enum ZMCreatureTypes struct zm_beacon { - uint32 slider_disp; - uint32 slider_n; - uint32 slider_pos; uint32 ui_tower_n; uint32 ui_tower_h; uint32 ui_tower_a; @@ -88,32 +98,20 @@ enum ZM_BeaconType const zm_beacon ZMBeaconInfo[ZM_NUM_BEACONS] = { - {2533, 2535, 2534, 2560, 2559, 2558, 2652, 2651, 2650, 11807, 11806}, - {2527, 2529, 2528, 2557, 2556, 2555, 2646, 2645, 2644, 11805, 11804} + {2560, 2559, 2558, 2652, 2651, 2650, 11807, 11806}, + {2557, 2556, 2555, 2646, 2645, 2644, 11805, 11804} }; const uint32 ZMBeaconCaptureA[ZM_NUM_BEACONS] = { - LANG_OPVP_ZM_CAPTURE_EAST_A, - LANG_OPVP_ZM_CAPTURE_WEST_A + TEXT_EAST_BEACON_TAKEN_ALLIANCE, + TEXT_WEST_BEACON_TAKEN_ALLIANCE }; const uint32 ZMBeaconCaptureH[ZM_NUM_BEACONS] = { - LANG_OPVP_ZM_CAPTURE_EAST_H, - LANG_OPVP_ZM_CAPTURE_WEST_H -}; - -const uint32 ZMBeaconLoseA[ZM_NUM_BEACONS] = -{ - LANG_OPVP_ZM_LOSE_EAST_A, - LANG_OPVP_ZM_LOSE_WEST_A -}; - -const uint32 ZMBeaconLoseH[ZM_NUM_BEACONS] = -{ - LANG_OPVP_ZM_LOSE_EAST_H, - LANG_OPVP_ZM_LOSE_WEST_H + TEXT_EAST_BEACON_TAKEN_HORDE, + TEXT_WEST_BEACON_TAKEN_HORDE }; const go_type ZMCapturePoints[ZM_NUM_BEACONS] = @@ -124,14 +122,6 @@ const go_type ZMCapturePoints[ZM_NUM_BEACONS] = enum OutdoorPvPZMWorldStates { - ZM_UI_TOWER_SLIDER_N_W = 2529, - ZM_UI_TOWER_SLIDER_POS_W = 2528, - ZM_UI_TOWER_SLIDER_DISPLAY_W = 2527, - - ZM_UI_TOWER_SLIDER_N_E = 2535, - ZM_UI_TOWER_SLIDER_POS_E = 2534, - ZM_UI_TOWER_SLIDER_DISPLAY_E = 2533, - ZM_WORLDSTATE_UNK_1 = 2653, ZM_UI_TOWER_EAST_N = 2560, @@ -169,23 +159,15 @@ class OutdoorPvPZM; class OPvPCapturePointZM_Beacon : public OPvPCapturePoint { public: - OPvPCapturePointZM_Beacon(OutdoorPvP* pvp, ZM_BeaconType type); void ChangeState(); - void SendChangePhase(); - void FillInitialWorldStates(WorldPacket & data); - // used when player is activated/inactivated in the area - bool HandlePlayerEnter(Player* player); - void HandlePlayerLeave(Player* player); - void UpdateTowerState(); protected: - ZM_BeaconType m_TowerType; uint32 m_TowerState; }; @@ -200,7 +182,6 @@ enum ZM_GraveYardState class OPvPCapturePointZM_GraveYard : public OPvPCapturePoint { public: - OPvPCapturePointZM_GraveYard(OutdoorPvP* pvp); bool Update(uint32 diff); @@ -224,11 +205,9 @@ class OPvPCapturePointZM_GraveYard : public OPvPCapturePoint uint32 GetGraveYardState() const; private: - uint32 m_GraveYardState; protected: - uint32 m_BothControllingFaction; uint64 m_FlagCarrierGUID; @@ -237,7 +216,6 @@ class OPvPCapturePointZM_GraveYard : public OPvPCapturePoint class OutdoorPvPZM : public OutdoorPvP { public: - OutdoorPvPZM(); bool SetupOutdoorPvP(); @@ -260,7 +238,6 @@ class OutdoorPvPZM : public OutdoorPvP void SetHordeTowersControlled(uint32 count); private: - OPvPCapturePointZM_GraveYard * m_GraveYard; uint32 m_AllianceTowersControlled; diff --git a/src/server/shared/Configuration/Config.cpp b/src/server/shared/Configuration/Config.cpp index ecebf30182e..6b83f562520 100644 --- a/src/server/shared/Configuration/Config.cpp +++ b/src/server/shared/Configuration/Config.cpp @@ -25,7 +25,7 @@ using namespace boost::property_tree; -bool ConfigMgr::LoadInitial(std::string const& file) +bool ConfigMgr::LoadInitial(std::string const& file, std::string& error) { std::lock_guard<std::mutex> lock(_configLock); @@ -34,25 +34,32 @@ bool ConfigMgr::LoadInitial(std::string const& file) try { ptree fullTree; - boost::property_tree::ini_parser::read_ini(file, fullTree); + ini_parser::read_ini(file, fullTree); if (fullTree.empty()) + { + error = "empty file (" + file + ")"; return false; + } // Since we're using only one section per config file, we skip the section and have direct property access _config = fullTree.begin()->second; } - catch (std::exception const& /*ex*/) + catch (ini_parser::ini_parser_error const& e) { + if (e.line() == 0) + error = e.message() + " (" + e.filename() + ")"; + else + error = e.message() + " (" + e.filename() + ":" + std::to_string(e.line()) + ")"; return false; } return true; } -bool ConfigMgr::Reload() +bool ConfigMgr::Reload(std::string& error) { - return LoadInitial(_filename.c_str()); + return LoadInitial(_filename.c_str(), error); } std::string ConfigMgr::GetStringDefault(std::string const& name, const std::string& def) diff --git a/src/server/shared/Configuration/Config.h b/src/server/shared/Configuration/Config.h index 42c3a700f3f..ff0233b5669 100644 --- a/src/server/shared/Configuration/Config.h +++ b/src/server/shared/Configuration/Config.h @@ -31,7 +31,7 @@ class ConfigMgr public: /// Method used only for loading main configuration files (authserver.conf and worldserver.conf) - bool LoadInitial(std::string const& file); + bool LoadInitial(std::string const& file, std::string& error); static ConfigMgr* instance() { @@ -39,7 +39,7 @@ public: return &instance; } - bool Reload(); + bool Reload(std::string& error); std::string GetStringDefault(std::string const& name, const std::string& def); bool GetBoolDefault(std::string const& name, bool def); diff --git a/src/server/shared/Database/Implementation/LoginDatabase.cpp b/src/server/shared/Database/Implementation/LoginDatabase.cpp index f0ab2077662..b9f281d3f2a 100644 --- a/src/server/shared/Database/Implementation/LoginDatabase.cpp +++ b/src/server/shared/Database/Implementation/LoginDatabase.cpp @@ -26,13 +26,13 @@ void LoginDatabaseConnection::DoPrepareStatements() PrepareStatement(LOGIN_DEL_EXPIRED_IP_BANS, "DELETE FROM ip_banned WHERE unbandate<>bandate AND unbandate<=UNIX_TIMESTAMP()", CONNECTION_ASYNC); PrepareStatement(LOGIN_UPD_EXPIRED_ACCOUNT_BANS, "UPDATE account_banned SET active = 0 WHERE active = 1 AND unbandate<>bandate AND unbandate<=UNIX_TIMESTAMP()", CONNECTION_SYNCH); PrepareStatement(LOGIN_SEL_IP_BANNED, "SELECT * FROM ip_banned WHERE ip = ?", CONNECTION_SYNCH); - PrepareStatement(LOGIN_INS_IP_AUTO_BANNED, "INSERT INTO ip_banned (ip, bandate, unbandate, bannedby, banreason) VALUES (?, UNIX_TIMESTAMP(), UNIX_TIMESTAMP()+?, 'Trinity realmd', 'Failed login autoban')", CONNECTION_ASYNC); + PrepareStatement(LOGIN_INS_IP_AUTO_BANNED, "INSERT INTO ip_banned (ip, bandate, unbandate, bannedby, banreason) VALUES (?, UNIX_TIMESTAMP(), UNIX_TIMESTAMP()+?, 'Trinity Auth', 'Failed login autoban')", CONNECTION_ASYNC); PrepareStatement(LOGIN_SEL_IP_BANNED_ALL, "SELECT ip, bandate, unbandate, bannedby, banreason FROM ip_banned WHERE (bandate = unbandate OR unbandate > UNIX_TIMESTAMP()) ORDER BY unbandate", CONNECTION_SYNCH); PrepareStatement(LOGIN_SEL_IP_BANNED_BY_IP, "SELECT ip, bandate, unbandate, bannedby, banreason FROM ip_banned WHERE (bandate = unbandate OR unbandate > UNIX_TIMESTAMP()) AND ip LIKE CONCAT('%%', ?, '%%') ORDER BY unbandate", CONNECTION_SYNCH); PrepareStatement(LOGIN_SEL_ACCOUNT_BANNED, "SELECT bandate, unbandate FROM account_banned WHERE id = ? AND active = 1", CONNECTION_SYNCH); PrepareStatement(LOGIN_SEL_ACCOUNT_BANNED_ALL, "SELECT account.id, username FROM account, account_banned WHERE account.id = account_banned.id AND active = 1 GROUP BY account.id", CONNECTION_SYNCH); PrepareStatement(LOGIN_SEL_ACCOUNT_BANNED_BY_USERNAME, "SELECT account.id, username FROM account, account_banned WHERE account.id = account_banned.id AND active = 1 AND username LIKE CONCAT('%%', ?, '%%') GROUP BY account.id", CONNECTION_SYNCH); - PrepareStatement(LOGIN_INS_ACCOUNT_AUTO_BANNED, "INSERT INTO account_banned VALUES (?, UNIX_TIMESTAMP(), UNIX_TIMESTAMP()+?, 'Trinity realmd', 'Failed login autoban', 1)", CONNECTION_ASYNC); + PrepareStatement(LOGIN_INS_ACCOUNT_AUTO_BANNED, "INSERT INTO account_banned VALUES (?, UNIX_TIMESTAMP(), UNIX_TIMESTAMP()+?, 'Trinity Auth', 'Failed login autoban', 1)", CONNECTION_ASYNC); PrepareStatement(LOGIN_DEL_ACCOUNT_BANNED, "DELETE FROM account_banned WHERE id = ?", CONNECTION_ASYNC); PrepareStatement(LOGIN_SEL_SESSIONKEY, "SELECT a.sessionkey, a.id, aa.gmlevel FROM account a LEFT JOIN account_access aa ON (a.id = aa.id) WHERE username = ?", CONNECTION_SYNCH); PrepareStatement(LOGIN_UPD_VS, "UPDATE account SET v = ?, s = ? WHERE username = ?", CONNECTION_ASYNC); diff --git a/src/server/worldserver/Main.cpp b/src/server/worldserver/Main.cpp index 02e6268cd26..3afa9e84e8b 100644 --- a/src/server/worldserver/Main.cpp +++ b/src/server/worldserver/Main.cpp @@ -109,10 +109,10 @@ extern int main(int argc, char** argv) WinServiceRun(); #endif - if (!sConfigMgr->LoadInitial(configFile)) + std::string configError; + if (!sConfigMgr->LoadInitial(configFile, configError)) { - printf("Invalid or missing configuration file : %s\n", configFile.c_str()); - printf("Verify that the file exists and has \'[worldserver]' written in the top of the file!\n"); + printf("Error in config file: %s\n", configError.c_str()); return 1; } diff --git a/src/tools/mmaps_generator/MapBuilder.cpp b/src/tools/mmaps_generator/MapBuilder.cpp index 3437355c0a9..b119b6cdbde 100644 --- a/src/tools/mmaps_generator/MapBuilder.cpp +++ b/src/tools/mmaps_generator/MapBuilder.cpp @@ -782,12 +782,12 @@ namespace MMAP if (params.nvp > DT_VERTS_PER_POLYGON) { printf("%s Invalid verts-per-polygon value! \n", tileString); - continue; + break; } if (params.vertCount >= 0xffff) { printf("%s Too many vertices! \n", tileString); - continue; + break; } if (!params.vertCount || !params.verts) { @@ -796,7 +796,7 @@ namespace MMAP // message is an annoyance //printf("%sNo vertices to build tile! \n", tileString); - continue; + break; } if (!params.polyCount || !params.polys || TILES_PER_MAP*TILES_PER_MAP == params.polyCount) @@ -805,19 +805,19 @@ namespace MMAP // keep in mind that we do output those into debug info // drop tiles with only exact count - some tiles may have geometry while having less tiles printf("%s No polygons to build on tile! \n", tileString); - continue; + break; } if (!params.detailMeshes || !params.detailVerts || !params.detailTris) { printf("%s No detail mesh to build tile! \n", tileString); - continue; + break; } printf("%s Building navmesh tile...\n", tileString); if (!dtCreateNavMeshData(¶ms, &navData, &navDataSize)) { printf("%s Failed building navmesh tile! \n", tileString); - continue; + break; } dtTileRef tileRef = 0; @@ -828,7 +828,7 @@ namespace MMAP if (!tileRef || dtResult != DT_SUCCESS) { printf("%s Failed adding tile to navmesh! \n", tileString); - continue; + break; } // file output @@ -841,7 +841,7 @@ namespace MMAP sprintf(message, "[Map %03i] Failed to open %s for writing!\n", mapID, fileName); perror(message); navMesh->removeTile(tileRef, NULL, NULL); - continue; + break; } printf("%s Writing to file...\n", tileString); |