Added class EQEmu::InventorySlot

This commit is contained in:
Uleat
2016-10-16 21:36:39 -04:00
parent 8b5dd58e96
commit bfd07b1010
69 changed files with 1852 additions and 1391 deletions
+53 -53
View File
@@ -132,7 +132,7 @@ bool Mob::AttackAnimation(EQEmu::skills::SkillType &skillinuse, int Hand, const
}
// If we're attacking with the secondary hand, play the dual wield anim
if (Hand == EQEmu::legacy::SlotSecondary) // DW anim
if (Hand == EQEmu::inventory::slotSecondary) // DW anim
type = animDualWield;
DoAnim(type);
@@ -373,7 +373,7 @@ bool Mob::AvoidDamage(Mob *other, int32 &damage, int hand)
// riposte -- it may seem crazy, but if the attacker has SPA 173 on them, they are immune to Ripo
bool ImmuneRipo = attacker->aabonuses.RiposteChance || attacker->spellbonuses.RiposteChance || attacker->itembonuses.RiposteChance;
// Need to check if we have something in MainHand to actually attack with (or fists)
if (hand != EQEmu::legacy::SlotRange && (CanThisClassRiposte() || IsEnraged()) && InFront && !ImmuneRipo) {
if (hand != EQEmu::inventory::slotRange && (CanThisClassRiposte() || IsEnraged()) && InFront && !ImmuneRipo) {
if (IsEnraged()) {
damage = -3;
Log.Out(Logs::Detail, Logs::Combat, "I am enraged, riposting frontal attack.");
@@ -395,7 +395,7 @@ bool Mob::AvoidDamage(Mob *other, int32 &damage, int hand)
chance -= chance * counter;
}
// AA Slippery Attacks
if (hand == EQEmu::legacy::SlotSecondary) {
if (hand == EQEmu::inventory::slotSecondary) {
int slip = aabonuses.OffhandRiposteFail + itembonuses.OffhandRiposteFail + spellbonuses.OffhandRiposteFail;
chance += chance * slip / 100;
}
@@ -440,7 +440,7 @@ bool Mob::AvoidDamage(Mob *other, int32 &damage, int hand)
}
// parry
if (CanThisClassParry() && InFront && hand != EQEmu::legacy::SlotRange) {
if (CanThisClassParry() && InFront && hand != EQEmu::inventory::slotRange) {
if (IsClient())
CastToClient()->CheckIncreaseSkill(EQEmu::skills::SkillParry, other, -10);
// check auto discs ... I guess aa/items too :P
@@ -927,7 +927,7 @@ int Mob::GetWeaponDamage(Mob *against, const EQEmu::ItemInstance *weapon_item, u
} else {
bool MagicGloves = false;
if (IsClient()) {
const EQEmu::ItemInstance *gloves = CastToClient()->GetInv().GetItem(EQEmu::legacy::SlotHands);
const EQEmu::ItemInstance *gloves = CastToClient()->GetInv().GetItem(EQEmu::inventory::slotHands);
if (gloves)
MagicGloves = gloves->GetItemMagical(true);
}
@@ -1036,12 +1036,12 @@ bool Client::Attack(Mob* other, int Hand, bool bRiposte, bool IsStrikethrough, b
return false; // Rogean: How can you attack while feigned? Moved up from Aggro Code.
EQEmu::ItemInstance* weapon;
if (Hand == EQEmu::legacy::SlotSecondary){ // Kaiyodo - Pick weapon from the attacking hand
weapon = GetInv().GetItem(EQEmu::legacy::SlotSecondary);
if (Hand == EQEmu::inventory::slotSecondary){ // Kaiyodo - Pick weapon from the attacking hand
weapon = GetInv().GetItem(EQEmu::inventory::slotSecondary);
OffHandAtk(true);
}
else{
weapon = GetInv().GetItem(EQEmu::legacy::SlotPrimary);
weapon = GetInv().GetItem(EQEmu::inventory::slotPrimary);
OffHandAtk(false);
}
@@ -1109,7 +1109,7 @@ bool Client::Attack(Mob* other, int Hand, bool bRiposte, bool IsStrikethrough, b
int ucDamageBonus = 0;
if (Hand == EQEmu::legacy::SlotPrimary && GetLevel() >= 28 && IsWarriorClass())
if (Hand == EQEmu::inventory::slotPrimary && GetLevel() >= 28 && IsWarriorClass())
{
// Damage bonuses apply only to hits from the main hand (Hand == MainPrimary) by characters level 28 and above
// who belong to a melee class. If we're here, then all of these conditions apply.
@@ -1122,7 +1122,7 @@ bool Client::Attack(Mob* other, int Hand, bool bRiposte, bool IsStrikethrough, b
}
#endif
//Live AA - Sinister Strikes *Adds weapon damage bonus to offhand weapon.
if (Hand == EQEmu::legacy::SlotSecondary) {
if (Hand == EQEmu::inventory::slotSecondary) {
if (aabonuses.SecondaryDmgInc || itembonuses.SecondaryDmgInc || spellbonuses.SecondaryDmgInc){
ucDamageBonus = GetWeaponDamageBonus(weapon ? weapon->GetItem() : (const EQEmu::ItemData*) nullptr, true);
@@ -1583,28 +1583,28 @@ bool NPC::Attack(Mob* other, int Hand, bool bRiposte, bool IsStrikethrough, bool
FaceTarget(GetTarget());
EQEmu::skills::SkillType skillinuse = EQEmu::skills::SkillHandtoHand;
if (Hand == EQEmu::legacy::SlotPrimary) {
if (Hand == EQEmu::inventory::slotPrimary) {
skillinuse = static_cast<EQEmu::skills::SkillType>(GetPrimSkill());
OffHandAtk(false);
}
if (Hand == EQEmu::legacy::SlotSecondary) {
if (Hand == EQEmu::inventory::slotSecondary) {
skillinuse = static_cast<EQEmu::skills::SkillType>(GetSecSkill());
OffHandAtk(true);
}
//figure out what weapon they are using, if any
const EQEmu::ItemData* weapon = nullptr;
if (Hand == EQEmu::legacy::SlotPrimary && equipment[EQEmu::legacy::SlotPrimary] > 0)
weapon = database.GetItem(equipment[EQEmu::legacy::SlotPrimary]);
else if (equipment[EQEmu::legacy::SlotSecondary])
weapon = database.GetItem(equipment[EQEmu::legacy::SlotSecondary]);
if (Hand == EQEmu::inventory::slotPrimary && equipment[EQEmu::inventory::slotPrimary] > 0)
weapon = database.GetItem(equipment[EQEmu::inventory::slotPrimary]);
else if (equipment[EQEmu::inventory::slotSecondary])
weapon = database.GetItem(equipment[EQEmu::inventory::slotSecondary]);
//We dont factor much from the weapon into the attack.
//Just the skill type so it doesn't look silly using punching animations and stuff while wielding weapons
if(weapon) {
Log.Out(Logs::Detail, Logs::Combat, "Attacking with weapon: %s (%d) (too bad im not using it for much)", weapon->Name, weapon->ID);
if (Hand == EQEmu::legacy::SlotSecondary && weapon->ItemType == EQEmu::item::ItemTypeShield){
if (Hand == EQEmu::inventory::slotSecondary && weapon->ItemType == EQEmu::item::ItemTypeShield){
Log.Out(Logs::Detail, Logs::Combat, "Attack with shield canceled.");
return false;
}
@@ -3501,7 +3501,7 @@ void Mob::TryDefensiveProc(Mob *on, uint16 hand) {
float ProcChance, ProcBonus;
on->GetDefensiveProcChances(ProcBonus, ProcChance, hand , this);
if (hand != EQEmu::legacy::SlotPrimary)
if (hand != EQEmu::inventory::slotPrimary)
ProcChance /= 2;
int level_penalty = 0;
@@ -3574,7 +3574,7 @@ void Mob::TryWeaponProc(const EQEmu::ItemInstance *inst, const EQEmu::ItemData *
ProcBonus += static_cast<float>(itembonuses.ProcChance) / 10.0f; // Combat Effects
float ProcChance = GetProcChances(ProcBonus, hand);
if (hand != EQEmu::legacy::SlotPrimary) //Is Archery intened to proc at 50% rate?
if (hand != EQEmu::inventory::slotPrimary) //Is Archery intened to proc at 50% rate?
ProcChance /= 2;
// Try innate proc on weapon
@@ -3611,7 +3611,7 @@ void Mob::TryWeaponProc(const EQEmu::ItemInstance *inst, const EQEmu::ItemData *
proced = false;
if (!proced && inst) {
for (int r = 0; r < EQEmu::legacy::ITEM_COMMON_SIZE; r++) {
for (int r = EQEmu::inventory::socketBegin; r < EQEmu::inventory::SocketCount; r++) {
const EQEmu::ItemInstance *aug_i = inst->GetAugment(r);
if (!aug_i) // no aug, try next slot!
continue;
@@ -3652,11 +3652,11 @@ void Mob::TrySpellProc(const EQEmu::ItemInstance *inst, const EQEmu::ItemData *w
float ProcChance = 0.0f;
ProcChance = GetProcChances(ProcBonus, hand);
if (hand != EQEmu::legacy::SlotPrimary) //Is Archery intened to proc at 50% rate?
if (hand != EQEmu::inventory::slotPrimary) //Is Archery intened to proc at 50% rate?
ProcChance /= 2;
bool rangedattk = false;
if (weapon && hand == EQEmu::legacy::SlotRange) {
if (weapon && hand == EQEmu::inventory::slotRange) {
if (weapon->ItemType == EQEmu::item::ItemTypeArrow ||
weapon->ItemType == EQEmu::item::ItemTypeLargeThrowing ||
weapon->ItemType == EQEmu::item::ItemTypeSmallThrowing ||
@@ -3665,11 +3665,11 @@ void Mob::TrySpellProc(const EQEmu::ItemInstance *inst, const EQEmu::ItemData *w
}
}
if (!weapon && hand == EQEmu::legacy::SlotRange && GetSpecialAbility(SPECATK_RANGED_ATK))
if (!weapon && hand == EQEmu::inventory::slotRange && GetSpecialAbility(SPECATK_RANGED_ATK))
rangedattk = true;
for (uint32 i = 0; i < MAX_PROCS; i++) {
if (IsPet() && hand != EQEmu::legacy::SlotPrimary) //Pets can only proc spell procs from their primay hand (ie; beastlord pets)
if (IsPet() && hand != EQEmu::inventory::slotPrimary) //Pets can only proc spell procs from their primay hand (ie; beastlord pets)
continue; // If pets ever can proc from off hand, this will need to change
// Not ranged
@@ -3732,7 +3732,7 @@ void Mob::TrySpellProc(const EQEmu::ItemInstance *inst, const EQEmu::ItemData *w
}
}
if (HasSkillProcs() && hand != EQEmu::legacy::SlotRange){ //We check ranged skill procs within the attack functions.
if (HasSkillProcs() && hand != EQEmu::inventory::slotRange){ //We check ranged skill procs within the attack functions.
uint16 skillinuse = 28;
if (weapon)
skillinuse = GetSkillByItemType(weapon->ItemType);
@@ -3980,7 +3980,7 @@ void Mob::DoRiposte(Mob *defender)
if (!defender)
return;
defender->Attack(this, EQEmu::legacy::SlotPrimary, true);
defender->Attack(this, EQEmu::inventory::slotPrimary, true);
if (HasDied())
return;
@@ -3991,7 +3991,7 @@ void Mob::DoRiposte(Mob *defender)
if (DoubleRipChance && zone->random.Roll(DoubleRipChance)) {
Log.Out(Logs::Detail, Logs::Combat,
"Preforming a double riposted from SE_DoubleRiposte (%d percent chance)", DoubleRipChance);
defender->Attack(this, EQEmu::legacy::SlotPrimary, true);
defender->Attack(this, EQEmu::inventory::slotPrimary, true);
if (HasDied())
return;
}
@@ -4004,7 +4004,7 @@ void Mob::DoRiposte(Mob *defender)
Log.Out(Logs::Detail, Logs::Combat,
"Preforming a double riposted from SE_GiveDoubleRiposte base1 == 0 (%d percent chance)",
DoubleRipChance);
defender->Attack(this, EQEmu::legacy::SlotPrimary, true);
defender->Attack(this, EQEmu::inventory::slotPrimary, true);
if (HasDied())
return;
}
@@ -4288,7 +4288,7 @@ float Mob::GetSkillProcChances(uint16 ReuseTime, uint16 hand) {
if (!ReuseTime && hand) {
weapon_speed = GetWeaponSpeedbyHand(hand);
ProcChance = static_cast<float>(weapon_speed) * (RuleR(Combat, AvgProcsPerMinute) / 60000.0f);
if (hand != EQEmu::legacy::SlotPrimary)
if (hand != EQEmu::inventory::slotPrimary)
ProcChance /= 2;
}
@@ -4478,13 +4478,13 @@ void Client::SetAttackTimer()
Timer *TimerToUse = nullptr;
for (int i = EQEmu::legacy::SlotRange; i <= EQEmu::legacy::SlotSecondary; i++) {
for (int i = EQEmu::inventory::slotRange; i <= EQEmu::inventory::slotSecondary; i++) {
//pick a timer
if (i == EQEmu::legacy::SlotPrimary)
if (i == EQEmu::inventory::slotPrimary)
TimerToUse = &attack_timer;
else if (i == EQEmu::legacy::SlotRange)
else if (i == EQEmu::inventory::slotRange)
TimerToUse = &ranged_timer;
else if (i == EQEmu::legacy::SlotSecondary)
else if (i == EQEmu::inventory::slotSecondary)
TimerToUse = &attack_dw_timer;
else //invalid slot (hands will always hit this)
continue;
@@ -4497,7 +4497,7 @@ void Client::SetAttackTimer()
ItemToUse = ci->GetItem();
//special offhand stuff
if (i == EQEmu::legacy::SlotSecondary) {
if (i == EQEmu::inventory::slotSecondary) {
//if we cant dual wield, skip it
if (!CanThisClassDualWield() || HasTwoHanderEquipped()) {
attack_dw_timer.Disable();
@@ -4571,19 +4571,19 @@ void NPC::SetAttackTimer()
else
speed = static_cast<int>(((attack_delay / haste_mod) + ((hhe / 100.0f) * attack_delay)) * 100);
for (int i = EQEmu::legacy::SlotRange; i <= EQEmu::legacy::SlotSecondary; i++) {
for (int i = EQEmu::inventory::slotRange; i <= EQEmu::inventory::slotSecondary; i++) {
//pick a timer
if (i == EQEmu::legacy::SlotPrimary)
if (i == EQEmu::inventory::slotPrimary)
TimerToUse = &attack_timer;
else if (i == EQEmu::legacy::SlotRange)
else if (i == EQEmu::inventory::slotRange)
TimerToUse = &ranged_timer;
else if (i == EQEmu::legacy::SlotSecondary)
else if (i == EQEmu::inventory::slotSecondary)
TimerToUse = &attack_dw_timer;
else //invalid slot (hands will always hit this)
continue;
//special offhand stuff
if (i == EQEmu::legacy::SlotSecondary) {
if (i == EQEmu::inventory::slotSecondary) {
// SPECATK_QUAD is uncheesable
if(!CanThisClassDualWield() || (HasTwoHanderEquipped() && !GetSpecialAbility(SPECATK_QUAD))) {
attack_dw_timer.Disable();
@@ -4605,7 +4605,7 @@ void Client::DoAttackRounds(Mob *target, int hand, bool IsFromSpell)
bool candouble = CanThisClassDoubleAttack();
// extra off hand non-sense, can only double with skill of 150 or above
// or you have any amount of GiveDoubleAttack
if (candouble && hand == EQEmu::legacy::SlotSecondary)
if (candouble && hand == EQEmu::inventory::slotSecondary)
candouble = GetSkill(EQEmu::skills::SkillDoubleAttack) > 149 || (aabonuses.GiveDoubleAttack + spellbonuses.GiveDoubleAttack + itembonuses.GiveDoubleAttack) > 0;
if (candouble) {
@@ -4613,7 +4613,7 @@ void Client::DoAttackRounds(Mob *target, int hand, bool IsFromSpell)
if (CheckDoubleAttack()) {
Attack(target, hand, false, false, IsFromSpell);
// you can only triple from the main hand
if (hand == EQEmu::legacy::SlotPrimary && CanThisClassTripleAttack()) {
if (hand == EQEmu::inventory::slotPrimary && CanThisClassTripleAttack()) {
CheckIncreaseSkill(EQEmu::skills::SkillTripleAttack, target, -10);
if (CheckTripleAttack())
Attack(target, hand, false, false, IsFromSpell);
@@ -4621,7 +4621,7 @@ void Client::DoAttackRounds(Mob *target, int hand, bool IsFromSpell)
}
}
if (hand == EQEmu::legacy::SlotPrimary) {
if (hand == EQEmu::inventory::slotPrimary) {
// According to http://www.monkly-business.net/forums/showpost.php?p=312095&postcount=168 a dev told them flurry isn't dependant on triple attack
// the parses kind of back that up and all of my parses seemed to be 4 or 5 attacks in the round which would work out to be
// doubles or triples with 2 from flurries or triple with 1 or 2 flurries ... Going with the "dev quote" I guess like we've always had it
@@ -4674,9 +4674,9 @@ void Mob::DoMainHandAttackRounds(Mob *target, ExtraAttackOptions *opts, int spec
if (RuleB(Combat, UseLiveCombatRounds)) {
// A "quad" on live really is just a successful dual wield where both double attack
// The mobs that could triple lost the ability to when the triple attack skill was added in
Attack(target, EQEmu::legacy::SlotPrimary, false, false, false, opts, special);
Attack(target, EQEmu::inventory::slotPrimary, false, false, false, opts, special);
if (CanThisClassDoubleAttack() && CheckDoubleAttack()){
Attack(target, EQEmu::legacy::SlotPrimary, false, false, false, opts, special);
Attack(target, EQEmu::inventory::slotPrimary, false, false, false, opts, special);
if ((IsPet() || IsTempPet()) && IsPetOwnerClient()){
int chance = spellbonuses.PC_Pet_Flurry + itembonuses.PC_Pet_Flurry + aabonuses.PC_Pet_Flurry;
@@ -4690,14 +4690,14 @@ void Mob::DoMainHandAttackRounds(Mob *target, ExtraAttackOptions *opts, int spec
if (IsNPC()) {
int16 n_atk = CastToNPC()->GetNumberOfAttacks();
if (n_atk <= 1) {
Attack(target, EQEmu::legacy::SlotPrimary, false, false, false, opts, special);
Attack(target, EQEmu::inventory::slotPrimary, false, false, false, opts, special);
} else {
for (int i = 0; i < n_atk; ++i) {
Attack(target, EQEmu::legacy::SlotPrimary, false, false, false, opts, special);
Attack(target, EQEmu::inventory::slotPrimary, false, false, false, opts, special);
}
}
} else {
Attack(target, EQEmu::legacy::SlotPrimary, false, false, false, opts, special);
Attack(target, EQEmu::inventory::slotPrimary, false, false, false, opts, special);
}
// we use this random value in three comparisons with different
@@ -4708,15 +4708,15 @@ void Mob::DoMainHandAttackRounds(Mob *target, ExtraAttackOptions *opts, int spec
// check double attack, this is NOT the same rules that clients use...
&&
RandRoll < (GetLevel() + NPCDualAttackModifier)) {
Attack(target, EQEmu::legacy::SlotPrimary, false, false, false, opts, special);
Attack(target, EQEmu::inventory::slotPrimary, false, false, false, opts, special);
// lets see if we can do a triple attack with the main hand
// pets are excluded from triple and quads...
if ((GetSpecialAbility(SPECATK_TRIPLE) || GetSpecialAbility(SPECATK_QUAD)) && !IsPet() &&
RandRoll < (GetLevel() + NPCTripleAttackModifier)) {
Attack(target, EQEmu::legacy::SlotPrimary, false, false, false, opts, special);
Attack(target, EQEmu::inventory::slotPrimary, false, false, false, opts, special);
// now lets check the quad attack
if (GetSpecialAbility(SPECATK_QUAD) && RandRoll < (GetLevel() + NPCQuadAttackModifier)) {
Attack(target, EQEmu::legacy::SlotPrimary, false, false, false, opts, special);
Attack(target, EQEmu::inventory::slotPrimary, false, false, false, opts, special);
}
}
}
@@ -4730,11 +4730,11 @@ void Mob::DoOffHandAttackRounds(Mob *target, ExtraAttackOptions *opts, int speci
// For now, SPECATK_QUAD means innate DW when Combat:UseLiveCombatRounds is true
if ((GetSpecialAbility(SPECATK_INNATE_DW) ||
(RuleB(Combat, UseLiveCombatRounds) && GetSpecialAbility(SPECATK_QUAD))) ||
GetEquipment(EQEmu::textures::TextureSecondary) != 0) {
GetEquipment(EQEmu::textures::weaponSecondary) != 0) {
if (CheckDualWield()) {
Attack(target, EQEmu::legacy::SlotSecondary, false, false, false, opts, special);
Attack(target, EQEmu::inventory::slotSecondary, false, false, false, opts, special);
if (CanThisClassDoubleAttack() && GetLevel() > 35 && CheckDoubleAttack()){
Attack(target, EQEmu::legacy::SlotSecondary, false, false, false, opts, special);
Attack(target, EQEmu::inventory::slotSecondary, false, false, false, opts, special);
if ((IsPet() || IsTempPet()) && IsPetOwnerClient()){
int chance = spellbonuses.PC_Pet_Flurry + itembonuses.PC_Pet_Flurry + aabonuses.PC_Pet_Flurry;