aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorVincent-Michael <Vincent_Michael@gmx.de>2014-07-09 20:34:39 +0200
committerVincent-Michael <Vincent_Michael@gmx.de>2014-07-09 20:34:39 +0200
commitc8eb69df10b36d19a77743a037e700b001c8ed77 (patch)
tree08bc1cfc49840d9e564ae29bc8dd70a42bdb277e
parent6a6403a54e26b13b483f058709a48404a17e6b8b (diff)
Core/Player: Added support cast spell for some class spells (Warlock / Hunter pet, "Battle Stance" and "Frost Presence") on first login...
-rw-r--r--sql/updates/world/2014_07_09_00_world_playercreateinfo_cast_spell_434.sql7
-rw-r--r--sql/updates/world/2014_07_09_01_world_playercreateinfo_cast_spell_434.sql22
-rw-r--r--src/server/game/Entities/Player/Player.h1
-rw-r--r--src/server/game/Globals/ObjectMgr.cpp55
-rw-r--r--src/server/game/Handlers/CharacterHandler.cpp23
5 files changed, 88 insertions, 20 deletions
diff --git a/sql/updates/world/2014_07_09_00_world_playercreateinfo_cast_spell_434.sql b/sql/updates/world/2014_07_09_00_world_playercreateinfo_cast_spell_434.sql
new file mode 100644
index 00000000000..708a16d8149
--- /dev/null
+++ b/sql/updates/world/2014_07_09_00_world_playercreateinfo_cast_spell_434.sql
@@ -0,0 +1,7 @@
+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;
diff --git a/sql/updates/world/2014_07_09_01_world_playercreateinfo_cast_spell_434.sql b/sql/updates/world/2014_07_09_01_world_playercreateinfo_cast_spell_434.sql
new file mode 100644
index 00000000000..61c240dc0b6
--- /dev/null
+++ b/sql/updates/world/2014_07_09_01_world_playercreateinfo_cast_spell_434.sql
@@ -0,0 +1,22 @@
+DELETE FROM `playercreateinfo_cast_spell` WHERE `spell` IN (48266, 79597, 79598, 79593, 79602, 79600, 79603, 79599, 79595, 79594, 79601, 79596, 2457, 688, 73523);
+INSERT INTO `playercreateinfo_cast_spell` (`racemask`, `classmask`, `spell`, `note`) VALUES
+-- Death Knight
+(0, 32, 48266, 'Death Knight - Blood Presence'),
+-- Hunter
+(1, 4, 79597, 'Human - Hunter - Young Wolf'),
+(2, 4, 79598, 'Orc - Hunter - Young Boar'),
+(4, 4, 79593, 'Dwarf - Hunter - Young Bear'),
+(8, 4, 79602, 'Night Elf - Hunter - Young Cat'),
+(16, 4, 79600, 'Undead - Hunter - Young Widow'),
+(32, 4, 79603, 'Tauren - Hunter - Young Tallstrider'),
+(128, 4, 79599, 'Troll - Hunter - Young Raptor'),
+(256, 4, 79595, 'Goblin - Hunter - Young Crab'),
+(512, 4, 79594, 'Blood Elf - Hunter - Young Dragonhawk'),
+(1024, 4, 79601, 'Draenei - Hunter - Young Moth'),
+(2097152, 4, 79596, 'Worgen - Hunter - Young Mastiff'),
+-- Warrior
+(0, 1, 2457, 'Warrior - Battle Stance'),
+-- Warlock
+(0, 256, 688, 'Warlock - Summon Imp'),
+-- Quest
+(16, 0, 73523, 'Undead - Rigor Mortis');
diff --git a/src/server/game/Entities/Player/Player.h b/src/server/game/Entities/Player/Player.h
index 243ba8e725f..302cb058851 100644
--- a/src/server/game/Entities/Player/Player.h
+++ b/src/server/game/Entities/Player/Player.h
@@ -407,6 +407,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 72621865465..48dc6ae70c5 100644
--- a/src/server/game/Globals/ObjectMgr.cpp
+++ b/src/server/game/Globals/ObjectMgr.cpp
@@ -3387,6 +3387,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 70e01238663..31e46d5abc8 100644
--- a/src/server/game/Handlers/CharacterHandler.cpp
+++ b/src/server/game/Handlers/CharacterHandler.cpp
@@ -1110,26 +1110,9 @@ void WorldSession::HandlePlayerLogin(LoginQueryHolder* holder)
{
pCurrChar->RemoveAtLoginFlag(AT_LOGIN_FIRST);
- if (pCurrChar->getClass() == CLASS_HUNTER)
- {
- static uint32 const HunterCreatePetSpells[MAX_RACES] =
- {
- 0, /* None */ 79597, /* Human - Young Wolf */
- 79598, /* Orc - Young Boar */ 79593, /* Dwarf - Young Bear */
- 79602, /* Night Elf - Young Cat */ 79600, /* Undead - Young Widow */
- 79603, /* Tauren - Young Tallstrider */ 0, /* Gnome */
- 79599, /* Troll - Young Raptor */ 79595, /* Goblin - Young Crab */
- 79594, /* Blood Elf - Young Dragonhawk */ 79601, /* Draenei - Young Moth */
- 0, /* Fel Orc */ 0, /* Naga */
- 0, /* Broken */ 0, /* Skeleton */
- 0, /* Vrykul */ 0, /* Tuskarr */
- 0, /* Forest Troll */ 0, /* Taunka */
- 0, /* Northrend Skeleton */ 0, /* Ice Troll */
- 79596, /* Worgen - Young Mastiff */
- };
-
- pCurrChar->CastSpell(pCurrChar, HunterCreatePetSpells[pCurrChar->getRace()], true);
- }
+ 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.