Core/Player: Changed ranged weapons to be equipped in main hand slot instead of no longer used ranged slot

Closes #14675
Closes #15296
This commit is contained in:
Shauren
2015-09-27 00:06:08 +02:00
parent e51b660177
commit 3bc3b67a8f
13 changed files with 69 additions and 104 deletions
+1 -1
View File
@@ -444,7 +444,7 @@ enum ItemSubclassWeapon
#define ITEM_SUBCLASS_MASK_WEAPON_RANGED (\
(1 << ITEM_SUBCLASS_WEAPON_BOW) | (1 << ITEM_SUBCLASS_WEAPON_GUN) |\
(1 << ITEM_SUBCLASS_WEAPON_CROSSBOW) | (1 << ITEM_SUBCLASS_WEAPON_THROWN))
(1 << ITEM_SUBCLASS_WEAPON_CROSSBOW))
#define MAX_ITEM_SUBCLASS_WEAPON 21
+46 -86
View File
@@ -7503,7 +7503,7 @@ void Player::_ApplyItemMods(Item* item, uint8 slot, bool apply)
TC_LOG_DEBUG("entities.player.items", "applying mods for item %s", item->GetGUID().ToString().c_str());
uint8 attacktype = Player::GetAttackBySlot(slot);
uint8 attacktype = Player::GetAttackBySlot(slot, item->GetTemplate()->GetInventoryType());
if (item->GetSocketColor(0)) //only (un)equipping of items with sockets can influence metagems, so no need to waste time with normal items
CorrectMetaGemEnchants(slot, apply);
@@ -7750,9 +7750,7 @@ void Player::_ApplyItemBonuses(Item* item, uint8 slot, bool apply)
WeaponAttackType attType = BASE_ATTACK;
if (slot == EQUIPMENT_SLOT_RANGED && (
proto->GetInventoryType() == INVTYPE_RANGED || proto->GetInventoryType() == INVTYPE_THROWN ||
proto->GetInventoryType() == INVTYPE_RANGEDRIGHT))
if (slot == EQUIPMENT_SLOT_MAINHAND && (proto->GetInventoryType() == INVTYPE_RANGED || proto->GetInventoryType() == INVTYPE_RANGEDRIGHT))
{
attType = RANGED_ATTACK;
}
@@ -7771,16 +7769,10 @@ void Player::_ApplyWeaponDamage(uint8 slot, Item* item, bool apply)
WeaponAttackType attType = BASE_ATTACK;
float damage = 0.0f;
if (slot == EQUIPMENT_SLOT_RANGED && (
proto->GetInventoryType() == INVTYPE_RANGED || proto->GetInventoryType() == INVTYPE_THROWN ||
proto->GetInventoryType() == INVTYPE_RANGEDRIGHT))
{
if (slot == EQUIPMENT_SLOT_MAINHAND && (proto->GetInventoryType() == INVTYPE_RANGED || proto->GetInventoryType() == INVTYPE_RANGEDRIGHT))
attType = RANGED_ATTACK;
}
else if (slot == EQUIPMENT_SLOT_OFFHAND)
{
attType = OFF_ATTACK;
}
float minDamage, maxDamage;
item->GetDamage(this, minDamage, maxDamage);
@@ -7798,14 +7790,7 @@ void Player::_ApplyWeaponDamage(uint8 slot, Item* item, bool apply)
}
if (proto->GetDelay() && !IsInFeralForm())
{
if (slot == EQUIPMENT_SLOT_RANGED)
SetAttackTime(RANGED_ATTACK, apply ? proto->GetDelay() : BASE_ATTACK_TIME);
else if (slot == EQUIPMENT_SLOT_MAINHAND)
SetAttackTime(BASE_ATTACK, apply ? proto->GetDelay() : BASE_ATTACK_TIME);
else if (slot == EQUIPMENT_SLOT_OFFHAND)
SetAttackTime(OFF_ATTACK, apply ? proto->GetDelay() : BASE_ATTACK_TIME);
}
SetAttackTime(attType, apply ? proto->GetDelay() : BASE_ATTACK_TIME);
if (CanModifyStats() && (damage || proto->GetDelay()))
UpdateDamagePhysical(attType);
@@ -7959,7 +7944,7 @@ void Player::UpdateEquipSpellsAtFormChange()
{
for (uint8 i = 0; i < INVENTORY_SLOT_BAG_END; ++i)
{
if (m_items[i] && !m_items[i]->IsBroken() && CanUseAttackType(GetAttackBySlot(i)))
if (m_items[i] && !m_items[i]->IsBroken() && CanUseAttackType(Player::GetAttackBySlot(i, m_items[i]->GetTemplate()->GetInventoryType())))
{
ApplyItemEquipSpell(m_items[i], false, true); // remove spells that not fit to form
ApplyItemEquipSpell(m_items[i], true, true); // add spells that fit form but not active
@@ -8014,7 +7999,7 @@ void Player::CastItemCombatSpell(Unit* target, WeaponAttackType attType, uint32
{
case BASE_ATTACK: slot = EQUIPMENT_SLOT_MAINHAND; break;
case OFF_ATTACK: slot = EQUIPMENT_SLOT_OFFHAND; break;
case RANGED_ATTACK: slot = EQUIPMENT_SLOT_RANGED; break;
case RANGED_ATTACK: slot = EQUIPMENT_SLOT_MAINHAND; break;
default: slot = EQUIPMENT_SLOT_END; break;
}
if (slot != i)
@@ -8233,7 +8218,7 @@ void Player::_RemoveAllItemMods()
if (proto->GetItemSet())
RemoveItemsSetItem(this, proto);
if (m_items[i]->IsBroken() || !CanUseAttackType(GetAttackBySlot(i)))
if (m_items[i]->IsBroken() || !CanUseAttackType(Player::GetAttackBySlot(i, m_items[i]->GetTemplate()->GetInventoryType())))
continue;
ApplyItemEquipSpell(m_items[i], false);
@@ -8245,10 +8230,10 @@ void Player::_RemoveAllItemMods()
{
if (m_items[i])
{
if (m_items[i]->IsBroken() || !CanUseAttackType(GetAttackBySlot(i)))
if (m_items[i]->IsBroken() || !CanUseAttackType(Player::GetAttackBySlot(i, m_items[i]->GetTemplate()->GetInventoryType())))
continue;
uint32 attacktype = Player::GetAttackBySlot(i);
uint32 attacktype = Player::GetAttackBySlot(i, m_items[i]->GetTemplate()->GetInventoryType());
if (attacktype < MAX_ATTACK)
_ApplyWeaponDependentAuraMods(m_items[i], WeaponAttackType(attacktype), false);
@@ -8267,10 +8252,10 @@ void Player::_ApplyAllItemMods()
{
if (m_items[i])
{
if (m_items[i]->IsBroken() || !CanUseAttackType(GetAttackBySlot(i)))
if (m_items[i]->IsBroken() || !CanUseAttackType(Player::GetAttackBySlot(i, m_items[i]->GetTemplate()->GetInventoryType())))
continue;
uint32 attacktype = Player::GetAttackBySlot(i);
uint32 attacktype = Player::GetAttackBySlot(i, m_items[i]->GetTemplate()->GetInventoryType());
if (attacktype < MAX_ATTACK)
_ApplyWeaponDependentAuraMods(m_items[i], WeaponAttackType(attacktype), true);
@@ -8290,7 +8275,7 @@ void Player::_ApplyAllItemMods()
if (proto->GetItemSet())
AddItemsSetItem(this, m_items[i]);
if (m_items[i]->IsBroken() || !CanUseAttackType(GetAttackBySlot(i)))
if (m_items[i]->IsBroken() || !CanUseAttackType(Player::GetAttackBySlot(i, m_items[i]->GetTemplate()->GetInventoryType())))
continue;
ApplyItemEquipSpell(m_items[i], true);
@@ -8307,7 +8292,7 @@ void Player::_ApplyAllLevelScaleItemMods(bool apply)
{
if (m_items[i])
{
if (m_items[i]->IsBroken() || !CanUseAttackType(GetAttackBySlot(i)))
if (m_items[i]->IsBroken() || !CanUseAttackType(Player::GetAttackBySlot(i, m_items[i]->GetTemplate()->GetInventoryType())))
continue;
_ApplyItemBonuses(m_items[i], i, apply);
@@ -9469,8 +9454,6 @@ void Player::SetSheath(SheathState sheathed)
uint8 Player::FindEquipSlot(ItemTemplate const* proto, uint32 slot, bool swap) const
{
uint8 playerClass = getClass();
uint8 slots[4];
slots[0] = NULL_SLOT;
slots[1] = NULL_SLOT;
@@ -9536,31 +9519,11 @@ uint8 Player::FindEquipSlot(ItemTemplate const* proto, uint32 slot, bool swap) c
slots[0] = EQUIPMENT_SLOT_OFFHAND;
break;
case INVTYPE_RANGED:
slots[0] = EQUIPMENT_SLOT_RANGED;
slots[0] = EQUIPMENT_SLOT_MAINHAND;
break;
case INVTYPE_2HWEAPON:
slots[0] = EQUIPMENT_SLOT_MAINHAND;
if (Item* mhWeapon = GetItemByPos(INVENTORY_SLOT_BAG_0, EQUIPMENT_SLOT_MAINHAND))
{
if (ItemTemplate const* mhWeaponProto = mhWeapon->GetTemplate())
{
if (mhWeaponProto->GetSubClass() == ITEM_SUBCLASS_WEAPON_POLEARM || mhWeaponProto->GetSubClass() == ITEM_SUBCLASS_WEAPON_STAFF)
{
const_cast<Player*>(this)->AutoUnequipOffhandIfNeed(true);
break;
}
}
}
if (GetItemByPos(INVENTORY_SLOT_BAG_0, EQUIPMENT_SLOT_OFFHAND))
{
if (proto->GetSubClass() == ITEM_SUBCLASS_WEAPON_POLEARM || proto->GetSubClass() == ITEM_SUBCLASS_WEAPON_STAFF)
{
const_cast<Player*>(this)->AutoUnequipOffhandIfNeed(true);
break;
}
}
if (CanDualWield() && CanTitanGrip() && proto->GetSubClass() != ITEM_SUBCLASS_WEAPON_POLEARM && proto->GetSubClass() != ITEM_SUBCLASS_WEAPON_STAFF)
if (CanDualWield() && CanTitanGrip())
slots[1] = EQUIPMENT_SLOT_OFFHAND;
break;
case INVTYPE_TABARD:
@@ -9575,11 +9538,8 @@ uint8 Player::FindEquipSlot(ItemTemplate const* proto, uint32 slot, bool swap) c
case INVTYPE_HOLDABLE:
slots[0] = EQUIPMENT_SLOT_OFFHAND;
break;
case INVTYPE_THROWN:
slots[0] = EQUIPMENT_SLOT_RANGED;
break;
case INVTYPE_RANGEDRIGHT:
slots[0] = EQUIPMENT_SLOT_RANGED;
slots[0] = EQUIPMENT_SLOT_MAINHAND;
break;
case INVTYPE_BAG:
slots[0] = INVENTORY_SLOT_BAG_START + 0;
@@ -9587,13 +9547,6 @@ uint8 Player::FindEquipSlot(ItemTemplate const* proto, uint32 slot, bool swap) c
slots[2] = INVENTORY_SLOT_BAG_START + 2;
slots[3] = INVENTORY_SLOT_BAG_START + 3;
break;
case INVTYPE_RELIC:
{
if (playerClass == CLASS_PALADIN || playerClass == CLASS_DRUID ||
playerClass == CLASS_SHAMAN || playerClass == CLASS_DEATH_KNIGHT)
slots[0] = EQUIPMENT_SLOT_RANGED;
break;
}
default:
return NULL_SLOT;
}
@@ -9786,9 +9739,14 @@ Item* Player::GetItemByPos(uint8 bag, uint8 slot) const
//Does additional check for disarmed weapons
Item* Player::GetUseableItemByPos(uint8 bag, uint8 slot) const
{
if (!CanUseAttackType(GetAttackBySlot(slot)))
return NULL;
return GetItemByPos(bag, slot);
Item* item = GetItemByPos(bag, slot);
if (!item)
return nullptr;
if (!CanUseAttackType(GetAttackBySlot(slot, item->GetTemplate()->GetInventoryType())))
return nullptr;
return item;
}
Bag* Player::GetBagByPos(uint8 bag) const
@@ -9807,7 +9765,7 @@ Item* Player::GetWeaponForAttack(WeaponAttackType attackType, bool useable /*= f
{
case BASE_ATTACK: slot = EQUIPMENT_SLOT_MAINHAND; break;
case OFF_ATTACK: slot = EQUIPMENT_SLOT_OFFHAND; break;
case RANGED_ATTACK: slot = EQUIPMENT_SLOT_RANGED; break;
case RANGED_ATTACK: slot = EQUIPMENT_SLOT_MAINHAND; break;
default: return NULL;
}
@@ -9847,13 +9805,12 @@ Item* Player::GetShield(bool useable) const
return item;
}
uint8 Player::GetAttackBySlot(uint8 slot)
uint8 Player::GetAttackBySlot(uint8 slot, InventoryType inventoryType)
{
switch (slot)
{
case EQUIPMENT_SLOT_MAINHAND: return BASE_ATTACK;
case EQUIPMENT_SLOT_MAINHAND: return inventoryType != INVTYPE_RANGED && inventoryType != INVTYPE_RANGEDRIGHT ? BASE_ATTACK : RANGED_ATTACK;
case EQUIPMENT_SLOT_OFFHAND: return OFF_ATTACK;
case EQUIPMENT_SLOT_RANGED: return RANGED_ATTACK;
default: return MAX_ATTACK;
}
}
@@ -11675,7 +11632,6 @@ Item* Player::EquipItem(uint16 pos, Item* pItem, bool update)
{
case EQUIPMENT_SLOT_MAINHAND:
case EQUIPMENT_SLOT_OFFHAND:
case EQUIPMENT_SLOT_RANGED:
RecalculateRating(CR_ARMOR_PENETRATION);
default:
break;
@@ -11838,7 +11794,6 @@ void Player::RemoveItem(uint8 bag, uint8 slot, bool update)
{
case EQUIPMENT_SLOT_MAINHAND:
case EQUIPMENT_SLOT_OFFHAND:
case EQUIPMENT_SLOT_RANGED:
RecalculateRating(CR_ARMOR_PENETRATION);
default:
break;
@@ -11968,7 +11923,6 @@ void Player::DestroyItem(uint8 bag, uint8 slot, bool update)
{
case EQUIPMENT_SLOT_MAINHAND:
case EQUIPMENT_SLOT_OFFHAND:
case EQUIPMENT_SLOT_RANGED:
RecalculateRating(CR_ARMOR_PENETRATION);
default:
break;
@@ -12891,7 +12845,13 @@ bool Player::IsUseEquipedWeapon(bool mainhand) const
bool Player::IsTwoHandUsed() const
{
Item* mainItem = GetItemByPos(INVENTORY_SLOT_BAG_0, EQUIPMENT_SLOT_MAINHAND);
return mainItem && mainItem->GetTemplate()->GetInventoryType() == INVTYPE_2HWEAPON && !CanTitanGrip();
if (!mainItem)
return false;
ItemTemplate const* itemTemplate = mainItem->GetTemplate();
return (itemTemplate->GetInventoryType() == INVTYPE_2HWEAPON && !CanTitanGrip()) ||
itemTemplate->GetInventoryType() == INVTYPE_RANGED ||
(itemTemplate->GetInventoryType() == INVTYPE_RANGEDRIGHT && itemTemplate->GetClass() == ITEM_CLASS_WEAPON && itemTemplate->GetSubClass() != ITEM_SUBCLASS_WEAPON_WAND);
}
void Player::TradeCancel(bool sendback)
@@ -13151,11 +13111,14 @@ void Player::ApplyEnchantment(Item* item, EnchantmentSlot slot, bool apply, bool
break;
case ITEM_ENCHANTMENT_TYPE_DAMAGE:
if (item->GetSlot() == EQUIPMENT_SLOT_MAINHAND)
HandleStatModifier(UNIT_MOD_DAMAGE_MAINHAND, TOTAL_VALUE, float(enchant_amount), apply);
{
if (item->GetTemplate()->GetInventoryType() != INVTYPE_RANGED && item->GetTemplate()->GetInventoryType() != INVTYPE_RANGEDRIGHT)
HandleStatModifier(UNIT_MOD_DAMAGE_MAINHAND, TOTAL_VALUE, float(enchant_amount), apply);
else
HandleStatModifier(UNIT_MOD_DAMAGE_RANGED, TOTAL_VALUE, float(enchant_amount), apply);
}
else if (item->GetSlot() == EQUIPMENT_SLOT_OFFHAND)
HandleStatModifier(UNIT_MOD_DAMAGE_OFFHAND, TOTAL_VALUE, float(enchant_amount), apply);
else if (item->GetSlot() == EQUIPMENT_SLOT_RANGED)
HandleStatModifier(UNIT_MOD_DAMAGE_RANGED, TOTAL_VALUE, float(enchant_amount), apply);
break;
case ITEM_ENCHANTMENT_TYPE_EQUIP_SPELL:
if (enchant_spell_id)
@@ -23421,10 +23384,12 @@ bool Player::HasItemFitToSpellRequirements(SpellInfo const* spellInfo, Item cons
{
case ITEM_CLASS_WEAPON:
{
for (uint8 i = EQUIPMENT_SLOT_MAINHAND; i < EQUIPMENT_SLOT_TABARD; ++i)
if (Item* item = GetUseableItemByPos(INVENTORY_SLOT_BAG_0, i))
if (item != ignoreItem && item->IsFitToSpellRequirements(spellInfo))
return true;
if (Item* item = GetUseableItemByPos(INVENTORY_SLOT_BAG_0, EQUIPMENT_SLOT_MAINHAND))
if (item != ignoreItem && item->IsFitToSpellRequirements(spellInfo))
return true;
if (Item* item = GetUseableItemByPos(INVENTORY_SLOT_BAG_0, EQUIPMENT_SLOT_OFFHAND))
if (item != ignoreItem && item->IsFitToSpellRequirements(spellInfo))
return true;
break;
}
case ITEM_CLASS_ARMOR:
@@ -23440,11 +23405,6 @@ bool Player::HasItemFitToSpellRequirements(SpellInfo const* spellInfo, Item cons
if (item != ignoreItem && item->IsFitToSpellRequirements(spellInfo))
return true;
// ranged slot can have some armor subclasses
if (Item* item = GetUseableItemByPos(INVENTORY_SLOT_BAG_0, EQUIPMENT_SLOT_RANGED))
if (item != ignoreItem && item->IsFitToSpellRequirements(spellInfo))
return true;
break;
}
default:
+1 -1
View File
@@ -1408,7 +1408,7 @@ class Player : public Unit, public GridObject<Player>
Bag* GetBagByPos(uint8 slot) const;
Item* GetWeaponForAttack(WeaponAttackType attackType, bool useable = false) const;
Item* GetShield(bool useable = false) const;
static uint8 GetAttackBySlot(uint8 slot); // MAX_ATTACK if not weapon slot
static uint8 GetAttackBySlot(uint8 slot, InventoryType inventoryType); // MAX_ATTACK if not weapon slot
std::vector<Item*> &GetItemUpdateQueue() { return m_itemUpdateQueue; }
static bool IsInventoryPos(uint16 pos) { return IsInventoryPos(pos >> 8, pos & 255); }
static bool IsInventoryPos(uint8 bag, uint8 slot);
+2 -4
View File
@@ -5917,7 +5917,7 @@ bool Unit::HandleDummyAuraProc(Unit* victim, uint32 damage, AuraEffect* triggere
if (triggeredByAura->GetBase() && castItem->GetGUID() != triggeredByAura->GetBase()->GetCastItemGUID())
return false;
WeaponAttackType attType = WeaponAttackType(player->GetAttackBySlot(castItem->GetSlot()));
WeaponAttackType attType = WeaponAttackType(player->GetAttackBySlot(castItem->GetSlot(), castItem->GetTemplate()->GetInventoryType()));
if ((attType != BASE_ATTACK && attType != OFF_ATTACK)
|| (attType == BASE_ATTACK && procFlag & PROC_FLAG_DONE_OFFHAND_ATTACK)
|| (attType == OFF_ATTACK && procFlag & PROC_FLAG_DONE_MAINHAND_ATTACK))
@@ -13286,12 +13286,10 @@ bool Unit::IsTriggeredAtSpellProcEvent(Unit* victim, Aura* aura, SpellInfo const
if (spellProto->EquippedItemClass == ITEM_CLASS_WEAPON)
{
Item* item = NULL;
if (attType == BASE_ATTACK)
if (attType == BASE_ATTACK || attType == RANGED_ATTACK)
item = player->GetUseableItemByPos(INVENTORY_SLOT_BAG_0, EQUIPMENT_SLOT_MAINHAND);
else if (attType == OFF_ATTACK)
item = player->GetUseableItemByPos(INVENTORY_SLOT_BAG_0, EQUIPMENT_SLOT_OFFHAND);
else
item = player->GetUseableItemByPos(INVENTORY_SLOT_BAG_0, EQUIPMENT_SLOT_RANGED);
if (player->IsInFeralForm())
return false;
@@ -1689,7 +1689,7 @@ void WorldSession::HandleUseEquipmentSet(WorldPackets::EquipmentSet::UseEquipmen
continue;
// Only equip weapons in combat
if (_player->IsInCombat() && i != EQUIPMENT_SLOT_MAINHAND && i != EQUIPMENT_SLOT_OFFHAND && i != EQUIPMENT_SLOT_RANGED)
if (_player->IsInCombat() && i != EQUIPMENT_SLOT_MAINHAND && i != EQUIPMENT_SLOT_OFFHAND)
continue;
Item* item = _player->GetItemByGuid(useEquipmentSet.Items[i].Item);
+1 -1
View File
@@ -423,7 +423,7 @@ void WorldSession::HandleCancelMountAuraOpcode(WorldPackets::Spells::CancelMount
});
}
void WorldSession::HandleCancelAutoRepeatSpellOpcode(WorldPacket& /*recvPacket*/)
void WorldSession::HandleCancelAutoRepeatSpellOpcode(WorldPackets::Spells::CancelAutoRepeatSpell& /*cancelAutoRepeatSpell*/)
{
// may be better send SMSG_CANCEL_AUTO_REPEAT?
// cancel and prepare for deleting
@@ -38,6 +38,14 @@ namespace WorldPackets
int32 SpellID = 0;
};
class CancelAutoRepeatSpell final : public ClientPacket
{
public:
CancelAutoRepeatSpell(WorldPacket&& packet) : ClientPacket(CMSG_CANCEL_AUTO_REPEAT_SPELL, std::move(packet)) { }
void Read() override { }
};
class CancelGrowthAura final : public ClientPacket
{
public:
+1 -1
View File
@@ -250,7 +250,7 @@ void OpcodeTable::Initialize()
DEFINE_HANDLER(CMSG_CALENDAR_REMOVE_INVITE, STATUS_LOGGEDIN, PROCESS_THREADUNSAFE, WorldPackets::Calendar::CalendarRemoveInvite, &WorldSession::HandleCalendarEventRemoveInvite);
DEFINE_HANDLER(CMSG_CALENDAR_UPDATE_EVENT, STATUS_LOGGEDIN, PROCESS_THREADUNSAFE, WorldPackets::Calendar::CalendarUpdateEvent, &WorldSession::HandleCalendarUpdateEvent);
DEFINE_HANDLER(CMSG_CANCEL_AURA, STATUS_LOGGEDIN, PROCESS_THREADUNSAFE, WorldPackets::Spells::CancelAura, &WorldSession::HandleCancelAuraOpcode);
DEFINE_OPCODE_HANDLER_OLD(CMSG_CANCEL_AUTO_REPEAT_SPELL, STATUS_UNHANDLED, PROCESS_THREADUNSAFE, &WorldSession::HandleCancelAutoRepeatSpellOpcode);
DEFINE_HANDLER(CMSG_CANCEL_AUTO_REPEAT_SPELL, STATUS_LOGGEDIN, PROCESS_THREADUNSAFE, WorldPackets::Spells::CancelAutoRepeatSpell, &WorldSession::HandleCancelAutoRepeatSpellOpcode);
DEFINE_HANDLER(CMSG_CANCEL_CAST, STATUS_LOGGEDIN, PROCESS_THREADSAFE, WorldPackets::Spells::CancelCast, &WorldSession::HandleCancelCastOpcode);
DEFINE_OPCODE_HANDLER_OLD(CMSG_CANCEL_CHANNELLING, STATUS_UNHANDLED, PROCESS_THREADUNSAFE, &WorldSession::HandleCancelChanneling );
DEFINE_HANDLER(CMSG_CANCEL_GROWTH_AURA, STATUS_LOGGEDIN, PROCESS_THREADUNSAFE, WorldPackets::Spells::CancelGrowthAura, &WorldSession::HandleCancelGrowthAuraOpcode);
+2 -1
View File
@@ -537,6 +537,7 @@ namespace WorldPackets
namespace Spells
{
class CancelAura;
class CancelAutoRepeatSpell;
class CancelGrowthAura;
class CancelMountAura;
class RequestCategoryCooldowns;
@@ -1341,7 +1342,7 @@ class WorldSession
void HandleCancelAuraOpcode(WorldPackets::Spells::CancelAura& cancelAura);
void HandleCancelGrowthAuraOpcode(WorldPackets::Spells::CancelGrowthAura& cancelGrowthAura);
void HandleCancelMountAuraOpcode(WorldPackets::Spells::CancelMountAura& cancelMountAura);
void HandleCancelAutoRepeatSpellOpcode(WorldPacket& recvPacket);
void HandleCancelAutoRepeatSpellOpcode(WorldPackets::Spells::CancelAutoRepeatSpell& cancelAutoRepeatSpell);
void HandleLearnTalentsOpcode(WorldPackets::Talent::LearnTalents& packet);
void HandleConfirmRespecWipeOpcode(WorldPacket& recvPacket);
@@ -2396,7 +2396,7 @@ void AuraEffect::HandleAuraModDisarm(AuraApplication const* aurApp, uint8 mode,
case SPELL_AURA_MOD_DISARM_RANGED:
field = UNIT_FIELD_FLAGS_2;
flag = UNIT_FLAG2_DISARM_RANGED;
slot = EQUIPMENT_SLOT_RANGED;
slot = EQUIPMENT_SLOT_MAINHAND;
attType = RANGED_ATTACK;
break;
default:
@@ -2413,7 +2413,7 @@ void AuraEffect::HandleAuraModDisarm(AuraApplication const* aurApp, uint8 mode,
Player* player = target->ToPlayer();
if (Item* item = player->GetItemByPos(INVENTORY_SLOT_BAG_0, slot))
{
uint8 attacktype = Player::GetAttackBySlot(slot);
uint8 attacktype = Player::GetAttackBySlot(slot, item->GetTemplate()->GetInventoryType());
if (attacktype < MAX_ATTACK)
{
+1 -3
View File
@@ -1885,12 +1885,10 @@ bool Aura::IsProcTriggeredOnEvent(AuraApplication* aurApp, ProcEventInfo& eventI
{
WeaponAttackType attType = eventInfo.GetDamageInfo()->GetAttackType();
Item* item = NULL;
if (attType == BASE_ATTACK)
if (attType == BASE_ATTACK || attType == RANGED_ATTACK)
item = target->ToPlayer()->GetUseableItemByPos(INVENTORY_SLOT_BAG_0, EQUIPMENT_SLOT_MAINHAND);
else if (attType == OFF_ATTACK)
item = target->ToPlayer()->GetUseableItemByPos(INVENTORY_SLOT_BAG_0, EQUIPMENT_SLOT_OFFHAND);
else
item = target->ToPlayer()->GetUseableItemByPos(INVENTORY_SLOT_BAG_0, EQUIPMENT_SLOT_RANGED);
if (!item || item->IsBroken() || item->GetTemplate()->GetClass() != ITEM_CLASS_WEAPON || !((1 << item->GetTemplate()->GetSubClass()) & GetSpellInfo()->EquippedItemSubClassMask))
return false;
@@ -760,7 +760,7 @@ class instance_ulduar : public InstanceMapScript
Map::PlayerList const& players = instance->GetPlayers();
for (Map::PlayerList::const_iterator itr = players.begin(); itr != players.end(); ++itr)
if (Player* player = itr->GetSource())
for (uint8 slot = EQUIPMENT_SLOT_MAINHAND; slot <= EQUIPMENT_SLOT_RANGED; ++slot)
for (uint8 slot = EQUIPMENT_SLOT_MAINHAND; slot <= EQUIPMENT_SLOT_OFFHAND; ++slot)
if (Item* item = player->GetItemByPos(INVENTORY_SLOT_BAG_0, slot))
if (item->GetItemLevel(player) > _maxWeaponItemLevel)
_maxWeaponItemLevel = item->GetItemLevel(player);
@@ -780,7 +780,7 @@ class instance_ulduar : public InstanceMapScript
if (Item* item = player->GetItemByPos(INVENTORY_SLOT_BAG_0, slot))
{
if (slot >= EQUIPMENT_SLOT_MAINHAND && slot <= EQUIPMENT_SLOT_RANGED)
if (slot >= EQUIPMENT_SLOT_MAINHAND && slot <= EQUIPMENT_SLOT_OFFHAND)
{
if (item->GetItemLevel(player) > _maxWeaponItemLevel)
_maxWeaponItemLevel = item->GetItemLevel(player);
+1 -1
View File
@@ -921,7 +921,7 @@ class spell_gen_clone_weapon_aura : public SpellScriptLoader
if (Player* player = caster->ToPlayer())
{
if (Item* rangedItem = player->GetItemByPos(INVENTORY_SLOT_BAG_0, EQUIPMENT_SLOT_RANGED))
if (Item* rangedItem = player->GetItemByPos(INVENTORY_SLOT_BAG_0, EQUIPMENT_SLOT_MAINHAND))
target->SetVirtualItem(2, rangedItem->GetEntry());
}
else