mirror of
https://github.com/mangosfour/server.git
synced 2025-12-18 10:37:01 +00:00
[9013] shapeshift spells
some shapeshift forms will give the player spells so we need to tell the server that the player has those new spells else he can't cast them since the server is thinking the player is cheating ps forms with spells: FORM_GHOUL FORM_THARONJA_SKELETON FORM_TEST_OF_STRENGTH FORM_BLB_PLAYER FORM_TEST FORM_ZOMBIE -- so this mostly won't affect any ingame experience.. but good to have this feature anyway.. :) also changed errormessage if player has no reagents for spell.. thx to nofantasy
This commit is contained in:
parent
7c4acf31e2
commit
0502de55af
7 changed files with 33 additions and 12 deletions
|
|
@ -1492,7 +1492,7 @@ struct SpellShapeshiftEntry
|
||||||
uint32 modelID_H; // 24 horde modelid (but only for one form)
|
uint32 modelID_H; // 24 horde modelid (but only for one form)
|
||||||
//uint32 unk3; // 25 unused always 0
|
//uint32 unk3; // 25 unused always 0
|
||||||
//uint32 unk4; // 26 unused always 0
|
//uint32 unk4; // 26 unused always 0
|
||||||
//uint32 spell[8]; // 27-34 unused, spells which appear in the bar after shapeshifting
|
uint32 spellId[8]; // 27-34 spells which appear in the bar after shapeshifting
|
||||||
};
|
};
|
||||||
|
|
||||||
struct SpellDurationEntry
|
struct SpellDurationEntry
|
||||||
|
|
|
||||||
|
|
@ -91,7 +91,7 @@ const char SpellItemEnchantmentConditionfmt[]="nbbbbbxxxxxbbbbbbbbbbiiiiiXXXXX";
|
||||||
const char SpellRadiusfmt[]="nfxf";
|
const char SpellRadiusfmt[]="nfxf";
|
||||||
const char SpellRangefmt[]="nffffxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx";
|
const char SpellRangefmt[]="nffffxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx";
|
||||||
const char SpellRuneCostfmt[]="niiii";
|
const char SpellRuneCostfmt[]="niiii";
|
||||||
const char SpellShapeshiftfmt[]="nxxxxxxxxxxxxxxxxxxiixiiixxxxxxxxxx";
|
const char SpellShapeshiftfmt[]="nxxxxxxxxxxxxxxxxxxiixiiixxiiiiiiii";
|
||||||
const char StableSlotPricesfmt[] = "ni";
|
const char StableSlotPricesfmt[] = "ni";
|
||||||
const char SummonPropertiesfmt[] = "niiiii";
|
const char SummonPropertiesfmt[] = "niiiii";
|
||||||
const char TalentEntryfmt[]="niiiiiiiixxxxixxixxxxxx";
|
const char TalentEntryfmt[]="niiiiiiiixxxxixxixxxxxx";
|
||||||
|
|
|
||||||
|
|
@ -3188,7 +3188,7 @@ void Player::learnSpell(uint32 spell_id, bool dependent)
|
||||||
GetSession()->SendPacket(&data);
|
GetSession()->SendPacket(&data);
|
||||||
}
|
}
|
||||||
|
|
||||||
void Player::removeSpell(uint32 spell_id, bool disabled, bool learn_low_rank)
|
void Player::removeSpell(uint32 spell_id, bool disabled, bool learn_low_rank, bool sendUpdate)
|
||||||
{
|
{
|
||||||
PlayerSpellMap::iterator itr = m_spells.find(spell_id);
|
PlayerSpellMap::iterator itr = m_spells.find(spell_id);
|
||||||
if (itr == m_spells.end())
|
if (itr == m_spells.end())
|
||||||
|
|
@ -3367,7 +3367,7 @@ void Player::removeSpell(uint32 spell_id, bool disabled, bool learn_low_rank)
|
||||||
}
|
}
|
||||||
|
|
||||||
// remove from spell book if not replaced by lesser rank
|
// remove from spell book if not replaced by lesser rank
|
||||||
if(!prev_activate)
|
if (!prev_activate && sendUpdate)
|
||||||
{
|
{
|
||||||
WorldPacket data(SMSG_REMOVED_SPELL, 4);
|
WorldPacket data(SMSG_REMOVED_SPELL, 4);
|
||||||
data << uint32(spell_id);
|
data << uint32(spell_id);
|
||||||
|
|
|
||||||
|
|
@ -1555,7 +1555,7 @@ class MANGOS_DLL_SPEC Player : public Unit
|
||||||
void SendInitialSpells();
|
void SendInitialSpells();
|
||||||
bool addSpell(uint32 spell_id, bool active, bool learning, bool dependent, bool disabled);
|
bool addSpell(uint32 spell_id, bool active, bool learning, bool dependent, bool disabled);
|
||||||
void learnSpell(uint32 spell_id, bool dependent);
|
void learnSpell(uint32 spell_id, bool dependent);
|
||||||
void removeSpell(uint32 spell_id, bool disabled = false, bool learn_low_rank = true);
|
void removeSpell(uint32 spell_id, bool disabled = false, bool learn_low_rank = true, bool sendUpdate = true);
|
||||||
void resetSpells();
|
void resetSpells();
|
||||||
void learnDefaultSpells();
|
void learnDefaultSpells();
|
||||||
void learnQuestRewardedSpells();
|
void learnQuestRewardedSpells();
|
||||||
|
|
|
||||||
|
|
@ -5260,11 +5260,11 @@ SpellCastResult Spell::CheckItems()
|
||||||
{
|
{
|
||||||
uint32 itemid = m_CastItem->GetEntry();
|
uint32 itemid = m_CastItem->GetEntry();
|
||||||
if( !p_caster->HasItemCount(itemid, 1) )
|
if( !p_caster->HasItemCount(itemid, 1) )
|
||||||
return SPELL_FAILED_ITEM_NOT_READY;
|
return SPELL_FAILED_ITEM_NOT_FOUND;
|
||||||
|
|
||||||
ItemPrototype const *proto = m_CastItem->GetProto();
|
ItemPrototype const *proto = m_CastItem->GetProto();
|
||||||
if(!proto)
|
if(!proto)
|
||||||
return SPELL_FAILED_ITEM_NOT_READY;
|
return SPELL_FAILED_ITEM_NOT_FOUND;
|
||||||
|
|
||||||
for (int i = 0; i < 5; ++i)
|
for (int i = 0; i < 5; ++i)
|
||||||
if (proto->Spells[i].SpellCharges)
|
if (proto->Spells[i].SpellCharges)
|
||||||
|
|
@ -5380,7 +5380,7 @@ SpellCastResult Spell::CheckItems()
|
||||||
{
|
{
|
||||||
ItemPrototype const *proto = m_CastItem->GetProto();
|
ItemPrototype const *proto = m_CastItem->GetProto();
|
||||||
if(!proto)
|
if(!proto)
|
||||||
return SPELL_FAILED_ITEM_NOT_READY;
|
return SPELL_FAILED_REAGENTS;
|
||||||
for(int s = 0; s < MAX_ITEM_PROTO_SPELLS; ++s)
|
for(int s = 0; s < MAX_ITEM_PROTO_SPELLS; ++s)
|
||||||
{
|
{
|
||||||
// CastItem will be used up and does not count as reagent
|
// CastItem will be used up and does not count as reagent
|
||||||
|
|
@ -5393,7 +5393,7 @@ SpellCastResult Spell::CheckItems()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if( !p_caster->HasItemCount(itemid, itemcount) )
|
if( !p_caster->HasItemCount(itemid, itemcount) )
|
||||||
return SPELL_FAILED_ITEM_NOT_READY; //0x54
|
return SPELL_FAILED_REAGENTS;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -2925,7 +2925,13 @@ void Aura::HandleAuraModShapeshift(bool apply, bool Real)
|
||||||
ShapeshiftForm form = ShapeshiftForm(m_modifier.m_miscvalue);
|
ShapeshiftForm form = ShapeshiftForm(m_modifier.m_miscvalue);
|
||||||
|
|
||||||
SpellShapeshiftEntry const* ssEntry = sSpellShapeshiftStore.LookupEntry(form);
|
SpellShapeshiftEntry const* ssEntry = sSpellShapeshiftStore.LookupEntry(form);
|
||||||
if(ssEntry && ssEntry->modelID_A)
|
if (!ssEntry)
|
||||||
|
{
|
||||||
|
sLog.outError("Unknown shapeshift form %u in spell %u", form, GetId());
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (ssEntry->modelID_A)
|
||||||
{
|
{
|
||||||
// i will asume that creatures will always take the defined model from the dbc
|
// i will asume that creatures will always take the defined model from the dbc
|
||||||
// since no field in creature_templates describes wether an alliance or
|
// since no field in creature_templates describes wether an alliance or
|
||||||
|
|
@ -3112,6 +3118,14 @@ void Aura::HandleAuraModShapeshift(bool apply, bool Real)
|
||||||
|
|
||||||
m_target->m_ShapeShiftFormSpellId = GetId();
|
m_target->m_ShapeShiftFormSpellId = GetId();
|
||||||
m_target->m_form = form;
|
m_target->m_form = form;
|
||||||
|
|
||||||
|
// a form can give the player a new castbar with some spells.. this is a clientside process..
|
||||||
|
// serverside just needs to register the new spells so that player isn't kicked as cheater
|
||||||
|
if (m_target->GetTypeId() == TYPEID_PLAYER)
|
||||||
|
for (uint32 i = 0; i < 8; ++i)
|
||||||
|
if (ssEntry->spellId[i])
|
||||||
|
((Player*)m_target)->addSpell(ssEntry->spellId[i], true, false, false, false);
|
||||||
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
|
@ -3140,6 +3154,13 @@ void Aura::HandleAuraModShapeshift(bool apply, bool Real)
|
||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// look at the comment in apply-part
|
||||||
|
if (m_target->GetTypeId() == TYPEID_PLAYER)
|
||||||
|
for (uint32 i = 0; i < 8; ++i)
|
||||||
|
if (ssEntry->spellId[i])
|
||||||
|
((Player*)m_target)->removeSpell(ssEntry->spellId[i], false, false, false);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// adding/removing linked auras
|
// adding/removing linked auras
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,4 @@
|
||||||
#ifndef __REVISION_NR_H__
|
#ifndef __REVISION_NR_H__
|
||||||
#define __REVISION_NR_H__
|
#define __REVISION_NR_H__
|
||||||
#define REVISION_NR "9012"
|
#define REVISION_NR "9013"
|
||||||
#endif // __REVISION_NR_H__
|
#endif // __REVISION_NR_H__
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue