Core/Pets: fixed order of pet action bar spells

*fixed stable master script
This commit is contained in:
Ovalord
2018-01-07 21:16:38 +01:00
parent c08f1c57c2
commit fb3b62ca5b
2 changed files with 49 additions and 39 deletions

View File

@@ -1313,6 +1313,10 @@ bool Pet::addSpell(uint32 spellId, ActiveStates active /*= ACT_DECIDE*/, PetSpel
return false;
}
// SPELL_ATTR4_UNK15 = DO NOT ADD SPELL TO SPELLBOOK OR ACTIONBAR
if (spellInfo->AttributesEx4 & SPELL_ATTR4_UNK15)
return false;
PetSpellMap::iterator itr = m_spells.find(spellId);
if (itr != m_spells.end())
{
@@ -1404,7 +1408,7 @@ bool Pet::addSpell(uint32 spellId, ActiveStates active /*= ACT_DECIDE*/, PetSpel
if (spellInfo->IsPassive() && (!spellInfo->CasterAuraState || HasAuraState(AuraStateType(spellInfo->CasterAuraState))))
CastSpell(this, spellId, true);
else if (!(spellInfo->AttributesEx4 & SPELL_ATTR4_UNK15)) // This attribute seems to be responsible to block transform related spells
else
m_charmInfo->AddSpellToActionBar(spellInfo);
if (newspell.active == ACT_ENABLED)
@@ -1428,7 +1432,7 @@ bool Pet::learnSpell(uint32 spell_id)
if (!addSpell(spell_id))
return false;
if (!m_loading)
if (!m_loading && getPetType() != SUMMON_PET)
{
WorldPacket data(SMSG_PET_LEARNED_SPELL, 4);
data << uint32(spell_id);
@@ -1444,8 +1448,8 @@ void Pet::InitLevelupSpellsForLevel()
if (PetLevelupSpellSet const* levelupSpells = GetCreatureTemplate()->family ? sSpellMgr->GetPetLevelupSpellList(GetCreatureTemplate()->family) : NULL)
{
// PetLevelupSpellSet ordered by levels, process in reversed order
for (PetLevelupSpellSet::const_reverse_iterator itr = levelupSpells->rbegin(); itr != levelupSpells->rend(); ++itr)
// PetLevelupSpellSet ordered by levels
for (PetLevelupSpellSet::const_iterator itr = levelupSpells->begin(); itr != levelupSpells->end(); ++itr)
{
// will called first if level down
if (itr->first > level)
@@ -1481,7 +1485,7 @@ bool Pet::unlearnSpell(uint32 spell_id, bool learn_prev, bool clear_ab)
{
if (removeSpell(spell_id, learn_prev, clear_ab))
{
if (!m_loading)
if (!m_loading && getPetType() != SUMMON_PET)
{
WorldPacket data(SMSG_PET_REMOVED_SPELL, 4);
data << uint32(spell_id);

View File

@@ -2551,6 +2551,9 @@ enum StableMasters
SPELL_CHIKEN = 54677,
SPELL_WOLPERTINGER = 54688,
NPC_TEXT_STABLE_MASTER_HUNTER = 13557,
NPC_TEXT_STABLE_MASTER_OTHER = 13584,
GOSSIP_MENU_STABLE_MASTER = 9821,
STABLE_MASTER_GOSSIP_SUB_MENU = 9820
};
@@ -2559,46 +2562,49 @@ class npc_stable_master : public CreatureScript
public:
npc_stable_master() : CreatureScript("npc_stable_master") { }
struct npc_stable_masterAI : public SmartAI
struct npc_stable_masterAI : public ScriptedAI
{
npc_stable_masterAI(Creature* creature) : SmartAI(creature) { }
npc_stable_masterAI(Creature* creature) : ScriptedAI(creature) { }
bool GossipSelect(Player* player, uint32 menuId, uint32 gossipListId) override
{
player->GetSession()->SendStablePet(me->GetGUID());
SmartAI::GossipSelect(player, menuId, gossipListId);
if (menuId != STABLE_MASTER_GOSSIP_SUB_MENU)
return true;
switch (gossipListId)
if (menuId == STABLE_MASTER_GOSSIP_SUB_MENU)
{
case 0:
player->CastSpell(player, SPELL_MINIWING, false);
break;
case 1:
player->CastSpell(player, SPELL_JUBLING, false);
break;
case 2:
player->CastSpell(player, SPELL_DARTER, false);
break;
case 3:
player->CastSpell(player, SPELL_WORG, false);
break;
case 4:
player->CastSpell(player, SPELL_SMOLDERWEB, false);
break;
case 5:
player->CastSpell(player, SPELL_CHIKEN, false);
break;
case 6:
player->CastSpell(player, SPELL_WOLPERTINGER, false);
break;
default:
return false;
switch (gossipListId)
{
case 0:
player->CastSpell(player, SPELL_MINIWING, false);
break;
case 1:
player->CastSpell(player, SPELL_JUBLING, false);
break;
case 2:
player->CastSpell(player, SPELL_DARTER, false);
break;
case 3:
player->CastSpell(player, SPELL_WORG, false);
break;
case 4:
player->CastSpell(player, SPELL_SMOLDERWEB, false);
break;
case 5:
player->CastSpell(player, SPELL_CHIKEN, false);
break;
case 6:
player->CastSpell(player, SPELL_WOLPERTINGER, false);
break;
default:
return false;
}
}
else
{
if (gossipListId == 0)
{
player->GetSession()->SendStablePet(me->GetGUID());
player->PlayerTalkClass->SendCloseGossip();
}
}
player->PlayerTalkClass->SendCloseGossip();
return false;
}
};