aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/server/authserver/Main.cpp9
-rw-r--r--src/server/game/AI/SmartScripts/SmartAI.cpp3
-rw-r--r--src/server/game/Accounts/RBAC.cpp530
-rw-r--r--src/server/game/Battlegrounds/Zones/BattlegroundWS.cpp2
-rw-r--r--src/server/game/Entities/Creature/Creature.cpp2
-rw-r--r--src/server/game/Entities/Creature/Creature.h4
-rw-r--r--src/server/game/Entities/GameObject/GameObject.cpp6
-rw-r--r--src/server/game/Entities/GameObject/GameObject.h6
-rw-r--r--src/server/game/Entities/Player/Player.cpp10
-rw-r--r--src/server/game/Entities/Player/Player.h2
-rw-r--r--src/server/game/Entities/Unit/Unit.cpp65
-rw-r--r--src/server/game/Entities/Unit/Unit.h2
-rw-r--r--src/server/game/Globals/ObjectMgr.cpp159
-rw-r--r--src/server/game/Globals/ObjectMgr.h27
-rw-r--r--src/server/game/Handlers/MovementHandler.cpp2
-rw-r--r--src/server/game/Handlers/QueryHandler.cpp22
-rw-r--r--src/server/game/Instances/InstanceSaveMgr.cpp4
-rw-r--r--src/server/game/Maps/Map.cpp2
-rw-r--r--src/server/game/Movement/PathGenerator.cpp1
-rw-r--r--src/server/game/Quests/QuestDef.cpp156
-rw-r--r--src/server/game/Quests/QuestDef.h35
-rw-r--r--src/server/game/Spells/Auras/SpellAuraEffects.cpp4
-rw-r--r--src/server/game/Spells/Auras/SpellAuras.cpp1
-rw-r--r--src/server/game/Spells/Spell.cpp43
-rw-r--r--src/server/game/Spells/SpellEffects.cpp15
-rw-r--r--src/server/game/World/World.cpp6
-rw-r--r--src/server/scripts/Commands/cs_misc.cpp6
-rw-r--r--src/server/scripts/Commands/cs_mmaps.cpp8
-rw-r--r--src/server/scripts/Commands/cs_rbac.cpp766
-rw-r--r--src/server/scripts/Northrend/ChamberOfAspects/RubySanctum/boss_halion.cpp4
-rw-r--r--src/server/scripts/Northrend/FrozenHalls/ForgeOfSouls/boss_bronjahm.cpp20
-rw-r--r--src/server/scripts/Northrend/Nexus/EyeOfEternity/boss_malygos.cpp10
-rw-r--r--src/server/scripts/Northrend/Nexus/EyeOfEternity/instance_eye_of_eternity.cpp37
-rw-r--r--src/server/scripts/Northrend/Ulduar/Ulduar/instance_ulduar.cpp33
-rw-r--r--src/server/scripts/Northrend/Ulduar/Ulduar/ulduar.h1
-rw-r--r--src/server/scripts/Northrend/VioletHold/boss_ichoron.cpp2
-rw-r--r--src/server/scripts/Outland/BlackTemple/boss_warlord_najentus.cpp430
-rw-r--r--src/server/scripts/Spells/spell_quest.cpp30
-rw-r--r--src/server/shared/Database/Implementation/WorldDatabase.cpp2
-rw-r--r--src/server/shared/Packets/ByteBuffer.h2
-rw-r--r--src/server/shared/Updater/DBUpdater.cpp4
-rw-r--r--src/server/shared/Utilities/TaskScheduler.cpp3
-rw-r--r--src/server/worldserver/Main.cpp9
43 files changed, 1365 insertions, 1120 deletions
diff --git a/src/server/authserver/Main.cpp b/src/server/authserver/Main.cpp
index 15ab1c38925..9a3bd6a58dd 100644
--- a/src/server/authserver/Main.cpp
+++ b/src/server/authserver/Main.cpp
@@ -79,8 +79,8 @@ int main(int argc, char** argv)
std::string configFile = _TRINITY_REALM_CONFIG;
std::string configService;
auto vm = GetConsoleArguments(argc, argv, configFile, configService);
- // exit if help is enabled
- if (vm.count("help"))
+ // exit if help or version is enabled
+ if (vm.count("help") || vm.count("version"))
return 0;
#if PLATFORM == PLATFORM_WINDOWS
@@ -262,6 +262,7 @@ variables_map GetConsoleArguments(int argc, char** argv, std::string& configFile
options_description all("Allowed options");
all.add_options()
("help,h", "print usage message")
+ ("version,v", "print version build info")
("config,c", value<std::string>(&configFile)->default_value(_TRINITY_REALM_CONFIG), "use <arg> as configuration file")
;
#if PLATFORM == PLATFORM_WINDOWS
@@ -271,6 +272,8 @@ variables_map GetConsoleArguments(int argc, char** argv, std::string& configFile
;
all.add(win);
+#else
+ (void)configService;
#endif
variables_map variablesMap;
try
@@ -285,6 +288,8 @@ variables_map GetConsoleArguments(int argc, char** argv, std::string& configFile
if (variablesMap.count("help"))
std::cout << all << "\n";
+ else if (variablesMap.count("version"))
+ std::cout << _FULLVERSION << "\n";
return variablesMap;
}
diff --git a/src/server/game/AI/SmartScripts/SmartAI.cpp b/src/server/game/AI/SmartScripts/SmartAI.cpp
index 21a15fa4f99..0b040fc519a 100644
--- a/src/server/game/AI/SmartScripts/SmartAI.cpp
+++ b/src/server/game/AI/SmartScripts/SmartAI.cpp
@@ -763,6 +763,9 @@ void SmartAI::SetCombatMove(bool on)
}
else
{
+ if (me->HasUnitState(UNIT_STATE_CONFUSED_MOVE | UNIT_STATE_FLEEING_MOVE))
+ return;
+
me->GetMotionMaster()->MovementExpired();
me->GetMotionMaster()->Clear(true);
me->StopMoving();
diff --git a/src/server/game/Accounts/RBAC.cpp b/src/server/game/Accounts/RBAC.cpp
index 54ef1a34766..74ff060636e 100644
--- a/src/server/game/Accounts/RBAC.cpp
+++ b/src/server/game/Accounts/RBAC.cpp
@@ -1,265 +1,265 @@
-/*
- * Copyright (C) 2008-2015 TrinityCore <http://www.trinitycore.org/>
- *
- * This program is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License as published by the
- * Free Software Foundation; either version 2 of the License, or (at your
- * option) any later version.
- *
- * This program is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
- * more details.
- *
- * You should have received a copy of the GNU General Public License along
- * with this program. If not, see <http://www.gnu.org/licenses/>.
- */
-
-#include "RBAC.h"
-#include "AccountMgr.h"
-#include "DatabaseEnv.h"
-#include "Log.h"
-
-namespace rbac
-{
-
-std::string GetDebugPermissionString(RBACPermissionContainer const& perms)
-{
- std::string str = "";
- if (!perms.empty())
- {
- std::ostringstream o;
- RBACPermissionContainer::const_iterator itr = perms.begin();
- o << (*itr);
- for (++itr; itr != perms.end(); ++itr)
- o << ", " << uint32(*itr);
- str = o.str();
- }
-
- return str;
-}
-
-RBACCommandResult RBACData::GrantPermission(uint32 permissionId, int32 realmId /* = 0*/)
-{
- // Check if permission Id exists
- RBACPermission const* perm = sAccountMgr->GetRBACPermission(permissionId);
- if (!perm)
- {
- TC_LOG_TRACE("rbac", "RBACData::GrantPermission [Id: %u Name: %s] (Permission %u, RealmId %d). Permission does not exists",
- GetId(), GetName().c_str(), permissionId, realmId);
- return RBAC_ID_DOES_NOT_EXISTS;
- }
-
- // Check if already added in denied list
- if (HasDeniedPermission(permissionId))
- {
- TC_LOG_TRACE("rbac", "RBACData::GrantPermission [Id: %u Name: %s] (Permission %u, RealmId %d). Permission in deny list",
- GetId(), GetName().c_str(), permissionId, realmId);
- return RBAC_IN_DENIED_LIST;
- }
-
- // Already added?
- if (HasGrantedPermission(permissionId))
- {
- TC_LOG_TRACE("rbac", "RBACData::GrantPermission [Id: %u Name: %s] (Permission %u, RealmId %d). Permission already granted",
- GetId(), GetName().c_str(), permissionId, realmId);
- return RBAC_CANT_ADD_ALREADY_ADDED;
- }
-
- AddGrantedPermission(permissionId);
-
- // Do not save to db when loading data from DB (realmId = 0)
- if (realmId)
- {
- TC_LOG_TRACE("rbac", "RBACData::GrantPermission [Id: %u Name: %s] (Permission %u, RealmId %d). Ok and DB updated",
- GetId(), GetName().c_str(), permissionId, realmId);
- SavePermission(permissionId, true, realmId);
- CalculateNewPermissions();
- }
- else
- TC_LOG_TRACE("rbac", "RBACData::GrantPermission [Id: %u Name: %s] (Permission %u, RealmId %d). Ok",
- GetId(), GetName().c_str(), permissionId, realmId);
-
- return RBAC_OK;
-}
-
-RBACCommandResult RBACData::DenyPermission(uint32 permissionId, int32 realmId /* = 0*/)
-{
- // Check if permission Id exists
- RBACPermission const* perm = sAccountMgr->GetRBACPermission(permissionId);
- if (!perm)
- {
- TC_LOG_TRACE("rbac", "RBACData::DenyPermission [Id: %u Name: %s] (Permission %u, RealmId %d). Permission does not exists",
- GetId(), GetName().c_str(), permissionId, realmId);
- return RBAC_ID_DOES_NOT_EXISTS;
- }
-
- // Check if already added in granted list
- if (HasGrantedPermission(permissionId))
- {
- TC_LOG_TRACE("rbac", "RBACData::DenyPermission [Id: %u Name: %s] (Permission %u, RealmId %d). Permission in grant list",
- GetId(), GetName().c_str(), permissionId, realmId);
- return RBAC_IN_GRANTED_LIST;
- }
-
- // Already added?
- if (HasDeniedPermission(permissionId))
- {
- TC_LOG_TRACE("rbac", "RBACData::DenyPermission [Id: %u Name: %s] (Permission %u, RealmId %d). Permission already denied",
- GetId(), GetName().c_str(), permissionId, realmId);
- return RBAC_CANT_ADD_ALREADY_ADDED;
- }
-
- AddDeniedPermission(permissionId);
-
- // Do not save to db when loading data from DB (realmId = 0)
- if (realmId)
- {
- TC_LOG_TRACE("rbac", "RBACData::DenyPermission [Id: %u Name: %s] (Permission %u, RealmId %d). Ok and DB updated",
- GetId(), GetName().c_str(), permissionId, realmId);
- SavePermission(permissionId, false, realmId);
- CalculateNewPermissions();
- }
- else
- TC_LOG_TRACE("rbac", "RBACData::DenyPermission [Id: %u Name: %s] (Permission %u, RealmId %d). Ok",
- GetId(), GetName().c_str(), permissionId, realmId);
-
- return RBAC_OK;
-}
-
-void RBACData::SavePermission(uint32 permission, bool granted, int32 realmId)
-{
- PreparedStatement* stmt = LoginDatabase.GetPreparedStatement(LOGIN_INS_RBAC_ACCOUNT_PERMISSION);
- stmt->setUInt32(0, GetId());
- stmt->setUInt32(1, permission);
- stmt->setBool(2, granted);
- stmt->setInt32(3, realmId);
- LoginDatabase.Execute(stmt);
-}
-
-RBACCommandResult RBACData::RevokePermission(uint32 permissionId, int32 realmId /* = 0*/)
-{
- // Check if it's present in any list
- if (!HasGrantedPermission(permissionId) && !HasDeniedPermission(permissionId))
- {
- TC_LOG_TRACE("rbac", "RBACData::RevokePermission [Id: %u Name: %s] (Permission %u, RealmId %d). Not granted or revoked",
- GetId(), GetName().c_str(), permissionId, realmId);
- return RBAC_CANT_REVOKE_NOT_IN_LIST;
- }
-
- RemoveGrantedPermission(permissionId);
- RemoveDeniedPermission(permissionId);
-
- // Do not save to db when loading data from DB (realmId = 0)
- if (realmId)
- {
- TC_LOG_TRACE("rbac", "RBACData::RevokePermission [Id: %u Name: %s] (Permission %u, RealmId %d). Ok and DB updated",
- GetId(), GetName().c_str(), permissionId, realmId);
- PreparedStatement* stmt = LoginDatabase.GetPreparedStatement(LOGIN_DEL_RBAC_ACCOUNT_PERMISSION);
- stmt->setUInt32(0, GetId());
- stmt->setUInt32(1, permissionId);
- stmt->setInt32(2, realmId);
- LoginDatabase.Execute(stmt);
-
- CalculateNewPermissions();
- }
- else
- TC_LOG_TRACE("rbac", "RBACData::RevokePermission [Id: %u Name: %s] (Permission %u, RealmId %d). Ok",
- GetId(), GetName().c_str(), permissionId, realmId);
-
- return RBAC_OK;
-}
-
-void RBACData::LoadFromDB()
-{
- ClearData();
-
- TC_LOG_DEBUG("rbac", "RBACData::LoadFromDB [Id: %u Name: %s]: Loading permissions", GetId(), GetName().c_str());
- // Load account permissions (granted and denied) that affect current realm
- PreparedStatement* stmt = LoginDatabase.GetPreparedStatement(LOGIN_SEL_RBAC_ACCOUNT_PERMISSIONS);
- stmt->setUInt32(0, GetId());
- stmt->setInt32(1, GetRealmId());
-
- PreparedQueryResult result = LoginDatabase.Query(stmt);
- if (result)
- {
- do
- {
- Field* fields = result->Fetch();
- if (fields[1].GetBool())
- GrantPermission(fields[0].GetUInt32());
- else
- DenyPermission(fields[0].GetUInt32());
- }
- while (result->NextRow());
- }
-
- // Add default permissions
- RBACPermissionContainer const& permissions = sAccountMgr->GetRBACDefaultPermissions(_secLevel);
- for (RBACPermissionContainer::const_iterator itr = permissions.begin(); itr != permissions.end(); ++itr)
- GrantPermission(*itr);
-
- // Force calculation of permissions
- CalculateNewPermissions();
-}
-
-void RBACData::CalculateNewPermissions()
-{
- TC_LOG_TRACE("rbac", "RBACData::CalculateNewPermissions [Id: %u Name: %s]", GetId(), GetName().c_str());
-
- // Get the list of granted permissions
- _globalPerms = GetGrantedPermissions();
- ExpandPermissions(_globalPerms);
- RBACPermissionContainer revoked = GetDeniedPermissions();
- ExpandPermissions(revoked);
- RemovePermissions(_globalPerms, revoked);
-}
-
-void RBACData::AddPermissions(RBACPermissionContainer const& permsFrom, RBACPermissionContainer& permsTo)
-{
- for (RBACPermissionContainer::const_iterator itr = permsFrom.begin(); itr != permsFrom.end(); ++itr)
- permsTo.insert(*itr);
-}
-
-void RBACData::RemovePermissions(RBACPermissionContainer const& permsFrom, RBACPermissionContainer& permsTo)
-{
- for (RBACPermissionContainer::const_iterator itr = permsFrom.begin(); itr != permsFrom.end(); ++itr)
- permsTo.erase(*itr);
-}
-
-void RBACData::ExpandPermissions(RBACPermissionContainer& permissions)
-{
- RBACPermissionContainer toCheck = permissions;
- permissions.clear();
-
- while (!toCheck.empty())
- {
- // remove the permission from original list
- uint32 permissionId = *toCheck.begin();
- toCheck.erase(toCheck.begin());
-
- RBACPermission const* permission = sAccountMgr->GetRBACPermission(permissionId);
- if (!permission)
- continue;
-
- // insert into the final list (expanded list)
- permissions.insert(permissionId);
-
- // add all linked permissions (that are not already expanded) to the list of permissions to be checked
- RBACPermissionContainer const& linkedPerms = permission->GetLinkedPermissions();
- for (RBACPermissionContainer::const_iterator itr = linkedPerms.begin(); itr != linkedPerms.end(); ++itr)
- if (permissions.find(*itr) == permissions.end())
- toCheck.insert(*itr);
- }
-
- TC_LOG_DEBUG("rbac", "RBACData::ExpandPermissions: Expanded: %s", GetDebugPermissionString(permissions).c_str());
-}
-
-void RBACData::ClearData()
-{
- _grantedPerms.clear();
- _deniedPerms.clear();
- _globalPerms.clear();
-}
-
-}
+/*
+ * Copyright (C) 2008-2015 TrinityCore <http://www.trinitycore.org/>
+ *
+ * This program is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License as published by the
+ * Free Software Foundation; either version 2 of the License, or (at your
+ * option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
+ * more details.
+ *
+ * You should have received a copy of the GNU General Public License along
+ * with this program. If not, see <http://www.gnu.org/licenses/>.
+ */
+
+#include "RBAC.h"
+#include "AccountMgr.h"
+#include "DatabaseEnv.h"
+#include "Log.h"
+
+namespace rbac
+{
+
+std::string GetDebugPermissionString(RBACPermissionContainer const& perms)
+{
+ std::string str = "";
+ if (!perms.empty())
+ {
+ std::ostringstream o;
+ RBACPermissionContainer::const_iterator itr = perms.begin();
+ o << (*itr);
+ for (++itr; itr != perms.end(); ++itr)
+ o << ", " << uint32(*itr);
+ str = o.str();
+ }
+
+ return str;
+}
+
+RBACCommandResult RBACData::GrantPermission(uint32 permissionId, int32 realmId /* = 0*/)
+{
+ // Check if permission Id exists
+ RBACPermission const* perm = sAccountMgr->GetRBACPermission(permissionId);
+ if (!perm)
+ {
+ TC_LOG_TRACE("rbac", "RBACData::GrantPermission [Id: %u Name: %s] (Permission %u, RealmId %d). Permission does not exists",
+ GetId(), GetName().c_str(), permissionId, realmId);
+ return RBAC_ID_DOES_NOT_EXISTS;
+ }
+
+ // Check if already added in denied list
+ if (HasDeniedPermission(permissionId))
+ {
+ TC_LOG_TRACE("rbac", "RBACData::GrantPermission [Id: %u Name: %s] (Permission %u, RealmId %d). Permission in deny list",
+ GetId(), GetName().c_str(), permissionId, realmId);
+ return RBAC_IN_DENIED_LIST;
+ }
+
+ // Already added?
+ if (HasGrantedPermission(permissionId))
+ {
+ TC_LOG_TRACE("rbac", "RBACData::GrantPermission [Id: %u Name: %s] (Permission %u, RealmId %d). Permission already granted",
+ GetId(), GetName().c_str(), permissionId, realmId);
+ return RBAC_CANT_ADD_ALREADY_ADDED;
+ }
+
+ AddGrantedPermission(permissionId);
+
+ // Do not save to db when loading data from DB (realmId = 0)
+ if (realmId)
+ {
+ TC_LOG_TRACE("rbac", "RBACData::GrantPermission [Id: %u Name: %s] (Permission %u, RealmId %d). Ok and DB updated",
+ GetId(), GetName().c_str(), permissionId, realmId);
+ SavePermission(permissionId, true, realmId);
+ CalculateNewPermissions();
+ }
+ else
+ TC_LOG_TRACE("rbac", "RBACData::GrantPermission [Id: %u Name: %s] (Permission %u, RealmId %d). Ok",
+ GetId(), GetName().c_str(), permissionId, realmId);
+
+ return RBAC_OK;
+}
+
+RBACCommandResult RBACData::DenyPermission(uint32 permissionId, int32 realmId /* = 0*/)
+{
+ // Check if permission Id exists
+ RBACPermission const* perm = sAccountMgr->GetRBACPermission(permissionId);
+ if (!perm)
+ {
+ TC_LOG_TRACE("rbac", "RBACData::DenyPermission [Id: %u Name: %s] (Permission %u, RealmId %d). Permission does not exists",
+ GetId(), GetName().c_str(), permissionId, realmId);
+ return RBAC_ID_DOES_NOT_EXISTS;
+ }
+
+ // Check if already added in granted list
+ if (HasGrantedPermission(permissionId))
+ {
+ TC_LOG_TRACE("rbac", "RBACData::DenyPermission [Id: %u Name: %s] (Permission %u, RealmId %d). Permission in grant list",
+ GetId(), GetName().c_str(), permissionId, realmId);
+ return RBAC_IN_GRANTED_LIST;
+ }
+
+ // Already added?
+ if (HasDeniedPermission(permissionId))
+ {
+ TC_LOG_TRACE("rbac", "RBACData::DenyPermission [Id: %u Name: %s] (Permission %u, RealmId %d). Permission already denied",
+ GetId(), GetName().c_str(), permissionId, realmId);
+ return RBAC_CANT_ADD_ALREADY_ADDED;
+ }
+
+ AddDeniedPermission(permissionId);
+
+ // Do not save to db when loading data from DB (realmId = 0)
+ if (realmId)
+ {
+ TC_LOG_TRACE("rbac", "RBACData::DenyPermission [Id: %u Name: %s] (Permission %u, RealmId %d). Ok and DB updated",
+ GetId(), GetName().c_str(), permissionId, realmId);
+ SavePermission(permissionId, false, realmId);
+ CalculateNewPermissions();
+ }
+ else
+ TC_LOG_TRACE("rbac", "RBACData::DenyPermission [Id: %u Name: %s] (Permission %u, RealmId %d). Ok",
+ GetId(), GetName().c_str(), permissionId, realmId);
+
+ return RBAC_OK;
+}
+
+void RBACData::SavePermission(uint32 permission, bool granted, int32 realmId)
+{
+ PreparedStatement* stmt = LoginDatabase.GetPreparedStatement(LOGIN_INS_RBAC_ACCOUNT_PERMISSION);
+ stmt->setUInt32(0, GetId());
+ stmt->setUInt32(1, permission);
+ stmt->setBool(2, granted);
+ stmt->setInt32(3, realmId);
+ LoginDatabase.Execute(stmt);
+}
+
+RBACCommandResult RBACData::RevokePermission(uint32 permissionId, int32 realmId /* = 0*/)
+{
+ // Check if it's present in any list
+ if (!HasGrantedPermission(permissionId) && !HasDeniedPermission(permissionId))
+ {
+ TC_LOG_TRACE("rbac", "RBACData::RevokePermission [Id: %u Name: %s] (Permission %u, RealmId %d). Not granted or revoked",
+ GetId(), GetName().c_str(), permissionId, realmId);
+ return RBAC_CANT_REVOKE_NOT_IN_LIST;
+ }
+
+ RemoveGrantedPermission(permissionId);
+ RemoveDeniedPermission(permissionId);
+
+ // Do not save to db when loading data from DB (realmId = 0)
+ if (realmId)
+ {
+ TC_LOG_TRACE("rbac", "RBACData::RevokePermission [Id: %u Name: %s] (Permission %u, RealmId %d). Ok and DB updated",
+ GetId(), GetName().c_str(), permissionId, realmId);
+ PreparedStatement* stmt = LoginDatabase.GetPreparedStatement(LOGIN_DEL_RBAC_ACCOUNT_PERMISSION);
+ stmt->setUInt32(0, GetId());
+ stmt->setUInt32(1, permissionId);
+ stmt->setInt32(2, realmId);
+ LoginDatabase.Execute(stmt);
+
+ CalculateNewPermissions();
+ }
+ else
+ TC_LOG_TRACE("rbac", "RBACData::RevokePermission [Id: %u Name: %s] (Permission %u, RealmId %d). Ok",
+ GetId(), GetName().c_str(), permissionId, realmId);
+
+ return RBAC_OK;
+}
+
+void RBACData::LoadFromDB()
+{
+ ClearData();
+
+ TC_LOG_DEBUG("rbac", "RBACData::LoadFromDB [Id: %u Name: %s]: Loading permissions", GetId(), GetName().c_str());
+ // Load account permissions (granted and denied) that affect current realm
+ PreparedStatement* stmt = LoginDatabase.GetPreparedStatement(LOGIN_SEL_RBAC_ACCOUNT_PERMISSIONS);
+ stmt->setUInt32(0, GetId());
+ stmt->setInt32(1, GetRealmId());
+
+ PreparedQueryResult result = LoginDatabase.Query(stmt);
+ if (result)
+ {
+ do
+ {
+ Field* fields = result->Fetch();
+ if (fields[1].GetBool())
+ GrantPermission(fields[0].GetUInt32());
+ else
+ DenyPermission(fields[0].GetUInt32());
+ }
+ while (result->NextRow());
+ }
+
+ // Add default permissions
+ RBACPermissionContainer const& permissions = sAccountMgr->GetRBACDefaultPermissions(_secLevel);
+ for (RBACPermissionContainer::const_iterator itr = permissions.begin(); itr != permissions.end(); ++itr)
+ GrantPermission(*itr);
+
+ // Force calculation of permissions
+ CalculateNewPermissions();
+}
+
+void RBACData::CalculateNewPermissions()
+{
+ TC_LOG_TRACE("rbac", "RBACData::CalculateNewPermissions [Id: %u Name: %s]", GetId(), GetName().c_str());
+
+ // Get the list of granted permissions
+ _globalPerms = GetGrantedPermissions();
+ ExpandPermissions(_globalPerms);
+ RBACPermissionContainer revoked = GetDeniedPermissions();
+ ExpandPermissions(revoked);
+ RemovePermissions(_globalPerms, revoked);
+}
+
+void RBACData::AddPermissions(RBACPermissionContainer const& permsFrom, RBACPermissionContainer& permsTo)
+{
+ for (RBACPermissionContainer::const_iterator itr = permsFrom.begin(); itr != permsFrom.end(); ++itr)
+ permsTo.insert(*itr);
+}
+
+void RBACData::RemovePermissions(RBACPermissionContainer const& permsFrom, RBACPermissionContainer& permsTo)
+{
+ for (RBACPermissionContainer::const_iterator itr = permsFrom.begin(); itr != permsFrom.end(); ++itr)
+ permsTo.erase(*itr);
+}
+
+void RBACData::ExpandPermissions(RBACPermissionContainer& permissions)
+{
+ RBACPermissionContainer toCheck = permissions;
+ permissions.clear();
+
+ while (!toCheck.empty())
+ {
+ // remove the permission from original list
+ uint32 permissionId = *toCheck.begin();
+ toCheck.erase(toCheck.begin());
+
+ RBACPermission const* permission = sAccountMgr->GetRBACPermission(permissionId);
+ if (!permission)
+ continue;
+
+ // insert into the final list (expanded list)
+ permissions.insert(permissionId);
+
+ // add all linked permissions (that are not already expanded) to the list of permissions to be checked
+ RBACPermissionContainer const& linkedPerms = permission->GetLinkedPermissions();
+ for (RBACPermissionContainer::const_iterator itr = linkedPerms.begin(); itr != linkedPerms.end(); ++itr)
+ if (permissions.find(*itr) == permissions.end())
+ toCheck.insert(*itr);
+ }
+
+ TC_LOG_DEBUG("rbac", "RBACData::ExpandPermissions: Expanded: %s", GetDebugPermissionString(permissions).c_str());
+}
+
+void RBACData::ClearData()
+{
+ _grantedPerms.clear();
+ _deniedPerms.clear();
+ _globalPerms.clear();
+}
+
+}
diff --git a/src/server/game/Battlegrounds/Zones/BattlegroundWS.cpp b/src/server/game/Battlegrounds/Zones/BattlegroundWS.cpp
index 378ce22ba3e..cc3daec1649 100644
--- a/src/server/game/Battlegrounds/Zones/BattlegroundWS.cpp
+++ b/src/server/game/Battlegrounds/Zones/BattlegroundWS.cpp
@@ -157,7 +157,7 @@ void BattlegroundWS::PostUpdateImpl(uint32 diff)
player->CastSpell(player, WS_SPELL_FOCUSED_ASSAULT, true);
_flagDebuffState = 1;
}
- else if (_flagDebuffState == 1 && _flagSpellForceTimer >= 900000) //15 minutes
+ else if (_flagDebuffState == 1 && _flagSpellForceTimer >= 15*MINUTE*IN_MILLISECONDS) //15 minutes
{
if (Player* player = ObjectAccessor::FindPlayer(m_FlagKeepers[0]))
{
diff --git a/src/server/game/Entities/Creature/Creature.cpp b/src/server/game/Entities/Creature/Creature.cpp
index 3b9b6d9dfe8..6e51257eb82 100644
--- a/src/server/game/Entities/Creature/Creature.cpp
+++ b/src/server/game/Entities/Creature/Creature.cpp
@@ -1373,7 +1373,7 @@ bool Creature::CanStartAttack(Unit const* who, bool force) const
// This set of checks is should be done only for creatures
if ((HasFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_IMMUNE_TO_NPC) && who->GetTypeId() != TYPEID_PLAYER) // flag is valid only for non player characters
|| (HasFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_IMMUNE_TO_PC) && who->GetTypeId() == TYPEID_PLAYER) // immune to PC and target is a player, return false
- || (who->GetOwner() && who->GetOwner()->GetTypeId() == TYPEID_PLAYER) && HasFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_IMMUNE_TO_PC)) // player pets are immune to pc as well
+ || (who->GetOwner() && who->GetOwner()->GetTypeId() == TYPEID_PLAYER && HasFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_IMMUNE_TO_PC))) // player pets are immune to pc as well
return false;
// Do not attack non-combat pets
diff --git a/src/server/game/Entities/Creature/Creature.h b/src/server/game/Entities/Creature/Creature.h
index 585bc137e0b..0ad76ab2086 100644
--- a/src/server/game/Entities/Creature/Creature.h
+++ b/src/server/game/Entities/Creature/Creature.h
@@ -130,7 +130,6 @@ struct CreatureTemplate
float ModDamage;
float ModExperience;
bool RacialLeader;
- uint32 questItems[MAX_CREATURE_QUEST_ITEMS];
uint32 movementId;
bool RegenHealth;
uint32 MechanicImmuneMask;
@@ -167,6 +166,9 @@ struct CreatureTemplate
}
};
+typedef std::vector<uint32> CreatureQuestItemList;
+typedef std::unordered_map<uint32, CreatureQuestItemList> CreatureQuestItemMap;
+
// Benchmarked: Faster than std::map (insert/find)
typedef std::unordered_map<uint32, CreatureTemplate> CreatureTemplateContainer;
diff --git a/src/server/game/Entities/GameObject/GameObject.cpp b/src/server/game/Entities/GameObject/GameObject.cpp
index 50981a163be..03566390a6c 100644
--- a/src/server/game/Entities/GameObject/GameObject.cpp
+++ b/src/server/game/Entities/GameObject/GameObject.cpp
@@ -1757,9 +1757,9 @@ void GameObject::Use(Unit* user)
return;
}
- if (Player* player = user->ToPlayer())
- sOutdoorPvPMgr->HandleCustomSpell(player, spellId, this);
-
+ if (Player* player = user->ToPlayer())
+ sOutdoorPvPMgr->HandleCustomSpell(player, spellId, this);
+
if (spellCaster)
spellCaster->CastSpell(user, spellInfo, triggered);
else
diff --git a/src/server/game/Entities/GameObject/GameObject.h b/src/server/game/Entities/GameObject/GameObject.h
index 5f1d2c793e6..2311bc71179 100644
--- a/src/server/game/Entities/GameObject/GameObject.h
+++ b/src/server/game/Entities/GameObject/GameObject.h
@@ -45,7 +45,6 @@ struct GameObjectTemplate
uint32 faction;
uint32 flags;
float size;
- uint32 questItems[MAX_GAMEOBJECT_QUEST_ITEMS];
union // different GO types have different data field
{
//0 GAMEOBJECT_TYPE_DOOR
@@ -620,6 +619,9 @@ struct GameObjectData
bool dbData;
};
+typedef std::vector<uint32> GameObjectQuestItemList;
+typedef std::unordered_map<uint32, GameObjectQuestItemList> GameObjectQuestItemMap;
+
// For containers: [GO_NOT_READY]->GO_READY (close)->GO_ACTIVATED (open) ->GO_JUST_DEACTIVATED->GO_READY -> ...
// For bobber: GO_NOT_READY ->GO_READY (close)->GO_ACTIVATED (open) ->GO_JUST_DEACTIVATED-><deleted>
// For door(closed):[GO_NOT_READY]->GO_READY (close)->GO_ACTIVATED (open) ->GO_JUST_DEACTIVATED->GO_READY(close) -> ...
@@ -733,7 +735,7 @@ class GameObject : public WorldObject, public GridObject<GameObject>, public Map
void SetGoAnimProgress(uint8 animprogress) { SetByteValue(GAMEOBJECT_BYTES_1, 3, animprogress); }
static void SetGoArtKit(uint8 artkit, GameObject* go, uint32 lowguid = 0);
- void SetPhaseMask(uint32 newPhaseMask, bool update);
+ void SetPhaseMask(uint32 newPhaseMask, bool update) override;
void EnableCollision(bool enable);
void Use(Unit* user);
diff --git a/src/server/game/Entities/Player/Player.cpp b/src/server/game/Entities/Player/Player.cpp
index 55d882c65d3..31a3b5becf5 100644
--- a/src/server/game/Entities/Player/Player.cpp
+++ b/src/server/game/Entities/Player/Player.cpp
@@ -22621,15 +22621,17 @@ void Player::SendTransferAborted(uint32 mapid, TransferAbortReason reason, uint8
GetSession()->SendPacket(&data);
}
-void Player::SendInstanceResetWarning(uint32 mapid, Difficulty difficulty, uint32 time)
+void Player::SendInstanceResetWarning(uint32 mapid, Difficulty difficulty, uint32 time, bool welcome)
{
// type of warning, based on the time remaining until reset
uint32 type;
- if (time > 3600)
+ if (welcome)
type = RAID_INSTANCE_WELCOME;
- else if (time > 900 && time <= 3600)
+ else if (time > 21600)
+ type = RAID_INSTANCE_WELCOME;
+ else if (time > 3600)
type = RAID_INSTANCE_WARNING_HOURS;
- else if (time > 300 && time <= 900)
+ else if (time > 300)
type = RAID_INSTANCE_WARNING_MIN;
else
type = RAID_INSTANCE_WARNING_MIN_SOON;
diff --git a/src/server/game/Entities/Player/Player.h b/src/server/game/Entities/Player/Player.h
index 98b9d8a3d07..ee19eaf21ba 100644
--- a/src/server/game/Entities/Player/Player.h
+++ b/src/server/game/Entities/Player/Player.h
@@ -1129,7 +1129,7 @@ class Player : public Unit, public GridObject<Player>
void SendInitialPacketsAfterAddToMap();
void SendSupercededSpell(uint32 oldSpell, uint32 newSpell);
void SendTransferAborted(uint32 mapid, TransferAbortReason reason, uint8 arg = 0);
- void SendInstanceResetWarning(uint32 mapid, Difficulty difficulty, uint32 time);
+ void SendInstanceResetWarning(uint32 mapid, Difficulty difficulty, uint32 time, bool welcome);
bool CanInteractWithQuestGiver(Object* questGiver);
Creature* GetNPCIfCanInteractWith(ObjectGuid guid, uint32 npcflagmask);
diff --git a/src/server/game/Entities/Unit/Unit.cpp b/src/server/game/Entities/Unit/Unit.cpp
index b9d4650de47..2ed7558f8bb 100644
--- a/src/server/game/Entities/Unit/Unit.cpp
+++ b/src/server/game/Entities/Unit/Unit.cpp
@@ -1787,6 +1787,13 @@ void Unit::CalcAbsorbResist(Unit* victim, SpellSchoolMask schoolMask, DamageEffe
dmgInfo.AbsorbDamage(splitDamage);
+ // check if caster is immune to damage
+ if (caster->IsImmunedToDamage(schoolMask))
+ {
+ victim->SendSpellMiss(caster, (*itr)->GetSpellInfo()->Id, SPELL_MISS_IMMUNE);
+ continue;
+ }
+
uint32 splitted = splitDamage;
uint32 splitted_absorb = 0;
DealDamageMods(caster, splitted, &splitted_absorb);
@@ -1824,6 +1831,14 @@ void Unit::CalcAbsorbResist(Unit* victim, SpellSchoolMask schoolMask, DamageEffe
splitDamage = RoundToInterval(splitDamage, uint32(0), uint32(dmgInfo.GetDamage()));
dmgInfo.AbsorbDamage(splitDamage);
+
+ // check if caster is immune to damage
+ if (caster->IsImmunedToDamage(schoolMask))
+ {
+ victim->SendSpellMiss(caster, (*itr)->GetSpellInfo()->Id, SPELL_MISS_IMMUNE);
+ continue;
+ }
+
uint32 split_absorb = 0;
DealDamageMods(caster, splitDamage, &split_absorb);
@@ -9949,15 +9964,11 @@ uint32 Unit::SpellDamageBonusDone(Unit* victim, SpellInfo const* spellProto, uin
DoneTotal += int32(DoneAdvertisedBenefit * coeff * factorMod);
}
- float tmpDamage = float(int32(pdamage) + DoneTotal);
- // SPELLMOD_DOT will be applied in AuraEffect::HandlePeriodicDamageAurasTick.
- if (damagetype != DOT)
- {
- tmpDamage *= SpellDamagePctDone(victim, spellProto, damagetype);
- // apply spellmod to Done damage (flat and pct)
- if (Player* modOwner = GetSpellModOwner())
- modOwner->ApplySpellMod(spellProto->Id, SPELLMOD_DAMAGE, tmpDamage);
- }
+ // Done Percentage for DOT is already calculated, no need to do it again. The percentage mod is applied in Aura::HandleAuraSpecificMods.
+ float tmpDamage = (int32(pdamage) + DoneTotal) * (damagetype == DOT ? 1.0f : SpellDamagePctDone(victim, spellProto, damagetype));
+ // apply spellmod to Done damage (flat and pct)
+ if (Player* modOwner = GetSpellModOwner())
+ modOwner->ApplySpellMod(spellProto->Id, damagetype == DOT ? SPELLMOD_DOT : SPELLMOD_DAMAGE, tmpDamage);
return uint32(std::max(tmpDamage, 0.0f));
}
@@ -10797,15 +10808,11 @@ uint32 Unit::SpellHealingBonusDone(Unit* victim, SpellInfo const* spellProto, ui
DoneTotal = 0;
}
- float heal = float(int32(healamount) + DoneTotal);
- // SPELLMOD_DOT will be applied in AuraEffect::HandlePeriodicHealAurasTick.
- if (damagetype != DOT)
- {
- heal *= SpellHealingPctDone(victim, spellProto);
- // apply spellmod to Done amount
- if (Player* modOwner = GetSpellModOwner())
- modOwner->ApplySpellMod(spellProto->Id, SPELLMOD_DAMAGE, heal);
- }
+ // Done Percentage for DOT is already calculated, no need to do it again. The percentage mod is applied in Aura::HandleAuraSpecificMods.
+ float heal = float(int32(healamount) + DoneTotal) * (damagetype == DOT ? 1.0f : SpellHealingPctDone(victim, spellProto));
+ // apply spellmod to Done amount
+ if (Player* modOwner = GetSpellModOwner())
+ modOwner->ApplySpellMod(spellProto->Id, damagetype == DOT ? SPELLMOD_DOT : SPELLMOD_DAMAGE, heal);
return uint32(std::max(heal, 0.0f));
}
@@ -11136,6 +11143,26 @@ bool Unit::IsImmunedToSpell(SpellInfo const* spellInfo) const
return false;
}
+uint32 Unit::GetSchoolImmunityMask() const
+{
+ uint32 mask = 0;
+ SpellImmuneList const& mechanicList = m_spellImmune[IMMUNITY_SCHOOL];
+ for (SpellImmuneList::const_iterator itr = mechanicList.begin(); itr != mechanicList.end(); ++itr)
+ mask |= itr->type;
+
+ return mask;
+}
+
+uint32 Unit::GetMechanicImmunityMask() const
+{
+ uint32 mask = 0;
+ SpellImmuneList const& mechanicList = m_spellImmune[IMMUNITY_MECHANIC];
+ for (SpellImmuneList::const_iterator itr = mechanicList.begin(); itr != mechanicList.end(); ++itr)
+ mask |= (1 << itr->type);
+
+ return mask;
+}
+
bool Unit::IsImmunedToSpellEffect(SpellInfo const* spellInfo, uint32 index) const
{
if (!spellInfo || !spellInfo->Effects[index].IsEffect())
@@ -16464,7 +16491,7 @@ void Unit::KnockbackFrom(float x, float y, float speedXY, float speedZ)
data << float(-speedZ); // Z Movement speed (vertical)
player->GetSession()->SendPacket(&data);
-
+
if (player->HasAuraType(SPELL_AURA_MOD_INCREASE_MOUNTED_FLIGHT_SPEED) || player->HasAuraType(SPELL_AURA_FLY))
player->SetCanFly(true, true);
}
diff --git a/src/server/game/Entities/Unit/Unit.h b/src/server/game/Entities/Unit/Unit.h
index 2593ca2c728..a61b406cbbd 100644
--- a/src/server/game/Entities/Unit/Unit.h
+++ b/src/server/game/Entities/Unit/Unit.h
@@ -1958,6 +1958,8 @@ class Unit : public WorldObject
void ApplySpellImmune(uint32 spellId, uint32 op, uint32 type, bool apply);
void ApplySpellDispelImmunity(const SpellInfo* spellProto, DispelType type, bool apply);
virtual bool IsImmunedToSpell(SpellInfo const* spellInfo) const; // redefined in Creature
+ uint32 GetSchoolImmunityMask() const;
+ uint32 GetMechanicImmunityMask() const;
bool IsImmunedToDamage(SpellSchoolMask meleeSchoolMask) const;
bool IsImmunedToDamage(SpellInfo const* spellInfo) const;
diff --git a/src/server/game/Globals/ObjectMgr.cpp b/src/server/game/Globals/ObjectMgr.cpp
index b9d828b2dfd..491a61f6f35 100644
--- a/src/server/game/Globals/ObjectMgr.cpp
+++ b/src/server/game/Globals/ObjectMgr.cpp
@@ -408,8 +408,8 @@ void ObjectMgr::LoadCreatureTemplates()
"spell2, spell3, spell4, spell5, spell6, spell7, spell8, PetSpellDataId, VehicleId, mingold, maxgold, AIName, MovementType, "
// 62 63 64 65 66 67 68 69
"InhabitType, HoverHeight, HealthModifier, ManaModifier, ArmorModifier, DamageModifier, ExperienceModifier, RacialLeader, "
- // 70 71 72 73 74 75 76 77 78 79 80
- "questItem1, questItem2, questItem3, questItem4, questItem5, questItem6, movementId, RegenHealth, mechanic_immune_mask, flags_extra, ScriptName "
+ // 70 71 72 73 74
+ "movementId, RegenHealth, mechanic_immune_mask, flags_extra, ScriptName "
"FROM creature_template;");
if (!result)
@@ -507,14 +507,11 @@ void ObjectMgr::LoadCreatureTemplate(Field* fields)
creatureTemplate.ModExperience = fields[68].GetFloat();
creatureTemplate.RacialLeader = fields[69].GetBool();
- for (uint8 i = 0; i < MAX_CREATURE_QUEST_ITEMS; ++i)
- creatureTemplate.questItems[i] = fields[70 + i].GetUInt32();
-
- creatureTemplate.movementId = fields[76].GetUInt32();
- creatureTemplate.RegenHealth = fields[77].GetBool();
- creatureTemplate.MechanicImmuneMask = fields[78].GetUInt32();
- creatureTemplate.flags_extra = fields[79].GetUInt32();
- creatureTemplate.ScriptID = GetScriptId(fields[80].GetCString());
+ creatureTemplate.movementId = fields[70].GetUInt32();
+ creatureTemplate.RegenHealth = fields[71].GetBool();
+ creatureTemplate.MechanicImmuneMask = fields[72].GetUInt32();
+ creatureTemplate.flags_extra = fields[73].GetUInt32();
+ creatureTemplate.ScriptID = GetScriptId(fields[74].GetCString());
}
void ObjectMgr::LoadCreatureTemplateAddons()
@@ -3965,35 +3962,35 @@ void ObjectMgr::LoadQuests()
mExclusiveQuestGroups.clear();
QueryResult result = WorldDatabase.Query("SELECT "
- //0 1 2 3 4 5 6 7 8 9 10 11 12
- "ID, Method, QuestLevel, MinLevel, MaxLevel, QuestSortID, QuestType, SuggestedGroupNum, LimitTime, RequiredClasses, RequiredRaces, RequiredSkillId, RequiredSkillPoints, "
- // 13 14 15 16 17 18 19 20
- "RequiredFactionId1, RequiredFactionId2, RequiredFactionValue1, RequiredFactionValue2, RequiredMinRepFaction, RequiredMaxRepFaction, RequiredMinRepValue, RequiredMaxRepValue, "
- // 21 22 23 24 25 26 27 28 29 30 31
- "PrevQuestId, NextQuestId, ExclusiveGroup, NextQuestIdChain, RewardXPId, RewardOrRequiredMoney, RewardMoneyMaxLevel, RewardSpell, RewardSpellCast, RewardHonor, RewardHonorMultiplier, "
- // 32 33 34 35 36 37 38 39 40 41 42
- "RewardMailTemplateId, RewardMailDelay, SourceItemId, SourceItemCount, SourceSpellId, Flags, SpecialFlags, RewardTitle, RequiredPlayerKills, RewardTalents, RewardArenaPoints, "
- // 43 44 45 46 47 48 49 50
+ //0 1 2 3 4 5 6 7 8
+ "ID, Method, QuestLevel, MinLevel, QuestSortID, QuestType, SuggestedGroupNum, LimitTime, RequiredRaces,"
+ // 9 10 11 12
+ "RequiredFactionId1, RequiredFactionId2, RequiredFactionValue1, RequiredFactionValue2, "
+ // 13 14 15 16 17 18 19 20
+ "NextQuestIdChain, RewardXPId, RewardOrRequiredMoney, RewardMoneyMaxLevel, RewardSpell, RewardSpellCast, RewardHonor, RewardHonorMultiplier, "
+ // 21 22 23 24 25 26
+ "SourceItemId, Flags, RewardTitle, RequiredPlayerKills, RewardTalents, RewardArenaPoints, "
+ // 27 28 29 30 31 32 33 34
"RewardItem1, RewardItem2, RewardItem3, RewardItem4, RewardAmount1, RewardAmount2, RewardAmount3, RewardAmount4, "
- // 51 52 53 54 55 56 57 58 59 60 61 62
+ // 35 36 37 38 39 40 41 42 43 44 45 46
"RewardChoiceItemID1, RewardChoiceItemID2, RewardChoiceItemID3, RewardChoiceItemID4, RewardChoiceItemID5, RewardChoiceItemID6, RewardChoiceItemQuantity1, RewardChoiceItemQuantity2, RewardChoiceItemQuantity3, RewardChoiceItemQuantity4, RewardChoiceItemQuantity5, RewardChoiceItemQuantity6, "
- // 63 64 65 66 67 68 69 70 71 72
+ // 47 48 49 50 51 52 53 54 55 56
"RewardFactionID1, RewardFactionID2, RewardFactionID3, RewardFactionID4, RewardFactionID5, RewardFactionValue1, RewardFactionValue2, RewardFactionValue3, RewardFactionValue4, RewardFactionValue5, "
- // 73 74 75 76 77
+ // 57 58 59 60 61
"RewardFactionOverride1, RewardFactionOverride2, RewardFactionOverride3, RewardFactionOverride4, RewardFactionOverride5, "
- // 78 79 80 81
+ // 62 63 64 65
"PointMapId, PointX, PointY, PointOption, "
- // 82 83 84 85 86 87 88
+ // 66 67 68 69 70 71 72
"LogTitle, LogDescription, QuestDescription, EndText, OfferRewardText, RequestItemsText, QuestCompletionLog, "
- // 89 90 91 92 93 94 95 96
+ // 73 74 75 76 77 78 79 80
"RequiredNpcOrGo1, RequiredNpcOrGo2, RequiredNpcOrGo3, RequiredNpcOrGo4, RequiredNpcOrGoCount1, RequiredNpcOrGoCount2, RequiredNpcOrGoCount3, RequiredNpcOrGoCount4, "
- // 97 98 99 100 101 102 103 104
+ // 81 82 83 84 85 86 87 88
"RequiredSourceItemId1, RequiredSourceItemId2, RequiredSourceItemId3, RequiredSourceItemId4, RequiredSourceItemCount1, RequiredSourceItemCount2, RequiredSourceItemCount3, RequiredSourceItemCount4, "
- // 105 106 107 108 109 110 111 112 113 114 115 116
+ // 89 90 91 92 93 94 95 96 97 98 99 100
"RequiredItemId1, RequiredItemId2, RequiredItemId3, RequiredItemId4, RequiredItemId5, RequiredItemId6, RequiredItemCount1, RequiredItemCount2, RequiredItemCount3, RequiredItemCount4, RequiredItemCount5, RequiredItemCount6, "
- // 117 118 119 120 121 122 123 124 125 126 127 128 129
+ // 101 102 103 104 105 106 107 108 109 110 111 112 113
"Unknown0, ObjectiveText1, ObjectiveText2, ObjectiveText3, ObjectiveText4, DetailsEmote1, DetailsEmote2, DetailsEmote3, DetailsEmote4, DetailsEmoteDelay1, DetailsEmoteDelay2, DetailsEmoteDelay3, DetailsEmoteDelay4, "
- // 130 131 132 133 134 135 136 137 138 139
+ // 114 115 116 117 118 119 120 121 122 123
"EmoteOnIncomplete, EmoteOnComplete, OfferRewardEmote1, OfferRewardEmote2, OfferRewardEmote3, OfferRewardEmote4, OfferRewardEmoteDelay1, OfferRewardEmoteDelay2, OfferRewardEmoteDelay3, OfferRewardEmoteDelay4"
" FROM quest_template");
if (!result)
@@ -4015,6 +4012,31 @@ void ObjectMgr::LoadQuests()
std::map<uint32, uint32> usedMailTemplates;
+ // Load `quest_template_addon`
+ // 0 1 2 3 4 5 6 7 8
+ result = WorldDatabase.Query("SELECT ID, MaxLevel, AllowableClasses, SourceSpellID, PrevQuestID, NextQuestID, ExclusiveGroup, RewardMailTemplateID, RewardMailDelay, "
+ //9 10 11 12 13 14 15 16
+ "RequiredSkillID, RequiredSkillPoints, RequiredMinRepFaction, RequiredMaxRepFaction, RequiredMinRepValue, RequiredMaxRepValue, ProvidedItemCount, SpecialFlags FROM quest_template_addon");
+
+ if (!result)
+ {
+ TC_LOG_ERROR("server.loading", ">> Loaded 0 quest template addons. DB table `quest_template_addon` is empty.");
+ }
+ else
+ {
+ do
+ {
+ Field* fields = result->Fetch();
+ uint32 questId = fields[0].GetUInt32();
+
+ auto itr = _questTemplates.find(questId);
+ if (itr != _questTemplates.end())
+ itr->second->LoadQuestTemplateAddon(fields);
+ else
+ TC_LOG_ERROR("server.loading", "Table `quest_template_addon` has data for quest %u but such quest does not exist", questId);
+ } while (result->NextRow());
+ }
+
// Post processing
for (QuestMap::iterator iter = _questTemplates.begin(); iter != _questTemplates.end(); ++iter)
{
@@ -6596,11 +6618,11 @@ void ObjectMgr::LoadGameObjectTemplate()
{
uint32 oldMSTime = getMSTime();
- // 0 1 2 3 4 5 6 7 8 9 10 11 12
- QueryResult result = WorldDatabase.Query("SELECT entry, type, displayId, name, IconName, castBarCaption, unk1, faction, flags, size, questItem1, questItem2, questItem3, "
- // 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28
- "questItem4, questItem5, questItem6, Data0, Data1, Data2, Data3, Data4, Data5, Data6, Data7, Data8, Data9, Data10, Data11, Data12, "
- // 29 30 31 32 33 34 35 36 37 38 39 40 41
+ // 0 1 2 3 4 5 6 7 8 9
+ QueryResult result = WorldDatabase.Query("SELECT entry, type, displayId, name, IconName, castBarCaption, unk1, faction, flags, size, "
+ // 10 11 12 13 14 15 16 17 18 19 20 21 22
+ "Data0, Data1, Data2, Data3, Data4, Data5, Data6, Data7, Data8, Data9, Data10, Data11, Data12, "
+ // 23 24 25 26 27 28 29 30 31 32 33 34 35
"Data13, Data14, Data15, Data16, Data17, Data18, Data19, Data20, Data21, Data22, Data23, AIName, ScriptName "
"FROM gameobject_template");
@@ -6631,14 +6653,11 @@ void ObjectMgr::LoadGameObjectTemplate()
got.flags = fields[8].GetUInt32();
got.size = fields[9].GetFloat();
- for (uint8 i = 0; i < MAX_GAMEOBJECT_QUEST_ITEMS; ++i)
- got.questItems[i] = fields[10 + i].GetUInt32();
-
for (uint8 i = 0; i < MAX_GAMEOBJECT_DATA; ++i)
- got.raw.data[i] = fields[16 + i].GetInt32(); // data1 and data6 can be -1
+ got.raw.data[i] = fields[10 + i].GetInt32(); // data1 and data6 can be -1
- got.AIName = fields[40].GetString();
- got.ScriptId = GetScriptId(fields[41].GetCString());
+ got.AIName = fields[34].GetString();
+ got.ScriptId = GetScriptId(fields[35].GetCString());
// Checks
@@ -9122,3 +9141,63 @@ PlayerInfo const* ObjectMgr::GetPlayerInfo(uint32 race, uint32 class_) const
return NULL;
return info;
}
+
+void ObjectMgr::LoadGameObjectQuestItems()
+{
+ uint32 oldMSTime = getMSTime();
+
+ // 0 1
+ QueryResult result = WorldDatabase.Query("SELECT GameObjectEntry, ItemId FROM gameobject_questitem ORDER BY Idx ASC");
+
+ if (!result)
+ {
+ TC_LOG_INFO("server.loading", ">> Loaded 0 gameobject quest items. DB table `gameobject_questitem` is empty.");
+ return;
+ }
+
+ uint32 count = 0;
+ do
+ {
+ Field* fields = result->Fetch();
+
+ uint32 entry = fields[0].GetUInt32();
+ uint32 item = fields[1].GetUInt32();
+
+ _gameObjectQuestItemStore[entry].push_back(item);
+
+ ++count;
+ }
+ while (result->NextRow());
+
+ TC_LOG_INFO("server.loading", ">> Loaded %u gameobject quest items in %u ms", count, GetMSTimeDiffToNow(oldMSTime));
+}
+
+void ObjectMgr::LoadCreatureQuestItems()
+{
+ uint32 oldMSTime = getMSTime();
+
+ // 0 1
+ QueryResult result = WorldDatabase.Query("SELECT CreatureEntry, ItemId FROM creature_questitem ORDER BY Idx ASC");
+
+ if (!result)
+ {
+ TC_LOG_INFO("server.loading", ">> Loaded 0 creature quest items. DB table `creature_questitem` is empty.");
+ return;
+ }
+
+ uint32 count = 0;
+ do
+ {
+ Field* fields = result->Fetch();
+
+ uint32 entry = fields[0].GetUInt32();
+ uint32 item = fields[1].GetUInt32();
+
+ _creatureQuestItemStore[entry].push_back(item);
+
+ ++count;
+ }
+ while (result->NextRow());
+
+ TC_LOG_INFO("server.loading", ">> Loaded %u creature quest items in %u ms", count, GetMSTimeDiffToNow(oldMSTime));
+}
diff --git a/src/server/game/Globals/ObjectMgr.h b/src/server/game/Globals/ObjectMgr.h
index f18e39077f3..601537d9035 100644
--- a/src/server/game/Globals/ObjectMgr.h
+++ b/src/server/game/Globals/ObjectMgr.h
@@ -37,6 +37,7 @@
#include "ObjectDefines.h"
#include "VehicleDefines.h"
#include <string>
+#include <tuple>
#include <map>
#include <limits>
#include "ConditionMgr.h"
@@ -67,8 +68,8 @@ struct TempSummonGroupKey
bool operator<(TempSummonGroupKey const& rhs) const
{
- // memcmp is only reliable if struct doesn't have any padding (packed)
- return memcmp(this, &rhs, sizeof(TempSummonGroupKey)) < 0;
+ return std::tie(_summonerEntry, _summonerType, _summonGroup) <
+ std::tie(rhs._summonerEntry, rhs._summonerType, rhs._summonGroup);
}
private:
@@ -753,6 +754,24 @@ class ObjectMgr
ObjectGuid GetPlayerGUIDByName(std::string const& name) const;
+ GameObjectQuestItemList const* GetGameObjectQuestItemList(uint32 id) const
+ {
+ GameObjectQuestItemMap::const_iterator itr = _gameObjectQuestItemStore.find(id);
+ if (itr != _gameObjectQuestItemStore.end())
+ return &itr->second;
+ return NULL;
+ }
+ GameObjectQuestItemMap const* GetGameObjectQuestItemMap() const { return &_gameObjectQuestItemStore; }
+
+ CreatureQuestItemList const* GetCreatureQuestItemList(uint32 id) const
+ {
+ CreatureQuestItemMap::const_iterator itr = _creatureQuestItemStore.find(id);
+ if (itr != _creatureQuestItemStore.end())
+ return &itr->second;
+ return NULL;
+ }
+ CreatureQuestItemMap const* GetCreatureQuestItemMap() const { return &_creatureQuestItemStore; }
+
/**
* Retrieves the player name by guid.
*
@@ -960,6 +979,8 @@ class ObjectMgr
void LoadCreatureTemplateAddons();
void LoadCreatureTemplate(Field* fields);
void CheckCreatureTemplate(CreatureTemplate const* cInfo);
+ void LoadGameObjectQuestItems();
+ void LoadCreatureQuestItems();
void LoadTempSummons();
void LoadCreatures();
void LoadLinkedRespawn();
@@ -1412,6 +1433,8 @@ class ObjectMgr
CreatureAddonContainer _creatureAddonStore;
CreatureAddonContainer _creatureTemplateAddonStore;
GameObjectAddonContainer _gameObjectAddonStore;
+ GameObjectQuestItemMap _gameObjectQuestItemStore;
+ CreatureQuestItemMap _creatureQuestItemStore;
EquipmentInfoContainer _equipmentInfoStore;
LinkedRespawnContainer _linkedRespawnStore;
CreatureLocaleContainer _creatureLocaleStore;
diff --git a/src/server/game/Handlers/MovementHandler.cpp b/src/server/game/Handlers/MovementHandler.cpp
index e86fa523f68..cedfed2e7c5 100644
--- a/src/server/game/Handlers/MovementHandler.cpp
+++ b/src/server/game/Handlers/MovementHandler.cpp
@@ -163,7 +163,7 @@ void WorldSession::HandleMoveWorldportAckOpcode()
if (time_t timeReset = sInstanceSaveMgr->GetResetTimeFor(mEntry->MapID, diff))
{
uint32 timeleft = uint32(timeReset - time(NULL));
- GetPlayer()->SendInstanceResetWarning(mEntry->MapID, diff, timeleft);
+ GetPlayer()->SendInstanceResetWarning(mEntry->MapID, diff, timeleft, true);
}
}
}
diff --git a/src/server/game/Handlers/QueryHandler.cpp b/src/server/game/Handlers/QueryHandler.cpp
index d15f21f4ad3..03782481ef7 100644
--- a/src/server/game/Handlers/QueryHandler.cpp
+++ b/src/server/game/Handlers/QueryHandler.cpp
@@ -131,8 +131,15 @@ void WorldSession::HandleCreatureQueryOpcode(WorldPacket& recvData)
data << float(ci->ModHealth); // dmg/hp modifier
data << float(ci->ModMana); // dmg/mana modifier
data << uint8(ci->RacialLeader);
- for (uint32 i = 0; i < MAX_CREATURE_QUEST_ITEMS; ++i)
- data << uint32(ci->questItems[i]); // itemId[6], quest drop
+
+ CreatureQuestItemList const* items = sObjectMgr->GetCreatureQuestItemList(entry);
+ if (items)
+ for (size_t i = 0; i < MAX_CREATURE_QUEST_ITEMS; ++i)
+ data << (i < items->size() ? uint32((*items)[i]) : uint32(0));
+ else
+ for (size_t i = 0; i < MAX_CREATURE_QUEST_ITEMS; ++i)
+ data << uint32(0);
+
data << uint32(ci->movementId); // CreatureMovementInfo.dbc
SendPacket(&data);
TC_LOG_DEBUG("network", "WORLD: Sent SMSG_CREATURE_QUERY_RESPONSE");
@@ -188,8 +195,15 @@ void WorldSession::HandleGameObjectQueryOpcode(WorldPacket& recvData)
data << info->unk1; // 2.0.3, string
data.append(info->raw.data, MAX_GAMEOBJECT_DATA);
data << float(info->size); // go size
- for (uint32 i = 0; i < MAX_GAMEOBJECT_QUEST_ITEMS; ++i)
- data << uint32(info->questItems[i]); // itemId[6], quest drop
+
+ GameObjectQuestItemList const* items = sObjectMgr->GetGameObjectQuestItemList(entry);
+ if (items)
+ for (size_t i = 0; i < MAX_GAMEOBJECT_QUEST_ITEMS; ++i)
+ data << (i < items->size() ? uint32((*items)[i]) : uint32(0));
+ else
+ for (size_t i = 0; i < MAX_GAMEOBJECT_QUEST_ITEMS; ++i)
+ data << uint32(0);
+
SendPacket(&data);
TC_LOG_DEBUG("network", "WORLD: Sent SMSG_GAMEOBJECT_QUERY_RESPONSE");
}
diff --git a/src/server/game/Instances/InstanceSaveMgr.cpp b/src/server/game/Instances/InstanceSaveMgr.cpp
index 260c2966a52..f26912a24dd 100644
--- a/src/server/game/Instances/InstanceSaveMgr.cpp
+++ b/src/server/game/Instances/InstanceSaveMgr.cpp
@@ -646,10 +646,10 @@ void InstanceSaveManager::_ResetOrWarnAll(uint32 mapid, Difficulty difficulty, b
if (warn)
{
- if (now <= resetTime)
+ if (now >= resetTime)
timeLeft = 0;
else
- timeLeft = uint32(now - resetTime);
+ timeLeft = uint32(resetTime - now);
((InstanceMap*)map2)->SendResetWarnings(timeLeft);
}
diff --git a/src/server/game/Maps/Map.cpp b/src/server/game/Maps/Map.cpp
index c1a462497cd..585533fa21b 100644
--- a/src/server/game/Maps/Map.cpp
+++ b/src/server/game/Maps/Map.cpp
@@ -3171,7 +3171,7 @@ void InstanceMap::UnloadAll()
void InstanceMap::SendResetWarnings(uint32 timeLeft) const
{
for (MapRefManager::const_iterator itr = m_mapRefManager.begin(); itr != m_mapRefManager.end(); ++itr)
- itr->GetSource()->SendInstanceResetWarning(GetId(), itr->GetSource()->GetDifficulty(IsRaid()), timeLeft);
+ itr->GetSource()->SendInstanceResetWarning(GetId(), itr->GetSource()->GetDifficulty(IsRaid()), timeLeft, false);
}
void InstanceMap::SetResetSchedule(bool on)
diff --git a/src/server/game/Movement/PathGenerator.cpp b/src/server/game/Movement/PathGenerator.cpp
index 2aebac6beb4..efefcdce834 100644
--- a/src/server/game/Movement/PathGenerator.cpp
+++ b/src/server/game/Movement/PathGenerator.cpp
@@ -924,6 +924,7 @@ void PathGenerator::ReducePathLenghtByDist(float dist)
float step = dist / len;
// same as nextVec
_pathPoints[i + 1] -= diffVec * step;
+ _sourceUnit->UpdateAllowedPositionZ(_pathPoints[i + 1].x, _pathPoints[i + 1].y, _pathPoints[i + 1].z);
_pathPoints.resize(i + 2);
break;
}
diff --git a/src/server/game/Quests/QuestDef.cpp b/src/server/game/Quests/QuestDef.cpp
index 6a6e0f45eb7..d1dcfd0f693 100644
--- a/src/server/game/Quests/QuestDef.cpp
+++ b/src/server/game/Quests/QuestDef.cpp
@@ -26,121 +26,102 @@ Quest::Quest(Field* questRecord)
Method = questRecord[1].GetUInt8();
Level = questRecord[2].GetInt16();
MinLevel = questRecord[3].GetUInt8();
- MaxLevel = questRecord[4].GetUInt8();
- ZoneOrSort = questRecord[5].GetInt16();
- Type = questRecord[6].GetUInt16();
- SuggestedPlayers = questRecord[7].GetUInt8();
- LimitTime = questRecord[8].GetUInt32();
- RequiredClasses = questRecord[9].GetUInt16();
- RequiredRaces = questRecord[10].GetUInt16();
- RequiredSkillId = questRecord[11].GetUInt16();
- RequiredSkillPoints = questRecord[12].GetUInt16();
- RequiredFactionId1 = questRecord[13].GetUInt16();
- RequiredFactionId2 = questRecord[14].GetUInt16();
- RequiredFactionValue1 = questRecord[15].GetInt32();
- RequiredFactionValue2 = questRecord[16].GetInt32();
- RequiredMinRepFaction = questRecord[17].GetUInt16();
- RequiredMaxRepFaction = questRecord[18].GetUInt16();
- RequiredMinRepValue = questRecord[19].GetInt32();
- RequiredMaxRepValue = questRecord[20].GetInt32();
- PrevQuestId = questRecord[21].GetInt32();
- NextQuestId = questRecord[22].GetInt32();
- ExclusiveGroup = questRecord[23].GetInt32();
- NextQuestIdChain = questRecord[24].GetUInt32();
- RewardXPId = questRecord[25].GetUInt8();
- RewardOrRequiredMoney = questRecord[26].GetInt32();
- RewardMoneyMaxLevel = questRecord[27].GetUInt32();
- RewardSpell = questRecord[28].GetUInt32();
- RewardSpellCast = questRecord[29].GetInt32();
- RewardHonor = questRecord[30].GetUInt32();
- RewardHonorMultiplier = questRecord[31].GetFloat();
- RewardMailTemplateId = questRecord[32].GetUInt32();
- RewardMailDelay = questRecord[33].GetUInt32();
- SourceItemId = questRecord[34].GetUInt32();
- SourceItemIdCount = questRecord[35].GetUInt8();
- SourceSpellid = questRecord[36].GetUInt32();
- Flags = questRecord[37].GetUInt32();
- SpecialFlags = questRecord[38].GetUInt8();
- RewardTitleId = questRecord[39].GetUInt8();
- RequiredPlayerKills = questRecord[40].GetUInt8();
- RewardTalents = questRecord[41].GetUInt8();
- RewardArenaPoints = questRecord[42].GetUInt16();
+ ZoneOrSort = questRecord[4].GetInt16();
+ Type = questRecord[5].GetUInt16();
+ SuggestedPlayers = questRecord[6].GetUInt8();
+ LimitTime = questRecord[7].GetUInt32();
+ RequiredRaces = questRecord[8].GetUInt16();
+ RequiredFactionId1 = questRecord[9].GetUInt16();
+ RequiredFactionId2 = questRecord[10].GetUInt16();
+ RequiredFactionValue1 = questRecord[11].GetInt32();
+ RequiredFactionValue2 = questRecord[12].GetInt32();
+ NextQuestIdChain = questRecord[13].GetUInt32();
+ RewardXPId = questRecord[14].GetUInt8();
+ RewardOrRequiredMoney = questRecord[15].GetInt32();
+ RewardMoneyMaxLevel = questRecord[16].GetUInt32();
+ RewardSpell = questRecord[17].GetUInt32();
+ RewardSpellCast = questRecord[18].GetInt32();
+ RewardHonor = questRecord[19].GetUInt32();
+ RewardHonorMultiplier = questRecord[20].GetFloat();
+ SourceItemId = questRecord[21].GetUInt32();
+ Flags = questRecord[22].GetUInt32();
+ RewardTitleId = questRecord[23].GetUInt8();
+ RequiredPlayerKills = questRecord[24].GetUInt8();
+ RewardTalents = questRecord[25].GetUInt8();
+ RewardArenaPoints = questRecord[26].GetUInt16();
for (int i = 0; i < QUEST_REWARDS_COUNT; ++i)
- RewardItemId[i] = questRecord[43+i].GetUInt32();
+ RewardItemId[i] = questRecord[27+i].GetUInt32();
for (int i = 0; i < QUEST_REWARDS_COUNT; ++i)
- RewardItemIdCount[i] = questRecord[47+i].GetUInt16();
+ RewardItemIdCount[i] = questRecord[31+i].GetUInt16();
for (int i = 0; i < QUEST_REWARD_CHOICES_COUNT; ++i)
- RewardChoiceItemId[i] = questRecord[51+i].GetUInt32();
+ RewardChoiceItemId[i] = questRecord[35+i].GetUInt32();
for (int i = 0; i < QUEST_REWARD_CHOICES_COUNT; ++i)
- RewardChoiceItemCount[i] = questRecord[57+i].GetUInt16();
+ RewardChoiceItemCount[i] = questRecord[41+i].GetUInt16();
for (int i = 0; i < QUEST_REPUTATIONS_COUNT; ++i)
- RewardFactionId[i] = questRecord[63+i].GetUInt16();
+ RewardFactionId[i] = questRecord[47+i].GetUInt16();
for (int i = 0; i < QUEST_REPUTATIONS_COUNT; ++i)
- RewardFactionValueId[i] = questRecord[68+i].GetInt32();
+ RewardFactionValueId[i] = questRecord[52+i].GetInt32();
for (int i = 0; i < QUEST_REPUTATIONS_COUNT; ++i)
- RewardFactionValueIdOverride[i] = questRecord[73+i].GetInt32();
-
- PointMapId = questRecord[78].GetUInt16();
- PointX = questRecord[79].GetFloat();
- PointY = questRecord[80].GetFloat();
- PointOption = questRecord[81].GetUInt32();
- Title = questRecord[82].GetString();
- Objectives = questRecord[83].GetString();
- Details = questRecord[84].GetString();
- EndText = questRecord[85].GetString();
- OfferRewardText = questRecord[86].GetString();
- RequestItemsText = questRecord[87].GetString();
- CompletedText = questRecord[88].GetString();
+ RewardFactionValueIdOverride[i] = questRecord[57+i].GetInt32();
+
+ PointMapId = questRecord[62].GetUInt16();
+ PointX = questRecord[63].GetFloat();
+ PointY = questRecord[64].GetFloat();
+ PointOption = questRecord[65].GetUInt32();
+ Title = questRecord[66].GetString();
+ Objectives = questRecord[67].GetString();
+ Details = questRecord[68].GetString();
+ EndText = questRecord[69].GetString();
+ OfferRewardText = questRecord[70].GetString();
+ RequestItemsText = questRecord[71].GetString();
+ CompletedText = questRecord[72].GetString();
for (int i = 0; i < QUEST_OBJECTIVES_COUNT; ++i)
- RequiredNpcOrGo[i] = questRecord[89+i].GetInt32();
+ RequiredNpcOrGo[i] = questRecord[73+i].GetInt32();
for (int i = 0; i < QUEST_OBJECTIVES_COUNT; ++i)
- RequiredNpcOrGoCount[i] = questRecord[93+i].GetUInt16();
+ RequiredNpcOrGoCount[i] = questRecord[77+i].GetUInt16();
for (int i = 0; i < QUEST_SOURCE_ITEM_IDS_COUNT; ++i)
- RequiredSourceItemId[i] = questRecord[97+i].GetUInt32();
+ RequiredSourceItemId[i] = questRecord[81+i].GetUInt32();
for (int i = 0; i < QUEST_SOURCE_ITEM_IDS_COUNT; ++i)
- RequiredSourceItemCount[i] = questRecord[101+i].GetUInt16();
+ RequiredSourceItemCount[i] = questRecord[85+i].GetUInt16();
for (int i = 0; i < QUEST_ITEM_OBJECTIVES_COUNT; ++i)
- RequiredItemId[i] = questRecord[105+i].GetUInt32();
+ RequiredItemId[i] = questRecord[89+i].GetUInt32();
for (int i = 0; i < QUEST_ITEM_OBJECTIVES_COUNT; ++i)
- RequiredItemCount[i] = questRecord[111+i].GetUInt16();
+ RequiredItemCount[i] = questRecord[95+i].GetUInt16();
- // int8 Unknown0 = questRecord[117].GetUInt8();
+ // int8 Unknown0 = questRecord[101].GetUInt8();
for (int i = 0; i < QUEST_OBJECTIVES_COUNT; ++i)
- ObjectiveText[i] = questRecord[118+i].GetString();
+ ObjectiveText[i] = questRecord[102+i].GetString();
for (int i = 0; i < QUEST_EMOTE_COUNT; ++i)
- DetailsEmote[i] = questRecord[122+i].GetUInt16();
+ DetailsEmote[i] = questRecord[106+i].GetUInt16();
for (int i = 0; i < QUEST_EMOTE_COUNT; ++i)
- DetailsEmoteDelay[i] = questRecord[126+i].GetUInt32();
+ DetailsEmoteDelay[i] = questRecord[110+i].GetUInt32();
- EmoteOnIncomplete = questRecord[130].GetUInt16();
- EmoteOnComplete = questRecord[131].GetUInt16();
+ EmoteOnIncomplete = questRecord[114].GetUInt16();
+ EmoteOnComplete = questRecord[115].GetUInt16();
for (int i = 0; i < QUEST_EMOTE_COUNT; ++i)
- OfferRewardEmote[i] = questRecord[132+i].GetInt16();
+ OfferRewardEmote[i] = questRecord[116+i].GetInt16();
for (int i = 0; i < QUEST_EMOTE_COUNT; ++i)
- OfferRewardEmoteDelay[i] = questRecord[136+i].GetInt32();
+ OfferRewardEmoteDelay[i] = questRecord[120+i].GetInt32();
- //int32 VerifiedBuild = questRecord[140].GetInt32();
-
- if (SpecialFlags & QUEST_SPECIAL_FLAGS_AUTO_ACCEPT)
- Flags |= QUEST_FLAGS_AUTO_ACCEPT;
+ //int32 VerifiedBuild = questRecord[124].GetInt32();
_reqItemsCount = 0;
_reqCreatureOrGOcount = 0;
@@ -164,6 +145,29 @@ Quest::Quest(Field* questRecord)
++_rewChoiceItemsCount;
}
+void Quest::LoadQuestTemplateAddon(Field* fields)
+{
+ MaxLevel = fields[1].GetUInt8();
+ RequiredClasses = fields[2].GetUInt32();
+ SourceSpellid = fields[3].GetUInt32();
+ PrevQuestId = fields[4].GetInt32();
+ NextQuestId = fields[5].GetInt32();
+ ExclusiveGroup = fields[6].GetInt32();
+ RewardMailTemplateId = fields[7].GetUInt32();
+ RewardMailDelay = fields[8].GetUInt32();
+ RequiredSkillId = fields[9].GetUInt16();
+ RequiredSkillPoints = fields[10].GetUInt16();
+ RequiredMinRepFaction = fields[11].GetUInt16();
+ RequiredMaxRepFaction = fields[12].GetUInt16();
+ RequiredMinRepValue = fields[13].GetInt32();
+ RequiredMaxRepValue = fields[14].GetInt32();
+ SourceItemIdCount = fields[15].GetUInt8();
+ SpecialFlags = fields[16].GetUInt8();
+
+ if (SpecialFlags & QUEST_SPECIAL_FLAGS_AUTO_ACCEPT)
+ Flags |= QUEST_FLAGS_AUTO_ACCEPT;
+}
+
uint32 Quest::XPValue(Player* player) const
{
if (player)
diff --git a/src/server/game/Quests/QuestDef.h b/src/server/game/Quests/QuestDef.h
index 8485fab7f63..fdfb2a8e8b9 100644
--- a/src/server/game/Quests/QuestDef.h
+++ b/src/server/game/Quests/QuestDef.h
@@ -195,6 +195,8 @@ class Quest
friend class ObjectMgr;
public:
Quest(Field* questRecord);
+ void LoadQuestTemplateAddon(Field* fields);
+
uint32 XPValue(Player* player) const;
bool HasFlag(uint32 flag) const { return (Flags & flag) != 0; }
@@ -315,21 +317,13 @@ class Quest
uint32 Method;
int32 ZoneOrSort;
uint32 MinLevel;
- uint32 MaxLevel;
int32 Level;
uint32 Type;
- uint32 RequiredClasses;
uint32 RequiredRaces;
- uint32 RequiredSkillId;
- uint32 RequiredSkillPoints;
uint32 RequiredFactionId1;
int32 RequiredFactionValue1;
uint32 RequiredFactionId2;
int32 RequiredFactionValue2;
- uint32 RequiredMinRepFaction;
- int32 RequiredMinRepValue;
- uint32 RequiredMaxRepFaction;
- int32 RequiredMaxRepValue;
uint32 SuggestedPlayers;
uint32 LimitTime;
uint32 Flags;
@@ -337,14 +331,9 @@ class Quest
uint32 RequiredPlayerKills;
uint32 RewardTalents;
int32 RewardArenaPoints;
- int32 PrevQuestId;
- int32 NextQuestId;
- int32 ExclusiveGroup;
uint32 NextQuestIdChain;
uint32 RewardXPId;
uint32 SourceItemId;
- uint32 SourceItemIdCount;
- uint32 SourceSpellid;
std::string Title;
std::string Details;
std::string Objectives;
@@ -358,8 +347,6 @@ class Quest
uint32 RewardMoneyMaxLevel;
uint32 RewardSpell;
int32 RewardSpellCast;
- uint32 RewardMailTemplateId;
- uint32 RewardMailDelay;
uint32 PointMapId;
float PointX;
float PointY;
@@ -367,7 +354,23 @@ class Quest
uint32 EmoteOnIncomplete;
uint32 EmoteOnComplete;
- uint32 SpecialFlags; // custom flags, not sniffed/WDB
+ // quest_template_addon table (custom data)
+ uint32 MaxLevel = 0;
+ uint32 RequiredClasses = 0;
+ uint32 SourceSpellid = 0;
+ int32 PrevQuestId = 0;
+ int32 NextQuestId = 0;
+ int32 ExclusiveGroup = 0;
+ uint32 RewardMailTemplateId = 0;
+ uint32 RewardMailDelay = 0;
+ uint32 RequiredSkillId = 0;
+ uint32 RequiredSkillPoints = 0;
+ uint32 RequiredMinRepFaction = 0;
+ int32 RequiredMinRepValue = 0;
+ uint32 RequiredMaxRepFaction = 0;
+ int32 RequiredMaxRepValue = 0;
+ uint32 SourceItemIdCount = 0;
+ uint32 SpecialFlags = 0; // custom flags, not sniffed/WDB
};
struct QuestStatusData
diff --git a/src/server/game/Spells/Auras/SpellAuraEffects.cpp b/src/server/game/Spells/Auras/SpellAuraEffects.cpp
index 918b000a557..286cdf51bf1 100644
--- a/src/server/game/Spells/Auras/SpellAuraEffects.cpp
+++ b/src/server/game/Spells/Auras/SpellAuraEffects.cpp
@@ -3020,6 +3020,10 @@ void AuraEffect::HandleModStateImmunityMask(AuraApplication const* aurApp, uint8
switch (miscVal)
{
+ case 27:
+ target->ApplySpellImmune(GetId(), IMMUNITY_MECHANIC, MECHANIC_SILENCE, apply);
+ aura_immunity_list.push_back(SPELL_AURA_MOD_SILENCE);
+ break;
case 96:
case 1615:
{
diff --git a/src/server/game/Spells/Auras/SpellAuras.cpp b/src/server/game/Spells/Auras/SpellAuras.cpp
index 5479dcdbf00..e6f01dea33e 100644
--- a/src/server/game/Spells/Auras/SpellAuras.cpp
+++ b/src/server/game/Spells/Auras/SpellAuras.cpp
@@ -1305,6 +1305,7 @@ void Aura::HandleAuraSpecificMods(AuraApplication const* aurApp, Unit* caster, b
if (AuraEffect const* aurEff = caster->GetDummyAuraEffect(SPELLFAMILY_PRIEST, 3790, 1))
{
uint32 damage = caster->SpellDamageBonusDone(target, GetSpellInfo(), GetEffect(0)->GetAmount(), DOT);
+ damage *= caster->SpellDamagePctDone(target, GetSpellInfo(), SPELL_DIRECT_DAMAGE);
damage = target->SpellDamageBonusTaken(caster, GetSpellInfo(), damage, DOT);
int32 basepoints0 = aurEff->GetAmount() * GetEffect(0)->GetTotalTicks() * int32(damage) / 100;
int32 heal = int32(CalculatePct(basepoints0, 15));
diff --git a/src/server/game/Spells/Spell.cpp b/src/server/game/Spells/Spell.cpp
index ff7c6a86ae8..30c02db9150 100644
--- a/src/server/game/Spells/Spell.cpp
+++ b/src/server/game/Spells/Spell.cpp
@@ -3754,6 +3754,10 @@ void Spell::SendSpellStart()
//TC_LOG_DEBUG("spells", "Sending SMSG_SPELL_START id=%u", m_spellInfo->Id);
uint32 castFlags = CAST_FLAG_UNKNOWN_2;
+ uint32 schoolImmunityMask = m_caster->GetSchoolImmunityMask();
+ uint32 mechanicImmunityMask = m_caster->GetMechanicImmunityMask();
+ if (schoolImmunityMask || mechanicImmunityMask)
+ castFlags |= CAST_FLAG_IMMUNITY;
if ((IsTriggered() && !m_spellInfo->IsAutoRepeatRangedSpell()) || m_triggeredByAuraSpell)
castFlags |= CAST_FLAG_PENDING;
@@ -3788,10 +3792,10 @@ void Spell::SendSpellStart()
if (castFlags & CAST_FLAG_AMMO)
WriteAmmoToPacket(&data);
- if (castFlags & CAST_FLAG_UNKNOWN_23)
+ if (castFlags & CAST_FLAG_IMMUNITY)
{
- data << uint32(0);
- data << uint32(0);
+ data << uint32(schoolImmunityMask);
+ data << uint32(mechanicImmunityMask);
}
m_caster->SendMessageToSet(&data, true);
@@ -4439,8 +4443,11 @@ void Spell::TakeRunePower(bool didHit)
modOwner->ApplySpellMod(m_spellInfo->Id, SPELLMOD_COST, runeCost[i], this);
}
+ // Let's say we use a skill that requires a Frost rune. This is the order:
+ // - Frost rune
+ // - Death rune, originally a Frost rune
+ // - Death rune, any kind
runeCost[RUNE_DEATH] = 0; // calculated later
-
for (uint32 i = 0; i < MAX_RUNES; ++i)
{
RuneType rune = player->GetCurrentRune(i);
@@ -4452,8 +4459,32 @@ void Spell::TakeRunePower(bool didHit)
}
}
+ // Find a Death rune where the base rune matches the one we need
runeCost[RUNE_DEATH] = runeCost[RUNE_BLOOD] + runeCost[RUNE_UNHOLY] + runeCost[RUNE_FROST];
+ if (runeCost[RUNE_DEATH] > 0)
+ {
+ for (uint32 i = 0; i < MAX_RUNES; ++i)
+ {
+ RuneType rune = player->GetCurrentRune(i);
+ RuneType baseRune = player->GetBaseRune(i);
+ if (!player->GetRuneCooldown(i) && rune == RUNE_DEATH && runeCost[baseRune] > 0)
+ {
+ player->SetRuneCooldown(i, didHit ? player->GetRuneBaseCooldown(i) : uint32(RUNE_MISS_COOLDOWN), true);
+ player->SetLastUsedRune(rune);
+ runeCost[baseRune]--;
+ runeCost[rune]--;
+
+ // keep Death Rune type if missed
+ if (didHit)
+ player->RestoreBaseRune(i);
+
+ if (runeCost[RUNE_DEATH] == 0)
+ break;
+ }
+ }
+ }
+ // Grab any Death rune
if (runeCost[RUNE_DEATH] > 0)
{
for (uint32 i = 0; i < MAX_RUNES; ++i)
@@ -5057,12 +5088,12 @@ SpellCastResult Spell::CheckCast(bool strict)
m_preGeneratedPath.SetPathLengthLimit(range);
// first try with raycast, if it fails fall back to normal path
- bool result = m_preGeneratedPath.CalculatePath(target->GetPositionX(), target->GetPositionY(), target->GetPositionZ() + target->GetObjectSize(), false, true);
+ bool result = m_preGeneratedPath.CalculatePath(target->GetPositionX(), target->GetPositionY(), target->GetPositionZ() + target->GetObjectSize() / 2.f, false, true);
if (m_preGeneratedPath.GetPathType() & PATHFIND_SHORT)
return SPELL_FAILED_OUT_OF_RANGE;
else if (!result || m_preGeneratedPath.GetPathType() & (PATHFIND_NOPATH | PATHFIND_INCOMPLETE))
{
- result = m_preGeneratedPath.CalculatePath(target->GetPositionX(), target->GetPositionY(), target->GetPositionZ() + target->GetObjectSize(), false, false);
+ result = m_preGeneratedPath.CalculatePath(target->GetPositionX(), target->GetPositionY(), target->GetPositionZ() + target->GetObjectSize() / 2.f, false, false);
if (m_preGeneratedPath.GetPathType() & PATHFIND_SHORT)
return SPELL_FAILED_OUT_OF_RANGE;
else if (!result || m_preGeneratedPath.GetPathType() & (PATHFIND_NOPATH | PATHFIND_INCOMPLETE))
diff --git a/src/server/game/Spells/SpellEffects.cpp b/src/server/game/Spells/SpellEffects.cpp
index 3829e12b790..965b2463139 100644
--- a/src/server/game/Spells/SpellEffects.cpp
+++ b/src/server/game/Spells/SpellEffects.cpp
@@ -3100,19 +3100,18 @@ void Spell::EffectTaunt(SpellEffIndex /*effIndex*/)
if (m_spellInfo->Id == 62124)
m_caster->CastSpell(unitTarget, 67485, true);
- // Also use this effect to set the taunter's threat to the taunted creature's highest value
- if (unitTarget->getThreatManager().getCurrentVictim())
+ if (!unitTarget->getThreatManager().getOnlineContainer().empty())
{
+ // Also use this effect to set the taunter's threat to the taunted creature's highest value
float myThreat = unitTarget->getThreatManager().getThreat(m_caster);
- float itsThreat = unitTarget->getThreatManager().getCurrentVictim()->getThreat();
- if (itsThreat > myThreat)
- unitTarget->getThreatManager().addThreat(m_caster, itsThreat - myThreat);
- }
+ float topThreat = unitTarget->getThreatManager().getOnlineContainer().getMostHated()->getThreat();
+ if (topThreat > myThreat)
+ unitTarget->getThreatManager().doAddThreat(m_caster, topThreat - myThreat);
- //Set aggro victim to caster
- if (!unitTarget->getThreatManager().getOnlineContainer().empty())
+ //Set aggro victim to caster
if (HostileReference* forcedVictim = unitTarget->getThreatManager().getOnlineContainer().getReferenceByTarget(m_caster))
unitTarget->getThreatManager().setCurrentVictim(forcedVictim);
+ }
if (unitTarget->ToCreature()->IsAIEnabled && !unitTarget->ToCreature()->HasReactState(REACT_PASSIVE))
unitTarget->ToCreature()->AI()->AttackStart(m_caster);
diff --git a/src/server/game/World/World.cpp b/src/server/game/World/World.cpp
index c4b2eb768c6..7cddfc3f61e 100644
--- a/src/server/game/World/World.cpp
+++ b/src/server/game/World/World.cpp
@@ -1527,6 +1527,12 @@ void World::SetInitialWorldSettings()
TC_LOG_INFO("server.loading", "Loading GameObject Addon Data...");
sObjectMgr->LoadGameObjectAddons(); // must be after LoadGameObjectTemplate() and LoadGameobjects()
+ TC_LOG_INFO("server.loading", "Loading GameObject Quest Items...");
+ sObjectMgr->LoadGameObjectQuestItems();
+
+ TC_LOG_INFO("server.loading", "Loading Creature Quest Items...");
+ sObjectMgr->LoadCreatureQuestItems();
+
TC_LOG_INFO("server.loading", "Loading Creature Linked Respawn...");
sObjectMgr->LoadLinkedRespawn(); // must be after LoadCreatures(), LoadGameObjects()
diff --git a/src/server/scripts/Commands/cs_misc.cpp b/src/server/scripts/Commands/cs_misc.cpp
index c8a908f6930..7baef489865 100644
--- a/src/server/scripts/Commands/cs_misc.cpp
+++ b/src/server/scripts/Commands/cs_misc.cpp
@@ -1325,8 +1325,8 @@ public:
static bool HandleMaxSkillCommand(ChatHandler* handler, char const* /*args*/)
{
- Player* SelectedPlayer = handler->getSelectedPlayer();
- if (!SelectedPlayer)
+ Player* player = handler->getSelectedPlayerOrSelf();
+ if (!player)
{
handler->SendSysMessage(LANG_NO_CHAR_SELECTED);
handler->SetSentErrorMessage(true);
@@ -1334,7 +1334,7 @@ public:
}
// each skills that have max skill value dependent from level seted to current level max skill value
- SelectedPlayer->UpdateSkillsToMaxSkillsForLevel();
+ player->UpdateSkillsToMaxSkillsForLevel();
return true;
}
diff --git a/src/server/scripts/Commands/cs_mmaps.cpp b/src/server/scripts/Commands/cs_mmaps.cpp
index 14623e591c1..e06159a6748 100644
--- a/src/server/scripts/Commands/cs_mmaps.cpp
+++ b/src/server/scripts/Commands/cs_mmaps.cpp
@@ -87,6 +87,10 @@ public:
if (para && strcmp(para, "true") == 0)
useStraightPath = true;
+ bool useStraightLine = false;
+ if (para && strcmp(para, "line") == 0)
+ useStraightLine = true;
+
// unit locations
float x, y, z;
player->GetPosition(x, y, z);
@@ -94,11 +98,11 @@ public:
// path
PathGenerator path(target);
path.SetUseStraightPath(useStraightPath);
- bool result = path.CalculatePath(x, y, z);
+ bool result = path.CalculatePath(x, y, z, false, useStraightLine);
Movement::PointsArray const& pointPath = path.GetPath();
handler->PSendSysMessage("%s's path to %s:", target->GetName().c_str(), player->GetName().c_str());
- handler->PSendSysMessage("Building: %s", useStraightPath ? "StraightPath" : "SmoothPath");
+ handler->PSendSysMessage("Building: %s", useStraightPath ? "StraightPath" : useStraightLine ? "Raycast" : "SmoothPath");
handler->PSendSysMessage("Result: %s - Length: %zu - Type: %u", (result ? "true" : "false"), pointPath.size(), path.GetPathType());
G3D::Vector3 const &start = path.GetStartPosition();
diff --git a/src/server/scripts/Commands/cs_rbac.cpp b/src/server/scripts/Commands/cs_rbac.cpp
index 497bd45ec5c..03f35e6ba65 100644
--- a/src/server/scripts/Commands/cs_rbac.cpp
+++ b/src/server/scripts/Commands/cs_rbac.cpp
@@ -1,383 +1,383 @@
-/*
- * Copyright (C) 2008-2015 TrinityCore <http://www.trinitycore.org/>
- *
- * This program is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License as published by the
- * Free Software Foundation; either version 2 of the License, or (at your
- * option) any later version.
- *
- * This program is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
- * more details.
- *
- * You should have received a copy of the GNU General Public License along
- * with this program. If not, see <http://www.gnu.org/licenses/>.
- */
-
-/* ScriptData
-Name: rbac_commandscript
-%Complete: 100
-Comment: All role based access control related commands (including account related)
-Category: commandscripts
-EndScriptData */
-
-#include "AccountMgr.h"
-#include "Config.h"
-#include "Chat.h"
-#include "Language.h"
-#include "Player.h"
-#include "ScriptMgr.h"
-
-struct RBACCommandData
-{
- RBACCommandData(): id(0), realmId(0), rbac(NULL), needDelete(false) { }
- ~RBACCommandData()
- {
- if (needDelete)
- delete rbac;
- }
-
- uint32 id;
- int32 realmId;
- rbac::RBACData* rbac;
- bool needDelete;
-};
-
-class rbac_commandscript : public CommandScript
-{
-public:
- rbac_commandscript() : CommandScript("rbac_commandscript") { }
-
- ChatCommand* GetCommands() const
- {
- static ChatCommand rbacAccountCommandTable[] =
- {
- { "list", rbac::RBAC_PERM_COMMAND_RBAC_ACC_PERM_LIST, true, &HandleRBACPermListCommand, "", NULL },
- { "grant", rbac::RBAC_PERM_COMMAND_RBAC_ACC_PERM_GRANT, true, &HandleRBACPermGrantCommand, "", NULL },
- { "deny", rbac::RBAC_PERM_COMMAND_RBAC_ACC_PERM_DENY, true, &HandleRBACPermDenyCommand, "", NULL },
- { "revoke", rbac::RBAC_PERM_COMMAND_RBAC_ACC_PERM_REVOKE, true, &HandleRBACPermRevokeCommand, "", NULL },
- { NULL, 0, false, NULL, "", NULL }
- };
-
- static ChatCommand rbacCommandTable[] =
- {
- { "account", rbac::RBAC_PERM_COMMAND_RBAC_ACC, true, NULL, "", rbacAccountCommandTable },
- { "list", rbac::RBAC_PERM_COMMAND_RBAC_LIST, true, &HandleRBACListPermissionsCommand, "", NULL },
- { NULL, 0, false, NULL, "", NULL }
- };
-
- static ChatCommand commandTable[] =
- {
- { "rbac", rbac::RBAC_PERM_COMMAND_RBAC, true, NULL, "", rbacCommandTable },
- { NULL, 0, false, NULL, "", NULL }
- };
-
- return commandTable;
- }
-
- static RBACCommandData* ReadParams(ChatHandler* handler, char const* args, bool checkParams = true)
- {
- if (!args)
- return NULL;
-
- char* param1 = strtok((char*)args, " ");
- char* param2 = strtok(NULL, " ");
- char* param3 = strtok(NULL, " ");
-
- int32 realmId = -1;
- uint32 accountId = 0;
- std::string accountName;
- uint32 id = 0;
- RBACCommandData* data = NULL;
- rbac::RBACData* rdata = NULL;
- bool useSelectedPlayer = false;
-
- if (checkParams)
- {
- if (!param3)
- {
- if (param2)
- realmId = atoi(param2);
-
- if (param1)
- id = atoi(param1);
-
- useSelectedPlayer = true;
- }
- else
- {
- id = atoi(param2);
- realmId = atoi(param3);
- }
-
- if (!id)
- {
- handler->PSendSysMessage(LANG_RBAC_WRONG_PARAMETER_ID, id);
- handler->SetSentErrorMessage(true);
- return NULL;
- }
-
- if (realmId < -1 || !realmId)
- {
- handler->PSendSysMessage(LANG_RBAC_WRONG_PARAMETER_REALM, realmId);
- handler->SetSentErrorMessage(true);
- return NULL;
- }
- }
- else if (!param1)
- useSelectedPlayer = true;
-
- if (useSelectedPlayer)
- {
- Player* player = handler->getSelectedPlayer();
- if (!player)
- return NULL;
-
- rdata = player->GetSession()->GetRBACData();
- accountId = rdata->GetId();
- AccountMgr::GetName(accountId, accountName);
- }
- else
- {
- accountName = param1;
-
- if (AccountMgr::normalizeString(accountName))
- accountId = AccountMgr::GetId(accountName);
-
- if (!accountId)
- {
- handler->PSendSysMessage(LANG_ACCOUNT_NOT_EXIST, accountName.c_str());
- handler->SetSentErrorMessage(true);
- return NULL;
- }
- }
-
- if (checkParams && handler->HasLowerSecurityAccount(NULL, accountId, true))
- return NULL;
-
- data = new RBACCommandData();
-
- if (!rdata)
- {
- data->rbac = new rbac::RBACData(accountId, accountName, realmID, AccountMgr::GetSecurity(accountId, realmID));
- data->rbac->LoadFromDB();
- data->needDelete = true;
- }
- else
- data->rbac = rdata;
-
- data->id = id;
- data->realmId = realmId;
- return data;
- }
-
- static bool HandleRBACPermGrantCommand(ChatHandler* handler, char const* args)
- {
- RBACCommandData* command = ReadParams(handler, args);
-
- if (!command)
- {
- handler->SetSentErrorMessage(true);
- return false;
- }
-
- rbac::RBACCommandResult result = command->rbac->GrantPermission(command->id, command->realmId);
- rbac::RBACPermission const* permission = sAccountMgr->GetRBACPermission(command->id);
-
- switch (result)
- {
- case rbac::RBAC_CANT_ADD_ALREADY_ADDED:
- handler->PSendSysMessage(LANG_RBAC_PERM_GRANTED_IN_LIST, command->id, permission->GetName().c_str(),
- command->realmId, command->rbac->GetId(), command->rbac->GetName().c_str());
- break;
- case rbac::RBAC_IN_DENIED_LIST:
- handler->PSendSysMessage(LANG_RBAC_PERM_GRANTED_IN_DENIED_LIST, command->id, permission->GetName().c_str(),
- command->realmId, command->rbac->GetId(), command->rbac->GetName().c_str());
- break;
- case rbac::RBAC_OK:
- handler->PSendSysMessage(LANG_RBAC_PERM_GRANTED, command->id, permission->GetName().c_str(),
- command->realmId, command->rbac->GetId(), command->rbac->GetName().c_str());
- break;
- case rbac::RBAC_ID_DOES_NOT_EXISTS:
- handler->PSendSysMessage(LANG_RBAC_WRONG_PARAMETER_ID, command->id);
- break;
- default:
- break;
- }
-
- delete command;
-
- return true;
- }
-
- static bool HandleRBACPermDenyCommand(ChatHandler* handler, char const* args)
- {
- RBACCommandData* command = ReadParams(handler, args);
-
- if (!command)
- {
- handler->SetSentErrorMessage(true);
- return false;
- }
-
- rbac::RBACCommandResult result = command->rbac->DenyPermission(command->id, command->realmId);
- rbac::RBACPermission const* permission = sAccountMgr->GetRBACPermission(command->id);
-
- switch (result)
- {
- case rbac::RBAC_CANT_ADD_ALREADY_ADDED:
- handler->PSendSysMessage(LANG_RBAC_PERM_DENIED_IN_LIST, command->id, permission->GetName().c_str(),
- command->realmId, command->rbac->GetId(), command->rbac->GetName().c_str());
- break;
- case rbac::RBAC_IN_GRANTED_LIST:
- handler->PSendSysMessage(LANG_RBAC_PERM_DENIED_IN_GRANTED_LIST, command->id, permission->GetName().c_str(),
- command->realmId, command->rbac->GetId(), command->rbac->GetName().c_str());
- break;
- case rbac::RBAC_OK:
- handler->PSendSysMessage(LANG_RBAC_PERM_DENIED, command->id, permission->GetName().c_str(),
- command->realmId, command->rbac->GetId(), command->rbac->GetName().c_str());
- break;
- case rbac::RBAC_ID_DOES_NOT_EXISTS:
- handler->PSendSysMessage(LANG_RBAC_WRONG_PARAMETER_ID, command->id);
- break;
- default:
- break;
- }
-
- delete command;
-
- return true;
- }
-
- static bool HandleRBACPermRevokeCommand(ChatHandler* handler, char const* args)
- {
- RBACCommandData* command = ReadParams(handler, args);
-
- if (!command)
- {
- handler->SetSentErrorMessage(true);
- return false;
- }
-
- rbac::RBACCommandResult result = command->rbac->RevokePermission(command->id, command->realmId);
- rbac::RBACPermission const* permission = sAccountMgr->GetRBACPermission(command->id);
-
- switch (result)
- {
- case rbac::RBAC_CANT_REVOKE_NOT_IN_LIST:
- handler->PSendSysMessage(LANG_RBAC_PERM_REVOKED_NOT_IN_LIST, command->id, permission->GetName().c_str(),
- command->realmId, command->rbac->GetId(), command->rbac->GetName().c_str());
- break;
- case rbac::RBAC_OK:
- handler->PSendSysMessage(LANG_RBAC_PERM_REVOKED, command->id, permission->GetName().c_str(),
- command->realmId, command->rbac->GetId(), command->rbac->GetName().c_str());
- break;
- case rbac::RBAC_ID_DOES_NOT_EXISTS:
- handler->PSendSysMessage(LANG_RBAC_WRONG_PARAMETER_ID, command->id);
- break;
- default:
- break;
- }
-
- delete command;
-
- return true;
- }
-
- static bool HandleRBACPermListCommand(ChatHandler* handler, char const* args)
- {
- RBACCommandData* command = ReadParams(handler, args, false);
-
- if (!command)
- {
- handler->SetSentErrorMessage(true);
- return false;
- }
-
- handler->PSendSysMessage(LANG_RBAC_LIST_HEADER_GRANTED, command->rbac->GetId(), command->rbac->GetName().c_str());
- rbac::RBACPermissionContainer const& granted = command->rbac->GetGrantedPermissions();
- if (granted.empty())
- handler->PSendSysMessage("%s", handler->GetTrinityString(LANG_RBAC_LIST_EMPTY));
- else
- {
- for (rbac::RBACPermissionContainer::const_iterator itr = granted.begin(); itr != granted.end(); ++itr)
- {
- rbac::RBACPermission const* permission = sAccountMgr->GetRBACPermission(*itr);
- handler->PSendSysMessage(LANG_RBAC_LIST_ELEMENT, permission->GetId(), permission->GetName().c_str());
- }
- }
-
- handler->PSendSysMessage(LANG_RBAC_LIST_HEADER_DENIED, command->rbac->GetId(), command->rbac->GetName().c_str());
- rbac::RBACPermissionContainer const& denied = command->rbac->GetDeniedPermissions();
- if (denied.empty())
- handler->PSendSysMessage("%s", handler->GetTrinityString(LANG_RBAC_LIST_EMPTY));
- else
- {
- for (rbac::RBACPermissionContainer::const_iterator itr = denied.begin(); itr != denied.end(); ++itr)
- {
- rbac::RBACPermission const* permission = sAccountMgr->GetRBACPermission(*itr);
- handler->PSendSysMessage(LANG_RBAC_LIST_ELEMENT, permission->GetId(), permission->GetName().c_str());
- }
- }
- handler->PSendSysMessage(LANG_RBAC_LIST_HEADER_BY_SEC_LEVEL, command->rbac->GetId(), command->rbac->GetName().c_str(), command->rbac->GetSecurityLevel());
- rbac::RBACPermissionContainer const& defaultPermissions = sAccountMgr->GetRBACDefaultPermissions(command->rbac->GetSecurityLevel());
- if (defaultPermissions.empty())
- handler->PSendSysMessage("%s", handler->GetTrinityString(LANG_RBAC_LIST_EMPTY));
- else
- {
- for (rbac::RBACPermissionContainer::const_iterator itr = defaultPermissions.begin(); itr != defaultPermissions.end(); ++itr)
- {
- rbac::RBACPermission const* permission = sAccountMgr->GetRBACPermission(*itr);
- handler->PSendSysMessage(LANG_RBAC_LIST_ELEMENT, permission->GetId(), permission->GetName().c_str());
- }
- }
-
- delete command;
-
- return true;
- }
-
- static bool HandleRBACListPermissionsCommand(ChatHandler* handler, char const* args)
- {
- uint32 id = 0;
- if (char* param1 = strtok((char*)args, " "))
- id = atoi(param1);
-
- if (!id)
- {
- rbac::RBACPermissionsContainer const& permissions = sAccountMgr->GetRBACPermissionList();
- handler->PSendSysMessage("%s", handler->GetTrinityString(LANG_RBAC_LIST_PERMISSIONS_HEADER));
- for (rbac::RBACPermissionsContainer::const_iterator it = permissions.begin(); it != permissions.end(); ++it)
- {
- rbac::RBACPermission const* permission = it->second;
- handler->PSendSysMessage(LANG_RBAC_LIST_ELEMENT, permission->GetId(), permission->GetName().c_str());
- }
- }
- else
- {
- rbac::RBACPermission const* permission = sAccountMgr->GetRBACPermission(id);
- if (!permission)
- {
- handler->PSendSysMessage(LANG_RBAC_WRONG_PARAMETER_ID, id);
- handler->SetSentErrorMessage(true);
- return false;
- }
-
- handler->PSendSysMessage("%s", handler->GetTrinityString(LANG_RBAC_LIST_PERMISSIONS_HEADER));
- handler->PSendSysMessage(LANG_RBAC_LIST_ELEMENT, permission->GetId(), permission->GetName().c_str());
- handler->PSendSysMessage("%s", handler->GetTrinityString(LANG_RBAC_LIST_PERMS_LINKED_HEADER));
- rbac::RBACPermissionContainer const& permissions = permission->GetLinkedPermissions();
- for (rbac::RBACPermissionContainer::const_iterator it = permissions.begin(); it != permissions.end(); ++it)
- if (rbac::RBACPermission const* rbacPermission = sAccountMgr->GetRBACPermission(*it))
- handler->PSendSysMessage(LANG_RBAC_LIST_ELEMENT, rbacPermission->GetId(), rbacPermission->GetName().c_str());
- }
-
- return true;
- }
-};
-
-void AddSC_rbac_commandscript()
-{
- new rbac_commandscript();
-}
+/*
+ * Copyright (C) 2008-2015 TrinityCore <http://www.trinitycore.org/>
+ *
+ * This program is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License as published by the
+ * Free Software Foundation; either version 2 of the License, or (at your
+ * option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
+ * more details.
+ *
+ * You should have received a copy of the GNU General Public License along
+ * with this program. If not, see <http://www.gnu.org/licenses/>.
+ */
+
+/* ScriptData
+Name: rbac_commandscript
+%Complete: 100
+Comment: All role based access control related commands (including account related)
+Category: commandscripts
+EndScriptData */
+
+#include "AccountMgr.h"
+#include "Config.h"
+#include "Chat.h"
+#include "Language.h"
+#include "Player.h"
+#include "ScriptMgr.h"
+
+struct RBACCommandData
+{
+ RBACCommandData(): id(0), realmId(0), rbac(NULL), needDelete(false) { }
+ ~RBACCommandData()
+ {
+ if (needDelete)
+ delete rbac;
+ }
+
+ uint32 id;
+ int32 realmId;
+ rbac::RBACData* rbac;
+ bool needDelete;
+};
+
+class rbac_commandscript : public CommandScript
+{
+public:
+ rbac_commandscript() : CommandScript("rbac_commandscript") { }
+
+ ChatCommand* GetCommands() const
+ {
+ static ChatCommand rbacAccountCommandTable[] =
+ {
+ { "list", rbac::RBAC_PERM_COMMAND_RBAC_ACC_PERM_LIST, true, &HandleRBACPermListCommand, "", NULL },
+ { "grant", rbac::RBAC_PERM_COMMAND_RBAC_ACC_PERM_GRANT, true, &HandleRBACPermGrantCommand, "", NULL },
+ { "deny", rbac::RBAC_PERM_COMMAND_RBAC_ACC_PERM_DENY, true, &HandleRBACPermDenyCommand, "", NULL },
+ { "revoke", rbac::RBAC_PERM_COMMAND_RBAC_ACC_PERM_REVOKE, true, &HandleRBACPermRevokeCommand, "", NULL },
+ { NULL, 0, false, NULL, "", NULL }
+ };
+
+ static ChatCommand rbacCommandTable[] =
+ {
+ { "account", rbac::RBAC_PERM_COMMAND_RBAC_ACC, true, NULL, "", rbacAccountCommandTable },
+ { "list", rbac::RBAC_PERM_COMMAND_RBAC_LIST, true, &HandleRBACListPermissionsCommand, "", NULL },
+ { NULL, 0, false, NULL, "", NULL }
+ };
+
+ static ChatCommand commandTable[] =
+ {
+ { "rbac", rbac::RBAC_PERM_COMMAND_RBAC, true, NULL, "", rbacCommandTable },
+ { NULL, 0, false, NULL, "", NULL }
+ };
+
+ return commandTable;
+ }
+
+ static RBACCommandData* ReadParams(ChatHandler* handler, char const* args, bool checkParams = true)
+ {
+ if (!args)
+ return NULL;
+
+ char* param1 = strtok((char*)args, " ");
+ char* param2 = strtok(NULL, " ");
+ char* param3 = strtok(NULL, " ");
+
+ int32 realmId = -1;
+ uint32 accountId = 0;
+ std::string accountName;
+ uint32 id = 0;
+ RBACCommandData* data = NULL;
+ rbac::RBACData* rdata = NULL;
+ bool useSelectedPlayer = false;
+
+ if (checkParams)
+ {
+ if (!param3)
+ {
+ if (param2)
+ realmId = atoi(param2);
+
+ if (param1)
+ id = atoi(param1);
+
+ useSelectedPlayer = true;
+ }
+ else
+ {
+ id = atoi(param2);
+ realmId = atoi(param3);
+ }
+
+ if (!id)
+ {
+ handler->PSendSysMessage(LANG_RBAC_WRONG_PARAMETER_ID, id);
+ handler->SetSentErrorMessage(true);
+ return NULL;
+ }
+
+ if (realmId < -1 || !realmId)
+ {
+ handler->PSendSysMessage(LANG_RBAC_WRONG_PARAMETER_REALM, realmId);
+ handler->SetSentErrorMessage(true);
+ return NULL;
+ }
+ }
+ else if (!param1)
+ useSelectedPlayer = true;
+
+ if (useSelectedPlayer)
+ {
+ Player* player = handler->getSelectedPlayer();
+ if (!player)
+ return NULL;
+
+ rdata = player->GetSession()->GetRBACData();
+ accountId = rdata->GetId();
+ AccountMgr::GetName(accountId, accountName);
+ }
+ else
+ {
+ accountName = param1;
+
+ if (AccountMgr::normalizeString(accountName))
+ accountId = AccountMgr::GetId(accountName);
+
+ if (!accountId)
+ {
+ handler->PSendSysMessage(LANG_ACCOUNT_NOT_EXIST, accountName.c_str());
+ handler->SetSentErrorMessage(true);
+ return NULL;
+ }
+ }
+
+ if (checkParams && handler->HasLowerSecurityAccount(NULL, accountId, true))
+ return NULL;
+
+ data = new RBACCommandData();
+
+ if (!rdata)
+ {
+ data->rbac = new rbac::RBACData(accountId, accountName, realmID, AccountMgr::GetSecurity(accountId, realmID));
+ data->rbac->LoadFromDB();
+ data->needDelete = true;
+ }
+ else
+ data->rbac = rdata;
+
+ data->id = id;
+ data->realmId = realmId;
+ return data;
+ }
+
+ static bool HandleRBACPermGrantCommand(ChatHandler* handler, char const* args)
+ {
+ RBACCommandData* command = ReadParams(handler, args);
+
+ if (!command)
+ {
+ handler->SetSentErrorMessage(true);
+ return false;
+ }
+
+ rbac::RBACCommandResult result = command->rbac->GrantPermission(command->id, command->realmId);
+ rbac::RBACPermission const* permission = sAccountMgr->GetRBACPermission(command->id);
+
+ switch (result)
+ {
+ case rbac::RBAC_CANT_ADD_ALREADY_ADDED:
+ handler->PSendSysMessage(LANG_RBAC_PERM_GRANTED_IN_LIST, command->id, permission->GetName().c_str(),
+ command->realmId, command->rbac->GetId(), command->rbac->GetName().c_str());
+ break;
+ case rbac::RBAC_IN_DENIED_LIST:
+ handler->PSendSysMessage(LANG_RBAC_PERM_GRANTED_IN_DENIED_LIST, command->id, permission->GetName().c_str(),
+ command->realmId, command->rbac->GetId(), command->rbac->GetName().c_str());
+ break;
+ case rbac::RBAC_OK:
+ handler->PSendSysMessage(LANG_RBAC_PERM_GRANTED, command->id, permission->GetName().c_str(),
+ command->realmId, command->rbac->GetId(), command->rbac->GetName().c_str());
+ break;
+ case rbac::RBAC_ID_DOES_NOT_EXISTS:
+ handler->PSendSysMessage(LANG_RBAC_WRONG_PARAMETER_ID, command->id);
+ break;
+ default:
+ break;
+ }
+
+ delete command;
+
+ return true;
+ }
+
+ static bool HandleRBACPermDenyCommand(ChatHandler* handler, char const* args)
+ {
+ RBACCommandData* command = ReadParams(handler, args);
+
+ if (!command)
+ {
+ handler->SetSentErrorMessage(true);
+ return false;
+ }
+
+ rbac::RBACCommandResult result = command->rbac->DenyPermission(command->id, command->realmId);
+ rbac::RBACPermission const* permission = sAccountMgr->GetRBACPermission(command->id);
+
+ switch (result)
+ {
+ case rbac::RBAC_CANT_ADD_ALREADY_ADDED:
+ handler->PSendSysMessage(LANG_RBAC_PERM_DENIED_IN_LIST, command->id, permission->GetName().c_str(),
+ command->realmId, command->rbac->GetId(), command->rbac->GetName().c_str());
+ break;
+ case rbac::RBAC_IN_GRANTED_LIST:
+ handler->PSendSysMessage(LANG_RBAC_PERM_DENIED_IN_GRANTED_LIST, command->id, permission->GetName().c_str(),
+ command->realmId, command->rbac->GetId(), command->rbac->GetName().c_str());
+ break;
+ case rbac::RBAC_OK:
+ handler->PSendSysMessage(LANG_RBAC_PERM_DENIED, command->id, permission->GetName().c_str(),
+ command->realmId, command->rbac->GetId(), command->rbac->GetName().c_str());
+ break;
+ case rbac::RBAC_ID_DOES_NOT_EXISTS:
+ handler->PSendSysMessage(LANG_RBAC_WRONG_PARAMETER_ID, command->id);
+ break;
+ default:
+ break;
+ }
+
+ delete command;
+
+ return true;
+ }
+
+ static bool HandleRBACPermRevokeCommand(ChatHandler* handler, char const* args)
+ {
+ RBACCommandData* command = ReadParams(handler, args);
+
+ if (!command)
+ {
+ handler->SetSentErrorMessage(true);
+ return false;
+ }
+
+ rbac::RBACCommandResult result = command->rbac->RevokePermission(command->id, command->realmId);
+ rbac::RBACPermission const* permission = sAccountMgr->GetRBACPermission(command->id);
+
+ switch (result)
+ {
+ case rbac::RBAC_CANT_REVOKE_NOT_IN_LIST:
+ handler->PSendSysMessage(LANG_RBAC_PERM_REVOKED_NOT_IN_LIST, command->id, permission->GetName().c_str(),
+ command->realmId, command->rbac->GetId(), command->rbac->GetName().c_str());
+ break;
+ case rbac::RBAC_OK:
+ handler->PSendSysMessage(LANG_RBAC_PERM_REVOKED, command->id, permission->GetName().c_str(),
+ command->realmId, command->rbac->GetId(), command->rbac->GetName().c_str());
+ break;
+ case rbac::RBAC_ID_DOES_NOT_EXISTS:
+ handler->PSendSysMessage(LANG_RBAC_WRONG_PARAMETER_ID, command->id);
+ break;
+ default:
+ break;
+ }
+
+ delete command;
+
+ return true;
+ }
+
+ static bool HandleRBACPermListCommand(ChatHandler* handler, char const* args)
+ {
+ RBACCommandData* command = ReadParams(handler, args, false);
+
+ if (!command)
+ {
+ handler->SetSentErrorMessage(true);
+ return false;
+ }
+
+ handler->PSendSysMessage(LANG_RBAC_LIST_HEADER_GRANTED, command->rbac->GetId(), command->rbac->GetName().c_str());
+ rbac::RBACPermissionContainer const& granted = command->rbac->GetGrantedPermissions();
+ if (granted.empty())
+ handler->PSendSysMessage("%s", handler->GetTrinityString(LANG_RBAC_LIST_EMPTY));
+ else
+ {
+ for (rbac::RBACPermissionContainer::const_iterator itr = granted.begin(); itr != granted.end(); ++itr)
+ {
+ rbac::RBACPermission const* permission = sAccountMgr->GetRBACPermission(*itr);
+ handler->PSendSysMessage(LANG_RBAC_LIST_ELEMENT, permission->GetId(), permission->GetName().c_str());
+ }
+ }
+
+ handler->PSendSysMessage(LANG_RBAC_LIST_HEADER_DENIED, command->rbac->GetId(), command->rbac->GetName().c_str());
+ rbac::RBACPermissionContainer const& denied = command->rbac->GetDeniedPermissions();
+ if (denied.empty())
+ handler->PSendSysMessage("%s", handler->GetTrinityString(LANG_RBAC_LIST_EMPTY));
+ else
+ {
+ for (rbac::RBACPermissionContainer::const_iterator itr = denied.begin(); itr != denied.end(); ++itr)
+ {
+ rbac::RBACPermission const* permission = sAccountMgr->GetRBACPermission(*itr);
+ handler->PSendSysMessage(LANG_RBAC_LIST_ELEMENT, permission->GetId(), permission->GetName().c_str());
+ }
+ }
+ handler->PSendSysMessage(LANG_RBAC_LIST_HEADER_BY_SEC_LEVEL, command->rbac->GetId(), command->rbac->GetName().c_str(), command->rbac->GetSecurityLevel());
+ rbac::RBACPermissionContainer const& defaultPermissions = sAccountMgr->GetRBACDefaultPermissions(command->rbac->GetSecurityLevel());
+ if (defaultPermissions.empty())
+ handler->PSendSysMessage("%s", handler->GetTrinityString(LANG_RBAC_LIST_EMPTY));
+ else
+ {
+ for (rbac::RBACPermissionContainer::const_iterator itr = defaultPermissions.begin(); itr != defaultPermissions.end(); ++itr)
+ {
+ rbac::RBACPermission const* permission = sAccountMgr->GetRBACPermission(*itr);
+ handler->PSendSysMessage(LANG_RBAC_LIST_ELEMENT, permission->GetId(), permission->GetName().c_str());
+ }
+ }
+
+ delete command;
+
+ return true;
+ }
+
+ static bool HandleRBACListPermissionsCommand(ChatHandler* handler, char const* args)
+ {
+ uint32 id = 0;
+ if (char* param1 = strtok((char*)args, " "))
+ id = atoi(param1);
+
+ if (!id)
+ {
+ rbac::RBACPermissionsContainer const& permissions = sAccountMgr->GetRBACPermissionList();
+ handler->PSendSysMessage("%s", handler->GetTrinityString(LANG_RBAC_LIST_PERMISSIONS_HEADER));
+ for (rbac::RBACPermissionsContainer::const_iterator it = permissions.begin(); it != permissions.end(); ++it)
+ {
+ rbac::RBACPermission const* permission = it->second;
+ handler->PSendSysMessage(LANG_RBAC_LIST_ELEMENT, permission->GetId(), permission->GetName().c_str());
+ }
+ }
+ else
+ {
+ rbac::RBACPermission const* permission = sAccountMgr->GetRBACPermission(id);
+ if (!permission)
+ {
+ handler->PSendSysMessage(LANG_RBAC_WRONG_PARAMETER_ID, id);
+ handler->SetSentErrorMessage(true);
+ return false;
+ }
+
+ handler->PSendSysMessage("%s", handler->GetTrinityString(LANG_RBAC_LIST_PERMISSIONS_HEADER));
+ handler->PSendSysMessage(LANG_RBAC_LIST_ELEMENT, permission->GetId(), permission->GetName().c_str());
+ handler->PSendSysMessage("%s", handler->GetTrinityString(LANG_RBAC_LIST_PERMS_LINKED_HEADER));
+ rbac::RBACPermissionContainer const& permissions = permission->GetLinkedPermissions();
+ for (rbac::RBACPermissionContainer::const_iterator it = permissions.begin(); it != permissions.end(); ++it)
+ if (rbac::RBACPermission const* rbacPermission = sAccountMgr->GetRBACPermission(*it))
+ handler->PSendSysMessage(LANG_RBAC_LIST_ELEMENT, rbacPermission->GetId(), rbacPermission->GetName().c_str());
+ }
+
+ return true;
+ }
+};
+
+void AddSC_rbac_commandscript()
+{
+ new rbac_commandscript();
+}
diff --git a/src/server/scripts/Northrend/ChamberOfAspects/RubySanctum/boss_halion.cpp b/src/server/scripts/Northrend/ChamberOfAspects/RubySanctum/boss_halion.cpp
index 04ea31bd1dd..434028ab255 100644
--- a/src/server/scripts/Northrend/ChamberOfAspects/RubySanctum/boss_halion.cpp
+++ b/src/server/scripts/Northrend/ChamberOfAspects/RubySanctum/boss_halion.cpp
@@ -1126,7 +1126,7 @@ class npc_meteor_strike_flame : public CreatureScript
SetCombatMovement(false);
}
- void SetGUID(ObjectGuid guid, int32 id /* = 0 */) override
+ void SetGUID(ObjectGuid guid, int32 /*id = 0 */) override
{
_rootOwnerGuid = guid;
}
@@ -1159,7 +1159,7 @@ class npc_meteor_strike_flame : public CreatureScript
controller->AI()->JustSummoned(me);
}
- void UpdateAI(uint32 diff) override { }
+ void UpdateAI(uint32 /*diff*/) override { }
void EnterEvadeMode() override { }
private:
diff --git a/src/server/scripts/Northrend/FrozenHalls/ForgeOfSouls/boss_bronjahm.cpp b/src/server/scripts/Northrend/FrozenHalls/ForgeOfSouls/boss_bronjahm.cpp
index 0b829c2c6dd..620eb54ffa9 100644
--- a/src/server/scripts/Northrend/FrozenHalls/ForgeOfSouls/boss_bronjahm.cpp
+++ b/src/server/scripts/Northrend/FrozenHalls/ForgeOfSouls/boss_bronjahm.cpp
@@ -123,11 +123,13 @@ class boss_bronjahm : public CreatureScript
void JustSummoned(Creature* summon) override
{
- summons.Summon(summon);
- summon->SetReactState(REACT_PASSIVE);
- summon->GetMotionMaster()->Clear();
- summon->GetMotionMaster()->MoveFollow(me, me->GetObjectSize(), 0.0f);
- summon->CastSpell(summon, SPELL_PURPLE_BANISH_VISUAL, true);
+ if (summon->GetEntry() == NPC_CORRUPTED_SOUL_FRAGMENT)
+ {
+ summons.Summon(summon);
+ summon->SetReactState(REACT_PASSIVE);
+ summon->GetMotionMaster()->MoveFollow(me, me->GetObjectSize(), 0.0f);
+ summon->CastSpell(summon, SPELL_PURPLE_BANISH_VISUAL, true);
+ }
}
uint32 GetData(uint32 type) const override
@@ -223,9 +225,15 @@ class npc_corrupted_soul_fragment : public CreatureScript
instance = me->GetInstanceScript();
}
+ void IsSummonedBy(Unit* /*summoner*/) override
+ {
+ if (Creature* bronjahm = ObjectAccessor::GetCreature(*me, instance->GetGuidData(DATA_BRONJAHM)))
+ bronjahm->AI()->JustSummoned(me);
+ }
+
void MovementInform(uint32 type, uint32 id) override
{
- if (type != CHASE_MOTION_TYPE)
+ if (type != FOLLOW_MOTION_TYPE)
return;
if (instance->GetGuidData(DATA_BRONJAHM).GetCounter() != id)
diff --git a/src/server/scripts/Northrend/Nexus/EyeOfEternity/boss_malygos.cpp b/src/server/scripts/Northrend/Nexus/EyeOfEternity/boss_malygos.cpp
index 9c339e596a4..ff1ba5ee9b1 100644
--- a/src/server/scripts/Northrend/Nexus/EyeOfEternity/boss_malygos.cpp
+++ b/src/server/scripts/Northrend/Nexus/EyeOfEternity/boss_malygos.cpp
@@ -1530,15 +1530,14 @@ public:
{
npc_wyrmrest_skytalonAI(Creature* creature) : VehicleAI(creature)
{
- _summoner = NULL;
}
void IsSummonedBy(Unit* summoner) override
{
- _summoner = NULL;
+ _summoner.Clear();
if (Player* player = summoner->ToPlayer())
{
- _summoner = player;
+ _summoner = player->GetGUID();
_events.ScheduleEvent(EVENT_CAST_RIDE_SPELL, 2*IN_MILLISECONDS);
}
}
@@ -1553,7 +1552,8 @@ public:
switch (eventId)
{
case EVENT_CAST_RIDE_SPELL:
- me->CastSpell(_summoner, SPELL_RIDE_RED_DRAGON_TRIGGERED, true);
+ if (Player* player = ObjectAccessor::GetPlayer(*me, _summoner))
+ me->CastSpell(player, SPELL_RIDE_RED_DRAGON_TRIGGERED, true);
break;
}
}
@@ -1575,7 +1575,7 @@ public:
}
private:
- Player* _summoner;
+ ObjectGuid _summoner;
EventMap _events;
};
diff --git a/src/server/scripts/Northrend/Nexus/EyeOfEternity/instance_eye_of_eternity.cpp b/src/server/scripts/Northrend/Nexus/EyeOfEternity/instance_eye_of_eternity.cpp
index 7b884f39a41..7c99fe40e32 100644
--- a/src/server/scripts/Northrend/Nexus/EyeOfEternity/instance_eye_of_eternity.cpp
+++ b/src/server/scripts/Northrend/Nexus/EyeOfEternity/instance_eye_of_eternity.cpp
@@ -77,9 +77,9 @@ public:
/// @todo this should be handled in map, maybe add a summon function in map
// There is no other way afaik...
- void SpawnGameObject(uint32 entry, Position& pos)
+ void SpawnGameObject(uint32 entry, Position const& pos)
{
- GameObject* go = new GameObject;
+ GameObject* go = new GameObject();
if (!go->Create(sObjectMgr->GenerateLowGuid(HIGHGUID_GAMEOBJECT), entry, instance,
PHASEMASK_NORMAL, pos.GetPositionX(), pos.GetPositionY(), pos.GetPositionZ(), pos.GetOrientation(),
0, 0, 0, 0, 120, GO_STATE_READY))
@@ -99,30 +99,19 @@ public:
platformGUID = go->GetGUID();
break;
case GO_FOCUSING_IRIS_10:
- if (instance->GetDifficulty() == RAID_DIFFICULTY_10MAN_NORMAL)
- {
- irisGUID = go->GetGUID();
- focusingIrisPosition = go->GetPosition();
- }
- break;
case GO_FOCUSING_IRIS_25:
- if (instance->GetDifficulty() == RAID_DIFFICULTY_25MAN_NORMAL)
- {
- irisGUID = go->GetGUID();
- focusingIrisPosition = go->GetPosition();
- }
+ irisGUID = go->GetGUID();
+ focusingIrisPosition = go->GetPosition();
break;
case GO_EXIT_PORTAL:
exitPortalGUID = go->GetGUID();
exitPortalPosition = go->GetPosition();
break;
case GO_HEART_OF_MAGIC_10:
- if (instance->GetDifficulty() == RAID_DIFFICULTY_10MAN_NORMAL)
- heartOfMagicGUID = go->GetGUID();
- break;
case GO_HEART_OF_MAGIC_25:
- if (instance->GetDifficulty() == RAID_DIFFICULTY_25MAN_NORMAL)
- heartOfMagicGUID = go->GetGUID();
+ heartOfMagicGUID = go->GetGUID();
+ break;
+ default:
break;
}
}
@@ -167,10 +156,10 @@ public:
if (eventId == EVENT_FOCUSING_IRIS)
{
if (Creature* alexstraszaBunny = instance->GetCreature(alexstraszaBunnyGUID))
- {
alexstraszaBunny->CastSpell(alexstraszaBunny, SPELL_IRIS_OPENED);
- instance->GetGameObject(irisGUID)->SetFlag(GAMEOBJECT_FLAGS, GO_FLAG_IN_USE);
- }
+
+ if (GameObject* iris = instance->GetGameObject(irisGUID))
+ iris->SetFlag(GAMEOBJECT_FLAGS, GO_FLAG_IN_USE);
if (Creature* malygos = instance->GetCreature(malygosGUID))
malygos->AI()->DoAction(0); // ACTION_LAND_ENCOUNTER_START
@@ -184,17 +173,17 @@ public:
{
if (Creature* malygos = instance->GetCreature(malygosGUID))
{
- std::list<HostileReference*> m_threatlist = malygos->getThreatManager().getThreatList();
+ ThreatContainer::StorageType const& threatList = malygos->getThreatManager().getThreatList();
for (GuidList::const_iterator itr_vortex = vortexTriggers.begin(); itr_vortex != vortexTriggers.end(); ++itr_vortex)
{
- if (m_threatlist.empty())
+ if (threatList.empty())
return;
uint8 counter = 0;
if (Creature* trigger = instance->GetCreature(*itr_vortex))
{
// each trigger have to cast the spell to 5 players.
- for (std::list<HostileReference*>::const_iterator itr = m_threatlist.begin(); itr!= m_threatlist.end(); ++itr)
+ for (ThreatContainer::StorageType::const_iterator itr = threatList.begin(); itr != threatList.end(); ++itr)
{
if (counter >= 5)
break;
diff --git a/src/server/scripts/Northrend/Ulduar/Ulduar/instance_ulduar.cpp b/src/server/scripts/Northrend/Ulduar/Ulduar/instance_ulduar.cpp
index ca3ea3a60ed..0c7df100f60 100644
--- a/src/server/scripts/Northrend/Ulduar/Ulduar/instance_ulduar.cpp
+++ b/src/server/scripts/Northrend/Ulduar/Ulduar/instance_ulduar.cpp
@@ -690,22 +690,7 @@ class instance_ulduar : public InstanceMapScript
{
case BOSS_LEVIATHAN:
if (state == DONE)
- {
- // Eject all players from vehicles and make them untargetable.
- // They will be despawned after a while
- for (auto const& vehicleGuid : LeviathanVehicleGUIDs)
- {
- if (Creature* vehicleCreature = instance->GetCreature(vehicleGuid))
- {
- if (Vehicle* vehicle = vehicleCreature->GetVehicleKit())
- {
- vehicle->RemoveAllPassengers();
- vehicleCreature->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE);
- vehicleCreature->DespawnOrUnsummon(5 * MINUTE * IN_MILLISECONDS);
- }
- }
- }
- }
+ _events.ScheduleEvent(EVENT_DESPAWN_LEVIATHAN_VEHICLES, 5 * IN_MILLISECONDS);
break;
case BOSS_IGNIS:
case BOSS_RAZORSCALE:
@@ -1164,6 +1149,22 @@ class instance_ulduar : public InstanceMapScript
algalon->AI()->DoAction(EVENT_DESPAWN_ALGALON);
}
break;
+ case EVENT_DESPAWN_LEVIATHAN_VEHICLES:
+ // Eject all players from vehicles and make them untargetable.
+ // They will be despawned after a while
+ for (auto const& vehicleGuid : LeviathanVehicleGUIDs)
+ {
+ if (Creature* vehicleCreature = instance->GetCreature(vehicleGuid))
+ {
+ if (Vehicle* vehicle = vehicleCreature->GetVehicleKit())
+ {
+ vehicle->RemoveAllPassengers();
+ vehicleCreature->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE);
+ vehicleCreature->DespawnOrUnsummon(5 * MINUTE * IN_MILLISECONDS);
+ }
+ }
+ }
+ break;
}
}
}
diff --git a/src/server/scripts/Northrend/Ulduar/Ulduar/ulduar.h b/src/server/scripts/Northrend/Ulduar/Ulduar/ulduar.h
index d40fb698658..2d10ffc01bc 100644
--- a/src/server/scripts/Northrend/Ulduar/Ulduar/ulduar.h
+++ b/src/server/scripts/Northrend/Ulduar/Ulduar/ulduar.h
@@ -404,6 +404,7 @@ enum UlduarEvents
EVENT_DESPAWN_ALGALON = 1,
EVENT_UPDATE_ALGALON_TIMER = 2,
ACTION_INIT_ALGALON = 6,
+ EVENT_DESPAWN_LEVIATHAN_VEHICLES = 7
};
enum YoggSaronIllusions
diff --git a/src/server/scripts/Northrend/VioletHold/boss_ichoron.cpp b/src/server/scripts/Northrend/VioletHold/boss_ichoron.cpp
index 137f63a381d..cfdacb10896 100644
--- a/src/server/scripts/Northrend/VioletHold/boss_ichoron.cpp
+++ b/src/server/scripts/Northrend/VioletHold/boss_ichoron.cpp
@@ -489,7 +489,7 @@ public:
// on retail spell casted on a creature's death are not casted after death but keeping mob at 1 health, casting it and then letting the mob die.
// this feature should be still implemented
- void DamageTaken(Unit* attacker, uint32 &damage) override
+ void DamageTaken(Unit* /*attacker*/, uint32 &damage) override
{
int32 actualHp = me->GetHealth();
actualHp -= damage;
diff --git a/src/server/scripts/Outland/BlackTemple/boss_warlord_najentus.cpp b/src/server/scripts/Outland/BlackTemple/boss_warlord_najentus.cpp
index 61b202fcfeb..0bc6a4f49a4 100644
--- a/src/server/scripts/Outland/BlackTemple/boss_warlord_najentus.cpp
+++ b/src/server/scripts/Outland/BlackTemple/boss_warlord_najentus.cpp
@@ -1,215 +1,215 @@
-/*
- * Copyright (C) 2008-2015 TrinityCore <http://www.trinitycore.org/>
- *
- * This program is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License as published by the
- * Free Software Foundation; either version 2 of the License, or (at your
- * option) any later version.
- *
- * This program is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
- * more details.
- *
- * You should have received a copy of the GNU General Public License along
- * with this program. If not, see <http://www.gnu.org/licenses/>.
- */
-
-#include "ScriptMgr.h"
-#include "ScriptedCreature.h"
-#include "black_temple.h"
-#include "Player.h"
-#include "SpellInfo.h"
-
-enum Texts
-{
- SAY_AGGRO = 0,
- SAY_NEEDLE = 1,
- SAY_SLAY = 2,
- SAY_SPECIAL = 3,
- SAY_ENRAGE = 4,
- SAY_DEATH = 5
-};
-
-enum Spells
-{
- SPELL_NEEDLE_SPINE = 39992,
- SPELL_TIDAL_BURST = 39878,
- SPELL_TIDAL_SHIELD = 39872,
- SPELL_IMPALING_SPINE = 39837,
- SPELL_CREATE_NAJENTUS_SPINE = 39956,
- SPELL_HURL_SPINE = 39948,
- SPELL_BERSERK = 26662
-
-};
-
-enum Events
-{
- EVENT_BERSERK = 1,
- EVENT_YELL = 2,
- EVENT_NEEDLE = 3,
- EVENT_SPINE = 4,
- EVENT_SHIELD = 5
-};
-
-enum EventGroups
-{
- GCD_CAST = 1,
- GCD_YELL = 2
-};
-
-class boss_najentus : public CreatureScript
-{
-public:
- boss_najentus() : CreatureScript("boss_najentus") { }
-
- struct boss_najentusAI : public BossAI
- {
- boss_najentusAI(Creature* creature) : BossAI(creature, DATA_HIGH_WARLORD_NAJENTUS)
- {
- }
-
- void Reset() override
- {
- _Reset();
- SpineTargetGUID.Clear();
- }
-
- void KilledUnit(Unit* /*victim*/) override
- {
- Talk(SAY_SLAY);
- events.DelayEvents(5000, GCD_YELL);
- }
-
- void JustDied(Unit* /*killer*/) override
- {
- _JustDied();
- Talk(SAY_DEATH);
- }
-
- void SpellHit(Unit* /*caster*/, const SpellInfo* spell) override
- {
- if (spell->Id == SPELL_HURL_SPINE && me->HasAura(SPELL_TIDAL_SHIELD))
- {
- me->RemoveAurasDueToSpell(SPELL_TIDAL_SHIELD);
- DoCast(me, SPELL_TIDAL_BURST, true);
- ResetTimer();
- }
- }
-
- void EnterCombat(Unit* /*who*/) override
- {
- _EnterCombat();
- Talk(SAY_AGGRO);
- events.ScheduleEvent(EVENT_BERSERK, 480000, GCD_CAST);
- events.ScheduleEvent(EVENT_YELL, 45000 + (rand32() % 76) * 1000, GCD_YELL);
- ResetTimer();
- }
-
- bool RemoveImpalingSpine()
- {
- if (!SpineTargetGUID)
- return false;
-
- Unit* target = ObjectAccessor::GetUnit(*me, SpineTargetGUID);
- if (target && target->HasAura(SPELL_IMPALING_SPINE))
- target->RemoveAurasDueToSpell(SPELL_IMPALING_SPINE);
- SpineTargetGUID.Clear();
- return true;
- }
-
- void ResetTimer(uint32 inc = 0)
- {
- events.RescheduleEvent(EVENT_NEEDLE, 10000 + inc, GCD_CAST);
- events.RescheduleEvent(EVENT_SPINE, 20000 + inc, GCD_CAST);
- events.RescheduleEvent(EVENT_SHIELD, 60000 + inc);
- }
-
- void ExecuteEvent(uint32 eventId) override
- {
- switch (eventId)
- {
- case EVENT_SHIELD:
- DoCast(me, SPELL_TIDAL_SHIELD, true);
- ResetTimer(45000);
- break;
- case EVENT_BERSERK:
- Talk(SAY_ENRAGE);
- DoCast(me, SPELL_BERSERK, true);
- events.DelayEvents(15000, GCD_YELL);
- break;
- case EVENT_SPINE:
- {
- Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 1);
-
- if (!target)
- target = me->GetVictim();
-
- if (target)
- {
- DoCast(target, SPELL_IMPALING_SPINE, true);
- SpineTargetGUID = target->GetGUID();
- //must let target summon, otherwise you cannot click the spine
- target->SummonGameObject(GO_NAJENTUS_SPINE, target->GetPositionX(), target->GetPositionY(), target->GetPositionZ(), me->GetOrientation(), 0, 0, 0, 0, 30);
- Talk(SAY_NEEDLE);
- events.DelayEvents(1500, GCD_CAST);
- events.DelayEvents(15000, GCD_YELL);
- }
- events.ScheduleEvent(EVENT_SPINE, 21000, GCD_CAST);
- return;
- }
- case EVENT_NEEDLE:
- {
- //DoCast(me, SPELL_NEEDLE_SPINE, true);
- std::list<Unit*> targets;
- SelectTargetList(targets, 3, SELECT_TARGET_RANDOM, 80, true);
- for (std::list<Unit*>::const_iterator i = targets.begin(); i != targets.end(); ++i)
- DoCast(*i, 39835, true);
- events.ScheduleEvent(EVENT_NEEDLE, urand(15000, 25000), GCD_CAST);
- events.DelayEvents(1500, GCD_CAST);
- return;
- }
- case EVENT_YELL:
- Talk(SAY_SPECIAL);
- events.ScheduleEvent(EVENT_YELL, urand(25000, 100000), GCD_YELL);
- events.DelayEvents(15000, GCD_YELL);
- break;
- default:
- break;
- }
- }
-
- private:
- ObjectGuid SpineTargetGUID;
- };
-
- CreatureAI* GetAI(Creature* creature) const override
- {
- return GetBlackTempleAI<boss_najentusAI>(creature);
- }
-};
-
-class go_najentus_spine : public GameObjectScript
-{
-public:
- go_najentus_spine() : GameObjectScript("go_najentus_spine") { }
-
- bool OnGossipHello(Player* player, GameObject* go) override
- {
- if (InstanceScript* instance = go->GetInstanceScript())
- if (Creature* Najentus = ObjectAccessor::GetCreature(*go, instance->GetGuidData(DATA_HIGH_WARLORD_NAJENTUS)))
- if (ENSURE_AI(boss_najentus::boss_najentusAI, Najentus->AI())->RemoveImpalingSpine())
- {
- player->CastSpell(player, SPELL_CREATE_NAJENTUS_SPINE, true);
- go->Delete();
- }
- return true;
- }
-
-};
-
-void AddSC_boss_najentus()
-{
- new boss_najentus();
- new go_najentus_spine();
-}
+/*
+ * Copyright (C) 2008-2015 TrinityCore <http://www.trinitycore.org/>
+ *
+ * This program is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License as published by the
+ * Free Software Foundation; either version 2 of the License, or (at your
+ * option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
+ * more details.
+ *
+ * You should have received a copy of the GNU General Public License along
+ * with this program. If not, see <http://www.gnu.org/licenses/>.
+ */
+
+#include "ScriptMgr.h"
+#include "ScriptedCreature.h"
+#include "black_temple.h"
+#include "Player.h"
+#include "SpellInfo.h"
+
+enum Texts
+{
+ SAY_AGGRO = 0,
+ SAY_NEEDLE = 1,
+ SAY_SLAY = 2,
+ SAY_SPECIAL = 3,
+ SAY_ENRAGE = 4,
+ SAY_DEATH = 5
+};
+
+enum Spells
+{
+ SPELL_NEEDLE_SPINE = 39992,
+ SPELL_TIDAL_BURST = 39878,
+ SPELL_TIDAL_SHIELD = 39872,
+ SPELL_IMPALING_SPINE = 39837,
+ SPELL_CREATE_NAJENTUS_SPINE = 39956,
+ SPELL_HURL_SPINE = 39948,
+ SPELL_BERSERK = 26662
+
+};
+
+enum Events
+{
+ EVENT_BERSERK = 1,
+ EVENT_YELL = 2,
+ EVENT_NEEDLE = 3,
+ EVENT_SPINE = 4,
+ EVENT_SHIELD = 5
+};
+
+enum EventGroups
+{
+ GCD_CAST = 1,
+ GCD_YELL = 2
+};
+
+class boss_najentus : public CreatureScript
+{
+public:
+ boss_najentus() : CreatureScript("boss_najentus") { }
+
+ struct boss_najentusAI : public BossAI
+ {
+ boss_najentusAI(Creature* creature) : BossAI(creature, DATA_HIGH_WARLORD_NAJENTUS)
+ {
+ }
+
+ void Reset() override
+ {
+ _Reset();
+ SpineTargetGUID.Clear();
+ }
+
+ void KilledUnit(Unit* /*victim*/) override
+ {
+ Talk(SAY_SLAY);
+ events.DelayEvents(5000, GCD_YELL);
+ }
+
+ void JustDied(Unit* /*killer*/) override
+ {
+ _JustDied();
+ Talk(SAY_DEATH);
+ }
+
+ void SpellHit(Unit* /*caster*/, const SpellInfo* spell) override
+ {
+ if (spell->Id == SPELL_HURL_SPINE && me->HasAura(SPELL_TIDAL_SHIELD))
+ {
+ me->RemoveAurasDueToSpell(SPELL_TIDAL_SHIELD);
+ DoCast(me, SPELL_TIDAL_BURST, true);
+ ResetTimer();
+ }
+ }
+
+ void EnterCombat(Unit* /*who*/) override
+ {
+ _EnterCombat();
+ Talk(SAY_AGGRO);
+ events.ScheduleEvent(EVENT_BERSERK, 480000, GCD_CAST);
+ events.ScheduleEvent(EVENT_YELL, 45000 + (rand32() % 76) * 1000, GCD_YELL);
+ ResetTimer();
+ }
+
+ bool RemoveImpalingSpine()
+ {
+ if (!SpineTargetGUID)
+ return false;
+
+ Unit* target = ObjectAccessor::GetUnit(*me, SpineTargetGUID);
+ if (target && target->HasAura(SPELL_IMPALING_SPINE))
+ target->RemoveAurasDueToSpell(SPELL_IMPALING_SPINE);
+ SpineTargetGUID.Clear();
+ return true;
+ }
+
+ void ResetTimer(uint32 inc = 0)
+ {
+ events.RescheduleEvent(EVENT_NEEDLE, 10000 + inc, GCD_CAST);
+ events.RescheduleEvent(EVENT_SPINE, 20000 + inc, GCD_CAST);
+ events.RescheduleEvent(EVENT_SHIELD, 60000 + inc);
+ }
+
+ void ExecuteEvent(uint32 eventId) override
+ {
+ switch (eventId)
+ {
+ case EVENT_SHIELD:
+ DoCast(me, SPELL_TIDAL_SHIELD, true);
+ ResetTimer(45000);
+ break;
+ case EVENT_BERSERK:
+ Talk(SAY_ENRAGE);
+ DoCast(me, SPELL_BERSERK, true);
+ events.DelayEvents(15000, GCD_YELL);
+ break;
+ case EVENT_SPINE:
+ {
+ Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 1);
+
+ if (!target)
+ target = me->GetVictim();
+
+ if (target)
+ {
+ DoCast(target, SPELL_IMPALING_SPINE, true);
+ SpineTargetGUID = target->GetGUID();
+ //must let target summon, otherwise you cannot click the spine
+ target->SummonGameObject(GO_NAJENTUS_SPINE, target->GetPositionX(), target->GetPositionY(), target->GetPositionZ(), me->GetOrientation(), 0, 0, 0, 0, 30);
+ Talk(SAY_NEEDLE);
+ events.DelayEvents(1500, GCD_CAST);
+ events.DelayEvents(15000, GCD_YELL);
+ }
+ events.ScheduleEvent(EVENT_SPINE, 21000, GCD_CAST);
+ return;
+ }
+ case EVENT_NEEDLE:
+ {
+ //DoCast(me, SPELL_NEEDLE_SPINE, true);
+ std::list<Unit*> targets;
+ SelectTargetList(targets, 3, SELECT_TARGET_RANDOM, 80, true);
+ for (std::list<Unit*>::const_iterator i = targets.begin(); i != targets.end(); ++i)
+ DoCast(*i, 39835, true);
+ events.ScheduleEvent(EVENT_NEEDLE, urand(15000, 25000), GCD_CAST);
+ events.DelayEvents(1500, GCD_CAST);
+ return;
+ }
+ case EVENT_YELL:
+ Talk(SAY_SPECIAL);
+ events.ScheduleEvent(EVENT_YELL, urand(25000, 100000), GCD_YELL);
+ events.DelayEvents(15000, GCD_YELL);
+ break;
+ default:
+ break;
+ }
+ }
+
+ private:
+ ObjectGuid SpineTargetGUID;
+ };
+
+ CreatureAI* GetAI(Creature* creature) const override
+ {
+ return GetBlackTempleAI<boss_najentusAI>(creature);
+ }
+};
+
+class go_najentus_spine : public GameObjectScript
+{
+public:
+ go_najentus_spine() : GameObjectScript("go_najentus_spine") { }
+
+ bool OnGossipHello(Player* player, GameObject* go) override
+ {
+ if (InstanceScript* instance = go->GetInstanceScript())
+ if (Creature* Najentus = ObjectAccessor::GetCreature(*go, instance->GetGuidData(DATA_HIGH_WARLORD_NAJENTUS)))
+ if (ENSURE_AI(boss_najentus::boss_najentusAI, Najentus->AI())->RemoveImpalingSpine())
+ {
+ player->CastSpell(player, SPELL_CREATE_NAJENTUS_SPINE, true);
+ go->Delete();
+ }
+ return true;
+ }
+
+};
+
+void AddSC_boss_najentus()
+{
+ new boss_najentus();
+ new go_najentus_spine();
+}
diff --git a/src/server/scripts/Spells/spell_quest.cpp b/src/server/scripts/Spells/spell_quest.cpp
index 60ff67d74c0..8af97e46dee 100644
--- a/src/server/scripts/Spells/spell_quest.cpp
+++ b/src/server/scripts/Spells/spell_quest.cpp
@@ -2453,6 +2453,35 @@ class spell_q12414_hand_over_reins : public SpellScriptLoader
}
};
+// 13790 13793 13811 13814 - Among the Champions
+// 13665 13745 13750 13756 13761 13767 13772 13777 13782 13787 - The Grand Melee
+class spell_q13665_q13790_bested_trigger : public SpellScriptLoader
+{
+ public:
+ spell_q13665_q13790_bested_trigger() : SpellScriptLoader("spell_q13665_q13790_bested_trigger") { }
+
+ class spell_q13665_q13790_bested_trigger_SpellScript : public SpellScript
+ {
+ PrepareSpellScript(spell_q13665_q13790_bested_trigger_SpellScript);
+
+ void HandleScript(SpellEffIndex /*effIndex*/)
+ {
+ Unit* target = GetHitUnit()->GetCharmerOrOwnerOrSelf();
+ target->CastSpell(target, uint32(GetEffectValue()));
+ }
+
+ void Register() override
+ {
+ OnEffectHitTarget += SpellEffectFn(spell_q13665_q13790_bested_trigger_SpellScript::HandleScript, EFFECT_0, SPELL_EFFECT_SCRIPT_EFFECT);
+ }
+ };
+
+ SpellScript* GetSpellScript() const override
+ {
+ return new spell_q13665_q13790_bested_trigger_SpellScript();
+ }
+};
+
void AddSC_quest_spell_scripts()
{
new spell_q55_sacred_cleansing();
@@ -2512,4 +2541,5 @@ void AddSC_quest_spell_scripts()
new spell_q14100_q14111_make_player_destroy_totems();
new spell_q10929_fumping();
new spell_q12414_hand_over_reins();
+ new spell_q13665_q13790_bested_trigger();
}
diff --git a/src/server/shared/Database/Implementation/WorldDatabase.cpp b/src/server/shared/Database/Implementation/WorldDatabase.cpp
index 4532f87d406..d9aad94293e 100644
--- a/src/server/shared/Database/Implementation/WorldDatabase.cpp
+++ b/src/server/shared/Database/Implementation/WorldDatabase.cpp
@@ -76,7 +76,7 @@ void WorldDatabaseConnection::DoPrepareStatements()
PrepareStatement(WORLD_SEL_WAYPOINT_SCRIPT_ID_BY_GUID, "SELECT id FROM waypoint_scripts WHERE guid = ?", CONNECTION_SYNCH);
PrepareStatement(WORLD_DEL_CREATURE, "DELETE FROM creature WHERE guid = ?", CONNECTION_ASYNC);
PrepareStatement(WORLD_SEL_COMMANDS, "SELECT name, permission, help FROM command", CONNECTION_SYNCH);
- PrepareStatement(WORLD_SEL_CREATURE_TEMPLATE, "SELECT entry, difficulty_entry_1, difficulty_entry_2, difficulty_entry_3, KillCredit1, KillCredit2, modelid1, modelid2, modelid3, modelid4, name, subname, IconName, gossip_menu_id, minlevel, maxlevel, exp, faction, npcflag, speed_walk, speed_run, scale, rank, dmgschool, BaseAttackTime, RangeAttackTime, BaseVariance, RangeVariance, unit_class, unit_flags, unit_flags2, dynamicflags, family, trainer_type, trainer_spell, trainer_class, trainer_race, type, type_flags, lootid, pickpocketloot, skinloot, resistance1, resistance2, resistance3, resistance4, resistance5, resistance6, spell1, spell2, spell3, spell4, spell5, spell6, spell7, spell8, PetSpellDataId, VehicleId, mingold, maxgold, AIName, MovementType, InhabitType, HoverHeight, HealthModifier, ManaModifier, ArmorModifier, DamageModifier, ExperienceModifier, RacialLeader, questItem1, questItem2, questItem3, questItem4, questItem5, questItem6, movementId, RegenHealth, mechanic_immune_mask, flags_extra, ScriptName FROM creature_template WHERE entry = ?", CONNECTION_SYNCH);
+ PrepareStatement(WORLD_SEL_CREATURE_TEMPLATE, "SELECT entry, difficulty_entry_1, difficulty_entry_2, difficulty_entry_3, KillCredit1, KillCredit2, modelid1, modelid2, modelid3, modelid4, name, subname, IconName, gossip_menu_id, minlevel, maxlevel, exp, faction, npcflag, speed_walk, speed_run, scale, rank, dmgschool, BaseAttackTime, RangeAttackTime, BaseVariance, RangeVariance, unit_class, unit_flags, unit_flags2, dynamicflags, family, trainer_type, trainer_spell, trainer_class, trainer_race, type, type_flags, lootid, pickpocketloot, skinloot, resistance1, resistance2, resistance3, resistance4, resistance5, resistance6, spell1, spell2, spell3, spell4, spell5, spell6, spell7, spell8, PetSpellDataId, VehicleId, mingold, maxgold, AIName, MovementType, InhabitType, HoverHeight, HealthModifier, ManaModifier, ArmorModifier, DamageModifier, ExperienceModifier, RacialLeader, movementId, RegenHealth, mechanic_immune_mask, flags_extra, ScriptName FROM creature_template WHERE entry = ?", CONNECTION_SYNCH);
PrepareStatement(WORLD_SEL_WAYPOINT_SCRIPT_BY_ID, "SELECT guid, delay, command, datalong, datalong2, dataint, x, y, z, o FROM waypoint_scripts WHERE id = ?", CONNECTION_SYNCH);
PrepareStatement(WORLD_SEL_ITEM_TEMPLATE_BY_NAME, "SELECT entry FROM item_template WHERE name = ?", CONNECTION_SYNCH);
PrepareStatement(WORLD_SEL_CREATURE_BY_ID, "SELECT guid FROM creature WHERE id = ?", CONNECTION_SYNCH);
diff --git a/src/server/shared/Packets/ByteBuffer.h b/src/server/shared/Packets/ByteBuffer.h
index 3dd396d4bc0..083f1d6e329 100644
--- a/src/server/shared/Packets/ByteBuffer.h
+++ b/src/server/shared/Packets/ByteBuffer.h
@@ -393,7 +393,7 @@ class ByteBuffer
lt.tm_mon = (packedDate >> 20) & 0xF;
lt.tm_year = ((packedDate >> 24) & 0x1F) + 100;
- return uint32(mktime(&lt) + timezone);
+ return uint32(mktime(&lt));
}
ByteBuffer& ReadPackedTime(uint32& time)
diff --git a/src/server/shared/Updater/DBUpdater.cpp b/src/server/shared/Updater/DBUpdater.cpp
index fd91e94b78f..7b39062222e 100644
--- a/src/server/shared/Updater/DBUpdater.cpp
+++ b/src/server/shared/Updater/DBUpdater.cpp
@@ -351,7 +351,9 @@ void DBUpdater<T>::ApplyFile(DatabaseWorkerPool<T>& pool, std::string const& hos
// CLI Client connection info
args.push_back("-h" + host);
args.push_back("-u" + user);
- args.push_back("-p" + password);
+
+ if (!password.empty())
+ args.push_back("-p" + password);
// Check if we want to connect through ip or socket (Unix only)
#ifdef _WIN32
diff --git a/src/server/shared/Utilities/TaskScheduler.cpp b/src/server/shared/Utilities/TaskScheduler.cpp
index 04a4071d1f5..801cc96cf77 100644
--- a/src/server/shared/Utilities/TaskScheduler.cpp
+++ b/src/server/shared/Utilities/TaskScheduler.cpp
@@ -89,9 +89,6 @@ void TaskScheduler::Dispatch(success_t const& callback)
return;
}
- if (_task_holder.IsEmpty())
- return;
-
while (!_task_holder.IsEmpty())
{
if (_task_holder.First()->_end > _now)
diff --git a/src/server/worldserver/Main.cpp b/src/server/worldserver/Main.cpp
index 430c3ce4d73..b3d97d7884c 100644
--- a/src/server/worldserver/Main.cpp
+++ b/src/server/worldserver/Main.cpp
@@ -100,8 +100,8 @@ extern int main(int argc, char** argv)
std::string configService;
auto vm = GetConsoleArguments(argc, argv, configFile, configService);
- // exit if help is enabled
- if (vm.count("help"))
+ // exit if help or version is enabled
+ if (vm.count("help") || vm.count("version"))
return 0;
#ifdef _WIN32
@@ -511,6 +511,7 @@ variables_map GetConsoleArguments(int argc, char** argv, std::string& configFile
options_description all("Allowed options");
all.add_options()
("help,h", "print usage message")
+ ("version,v", "print version build info")
("config,c", value<std::string>(&configFile)->default_value(_TRINITY_CORE_CONFIG), "use <arg> as configuration file")
;
#ifdef _WIN32
@@ -534,6 +535,10 @@ variables_map GetConsoleArguments(int argc, char** argv, std::string& configFile
if (vm.count("help")) {
std::cout << all << "\n";
}
+ else if (vm.count("version"))
+ {
+ std::cout << _FULLVERSION << "\n";
+ }
return vm;
}