Core/Cleanup:
* move repeating code into separate method for storing locale strings in ObjectMgr (copy/paste sucks, you know) * fix 'signed/unsigned' warnings (at least in VS) * fix some other warnings and cleanup relative code --HG-- branch : trunk
This commit is contained in:
@@ -205,19 +205,19 @@ typedef UNORDERED_MAP<uint16, CreatureBaseStats> CreatureBaseStatsMap;
|
||||
|
||||
struct CreatureLocale
|
||||
{
|
||||
std::vector<std::string> Name;
|
||||
std::vector<std::string> SubName;
|
||||
StringVector Name;
|
||||
StringVector SubName;
|
||||
};
|
||||
|
||||
struct GossipMenuItemsLocale
|
||||
{
|
||||
std::vector<std::string> OptionText;
|
||||
std::vector<std::string> BoxText;
|
||||
StringVector OptionText;
|
||||
StringVector BoxText;
|
||||
};
|
||||
|
||||
struct PointOfInterestLocale
|
||||
{
|
||||
std::vector<std::string> IconName;
|
||||
StringVector IconName;
|
||||
};
|
||||
|
||||
struct EquipmentInfo
|
||||
|
||||
@@ -537,8 +537,8 @@ union GameObjectValue
|
||||
|
||||
struct GameObjectLocale
|
||||
{
|
||||
std::vector<std::string> Name;
|
||||
std::vector<std::string> CastBarCaption;
|
||||
StringVector Name;
|
||||
StringVector CastBarCaption;
|
||||
};
|
||||
|
||||
// client side GO show states
|
||||
|
||||
@@ -735,8 +735,8 @@ struct ItemPrototype
|
||||
|
||||
struct ItemLocale
|
||||
{
|
||||
std::vector<std::string> Name;
|
||||
std::vector<std::string> Description;
|
||||
StringVector Name;
|
||||
StringVector Description;
|
||||
};
|
||||
|
||||
struct ItemSetNameEntry
|
||||
@@ -747,7 +747,7 @@ struct ItemSetNameEntry
|
||||
|
||||
struct ItemSetNameLocale
|
||||
{
|
||||
std::vector<std::string> Name;
|
||||
StringVector Name;
|
||||
};
|
||||
|
||||
// GCC have alternative #pragma pack() syntax and old gcc version not support pack(pop), also any gcc version not support it at some platform
|
||||
|
||||
@@ -15518,15 +15518,15 @@ bool Player::HasQuestForItem(uint32 itemid) const
|
||||
ItemPrototype const *pProto = sObjectMgr.GetItemPrototype(itemid);
|
||||
|
||||
// 'unique' item
|
||||
if (pProto->MaxCount && GetItemCount(itemid,true) < pProto->MaxCount)
|
||||
if (pProto->MaxCount && int32(GetItemCount(itemid, true)) < pProto->MaxCount)
|
||||
return true;
|
||||
|
||||
// allows custom amount drop when not 0
|
||||
if (qinfo->ReqSourceCount[j])
|
||||
{
|
||||
if (GetItemCount(itemid,true) < qinfo->ReqSourceCount[j])
|
||||
if (GetItemCount(itemid, true) < qinfo->ReqSourceCount[j])
|
||||
return true;
|
||||
} else if (GetItemCount(itemid,true) < pProto->Stackable)
|
||||
} else if (int32(GetItemCount(itemid, true)) < pProto->Stackable)
|
||||
return true;
|
||||
}
|
||||
}
|
||||
@@ -15614,13 +15614,9 @@ void Player::SendQuestConfirmAccept(const Quest* pQuest, Player* pReceiver)
|
||||
int loc_idx = pReceiver->GetSession()->GetSessionDbLocaleIndex();
|
||||
|
||||
if (loc_idx >= 0)
|
||||
{
|
||||
if (const QuestLocale* pLocale = sObjectMgr.GetQuestLocale(pQuest->GetQuestId()))
|
||||
{
|
||||
if (pLocale->Title.size() > loc_idx && !pLocale->Title[loc_idx].empty())
|
||||
if (int(pLocale->Title.size()) > loc_idx && !pLocale->Title[loc_idx].empty())
|
||||
strTitle = pLocale->Title[loc_idx];
|
||||
}
|
||||
}
|
||||
|
||||
WorldPacket data(SMSG_QUEST_CONFIRM_ACCEPT, (4 + strTitle.size() + 8));
|
||||
data << uint32(pQuest->GetQuestId());
|
||||
|
||||
@@ -40,7 +40,7 @@ inline bool _ModifyUInt32(bool apply, uint32& baseValue, int32& amount)
|
||||
else
|
||||
{
|
||||
// Make sure we do not get uint32 overflow.
|
||||
if (amount > baseValue)
|
||||
if (amount > int32(baseValue))
|
||||
amount = baseValue;
|
||||
baseValue -= amount;
|
||||
}
|
||||
|
||||
@@ -1091,12 +1091,12 @@ void Unit::CalculateSpellDamageTaken(SpellNonMeleeDamage *damageInfo, int32 dama
|
||||
// Spell weapon based damage CAN BE crit & blocked at same time
|
||||
if (blocked)
|
||||
{
|
||||
damageInfo->blocked = uint32(pVictim->GetShieldBlockValue());
|
||||
damageInfo->blocked = pVictim->GetShieldBlockValue();
|
||||
//double blocked amount if block is critical
|
||||
if (pVictim->isBlockCritical())
|
||||
damageInfo->blocked+=damageInfo->blocked;
|
||||
if (damage < damageInfo->blocked)
|
||||
damageInfo->blocked = damage;
|
||||
damageInfo->blocked += damageInfo->blocked;
|
||||
if (damage < int32(damageInfo->blocked))
|
||||
damageInfo->blocked = uint32(damage);
|
||||
damage -= damageInfo->blocked;
|
||||
}
|
||||
|
||||
@@ -1941,7 +1941,7 @@ void Unit::CalcAbsorbResist(Unit *pVictim, SpellSchoolMask schoolMask, DamageEff
|
||||
pVictim->CastCustomSpell(pVictim, 66235, &healAmount, NULL, NULL, true);
|
||||
pVictim->ToPlayer()->AddSpellCooldown(66235,0,time(NULL) + 120);
|
||||
}
|
||||
else if (remainingHealth < allowedHealth)
|
||||
else if (remainingHealth < int32(allowedHealth))
|
||||
{
|
||||
// Reduce damage that brings us under 35% (or full damage if we are already under 35%) by x%
|
||||
uint32 damageToReduce = (pVictim->GetHealth() < allowedHealth)
|
||||
@@ -2203,7 +2203,7 @@ void Unit::CalcAbsorbResist(Unit *pVictim, SpellSchoolMask schoolMask, DamageEff
|
||||
RemainingDamage += auraAbsorbMod * TotalAbsorb / 100;
|
||||
|
||||
// Apply death prevention spells effects
|
||||
if (preventDeathSpell && RemainingDamage >= pVictim->GetHealth())
|
||||
if (preventDeathSpell && RemainingDamage >= int32(pVictim->GetHealth()))
|
||||
{
|
||||
switch(preventDeathSpell->SpellFamilyName)
|
||||
{
|
||||
@@ -2930,44 +2930,44 @@ SpellMissInfo Unit::MagicSpellHitResult(Unit *pVictim, SpellEntry const *spell)
|
||||
if (Player *modOwner = GetSpellModOwner())
|
||||
modOwner->ApplySpellMod(spell->Id, SPELLMOD_RESIST_MISS_CHANCE, modHitChance);
|
||||
// Increase from attacker SPELL_AURA_MOD_INCREASES_SPELL_PCT_TO_HIT auras
|
||||
modHitChance+=GetTotalAuraModifierByMiscMask(SPELL_AURA_MOD_INCREASES_SPELL_PCT_TO_HIT, schoolMask);
|
||||
modHitChance += GetTotalAuraModifierByMiscMask(SPELL_AURA_MOD_INCREASES_SPELL_PCT_TO_HIT, schoolMask);
|
||||
// Chance hit from victim SPELL_AURA_MOD_ATTACKER_SPELL_HIT_CHANCE auras
|
||||
modHitChance+= pVictim->GetTotalAuraModifierByMiscMask(SPELL_AURA_MOD_ATTACKER_SPELL_HIT_CHANCE, schoolMask);
|
||||
modHitChance += pVictim->GetTotalAuraModifierByMiscMask(SPELL_AURA_MOD_ATTACKER_SPELL_HIT_CHANCE, schoolMask);
|
||||
// Reduce spell hit chance for Area of effect spells from victim SPELL_AURA_MOD_AOE_AVOIDANCE aura
|
||||
if (IsAreaOfEffectSpell(spell))
|
||||
modHitChance-=pVictim->GetTotalAuraModifier(SPELL_AURA_MOD_AOE_AVOIDANCE);
|
||||
modHitChance -= pVictim->GetTotalAuraModifier(SPELL_AURA_MOD_AOE_AVOIDANCE);
|
||||
|
||||
int32 HitChance = modHitChance * 100;
|
||||
// Increase hit chance from attacker SPELL_AURA_MOD_SPELL_HIT_CHANCE and attacker ratings
|
||||
HitChance += int32(m_modSpellHitChance*100.0f);
|
||||
HitChance += int32(m_modSpellHitChance * 100.0f);
|
||||
|
||||
// Decrease hit chance from victim rating bonus
|
||||
if (pVictim->GetTypeId() == TYPEID_PLAYER)
|
||||
HitChance -= int32(pVictim->ToPlayer()->GetRatingBonusValue(CR_HIT_TAKEN_SPELL)*100.0f);
|
||||
HitChance -= int32(pVictim->ToPlayer()->GetRatingBonusValue(CR_HIT_TAKEN_SPELL) * 100.0f);
|
||||
|
||||
if (HitChance < 100)
|
||||
HitChance = 100;
|
||||
if (HitChance < 100)
|
||||
HitChance = 100;
|
||||
else if (HitChance > 10000)
|
||||
HitChance = 10000;
|
||||
|
||||
int32 tmp = 10000 - HitChance;
|
||||
|
||||
uint32 rand = urand(0,10000);
|
||||
int32 rand = irand(0, 10000);
|
||||
|
||||
if (rand < tmp)
|
||||
return SPELL_MISS_MISS;
|
||||
|
||||
// Chance resist mechanic (select max value from every mechanic spell effect)
|
||||
int32 resist_chance = pVictim->GetMechanicResistChance(spell)*100;
|
||||
int32 resist_chance = pVictim->GetMechanicResistChance(spell) * 100;
|
||||
tmp += resist_chance;
|
||||
|
||||
// Chance resist debuff
|
||||
if (!IsPositiveSpell(spell->Id))
|
||||
{
|
||||
bool bNegativeAura = false;
|
||||
for (uint8 I = 0; I < 3; I++)
|
||||
for (uint8 i = 0; i < 3; ++i)
|
||||
{
|
||||
if (spell->EffectApplyAuraName[I] != 0)
|
||||
if (spell->EffectApplyAuraName[i] != 0)
|
||||
{
|
||||
bNegativeAura = true;
|
||||
break;
|
||||
@@ -2986,10 +2986,10 @@ SpellMissInfo Unit::MagicSpellHitResult(Unit *pVictim, SpellEntry const *spell)
|
||||
return SPELL_MISS_RESIST;
|
||||
|
||||
// cast by caster in front of victim
|
||||
if (pVictim->HasInArc(M_PI,this) || pVictim->HasAuraType(SPELL_AURA_IGNORE_HIT_DIRECTION))
|
||||
if (pVictim->HasInArc(M_PI, this) || pVictim->HasAuraType(SPELL_AURA_IGNORE_HIT_DIRECTION))
|
||||
{
|
||||
int32 deflect_chance = pVictim->GetTotalAuraModifier(SPELL_AURA_DEFLECT_SPELLS)*100;
|
||||
tmp+=deflect_chance;
|
||||
int32 deflect_chance = pVictim->GetTotalAuraModifier(SPELL_AURA_DEFLECT_SPELLS) * 100;
|
||||
tmp += deflect_chance;
|
||||
if (rand < tmp)
|
||||
return SPELL_MISS_DEFLECT;
|
||||
}
|
||||
@@ -5481,12 +5481,13 @@ bool Unit::HandleDummyAuraProc(Unit *pVictim, uint32 damage, AuraEffect* trigger
|
||||
case 25988:
|
||||
{
|
||||
// return damage % to attacker but < 50% own total health
|
||||
basepoints0 = int32((triggerAmount* damage) /100);
|
||||
basepoints0 = int32((triggerAmount * damage) /100);
|
||||
|
||||
if (basepoints0 > GetMaxHealth()/2)
|
||||
basepoints0 = GetMaxHealth()/2;
|
||||
int32 halfMaxHealth = int32(CountPctFromMaxHealth(50));
|
||||
if (basepoints0 > halfMaxHealth)
|
||||
basepoints0 = halfMaxHealth;
|
||||
|
||||
sLog.outDebug("DEBUG LINE: Data about Eye for an Eye ID %u, damage taken %u, unit max health %u, damage done %u", dummySpell->Id, damage, GetMaxHealth(),basepoints0);
|
||||
sLog.outDebug("DEBUG LINE: Data about Eye for an Eye ID %u, damage taken %u, unit max health %u, damage done %u", dummySpell->Id, damage, GetMaxHealth(), basepoints0);
|
||||
|
||||
triggered_spell_id = 25997;
|
||||
|
||||
@@ -6179,7 +6180,7 @@ bool Unit::HandleDummyAuraProc(Unit *pVictim, uint32 damage, AuraEffect* trigger
|
||||
if (procSpell && procSpell->Id == 27285)
|
||||
return false;
|
||||
// if damage is more than need or target die from damage deal finish spell
|
||||
if (triggeredByAura->GetAmount() <= damage || GetHealth() <= damage)
|
||||
if (triggeredByAura->GetAmount() <= int32(damage) || GetHealth() <= damage)
|
||||
{
|
||||
// remember guid before aura delete
|
||||
uint64 casterGuid = triggeredByAura->GetCasterGUID();
|
||||
@@ -6198,10 +6199,10 @@ bool Unit::HandleDummyAuraProc(Unit *pVictim, uint32 damage, AuraEffect* trigger
|
||||
return true;
|
||||
}
|
||||
// Seed of Corruption (Mobs cast) - no die req
|
||||
if (dummySpell->SpellFamilyFlags.IsEqual(0,0,0) && dummySpell->SpellIconID == 1932)
|
||||
if (dummySpell->SpellFamilyFlags.IsEqual(0, 0, 0) && dummySpell->SpellIconID == 1932)
|
||||
{
|
||||
// if damage is more than need deal finish spell
|
||||
if (triggeredByAura->GetAmount() <= damage)
|
||||
if (triggeredByAura->GetAmount() <= int32(damage))
|
||||
{
|
||||
// remember guid before aura delete
|
||||
uint64 casterGuid = triggeredByAura->GetCasterGUID();
|
||||
@@ -12130,7 +12131,7 @@ bool Unit::canDetectInvisibilityOf(Unit const* u) const
|
||||
uint32 invLevel = 0;
|
||||
Unit::AuraEffectList const& iAuras = u->GetAuraEffectsByType(SPELL_AURA_MOD_INVISIBILITY);
|
||||
for (Unit::AuraEffectList::const_iterator itr = iAuras.begin(); itr != iAuras.end(); ++itr)
|
||||
if (uint8((*itr)->GetMiscValue()) == i && invLevel < (*itr)->GetAmount())
|
||||
if (uint8((*itr)->GetMiscValue()) == i && int32(invLevel) < (*itr)->GetAmount())
|
||||
invLevel = (*itr)->GetAmount();
|
||||
|
||||
// find invisibility detect level
|
||||
@@ -12143,7 +12144,7 @@ bool Unit::canDetectInvisibilityOf(Unit const* u) const
|
||||
{
|
||||
Unit::AuraEffectList const& dAuras = GetAuraEffectsByType(SPELL_AURA_MOD_INVISIBILITY_DETECTION);
|
||||
for (Unit::AuraEffectList::const_iterator itr = dAuras.begin(); itr != dAuras.end(); ++itr)
|
||||
if (uint8((*itr)->GetMiscValue()) == i && detectLevel < (*itr)->GetAmount())
|
||||
if (uint8((*itr)->GetMiscValue()) == i && int32(detectLevel) < (*itr)->GetAmount())
|
||||
detectLevel = (*itr)->GetAmount();
|
||||
}
|
||||
|
||||
@@ -12237,12 +12238,12 @@ void Unit::UpdateSpeed(UnitMoveType mtype, bool forced)
|
||||
stack_bonus = GetTotalAuraMultiplier(SPELL_AURA_MOD_VEHICLE_SPEED_ALWAYS);
|
||||
|
||||
// for some spells this mod is applied on vehicle owner
|
||||
uint32 owner_speed_mod = 0;
|
||||
int32 owner_speed_mod = 0;
|
||||
|
||||
if (Unit * owner = GetCharmer())
|
||||
owner_speed_mod = owner->GetMaxPositiveAuraModifier(SPELL_AURA_MOD_INCREASE_VEHICLE_FLIGHT_SPEED);
|
||||
|
||||
main_speed_mod = main_speed_mod>owner_speed_mod ? main_speed_mod : owner_speed_mod;
|
||||
main_speed_mod = std::max(main_speed_mod, owner_speed_mod);
|
||||
}
|
||||
else if (IsMounted())
|
||||
{
|
||||
@@ -12924,7 +12925,7 @@ void Unit::IncrDiminishing(DiminishingGroup group)
|
||||
{
|
||||
if (i->DRGroup != group)
|
||||
continue;
|
||||
if (i->hitCount < GetDiminishingReturnsMaxLevel(group))
|
||||
if (int32(i->hitCount) < GetDiminishingReturnsMaxLevel(group))
|
||||
i->hitCount += 1;
|
||||
return;
|
||||
}
|
||||
@@ -14246,7 +14247,7 @@ void Unit::ProcDamageAndSpellFor(bool isVictim, Unit * pTarget, uint32 procFlag,
|
||||
{
|
||||
int32 damageLeft = triggeredByAura->GetAmount();
|
||||
// No damage left
|
||||
if (damageLeft < damage)
|
||||
if (damageLeft < int32(damage))
|
||||
i->aura->Remove();
|
||||
else
|
||||
triggeredByAura->SetAmount(damageLeft - damage);
|
||||
|
||||
Reference in New Issue
Block a user