diff options
Diffstat (limited to 'src')
32 files changed, 521 insertions, 177 deletions
diff --git a/src/server/authserver/Authentication/AuthCodes.cpp b/src/server/authserver/Authentication/AuthCodes.cpp index ace18e7b45c..bdb96ca0d25 100644 --- a/src/server/authserver/Authentication/AuthCodes.cpp +++ b/src/server/authserver/Authentication/AuthCodes.cpp @@ -16,15 +16,36 @@ */ #include "AuthCodes.h" +#include <cstddef> namespace AuthHelper { - bool IsPreBCAcceptedClientBuild(int build) + static RealmBuildInfo const PostBcAcceptedClientBuilds[] = + { + {15595, 4, 3, 4, ' '}, + {14545, 4, 2, 2, ' '}, + {13623, 4, 0, 6, 'a'}, + {12340, 3, 3, 5, 'a'}, + {11723, 3, 3, 3, 'a'}, + {11403, 3, 3, 2, ' '}, + {11159, 3, 3, 0, 'a'}, + {10505, 3, 2, 2, 'a'}, + {9947, 3, 1, 3, ' '}, + {8606, 2, 4, 3, ' '}, + {0, 0, 0, 0, ' '} // terminator + }; + + static RealmBuildInfo const PreBcAcceptedClientBuilds[] = { - int accepted_versions[] = PRE_BC_ACCEPTED_CLIENT_BUILD; + {6005, 1, 12, 2, ' '}, + {5875, 1, 12, 1, ' '}, + {0, 0, 0, 0, ' '} // terminator + }; - for (int i = 0; accepted_versions[i]; ++i) - if (build == accepted_versions[i]) + bool IsPreBCAcceptedClientBuild(int build) + { + for (int i = 0; PreBcAcceptedClientBuilds[i].Build; ++i) + if (PreBcAcceptedClientBuilds[i].Build == build) return true; return false; @@ -32,10 +53,8 @@ namespace AuthHelper bool IsPostBCAcceptedClientBuild(int build) { - int accepted_versions[] = POST_BC_ACCEPTED_CLIENT_BUILD; - - for (int i = 0; accepted_versions[i]; ++i) - if (build == accepted_versions[i]) + for (int i = 0; PostBcAcceptedClientBuilds[i].Build; ++i) + if (PostBcAcceptedClientBuilds[i].Build == build) return true; return false; @@ -45,4 +64,17 @@ namespace AuthHelper { return (IsPostBCAcceptedClientBuild(build) || IsPreBCAcceptedClientBuild(build)); } + + RealmBuildInfo const* GetBuildInfo(int build) + { + for (int i = 0; PostBcAcceptedClientBuilds[i].Build; ++i) + if (PostBcAcceptedClientBuilds[i].Build == build) + return &PostBcAcceptedClientBuilds[i]; + + for (int i = 0; PreBcAcceptedClientBuilds[i].Build; ++i) + if (PreBcAcceptedClientBuilds[i].Build == build) + return &PreBcAcceptedClientBuilds[i]; + + return NULL; + } }; diff --git a/src/server/authserver/Authentication/AuthCodes.h b/src/server/authserver/Authentication/AuthCodes.h index f940d459d40..148225377ff 100755 --- a/src/server/authserver/Authentication/AuthCodes.h +++ b/src/server/authserver/Authentication/AuthCodes.h @@ -65,9 +65,6 @@ enum LoginResult LOGIN_LOCKED_ENFORCED = 0x10, }; -#define POST_BC_ACCEPTED_CLIENT_BUILD {12340, 11723, 11403, 11159, 10571, 10505, 10146, 9947, 8606, 0} -#define PRE_BC_ACCEPTED_CLIENT_BUILD {5875, 6005, 0} - enum ExpansionFlags { POST_BC_EXP_FLAG = 0x2, @@ -75,8 +72,18 @@ enum ExpansionFlags NO_VALID_EXP_FLAG = 0x0 }; +struct RealmBuildInfo +{ + int Build; + int MajorVersion; + int MinorVersion; + int BugfixVersion; + int HotfixVersion; +}; + namespace AuthHelper { + RealmBuildInfo const* GetBuildInfo(int build); bool IsAcceptedClientBuild(int build); bool IsPostBCAcceptedClientBuild(int build); bool IsPreBCAcceptedClientBuild(int build); diff --git a/src/server/authserver/Server/AuthSocket.cpp b/src/server/authserver/Server/AuthSocket.cpp index 0794d9a802a..2ad80c7f62d 100755 --- a/src/server/authserver/Server/AuthSocket.cpp +++ b/src/server/authserver/Server/AuthSocket.cpp @@ -343,7 +343,7 @@ bool AuthSocket::_HandleLogonChallenge() _login = (const char*)ch->I; _build = ch->build; - _expversion = (AuthHelper::IsPostBCAcceptedClientBuild(_build) ? POST_BC_EXP_FLAG : NO_VALID_EXP_FLAG) | (AuthHelper::IsPreBCAcceptedClientBuild(_build) ? PRE_BC_EXP_FLAG : NO_VALID_EXP_FLAG); + _expversion = uint8(AuthHelper::IsPostBCAcceptedClientBuild(_build) ? POST_BC_EXP_FLAG : (AuthHelper::IsPreBCAcceptedClientBuild(_build) ? PRE_BC_EXP_FLAG : NO_VALID_EXP_FLAG)); _os = (const char*)ch->os; if (_os.size() > 4) @@ -352,19 +352,19 @@ bool AuthSocket::_HandleLogonChallenge() // Restore string order as its byte order is reversed std::reverse(_os.begin(), _os.end()); - pkt << (uint8)AUTH_LOGON_CHALLENGE; - pkt << (uint8)0x00; + pkt << uint8(AUTH_LOGON_CHALLENGE); + pkt << uint8(0x00); // Verify that this IP is not in the ip_banned table LoginDatabase.Execute(LoginDatabase.GetPreparedStatement(LOGIN_DEL_EXPIRED_IP_BANS)); - const std::string& ip_address = socket().getRemoteAddress(); - PreparedStatement *stmt = LoginDatabase.GetPreparedStatement(LOGIN_SEL_IP_BANNED); + std::string const& ip_address = socket().getRemoteAddress(); + PreparedStatement* stmt = LoginDatabase.GetPreparedStatement(LOGIN_SEL_IP_BANNED); stmt->setString(0, ip_address); PreparedQueryResult result = LoginDatabase.Query(stmt); if (result) { - pkt << (uint8)WOW_FAIL_BANNED; + pkt << uint8(WOW_FAIL_BANNED); sLog->outDebug(LOG_FILTER_AUTHSERVER, "'%s:%d' [AuthChallenge] Banned ip tries to login!",socket().getRemoteAddress().c_str(), socket().getRemotePort()); } else @@ -411,12 +411,12 @@ bool AuthSocket::_HandleLogonChallenge() { if ((*banresult)[0].GetUInt64() == (*banresult)[1].GetUInt64()) { - pkt << (uint8)WOW_FAIL_BANNED; + pkt << uint8(WOW_FAIL_BANNED); sLog->outDebug(LOG_FILTER_AUTHSERVER, "'%s:%d' [AuthChallenge] Banned account %s tried to login!", socket().getRemoteAddress().c_str(), socket().getRemotePort(), _login.c_str ()); } else { - pkt << (uint8)WOW_FAIL_SUSPENDED; + pkt << uint8(WOW_FAIL_SUSPENDED); sLog->outDebug(LOG_FILTER_AUTHSERVER, "'%s:%d' [AuthChallenge] Temporarily banned account %s tried to login!", socket().getRemoteAddress().c_str(), socket().getRemotePort(), _login.c_str ()); } } @@ -450,7 +450,10 @@ bool AuthSocket::_HandleLogonChallenge() unk3.SetRand(16 * 8); // Fill the response packet with the result - pkt << uint8(WOW_SUCCESS); + if (AuthHelper::IsAcceptedClientBuild(_build)) + pkt << uint8(WOW_SUCCESS); + else + pkt << uint8(WOW_FAIL_VERSION_INVALID); // B may be calculated < 32B so we force minimal length to 32B pkt.append(B.AsByteArray(32), 32); // 32 bytes @@ -749,7 +752,7 @@ bool AuthSocket::_HandleReconnectChallenge() // Reinitialize build, expansion and the account securitylevel _build = ch->build; - _expversion = (AuthHelper::IsPostBCAcceptedClientBuild(_build) ? POST_BC_EXP_FLAG : NO_VALID_EXP_FLAG) | (AuthHelper::IsPreBCAcceptedClientBuild(_build) ? PRE_BC_EXP_FLAG : NO_VALID_EXP_FLAG); + _expversion = uint8(AuthHelper::IsPostBCAcceptedClientBuild(_build) ? POST_BC_EXP_FLAG : (AuthHelper::IsPreBCAcceptedClientBuild(_build) ? PRE_BC_EXP_FLAG : NO_VALID_EXP_FLAG)); _os = (const char*)ch->os; if (_os.size() > 4) @@ -766,11 +769,11 @@ bool AuthSocket::_HandleReconnectChallenge() // Sending response ByteBuffer pkt; - pkt << (uint8)AUTH_RECONNECT_CHALLENGE; - pkt << (uint8)0x00; + pkt << uint8(AUTH_RECONNECT_CHALLENGE); + pkt << uint8(0x00); _reconnectProof.SetRand(16 * 8); pkt.append(_reconnectProof.AsByteArray(16), 16); // 16 bytes random - pkt << (uint64)0x00 << (uint64)0x00; // 16 bytes zeros + pkt << uint64(0x00) << uint64(0x00); // 16 bytes zeros socket().send((char const*)pkt.contents(), pkt.size()); return true; } @@ -800,9 +803,9 @@ bool AuthSocket::_HandleReconnectProof() { // Sending response ByteBuffer pkt; - pkt << (uint8)AUTH_RECONNECT_PROOF; - pkt << (uint8)0x00; - pkt << (uint16)0x00; // 2 bytes zeros + pkt << uint8(AUTH_RECONNECT_PROOF); + pkt << uint8(0x00); + pkt << uint16(0x00); // 2 bytes zeros socket().send((char const*)pkt.contents(), pkt.size()); _authed = true; return true; @@ -849,73 +852,87 @@ bool AuthSocket::_HandleRealmList() for (RealmList::RealmMap::const_iterator i = sRealmList->begin(); i != sRealmList->end(); ++i) { // don't work with realms which not compatible with the client - if ((_expversion & POST_BC_EXP_FLAG) && i->second.gamebuild != _build) - continue; - else if ((_expversion & PRE_BC_EXP_FLAG) && !AuthHelper::IsPreBCAcceptedClientBuild(i->second.gamebuild)) + bool okBuild = ((_expversion & POST_BC_EXP_FLAG) && i->second.gamebuild == _build) || ((_expversion & PRE_BC_EXP_FLAG) && !AuthHelper::IsPreBCAcceptedClientBuild(i->second.gamebuild)); + + // No SQL injection. id of realm is controlled by the database. + uint32 flag = i->second.flag; + RealmBuildInfo const* buildInfo = AuthHelper::GetBuildInfo(i->second.gamebuild); + if (!okBuild) + { + if (!buildInfo) continue; - uint8 AmountOfCharacters; + flag |= REALM_FLAG_OFFLINE | REALM_FLAG_SPECIFYBUILD; // tell the client what build the realm is for + } - // No SQL injection. id of realm is controlled by the database. + if (!buildInfo) + flag &= ~REALM_FLAG_SPECIFYBUILD; + + std::string name = i->first; + if (_expversion & PRE_BC_EXP_FLAG && flag & REALM_FLAG_SPECIFYBUILD) + { + std::ostringstream ss; + ss << name << " (" << buildInfo->MajorVersion << '.' << buildInfo->MinorVersion << '.' << buildInfo->BugfixVersion << ')'; + name = ss.str(); + } + + uint8 lock = (i->second.allowedSecurityLevel > _accountSecurityLevel) ? 1 : 0; + + uint8 AmountOfCharacters = 0; stmt = LoginDatabase.GetPreparedStatement(LOGIN_SEL_NUM_CHARS_ON_REALM); stmt->setUInt32(0, i->second.m_ID); stmt->setUInt32(1, id); result = LoginDatabase.Query(stmt); if (result) AmountOfCharacters = (*result)[0].GetUInt8(); - else - AmountOfCharacters = 0; - - uint8 lock = (i->second.allowedSecurityLevel > _accountSecurityLevel) ? 1 : 0; pkt << i->second.icon; // realm type - if ( _expversion & POST_BC_EXP_FLAG ) // only 2.x and 3.x clients + if (_expversion & POST_BC_EXP_FLAG) // only 2.x and 3.x clients pkt << lock; // if 1, then realm locked - pkt << uint8(i->second.flag); // RealmFlags - pkt << i->first; + pkt << uint8(flag); // RealmFlags + pkt << name; pkt << i->second.address; pkt << i->second.populationLevel; pkt << AmountOfCharacters; pkt << i->second.timezone; // realm category if (_expversion & POST_BC_EXP_FLAG) // 2.x and 3.x clients - pkt << (uint8)0x2C; // unk, may be realm number/id? + pkt << uint8(0x2C); // unk, may be realm number/id? else - pkt << (uint8)0x0; // 1.12.1 and 1.12.2 clients + pkt << uint8(0x0); // 1.12.1 and 1.12.2 clients - if (i->second.flag & REALM_FLAG_SPECIFYBUILD) + if (_expversion & POST_BC_EXP_FLAG && flag & REALM_FLAG_SPECIFYBUILD) { - // TODO: Make this customizable - pkt << uint8(3); - pkt << uint8(3); - pkt << uint8(5); - pkt << uint16(12340); + pkt << uint8(buildInfo->MajorVersion); + pkt << uint8(buildInfo->MinorVersion); + pkt << uint8(buildInfo->BugfixVersion); + pkt << uint16(buildInfo->Build); } ++RealmListSize; } - if ( _expversion & POST_BC_EXP_FLAG ) // 2.x and 3.x clients + if (_expversion & POST_BC_EXP_FLAG) // 2.x and 3.x clients { - pkt << (uint8)0x10; - pkt << (uint8)0x00; + pkt << uint8(0x10); + pkt << uint8(0x00); } else // 1.12.1 and 1.12.2 clients { - pkt << (uint8)0x00; - pkt << (uint8)0x02; + pkt << uint8(0x00); + pkt << uint8(0x02); } // make a ByteBuffer which stores the RealmList's size ByteBuffer RealmListSizeBuffer; - RealmListSizeBuffer << (uint32)0; + RealmListSizeBuffer << uint32(0); if (_expversion & POST_BC_EXP_FLAG) // only 2.x and 3.x clients - RealmListSizeBuffer << (uint16)RealmListSize; + RealmListSizeBuffer << uint16(RealmListSize); else - RealmListSizeBuffer << (uint32)RealmListSize; + RealmListSizeBuffer << uint32(RealmListSize); ByteBuffer hdr; - hdr << (uint8) REALM_LIST; - hdr << (uint16)(pkt.size() + RealmListSizeBuffer.size()); + hdr << uint8(REALM_LIST); + hdr << uint16(pkt.size() + RealmListSizeBuffer.size()); hdr.append(RealmListSizeBuffer); // append RealmList's size buffer hdr.append(pkt); // append realms in the realmlist @@ -983,7 +1000,9 @@ PatcherRunnable::PatcherRunnable(class AuthSocket* as) } // Send content of patch file to the client -void PatcherRunnable::run() {} +void PatcherRunnable::run() +{ +} // Preload MD5 hashes of existing patch files on server #ifndef _WIN32 diff --git a/src/server/game/Battlefield/Battlefield.cpp b/src/server/game/Battlefield/Battlefield.cpp index d159580d189..7f701f541a1 100644 --- a/src/server/game/Battlefield/Battlefield.cpp +++ b/src/server/game/Battlefield/Battlefield.cpp @@ -65,7 +65,7 @@ Battlefield::~Battlefield() // Called when a player enters the zone void Battlefield::HandlePlayerEnterZone(Player* player, uint32 /*zone*/) { - // If battle is started, + // If battle is started, // If not full of players > invite player to join the war // If full of players > announce to player that BF is full and kick him after a few second if he desn't leave if (IsWarTime()) @@ -133,7 +133,7 @@ bool Battlefield::Update(uint32 diff) m_Timer -= diff; // Invite players a few minutes before the battle's beginning - if (!m_StartGrouping && m_Timer <= m_StartGroupingTimer) + if (!IsWarTime() && !m_StartGrouping && m_Timer <= m_StartGroupingTimer) { m_StartGrouping = true; InvitePlayersInZoneToQueue(); @@ -885,9 +885,9 @@ GuidSet::iterator BfCapturePoint::HandlePlayerLeave(Player* player) { if (m_capturePoint) player->SendUpdateWorldState(m_capturePoint->GetGOInfo()->capturePoint.worldState1, 0); - + GuidSet::iterator current = m_activePlayers[player->GetTeamId()].find(player->GetGUID()); - + if (current == m_activePlayers[player->GetTeamId()].end()) return current; // return end() diff --git a/src/server/game/Battlefield/Battlefield.h b/src/server/game/Battlefield/Battlefield.h index 5fa8d6b1bc8..07daf33d431 100644 --- a/src/server/game/Battlefield/Battlefield.h +++ b/src/server/game/Battlefield/Battlefield.h @@ -35,7 +35,7 @@ enum BattlefieldTypes enum BattlefieldIDs { - BATTLEFIELD_BATTLEID_WG = 1, // Wintergrasp battle + BATTLEFIELD_BATTLEID_WG = 1, // Wintergrasp battle }; enum BattlefieldObjectiveStates diff --git a/src/server/game/Battlefield/BattlefieldHandler.cpp b/src/server/game/Battlefield/BattlefieldHandler.cpp index 09c6f18f796..b852082d582 100644 --- a/src/server/game/Battlefield/BattlefieldHandler.cpp +++ b/src/server/game/Battlefield/BattlefieldHandler.cpp @@ -32,7 +32,7 @@ //Param3:(time) Time in second that the player have for accept void WorldSession::SendBfInvitePlayerToWar(uint32 BattleId, uint32 ZoneId, uint32 p_time) { - //Send packet + //Send packet WorldPacket data(SMSG_BATTLEFIELD_MGR_ENTRY_INVITE, 12); data << uint32(BattleId); data << uint32(ZoneId); @@ -65,13 +65,13 @@ void WorldSession::SendBfQueueInviteResponse(uint32 BattleId,uint32 ZoneId, bool WorldPacket data(SMSG_BATTLEFIELD_MGR_QUEUE_REQUEST_RESPONSE, 11); data << uint32(BattleId); data << uint32(ZoneId); - data << uint8((CanQueue ? 1 : 0)); //Accepted //0 you cannot queue wg //1 you are queued + data << uint8((CanQueue ? 1 : 0)); //Accepted //0 you cannot queue wg //1 you are queued data << uint8((Full ? 0 : 1)); //Logging In //0 wg full //1 queue for upcoming data << uint8(1); //Warmup SendPacket(&data); } -//This is call when player accept to join war +//This is call when player accept to join war //Param1:(BattleId) the BattleId of Bf void WorldSession::SendBfEntered(uint32 BattleId) { diff --git a/src/server/game/Battlefield/Zones/BattlefieldWG.cpp b/src/server/game/Battlefield/Zones/BattlefieldWG.cpp index 634b1bb2cea..97e7bb5bef2 100644 --- a/src/server/game/Battlefield/Zones/BattlefieldWG.cpp +++ b/src/server/game/Battlefield/Zones/BattlefieldWG.cpp @@ -25,12 +25,6 @@ #include "SpellAuras.h" #include "Vehicle.h" -enum WintergrastData -{ - BATTLEFIELD_WG_ZONEID = 4197, // Wintergrasp - BATTLEFIELD_WG_MAPID = 571, // Northrend -}; - enum WGVehicles { NPC_WG_SEIGE_ENGINE_ALLIANCE = 28312, @@ -39,6 +33,12 @@ enum WGVehicles NPC_WG_CATAPULT = 27881, }; +BattlefieldWG::~BattlefieldWG() +{ + for (Workshop::const_iterator itr = WorkshopsList.begin(); itr != WorkshopsList.end(); ++itr) + delete *itr; +} + bool BattlefieldWG::SetupBattlefield() { InitStalker(BATTLEFIELD_WG_NPC_STALKER, WintergraspStalkerPos[0], WintergraspStalkerPos[1], WintergraspStalkerPos[2], WintergraspStalkerPos[3]); @@ -172,6 +172,8 @@ bool BattlefieldWG::SetupBattlefield() GameObject* go = SpawnGameObject(WGGameObjectBuilding[i].entry, WGGameObjectBuilding[i].x, WGGameObjectBuilding[i].y, WGGameObjectBuilding[i].z, WGGameObjectBuilding[i].o); BfWGGameObjectBuilding* b = new BfWGGameObjectBuilding(this); b->Init(go, WGGameObjectBuilding[i].type, WGGameObjectBuilding[i].WorldState, WGGameObjectBuilding[i].nameId); + if (!IsEnabled() && go->GetEntry() == GO_WINTERGRASP_VAULT_GATE) + go->SetDestructibleState(GO_DESTRUCTIBLE_DESTROYED); BuildingsInZone.insert(b); } @@ -538,7 +540,6 @@ void BattlefieldWG::OnCreatureCreate(Creature* creature) { UpdateData(BATTLEFIELD_WG_DATA_VEHICLE_H, 1); creature->AddAura(SPELL_HORDE_FLAG, creature); - creature->setFaction(creator->getFaction()); m_vehicles[team].insert(creature->GetGUID()); UpdateVehicleCountWG(); } @@ -555,7 +556,6 @@ void BattlefieldWG::OnCreatureCreate(Creature* creature) { UpdateData(BATTLEFIELD_WG_DATA_VEHICLE_A, 1); creature->AddAura(SPELL_ALLIANCE_FLAG, creature); - creature->setFaction(creator->getFaction()); m_vehicles[team].insert(creature->GetGUID()); UpdateVehicleCountWG(); } diff --git a/src/server/game/Battlefield/Zones/BattlefieldWG.h b/src/server/game/Battlefield/Zones/BattlefieldWG.h index be062704b52..734154020d9 100644 --- a/src/server/game/Battlefield/Zones/BattlefieldWG.h +++ b/src/server/game/Battlefield/Zones/BattlefieldWG.h @@ -29,7 +29,7 @@ uint32 const VehNumWorldState[2] = { 3680, 3490 }; uint32 const MaxVehNumWorldState[2] = { 3681, 3491 }; uint32 const ClockWorldState[2] = { 3781, 4354 }; -uint32 const WintergraspFaction[3] = { 1, 2, 35 }; +uint32 const WintergraspFaction[3] = { 1732, 1735, 35 }; float const WintergraspStalkerPos[4] = { 0, 0, 0, 0 }; class BattlefieldWG; @@ -44,6 +44,12 @@ typedef std::set<WGWorkshop*> Workshop; typedef std::set<Group*> GroupSet; //typedef std::set<WintergraspCapturePoint *> CapturePointSet; unused ? +enum WintergrastData +{ + BATTLEFIELD_WG_ZONEID = 4197, // Wintergrasp + BATTLEFIELD_WG_MAPID = 571, // Northrend +}; + enum WintergraspSpells { // Wartime auras @@ -273,6 +279,7 @@ class WintergraspCapturePoint : public BfCapturePoint class BattlefieldWG : public Battlefield { public: + ~BattlefieldWG(); /** * \brief Called when the battle start * - Spawn relic and turret @@ -434,7 +441,6 @@ class BattlefieldWG : public Battlefield GameObject* m_titansRelic; }; -uint32 const NORTHREND_WINTERGRASP = 4197; uint8 const WG_MAX_OBJ = 32; uint8 const WG_KEEPGAMEOBJECT_MAX = 44; uint8 const WG_MAX_TURRET = 15; @@ -539,6 +545,12 @@ enum WintergraspGameObject GO_WINTERGRASP_SHADOWSIGHT_TOWER = 190356, GO_WINTERGRASP_WINTER_S_EDGE_TOWER = 190357, GO_WINTERGRASP_FLAMEWATCH_TOWER = 190358, + + GO_WINTERGRASP_FORTRESS_GATE = 190375, + GO_WINTERGRASP_VAULT_GATE = 191810, + + GO_WINTERGRASP_KEEP_COLLISION_WALL = 194323, + }; struct WintergraspObjectPositionData @@ -609,10 +621,10 @@ const WintergraspBuildingSpawnData WGGameObjectBuilding[WG_MAX_OBJ] = { 190358, 3706, 4459.1f, 1944.33f, 434.991f, -2.00276f, BATTLEFIELD_WG_OBJECTTYPE_TOWER, BATTLEFIELD_WG_TEXT_TOWER_NAME_E }, // Door of forteress (Not spawned in db) - { 190375, 3763, 5162.99f, 2841.23f, 410.162f, -3.13286f, BATTLEFIELD_WG_OBJECTTYPE_DOOR, 0 }, + { GO_WINTERGRASP_FORTRESS_GATE, 3763, 5162.99f, 2841.23f, 410.162f, -3.13286f, BATTLEFIELD_WG_OBJECTTYPE_DOOR, 0 }, // Last door (Not spawned in db) - { 191810, 3773, 5397.11f, 2841.54f, 425.899f, 3.14159f, BATTLEFIELD_WG_OBJECTTYPE_DOOR_LAST, 0 }, + { GO_WINTERGRASP_VAULT_GATE, 3773, 5397.11f, 2841.54f, 425.899f, 3.14159f, BATTLEFIELD_WG_OBJECTTYPE_DOOR_LAST, 0 }, }; @@ -1195,6 +1207,9 @@ struct BfWGGameObjectBuilding if (m_Build->IsDestructibleBuilding()) { m_Build->SetDestructibleState(GO_DESTRUCTIBLE_REBUILDING, NULL, true); + if (m_Build->GetEntry() == GO_WINTERGRASP_VAULT_GATE) + if (GameObject* go = m_Build->FindNearestGameObject(GO_WINTERGRASP_KEEP_COLLISION_WALL, 10.0f)) + go->EnableCollision(true); // Update worldstate m_State = BATTLEFIELD_WG_OBJECTSTATE_ALLIANCE_INTACT - (m_Team * 3); @@ -1250,6 +1265,8 @@ struct BfWGGameObjectBuilding m_WG->UpdatedDestroyedTowerCount(TeamId(m_Team)); break; case BATTLEFIELD_WG_OBJECTTYPE_DOOR_LAST: + if (GameObject* go = m_Build->FindNearestGameObject(GO_WINTERGRASP_KEEP_COLLISION_WALL, 10.0f)) + go->EnableCollision(false); m_WG->SetRelicInteractible(true); if (m_WG->GetRelic()) m_WG->GetRelic()->RemoveFlag(GAMEOBJECT_FLAGS, GO_FLAG_IN_USE); @@ -1403,7 +1420,7 @@ struct BfWGGameObjectBuilding { Position towerCannonPos; TowerCannon[towerid].TurretTop[i].GetPosition(&towerCannonPos); - if (Creature *turret = m_WG->SpawnCreature(28366, towerCannonPos, TeamId(0))) + if (Creature* turret = m_WG->SpawnCreature(28366, towerCannonPos, TeamId(0))) { m_TurretTopList.insert(turret->GetGUID()); switch (go->GetEntry()) @@ -1473,17 +1490,17 @@ struct BfWGGameObjectBuilding switch (m_Build->GetEntry()) { - case 190221: - case 190373: - case 190377: - case 190378: + case GO_WINTERGRASP_FORTRESS_TOWER_1: + case GO_WINTERGRASP_FORTRESS_TOWER_2: + case GO_WINTERGRASP_FORTRESS_TOWER_3: + case GO_WINTERGRASP_FORTRESS_TOWER_4: { creature->setFaction(WintergraspFaction[m_WG->GetDefenderTeam()]); break; } - case 190356: - case 190357: - case 190358: + case GO_WINTERGRASP_SHADOWSIGHT_TOWER: + case GO_WINTERGRASP_WINTER_S_EDGE_TOWER: + case GO_WINTERGRASP_FLAMEWATCH_TOWER: { creature->setFaction(WintergraspFaction[m_WG->GetAttackerTeam()]); break; @@ -1509,17 +1526,17 @@ struct BfWGGameObjectBuilding switch (m_Build->GetEntry()) { - case 190221: - case 190373: - case 190377: - case 190378: + case GO_WINTERGRASP_FORTRESS_TOWER_1: + case GO_WINTERGRASP_FORTRESS_TOWER_2: + case GO_WINTERGRASP_FORTRESS_TOWER_3: + case GO_WINTERGRASP_FORTRESS_TOWER_4: { creature->setFaction(WintergraspFaction[m_WG->GetDefenderTeam()]); break; } - case 190356: - case 190357: - case 190358: + case GO_WINTERGRASP_SHADOWSIGHT_TOWER: + case GO_WINTERGRASP_WINTER_S_EDGE_TOWER: + case GO_WINTERGRASP_FLAMEWATCH_TOWER: { creature->setFaction(WintergraspFaction[m_WG->GetAttackerTeam()]); break; @@ -1643,9 +1660,9 @@ struct WintergraspWorkshopData // Spawning Associate gameobject and store them void AddGameObject(WintergraspObjectPositionData obj) { - if (GameObject *gameobject = m_WG->SpawnGameObject(obj.entryHorde, obj.x, obj.y, obj.z, obj.o)) + if (GameObject* gameobject = m_WG->SpawnGameObject(obj.entryHorde, obj.x, obj.y, obj.z, obj.o)) m_GameObjectOnPoint[TEAM_HORDE].insert(gameobject); - if (GameObject *gameobject = m_WG->SpawnGameObject(obj.entryAlliance, obj.x, obj.y, obj.z, obj.o)) + if (GameObject* gameobject = m_WG->SpawnGameObject(obj.entryAlliance, obj.x, obj.y, obj.z, obj.o)) m_GameObjectOnPoint[TEAM_ALLIANCE].insert(gameobject); } diff --git a/src/server/game/Battlegrounds/Zones/BattlegroundWS.cpp b/src/server/game/Battlegrounds/Zones/BattlegroundWS.cpp index ededaf15bb5..8df6f93a082 100755 --- a/src/server/game/Battlegrounds/Zones/BattlegroundWS.cpp +++ b/src/server/game/Battlegrounds/Zones/BattlegroundWS.cpp @@ -52,6 +52,8 @@ BattlegroundWS::BattlegroundWS() StartMessageIds[BG_STARTING_EVENT_SECOND] = LANG_BG_WS_START_ONE_MINUTE; StartMessageIds[BG_STARTING_EVENT_THIRD] = LANG_BG_WS_START_HALF_MINUTE; StartMessageIds[BG_STARTING_EVENT_FOURTH] = LANG_BG_WS_HAS_BEGUN; + _flagSpellForceTimer = 0; + _bothFlagsKept = false; _flagDebuffState = 0; } diff --git a/src/server/game/Entities/Creature/GossipDef.cpp b/src/server/game/Entities/Creature/GossipDef.cpp index 63e186ffc42..ec196280d99 100755 --- a/src/server/game/Entities/Creature/GossipDef.cpp +++ b/src/server/game/Entities/Creature/GossipDef.cpp @@ -367,8 +367,8 @@ void PlayerMenu::SendQuestGiverQuestDetails(Quest const* quest, uint64 npcGUID, } // rewarded honor points. Multiply with 10 to satisfy client - data << 10 * Trinity::Honor::hk_honor_at_level(_session->GetPlayer()->getLevel(), quest->GetRewHonorMultiplier()); - data << float(0.0f); // new 3.3.0, honor multiplier? + data << uint32(10 * quest->CalculateHonorGain(_session->GetPlayer()->GetQuestLevel(quest))); + data << float(0.0f); // unk, honor multiplier? data << uint32(quest->GetRewSpell()); // reward spell, this spell will display (icon) (casted if RewSpellCast == 0) data << int32(quest->GetRewSpellCast()); // casted spell data << uint32(quest->GetCharTitleId()); // CharTitleId, new 2.4.0, player gets this title (id from CharTitles) @@ -454,8 +454,8 @@ void PlayerMenu::SendQuestQueryResponse(Quest const* quest) const data << int32(quest->GetRewSpellCast()); // casted spell // rewarded honor points - data << Trinity::Honor::hk_honor_at_level(_session->GetPlayer()->getLevel(), quest->GetRewHonorMultiplier()); - data << float(0); // new reward honor (multipled by ~62 at client side) + data << uint32(quest->GetRewHonorAddition()); + data << float(quest->GetRewHonorMultiplier()); data << uint32(quest->GetSrcItemId()); // source item id data << uint32(quest->GetFlags() & 0xFFFF); // quest flags data << uint32(quest->GetCharTitleId()); // CharTitleId, new 2.4.0, player gets this title (id from CharTitles) @@ -598,8 +598,8 @@ void PlayerMenu::SendQuestGiverOfferReward(Quest const* quest, uint64 npcGUID, b data << uint32(quest->XPValue(_session->GetPlayer()) * sWorld->getRate(RATE_XP_QUEST)); // rewarded honor points. Multiply with 10 to satisfy client - data << 10 * Trinity::Honor::hk_honor_at_level(_session->GetPlayer()->getLevel(), quest->GetRewHonorMultiplier()); - data << float(0); // unk, honor multiplier? + data << uint32(10 * quest->CalculateHonorGain(_session->GetPlayer()->GetQuestLevel(quest))); + data << float(0.0f); // unk, honor multiplier? data << uint32(0x08); // unused by client? data << uint32(quest->GetRewSpell()); // reward spell, this spell will display (icon) (casted if RewSpellCast == 0) data << int32(quest->GetRewSpellCast()); // casted spell diff --git a/src/server/game/Entities/GameObject/GameObject.cpp b/src/server/game/Entities/GameObject/GameObject.cpp index 08518217e26..b229f00fcd7 100755 --- a/src/server/game/Entities/GameObject/GameObject.cpp +++ b/src/server/game/Entities/GameObject/GameObject.cpp @@ -135,7 +135,7 @@ void GameObject::AddToWorld() sObjectAccessor->AddObject(this); bool startOpen = (GetGoType() == GAMEOBJECT_TYPE_DOOR || GetGoType() == GAMEOBJECT_TYPE_BUTTON ? GetGOInfo()->door.startOpen : false); // The state can be changed after GameObject::Create but before GameObject::AddToWorld - bool toggledState = GetGOData() ? GetGOData()->go_state == GO_STATE_READY : false; + bool toggledState = GetGOData() ? GetGOData()->go_state != GO_STATE_READY : false; if (m_model) GetMap()->InsertGameObjectModel(*m_model); @@ -1929,7 +1929,7 @@ void GameObject::SetLootState(LootState state, Unit* unit) bool startOpen = (GetGoType() == GAMEOBJECT_TYPE_DOOR || GetGoType() == GAMEOBJECT_TYPE_BUTTON ? GetGOInfo()->door.startOpen : false); // Use the current go state - if (GetGoState() != GO_STATE_ACTIVE) + if (GetGoState() != GO_STATE_READY) startOpen = !startOpen; if (state == GO_ACTIVATED || state == GO_JUST_DEACTIVATED) @@ -1951,13 +1951,10 @@ void GameObject::SetGoState(GOState state) // startOpen determines whether we are going to add or remove the LoS on activation bool startOpen = (GetGoType() == GAMEOBJECT_TYPE_DOOR || GetGoType() == GAMEOBJECT_TYPE_BUTTON ? GetGOInfo()->door.startOpen : false); - if (GetGOData() && GetGOData()->go_state == GO_STATE_READY) + if (state != GO_STATE_READY) startOpen = !startOpen; - if (state == GO_STATE_ACTIVE || state == GO_STATE_ACTIVE_ALTERNATIVE) - EnableCollision(startOpen); - else if (state == GO_STATE_READY) - EnableCollision(!startOpen); + EnableCollision(startOpen); } } diff --git a/src/server/game/Entities/Player/Player.cpp b/src/server/game/Entities/Player/Player.cpp index f463a62e9fa..8660b040037 100755 --- a/src/server/game/Entities/Player/Player.cpp +++ b/src/server/game/Entities/Player/Player.cpp @@ -7507,8 +7507,7 @@ void Player::UpdateZone(uint32 newZone, uint32 newArea) if (GetRestType() == REST_TYPE_IN_TAVERN) // Still inside a tavern or has recently left { // Remove rest state if we have recently left a tavern. - // Why is 40 yd hardcoded? - if (GetMapId() != GetInnPosMapId() || GetExactDist(GetInnPosX(), GetInnPosY(), GetInnPosZ()) > 40.0f) + if (GetMapId() != GetInnPosMapId() || GetExactDist(GetInnPosX(), GetInnPosY(), GetInnPosZ()) > 1.0f) { RemoveFlag(PLAYER_FLAGS, PLAYER_FLAGS_RESTING); SetRestType(REST_TYPE_NO); @@ -16375,7 +16374,7 @@ void Player::SendQuestReward(Quest const* quest, uint32 XP, Object* questGiver) data << uint32(quest->GetRewOrReqMoney() + int32(quest->GetRewMoneyMaxLevel() * sWorld->getRate(RATE_DROP_MONEY))); } - data << 10 * Trinity::Honor::hk_honor_at_level(getLevel(), quest->GetRewHonorMultiplier()); + data << uint32(10 * quest->CalculateHonorGain(GetQuestLevel(quest))); data << uint32(quest->GetBonusTalents()); // bonus talents data << uint32(quest->GetRewArenaPoints()); GetSession()->SendPacket(&data); diff --git a/src/server/game/Handlers/GroupHandler.cpp b/src/server/game/Handlers/GroupHandler.cpp index e0ff3933c3a..c11a1cfc2aa 100755 --- a/src/server/game/Handlers/GroupHandler.cpp +++ b/src/server/game/Handlers/GroupHandler.cpp @@ -859,7 +859,7 @@ void WorldSession::BuildPartyMemberStatsChangedPacket(Player* player, WorldPacke { if (auramask & (uint64(1) << i)) { - AuraApplication const* aurApp = player->GetVisibleAura(i); + AuraApplication const* aurApp = pet->GetVisibleAura(i); *data << uint32(aurApp ? aurApp->GetBase()->GetId() : 0); *data << uint8(1); } diff --git a/src/server/game/Quests/QuestDef.cpp b/src/server/game/Quests/QuestDef.cpp index 9221da53003..b58011efe42 100755 --- a/src/server/game/Quests/QuestDef.cpp +++ b/src/server/game/Quests/QuestDef.cpp @@ -238,10 +238,11 @@ uint32 Quest::CalculateHonorGain(uint8 level) const if (GetRewHonorAddition() > 0 || GetRewHonorMultiplier() > 0.0f) { // values stored from 0.. for 1... - TeamContributionPointsEntry const* tc = sTeamContributionPointsStore.LookupEntry(level-1); + TeamContributionPointsEntry const* tc = sTeamContributionPointsStore.LookupEntry(level); if (!tc) return 0; - honor = uint32(tc->value * GetRewHonorMultiplier() * 0.1000000014901161); + + honor = uint32(tc->value * GetRewHonorMultiplier() * 0.1f); honor += GetRewHonorAddition(); } diff --git a/src/server/game/Quests/QuestDef.h b/src/server/game/Quests/QuestDef.h index 7f22b441afe..6155e33d35e 100755 --- a/src/server/game/Quests/QuestDef.h +++ b/src/server/game/Quests/QuestDef.h @@ -194,7 +194,7 @@ class Quest int32 GetZoneOrSort() const { return ZoneOrSort; } uint32 GetMinLevel() const { return MinLevel; } uint32 GetMaxLevel() const { return MaxLevel; } - uint32 GetQuestLevel() const { return Level; } + int32 GetQuestLevel() const { return Level; } uint32 GetType() const { return Type; } uint32 GetRequiredClasses() const { return RequiredClasses; } uint32 GetRequiredRaces() const { return RequiredRaces; } diff --git a/src/server/game/Spells/Spell.cpp b/src/server/game/Spells/Spell.cpp index 6376ff6e50b..90ac5ed5a3f 100755 --- a/src/server/game/Spells/Spell.cpp +++ b/src/server/game/Spells/Spell.cpp @@ -6826,9 +6826,9 @@ SpellCastResult Spell::CanOpenLock(uint32 effIndex, uint32 lockId, SkillType& sk 0 : m_caster->ToPlayer()->GetSkillValue(skillId); // skill bonus provided by casting spell (mostly item spells) - // add the damage modifier from the spell casted (cheat lock / skeleton key etc.) + // add the effect base points modifier from the spell casted (cheat lock / skeleton key etc.) if (m_spellInfo->Effects[effIndex].TargetA.GetTarget() == TARGET_GAMEOBJECT_ITEM_TARGET || m_spellInfo->Effects[effIndex].TargetB.GetTarget() == TARGET_GAMEOBJECT_ITEM_TARGET) - skillValue += uint32(CalculateDamage(effIndex, NULL)); + skillValue += m_spellInfo->Effects[effIndex].CalcValue(); if (skillValue < reqSkillValue) return SPELL_FAILED_LOW_CASTLEVEL; diff --git a/src/server/game/Spells/SpellEffects.cpp b/src/server/game/Spells/SpellEffects.cpp index 11356e8b155..a5e24ff1cec 100755 --- a/src/server/game/Spells/SpellEffects.cpp +++ b/src/server/game/Spells/SpellEffects.cpp @@ -4281,17 +4281,6 @@ void Spell::EffectScriptEffect(SpellEffIndex effIndex) unitTarget->CastSpell(unitTarget, spellTarget[urand(0, 4)], true); break; } - case 64142: // Upper Deck - Create Foam Sword - if (unitTarget->GetTypeId() != TYPEID_PLAYER) - return; - Player* player = unitTarget->ToPlayer(); - static uint32 const itemId[] = {45061, 45176, 45177, 45178, 45179, 0}; - // player can only have one of these items - for (uint32 const* itr = &itemId[0]; *itr; ++itr) - if (player->HasItemCount(*itr, 1, true)) - return; - DoCreateItem(effIndex, itemId[urand(0, 4)]); - return; } break; } diff --git a/src/server/game/Spells/SpellMgr.cpp b/src/server/game/Spells/SpellMgr.cpp index 5493f1a2649..e17e71f8869 100755 --- a/src/server/game/Spells/SpellMgr.cpp +++ b/src/server/game/Spells/SpellMgr.cpp @@ -1160,13 +1160,33 @@ bool SpellArea::IsFitToRequirements(Player const* player, uint32 newZone, uint32 // team that controls the workshop in the specified area uint32 team = bf->GetData(newArea); - + if (team == TEAM_HORDE) return spellId == 56618; else if (team == TEAM_ALLIANCE) return spellId == 56617; } break; + case 57940: // Essence of Wintergrasp - Northrend + case 58045: // Essence of Wintergrasp - Wintergrasp + { + if (!player) + return false; + + if (Battlefield* battlefieldWG = sBattlefieldMgr->GetBattlefieldByBattleId(BATTLEFIELD_BATTLEID_WG)) + return battlefieldWG->IsEnabled() && (player->GetTeamId() == battlefieldWG->GetDefenderTeam()) && !battlefieldWG->IsWarTime(); + break; + } + case 74411: // Battleground - Dampening + { + if (!player) + return false; + + if (Battlefield* bf = sBattlefieldMgr->GetBattlefieldToZoneId(player->GetZoneId())) + return bf->IsWarTime(); + break; + } + } return true; diff --git a/src/server/game/World/World.cpp b/src/server/game/World/World.cpp index f3ff4d79d4a..ea74b6d06dd 100755 --- a/src/server/game/World/World.cpp +++ b/src/server/game/World/World.cpp @@ -1209,7 +1209,7 @@ void World::LoadConfigSettings(bool reload) m_int_configs[CONFIG_WINTERGRASP_BATTLETIME] = ConfigMgr::GetIntDefault("Wintergrasp.BattleTimer", 30); m_int_configs[CONFIG_WINTERGRASP_NOBATTLETIME] = ConfigMgr::GetIntDefault("Wintergrasp.NoBattleTimer", 150); m_int_configs[CONFIG_WINTERGRASP_RESTART_AFTER_CRASH] = ConfigMgr::GetIntDefault("Wintergrasp.CrashRestartTimer", 10); - + if (reload) sScriptMgr->OnConfigLoad(reload); } @@ -1733,7 +1733,7 @@ void World::SetInitialWorldSettings() ///- Initialize Battlefield sLog->outInfo(LOG_FILTER_SERVER_LOADING, "Starting Battlefield System"); sBattlefieldMgr->InitBattlefield(); - + sLog->outInfo(LOG_FILTER_SERVER_LOADING, "Loading Transports..."); sMapMgr->LoadTransports(); @@ -2928,7 +2928,7 @@ void World::LoadCharacterNameData() QueryResult result = CharacterDatabase.Query("SELECT guid, name, race, gender, class FROM characters WHERE deleteDate IS NULL"); if (!result) { - sLog->outError(LOG_FILTER_SQL, "No character name data loaded, empty query"); + sLog->outInfo(LOG_FILTER_SERVER_LOADING, "No character name data loaded, empty query"); return; } diff --git a/src/server/scripts/EasternKingdoms/Uldaman/boss_archaedas.cpp b/src/server/scripts/EasternKingdoms/Uldaman/boss_archaedas.cpp index 3ffb873e4d2..74fad4f94d8 100644 --- a/src/server/scripts/EasternKingdoms/Uldaman/boss_archaedas.cpp +++ b/src/server/scripts/EasternKingdoms/Uldaman/boss_archaedas.cpp @@ -95,14 +95,17 @@ class boss_archaedas : public CreatureScript me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_DISABLE_MOVE); } - void ActivateMinion(uint64 uiGuid, bool bFlag) + void ActivateMinion(uint64 uiGuid, bool flag) { - Unit* pMinion = Unit::GetUnit(*me, uiGuid); + Unit* minion = Unit::GetUnit(*me, uiGuid); - if (pMinion && pMinion->isAlive()) + if (minion && minion->isAlive()) { - DoCast(pMinion, SPELL_AWAKEN_VAULT_WALKER, bFlag); - pMinion->CastSpell(pMinion, SPELL_ARCHAEDAS_AWAKEN, true); + DoCast(minion, SPELL_AWAKEN_VAULT_WALKER, flag); + minion->CastSpell(minion, SPELL_ARCHAEDAS_AWAKEN, true); + minion->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE); + minion->RemoveFlag(UNIT_FIELD_FLAGS,UNIT_FLAG_DISABLE_MOVE); + minion->setFaction(14); } } diff --git a/src/server/scripts/EasternKingdoms/Uldaman/instance_uldaman.cpp b/src/server/scripts/EasternKingdoms/Uldaman/instance_uldaman.cpp index ade07039a23..ee82da668f8 100644 --- a/src/server/scripts/EasternKingdoms/Uldaman/instance_uldaman.cpp +++ b/src/server/scripts/EasternKingdoms/Uldaman/instance_uldaman.cpp @@ -202,6 +202,9 @@ class instance_uldaman : public InstanceMapScript continue; archaedas->CastSpell(target, SPELL_AWAKEN_VAULT_WALKER, true); target->CastSpell(target, SPELL_ARCHAEDAS_AWAKEN, true); + target->RemoveFlag(UNIT_FIELD_FLAGS,UNIT_FLAG_DISABLE_MOVE); + target->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE); + target->setFaction(14); return; // only want the first one we find } } diff --git a/src/server/scripts/EasternKingdoms/ZulGurub/boss_mandokir.cpp b/src/server/scripts/EasternKingdoms/ZulGurub/boss_mandokir.cpp index 83cd0b46fb8..32831eb047b 100644 --- a/src/server/scripts/EasternKingdoms/ZulGurub/boss_mandokir.cpp +++ b/src/server/scripts/EasternKingdoms/ZulGurub/boss_mandokir.cpp @@ -45,6 +45,8 @@ EndScriptData */ //Ohgans Spells #define SPELL_SUNDERARMOR 24317 +#define NPC_SPEAKER 11391 + class boss_mandokir : public CreatureScript { public: @@ -79,6 +81,7 @@ class boss_mandokir : public CreatureScript bool someWatched; bool RaptorDead; bool CombatStart; + bool SpeakerDead; uint64 WatchTarget; @@ -103,6 +106,7 @@ class boss_mandokir : public CreatureScript endWatch = false; RaptorDead = false; CombatStart = false; + SpeakerDead = false; DoCast(me, 23243); } @@ -129,19 +133,31 @@ class boss_mandokir : public CreatureScript } } } - DoCast(me, SPELL_LEVEL_UP, true); - KillCount = 0; + DoCast(me, SPELL_LEVEL_UP, true); + KillCount = 0; } } } void EnterCombat(Unit* /*who*/) { - DoScriptText(SAY_AGGRO, me); + DoScriptText(SAY_AGGRO, me); } void UpdateAI(const uint32 diff) { + if (!SpeakerDead) + { + if (!me->FindNearestCreature(NPC_SPEAKER, 100.0f, true)) + { + me->GetMotionMaster()->MovePoint(0, -12196.3f, -1948.37f, 130.36f); + SpeakerDead = true; + } + } + + if (me->GetMotionMaster()->GetCurrentMovementGeneratorType() != POINT_MOTION_TYPE && SpeakerDead) + me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_IMMUNE_TO_PC); + if (!UpdateVictim()) return; diff --git a/src/server/scripts/Northrend/dragonblight.cpp b/src/server/scripts/Northrend/dragonblight.cpp index ecc012eb25d..b915f4c6304 100644 --- a/src/server/scripts/Northrend/dragonblight.cpp +++ b/src/server/scripts/Northrend/dragonblight.cpp @@ -79,16 +79,16 @@ public: enum StrengthenAncientsMisc { - SAY_WALKER_FRIENDLY = 0, - SAY_WALKER_ENEMY = 1, - SAY_LOTHALOR = 0, + SAY_WALKER_FRIENDLY = 0, + SAY_WALKER_ENEMY = 1, + SAY_LOTHALOR = 0, - SPELL_CREATE_ITEM_BARK = 47550, - SPELL_CONFUSED = 47044, + SPELL_CREATE_ITEM_BARK = 47550, + SPELL_CONFUSED = 47044, - NPC_LOTHALOR = 26321, + NPC_LOTHALOR = 26321, - FACTION_WALKER_ENEMY = 14, + FACTION_WALKER_ENEMY = 14, }; class spell_q12096_q12092_dummy : public SpellScriptLoader // Strengthen the Ancients: On Interact Dummy to Woodlands Walker @@ -170,9 +170,48 @@ public: } }; +/*###### +## wyrmrest_defender +######*/ + +enum Spells +{ + SPELL_CHARACTER_SCRIPT = 49213 +}; + +#define GOSSIP_ITEM_1 "We need to get into the fight. Are you ready?" + +class npc_wyrmrest_defender : public CreatureScript +{ + public: + npc_wyrmrest_defender() : CreatureScript("npc_wyrmrest_defender") { } + + bool OnGossipHello(Player* player, Creature* creature) + { + player->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_ITEM_1, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF+1); + player->SEND_GOSSIP_MENU(player->GetGossipTextId(creature), creature->GetGUID()); + + return true; + } + + bool OnGossipSelect(Player* player, Creature* /*creature*/, uint32 /*sender*/, uint32 action) + { + player->PlayerTalkClass->ClearMenus(); + if (action == GOSSIP_ACTION_INFO_DEF+1) + { + player->CLOSE_GOSSIP_MENU(); + // Makes player cast trigger spell for 49207 on self + player->CastSpell(player, SPELL_CHARACTER_SCRIPT, true); + } + + return true; + } +}; + void AddSC_dragonblight() { new npc_alexstrasza_wr_gate; new spell_q12096_q12092_dummy; new spell_q12096_q12092_bark; + new npc_wyrmrest_defender; } diff --git a/src/server/scripts/Northrend/wintergrasp.cpp b/src/server/scripts/Northrend/wintergrasp.cpp index fc967acf9e2..59e9a31c4cf 100644 --- a/src/server/scripts/Northrend/wintergrasp.cpp +++ b/src/server/scripts/Northrend/wintergrasp.cpp @@ -119,8 +119,6 @@ class npc_wg_demolisher_engineer : public CreatureScript if (creature->isQuestGiver()) player->PrepareQuestMenu(creature->GetGUID()); - Battlefield* wintergrasp = sBattlefieldMgr->GetBattlefieldByBattleId(BATTLEFIELD_BATTLEID_WG); - if (canBuild(creature)) { if (player->HasAura(SPELL_CORPORAL)) @@ -143,8 +141,6 @@ class npc_wg_demolisher_engineer : public CreatureScript { player->CLOSE_GOSSIP_MENU(); - Battlefield* wintergrasp= sBattlefieldMgr->GetBattlefieldByBattleId(BATTLEFIELD_BATTLEID_WG); - if (canBuild(creature)) { switch (action - GOSSIP_ACTION_INFO_DEF) @@ -169,9 +165,9 @@ class npc_wg_demolisher_engineer : public CreatureScript bool canBuild(Creature* creature) { Battlefield* wintergrasp = sBattlefieldMgr->GetBattlefieldByBattleId(BATTLEFIELD_BATTLEID_WG); - if (!wintergrasp) return false; + switch (creature->GetEntry()) { case NPC_GOBLIN_MECHANIC: @@ -207,7 +203,7 @@ class npc_wg_spirit_guide : public CreatureScript return true; } - bool OnGossipSelect(Player* player, Creature* /*creature*/ , uint32 /*sender */ , uint32 action) + bool OnGossipSelect(Player* player, Creature* /*creature*/, uint32 /*sender*/, uint32 action) { player->CLOSE_GOSSIP_MENU(); @@ -307,15 +303,13 @@ class go_wg_vehicle_teleporter : public GameObjectScript { if (_checkTimer <= diff) { - // Tabulation madness in the hole! - for (uint8 i = 0; i < MAX_WINTERGRASP_VEHICLES; i++) - if (Creature* vehicleCreature = go->FindNearestCreature(vehiclesList[i], 3.0f, true)) - if (!vehicleCreature->HasAura(SPELL_VEHICLE_TELEPORT)) - if (Vehicle* vehicle = vehicleCreature->GetVehicle()) - if (Unit* passenger = vehicle->GetPassenger(0)) - if (go->GetUInt32Value(GAMEOBJECT_FACTION) == passenger->getFaction()) - if (Creature* teleportTrigger = vehicleCreature->FindNearestCreature(NPC_WORLD_TRIGGER_LARGE_AOI_NOT_IMMUNE_PC_NPC, 100.0f, true)) - teleportTrigger->CastSpell(vehicleCreature, SPELL_VEHICLE_TELEPORT, true); + if (Battlefield* wg = sBattlefieldMgr->GetBattlefieldByBattleId(BATTLEFIELD_BATTLEID_WG)) + // Tabulation madness in the hole! + for (uint8 i = 0; i < MAX_WINTERGRASP_VEHICLES; i++) + if (Creature* vehicleCreature = go->FindNearestCreature(vehiclesList[i], 3.0f, true)) + if (!vehicleCreature->HasAura(SPELL_VEHICLE_TELEPORT) && vehicleCreature->getFaction() == WintergraspFaction[wg->GetDefenderTeam()]) + if (Creature* teleportTrigger = vehicleCreature->FindNearestCreature(NPC_WORLD_TRIGGER_LARGE_AOI_NOT_IMMUNE_PC_NPC, 100.0f, true)) + teleportTrigger->CastSpell(vehicleCreature, SPELL_VEHICLE_TELEPORT, true); _checkTimer = 1000; } @@ -326,7 +320,7 @@ class go_wg_vehicle_teleporter : public GameObjectScript uint32 _checkTimer; }; - GameObjectAI* GetGameObjectAI(GameObject* go) const + GameObjectAI* GetAI(GameObject* go) const { return new go_wg_vehicle_teleporterAI(go); } @@ -508,7 +502,7 @@ class spell_wintergrasp_grab_passenger : public SpellScriptLoader void HandleScript(SpellEffIndex /*effIndex*/) { if (Player* target = GetHitPlayer()) - target->CastSpell(GetCaster(), SPELL_RIDE_WG_VEHICLE, true); + target->CastSpell(GetCaster(), SPELL_RIDE_WG_VEHICLE, false); } void Register() @@ -547,6 +541,36 @@ public: } }; +class spell_wintergrasp_defender_teleport : public SpellScriptLoader +{ +public: + spell_wintergrasp_defender_teleport() : SpellScriptLoader("spell_wintergrasp_defender_teleport") { } + + class spell_wintergrasp_defender_teleport_SpellScript : public SpellScript + { + PrepareSpellScript(spell_wintergrasp_defender_teleport_SpellScript); + + SpellCastResult CheckCast() + { + if (Battlefield* wg = sBattlefieldMgr->GetBattlefieldByBattleId(BATTLEFIELD_BATTLEID_WG)) + if (Player* target = GetExplTargetUnit()->ToPlayer()) + if (target->GetTeamId() != wg->GetDefenderTeam()) + return SPELL_FAILED_BAD_TARGETS; + return SPELL_CAST_OK; + } + + void Register() + { + OnCheckCast += SpellCheckCastFn(spell_wintergrasp_defender_teleport_SpellScript::CheckCast); + } + }; + + SpellScript* GetSpellScript() const + { + return new spell_wintergrasp_defender_teleport_SpellScript(); + } +}; + void AddSC_wintergrasp() { new npc_wg_queue(); @@ -557,4 +581,5 @@ void AddSC_wintergrasp() new spell_wintergrasp_force_building(); new spell_wintergrasp_grab_passenger(); new achievement_wg_didnt_stand_a_chance(); + new spell_wintergrasp_defender_teleport(); } diff --git a/src/server/scripts/Spells/spell_generic.cpp b/src/server/scripts/Spells/spell_generic.cpp index 9cbf81b39af..5eebb69d7a5 100644 --- a/src/server/scripts/Spells/spell_generic.cpp +++ b/src/server/scripts/Spells/spell_generic.cpp @@ -3076,6 +3076,96 @@ class spell_gen_mount : public SpellScriptLoader uint32 _mount310; }; +enum FoamSword +{ + ITEM_FOAM_SWORD_GREEN = 45061, + ITEM_FOAM_SWORD_PINK = 45176, + ITEM_FOAM_SWORD_BLUE = 45177, + ITEM_FOAM_SWORD_RED = 45178, + ITEM_FOAM_SWORD_YELLOW = 45179, + + SPELL_BONKED = 62991, + SPELL_FOAM_SWORD_DEFEAT = 62994, + SPELL_ON_GUARD = 62972, +}; + +class spell_gen_upper_deck_create_foam_sword : public SpellScriptLoader +{ + public: + spell_gen_upper_deck_create_foam_sword() : SpellScriptLoader("spell_gen_upper_deck_create_foam_sword") { } + + class spell_gen_upper_deck_create_foam_sword_SpellScript : public SpellScript + { + PrepareSpellScript(spell_gen_upper_deck_create_foam_sword_SpellScript); + + void HandleScript(SpellEffIndex effIndex) + { + if (Player* player = GetHitPlayer()) + { + static uint32 const itemId[5] = { ITEM_FOAM_SWORD_GREEN, ITEM_FOAM_SWORD_PINK, ITEM_FOAM_SWORD_BLUE, ITEM_FOAM_SWORD_RED, ITEM_FOAM_SWORD_YELLOW }; + // player can only have one of these items + for (uint8 i = 0; i < 5; ++i) + { + if (player->HasItemCount(itemId[i], 1, true)) + return; + } + + CreateItem(effIndex, itemId[urand(0, 4)]); + } + } + + void Register() + { + OnEffectHitTarget += SpellEffectFn(spell_gen_upper_deck_create_foam_sword_SpellScript::HandleScript, EFFECT_0, SPELL_EFFECT_SCRIPT_EFFECT); + } + }; + + SpellScript* GetSpellScript() const + { + return new spell_gen_upper_deck_create_foam_sword_SpellScript(); + } +}; + +class spell_gen_bonked : public SpellScriptLoader +{ + public: + spell_gen_bonked() : SpellScriptLoader("spell_gen_bonked") { } + + class spell_gen_bonked_SpellScript : public SpellScript + { + PrepareSpellScript(spell_gen_bonked_SpellScript); + + void HandleScript(SpellEffIndex /*effIndex*/) + { + if (Player* target = GetHitPlayer()) + { + Aura const* aura = GetHitAura(); + if (!(aura && aura->GetStackAmount() == 3)) + return; + + target->CastSpell(target, SPELL_FOAM_SWORD_DEFEAT, true); + target->RemoveAurasDueToSpell(SPELL_BONKED); + + if (Aura const* aura = target->GetAura(SPELL_ON_GUARD)) + { + if (Item* item = target->GetItemByGuid(aura->GetCastItemGUID())) + target->DestroyItemCount(item->GetEntry(), 1, true); + } + } + } + + void Register() + { + OnEffectHitTarget += SpellEffectFn(spell_gen_bonked_SpellScript::HandleScript, EFFECT_1, SPELL_EFFECT_SCRIPT_EFFECT); + } + }; + + SpellScript* GetSpellScript() const + { + return new spell_gen_bonked_SpellScript(); + } +}; + void AddSC_generic_spell_scripts() { new spell_gen_absorb0_hitlimit1(); @@ -3148,4 +3238,6 @@ void AddSC_generic_spell_scripts() new spell_gen_mount("spell_blazing_hippogryph", 0, 0, 0, SPELL_BLAZING_HIPPOGRYPH_150, SPELL_BLAZING_HIPPOGRYPH_280); new spell_gen_mount("spell_celestial_steed", 0, SPELL_CELESTIAL_STEED_60, SPELL_CELESTIAL_STEED_100, SPELL_CELESTIAL_STEED_150, SPELL_CELESTIAL_STEED_280, SPELL_CELESTIAL_STEED_310); new spell_gen_mount("spell_x53_touring_rocket", 0, 0, 0, SPELL_X53_TOURING_ROCKET_150, SPELL_X53_TOURING_ROCKET_280, SPELL_X53_TOURING_ROCKET_310); + new spell_gen_upper_deck_create_foam_sword(); + new spell_gen_bonked(); } diff --git a/src/server/scripts/Spells/spell_quest.cpp b/src/server/scripts/Spells/spell_quest.cpp index 5648c510413..3cb2300cadf 100644 --- a/src/server/scripts/Spells/spell_quest.cpp +++ b/src/server/scripts/Spells/spell_quest.cpp @@ -1245,6 +1245,75 @@ class spell_q12735_song_of_cleansing : public SpellScriptLoader } }; +enum DefendingWyrmrestTemple +{ + SPELL_SUMMON_WYRMREST_DEFENDER = 49207 +}; + +class spell_q12372_cast_from_gossip_trigger : public SpellScriptLoader +{ + public: + spell_q12372_cast_from_gossip_trigger() : SpellScriptLoader("spell_q12372_cast_from_gossip_trigger") { } + + class spell_q12372_cast_from_gossip_trigger_SpellScript : public SpellScript + { + PrepareSpellScript(spell_q12372_cast_from_gossip_trigger_SpellScript); + + void HandleScript(SpellEffIndex /*effIndex*/) + { + GetCaster()->CastSpell(GetCaster(), SPELL_SUMMON_WYRMREST_DEFENDER, true); + } + + void Register() + { + OnEffectHitTarget += SpellEffectFn(spell_q12372_cast_from_gossip_trigger_SpellScript::HandleScript, EFFECT_0, SPELL_EFFECT_SCRIPT_EFFECT); + } + }; + + SpellScript* GetSpellScript() const + { + return new spell_q12372_cast_from_gossip_trigger_SpellScript(); + } +}; + +// http://www.wowhead.com/quest=12372 Defending Wyrmrest Temple +// 49370 - Wyrmrest Defender: Destabilize Azure Dragonshrine Effect +enum Quest12372Data +{ + NPC_WYRMREST_TEMPLE_CREDIT = 27698, +}; + +class spell_q12372_destabilize_azure_dragonshrine_dummy : public SpellScriptLoader +{ + public: + spell_q12372_destabilize_azure_dragonshrine_dummy() : SpellScriptLoader("spell_q12372_destabilize_azure_dragonshrine_dummy") { } + + class spell_q12372_destabilize_azure_dragonshrine_dummy_SpellScript : public SpellScript + { + PrepareSpellScript(spell_q12372_destabilize_azure_dragonshrine_dummy_SpellScript); + + void HandleDummy(SpellEffIndex /*effIndex*/) + { + if (GetHitCreature()) + if (Unit* caster = GetOriginalCaster()) + if (Vehicle* vehicle = caster->GetVehicleKit()) + if (Unit* passenger = vehicle->GetPassenger(0)) + if (Player* player = passenger->ToPlayer()) + player->KilledMonsterCredit(NPC_WYRMREST_TEMPLE_CREDIT, 0); + } + + void Register() + { + OnEffectHitTarget += SpellEffectFn(spell_q12372_destabilize_azure_dragonshrine_dummy_SpellScript::HandleDummy, EFFECT_0, SPELL_EFFECT_DUMMY); + } + }; + + SpellScript* GetSpellScript() const + { + return new spell_q12372_destabilize_azure_dragonshrine_dummy_SpellScript(); + } +}; + void AddSC_quest_spell_scripts() { new spell_q55_sacred_cleansing(); @@ -1274,4 +1343,6 @@ void AddSC_quest_spell_scripts() new spell_q12277_wintergarde_mine_explosion(); new spell_q12066_bunny_kill_credit(); new spell_q12735_song_of_cleansing(); + new spell_q12372_cast_from_gossip_trigger(); + new spell_q12372_destabilize_azure_dragonshrine_dummy(); } diff --git a/src/server/shared/Database/AdhocStatement.cpp b/src/server/shared/Database/AdhocStatement.cpp index 9e795ae853a..95dce77e53c 100755 --- a/src/server/shared/Database/AdhocStatement.cpp +++ b/src/server/shared/Database/AdhocStatement.cpp @@ -44,6 +44,7 @@ bool BasicStatementTask::Execute() ResultSet* result = m_conn->Query(m_sql); if (!result || !result->GetRowCount()) { + delete result; m_result.set(QueryResult(NULL)); return false; } diff --git a/src/server/shared/Database/DatabaseWorkerPool.h b/src/server/shared/Database/DatabaseWorkerPool.h index 9d6fabb9dfa..001e74fc6c6 100755 --- a/src/server/shared/Database/DatabaseWorkerPool.h +++ b/src/server/shared/Database/DatabaseWorkerPool.h @@ -224,7 +224,10 @@ class DatabaseWorkerPool ResultSet* result = conn->Query(sql); conn->Unlock(); if (!result || !result->GetRowCount()) + { + delete result; return QueryResult(NULL); + } result->NextRow(); return QueryResult(result); @@ -275,7 +278,10 @@ class DatabaseWorkerPool delete stmt; if (!ret || !ret->GetRowCount()) + { + delete ret; return PreparedQueryResult(NULL); + } return PreparedQueryResult(ret); } diff --git a/src/server/shared/Database/PreparedStatement.cpp b/src/server/shared/Database/PreparedStatement.cpp index a72532e928b..21aef0f1834 100755 --- a/src/server/shared/Database/PreparedStatement.cpp +++ b/src/server/shared/Database/PreparedStatement.cpp @@ -440,6 +440,7 @@ bool PreparedStatementTask::Execute() PreparedResultSet* result = m_conn->Query(m_stmt); if (!result || !result->GetRowCount()) { + delete result; m_result.set(PreparedQueryResult(NULL)); return false; } diff --git a/src/server/shared/Database/QueryHolder.cpp b/src/server/shared/Database/QueryHolder.cpp index 99772c7e323..0908ad410cd 100755 --- a/src/server/shared/Database/QueryHolder.cpp +++ b/src/server/shared/Database/QueryHolder.cpp @@ -116,6 +116,12 @@ PreparedQueryResult SQLQueryHolder::GetPreparedResult(size_t index) void SQLQueryHolder::SetResult(size_t index, ResultSet* result) { + if (result && !result->GetRowCount()) + { + delete result; + result = NULL; + } + /// store the result in the holder if (index < m_queries.size()) m_queries[index].second.qresult = result; @@ -123,6 +129,12 @@ void SQLQueryHolder::SetResult(size_t index, ResultSet* result) void SQLQueryHolder::SetPreparedResult(size_t index, PreparedResultSet* result) { + if (result && !result->GetRowCount()) + { + delete result; + result = NULL; + } + /// store the result in the holder if (index < m_queries.size()) m_queries[index].second.presult = result; diff --git a/src/server/shared/Logging/Log.cpp b/src/server/shared/Logging/Log.cpp index 3a24190d8fa..6e17a32c78b 100755 --- a/src/server/shared/Logging/Log.cpp +++ b/src/server/shared/Logging/Log.cpp @@ -260,14 +260,9 @@ void Log::ReadLoggersFromConfig() } while (ss); - LoggerMap::const_iterator it = loggers.begin(); - - while (it != loggers.end() && it->first) - ++it; - // root logger must exist. Marking as disabled as its not configured - if (it == loggers.end()) - loggers[0].Create("root", LOG_FILTER_GENERAL, LOG_LEVEL_DISABLED); + if (loggers.find(LOG_FILTER_GENERAL) == loggers.end()) + loggers[LOG_FILTER_GENERAL].Create("root", LOG_FILTER_GENERAL, LOG_LEVEL_DISABLED); } void Log::EnableDBAppenders() @@ -349,10 +344,7 @@ bool Log::SetLogLevel(std::string const& name, const char* newLevelc, bool isLog bool Log::ShouldLog(LogFilterType type, LogLevel level) const { - LoggerMap::const_iterator it = loggers.begin(); - while (it != loggers.end() && it->second.getType() != type) - ++it; - + LoggerMap::const_iterator it = loggers.find(type); if (it != loggers.end()) { LogLevel loggerLevel = it->second.getLogLevel(); diff --git a/src/server/worldserver/worldserver.conf.dist b/src/server/worldserver/worldserver.conf.dist index a3ba270b4bd..9eab3c40a2d 100644 --- a/src/server/worldserver/worldserver.conf.dist +++ b/src/server/worldserver/worldserver.conf.dist @@ -49,7 +49,7 @@ # # RealmID # Description: ID of the Realm using this config. -# Important: RealmID must match the realmlist inside the realmd database. +# Important: RealmID must match the realmlist inside the auth database. # Default: 1 RealmID = 1 @@ -174,7 +174,7 @@ Compression = 1 # PlayerLimit # Description: Maximum number of players in the world. Excluding Mods, GMs and Admins. # Important: If you want to block players and only allow Mods, GMs or Admins to join the -# server, use the DB field "realmd.realmlist.allowedSecurityLevel". +# server, use the DB field "auth.realmlist.allowedSecurityLevel". # Default: 100 - (Enabled) # 1+ - (Enabled) # 0 - (Disabled, No limit) |
