mirror of
https://github.com/mangosfour/server.git
synced 2025-12-14 07:37:01 +00:00
Updated spells stuff
This commit is contained in:
parent
f7049657c9
commit
629da9de32
9 changed files with 479 additions and 370 deletions
|
|
@ -130,7 +130,7 @@ pEffect SpellEffects[TOTAL_SPELL_EFFECTS]=
|
|||
&Spell::EffectPickPocket, // 71 SPELL_EFFECT_PICKPOCKET
|
||||
&Spell::EffectAddFarsight, // 72 SPELL_EFFECT_ADD_FARSIGHT
|
||||
&Spell::EffectSummonGuardian, // 73 SPELL_EFFECT_SUMMON_POSSESSED
|
||||
&Spell::EffectSummonTotem, // 74 SPELL_EFFECT_SUMMON_TOTEM
|
||||
&Spell::EffectApplyGlyph, // 74 SPELL_EFFECT_APPLY_GLYPH
|
||||
&Spell::EffectHealMechanical, // 75 SPELL_EFFECT_HEAL_MECHANICAL one spell: Mechanical Patch Kit
|
||||
&Spell::EffectSummonObjectWild, // 76 SPELL_EFFECT_SUMMON_OBJECT_WILD
|
||||
&Spell::EffectScriptEffect, // 77 SPELL_EFFECT_SCRIPT_EFFECT
|
||||
|
|
@ -210,6 +210,12 @@ pEffect SpellEffects[TOTAL_SPELL_EFFECTS]=
|
|||
&Spell::EffectTriggerRitualOfSummoning, //151 SPELL_EFFECT_TRIGGER_SPELL_2
|
||||
&Spell::EffectNULL, //152 SPELL_EFFECT_152 summon Refer-a-Friend
|
||||
&Spell::EffectNULL, //153 SPELL_EFFECT_CREATE_PET misc value is creature entry
|
||||
&Spell::EffectNULL, //154
|
||||
&Spell::EffectNULL, //155 Allows you to equip two-handed axes, maces and swords in one hand, but you attack $49152s1% slower than normal.
|
||||
&Spell::EffectNULL, //156 Test Add Sockets Enchant
|
||||
&Spell::EffectNULL, //157
|
||||
&Spell::EffectNULL, //158
|
||||
&Spell::EffectNULL //159
|
||||
};
|
||||
|
||||
void Spell::EffectNULL(uint32 /*i*/)
|
||||
|
|
@ -2892,10 +2898,10 @@ void Spell::EffectOpenLock(uint32 /*i*/)
|
|||
}
|
||||
|
||||
// check key
|
||||
for(int i = 0; i < 5; ++i)
|
||||
for(int i = 0; i < 8; ++i)
|
||||
{
|
||||
// type==1 This means lockInfo->key[i] is an item
|
||||
if(lockInfo->keytype[i]==LOCK_KEY_ITEM && lockInfo->key[i] && m_CastItem && m_CastItem->GetEntry()==lockInfo->key[i])
|
||||
// Type==1 This means lockInfo->Index[i] is an item
|
||||
if(lockInfo->Type[i]==LOCK_KEY_ITEM && lockInfo->Index[i] && m_CastItem && m_CastItem->GetEntry()==lockInfo->Index[i])
|
||||
{
|
||||
SendLoot(guid, loottype);
|
||||
return;
|
||||
|
|
@ -2913,9 +2919,9 @@ void Spell::EffectOpenLock(uint32 /*i*/)
|
|||
// skill bonus provided by casting spell (mostly item spells)
|
||||
uint32 spellSkillBonus = uint32(m_currentBasePoints[0]+1);
|
||||
|
||||
uint32 reqSkillValue = lockInfo->requiredminingskill;
|
||||
uint32 reqSkillValue = lockInfo->Skill[0];
|
||||
|
||||
if(lockInfo->requiredlockskill) // required pick lock skill applying
|
||||
if(lockInfo->Skill[1]) // required pick lock skill applying
|
||||
{
|
||||
if(SkillId != SKILL_LOCKPICKING) // wrong skill (cheating?)
|
||||
{
|
||||
|
|
@ -2923,7 +2929,7 @@ void Spell::EffectOpenLock(uint32 /*i*/)
|
|||
return;
|
||||
}
|
||||
|
||||
reqSkillValue = lockInfo->requiredlockskill;
|
||||
reqSkillValue = lockInfo->Skill[1];
|
||||
}
|
||||
else if(SkillId == SKILL_LOCKPICKING) // apply picklock skill to wrong target
|
||||
{
|
||||
|
|
@ -3194,16 +3200,16 @@ void Spell::EffectSummon(uint32 i)
|
|||
if(duration > 0)
|
||||
spawnCreature->SetDuration(duration);
|
||||
|
||||
spawnCreature->SetUInt64Value(UNIT_FIELD_SUMMONEDBY,m_caster->GetGUID());
|
||||
spawnCreature->SetUInt32Value(UNIT_NPC_FLAGS , 0);
|
||||
spawnCreature->SetUInt64Value(UNIT_FIELD_SUMMONEDBY, m_caster->GetGUID());
|
||||
spawnCreature->SetUInt32Value(UNIT_NPC_FLAGS, 0);
|
||||
spawnCreature->setPowerType(POWER_MANA);
|
||||
spawnCreature->SetUInt32Value(UNIT_FIELD_FACTIONTEMPLATE,m_caster->getFaction());
|
||||
spawnCreature->SetUInt32Value(UNIT_FIELD_FLAGS,0);
|
||||
spawnCreature->SetUInt32Value(UNIT_FIELD_BYTES_0,2048);
|
||||
spawnCreature->SetUInt32Value(UNIT_FIELD_BYTES_1,0);
|
||||
spawnCreature->SetUInt32Value(UNIT_FIELD_PET_NAME_TIMESTAMP,0);
|
||||
spawnCreature->SetUInt32Value(UNIT_FIELD_PETEXPERIENCE,0);
|
||||
spawnCreature->SetUInt32Value(UNIT_FIELD_PETNEXTLEVELEXP,1000);
|
||||
spawnCreature->SetUInt32Value(UNIT_FIELD_FACTIONTEMPLATE, m_caster->getFaction());
|
||||
spawnCreature->SetUInt32Value(UNIT_FIELD_FLAGS, 0);
|
||||
spawnCreature->SetUInt32Value(UNIT_FIELD_BYTES_0, 2048);
|
||||
spawnCreature->SetUInt32Value(UNIT_FIELD_BYTES_1, 0);
|
||||
spawnCreature->SetUInt32Value(UNIT_FIELD_PET_NAME_TIMESTAMP, 0);
|
||||
spawnCreature->SetUInt32Value(UNIT_FIELD_PETEXPERIENCE, 0);
|
||||
spawnCreature->SetUInt32Value(UNIT_FIELD_PETNEXTLEVELEXP, 1000);
|
||||
spawnCreature->SetUInt64Value(UNIT_FIELD_CREATEDBY, m_caster->GetGUID());
|
||||
spawnCreature->SetUInt32Value(UNIT_CREATED_BY_SPELL, m_spellInfo->Id);
|
||||
|
||||
|
|
@ -3246,7 +3252,7 @@ void Spell::EffectLearnSpell(uint32 i)
|
|||
|
||||
Player *player = (Player*)unitTarget;
|
||||
|
||||
uint32 spellToLearn = (m_spellInfo->Id==SPELL_ID_GENERIC_LEARN) ? damage : m_spellInfo->EffectTriggerSpell[i];
|
||||
uint32 spellToLearn = ((m_spellInfo->Id==SPELL_ID_GENERIC_LEARN) || (m_spellInfo->Id==SPELL_ID_GENERIC_LEARN_PET)) ? damage : m_spellInfo->EffectTriggerSpell[i];
|
||||
player->learnSpell(spellToLearn);
|
||||
|
||||
sLog.outDebug( "Spell: Player %u have learned spell %u from NpcGUID=%u", player->GetGUIDLow(), spellToLearn, m_caster->GetGUIDLow() );
|
||||
|
|
@ -3904,10 +3910,13 @@ void Spell::EffectTameCreature(uint32 /*i*/)
|
|||
|
||||
pet->SetUInt64Value(UNIT_FIELD_SUMMONEDBY, m_caster->GetGUID());
|
||||
pet->SetUInt64Value(UNIT_FIELD_CREATEDBY, m_caster->GetGUID());
|
||||
pet->SetUInt32Value(UNIT_FIELD_FACTIONTEMPLATE,m_caster->getFaction());
|
||||
pet->SetUInt32Value(UNIT_FIELD_FACTIONTEMPLATE, m_caster->getFaction());
|
||||
pet->SetUInt32Value(UNIT_CREATED_BY_SPELL, m_spellInfo->Id);
|
||||
|
||||
if(!pet->InitStatsForLevel(creatureTarget->getLevel()))
|
||||
uint32 level = (creatureTarget->getLevel() < (m_caster->getLevel() - 5)) ? (m_caster->getLevel() - 5) : creatureTarget->getLevel();
|
||||
pet->SetFreeTalentPoints(pet->GetMaxTalentPointsForLevel(level));
|
||||
|
||||
if(!pet->InitStatsForLevel(level))
|
||||
{
|
||||
sLog.outError("ERROR: InitStatsForLevel() in EffectTameCreature failed! Pet deleted.");
|
||||
delete pet;
|
||||
|
|
@ -3915,7 +3924,7 @@ void Spell::EffectTameCreature(uint32 /*i*/)
|
|||
}
|
||||
|
||||
// prepare visual effect for levelup
|
||||
pet->SetUInt32Value(UNIT_FIELD_LEVEL,creatureTarget->getLevel()-1);
|
||||
pet->SetUInt32Value(UNIT_FIELD_LEVEL, level - 1);
|
||||
|
||||
pet->GetCharmInfo()->SetPetNumber(objmgr.GeneratePetNumber(), true);
|
||||
// this enables pet details window (Shift+P)
|
||||
|
|
@ -3926,7 +3935,7 @@ void Spell::EffectTameCreature(uint32 /*i*/)
|
|||
MapManager::Instance().GetMap(pet->GetMapId(), pet)->Add((Creature*)pet);
|
||||
|
||||
// visual effect for levelup
|
||||
pet->SetUInt32Value(UNIT_FIELD_LEVEL,creatureTarget->getLevel());
|
||||
pet->SetUInt32Value(UNIT_FIELD_LEVEL, level);
|
||||
|
||||
if(m_caster->GetTypeId() == TYPEID_PLAYER)
|
||||
{
|
||||
|
|
@ -4048,13 +4057,13 @@ void Spell::EffectSummonPet(uint32 i)
|
|||
|
||||
NewSummon->SetUInt64Value(UNIT_FIELD_SUMMONEDBY, m_caster->GetGUID());
|
||||
NewSummon->SetUInt64Value(UNIT_FIELD_CREATEDBY, m_caster->GetGUID());
|
||||
NewSummon->SetUInt32Value(UNIT_NPC_FLAGS , 0);
|
||||
NewSummon->SetUInt32Value(UNIT_NPC_FLAGS, 0);
|
||||
NewSummon->SetUInt32Value(UNIT_FIELD_FACTIONTEMPLATE, faction);
|
||||
NewSummon->SetUInt32Value(UNIT_FIELD_BYTES_0,2048);
|
||||
NewSummon->SetUInt32Value(UNIT_FIELD_BYTES_1,0);
|
||||
NewSummon->SetUInt32Value(UNIT_FIELD_PET_NAME_TIMESTAMP,time(NULL));
|
||||
NewSummon->SetUInt32Value(UNIT_FIELD_PETEXPERIENCE,0);
|
||||
NewSummon->SetUInt32Value(UNIT_FIELD_PETNEXTLEVELEXP,1000);
|
||||
NewSummon->SetUInt32Value(UNIT_FIELD_BYTES_0, 2048);
|
||||
NewSummon->SetUInt32Value(UNIT_FIELD_BYTES_1, 0);
|
||||
NewSummon->SetUInt32Value(UNIT_FIELD_PET_NAME_TIMESTAMP, time(NULL));
|
||||
NewSummon->SetUInt32Value(UNIT_FIELD_PETEXPERIENCE, 0);
|
||||
NewSummon->SetUInt32Value(UNIT_FIELD_PETNEXTLEVELEXP, 1000);
|
||||
NewSummon->SetUInt32Value(UNIT_CREATED_BY_SPELL, m_spellInfo->Id);
|
||||
|
||||
NewSummon->GetCharmInfo()->SetPetNumber(pet_number, true);
|
||||
|
|
@ -4063,7 +4072,7 @@ void Spell::EffectSummonPet(uint32 i)
|
|||
// this enables popup window (pet dismiss, cancel), hunter pet additional flags set later
|
||||
NewSummon->SetUInt32Value(UNIT_FIELD_FLAGS,UNIT_FLAG_PVP_ATTACKABLE);
|
||||
|
||||
NewSummon->InitStatsForLevel( petlevel);
|
||||
NewSummon->InitStatsForLevel(petlevel);
|
||||
NewSummon->InitPetCreateSpells();
|
||||
|
||||
if(NewSummon->getPetType()==SUMMON_PET)
|
||||
|
|
@ -4122,7 +4131,6 @@ void Spell::EffectLearnPetSpell(uint32 i)
|
|||
if(!learn_spellproto)
|
||||
return;
|
||||
|
||||
pet->SetTP(pet->m_TrainingPoints - pet->GetTPForSpell(learn_spellproto->Id));
|
||||
pet->learnSpell(learn_spellproto->Id);
|
||||
|
||||
pet->SavePetToDB(PET_SAVE_AS_CURRENT);
|
||||
|
|
@ -4203,7 +4211,7 @@ void Spell::EffectWeaponDmg(uint32 i)
|
|||
{
|
||||
int32 duration = GetSpellDuration(proto);
|
||||
(*itr)->SetAuraDuration(duration);
|
||||
(*itr)->UpdateAuraDuration();
|
||||
(*itr)->SendAuraUpdate(false);
|
||||
bonusDamagePercentMod += 1.0f; // +100%
|
||||
}
|
||||
}
|
||||
|
|
@ -5089,6 +5097,45 @@ void Spell::EffectActivateObject(uint32 effect_idx)
|
|||
sWorld.ScriptCommandStart(activateCommand, delay_secs, m_caster, gameObjTarget);
|
||||
}
|
||||
|
||||
void Spell::EffectApplyGlyph(uint32 i)
|
||||
{
|
||||
if(m_caster->GetTypeId() != TYPEID_PLAYER)
|
||||
return;
|
||||
|
||||
Player *player = (Player*)m_caster;
|
||||
|
||||
// remove old glyph
|
||||
if(uint32 oldglyph = player->GetGlyph(m_glyphIndex))
|
||||
{
|
||||
if(GlyphPropertiesEntry const *old_gp = sGlyphPropertiesStore.LookupEntry(oldglyph))
|
||||
{
|
||||
player->RemoveAurasDueToSpell(old_gp->SpellId);
|
||||
player->SetGlyph(m_glyphIndex, 0);
|
||||
}
|
||||
}
|
||||
|
||||
// apply new one
|
||||
if(uint32 glyph = m_spellInfo->EffectMiscValue[i])
|
||||
{
|
||||
if(GlyphPropertiesEntry const *gp = sGlyphPropertiesStore.LookupEntry(glyph))
|
||||
{
|
||||
if(GlyphSlotEntry const *gs = sGlyphSlotStore.LookupEntry(player->GetGlyphSlot(m_glyphIndex)))
|
||||
{
|
||||
if(gp->TypeFlags != gs->TypeFlags)
|
||||
{
|
||||
SendCastResult(SPELL_FAILED_INVALID_GLYPH);
|
||||
return; // glyph slot missmatch
|
||||
}
|
||||
}
|
||||
|
||||
player->CastSpell(m_caster, gp->SpellId, true);
|
||||
player->SetGlyph(m_glyphIndex, glyph);
|
||||
if(m_CastItem)
|
||||
player->DestroyItemCount(m_CastItem->GetEntry(), 1, true);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void Spell::EffectSummonTotem(uint32 i)
|
||||
{
|
||||
uint8 slot = 0;
|
||||
|
|
@ -5941,9 +5988,9 @@ void Spell::EffectTransmitted(uint32 effIndex)
|
|||
{
|
||||
m_caster->SetUInt64Value(UNIT_FIELD_CHANNEL_OBJECT,pGameObj->GetGUID());
|
||||
// Orientation3
|
||||
pGameObj->SetFloatValue(GAMEOBJECT_ROTATION + 2, 0.88431775569915771 );
|
||||
pGameObj->SetFloatValue(GAMEOBJECT_PARENTROTATION + 2, 0.88431775569915771 );
|
||||
// Orientation4
|
||||
pGameObj->SetFloatValue(GAMEOBJECT_ROTATION + 3, -0.4668855369091033 );
|
||||
pGameObj->SetFloatValue(GAMEOBJECT_PARENTROTATION + 3, -0.4668855369091033 );
|
||||
m_caster->AddGameObject(pGameObj); // will removed at spell cancel
|
||||
|
||||
// end time of range when possible catch fish (FISHING_BOBBER_READY_TIME..GetDuration(m_spellInfo))
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue