diff options
| author | Snapper <snapperryen@gmail.com> | 2016-06-04 19:31:29 +0100 |
|---|---|---|
| committer | DDuarte <dnpd.dd@gmail.com> | 2016-06-04 19:31:29 +0100 |
| commit | 30313fba8dbf5dbcdf4e91e1ea179ad1b8c9bdc5 (patch) | |
| tree | 645c2e99c52a32380ce79612781ba43b5e2d2a55 | |
| parent | 8d2ccc4d1a88757e021a02bb2ad24eb828d0a8f7 (diff) | |
Core/Player: Added support cast spell for some class spells
(Warrior's Battle Stance and Death Knight's Blood Presence) on first login.
(cherry-picked from commit c8eb69df10b36d19a77743a037e700b001c8ed77)
Closes #17232
| -rw-r--r-- | sql/updates/world/3.3.5/2016_06_04_01_world.sql | 12 | ||||
| -rw-r--r-- | src/server/game/Entities/Player/Player.h | 1 | ||||
| -rw-r--r-- | src/server/game/Globals/ObjectMgr.cpp | 55 | ||||
| -rw-r--r-- | src/server/game/Handlers/CharacterHandler.cpp | 6 |
4 files changed, 74 insertions, 0 deletions
diff --git a/sql/updates/world/3.3.5/2016_06_04_01_world.sql b/sql/updates/world/3.3.5/2016_06_04_01_world.sql new file mode 100644 index 00000000000..fb048449d40 --- /dev/null +++ b/sql/updates/world/3.3.5/2016_06_04_01_world.sql @@ -0,0 +1,12 @@ +DROP TABLE IF EXISTS `playercreateinfo_cast_spell`; +CREATE TABLE IF NOT EXISTS `playercreateinfo_cast_spell` ( + `raceMask` INT(10) UNSIGNED NOT NULL DEFAULT '0', + `classMask` INT(10) UNSIGNED NOT NULL DEFAULT '0', + `spell` MEDIUMINT(8) UNSIGNED NOT NULL DEFAULT '0', + `note` VARCHAR(255) DEFAULT NULL +) ENGINE=MYISAM DEFAULT CHARSET=utf8; + +DELETE FROM `playercreateinfo_cast_spell` WHERE `spell` IN (48266, 2457); +INSERT INTO `playercreateinfo_cast_spell` (`racemask`, `classmask`, `spell`, `note`) VALUES +(0, 32, 48266, 'Death Knight - Blood Presence'), +(0, 1, 2457, 'Warrior - Battle Stance'); diff --git a/src/server/game/Entities/Player/Player.h b/src/server/game/Entities/Player/Player.h index 6a38cd3b9fe..a31f074e65d 100644 --- a/src/server/game/Entities/Player/Player.h +++ b/src/server/game/Entities/Player/Player.h @@ -269,6 +269,7 @@ struct PlayerInfo uint16 displayId_f; PlayerCreateInfoItems item; PlayerCreateInfoSpells customSpells; + PlayerCreateInfoSpells castSpells; PlayerCreateInfoActions action; PlayerCreateInfoSkills skills; diff --git a/src/server/game/Globals/ObjectMgr.cpp b/src/server/game/Globals/ObjectMgr.cpp index 33a0325851a..73dd7e49f30 100644 --- a/src/server/game/Globals/ObjectMgr.cpp +++ b/src/server/game/Globals/ObjectMgr.cpp @@ -3529,6 +3529,61 @@ void ObjectMgr::LoadPlayerInfo() } } + // Load playercreate cast spell + TC_LOG_INFO("server.loading", "Loading Player Create Cast Spell Data..."); + { + uint32 oldMSTime = getMSTime(); + + QueryResult result = WorldDatabase.PQuery("SELECT raceMask, classMask, spell FROM playercreateinfo_cast_spell"); + + if (!result) + TC_LOG_ERROR("server.loading", ">> Loaded 0 player create cast spells. DB table `playercreateinfo_cast_spell` is empty."); + else + { + uint32 count = 0; + + do + { + Field* fields = result->Fetch(); + uint32 raceMask = fields[0].GetUInt32(); + uint32 classMask = fields[1].GetUInt32(); + uint32 spellId = fields[2].GetUInt32(); + + if (raceMask != 0 && !(raceMask & RACEMASK_ALL_PLAYABLE)) + { + TC_LOG_ERROR("sql.sql", "Wrong race mask %u in `playercreateinfo_cast_spell` table, ignoring.", raceMask); + continue; + } + + if (classMask != 0 && !(classMask & CLASSMASK_ALL_PLAYABLE)) + { + TC_LOG_ERROR("sql.sql", "Wrong class mask %u in `playercreateinfo_cast_spell` table, ignoring.", classMask); + continue; + } + + for (uint32 raceIndex = RACE_HUMAN; raceIndex < MAX_RACES; ++raceIndex) + { + if (raceMask == 0 || ((1 << (raceIndex - 1)) & raceMask)) + { + for (uint32 classIndex = CLASS_WARRIOR; classIndex < MAX_CLASSES; ++classIndex) + { + if (classMask == 0 || ((1 << (classIndex - 1)) & classMask)) + { + if (PlayerInfo* info = _playerInfo[raceIndex][classIndex]) + { + info->castSpells.push_back(spellId); + ++count; + } + } + } + } + } + } while (result->NextRow()); + + TC_LOG_INFO("server.loading", ">> Loaded %u player create cast spells in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); + } + } + // Load playercreate actions TC_LOG_INFO("server.loading", "Loading Player Create Action Data..."); { diff --git a/src/server/game/Handlers/CharacterHandler.cpp b/src/server/game/Handlers/CharacterHandler.cpp index a265b2760f5..786c708da93 100644 --- a/src/server/game/Handlers/CharacterHandler.cpp +++ b/src/server/game/Handlers/CharacterHandler.cpp @@ -970,8 +970,14 @@ void WorldSession::HandlePlayerLogin(LoginQueryHolder* holder) bool firstLogin = pCurrChar->HasAtLoginFlag(AT_LOGIN_FIRST); if (firstLogin) + { pCurrChar->RemoveAtLoginFlag(AT_LOGIN_FIRST); + PlayerInfo const* info = sObjectMgr->GetPlayerInfo(pCurrChar->getRace(), pCurrChar->getClass()); + for (uint32 spellId : info->castSpells) + pCurrChar->CastSpell(pCurrChar, spellId, true); + } + // show time before shutdown if shutdown planned. if (sWorld->IsShuttingDown()) sWorld->ShutdownMsg(true, pCurrChar); |
