mirror of
https://github.com/mangosfour/server.git
synced 2025-12-25 13:37:02 +00:00
Mage 400 INTO master/434
Signed-off-by: Salja <salja2012@hotmail.de>
This commit is contained in:
parent
7665a09232
commit
22bfaa12b0
66 changed files with 5773 additions and 3971 deletions
|
|
@ -274,6 +274,26 @@ std::ostringstream& operator<< (std::ostringstream& ss, PlayerTaxi const& taxi)
|
|||
ss << taxi.m_taximask[i] << " ";
|
||||
return ss;
|
||||
}
|
||||
|
||||
SpellModifier::SpellModifier( SpellModOp _op, SpellModType _type, int32 _value, SpellEntry const* spellEntry, SpellEffectIndex eff, int16 _charges /*= 0*/ ) : op(_op), type(_type), charges(_charges), value(_value), spellId(spellEntry->Id), lastAffected(NULL)
|
||||
{
|
||||
mask = spellEntry->GetEffectSpellClassMask(eff);
|
||||
}
|
||||
|
||||
SpellModifier::SpellModifier( SpellModOp _op, SpellModType _type, int32 _value, Aura const* aura, int16 _charges /*= 0*/ ) : op(_op), type(_type), charges(_charges), value(_value), spellId(aura->GetId()), lastAffected(NULL)
|
||||
{
|
||||
mask = aura->GetAuraSpellClassMask();
|
||||
}
|
||||
|
||||
bool SpellModifier::isAffectedOnSpell( SpellEntry const *spell ) const
|
||||
{
|
||||
SpellEntry const *affect_spell = sSpellStore.LookupEntry(spellId);
|
||||
// False if affect_spell == NULL or spellFamily not equal
|
||||
if (!affect_spell || affect_spell->GetSpellFamilyName() != spell->GetSpellFamilyName())
|
||||
return false;
|
||||
return spell->IsFitToFamilyMask(mask);
|
||||
}
|
||||
|
||||
//== TradeData =================================================
|
||||
|
||||
TradeData* TradeData::GetTraderData() const
|
||||
|
|
@ -425,6 +445,7 @@ Player::Player(WorldSession* session): Unit(), m_mover(this), m_camera(this), m_
|
|||
memset(m_items, 0, sizeof(Item*)*PLAYER_SLOTS_COUNT);
|
||||
|
||||
m_social = NULL;
|
||||
m_guildId = 0;
|
||||
|
||||
// group is initialized in the reference constructor
|
||||
SetGroupInvite(NULL);
|
||||
|
|
@ -541,6 +562,8 @@ Player::Player(WorldSession* session): Unit(), m_mover(this), m_camera(this), m_
|
|||
|
||||
// Honor System
|
||||
m_lastHonorUpdateTime = time(NULL);
|
||||
m_honorPoints = 0;
|
||||
m_arenaPoints = 0;
|
||||
|
||||
// Player summoning
|
||||
m_summon_expire = 0;
|
||||
|
|
@ -677,18 +700,16 @@ bool Player::Create(uint32 guidlow, const std::string& name, uint8 race, uint8 c
|
|||
SetUInt16Value(PLAYER_BYTES_3, 0, gender); // only GENDER_MALE/GENDER_FEMALE (1 bit) allowed, drunk state = 0
|
||||
SetByteValue(PLAYER_BYTES_3, 3, 0); // BattlefieldArenaFaction (0 or 1)
|
||||
|
||||
SetUInt32Value(PLAYER_GUILDID, 0);
|
||||
SetUInt32Value(PLAYER_GUILDRANK, 0);
|
||||
SetUInt32Value(PLAYER_GUILD_TIMESTAMP, 0);
|
||||
SetInGuild( 0 );
|
||||
SetUInt32Value( PLAYER_GUILDRANK, 0 );
|
||||
SetUInt32Value( PLAYER_GUILD_TIMESTAMP, 0 );
|
||||
|
||||
for (int i = 0; i < KNOWN_TITLES_SIZE; ++i)
|
||||
SetUInt64Value(PLAYER__FIELD_KNOWN_TITLES + i, 0); // 0=disabled
|
||||
SetUInt32Value(PLAYER_CHOSEN_TITLE, 0);
|
||||
|
||||
SetUInt32Value(PLAYER_FIELD_KILLS, 0);
|
||||
SetUInt32Value(PLAYER_FIELD_LIFETIME_HONORBALE_KILLS, 0);
|
||||
SetUInt32Value(PLAYER_FIELD_TODAY_CONTRIBUTION, 0);
|
||||
SetUInt32Value(PLAYER_FIELD_YESTERDAY_CONTRIBUTION, 0);
|
||||
SetUInt32Value( PLAYER_FIELD_KILLS, 0 );
|
||||
SetUInt32Value( PLAYER_FIELD_LIFETIME_HONORBALE_KILLS, 0 );
|
||||
|
||||
// set starting level
|
||||
uint32 start_level = getClass() != CLASS_DEATH_KNIGHT
|
||||
|
|
@ -1995,6 +2016,9 @@ void Player::RegenerateAll(uint32 diff)
|
|||
if (getClass() == CLASS_DEATH_KNIGHT)
|
||||
Regenerate(POWER_RUNE, diff);
|
||||
|
||||
if (getClass() == CLASS_HUNTER)
|
||||
Regenerate(POWER_FOCUS, diff);
|
||||
|
||||
m_regenTimer = REGEN_TIME_FULL;
|
||||
}
|
||||
|
||||
|
|
@ -2029,6 +2053,9 @@ void Player::Regenerate(Powers power, uint32 diff)
|
|||
float RageDecreaseRate = sWorld.getConfig(CONFIG_FLOAT_RATE_POWER_RAGE_LOSS);
|
||||
addvalue = 20 * RageDecreaseRate; // 2 rage by tick (= 2 seconds => 1 rage/sec)
|
||||
} break;
|
||||
case POWER_FOCUS:
|
||||
addvalue = 12;
|
||||
break;
|
||||
case POWER_ENERGY: // Regenerate energy (rogue)
|
||||
{
|
||||
float EnergyRate = sWorld.getConfig(CONFIG_FLOAT_RATE_POWER_ENERGY);
|
||||
|
|
@ -2059,7 +2086,6 @@ void Player::Regenerate(Powers power, uint32 diff)
|
|||
}
|
||||
}
|
||||
} break;
|
||||
case POWER_FOCUS:
|
||||
case POWER_HAPPINESS:
|
||||
case POWER_HEALTH:
|
||||
break;
|
||||
|
|
@ -2638,12 +2664,14 @@ void Player::InitStatsForLevel(bool reapplyMods)
|
|||
SetFloatValue(UNIT_FIELD_MINRANGEDDAMAGE, 0.0f);
|
||||
SetFloatValue(UNIT_FIELD_MAXRANGEDDAMAGE, 0.0f);
|
||||
|
||||
SetInt32Value(UNIT_FIELD_ATTACK_POWER, 0);
|
||||
SetInt32Value(UNIT_FIELD_ATTACK_POWER_MODS, 0);
|
||||
SetFloatValue(UNIT_FIELD_ATTACK_POWER_MULTIPLIER, 0.0f);
|
||||
SetInt32Value(UNIT_FIELD_RANGED_ATTACK_POWER, 0);
|
||||
SetInt32Value(UNIT_FIELD_RANGED_ATTACK_POWER_MODS, 0);
|
||||
SetFloatValue(UNIT_FIELD_RANGED_ATTACK_POWER_MULTIPLIER, 0.0f);
|
||||
SetInt32Value(UNIT_FIELD_ATTACK_POWER, 0 );
|
||||
SetInt32Value(UNIT_FIELD_ATTACK_POWER_MOD_POS, 0 );
|
||||
SetInt32Value(UNIT_FIELD_ATTACK_POWER_MOD_NEG, 0 );
|
||||
SetFloatValue(UNIT_FIELD_ATTACK_POWER_MULTIPLIER,0.0f);
|
||||
SetInt32Value(UNIT_FIELD_RANGED_ATTACK_POWER, 0 );
|
||||
SetInt32Value(UNIT_FIELD_RANGED_ATTACK_POWER_MOD_POS,0 );
|
||||
SetInt32Value(UNIT_FIELD_RANGED_ATTACK_POWER_MOD_NEG,0 );
|
||||
SetFloatValue(UNIT_FIELD_RANGED_ATTACK_POWER_MULTIPLIER,0.0f);
|
||||
|
||||
// Base crit values (will be recalculated in UpdateAllStats() at loading and in _ApplyAllStatBonuses() at reset
|
||||
SetFloatValue(PLAYER_CRIT_PERCENTAGE, 0.0f);
|
||||
|
|
@ -2688,7 +2716,7 @@ void Player::InitStatsForLevel(bool reapplyMods)
|
|||
|
||||
// save new stats
|
||||
for (int i = POWER_MANA; i < MAX_POWERS; ++i)
|
||||
SetMaxPower(Powers(i), GetCreatePowers(Powers(i)));
|
||||
SetMaxPower(Powers(i), GetCreatePowers(Powers(i)));
|
||||
|
||||
SetMaxHealth(classInfo.basehealth); // stamina bonus will applied later
|
||||
|
||||
|
|
@ -2774,7 +2802,7 @@ void Player::SendInitialSpells()
|
|||
data << uint32(itr->first);
|
||||
|
||||
data << uint16(itr->second.itemid); // cast item id
|
||||
data << uint16(sEntry->Category); // spell category
|
||||
data << uint16(sEntry->GetCategory()); // spell category
|
||||
|
||||
// send infinity cooldown in special format
|
||||
if (itr->second.end >= infTime)
|
||||
|
|
@ -2786,7 +2814,7 @@ void Player::SendInitialSpells()
|
|||
|
||||
time_t cooldown = itr->second.end > curTime ? (itr->second.end - curTime) * IN_MILLISECONDS : 0;
|
||||
|
||||
if (sEntry->Category) // may be wrong, but anyway better than nothing...
|
||||
if(sEntry->GetCategory()) // may be wrong, but anyway better than nothing...
|
||||
{
|
||||
data << uint32(0); // cooldown
|
||||
data << uint32(cooldown); // category cooldown
|
||||
|
|
@ -3260,10 +3288,12 @@ bool Player::IsNeedCastPassiveLikeSpellAtLearn(SpellEntry const* spellInfo) cons
|
|||
|
||||
// note: form passives activated with shapeshift spells be implemented by HandleShapeshiftBoosts instead of spell_learn_spell
|
||||
// talent dependent passives activated at form apply have proper stance data
|
||||
bool need_cast = !spellInfo->Stances || (!form && spellInfo->HasAttribute(SPELL_ATTR_EX2_NOT_NEED_SHAPESHIFT));
|
||||
SpellShapeshiftEntry const* shapeShift = spellInfo->GetSpellShapeshift();
|
||||
bool need_cast = (!shapeShift || !shapeShift->Stances || (!form && spellInfo->HasAttribute(SPELL_ATTR_EX2_NOT_NEED_SHAPESHIFT)));
|
||||
|
||||
// Check CasterAuraStates
|
||||
return need_cast && (!spellInfo->CasterAuraState || HasAuraState(AuraState(spellInfo->CasterAuraState)));
|
||||
SpellAuraRestrictionsEntry const* auraRestrictions = spellInfo->GetSpellAuraRestrictions();
|
||||
return need_cast && (auraRestrictions && (!auraRestrictions->CasterAuraState || HasAuraState(AuraState(auraRestrictions->CasterAuraState))));
|
||||
}
|
||||
|
||||
void Player::learnSpell(uint32 spell_id, bool dependent)
|
||||
|
|
@ -3553,9 +3583,9 @@ void Player::RemoveArenaSpellCooldowns()
|
|||
++next;
|
||||
SpellEntry const* entry = sSpellStore.LookupEntry(itr->first);
|
||||
// check if spellentry is present and if the cooldown is less than 15 mins
|
||||
if (entry &&
|
||||
entry->RecoveryTime <= 15 * MINUTE * IN_MILLISECONDS &&
|
||||
entry->CategoryRecoveryTime <= 15 * MINUTE * IN_MILLISECONDS)
|
||||
if( entry &&
|
||||
entry->GetRecoveryTime() <= 15 * MINUTE * IN_MILLISECONDS &&
|
||||
entry->GetCategoryRecoveryTime() <= 15 * MINUTE * IN_MILLISECONDS )
|
||||
{
|
||||
// remove & notify
|
||||
RemoveSpellCooldown(itr->first, true);
|
||||
|
|
@ -3855,6 +3885,9 @@ void Player::InitVisibleBits()
|
|||
updateVisualBits.SetBit(UNIT_FIELD_POWER5);
|
||||
updateVisualBits.SetBit(UNIT_FIELD_POWER6);
|
||||
updateVisualBits.SetBit(UNIT_FIELD_POWER7);
|
||||
updateVisualBits.SetBit(UNIT_FIELD_POWER8);
|
||||
updateVisualBits.SetBit(UNIT_FIELD_POWER9);
|
||||
updateVisualBits.SetBit(UNIT_FIELD_POWER10);
|
||||
updateVisualBits.SetBit(UNIT_FIELD_MAXHEALTH);
|
||||
updateVisualBits.SetBit(UNIT_FIELD_MAXPOWER1);
|
||||
updateVisualBits.SetBit(UNIT_FIELD_MAXPOWER2);
|
||||
|
|
@ -3863,6 +3896,9 @@ void Player::InitVisibleBits()
|
|||
updateVisualBits.SetBit(UNIT_FIELD_MAXPOWER5);
|
||||
updateVisualBits.SetBit(UNIT_FIELD_MAXPOWER6);
|
||||
updateVisualBits.SetBit(UNIT_FIELD_MAXPOWER7);
|
||||
updateVisualBits.SetBit(UNIT_FIELD_MAXPOWER8);
|
||||
updateVisualBits.SetBit(UNIT_FIELD_MAXPOWER9);
|
||||
updateVisualBits.SetBit(UNIT_FIELD_MAXPOWER10);
|
||||
updateVisualBits.SetBit(UNIT_FIELD_LEVEL);
|
||||
updateVisualBits.SetBit(UNIT_FIELD_FACTIONTEMPLATE);
|
||||
updateVisualBits.SetBit(UNIT_VIRTUAL_ITEM_SLOT_ID + 0);
|
||||
|
|
@ -3891,7 +3927,7 @@ void Player::InitVisibleBits()
|
|||
updateVisualBits.SetBit(PLAYER_DUEL_ARBITER + 0);
|
||||
updateVisualBits.SetBit(PLAYER_DUEL_ARBITER + 1);
|
||||
updateVisualBits.SetBit(PLAYER_FLAGS);
|
||||
updateVisualBits.SetBit(PLAYER_GUILDID);
|
||||
//updateVisualBits.SetBit(PLAYER_GUILDID);
|
||||
updateVisualBits.SetBit(PLAYER_GUILDRANK);
|
||||
updateVisualBits.SetBit(PLAYER_BYTES);
|
||||
updateVisualBits.SetBit(PLAYER_BYTES_2);
|
||||
|
|
@ -4035,9 +4071,10 @@ TrainerSpellState Player::GetTrainerSpellState(TrainerSpell const* trainer_spell
|
|||
SpellEntry const* spell = sSpellStore.LookupEntry(trainer_spell->learnedSpell);
|
||||
|
||||
// secondary prof. or not prof. spell
|
||||
uint32 skill = spell->EffectMiscValue[1];
|
||||
SpellEffectEntry const* spellEffect = spell->GetSpellEffect(EFFECT_INDEX_1);
|
||||
uint32 skill = spellEffect ? spellEffect->EffectMiscValue : 0;
|
||||
|
||||
if (spell->Effect[1] != SPELL_EFFECT_SKILL || !IsPrimaryProfessionSkill(skill))
|
||||
if(spellEffect && (spellEffect->Effect != SPELL_EFFECT_SKILL || !IsPrimaryProfessionSkill(skill)))
|
||||
return TRAINER_SPELL_GREEN;
|
||||
|
||||
// check primary prof. limit
|
||||
|
|
@ -4531,8 +4568,6 @@ Corpse* Player::CreateCorpse()
|
|||
|
||||
corpse->SetUInt32Value(CORPSE_FIELD_DISPLAY_ID, GetNativeDisplayId());
|
||||
|
||||
corpse->SetUInt32Value(CORPSE_FIELD_GUILD, GetGuildId());
|
||||
|
||||
uint32 iDisplayID;
|
||||
uint32 iIventoryType;
|
||||
uint32 _cfi;
|
||||
|
|
@ -5115,23 +5150,23 @@ float Player::GetExpertiseDodgeOrParryReduction(WeaponAttackType attType) const
|
|||
|
||||
float Player::OCTRegenHPPerSpirit()
|
||||
{
|
||||
uint32 level = getLevel();
|
||||
uint32 pclass = getClass();
|
||||
//uint32 level = getLevel();
|
||||
//uint32 pclass = getClass();
|
||||
|
||||
if (level > GT_MAX_LEVEL) level = GT_MAX_LEVEL;
|
||||
//if (level>GT_MAX_LEVEL) level = GT_MAX_LEVEL;
|
||||
|
||||
GtOCTRegenHPEntry const* baseRatio = sGtOCTRegenHPStore.LookupEntry((pclass - 1) * GT_MAX_LEVEL + level - 1);
|
||||
GtRegenHPPerSptEntry const* moreRatio = sGtRegenHPPerSptStore.LookupEntry((pclass - 1) * GT_MAX_LEVEL + level - 1);
|
||||
if (baseRatio == NULL || moreRatio == NULL)
|
||||
//GtOCTRegenHPEntry const *baseRatio = sGtOCTRegenHPStore.LookupEntry((pclass-1)*GT_MAX_LEVEL + level-1);
|
||||
//GtRegenHPPerSptEntry const *moreRatio = sGtRegenHPPerSptStore.LookupEntry((pclass-1)*GT_MAX_LEVEL + level-1);
|
||||
//if (baseRatio==NULL || moreRatio==NULL)
|
||||
return 0.0f;
|
||||
|
||||
// Formula from PaperDollFrame script
|
||||
float spirit = GetStat(STAT_SPIRIT);
|
||||
float baseSpirit = spirit;
|
||||
if (baseSpirit > 50) baseSpirit = 50;
|
||||
float moreSpirit = spirit - baseSpirit;
|
||||
float regen = baseSpirit * baseRatio->ratio + moreSpirit * moreRatio->ratio;
|
||||
return regen;
|
||||
//float spirit = GetStat(STAT_SPIRIT);
|
||||
//float baseSpirit = spirit;
|
||||
//if (baseSpirit>50) baseSpirit = 50;
|
||||
//float moreSpirit = spirit - baseSpirit;
|
||||
//float regen = baseSpirit * baseRatio->ratio + moreSpirit * moreRatio->ratio;
|
||||
//return regen;
|
||||
}
|
||||
|
||||
float Player::OCTRegenMPPerSpirit()
|
||||
|
|
@ -5352,7 +5387,7 @@ bool Player::UpdateCraftSkill(uint32 spellid)
|
|||
|
||||
// Alchemy Discoveries here
|
||||
SpellEntry const* spellEntry = sSpellStore.LookupEntry(spellid);
|
||||
if (spellEntry && spellEntry->Mechanic == MECHANIC_DISCOVERY)
|
||||
if (spellEntry && spellEntry->GetMechanic() == MECHANIC_DISCOVERY)
|
||||
{
|
||||
if (uint32 discoveredSpell = GetSkillDiscoverySpell(_spell_idx->second->skillId, spellid, this))
|
||||
learnSpell(discoveredSpell, false);
|
||||
|
|
@ -6394,16 +6429,14 @@ void Player::UpdateHonorFields()
|
|||
// update yesterday's contribution
|
||||
if (m_lastHonorUpdateTime >= yesterday)
|
||||
{
|
||||
SetUInt32Value(PLAYER_FIELD_YESTERDAY_CONTRIBUTION, GetUInt32Value(PLAYER_FIELD_TODAY_CONTRIBUTION));
|
||||
//SetUInt32Value(PLAYER_FIELD_YESTERDAY_CONTRIBUTION, GetUInt32Value(PLAYER_FIELD_TODAY_CONTRIBUTION));
|
||||
|
||||
// this is the first update today, reset today's contribution
|
||||
SetUInt32Value(PLAYER_FIELD_TODAY_CONTRIBUTION, 0);
|
||||
SetUInt32Value(PLAYER_FIELD_KILLS, MAKE_PAIR32(0, kills_today));
|
||||
SetUInt32Value(PLAYER_FIELD_KILLS, MAKE_PAIR32(0,kills_today));
|
||||
}
|
||||
else
|
||||
{
|
||||
// no honor/kills yesterday or today, reset
|
||||
SetUInt32Value(PLAYER_FIELD_YESTERDAY_CONTRIBUTION, 0);
|
||||
SetUInt32Value(PLAYER_FIELD_KILLS, 0);
|
||||
}
|
||||
}
|
||||
|
|
@ -6537,7 +6570,7 @@ bool Player::RewardHonor(Unit* uVictim, uint32 groupsize, float honor)
|
|||
// add honor points
|
||||
ModifyHonorPoints(int32(honor));
|
||||
|
||||
ApplyModUInt32Value(PLAYER_FIELD_TODAY_CONTRIBUTION, uint32(honor), true);
|
||||
// FIXME 4x ApplyModUInt32Value(PLAYER_FIELD_TODAY_CONTRIBUTION, uint32(honor), true);
|
||||
return true;
|
||||
}
|
||||
|
||||
|
|
@ -6546,7 +6579,9 @@ void Player::SetHonorPoints(uint32 value)
|
|||
if (value > sWorld.getConfig(CONFIG_UINT32_MAX_HONOR_POINTS))
|
||||
value = sWorld.getConfig(CONFIG_UINT32_MAX_HONOR_POINTS);
|
||||
|
||||
SetUInt32Value(PLAYER_FIELD_HONOR_CURRENCY, value);
|
||||
// FIXME 4x SetUInt32Value(PLAYER_FIELD_HONOR_CURRENCY, value);
|
||||
// must be recalculated to new honor points items and removed
|
||||
m_honorPoints = value;
|
||||
}
|
||||
|
||||
void Player::SetArenaPoints(uint32 value)
|
||||
|
|
@ -6554,7 +6589,9 @@ void Player::SetArenaPoints(uint32 value)
|
|||
if (value > sWorld.getConfig(CONFIG_UINT32_MAX_ARENA_POINTS))
|
||||
value = sWorld.getConfig(CONFIG_UINT32_MAX_ARENA_POINTS);
|
||||
|
||||
SetUInt32Value(PLAYER_FIELD_ARENA_CURRENCY, value);
|
||||
// FIXME 4x SetUInt32Value(PLAYER_FIELD_ARENA_CURRENCY, value);
|
||||
// must be recalculated to new honor points items and removed
|
||||
m_arenaPoints = value;
|
||||
}
|
||||
|
||||
void Player::ModifyHonorPoints(int32 value)
|
||||
|
|
@ -7149,7 +7186,7 @@ void Player::_ApplyItemBonuses(ItemPrototype const* proto, uint8 slot, bool appl
|
|||
}
|
||||
|
||||
// If set ScalingStatValue armor get it or use item armor
|
||||
uint32 armor = proto->Armor;
|
||||
uint32 armor = proto->GetArmor();
|
||||
if (ssv)
|
||||
{
|
||||
if (uint32 ssvarmor = ssv->getArmorMod(proto->ScalingStatValue))
|
||||
|
|
@ -7210,8 +7247,8 @@ void Player::_ApplyItemBonuses(ItemPrototype const* proto, uint8 slot, bool appl
|
|||
attType = OFF_ATTACK;
|
||||
}
|
||||
|
||||
float minDamage = proto->Damage[0].DamageMin;
|
||||
float maxDamage = proto->Damage[0].DamageMax;
|
||||
float minDamage = proto->GetMinDamage();
|
||||
float maxDamage = proto->GetMaxDamage();
|
||||
int32 extraDPS = 0;
|
||||
// If set dpsMod in ScalingStatValue use it for min (70% from average), max (130% from average) damage
|
||||
if (ssv)
|
||||
|
|
@ -7285,7 +7322,7 @@ void Player::_ApplyWeaponDependentAuraMods(Item* item, WeaponAttackType attackTy
|
|||
void Player::_ApplyWeaponDependentAuraCritMod(Item* item, WeaponAttackType attackType, Aura* aura, bool apply)
|
||||
{
|
||||
// generic not weapon specific case processes in aura code
|
||||
if (aura->GetSpellProto()->EquippedItemClass == -1)
|
||||
if(aura->GetSpellProto()->GetEquippedItemClass() == -1)
|
||||
return;
|
||||
|
||||
BaseModGroup mod = BASEMOD_END;
|
||||
|
|
@ -7311,7 +7348,7 @@ void Player::_ApplyWeaponDependentAuraDamageMod(Item* item, WeaponAttackType att
|
|||
return;
|
||||
|
||||
// generic not weapon specific case processes in aura code
|
||||
if (aura->GetSpellProto()->EquippedItemClass == -1)
|
||||
if(aura->GetSpellProto()->GetEquippedItemClass() == -1)
|
||||
return;
|
||||
|
||||
UnitMods unitMod = UNIT_MOD_END;
|
||||
|
|
@ -7542,7 +7579,7 @@ void Player::_HandleDeadlyPoison(Unit* Target, WeaponAttackType attType, SpellEn
|
|||
break;
|
||||
}
|
||||
}
|
||||
if (dPoison && dPoison->GetStackAmount() == spellInfo->StackAmount)
|
||||
if (dPoison && dPoison->GetStackAmount() == spellInfo->GetStackAmount())
|
||||
{
|
||||
Item* otherWeapon = GetWeaponForAttack(attType == BASE_ATTACK ? OFF_ATTACK : BASE_ATTACK);
|
||||
if (!otherWeapon)
|
||||
|
|
@ -7562,9 +7599,9 @@ void Player::_HandleDeadlyPoison(Unit* Target, WeaponAttackType attType, SpellEn
|
|||
if (pSecondEnchant->type[s] != ITEM_ENCHANTMENT_TYPE_COMBAT_SPELL)
|
||||
continue;
|
||||
|
||||
SpellEntry const* combatEntry = sSpellStore.LookupEntry(pSecondEnchant->spellid[s]);
|
||||
if (combatEntry && combatEntry->Dispel == DISPEL_POISON)
|
||||
CastSpell(Target, combatEntry, true, otherWeapon);
|
||||
if (SpellEntry const* combatEntry = sSpellStore.LookupEntry(pSecondEnchant->spellid[s]))
|
||||
if (combatEntry->GetDispel() == DISPEL_POISON)
|
||||
CastSpell(Target, combatEntry, true, otherWeapon);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -7605,7 +7642,7 @@ void Player::CastItemCombatSpell(Unit* Target, WeaponAttackType attType)
|
|||
if (m_extraAttacks && IsSpellHaveEffect(spellInfo, SPELL_EFFECT_ADD_EXTRA_ATTACKS))
|
||||
return;
|
||||
|
||||
float chance = (float)spellInfo->procChance;
|
||||
float chance = (float)spellInfo->GetProcChance();
|
||||
|
||||
if (spellData.SpellPPMRate)
|
||||
{
|
||||
|
|
@ -7658,7 +7695,7 @@ void Player::CastItemCombatSpell(Unit* Target, WeaponAttackType attType)
|
|||
else
|
||||
{
|
||||
// Deadly Poison, unique effect needs to be handled before casting triggered spell
|
||||
if (spellInfo->SpellFamilyName == SPELLFAMILY_ROGUE && spellInfo->SpellFamilyFlags & UI64LIT(0x10000))
|
||||
if (spellInfo->IsFitToFamily(SPELLFAMILY_ROGUE, UI64LIT(0x0000000000010000)))
|
||||
_HandleDeadlyPoison(Target, attType, spellInfo);
|
||||
|
||||
CastSpell(Target, spellInfo->Id, true, item);
|
||||
|
|
@ -7873,26 +7910,26 @@ void Player::_ApplyAllLevelScaleItemMods(bool apply)
|
|||
|
||||
void Player::_ApplyAmmoBonuses()
|
||||
{
|
||||
// check ammo
|
||||
uint32 ammo_id = GetUInt32Value(PLAYER_AMMO_ID);
|
||||
if (!ammo_id)
|
||||
return;
|
||||
//// check ammo
|
||||
//uint32 ammo_id = GetUInt32Value(PLAYER_AMMO_ID);
|
||||
//if(!ammo_id)
|
||||
// return;
|
||||
|
||||
float currentAmmoDPS;
|
||||
//float currentAmmoDPS;
|
||||
|
||||
ItemPrototype const* ammo_proto = ObjectMgr::GetItemPrototype(ammo_id);
|
||||
if (!ammo_proto || ammo_proto->Class != ITEM_CLASS_PROJECTILE || !CheckAmmoCompatibility(ammo_proto))
|
||||
currentAmmoDPS = 0.0f;
|
||||
else
|
||||
currentAmmoDPS = ammo_proto->Damage[0].DamageMin;
|
||||
//ItemPrototype const *ammo_proto = ObjectMgr::GetItemPrototype( ammo_id );
|
||||
//if( !ammo_proto || ammo_proto->Class!=ITEM_CLASS_PROJECTILE || !CheckAmmoCompatibility(ammo_proto))
|
||||
// currentAmmoDPS = 0.0f;
|
||||
//else
|
||||
// currentAmmoDPS = ammo_proto->Damage[0].DamageMin;
|
||||
|
||||
if (currentAmmoDPS == GetAmmoDPS())
|
||||
return;
|
||||
//if(currentAmmoDPS == GetAmmoDPS())
|
||||
// return;
|
||||
|
||||
m_ammoDPS = currentAmmoDPS;
|
||||
//m_ammoDPS = currentAmmoDPS;
|
||||
|
||||
if (CanModifyStats())
|
||||
UpdateDamagePhysical(RANGED_ATTACK);
|
||||
//if(CanModifyStats())
|
||||
// UpdateDamagePhysical(RANGED_ATTACK);
|
||||
}
|
||||
|
||||
bool Player::CheckAmmoCompatibility(const ItemPrototype* ammo_proto) const
|
||||
|
|
@ -11049,37 +11086,37 @@ InventoryResult Player::CanUseAmmo(uint32 item) const
|
|||
|
||||
void Player::SetAmmo(uint32 item)
|
||||
{
|
||||
if (!item)
|
||||
return;
|
||||
//if(!item)
|
||||
// return;
|
||||
|
||||
// already set
|
||||
if (GetUInt32Value(PLAYER_AMMO_ID) == item)
|
||||
return;
|
||||
//// already set
|
||||
//if( GetUInt32Value(PLAYER_AMMO_ID) == item )
|
||||
// return;
|
||||
|
||||
// check ammo
|
||||
if (item)
|
||||
{
|
||||
InventoryResult msg = CanUseAmmo(item);
|
||||
if (msg != EQUIP_ERR_OK)
|
||||
{
|
||||
SendEquipError(msg, NULL, NULL, item);
|
||||
return;
|
||||
}
|
||||
}
|
||||
//// check ammo
|
||||
//if (item)
|
||||
//{
|
||||
// InventoryResult msg = CanUseAmmo( item );
|
||||
// if (msg != EQUIP_ERR_OK)
|
||||
// {
|
||||
// SendEquipError(msg, NULL, NULL, item);
|
||||
// return;
|
||||
// }
|
||||
//}
|
||||
|
||||
SetUInt32Value(PLAYER_AMMO_ID, item);
|
||||
//SetUInt32Value(PLAYER_AMMO_ID, item);
|
||||
|
||||
_ApplyAmmoBonuses();
|
||||
//_ApplyAmmoBonuses();
|
||||
}
|
||||
|
||||
void Player::RemoveAmmo()
|
||||
{
|
||||
SetUInt32Value(PLAYER_AMMO_ID, 0);
|
||||
//SetUInt32Value(PLAYER_AMMO_ID, 0);
|
||||
|
||||
m_ammoDPS = 0.0f;
|
||||
//m_ammoDPS = 0.0f;
|
||||
|
||||
if (CanModifyStats())
|
||||
UpdateDamagePhysical(RANGED_ATTACK);
|
||||
//if (CanModifyStats())
|
||||
// UpdateDamagePhysical(RANGED_ATTACK);
|
||||
}
|
||||
|
||||
// Return stored item (if stored to stack, it can diff. from pItem). And pItem ca be deleted in this case.
|
||||
|
|
@ -11284,7 +11321,7 @@ Item* Player::EquipItem(uint16 pos, Item* pItem, bool update)
|
|||
sLog.outError("Weapon switch cooldown spell %u couldn't be found in Spell.dbc", cooldownSpell);
|
||||
else
|
||||
{
|
||||
m_weaponChangeTimer = spellProto->StartRecoveryTime;
|
||||
m_weaponChangeTimer = spellProto->GetStartRecoveryTime();
|
||||
|
||||
WorldPacket data(SMSG_SPELL_COOLDOWN, 8 + 1 + 4);
|
||||
data << GetObjectGuid();
|
||||
|
|
@ -15487,9 +15524,9 @@ bool Player::LoadFromDB(ObjectGuid guid, SqlQueryHolder* holder)
|
|||
//"resettalents_time, trans_x, trans_y, trans_z, trans_o, transguid, extra_flags, stable_slots, at_login, zone, online, death_expire_time, taxi_path, dungeon_difficulty,"
|
||||
// 39 40 41 42 43 44 45 46 47 48 49
|
||||
//"arenaPoints, totalHonorPoints, todayHonorPoints, yesterdayHonorPoints, totalKills, todayKills, yesterdayKills, chosenTitle, knownCurrencies, watchedFaction, drunk,"
|
||||
// 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64
|
||||
//"health, power1, power2, power3, power4, power5, power6, power7, specCount, activeSpec, exploredZones, equipmentCache, ammoId, knownTitles, actionBars FROM characters WHERE guid = '%u'", GUID_LOPART(m_guid));
|
||||
QueryResult* result = holder->GetResult(PLAYER_LOGIN_QUERY_LOADFROM);
|
||||
// 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66
|
||||
//"health, power1, power2, power3, power4, power5, power6, power7, power8, power9, power10, specCount, activeSpec, exploredZones, equipmentCache, knownTitles, actionBars FROM characters WHERE guid = '%u'", GUID_LOPART(m_guid));
|
||||
QueryResult *result = holder->GetResult(PLAYER_LOGIN_QUERY_LOADFROM);
|
||||
|
||||
if (!result)
|
||||
{
|
||||
|
|
@ -15538,8 +15575,8 @@ bool Player::LoadFromDB(ObjectGuid guid, SqlQueryHolder* holder)
|
|||
SetUInt32Value(UNIT_FIELD_LEVEL, fields[6].GetUInt8());
|
||||
SetUInt32Value(PLAYER_XP, fields[7].GetUInt32());
|
||||
|
||||
_LoadIntoDataField(fields[60].GetString(), PLAYER_EXPLORED_ZONES_1, PLAYER_EXPLORED_ZONES_SIZE);
|
||||
_LoadIntoDataField(fields[63].GetString(), PLAYER__FIELD_KNOWN_TITLES, KNOWN_TITLES_SIZE * 2);
|
||||
_LoadIntoDataField(fields[63].GetString(), PLAYER_EXPLORED_ZONES_1, PLAYER_EXPLORED_ZONES_SIZE);
|
||||
_LoadIntoDataField(fields[65].GetString(), PLAYER__FIELD_KNOWN_TITLES, KNOWN_TITLES_SIZE*2);
|
||||
|
||||
InitDisplayIds(); // model, scale and model data
|
||||
|
||||
|
|
@ -15564,12 +15601,10 @@ bool Player::LoadFromDB(ObjectGuid guid, SqlQueryHolder* holder)
|
|||
SetUInt32Value(PLAYER_FLAGS, fields[11].GetUInt32());
|
||||
SetInt32Value(PLAYER_FIELD_WATCHED_FACTION_INDEX, fields[48].GetInt32());
|
||||
|
||||
SetUInt64Value(PLAYER_FIELD_KNOWN_CURRENCIES, fields[47].GetUInt64());
|
||||
|
||||
SetUInt32Value(PLAYER_AMMO_ID, fields[62].GetUInt32());
|
||||
//SetUInt64Value(PLAYER_FIELD_KNOWN_CURRENCIES, fields[47].GetUInt64());
|
||||
|
||||
// Action bars state
|
||||
SetByteValue(PLAYER_FIELD_BYTES, 2, fields[64].GetUInt8());
|
||||
SetByteValue(PLAYER_FIELD_BYTES, 2, fields[66].GetUInt8());
|
||||
|
||||
// cleanup inventory related item value fields (its will be filled correctly in _LoadInventory)
|
||||
for (uint8 slot = EQUIPMENT_SLOT_START; slot < EQUIPMENT_SLOT_END; ++slot)
|
||||
|
|
@ -15632,8 +15667,8 @@ bool Player::LoadFromDB(ObjectGuid guid, SqlQueryHolder* holder)
|
|||
|
||||
SetHonorPoints(fields[40].GetUInt32());
|
||||
|
||||
SetUInt32Value(PLAYER_FIELD_TODAY_CONTRIBUTION, fields[41].GetUInt32());
|
||||
SetUInt32Value(PLAYER_FIELD_YESTERDAY_CONTRIBUTION, fields[42].GetUInt32());
|
||||
//SetUInt32Value(PLAYER_FIELD_TODAY_CONTRIBUTION, fields[41].GetUInt32());
|
||||
//SetUInt32Value(PLAYER_FIELD_YESTERDAY_CONTRIBUTION, fields[42].GetUInt32());
|
||||
SetUInt32Value(PLAYER_FIELD_LIFETIME_HONORBALE_KILLS, fields[43].GetUInt32());
|
||||
SetUInt16Value(PLAYER_FIELD_KILLS, 0, fields[44].GetUInt16());
|
||||
SetUInt16Value(PLAYER_FIELD_KILLS, 1, fields[45].GetUInt16());
|
||||
|
|
@ -15904,8 +15939,8 @@ bool Player::LoadFromDB(ObjectGuid guid, SqlQueryHolder* holder)
|
|||
_LoadMailedItems(holder->GetResult(PLAYER_LOGIN_QUERY_LOADMAILEDITEMS));
|
||||
UpdateNextMailTimeAndUnreads();
|
||||
|
||||
m_specsCount = fields[58].GetUInt8();
|
||||
m_activeSpec = fields[59].GetUInt8();
|
||||
m_specsCount = fields[61].GetUInt8();
|
||||
m_activeSpec = fields[62].GetUInt8();
|
||||
|
||||
_LoadGlyphs(holder->GetResult(PLAYER_LOGIN_QUERY_LOADGLYPHS));
|
||||
|
||||
|
|
@ -16015,7 +16050,8 @@ bool Player::LoadFromDB(ObjectGuid guid, SqlQueryHolder* holder)
|
|||
// restore remembered power/health values (but not more max values)
|
||||
uint32 savedhealth = fields[50].GetUInt32();
|
||||
SetHealth(savedhealth > GetMaxHealth() ? GetMaxHealth() : savedhealth);
|
||||
for (uint32 i = 0; i < MAX_POWERS; ++i)
|
||||
|
||||
for(uint32 i = 0; i < MAX_POWERS; ++i)
|
||||
{
|
||||
uint32 savedpower = fields[51 + i].GetUInt32();
|
||||
SetPower(Powers(i), savedpower > GetMaxPower(Powers(i)) ? GetMaxPower(Powers(i)) : savedpower);
|
||||
|
|
@ -16200,13 +16236,19 @@ void Player::_LoadAuras(QueryResult* result, uint32 timediff)
|
|||
}
|
||||
|
||||
// prevent wrong values of remaincharges
|
||||
if (spellproto->procCharges == 0)
|
||||
if (uint32 procCharges = spellproto->GetProcCharges())
|
||||
{
|
||||
if (remaincharges <= 0 || remaincharges > procCharges)
|
||||
remaincharges = procCharges;
|
||||
}
|
||||
else
|
||||
remaincharges = 0;
|
||||
|
||||
if (!spellproto->StackAmount)
|
||||
uint32 defstackamount = spellproto->GetStackAmount();
|
||||
if (!defstackamount)
|
||||
stackcount = 1;
|
||||
else if (spellproto->StackAmount < stackcount)
|
||||
stackcount = spellproto->StackAmount;
|
||||
else if (defstackamount < stackcount)
|
||||
stackcount = defstackamount;
|
||||
else if (!stackcount)
|
||||
stackcount = 1;
|
||||
|
||||
|
|
@ -17329,21 +17371,21 @@ void Player::SaveToDB()
|
|||
stmt.PExecute(GetGUIDLow());
|
||||
|
||||
SqlStatement uberInsert = CharacterDatabase.CreateStatement(insChar, "INSERT INTO characters (guid,account,name,race,class,gender,level,xp,money,playerBytes,playerBytes2,playerFlags,"
|
||||
"map, dungeon_difficulty, position_x, position_y, position_z, orientation, "
|
||||
"taximask, online, cinematic, "
|
||||
"totaltime, leveltime, rest_bonus, logout_time, is_logout_resting, resettalents_cost, resettalents_time, "
|
||||
"trans_x, trans_y, trans_z, trans_o, transguid, extra_flags, stable_slots, at_login, zone, "
|
||||
"death_expire_time, taxi_path, arenaPoints, totalHonorPoints, todayHonorPoints, yesterdayHonorPoints, totalKills, "
|
||||
"todayKills, yesterdayKills, chosenTitle, knownCurrencies, watchedFaction, drunk, health, power1, power2, power3, "
|
||||
"power4, power5, power6, power7, specCount, activeSpec, exploredZones, equipmentCache, ammoId, knownTitles, actionBars) "
|
||||
"VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, "
|
||||
"?, ?, ?, ?, ?, ?, "
|
||||
"?, ?, ?, "
|
||||
"?, ?, ?, ?, ?, ?, ?, "
|
||||
"?, ?, ?, ?, ?, ?, ?, ?, ?, "
|
||||
"?, ?, ?, ?, ?, ?, ?, "
|
||||
"?, ?, ?, ?, ?, ?, ?, ?, ?, ?, "
|
||||
"?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?) ");
|
||||
"map, dungeon_difficulty, position_x, position_y, position_z, orientation, "
|
||||
"taximask, online, cinematic, "
|
||||
"totaltime, leveltime, rest_bonus, logout_time, is_logout_resting, resettalents_cost, resettalents_time, "
|
||||
"trans_x, trans_y, trans_z, trans_o, transguid, extra_flags, stable_slots, at_login, zone, "
|
||||
"death_expire_time, taxi_path, arenaPoints, totalHonorPoints, todayHonorPoints, yesterdayHonorPoints, totalKills, "
|
||||
"todayKills, yesterdayKills, chosenTitle, knownCurrencies, watchedFaction, drunk, health, power1, power2, power3, "
|
||||
"power4, power5, power6, power7, power8, power9, power10, specCount, activeSpec, exploredZones, equipmentCache, knownTitles, actionBars) VALUES ("
|
||||
"VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, "
|
||||
"?, ?, ?, ?, ?, ?, "
|
||||
"?, ?, ?, "
|
||||
"?, ?, ?, ?, ?, ?, ?, "
|
||||
"?, ?, ?, ?, ?, ?, ?, ?, ?, "
|
||||
"?, ?, ?, ?, ?, ?, ?, "
|
||||
"?, ?, ?, ?, ?, ?, ?, ?, ?, ?, "
|
||||
"?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?) ");
|
||||
|
||||
uberInsert.addUInt32(GetGUIDLow());
|
||||
uberInsert.addUInt32(GetSession()->GetAccountId());
|
||||
|
|
@ -17422,9 +17464,9 @@ void Player::SaveToDB()
|
|||
|
||||
uberInsert.addUInt32(GetHonorPoints());
|
||||
|
||||
uberInsert.addUInt32(GetUInt32Value(PLAYER_FIELD_TODAY_CONTRIBUTION));
|
||||
uberInsert.addUInt32(0); // FIXME 4x GetUInt32Value(PLAYER_FIELD_TODAY_CONTRIBUTION)
|
||||
|
||||
uberInsert.addUInt32(GetUInt32Value(PLAYER_FIELD_YESTERDAY_CONTRIBUTION));
|
||||
uberInsert.addUInt32(0); // FIXME 4x GetUInt32Value(PLAYER_FIELD_YESTERDAY_CONTRIBUTION)
|
||||
|
||||
uberInsert.addUInt32(GetUInt32Value(PLAYER_FIELD_LIFETIME_HONORBALE_KILLS));
|
||||
|
||||
|
|
@ -17434,7 +17476,7 @@ void Player::SaveToDB()
|
|||
|
||||
uberInsert.addUInt32(GetUInt32Value(PLAYER_CHOSEN_TITLE));
|
||||
|
||||
uberInsert.addUInt64(GetUInt64Value(PLAYER_FIELD_KNOWN_CURRENCIES));
|
||||
uberInsert.addUInt64(0); // FIXME 4x GetUInt64Value(PLAYER_FIELD_KNOWN_CURRENCIES)
|
||||
|
||||
// FIXME: at this moment send to DB as unsigned, including unit32(-1)
|
||||
uberInsert.addUInt32(GetUInt32Value(PLAYER_FIELD_WATCHED_FACTION_INDEX));
|
||||
|
|
@ -17461,9 +17503,7 @@ void Player::SaveToDB()
|
|||
}
|
||||
uberInsert.addString(ss);
|
||||
|
||||
uberInsert.addUInt32(GetUInt32Value(PLAYER_AMMO_ID));
|
||||
|
||||
for (uint32 i = 0; i < KNOWN_TITLES_SIZE * 2; ++i) // string
|
||||
for(uint32 i = 0; i < KNOWN_TITLES_SIZE*2; ++i ) //string
|
||||
{
|
||||
ss << GetUInt32Value(PLAYER__FIELD_KNOWN_TITLES + i) << " ";
|
||||
}
|
||||
|
|
@ -18111,10 +18151,10 @@ void Player::_SaveStats()
|
|||
SqlStatement stmt = CharacterDatabase.CreateStatement(delStats, "DELETE FROM character_stats WHERE guid = ?");
|
||||
stmt.PExecute(GetGUIDLow());
|
||||
|
||||
stmt = CharacterDatabase.CreateStatement(insertStats, "INSERT INTO character_stats (guid, maxhealth, maxpower1, maxpower2, maxpower3, maxpower4, maxpower5, maxpower6, maxpower7, "
|
||||
"strength, agility, stamina, intellect, spirit, armor, resHoly, resFire, resNature, resFrost, resShadow, resArcane, "
|
||||
"blockPct, dodgePct, parryPct, critPct, rangedCritPct, spellCritPct, attackPower, rangedAttackPower, spellPower) "
|
||||
"VALUES ( ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)");
|
||||
stmt = CharacterDatabase.CreateStatement(insertStats, "INSERT INTO character_stats (guid, maxhealth, maxpower1, maxpower2, maxpower3, maxpower4, maxpower5, maxpower6, maxpower7, maxpower8, maxpower9, maxpower10"
|
||||
"strength, agility, stamina, intellect, spirit, armor, resHoly, resFire, resNature, resFrost, resShadow, resArcane, "
|
||||
"blockPct, dodgePct, parryPct, critPct, rangedCritPct, spellCritPct, attackPower, rangedAttackPower, spellPower) "
|
||||
"VALUES ( ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)");
|
||||
|
||||
stmt.addUInt32(GetGUIDLow());
|
||||
stmt.addUInt32(GetMaxHealth());
|
||||
|
|
@ -19245,7 +19285,7 @@ void Player::InitDisplayIds()
|
|||
}
|
||||
}
|
||||
|
||||
void Player::TakeExtendedCost(uint32 extendedCostId, uint32 count)
|
||||
/*void Player::TakeExtendedCost(uint32 extendedCostId, uint32 count)
|
||||
{
|
||||
ItemExtendedCostEntry const* extendedCost = sItemExtendedCostStore.LookupEntry(extendedCostId);
|
||||
|
||||
|
|
@ -19259,7 +19299,7 @@ void Player::TakeExtendedCost(uint32 extendedCostId, uint32 count)
|
|||
if (extendedCost->reqitem[i])
|
||||
DestroyItemCount(extendedCost->reqitem[i], extendedCost->reqitemcount[i] * count, true);
|
||||
}
|
||||
}
|
||||
}*/
|
||||
|
||||
// Return true is the bought item has a max count to force refresh of window by caller
|
||||
bool Player::BuyItemFromVendorSlot(ObjectGuid vendorGuid, uint32 vendorslot, uint32 item, uint8 count, uint8 bag, uint8 slot)
|
||||
|
|
@ -19344,7 +19384,7 @@ bool Player::BuyItemFromVendorSlot(ObjectGuid vendorGuid, uint32 vendorslot, uin
|
|||
return false;
|
||||
}
|
||||
|
||||
if (uint32 extendedCostId = crItem->ExtendedCost)
|
||||
/*if (uint32 extendedCostId = crItem->ExtendedCost)
|
||||
{
|
||||
ItemExtendedCostEntry const* iece = sItemExtendedCostStore.LookupEntry(extendedCostId);
|
||||
if (!iece)
|
||||
|
|
@ -19384,7 +19424,7 @@ bool Player::BuyItemFromVendorSlot(ObjectGuid vendorGuid, uint32 vendorslot, uin
|
|||
SendEquipError(EQUIP_ERR_CANT_EQUIP_RANK, NULL, NULL);
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}*/
|
||||
|
||||
uint32 price = (crItem->ExtendedCost == 0 || pProto->Flags2 & ITEM_FLAG2_EXT_COST_REQUIRES_GOLD) ? pProto->BuyPrice * count : 0;
|
||||
|
||||
|
|
@ -19412,8 +19452,8 @@ bool Player::BuyItemFromVendorSlot(ObjectGuid vendorGuid, uint32 vendorslot, uin
|
|||
|
||||
ModifyMoney(-int32(price));
|
||||
|
||||
if (crItem->ExtendedCost)
|
||||
TakeExtendedCost(crItem->ExtendedCost, count);
|
||||
/*if (crItem->ExtendedCost)
|
||||
TakeExtendedCost(crItem->ExtendedCost, count);*/
|
||||
|
||||
pItem = StoreNewItem(dest, item, true);
|
||||
}
|
||||
|
|
@ -19435,8 +19475,8 @@ bool Player::BuyItemFromVendorSlot(ObjectGuid vendorGuid, uint32 vendorslot, uin
|
|||
|
||||
ModifyMoney(-int32(price));
|
||||
|
||||
if (crItem->ExtendedCost)
|
||||
TakeExtendedCost(crItem->ExtendedCost, count);
|
||||
/*if (crItem->ExtendedCost)
|
||||
TakeExtendedCost(crItem->ExtendedCost, count);*/
|
||||
|
||||
pItem = EquipNewItem(dest, item, true);
|
||||
|
||||
|
|
@ -19572,9 +19612,9 @@ void Player::AddSpellAndCategoryCooldowns(SpellEntry const* spellInfo, uint32 it
|
|||
// if no cooldown found above then base at DBC data
|
||||
if (rec < 0 && catrec < 0)
|
||||
{
|
||||
cat = spellInfo->Category;
|
||||
rec = spellInfo->RecoveryTime;
|
||||
catrec = spellInfo->CategoryRecoveryTime;
|
||||
cat = spellInfo->GetCategory();
|
||||
rec = spellInfo->GetRecoveryTime();
|
||||
catrec = spellInfo->GetCategoryRecoveryTime();
|
||||
}
|
||||
|
||||
time_t curTime = time(NULL);
|
||||
|
|
@ -20449,10 +20489,13 @@ void Player::learnQuestRewardedSpells(Quest const* quest)
|
|||
bool found = false;
|
||||
for (int i = 0; i < MAX_EFFECT_INDEX; ++i)
|
||||
{
|
||||
if (spellInfo->Effect[i] == SPELL_EFFECT_LEARN_SPELL && !HasSpell(spellInfo->EffectTriggerSpell[i]))
|
||||
if(SpellEffectEntry const* spellEffect = spellInfo->GetSpellEffect(SpellEffectIndex(i)))
|
||||
{
|
||||
found = true;
|
||||
break;
|
||||
if(spellEffect->Effect == SPELL_EFFECT_LEARN_SPELL && !HasSpell(spellEffect->EffectTriggerSpell))
|
||||
{
|
||||
found = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -20461,8 +20504,10 @@ void Player::learnQuestRewardedSpells(Quest const* quest)
|
|||
return;
|
||||
|
||||
// prevent learn non first rank unknown profession and second specialization for same profession)
|
||||
uint32 learned_0 = spellInfo->EffectTriggerSpell[EFFECT_INDEX_0];
|
||||
if (sSpellMgr.GetSpellRank(learned_0) > 1 && !HasSpell(learned_0))
|
||||
SpellEffectEntry const* spellEffect = spellInfo->GetSpellEffect(EFFECT_INDEX_0);
|
||||
uint32 learned_0 = spellEffect ? spellEffect->EffectTriggerSpell : 0;
|
||||
|
||||
if( sSpellMgr.GetSpellRank(learned_0) > 1 && !HasSpell(learned_0) )
|
||||
{
|
||||
// not have first rank learned (unlearned prof?)
|
||||
uint32 first_spell = sSpellMgr.GetFirstSpellInChain(learned_0);
|
||||
|
|
@ -20474,7 +20519,9 @@ void Player::learnQuestRewardedSpells(Quest const* quest)
|
|||
return;
|
||||
|
||||
// specialization
|
||||
if (learnedInfo->Effect[EFFECT_INDEX_0] == SPELL_EFFECT_TRADE_SKILL && learnedInfo->Effect[EFFECT_INDEX_1] == 0)
|
||||
SpellEffectEntry const* learnedSpellEffect0 = learnedInfo->GetSpellEffect(EFFECT_INDEX_0);
|
||||
SpellEffectEntry const* learnedSpellEffect1 = learnedInfo->GetSpellEffect(EFFECT_INDEX_1);
|
||||
if (learnedSpellEffect0 && learnedSpellEffect0->Effect == SPELL_EFFECT_TRADE_SKILL && learnedSpellEffect1 && learnedSpellEffect1->Effect == 0)
|
||||
{
|
||||
// search other specialization for same prof
|
||||
for (PlayerSpellMap::const_iterator itr = m_spells.begin(); itr != m_spells.end(); ++itr)
|
||||
|
|
@ -20487,7 +20534,9 @@ void Player::learnQuestRewardedSpells(Quest const* quest)
|
|||
return;
|
||||
|
||||
// compare only specializations
|
||||
if (itrInfo->Effect[EFFECT_INDEX_0] != SPELL_EFFECT_TRADE_SKILL || itrInfo->Effect[EFFECT_INDEX_1] != 0)
|
||||
SpellEffectEntry const* itrSpellEffect0 = learnedInfo->GetSpellEffect(EFFECT_INDEX_0);
|
||||
SpellEffectEntry const* itrSpellEffect1 = learnedInfo->GetSpellEffect(EFFECT_INDEX_1);
|
||||
if ((itrSpellEffect0 && itrSpellEffect0->Effect != SPELL_EFFECT_TRADE_SKILL) || (itrSpellEffect1 && itrSpellEffect1->Effect != 0))
|
||||
continue;
|
||||
|
||||
// compare same chain spells
|
||||
|
|
@ -20889,12 +20938,13 @@ void Player::AutoUnequipOffhandIfNeed()
|
|||
|
||||
bool Player::HasItemFitToSpellReqirements(SpellEntry const* spellInfo, Item const* ignoreItem)
|
||||
{
|
||||
if (spellInfo->EquippedItemClass < 0)
|
||||
int32 itemClass = spellInfo->GetEquippedItemClass();
|
||||
if(itemClass < 0)
|
||||
return true;
|
||||
|
||||
// scan other equipped items for same requirements (mostly 2 daggers/etc)
|
||||
// for optimize check 2 used cases only
|
||||
switch (spellInfo->EquippedItemClass)
|
||||
switch(itemClass)
|
||||
{
|
||||
case ITEM_CLASS_WEAPON:
|
||||
{
|
||||
|
|
@ -20925,7 +20975,7 @@ bool Player::HasItemFitToSpellReqirements(SpellEntry const* spellInfo, Item cons
|
|||
break;
|
||||
}
|
||||
default:
|
||||
sLog.outError("HasItemFitToSpellReqirements: Not handled spell requirement for item class %u", spellInfo->EquippedItemClass);
|
||||
sLog.outError("HasItemFitToSpellReqirements: Not handled spell requirement for item class %u", itemClass);
|
||||
break;
|
||||
}
|
||||
|
||||
|
|
@ -22147,7 +22197,7 @@ void Player::LearnTalent(uint32 talentId, uint32 talentRank)
|
|||
return;
|
||||
|
||||
// Check if it requires another talent
|
||||
if (talentInfo->DependsOn > 0)
|
||||
/*if (talentInfo->DependsOn > 0)
|
||||
{
|
||||
if (TalentEntry const* depTalentInfo = sTalentStore.LookupEntry(talentInfo->DependsOn))
|
||||
{
|
||||
|
|
@ -22163,7 +22213,7 @@ void Player::LearnTalent(uint32 talentId, uint32 talentRank)
|
|||
if (!hasEnoughRank)
|
||||
return;
|
||||
}
|
||||
}
|
||||
}*/
|
||||
|
||||
// Find out how many points we have in this field
|
||||
uint32 spentPoints = 0;
|
||||
|
|
@ -22261,7 +22311,7 @@ void Player::LearnPetTalent(ObjectGuid petGuid, uint32 talentId, uint32 talentRa
|
|||
return;
|
||||
|
||||
// Check if it requires another talent
|
||||
if (talentInfo->DependsOn > 0)
|
||||
/*if (talentInfo->DependsOn > 0)
|
||||
{
|
||||
if (TalentEntry const* depTalentInfo = sTalentStore.LookupEntry(talentInfo->DependsOn))
|
||||
{
|
||||
|
|
@ -22275,7 +22325,7 @@ void Player::LearnPetTalent(ObjectGuid petGuid, uint32 talentId, uint32 talentRa
|
|||
if (!hasEnoughRank)
|
||||
return;
|
||||
}
|
||||
}
|
||||
}*/
|
||||
|
||||
// Find out how many points we have in this field
|
||||
uint32 spentPoints = 0;
|
||||
|
|
@ -22330,13 +22380,13 @@ void Player::LearnPetTalent(ObjectGuid petGuid, uint32 talentId, uint32 talentRa
|
|||
|
||||
void Player::UpdateKnownCurrencies(uint32 itemId, bool apply)
|
||||
{
|
||||
if (CurrencyTypesEntry const* ctEntry = sCurrencyTypesStore.LookupEntry(itemId))
|
||||
{
|
||||
if (apply)
|
||||
SetFlag64(PLAYER_FIELD_KNOWN_CURRENCIES, (UI64LIT(1) << (ctEntry->BitIndex - 1)));
|
||||
else
|
||||
RemoveFlag64(PLAYER_FIELD_KNOWN_CURRENCIES, (UI64LIT(1) << (ctEntry->BitIndex - 1)));
|
||||
}
|
||||
//if(CurrencyTypesEntry const* ctEntry = sCurrencyTypesStore.LookupEntry(itemId))
|
||||
//{
|
||||
// if(apply)
|
||||
// SetFlag64(PLAYER_FIELD_KNOWN_CURRENCIES, (UI64LIT(1) << (ctEntry->BitIndex - 1)));
|
||||
// else
|
||||
// RemoveFlag64(PLAYER_FIELD_KNOWN_CURRENCIES, (UI64LIT(1) << (ctEntry->BitIndex - 1)));
|
||||
//}
|
||||
}
|
||||
|
||||
void Player::UpdateFallInformationIfNeed(MovementInfo const& minfo, uint16 opcode)
|
||||
|
|
@ -22981,20 +23031,25 @@ void Player::SendDuelCountdown(uint32 counter)
|
|||
|
||||
bool Player::IsImmuneToSpellEffect(SpellEntry const* spellInfo, SpellEffectIndex index) const
|
||||
{
|
||||
switch (spellInfo->Effect[index])
|
||||
SpellEffectEntry const* spellEffect = spellInfo->GetSpellEffect(index);
|
||||
if(spellEffect)
|
||||
{
|
||||
case SPELL_EFFECT_ATTACK_ME:
|
||||
return true;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
switch (spellInfo->EffectApplyAuraName[index])
|
||||
{
|
||||
case SPELL_AURA_MOD_TAUNT:
|
||||
return true;
|
||||
default:
|
||||
break;
|
||||
switch(spellEffect->Effect)
|
||||
{
|
||||
case SPELL_EFFECT_ATTACK_ME:
|
||||
return true;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
switch(spellEffect->EffectApplyAuraName)
|
||||
{
|
||||
case SPELL_AURA_MOD_TAUNT:
|
||||
return true;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
return Unit::IsImmuneToSpellEffect(spellInfo, index);
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue