diff options
Diffstat (limited to 'src/server/game/Spells/SpellEffects.cpp')
-rw-r--r-- | src/server/game/Spells/SpellEffects.cpp | 51 |
1 files changed, 25 insertions, 26 deletions
diff --git a/src/server/game/Spells/SpellEffects.cpp b/src/server/game/Spells/SpellEffects.cpp index a5e2971c8df..b68b6dfbc04 100644 --- a/src/server/game/Spells/SpellEffects.cpp +++ b/src/server/game/Spells/SpellEffects.cpp @@ -1265,7 +1265,7 @@ void Spell::EffectHeal(SpellEffIndex /*effIndex*/) if (!targetAura) { - TC_LOG_ERROR("spells", "Target(GUID:" UI64FMTD ") has aurastate AURA_STATE_SWIFTMEND but no matching aura.", unitTarget->GetGUID()); + TC_LOG_ERROR("spells", "Target (%s) has aurastate AURA_STATE_SWIFTMEND but no matching aura.", unitTarget->GetGUID().ToString().c_str()); return; } @@ -1461,7 +1461,7 @@ void Spell::DoCreateItem(uint32 /*i*/, uint32 itemtype) // set the "Crafted by ..." property of the item if (pItem->GetTemplate()->Class != ITEM_CLASS_CONSUMABLE && pItem->GetTemplate()->Class != ITEM_CLASS_QUEST && newitemid != 6265 && newitemid != 6948) - pItem->SetUInt32Value(ITEM_FIELD_CREATOR, player->GetGUIDLow()); + pItem->SetGuidValue(ITEM_FIELD_CREATOR, player->GetGUID()); // send info to the client player->SendNewItem(pItem, num_to_add, true, bgType == 0); @@ -1713,7 +1713,7 @@ void Spell::EffectEnergizePct(SpellEffIndex effIndex) m_caster->EnergizeBySpell(unitTarget, m_spellInfo->Id, gain, power); } -void Spell::SendLoot(uint64 guid, LootType loottype) +void Spell::SendLoot(ObjectGuid guid, LootType loottype) { Player* player = m_caster->ToPlayer(); if (!player) @@ -1795,7 +1795,7 @@ void Spell::EffectOpenLock(SpellEffIndex effIndex) Player* player = m_caster->ToPlayer(); uint32 lockId = 0; - uint64 guid = 0; + ObjectGuid guid; // Get lockId if (gameObjTarget) @@ -1938,7 +1938,7 @@ void Spell::EffectSummonChangeItem(SpellEffIndex effIndex) m_targets.SetItemTarget(NULL); m_CastItem = NULL; - m_castItemGUID = 0; + m_castItemGUID.Clear(); m_castItemEntry = 0; player->StoreItem(dest, pNewItem, true); @@ -1958,7 +1958,7 @@ void Spell::EffectSummonChangeItem(SpellEffIndex effIndex) m_targets.SetItemTarget(NULL); m_CastItem = NULL; - m_castItemGUID = 0; + m_castItemGUID.Clear(); m_castItemEntry = 0; player->BankItem(dest, pNewItem, true); @@ -1982,7 +1982,7 @@ void Spell::EffectSummonChangeItem(SpellEffIndex effIndex) m_targets.SetItemTarget(NULL); m_CastItem = NULL; - m_castItemGUID = 0; + m_castItemGUID.Clear(); m_castItemEntry = 0; player->EquipItem(dest, pNewItem, true); @@ -2220,7 +2220,6 @@ void Spell::EffectLearnSpell(SpellEffIndex effIndex) TC_LOG_DEBUG("spells", "Spell: Player %u has learned spell %u from NpcGUID=%u", player->GetGUIDLow(), spellToLearn, m_caster->GetGUIDLow()); } -typedef std::list< std::pair<uint32, uint64> > DispelList; void Spell::EffectDispel(SpellEffIndex effIndex) { if (effectHandleMode != SPELL_EFFECT_HANDLE_HIT_TARGET) @@ -2299,8 +2298,8 @@ void Spell::EffectDispel(SpellEffIndex effIndex) WorldPacket dataSuccess(SMSG_SPELLDISPELLOG, 8+8+4+1+4+success_list.size()*5); // Send packet header - dataSuccess.append(unitTarget->GetPackGUID()); // Victim GUID - dataSuccess.append(m_caster->GetPackGUID()); // Caster GUID + dataSuccess << unitTarget->GetPackGUID(); // Victim GUID + dataSuccess << m_caster->GetPackGUID(); // Caster GUID dataSuccess << uint32(m_spellInfo->Id); // dispel spell id dataSuccess << uint8(0); // not used dataSuccess << uint32(success_list.size()); // count @@ -2410,7 +2409,7 @@ void Spell::EffectUntrainTalents(SpellEffIndex /*effIndex*/) if (!unitTarget || m_caster->GetTypeId() == TYPEID_PLAYER) return; - if (uint64 guid = m_caster->GetGUID()) // the trainer is the caster + if (ObjectGuid guid = m_caster->GetGUID()) // the trainer is the caster unitTarget->ToPlayer()->SendTalentWipeConfirm(guid); } @@ -3911,8 +3910,8 @@ void Spell::EffectDuel(SpellEffIndex effIndex) duel2->isMounted = (GetSpellInfo()->Id == 62875); // Mounted Duel target->duel = duel2; - caster->SetUInt64Value(PLAYER_DUEL_ARBITER, pGameObj->GetGUID()); - target->SetUInt64Value(PLAYER_DUEL_ARBITER, pGameObj->GetGUID()); + caster->SetGuidValue(PLAYER_DUEL_ARBITER, pGameObj->GetGUID()); + target->SetGuidValue(PLAYER_DUEL_ARBITER, pGameObj->GetGUID()); sScriptMgr->OnPlayerDuelRequest(target, caster); } @@ -4201,7 +4200,7 @@ void Spell::EffectSummonObject(SpellEffIndex effIndex) uint32 go_id = m_spellInfo->Effects[effIndex].MiscValue; uint8 slot = m_spellInfo->Effects[effIndex].Effect - SPELL_EFFECT_SUMMON_OBJECT_SLOT1; - if (uint64 guid = m_caster->m_ObjectSlot[slot]) + if (ObjectGuid guid = m_caster->m_ObjectSlot[slot]) { if (GameObject* obj = m_caster->GetMap()->GetGameObject(guid)) { @@ -4210,7 +4209,7 @@ void Spell::EffectSummonObject(SpellEffIndex effIndex) obj->SetSpellId(0); m_caster->RemoveGameObject(obj, true); } - m_caster->m_ObjectSlot[slot] = 0; + m_caster->m_ObjectSlot[slot].Clear(); } GameObject* go = new GameObject(); @@ -4454,15 +4453,16 @@ void Spell::EffectCharge(SpellEffIndex /*effIndex*/) if (effectHandleMode == SPELL_EFFECT_HANDLE_LAUNCH_TARGET) { + float speed = G3D::fuzzyGt(m_spellInfo->Speed, 0.0f) ? m_spellInfo->Speed : SPEED_CHARGE; // Spell is not using explicit target - no generated path if (m_preGeneratedPath.GetPathType() == PATHFIND_BLANK) { //unitTarget->GetContactPoint(m_caster, pos.m_positionX, pos.m_positionY, pos.m_positionZ); Position pos = unitTarget->GetFirstCollisionPosition(unitTarget->GetObjectSize(), unitTarget->GetRelativeAngle(m_caster)); - m_caster->GetMotionMaster()->MoveCharge(pos.m_positionX, pos.m_positionY, pos.m_positionZ); + m_caster->GetMotionMaster()->MoveCharge(pos.m_positionX, pos.m_positionY, pos.m_positionZ, speed); } else - m_caster->GetMotionMaster()->MoveCharge(m_preGeneratedPath); + m_caster->GetMotionMaster()->MoveCharge(m_preGeneratedPath, speed); } if (effectHandleMode == SPELL_EFFECT_HANDLE_HIT_TARGET) @@ -4635,9 +4635,7 @@ void Spell::EffectDispelMechanic(SpellEffIndex effIndex) return; uint32 mechanic = m_spellInfo->Effects[effIndex].MiscValue; - - std::queue < std::pair < uint32, uint64 > > dispel_list; - + DispelList dispel_list; Unit::AuraMap const& auras = unitTarget->GetOwnedAuras(); for (Unit::AuraMap::const_iterator itr = auras.begin(); itr != auras.end(); ++itr) { @@ -4646,12 +4644,13 @@ void Spell::EffectDispelMechanic(SpellEffIndex effIndex) continue; if (roll_chance_i(aura->CalcDispelChance(unitTarget, !unitTarget->IsFriendlyTo(m_caster)))) if ((aura->GetSpellInfo()->GetAllEffectsMechanicMask() & (1 << mechanic))) - dispel_list.push(std::make_pair(aura->GetId(), aura->GetCasterGUID())); + dispel_list.push_back(std::make_pair(aura->GetId(), aura->GetCasterGUID())); } - for (; dispel_list.size(); dispel_list.pop()) + while (!dispel_list.empty()) { unitTarget->RemoveAura(dispel_list.front().first, dispel_list.front().second, 0, AURA_REMOVE_BY_ENEMY_SPELL); + dispel_list.pop_front(); } } @@ -4873,7 +4872,7 @@ void Spell::EffectTransmitted(SpellEffIndex effIndex) { case GAMEOBJECT_TYPE_FISHINGNODE: { - m_caster->SetUInt64Value(UNIT_FIELD_CHANNEL_OBJECT, pGameObj->GetGUID()); + m_caster->SetChannelObjectGuid(pGameObj->GetGUID()); m_caster->AddGameObject(pGameObj); // will removed at spell cancel // end time of range when possible catch fish (FISHING_BOBBER_READY_TIME..GetDuration(m_spellInfo)) @@ -5137,8 +5136,8 @@ void Spell::EffectStealBeneficialBuff(SpellEffIndex effIndex) return; WorldPacket dataSuccess(SMSG_SPELLSTEALLOG, 8+8+4+1+4+damage*5); - dataSuccess.append(unitTarget->GetPackGUID()); // Victim GUID - dataSuccess.append(m_caster->GetPackGUID()); // Caster GUID + dataSuccess << unitTarget->GetPackGUID(); // Victim GUID + dataSuccess << m_caster->GetPackGUID(); // Caster GUID dataSuccess << uint32(m_spellInfo->Id); // dispel spell id dataSuccess << uint8(0); // not used dataSuccess << uint32(success_list.size()); // count @@ -5159,7 +5158,7 @@ void Spell::EffectKillCreditPersonal(SpellEffIndex effIndex) if (!unitTarget || unitTarget->GetTypeId() != TYPEID_PLAYER) return; - unitTarget->ToPlayer()->KilledMonsterCredit(m_spellInfo->Effects[effIndex].MiscValue, 0); + unitTarget->ToPlayer()->KilledMonsterCredit(m_spellInfo->Effects[effIndex].MiscValue); } void Spell::EffectKillCredit(SpellEffIndex effIndex) |