Core/Player: Added support cast spell for some class spells (Warlock / Hunter pet, "Battle Stance" and "Frost Presence") on first login...

This commit is contained in:
Vincent-Michael
2014-07-09 20:34:39 +02:00
parent 6a6403a54e
commit c8eb69df10
5 changed files with 88 additions and 20 deletions
@@ -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;
@@ -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');
+1
View File
@@ -407,6 +407,7 @@ struct PlayerInfo
uint16 displayId_f;
PlayerCreateInfoItems item;
PlayerCreateInfoSpells customSpells;
PlayerCreateInfoSpells castSpells;
PlayerCreateInfoActions action;
PlayerCreateInfoSkills skills;
+55
View File
@@ -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...");
{
+3 -20
View File
@@ -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.