bool PassengerEjectEvent::Execute(uint64 /*e_time*/, uint32 /*p_time*/) { if (m_passenger && m_passenger->IsInWorld()) { if (!m_passenger->GetVehicle()) return true; Unit* vehicle = m_passenger->GetVehicle()->GetBase(); uint32 controlSpell = 0; Unit::AuraList const& controlAuras = vehicle->GetAurasByType(SPELL_AURA_CONTROL_VEHICLE); for(Unit::AuraList::const_iterator i = controlAuras.begin(); i != controlAuras.end(); ++i) { if ((*i)->GetCasterGuid() == m_passenger->GetObjectGuid()) { controlSpell = (*i)->GetId(); break; } } if (controlSpell) { vehicle->RemoveAurasByCasterSpell(controlSpell, m_passenger->GetObjectGuid()); } } return true; }
void WarriorSpellHandler::HandleAuraDummyWithApply(Aura* aura,Unit* caster,Unit* target) { SpellEntry const* m_spellProto = aura->GetSpellProto(); Unit* m_target = target; // Overpower if(m_spellProto->SpellFamilyFlags & UI64LIT(0x0000000000000004)) { // Must be casting target if (!m_target->IsNonMeleeSpellCasted(false)) return; Unit* caster = aura->GetCaster(); if (!caster) return; Unit::AuraList const& modifierAuras = caster->GetAurasByType(SPELL_AURA_ADD_FLAT_MODIFIER); for(Unit::AuraList::const_iterator itr = modifierAuras.begin(); itr != modifierAuras.end(); ++itr) { // Unrelenting Assault if((*itr)->GetSpellProto()->SpellFamilyName==SPELLFAMILY_WARRIOR && (*itr)->GetSpellProto()->SpellIconID == 2775) { switch ((*itr)->GetSpellProto()->Id) { case 46859: // Unrelenting Assault, rank 1 m_target->CastSpell(m_target,64849,true,NULL,(*itr)); break; case 46860: // Unrelenting Assault, rank 2 m_target->CastSpell(m_target,64850,true,NULL,(*itr)); break; default: break; } break; } } return; } }
void WorldSession::HandleCastSpellOpcode(WorldPacket& recvPacket) { uint32 spellId, glyphIndex; uint8 cast_count, cast_flags; recvPacket >> cast_count; recvPacket >> spellId >> glyphIndex; recvPacket >> cast_flags; // flags (if 0x02 - some additional data are received) // ignore for remote control state (for player case) Unit* _mover = GetPlayer()->GetMover(); if (_mover != GetPlayer() && _mover->GetTypeId()==TYPEID_PLAYER) { recvPacket.rpos(recvPacket.wpos()); // prevent spam at ignore packet return; } DEBUG_LOG("WORLD: got cast spell packet, spellId - %u, cast_count: %u, cast_flags %u, data length = " SIZEFMTD, spellId, cast_count, cast_flags, recvPacket.size()); /* process anticheat check */ if (!GetPlayer()->GetAntiCheat()->DoAntiCheatCheck(CHECK_SPELL, spellId, CMSG_CAST_SPELL)) return; SpellEntry const *spellInfo = sSpellStore.LookupEntry(spellId ); if(!spellInfo) { sLog.outError("WORLD: unknown spell id %u", spellId); recvPacket.rpos(recvPacket.wpos()); // prevent spam at ignore packet return; } // Players on vehicles may cast many simple spells (like knock) from self Unit* mover = NULL; if (spellInfo->HasAttribute(SPELL_ATTR_EX6_CASTABLE_ON_VEHICLE) && _mover->IsCharmerOrOwnerPlayerOrPlayerItself()) mover = _mover->GetCharmerOrOwnerPlayerOrPlayerItself(); else mover = _mover; // casting own spells on some vehicles if (Player* plr = mover->GetCharmerOrOwnerPlayerOrPlayerItself()) { if (mover->IsVehicle() && (mover != plr)) { if (VehicleKitPtr vehicle = mover->GetVehicleKit()) { if (VehicleSeatEntry const* seatInfo = vehicle->GetSeatInfo(plr)) if (seatInfo->m_flags & (SEAT_FLAG_CAN_ATTACK | SEAT_FLAG_CAN_CAST)) mover = plr; } } } bool triggered = false; SpellEntry const* triggeredBy = NULL; Aura const* triggeredByAura = mover->GetTriggeredByClientAura(spellId); if (triggeredByAura) { triggered = true; triggeredBy = triggeredByAura->GetSpellProto(); cast_count = 0; } Unit::AuraList const& m363auras = mover->GetAurasByType(SPELL_AURA_363); for (Unit::AuraList::const_iterator itr = m363auras.begin(); itr != m363auras.end(); ++itr) { if ((*itr)->GetSpellEffect()->EffectTriggerSpell == spellId) { triggered = true; mover->RemoveSpellAuraHolder((*itr)->GetHolder()); break; } } if (!spellInfo->HasAttribute(SPELL_ATTR_EX8_RAID_MARKER)) { if (mover->GetTypeId()==TYPEID_PLAYER) { // not have spell in spellbook or spell passive and not casted by client if ((!((Player*)mover)->HasActiveSpell(spellId) && !triggered || IsPassiveSpell(spellInfo)) && !sSpellMgr.IsAbilityOfSkillType(spellInfo, SKILL_ARCHAEOLOGY)) { sLog.outError("WorldSession::HandleCastSpellOpcode: %s casts spell %u which he shouldn't have", mover->GetObjectGuid().GetString().c_str(), spellId); //cheater? kick? ban? recvPacket.rpos(recvPacket.wpos()); // prevent spam at ignore packet return; } } else { // not have spell in spellbook or spell passive and not casted by client if (!((Creature*)mover)->HasSpell(spellId) && !triggered || IsPassiveSpell(spellInfo)) { sLog.outError("World: Player %u casts spell %u which he shouldn't have", mover->GetGUIDLow(), spellId); //cheater? kick? ban? recvPacket.rpos(recvPacket.wpos()); // prevent spam at ignore packet return; } } } Unit::AuraList swaps = _mover->GetAurasByType(SPELL_AURA_OVERRIDE_ACTIONBAR_SPELLS); Unit::AuraList const& swaps2 = _mover->GetAurasByType(SPELL_AURA_OVERRIDE_ACTIONBAR_SPELLS_2); if (!swaps2.empty()) swaps.insert(swaps.end(), swaps2.begin(), swaps2.end()); for (Unit::AuraList::const_iterator itr = swaps.begin(); itr != swaps.end(); ++itr) { if ((*itr)->isAffectedOnSpell(spellInfo)) { if (SpellEntry const* newInfo = sSpellStore.LookupEntry((*itr)->GetModifier()->m_amount)) { spellInfo = newInfo; spellId = newInfo->Id; // Force triggered to spells mirrored by Dark Simulacrum if ((*itr)->GetId() == 77616) triggered = true; } break; } } // Lifebloom if (spellId == 33763) { // search Tree of Life (Passive) if (Aura* aura = _mover->GetAura(81098, EFFECT_INDEX_1)) { if (SpellEntry const* newInfo = sSpellStore.LookupEntry(aura->GetModifier()->m_amount)) { spellInfo = newInfo; spellId = newInfo->Id; } } } // client provided targets SpellCastTargets targets; recvPacket >> targets.ReadForCaster(mover); targets.ReadAdditionalData(recvPacket, cast_flags); // Multi-Shot hack if (!targets.getUnitTarget() && spellId == 2643) { if (Unit* target = _player->GetMap()->GetUnit(_player->GetSelectionGuid())) targets.setUnitTarget(target); } // auto-selection buff level base at target level (in spellInfo) if (Unit* target = targets.getUnitTarget()) { // if rank not found then function return NULL but in explicit cast case original spell can be casted and later failed with appropriate error message if (SpellEntry const *actualSpellInfo = sSpellMgr.SelectAuraRankForLevel(spellInfo, target->getLevel())) spellInfo = actualSpellInfo; } Spell *spell = new Spell(mover, spellInfo, triggered, mover->GetObjectGuid(), triggeredBy); spell->m_cast_count = cast_count; // set count of casts spell->m_glyphIndex = glyphIndex; spell->prepare(&targets, triggeredByAura); }
void WorldSession::HandleCastSpellOpcode(WorldPacket& recvPacket) { uint32 spellId, glyphIndex; uint8 cast_count, cast_flags; recvPacket >> cast_count; recvPacket >> spellId >> glyphIndex; recvPacket >> cast_flags; // flags (if 0x02 - some additional data are received) // ignore for remote control state (for player case) Unit* _mover = GetPlayer()->GetMover(); if (_mover != GetPlayer() && _mover->GetTypeId()==TYPEID_PLAYER) { recvPacket.rpos(recvPacket.wpos()); // prevent spam at ignore packet return; } DEBUG_LOG("WORLD: got cast spell packet, spellId - %u, cast_count: %u, cast_flags %u, data length = " SIZEFMTD, spellId, cast_count, cast_flags, recvPacket.size()); /* process anticheat check */ if (!GetPlayer()->GetAntiCheat()->DoAntiCheatCheck(CHECK_SPELL, spellId, CMSG_CAST_SPELL)) return; SpellEntry const *spellInfo = sSpellStore.LookupEntry(spellId ); if(!spellInfo) { sLog.outError("WORLD: unknown spell id %u", spellId); recvPacket.rpos(recvPacket.wpos()); // prevent spam at ignore packet return; } // Players on vehicles may cast many simple spells (like knock) from self Unit* mover = NULL; if (spellInfo->HasAttribute(SPELL_ATTR_EX6_CASTABLE_ON_VEHICLE) && _mover->IsCharmerOrOwnerPlayerOrPlayerItself()) mover = _mover->GetCharmerOrOwnerPlayerOrPlayerItself(); else mover = _mover; // casting own spells on some vehicles if (mover->IsVehicle() && mover->GetCharmerOrOwnerPlayerOrPlayerItself()) { Player *plr = mover->GetCharmerOrOwnerPlayerOrPlayerItself(); if (mover->GetVehicleKit()->GetSeatInfo(plr) && ((mover->GetVehicleKit()->GetSeatInfo(plr)->m_flags & SEAT_FLAG_CAN_ATTACK) || (mover->GetVehicleKit()->GetSeatInfo(plr)->m_flags & SEAT_FLAG_CAN_CAST) )) mover = plr; } bool triggered = false; SpellEntry const* triggeredBy = NULL; Aura const* triggeredByAura = mover->GetTriggeredByClientAura(spellId); if (triggeredByAura) { triggered = true; triggeredBy = triggeredByAura->GetSpellProto(); cast_count = 0; } if (mover->GetTypeId()==TYPEID_PLAYER) { // not have spell in spellbook or spell passive and not casted by client if (((((Player*)mover)->GetUInt16Value(PLAYER_FIELD_BYTES2, 0) == 0 && (!((Player*)mover)->HasActiveSpell(spellId) && !triggered)) || IsPassiveSpell(spellInfo)) && spellId != 1843) { sLog.outError("WorldSession::HandleCastSpellOpcode: %s casts spell %u which he shouldn't have", mover->GetObjectGuid().GetString().c_str(), spellId); //cheater? kick? ban? recvPacket.rpos(recvPacket.wpos()); // prevent spam at ignore packet return; } } else { // not have spell in spellbook or spell passive and not casted by client if ((!((Creature*)mover)->HasSpell(spellId) && !triggered) || IsPassiveSpell(spellInfo)) { sLog.outError("WorldSession::HandleCastSpellOpcode: %s try casts spell %u which he shouldn't have", mover->GetObjectGuid().GetString().c_str(), spellId); //cheater? kick? ban? recvPacket.rpos(recvPacket.wpos()); // prevent spam at ignore packet return; } } Unit::AuraList swaps = mover->GetAurasByType(SPELL_AURA_OVERRIDE_ACTIONBAR_SPELLS); Unit::AuraList const& swaps2 = mover->GetAurasByType(SPELL_AURA_OVERRIDE_ACTIONBAR_SPELLS_2); if (!swaps2.empty()) swaps.insert(swaps.end(), swaps2.begin(), swaps2.end()); for (Unit::AuraList::const_iterator itr = swaps.begin(); itr != swaps.end(); ++itr) { if ((*itr)->isAffectedOnSpell(spellInfo)) { if (SpellEntry const* newInfo = sSpellStore.LookupEntry((*itr)->GetModifier()->m_amount)) { spellInfo = newInfo; spellId = newInfo->Id; } break; } } // client provided targets SpellCastTargets targets; recvPacket >> targets.ReadForCaster(mover); targets.ReadAdditionalData(recvPacket, cast_flags); // auto-selection buff level base at target level (in spellInfo) if (Unit* target = targets.getUnitTarget()) { // if rank not found then function return NULL but in explicit cast case original spell can be casted and later failed with appropriate error message if (SpellEntry const *actualSpellInfo = sSpellMgr.SelectAuraRankForLevel(spellInfo, target->getLevel())) spellInfo = actualSpellInfo; } Spell *spell = new Spell(mover, spellInfo, triggered, mover->GetObjectGuid(), triggeredBy); spell->m_cast_count = cast_count; // set count of casts spell->m_glyphIndex = glyphIndex; spell->prepare(&targets, triggeredByAura); }
void WorldSession::HandleCastSpellOpcode(WorldPacket& recvPacket) { uint32 spellId, glyphIndex; uint8 cast_count, cast_flags; recvPacket >> cast_count; recvPacket >> spellId >> glyphIndex; recvPacket >> cast_flags; // flags (if 0x02 - some additional data are received) // ignore for remote control state (for player case) Unit* mover = _player->GetMover(); if (mover != _player && mover->GetTypeId() == TYPEID_PLAYER) { recvPacket.rpos(recvPacket.wpos()); // prevent spam at ignore packet return; } DEBUG_LOG("WORLD: got cast spell packet, spellId - %u, cast_count: %u, cast_flags %u, data length = " SIZEFMTD, spellId, cast_count, cast_flags, recvPacket.size()); SpellEntry const* spellInfo = sSpellStore.LookupEntry(spellId); if (!spellInfo) { sLog.outError("WORLD: unknown spell id %u", spellId); recvPacket.rpos(recvPacket.wpos()); // prevent spam at ignore packet return; } Aura* triggeredByAura = mover->GetTriggeredByClientAura(spellId); if (mover->GetTypeId() == TYPEID_PLAYER) { // not have spell in spellbook or spell passive and not casted by client if ((!((Player*)mover)->HasActiveSpell(spellId) && !triggeredByAura) || IsPassiveSpell(spellInfo)) { sLog.outError("World: %s casts spell %u which he shouldn't have", mover->GetGuidStr().c_str(), spellId); // cheater? kick? ban? recvPacket.rpos(recvPacket.wpos()); // prevent spam at ignore packet return; } } else { // not have spell in spellbook or spell passive and not casted by client if (!((Creature*)mover)->HasSpell(spellId) || IsPassiveSpell(spellInfo)) { // cheater? kick? ban? recvPacket.rpos(recvPacket.wpos()); // prevent spam at ignore packet return; } } Unit::AuraList swaps = mover->GetAurasByType(SPELL_AURA_OVERRIDE_ACTIONBAR_SPELLS); Unit::AuraList const& swaps2 = mover->GetAurasByType(SPELL_AURA_OVERRIDE_ACTIONBAR_SPELLS_2); if (!swaps2.empty()) swaps.insert(swaps.end(), swaps2.begin(), swaps2.end()); for (Unit::AuraList::const_iterator itr = swaps.begin(); itr != swaps.end(); ++itr) { if ((*itr)->isAffectedOnSpell(spellInfo)) { if (SpellEntry const* newInfo = sSpellStore.LookupEntry((*itr)->GetModifier()->m_amount)) { spellInfo = newInfo; spellId = newInfo->Id; } break; } } // client provided targets SpellCastTargets targets; recvPacket >> targets.ReadForCaster(mover); targets.ReadAdditionalData(recvPacket, cast_flags); // auto-selection buff level base at target level (in spellInfo) if (Unit* target = targets.getUnitTarget()) { // if rank not found then function return NULL but in explicit cast case original spell can be casted and later failed with appropriate error message if (SpellEntry const* actualSpellInfo = sSpellMgr.SelectAuraRankForLevel(spellInfo, target->getLevel())) spellInfo = actualSpellInfo; } Spell* spell = new Spell(mover, spellInfo, triggeredByAura ? true : false, mover->GetObjectGuid(), triggeredByAura ? triggeredByAura->GetSpellProto() : NULL); spell->m_cast_count = cast_count; // set count of casts spell->m_glyphIndex = glyphIndex; spell->prepare(&targets, triggeredByAura); }
void PaladinSpellHandler::HandleSchoolDmg(Spell *spell,int32 &damage,SpellEffectIndex i) { const SpellEntry* m_spellInfo = spell->m_spellInfo; Unit* m_caster = spell->GetCaster(); Unit* unitTarget = spell->getUnitTarget(); // Judgement of Righteousness - receive benefit from Spell Damage and Attack power if (m_spellInfo->Id == SPELL_JUDGEMENT_OF_RIGHTEOUSNESS) { float ap = m_caster->GetTotalAttackPowerValue(BASE_ATTACK); int32 holy = m_caster->SpellBaseDamageBonus(GetSpellSchoolMask(m_spellInfo)) + m_caster->SpellBaseDamageBonusForVictim(GetSpellSchoolMask(m_spellInfo), unitTarget); damage += int32(ap * 0.2f) + int32(holy * 32 / 100); } // Judgement of Vengeance/Corruption ${1+0.22*$SPH+0.14*$AP} + 10% for each application of Holy Vengeance/Blood Corruption on the target else if ((m_spellInfo->SpellFamilyFlags & UI64LIT(0x800000000)) && m_spellInfo->SpellIconID==2292) { uint32 debuf_id; switch(m_spellInfo->Id) { case 53733: debuf_id = 53742; break;// Judgement of Corruption -> Blood Corruption case 31804: debuf_id = 31803; break;// Judgement of Vengeance -> Holy Vengeance default: return; } float ap = m_caster->GetTotalAttackPowerValue(BASE_ATTACK); int32 holy = m_caster->SpellBaseDamageBonus(GetSpellSchoolMask(m_spellInfo)) + m_caster->SpellBaseDamageBonusForVictim(GetSpellSchoolMask(m_spellInfo), unitTarget); damage+=int32(ap * 0.14f) + int32(holy * 22 / 100); // Get stack of Holy Vengeance on the target added by caster uint32 stacks = 0; Unit::AuraList const& auras = unitTarget->GetAurasByType(SPELL_AURA_PERIODIC_DAMAGE); for(Unit::AuraList::const_iterator itr = auras.begin(); itr!=auras.end(); ++itr) { if( ((*itr)->GetId() == debuf_id) && (*itr)->GetCasterGUID()==m_caster->GetGUID()) { stacks = (*itr)->GetStackAmount(); break; } } // + 10% for each application of Holy Vengeance on the target if(stacks) damage += damage * stacks * 10 /100; } // Avenger's Shield ($m1+0.07*$SPH+0.07*$AP) - ranged sdb for future else if (m_spellInfo->SpellFamilyFlags & FLAG_AVENGER_SHIELD) { float ap = m_caster->GetTotalAttackPowerValue(BASE_ATTACK); int32 holy = m_caster->SpellBaseDamageBonus(GetSpellSchoolMask(m_spellInfo)) + m_caster->SpellBaseDamageBonusForVictim(GetSpellSchoolMask(m_spellInfo), unitTarget); damage += int32(ap * 0.07f) + int32(holy * 7 / 100); } // Hammer of Wrath ($m1+0.15*$SPH+0.15*$AP) - ranged type sdb future fix else if (m_spellInfo->SpellFamilyFlags & FLAG_HAMMER_OF_WRATH) { float ap = m_caster->GetTotalAttackPowerValue(BASE_ATTACK); int32 holy = m_caster->SpellBaseDamageBonus(GetSpellSchoolMask(m_spellInfo)) + m_caster->SpellBaseDamageBonusForVictim(GetSpellSchoolMask(m_spellInfo), unitTarget); damage += int32(ap * 0.15f) + int32(holy * 15 / 100); } // Hammer of the Righteous else if (m_spellInfo->SpellFamilyFlags & FLAG_HAMMER_OF_THE_RIGHTEOUS) { // Add main hand dps * effect[2] amount float average = (m_caster->GetFloatValue(UNIT_FIELD_MINDAMAGE) + m_caster->GetFloatValue(UNIT_FIELD_MAXDAMAGE)) / 2; int32 count = m_caster->CalculateSpellDamage(m_spellInfo, 2, m_spellInfo->EffectBasePoints[2], unitTarget); damage += count * int32(average * IN_MILLISECONDS) / m_caster->GetAttackTime(BASE_ATTACK); } // Shield of Righteousness else if (m_spellInfo->SpellFamilyFlags & FLAG_SHIELD_OF_RIGHTEOUSNESS) { damage+=int32(m_caster->GetShieldBlockValue()); } // Judgement else if (m_spellInfo->Id == SPELL_JUDGEMENT) { // [1 + 0.25 * SPH + 0.16 * AP] float ap = m_caster->GetTotalAttackPowerValue(BASE_ATTACK); int32 holy = m_caster->SpellBaseDamageBonus(GetSpellSchoolMask(m_spellInfo)) + m_caster->SpellBaseDamageBonusForVictim(GetSpellSchoolMask(m_spellInfo), unitTarget); damage += int32(ap * 0.16f) + int32(holy * 25 / 100); } }
void WorldSession::HandleGetMirrorimageData(WorldPacket& recv_data) { DEBUG_FILTER_LOG(LOG_FILTER_SPELL_CAST, "WORLD: CMSG_GET_MIRRORIMAGE_DATA"); ObjectGuid guid; recv_data >> guid; Unit *pUnit = ObjectAccessor::GetUnit(*_player, guid); if (!pUnit) return; Unit::AuraList const& images = pUnit->GetAurasByType(SPELL_AURA_MIRROR_IMAGE); if (images.empty()) return; Unit* pCaster = images.front()->GetCaster(); if(!pCaster) return; WorldPacket data(SMSG_MIRRORIMAGE_DATA, 68); data << guid; data << (uint32)pCaster->GetDisplayId(); data << (uint8)pCaster->getRace(); data << (uint8)pCaster->getGender(); data << (uint8)pCaster->getClass(); if (pCaster && pCaster->GetTypeId() == TYPEID_PLAYER) { Player* pPlayer = (Player*)pCaster; // skin, face, hair, haircolor data << (uint8)pPlayer->GetByteValue(PLAYER_BYTES, 0); data << (uint8)pPlayer->GetByteValue(PLAYER_BYTES, 1); data << (uint8)pPlayer->GetByteValue(PLAYER_BYTES, 2); data << (uint8)pPlayer->GetByteValue(PLAYER_BYTES, 3); // facial hair data << (uint8)pPlayer->GetByteValue(PLAYER_BYTES_2, 0); // guild id data << (uint32)pPlayer->GetGuildId(); if (pPlayer->HasFlag(PLAYER_FLAGS, PLAYER_FLAGS_HIDE_HELM)) data << (uint32)0; else data << (uint32)pPlayer->GetItemDisplayIdInSlot(INVENTORY_SLOT_BAG_0, EQUIPMENT_SLOT_HEAD); data << (uint32)pPlayer->GetItemDisplayIdInSlot(INVENTORY_SLOT_BAG_0, EQUIPMENT_SLOT_SHOULDERS); data << (uint32)pPlayer->GetItemDisplayIdInSlot(INVENTORY_SLOT_BAG_0, EQUIPMENT_SLOT_BODY); data << (uint32)pPlayer->GetItemDisplayIdInSlot(INVENTORY_SLOT_BAG_0, EQUIPMENT_SLOT_CHEST); data << (uint32)pPlayer->GetItemDisplayIdInSlot(INVENTORY_SLOT_BAG_0, EQUIPMENT_SLOT_WAIST); data << (uint32)pPlayer->GetItemDisplayIdInSlot(INVENTORY_SLOT_BAG_0, EQUIPMENT_SLOT_LEGS); data << (uint32)pPlayer->GetItemDisplayIdInSlot(INVENTORY_SLOT_BAG_0, EQUIPMENT_SLOT_FEET); data << (uint32)pPlayer->GetItemDisplayIdInSlot(INVENTORY_SLOT_BAG_0, EQUIPMENT_SLOT_WRISTS); data << (uint32)pPlayer->GetItemDisplayIdInSlot(INVENTORY_SLOT_BAG_0, EQUIPMENT_SLOT_HANDS); if (pPlayer->HasFlag(PLAYER_FLAGS, PLAYER_FLAGS_HIDE_CLOAK)) data << (uint32)0; else data << (uint32)pPlayer->GetItemDisplayIdInSlot(INVENTORY_SLOT_BAG_0, EQUIPMENT_SLOT_BACK); data << (uint32)pPlayer->GetItemDisplayIdInSlot(INVENTORY_SLOT_BAG_0, EQUIPMENT_SLOT_TABARD); } else { // pCaster may have been NULL (usually not expected, but may happen at disconnect, etc) // OR // pCaster is not player, data is taken from CreatureDisplayInfoExtraEntry by model already data << (uint8)0; data << (uint8)0; data << (uint8)0; data << (uint8)0; data << (uint8)0; data << (uint32)0; for (int i = 0; i < 11; ++i) data << (uint32)0; } SendPacket(&data); }
void WorldSession::HandleMirrorImageDataRequest(WorldPacket& recvData) { DEBUG_LOG("WORLD: Recvd CMSG_GET_MIRRORIMAGE_DATA Message"); uint64 guid; recvData >> guid; // Get unit for which data is needed by client Unit* unit = ObjectAccessor::GetObjectInWorld(guid, (Unit*)NULL); if (!unit) return; if (!unit->HasAuraType(SPELL_AURA_CLONE_CASTER)) return; // Get creator of the unit (SPELL_AURA_CLONE_CASTER does not stack) Unit* creator = unit->GetAurasByType(SPELL_AURA_CLONE_CASTER).front()->GetCaster(); if (!creator) return; WorldPacket data(SMSG_MIRRORIMAGE_DATA, 68); data << uint64(guid); data << uint32(creator->GetDisplayId()); data << uint8(creator->getRace()); data << uint8(creator->getGender()); if (creator->GetTypeId() == TYPEID_PLAYER) { Player* player = creator->ToPlayer(); data << uint8(player->GetByteValue(PLAYER_BYTES, 0)); // skin data << uint8(player->GetByteValue(PLAYER_BYTES, 1)); // face data << uint8(player->GetByteValue(PLAYER_BYTES, 2)); // hair data << uint8(player->GetByteValue(PLAYER_BYTES, 3)); // haircolor data << uint8(player->GetByteValue(PLAYER_BYTES_2, 0)); // facialhair data << uint32(player->GetGuildId()); // guildId static EquipmentSlots const itemSlots[] = { EQUIPMENT_SLOT_HEAD, EQUIPMENT_SLOT_SHOULDERS, EQUIPMENT_SLOT_BODY, EQUIPMENT_SLOT_CHEST, EQUIPMENT_SLOT_WAIST, EQUIPMENT_SLOT_LEGS, EQUIPMENT_SLOT_FEET, EQUIPMENT_SLOT_WRISTS, EQUIPMENT_SLOT_HANDS, EQUIPMENT_SLOT_BACK, EQUIPMENT_SLOT_TABARD, EQUIPMENT_SLOT_END }; // Display items in visible slots for (EquipmentSlots const* itr = &itemSlots[0]; *itr != EQUIPMENT_SLOT_END; ++itr) { if (*itr == EQUIPMENT_SLOT_HEAD && player->HasFlag(PLAYER_FLAGS, PLAYER_FLAGS_HIDE_HELM)) data << uint32(0); else if (*itr == EQUIPMENT_SLOT_BACK && player->HasFlag(PLAYER_FLAGS, PLAYER_FLAGS_HIDE_CLOAK)) data << uint32(0); else if (Item const* item = player->GetItemByPos(INVENTORY_SLOT_BAG_0, *itr)) data << uint32(item->GetProto()->DisplayInfoID); else data << uint32(0); } } else { // Skip player data for creatures data << uint8(0); data << uint32(0); data << uint32(0); data << uint32(0); data << uint32(0); data << uint32(0); data << uint32(0); data << uint32(0); data << uint32(0); data << uint32(0); data << uint32(0); data << uint32(0); data << uint32(0); data << uint32(0); } SendPacket(&data); }
void WarlockSpellHandler::HandleSchoolDmg(Spell *spell,int32 &damage,SpellEffectIndex i) { const SpellEntry* m_spellInfo = spell->m_spellInfo; Unit* m_caster = spell->GetCaster(); Unit* unitTarget = spell->getUnitTarget(); // Incinerate Rank 1 & 2 if ((m_spellInfo->SpellFamilyFlags & FLAG_INCINERATE) && m_spellInfo->SpellIconID==2128) { // Incinerate does more dmg (dmg*0.25) if the target have Immolate debuff. // Check aura state for speed but aura state set not only for Immolate spell if(unitTarget->HasAuraState(AURA_STATE_CONFLAGRATE)) { Unit::AuraList const& RejorRegr = unitTarget->GetAurasByType(SPELL_AURA_PERIODIC_DAMAGE); for(Unit::AuraList::const_iterator i = RejorRegr.begin(); i != RejorRegr.end(); ++i) { // Immolate if((*i)->GetSpellProto()->SpellFamilyName == SPELLFAMILY_WARLOCK && ((*i)->GetSpellProto()->SpellFamilyFlags & FLAG_IMMOLATE)) { damage += damage/4; break; } } } } // Shadowflame else if (m_spellInfo->SpellFamilyFlags & FLAG_SHADOWFLAME) { // Apply DOT part switch(m_spellInfo->Id) { case 47897: m_caster->CastSpell(unitTarget, 47960, true); break; case 61290: m_caster->CastSpell(unitTarget, 61291, true); break; default: sLog.outError("Spell::EffectDummy: Unhandeled Shadowflame spell rank %u",m_spellInfo->Id); break; } } // Conflagrate - consumes Immolate or Shadowflame else if (m_spellInfo->TargetAuraState == AURA_STATE_CONFLAGRATE) { Aura const* aura = NULL; // found req. aura for damage calculation Unit::AuraList const &mPeriodic = unitTarget->GetAurasByType(SPELL_AURA_PERIODIC_DAMAGE); for(Unit::AuraList::const_iterator i = mPeriodic.begin(); i != mPeriodic.end(); ++i) { // for caster applied auras only if ((*i)->GetSpellProto()->SpellFamilyName != SPELLFAMILY_WARLOCK || (*i)->GetCasterGUID()!=m_caster->GetGUID()) continue; // Shadowflame if ((*i)->GetSpellProto()->SpellFamilyFlags2 & 0x00000002) aura = *i; // remember but wait possible Immolate as primary priority // Immolate if ((*i)->GetSpellProto()->SpellFamilyFlags & FLAG_IMMOLATE) aura = *i; // it selected always if exist } // found Immolate or Shadowflame if (aura) { // DoT not have applied spell bonuses in m_amount int32 damagetick = m_caster->SpellDamageBonus(unitTarget, aura->GetSpellProto(), aura->GetModifier()->m_amount, DOT); // Save value of further damage spell->m_currentBasePoints[1] = damagetick * 2 / 3; damage += damagetick * 2; // Glyph of Conflagrate if (!m_caster->HasAura(56235)) unitTarget->RemoveAurasByCasterSpell(aura->GetId(), m_caster->GetGUID()); } } }