diff options
author | maximius <none@none> | 2009-09-14 16:02:13 -0700 |
---|---|---|
committer | maximius <none@none> | 2009-09-14 16:02:13 -0700 |
commit | b37f9b1e55bd4b80597b8b8c3f461aad70ccc5c1 (patch) | |
tree | c637055aab5d8f0e733fc611fada42c43ad04d83 | |
parent | 7b664c8c9fdda2b963f7883684a2f31d0f79551b (diff) |
*Merged MaNGOS [8458], [8475], [8476] by ogeraisi, thanks to all authors :)
--HG--
branch : trunk
34 files changed, 149 insertions, 113 deletions
diff --git a/src/game/BattleGround.cpp b/src/game/BattleGround.cpp index 8ac19588b7c..7163a9874f8 100644 --- a/src/game/BattleGround.cpp +++ b/src/game/BattleGround.cpp @@ -1906,5 +1906,6 @@ WorldSafeLocsEntry const* BattleGround::GetClosestGraveYard( Player* player ) bool BattleGround::IsTeamScoreInRange(uint32 team, uint32 minScore, uint32 maxScore) const { BattleGroundTeamId team_idx = GetTeamIndexByTeamId(team); - return m_TeamScores[team_idx] >= minScore && m_TeamScores[team_idx] <= maxScore; + uint32 score = (m_TeamScores[team_idx] < 0) ? 0 : uint32(m_TeamScores[team_idx]); + return score >= minScore && score <= maxScore; } diff --git a/src/game/BattleGroundAB.cpp b/src/game/BattleGroundAB.cpp index a6e9e9b97d7..adf480d6f97 100644 --- a/src/game/BattleGroundAB.cpp +++ b/src/game/BattleGroundAB.cpp @@ -689,8 +689,8 @@ bool BattleGroundAB::IsAllNodesConrolledByTeam(uint32 team) const { uint32 count = 0; for(int i = 0; i < BG_AB_DYNAMIC_NODES_COUNT; ++i) - if (team == ALLIANCE && m_Nodes[i] == BG_AB_NODE_STATUS_ALLY_OCCUPIED || - team == HORDE && m_Nodes[i] == BG_AB_NODE_STATUS_HORDE_OCCUPIED) + if ((team == ALLIANCE && m_Nodes[i] == BG_AB_NODE_STATUS_ALLY_OCCUPIED) || + (team == HORDE && m_Nodes[i] == BG_AB_NODE_STATUS_HORDE_OCCUPIED)) ++count; return count == BG_AB_DYNAMIC_NODES_COUNT; diff --git a/src/game/BattleGroundMgr.h b/src/game/BattleGroundMgr.h index dbf68dc1d31..1b07676ddfc 100644 --- a/src/game/BattleGroundMgr.h +++ b/src/game/BattleGroundMgr.h @@ -149,8 +149,8 @@ class BGQueueInviteEvent : public BasicEvent private: uint64 m_PlayerGuid; uint32 m_BgInstanceGUID; - uint32 m_RemoveTime; BattleGroundTypeId m_BgTypeId; + uint32 m_RemoveTime; }; /* diff --git a/src/game/Chat.cpp b/src/game/Chat.cpp index 068d524b9ad..41cdac7c7d2 100644 --- a/src/game/Chat.cpp +++ b/src/game/Chat.cpp @@ -1274,7 +1274,7 @@ valid examples: char c = reader.peek(); // ignore enchants etc. - while(c >='0' && c <='9' || c==':') + while ((c >= '0' && c <= '9') || c== ':') { reader.ignore(1); c = reader.peek(); diff --git a/src/game/Creature.cpp b/src/game/Creature.cpp index a04ec449fbd..01eeb234159 100644 --- a/src/game/Creature.cpp +++ b/src/game/Creature.cpp @@ -247,7 +247,7 @@ void Creature::SearchFormationAndPath() void Creature::RemoveCorpse() { - if( getDeathState()!=CORPSE && !m_isDeadByDefault || getDeathState()!=ALIVE && m_isDeadByDefault ) + if ((getDeathState() != CORPSE && !m_isDeadByDefault) || (getDeathState() != ALIVE && m_isDeadByDefault)) return; m_deathTimer = 0; @@ -1736,10 +1736,10 @@ float Creature::GetAttackDistance(Unit const* pl) const if(aggroRate==0) return 0.0f; - int32 playerlevel = pl->getLevelForTarget(this); - int32 creaturelevel = getLevelForTarget(pl); + uint32 playerlevel = pl->getLevelForTarget(this); + uint32 creaturelevel = getLevelForTarget(pl); - int32 leveldif = playerlevel - creaturelevel; + int32 leveldif = int32(playerlevel) - int32(creaturelevel); // "The maximum Aggro Radius has a cap of 25 levels under. Example: A level 30 char has the same Aggro Radius of a level 5 char on a level 60 mob." if ( leveldif < - 25) @@ -2027,7 +2027,7 @@ bool Creature::IsVisibleInGridForPlayer(Player const* pl) const { if( GetEntry() == VISUAL_WAYPOINT && !pl->isGameMaster() ) return false; - return isAlive() || m_deathTimer > 0 || m_isDeadByDefault && m_deathState==CORPSE; + return (isAlive() || m_deathTimer > 0 || (m_isDeadByDefault && m_deathState == CORPSE)); } // Dead player see live creatures near own corpse diff --git a/src/game/CreatureEventAI.cpp b/src/game/CreatureEventAI.cpp index b7795dc3927..bf606c6c488 100644 --- a/src/game/CreatureEventAI.cpp +++ b/src/game/CreatureEventAI.cpp @@ -381,7 +381,7 @@ void CreatureEventAI::ProcessAction(CreatureEventAI_Action const& action, uint32 target = owner; } } - else if (target = m_creature->getVictim()) + else if ((target = m_creature->getVictim())) { if (target->GetTypeId() != TYPEID_PLAYER) if (Unit* owner = target->GetOwner()) diff --git a/src/game/GameObject.cpp b/src/game/GameObject.cpp index c60ec02bab9..18a80ce46fe 100644 --- a/src/game/GameObject.cpp +++ b/src/game/GameObject.cpp @@ -402,6 +402,7 @@ void GameObject::Update(uint32 /*p_time*/) if (GetGOInfo()->GetAutoCloseTime() && (m_cooldownTime < time(NULL))) ResetDoorOrButton(); break; + default: break; } break; } diff --git a/src/game/GridNotifiers.h b/src/game/GridNotifiers.h index e11e1210ff5..399e50def3f 100644 --- a/src/game/GridNotifiers.h +++ b/src/game/GridNotifiers.h @@ -1224,7 +1224,7 @@ namespace Trinity ~LocalizedPacketListDo() { for(size_t i = 0; i < i_data_cache.size(); ++i) - for(int j = 0; j < i_data_cache[i].size(); ++j) + for(size_t j = 0; j < i_data_cache[i].size(); ++j) delete i_data_cache[i][j]; } void operator()( Player* p ); diff --git a/src/game/Guild.h b/src/game/Guild.h index 0e70ed53fd0..7a715be8911 100644 --- a/src/game/Guild.h +++ b/src/game/Guild.h @@ -297,19 +297,19 @@ class Guild uint32 GetId(){ return m_Id; } const uint64& GetLeader(){ return m_LeaderGuid; } - std::string GetName(){ return m_Name; } - std::string GetMOTD(){ return MOTD; } - std::string GetGINFO(){ return GINFO; } - - uint32 GetCreatedYear(){ return m_CreatedYear; } - uint32 GetCreatedMonth(){ return m_CreatedMonth; } - uint32 GetCreatedDay(){ return m_CreatedDay; } - - uint32 GetEmblemStyle(){ return m_EmblemStyle; } - uint32 GetEmblemColor(){ return m_EmblemColor; } - uint32 GetBorderStyle(){ return m_BorderStyle; } - uint32 GetBorderColor(){ return m_BorderColor; } - uint32 GetBackgroundColor(){ return m_BackgroundColor; } + std::string const& GetName() const { return m_Name; } + std::string const& GetMOTD() const { return MOTD; } + std::string const& GetGINFO() const { return GINFO; } + + uint32 GetCreatedYear() const { return m_CreatedYear; } + uint32 GetCreatedMonth() const { return m_CreatedMonth; } + uint32 GetCreatedDay() const { return m_CreatedDay; } + + uint32 GetEmblemStyle() const { return m_EmblemStyle; } + uint32 GetEmblemColor() const { return m_EmblemColor; } + uint32 GetBorderStyle() const { return m_BorderStyle; } + uint32 GetBorderColor() const { return m_BorderColor; } + uint32 GetBackgroundColor() const { return m_BackgroundColor; } void SetLeader(uint64 guid); bool AddMember(uint64 plGuid, uint32 plRank); diff --git a/src/game/GuildHandler.cpp b/src/game/GuildHandler.cpp index 4b163c09e85..c11ad11766b 100644 --- a/src/game/GuildHandler.cpp +++ b/src/game/GuildHandler.cpp @@ -1074,7 +1074,7 @@ void WorldSession::HandleGuildBankSwapItems( WorldPacket & recv_data ) recv_data >> unk2; // always 0 recv_data >> SplitedAmount; - if (BankTabSlotDst >= GUILD_BANK_MAX_SLOTS || BankTabDst == BankTab && BankTabSlotDst == BankTabSlot) + if (BankTabSlotDst >= GUILD_BANK_MAX_SLOTS || (BankTabDst == BankTab && BankTabSlotDst == BankTabSlot)) { recv_data.rpos(recv_data.wpos()); // prevent additional spam at rejected packet return; diff --git a/src/game/Level0.cpp b/src/game/Level0.cpp index efc09494d1d..2692fdbe953 100644 --- a/src/game/Level0.cpp +++ b/src/game/Level0.cpp @@ -149,7 +149,7 @@ bool ChatHandler::HandleSaveCommand(const char* /*args*/) // save or plan save after 20 sec (logout delay) if current next save time more this value and _not_ output any messages to prevent cheat planning uint32 save_interval = sWorld.getConfig(CONFIG_INTERVAL_SAVE); - if(save_interval==0 || save_interval > 20*IN_MILISECONDS && player->GetSaveTimer() <= save_interval - 20*IN_MILISECONDS) + if (save_interval==0 || (save_interval > 20*IN_MILISECONDS && player->GetSaveTimer() <= save_interval - 20*IN_MILISECONDS)) player->SaveToDB(); return true; @@ -164,7 +164,7 @@ bool ChatHandler::HandleGMListIngameCommand(const char* /*args*/) for(; itr != m.end(); ++itr) { AccountTypes itr_sec = itr->second->GetSession()->GetSecurity(); - if ((itr->second->isGameMaster() || itr_sec > SEC_PLAYER && itr_sec <= sWorld.getConfig(CONFIG_GM_LEVEL_IN_GM_LIST)) && + if ((itr->second->isGameMaster() || (itr_sec > SEC_PLAYER && itr_sec <= sWorld.getConfig(CONFIG_GM_LEVEL_IN_GM_LIST))) && (!m_session || itr->second->IsVisibleGloballyFor(m_session->GetPlayer()))) { if(first) diff --git a/src/game/Level1.cpp b/src/game/Level1.cpp index 2f0579b3d1d..f9adcf1dbaf 100644 --- a/src/game/Level1.cpp +++ b/src/game/Level1.cpp @@ -2736,7 +2736,7 @@ bool ChatHandler::HandleGoTaxinodeCommand(const char* args) return false; } - if (node->x == 0.0f && node->y == 0.0f && node->z == 0.0f || + if ((node->x == 0.0f && node->y == 0.0f && node->z == 0.0f) || !MapManager::IsValidMapCoord(node->map_id,node->x,node->y,node->z)) { PSendSysMessage(LANG_INVALID_TARGET_COORD,node->x,node->y,node->map_id); @@ -2873,7 +2873,7 @@ bool ChatHandler::HandleGoZoneXYCommand(const char* args) float y = (float)atof(py); // prevent accept wrong numeric args - if (x==0.0f && *px!='0' || y==0.0f && *py!='0') + if ((x==0.0f && *px!='0') || (y==0.0f && *py!='0')) return false; uint32 areaid = cAreaId ? (uint32)atoi(cAreaId) : _player->GetZoneId(); diff --git a/src/game/Level2.cpp b/src/game/Level2.cpp index 5e545fa5a41..eadd6bc1cf5 100644 --- a/src/game/Level2.cpp +++ b/src/game/Level2.cpp @@ -3066,7 +3066,7 @@ bool ChatHandler::HandleWpShowCommand(const char* args) return false; } - sLog.outDebug("DEBUG: UPDATE waypoint_data SET wpguid = '%u"); + sLog.outDebug("DEBUG: UPDATE waypoint_data SET wpguid = '%u", wpCreature->GetGUIDLow()); // set "wpguid" column to the visual waypoint WorldDatabase.PExecuteLog("UPDATE waypoint_data SET wpguid = '%u' WHERE id = '%u' and point = '%u'", wpCreature->GetGUIDLow(), pathid, point); @@ -3670,8 +3670,6 @@ void ChatHandler::HandleLearnSkillRecipesHelper(Player* player,uint32 skill_id) bool ChatHandler::HandleLearnAllCraftsCommand(const char* /*args*/) { - uint32 classmask = m_session->GetPlayer()->getClassMask(); - for (uint32 i = 0; i < sSkillLineStore.GetNumRows(); ++i) { SkillLineEntry const *skillInfo = sSkillLineStore.LookupEntry(i); @@ -3714,8 +3712,6 @@ bool ChatHandler::HandleLearnAllRecipesCommand(const char* args) // converting string that we try to find to lower case wstrToLower( wnamepart ); - uint32 classmask = m_session->GetPlayer()->getClassMask(); - std::string name; SkillLineEntry const *targetSkillInfo = NULL; diff --git a/src/game/Level3.cpp b/src/game/Level3.cpp index 025a367528c..488b28ff280 100644 --- a/src/game/Level3.cpp +++ b/src/game/Level3.cpp @@ -5438,7 +5438,7 @@ bool ChatHandler::HandleServerRestartCommand(const char* args) int32 time = atoi (time_str); ///- Prevent interpret wrong arg value as 0 secs shutdown time - if(time == 0 && (time_str[0]!='0' || time_str[1]!='\0') || time < 0) + if ((time == 0 && (time_str[0]!='0' || time_str[1]!='\0')) || time < 0) return false; if (exitcode_str) @@ -5473,7 +5473,7 @@ bool ChatHandler::HandleServerIdleRestartCommand(const char* args) int32 time = atoi (time_str); ///- Prevent interpret wrong arg value as 0 secs shutdown time - if(time == 0 && (time_str[0]!='0' || time_str[1]!='\0') || time < 0) + if ((time == 0 && (time_str[0]!='0' || time_str[1]!='\0')) || time < 0) return false; if (exitcode_str) @@ -5508,7 +5508,7 @@ bool ChatHandler::HandleServerIdleShutDownCommand(const char* args) int32 time = atoi (time_str); ///- Prevent interpret wrong arg value as 0 secs shutdown time - if(time == 0 && (time_str[0]!='0' || time_str[1]!='\0') || time < 0) + if ((time == 0 && (time_str[0]!='0' || time_str[1]!='\0')) || time < 0) return false; if (exitcode_str) @@ -7068,7 +7068,7 @@ bool ChatHandler::HandleSendItemsCommand(const char* args) } uint32 item_count = itemCountStr ? atoi(itemCountStr) : 1; - if(item_count < 1 || item_proto->MaxCount > 0 && item_count > uint32(item_proto->MaxCount)) + if (item_count < 1 || (item_proto->MaxCount > 0 && item_count > uint32(item_proto->MaxCount))) { PSendSysMessage(LANG_COMMAND_INVALID_ITEM_COUNT, item_count,item_id); SetSentErrorMessage(true); diff --git a/src/game/LootHandler.cpp b/src/game/LootHandler.cpp index 7a7f78fb90a..63e7308e340 100644 --- a/src/game/LootHandler.cpp +++ b/src/game/LootHandler.cpp @@ -47,7 +47,7 @@ void WorldSession::HandleAutostoreLootItemOpcode( WorldPacket & recv_data ) GameObject *go = player->GetMap()->GetGameObject(lguid); // not check distance for GO in case owned GO (fishing bobber case, for example) or Fishing hole GO - if (!go || (go->GetOwnerGUID() != _player->GetGUID() && go->GetGoType() != GAMEOBJECT_TYPE_FISHINGHOLE) && !go->IsWithinDistInMap(_player,INTERACTION_DISTANCE)) + if (!go || ((go->GetOwnerGUID() != _player->GetGUID() && go->GetGoType() != GAMEOBJECT_TYPE_FISHINGHOLE) && !go->IsWithinDistInMap(_player,INTERACTION_DISTANCE))) { player->SendLootRelease(lguid); return; @@ -292,7 +292,7 @@ void WorldSession::DoLootRelease( uint64 lguid ) GameObject *go = GetPlayer()->GetMap()->GetGameObject(lguid); // not check distance for GO in case owned GO (fishing bobber case, for example) or Fishing hole GO - if (!go || (go->GetOwnerGUID() != _player->GetGUID() && go->GetGoType() != GAMEOBJECT_TYPE_FISHINGHOLE) && !go->IsWithinDistInMap(_player,INTERACTION_DISTANCE)) + if (!go || ((go->GetOwnerGUID() != _player->GetGUID() && go->GetGoType() != GAMEOBJECT_TYPE_FISHINGHOLE) && !go->IsWithinDistInMap(_player,INTERACTION_DISTANCE))) return; loot = &go->loot; diff --git a/src/game/Map.cpp b/src/game/Map.cpp index 4c6dbba2e90..2fba8c37d2c 100644 --- a/src/game/Map.cpp +++ b/src/game/Map.cpp @@ -1870,7 +1870,8 @@ uint16 Map::GetAreaFlag(float x, float y, float z) const // Makers' Overlook (ground and cave) else if (x > 5634.48f && x < 5774.53f && y < 3475.0f && z > 300.0f) { - if(y > 3380.26f || y > 3265.0f && z < 360.0f) areaflag = 2187; + if(y > 3380.26f || y > 3265.0f && z < 360.0f) + areaflag = 2187; } break; // The Makers' Perch (underground) @@ -1949,7 +1950,7 @@ void Map::GetZoneAndAreaIdByAreaFlag(uint32& zoneid, uint32& areaid, uint16 area bool Map::IsInWater(float x, float y, float pZ, float min_depth) const { // Check surface in x, y point for liquid - if (GridMap* gmap = const_cast<Map*>(this)->GetGrid(x, y)) + if (const_cast<Map*>(this)->GetGrid(x, y)) { LiquidData liquid_status; if (getLiquidStatus(x, y, pZ, MAP_ALL_LIQUIDS, &liquid_status)) @@ -1963,7 +1964,7 @@ bool Map::IsInWater(float x, float y, float pZ, float min_depth) const bool Map::IsUnderWater(float x, float y, float z) const { - if (GridMap* gmap = const_cast<Map*>(this)->GetGrid(x, y)) + if (const_cast<Map*>(this)->GetGrid(x, y)) { if (getLiquidStatus(x, y, z, MAP_LIQUID_TYPE_WATER|MAP_LIQUID_TYPE_OCEAN)&LIQUID_MAP_UNDER_WATER) return true; diff --git a/src/game/MotionMaster.cpp b/src/game/MotionMaster.cpp index d77bd83ede2..0c6aa44ad1d 100644 --- a/src/game/MotionMaster.cpp +++ b/src/game/MotionMaster.cpp @@ -95,7 +95,7 @@ MotionMaster::UpdateMotion(uint32 diff) if (m_expList) { - for (int i = 0; i < m_expList->size(); ++i) + for (size_t i = 0; i < m_expList->size(); ++i) { MovementGenerator* mg = (*m_expList)[i]; DirectDelete(mg); diff --git a/src/game/MovementHandler.cpp b/src/game/MovementHandler.cpp index 40be00327f5..00a783190e9 100644 --- a/src/game/MovementHandler.cpp +++ b/src/game/MovementHandler.cpp @@ -485,7 +485,7 @@ void WorldSession::HandleSetActiveMoverOpcode(WorldPacket &recv_data) } else { - sLog.outError("HandleSetActiveMoverOpcode: incorrect mover guid: mover is " I64FMT " and should be " I64FMT, guid, _player->m_mover->GetGUID()); + sLog.outError("HandleSetActiveMoverOpcode: incorrect mover guid: mover is " I64FMT " and should be " I64FMT, _player->m_mover->GetGUID(), guid); GetPlayer()->SetMover(GetPlayer()); } } @@ -499,7 +499,7 @@ void WorldSession::HandleMoveNotActiveMover(WorldPacket &recv_data) /*if(_player->m_mover->GetGUID() == old_mover_guid) { - sLog.outError("HandleMoveNotActiveMover: incorrect mover guid: mover is " I64FMT " and should be " I64FMT " instead of " I64FMT, _player->m_mover->GetGUID(), _player->GetGUID(), old_mover_guid); + sLog.outError("HandleMoveNotActiveMover: incorrect mover guid: mover is " I64FMT " and should be " I64FMT " instead of " UI64FMTD, _player->m_mover->GetGUID(), _player->GetGUID(), old_mover_guid); recv_data.rpos(recv_data.wpos()); // prevent warnings spam return; }*/ diff --git a/src/game/ObjectMgr.cpp b/src/game/ObjectMgr.cpp index 2f4bad688ef..9054969b733 100644 --- a/src/game/ObjectMgr.cpp +++ b/src/game/ObjectMgr.cpp @@ -115,7 +115,7 @@ bool SpellClickInfo::IsFitToRequirements(Player const* player, Creature const * if(questStart) { // not in expected required quest state - if(!player || (!questStartCanActive || !player->IsActiveQuest(questStart)) && !player->GetQuestRewardStatus(questStart)) + if (!player || ((!questStartCanActive || !player->IsActiveQuest(questStart)) && !player->GetQuestRewardStatus(questStart))) return false; } @@ -878,8 +878,8 @@ void ObjectMgr::ConvertCreatureAddonAuras(CreatureDataAddon* addon, char const* // replace by new structures array const_cast<CreatureDataAddonAura*&>(addon->auras) = new CreatureDataAddonAura[val.size()/2+1]; - int i=0; - for(uint32 j=0;j<val.size()/2;++j) + uint32 i=0; + for(uint32 j = 0; j < val.size()/2; ++j) { CreatureDataAddonAura& cAura = const_cast<CreatureDataAddonAura&>(addon->auras[i]); cAura.spell_id = (uint32)val[2*j+0]; @@ -1301,7 +1301,7 @@ void ObjectMgr::LoadCreatures() if(heroicCreatures.find(data.id)!=heroicCreatures.end()) { - sLog.outErrorDb("Table `creature` have creature (GUID: %u) that listed as heroic template in `creature_template_substitution`, skipped.",guid,data.id ); + sLog.outErrorDb("Table `creature` have creature (GUID: %u) that listed as heroic template (entry: %u) in `creature_template`, skipped.",guid,data.id ); continue; } @@ -3823,8 +3823,8 @@ void ObjectMgr::LoadQuests() bool found = false; for(uint8 k = 0; k < 3; ++k) { - if( spellInfo->Effect[k]==SPELL_EFFECT_QUEST_COMPLETE && uint32(spellInfo->EffectMiscValue[k])==qinfo->QuestId || - spellInfo->Effect[k]==SPELL_EFFECT_SEND_EVENT) + if ((spellInfo->Effect[k] == SPELL_EFFECT_QUEST_COMPLETE && uint32(spellInfo->EffectMiscValue[k]) == qinfo->QuestId) || + spellInfo->Effect[k] == SPELL_EFFECT_SEND_EVENT) { found = true; break; @@ -7631,7 +7631,7 @@ bool PlayerCondition::Meets(Player const * player) const case CONDITION_REPUTATION_RANK: { FactionEntry const* faction = sFactionStore.LookupEntry(value1); - return faction && player->GetReputationMgr().GetRank(faction) >= value2; + return faction && player->GetReputationMgr().GetRank(faction) >= int32(value2); } case CONDITION_TEAM: return player->GetTeam() == value1; diff --git a/src/game/Player.cpp b/src/game/Player.cpp index 43a98ddc7b4..b1b27b2dda1 100644 --- a/src/game/Player.cpp +++ b/src/game/Player.cpp @@ -448,6 +448,7 @@ Player::Player (WorldSession *session): Unit(), m_achievementMgr(this), m_reputa m_baseSpellPower = 0; m_baseFeralAP = 0; m_baseManaRegen = 0; + m_armorPenetrationPct = 0.0f; // Honor System m_lastHonorUpdateTime = time(NULL); @@ -852,9 +853,9 @@ bool Player::StoreNewItemInBestSlots(uint32 titem_id, uint32 titem_amount) void Player::SendMirrorTimer(MirrorTimerType Type, uint32 MaxValue, uint32 CurrentValue, int32 Regen) { - if (MaxValue == DISABLED_MIRROR_TIMER) + if (int(MaxValue) == DISABLED_MIRROR_TIMER) { - if (CurrentValue!=DISABLED_MIRROR_TIMER) + if (int(CurrentValue) != DISABLED_MIRROR_TIMER) StopMirrorTimer(Type); return; } @@ -1577,7 +1578,7 @@ bool Player::BuildEnumData( QueryResult * result, WorldPacket * p_data ) if(!enchantId) continue; - if(enchant = sSpellItemEnchantmentStore.LookupEntry(enchantId)) + if ((enchant = sSpellItemEnchantmentStore.LookupEntry(enchantId))) break; } @@ -2397,9 +2398,8 @@ bool Player::IsGroupVisibleFor(Player* p) const bool Player::IsInSameGroupWith(Player const* p) const { - return p==this || GetGroup() != NULL && - GetGroup() == p->GetGroup() && - GetGroup()->SameSubGroup((Player*)this, (Player*)p); + return (p==this || (GetGroup() != NULL && + GetGroup()->SameSubGroup((Player*)this, (Player*)p))); } ///- If the player is invited, remove him. If the group if then only 1 person, disband the group. @@ -3281,7 +3281,7 @@ bool Player::addSpell(uint32 spell_id, bool active, bool learning, bool dependen if (_spell_idx->second->learnOnGetSkill == ABILITY_LEARNED_ON_GET_RACE_OR_CLASS_SKILL || // lockpicking/runeforging special case, not have ABILITY_LEARNED_ON_GET_RACE_OR_CLASS_SKILL - (pSkill->id==SKILL_LOCKPICKING || pSkill->id==SKILL_RUNEFORGING) && _spell_idx->second->max_value==0 ) + ((pSkill->id==SKILL_LOCKPICKING || pSkill->id==SKILL_RUNEFORGING) && _spell_idx->second->max_value==0)) { switch(GetSkillRangeType(pSkill,_spell_idx->second->racemask!=0)) { @@ -3362,7 +3362,7 @@ bool Player::IsNeedCastPassiveSpellAtLearn(SpellEntry const* spellInfo) const { // 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 || m_form != 0 && (spellInfo->Stances & (1<<(m_form-1))); + bool need_cast = (!spellInfo->Stances || (m_form != 0 && (spellInfo->Stances & (1<<(m_form-1))))); //Check CasterAuraStates return need_cast && (!spellInfo->CasterAuraState || HasAuraState(AuraState(spellInfo->CasterAuraState))); @@ -3404,7 +3404,7 @@ void Player::removeSpell(uint32 spell_id, bool disabled, bool learn_low_rank) if (itr == m_spells.end()) return; - if(itr->second->state == PLAYERSPELL_REMOVED || disabled && itr->second->disabled || itr->second->state == PLAYERSPELL_TEMPORARY) + if(itr->second->state == PLAYERSPELL_REMOVED || (disabled && itr->second->disabled) || itr->second->state == PLAYERSPELL_TEMPORARY) return; // unlearn non talent higher ranks (recursive) @@ -3521,7 +3521,7 @@ void Player::removeSpell(uint32 spell_id, bool disabled, bool learn_low_rank) if(_spell_idx->second->learnOnGetSkill == ABILITY_LEARNED_ON_GET_RACE_OR_CLASS_SKILL && pSkill->categoryId != SKILL_CATEGORY_CLASS ||// not unlearn class skills (spellbook/talent pages) // lockpicking/runeforging special case, not have ABILITY_LEARNED_ON_GET_RACE_OR_CLASS_SKILL - (pSkill->id==SKILL_LOCKPICKING || pSkill->id==SKILL_RUNEFORGING) && _spell_idx->second->max_value==0 ) + ((pSkill->id==SKILL_LOCKPICKING || pSkill->id==SKILL_RUNEFORGING) && _spell_idx->second->max_value==0)) { // not reset skills for professions and racial abilities if ((pSkill->categoryId==SKILL_CATEGORY_SECONDARY || pSkill->categoryId==SKILL_CATEGORY_PROFESSION) && @@ -4768,7 +4768,7 @@ void Player::RepopAtGraveyard() AreaTableEntry const *zone = GetAreaEntryByAreaID(GetAreaId()); // Such zones are considered unreachable as a ghost and the player must be automatically revived - if(!isAlive() && zone && zone->flags & AREA_FLAG_NEED_FLY || GetTransport() || GetPositionZ() < -500.0f) + if((!isAlive() && zone && zone->flags & AREA_FLAG_NEED_FLY) || GetTransport() || GetPositionZ() < -500.0f) { ResurrectPlayer(0.5f); SpawnCorpseBones(); @@ -7091,7 +7091,7 @@ void Player::_ApplyItemBonuses(ItemPrototype const *proto, uint8 slot, bool appl // If set dpsMod in ScalingStatValue use it for min (70% from average), max (130% from average) damage if (ssv) { - if (extraDPS = ssv->getDPSMod(proto->ScalingStatValue)) + if ((extraDPS = ssv->getDPSMod(proto->ScalingStatValue))) { float average = extraDPS * proto->Delay / 1000.0f; minDamage = 0.7f * average; @@ -9009,10 +9009,10 @@ Item* Player::GetItemByPos( uint16 pos ) const Item* Player::GetItemByPos( uint8 bag, uint8 slot ) const { - if( bag == INVENTORY_SLOT_BAG_0 && ( slot < BANK_SLOT_BAG_END || slot >= KEYRING_SLOT_START && slot < CURRENCYTOKEN_SLOT_END ) ) + if( bag == INVENTORY_SLOT_BAG_0 && ( slot < BANK_SLOT_BAG_END || (slot >= KEYRING_SLOT_START && slot < CURRENCYTOKEN_SLOT_END )) ) return m_items[slot]; - else if(bag >= INVENTORY_SLOT_BAG_START && bag < INVENTORY_SLOT_BAG_END - || bag >= BANK_SLOT_BAG_START && bag < BANK_SLOT_BAG_END ) + else if ((bag >= INVENTORY_SLOT_BAG_START && bag < INVENTORY_SLOT_BAG_END) + || (bag >= BANK_SLOT_BAG_START && bag < BANK_SLOT_BAG_END) ) { Bag *pBag = (Bag*)GetItemByPos( INVENTORY_SLOT_BAG_0, bag ); if ( pBag ) @@ -10996,9 +10996,15 @@ Item* Player::EquipItem( uint16 pos, Item *pItem, bool update ) // update expertise and armor penetration - passive auras may need it if( slot == EQUIPMENT_SLOT_MAINHAND ) + { UpdateExpertise(BASE_ATTACK); + UpdateArmorPenetration(); + } else if( slot == EQUIPMENT_SLOT_OFFHAND ) + { UpdateExpertise(OFF_ATTACK); + UpdateArmorPenetration(); + } switch(slot) { @@ -11148,9 +11154,13 @@ void Player::RemoveItem( uint8 bag, uint8 slot, bool update ) } UpdateExpertise(BASE_ATTACK); + UpdateArmorPenetration(); } else if( slot == EQUIPMENT_SLOT_OFFHAND ) + { UpdateExpertise(OFF_ATTACK); + UpdateArmorPenetration(); + } // update armor penetration - passive auras may need it switch(slot) { @@ -11279,10 +11289,16 @@ void Player::DestroyItem( uint8 bag, uint8 slot, bool update ) break; } - if ( slot == EQUIPMENT_SLOT_MAINHAND ) + if( slot == EQUIPMENT_SLOT_MAINHAND ) + { UpdateExpertise(BASE_ATTACK); + UpdateArmorPenetration(); + } else if( slot == EQUIPMENT_SLOT_OFFHAND ) + { UpdateExpertise(OFF_ATTACK); + UpdateArmorPenetration(); + } // equipment visual show SetVisibleItemSlot(slot, NULL); @@ -11661,7 +11677,7 @@ void Player::SwapItem( uint16 src, uint16 dst ) if(IsEquipmentPos ( src ) || IsBagPos ( src )) { // bags can be swapped with empty bag slots, or with empty bag (items move possibility checked later) - uint8 msg = CanUnequipItem( src, !IsBagPos ( src ) || IsBagPos ( dst ) || pDstItem && pDstItem->IsBag() && ((Bag*)pDstItem)->IsEmpty()); + uint8 msg = CanUnequipItem( src, !IsBagPos ( src ) || IsBagPos ( dst ) || (pDstItem && pDstItem->IsBag() && ((Bag*)pDstItem)->IsEmpty())); if(msg != EQUIP_ERR_OK) { SendEquipError( msg, pSrcItem, pDstItem ); @@ -11691,7 +11707,7 @@ void Player::SwapItem( uint16 src, uint16 dst ) if(IsEquipmentPos ( dst ) || IsBagPos ( dst )) { // bags can be swapped with empty bag slots, or with empty bag (items move possibility checked later) - uint8 msg = CanUnequipItem( dst, !IsBagPos ( dst ) || IsBagPos ( src ) || pSrcItem->IsBag() && ((Bag*)pSrcItem)->IsEmpty()); + uint8 msg = CanUnequipItem( dst, !IsBagPos ( dst ) || IsBagPos ( src ) || (pSrcItem->IsBag() && ((Bag*)pSrcItem)->IsEmpty())); if(msg != EQUIP_ERR_OK) { SendEquipError( msg, pSrcItem, pDstItem ); @@ -12109,7 +12125,7 @@ void Player::UpdateItemDuration(uint32 time, bool realtimeonly) Item* item = *itr; ++itr; // current element can be erased in UpdateDuration - if (realtimeonly && item->GetProto()->Duration < 0 || !realtimeonly) + if ((realtimeonly && item->GetProto()->Duration < 0) || !realtimeonly) item->UpdateDuration(this,time); } } @@ -14747,7 +14763,7 @@ bool Player::LoadFromDB( uint32 guid, SqlQueryHolder *holder ) // check name limitations if (ObjectMgr::CheckPlayerName(m_name) != CHAR_NAME_SUCCESS || - GetSession()->GetSecurity() == SEC_PLAYER && objmgr.IsReservedName(m_name)) + (GetSession()->GetSecurity() == SEC_PLAYER && objmgr.IsReservedName(m_name))) { delete result; CharacterDatabase.PExecute("UPDATE characters SET at_login = at_login | '%u' WHERE guid ='%u'", uint32(AT_LOGIN_RENAME),guid); @@ -17931,7 +17947,7 @@ bool Player::ActivateTaxiPathTo(std::vector<uint32> const& nodes, Creature* npc uint32 mount_display_id = objmgr.GetTaxiMountDisplayId(sourcenode, GetTeam(), npc == NULL); // in spell case allow 0 model - if (mount_display_id == 0 && spellid == 0 || sourcepath == 0) + if ((mount_display_id == 0 && spellid == 0) || sourcepath == 0) { WorldPacket data(SMSG_ACTIVATETAXIREPLY, 4); data << uint32(ERR_TAXIUNSPECIFIEDSERVERERROR); @@ -20392,8 +20408,8 @@ void Player::UpdateCorpseReclaimDelay() { bool pvp = m_ExtraFlags & PLAYER_EXTRA_PVP_DEATH; - if( pvp && !sWorld.getConfig(CONFIG_DEATH_CORPSE_RECLAIM_DELAY_PVP) || - !pvp && !sWorld.getConfig(CONFIG_DEATH_CORPSE_RECLAIM_DELAY_PVE) ) + if ((pvp && !sWorld.getConfig(CONFIG_DEATH_CORPSE_RECLAIM_DELAY_PVP)) || + (!pvp && !sWorld.getConfig(CONFIG_DEATH_CORPSE_RECLAIM_DELAY_PVE) )) return; time_t now = time(NULL); @@ -20429,8 +20445,8 @@ void Player::SendCorpseReclaimDelay(bool load) return; uint32 count; - if( pvp && sWorld.getConfig(CONFIG_DEATH_CORPSE_RECLAIM_DELAY_PVP) || - !pvp && sWorld.getConfig(CONFIG_DEATH_CORPSE_RECLAIM_DELAY_PVE) ) + if ((pvp && !sWorld.getConfig(CONFIG_DEATH_CORPSE_RECLAIM_DELAY_PVP)) || + (!pvp && !sWorld.getConfig(CONFIG_DEATH_CORPSE_RECLAIM_DELAY_PVE) )) { count = (m_deathExpireTime-corpse->GetGhostTime())/DEATH_EXPIRE_STEP; if(count>=MAX_DEATH_COUNT) diff --git a/src/game/Player.h b/src/game/Player.h index ec58459bea0..449e0be40e8 100644 --- a/src/game/Player.h +++ b/src/game/Player.h @@ -1699,6 +1699,7 @@ class MANGOS_DLL_SPEC Player : public Unit void UpdateSpellCritChance(uint32 school); void UpdateArmorPenetration(int32 amount); void UpdateExpertise(WeaponAttackType attType); + void UpdateArmorPenetration(); void ApplyManaRegenBonus(int32 amount, bool apply); void UpdateManaRegen(); @@ -1865,6 +1866,7 @@ class MANGOS_DLL_SPEC Player : public Unit float GetTotalPercentageModValue(BaseModGroup modGroup) const { return m_auraBaseMod[modGroup][FLAT_MOD] + m_auraBaseMod[modGroup][PCT_MOD]; } void _ApplyAllStatBonuses(); void _RemoveAllStatBonuses(); + float GetArmorPenetrationPct() const { return m_armorPenetrationPct; } void _ApplyWeaponDependentAuraMods(Item *item, WeaponAttackType attackType, bool apply); void _ApplyWeaponDependentAuraCritMod(Item *item, WeaponAttackType attackType, AuraEffect* aura, bool apply); @@ -2353,6 +2355,7 @@ Spell * m_spellModTakingSpell; uint16 m_baseSpellPower; uint16 m_baseFeralAP; uint16 m_baseManaRegen; + float m_armorPenetrationPct; SpellModList m_spellMods[MAX_SPELLMOD]; uint32 m_pad; diff --git a/src/game/PoolHandler.cpp b/src/game/PoolHandler.cpp index dd0834b80f4..d02b5b695fc 100644 --- a/src/game/PoolHandler.cpp +++ b/src/game/PoolHandler.cpp @@ -100,7 +100,7 @@ uint32 PoolGroup<T>::RollOne(void) template<class T> void PoolGroup<T>::DespawnObject(uint32 guid) { - for (int i=0; i<EqualChanced.size(); ++i) + for (size_t i=0; i < EqualChanced.size(); ++i) { if (EqualChanced[i].spawned) { @@ -189,7 +189,7 @@ void PoolGroup<T>::SpawnObject(uint32 limit, bool cache) else if (limit < EqualChanced.size() && Spawned < limit) { std::vector<uint32> IndexList; - for (int i=0; i<EqualChanced.size(); ++i) + for (size_t i=0; i < EqualChanced.size(); ++i) if (!EqualChanced[i].spawned) IndexList.push_back(i); @@ -215,7 +215,7 @@ void PoolGroup<T>::SpawnObject(uint32 limit, bool cache) } else // Not enough objects in pool, so spawn all { - for (int i=0; i<EqualChanced.size(); ++i) + for (size_t i = 0; i < EqualChanced.size(); ++i) EqualChanced[i].spawned = Spawn1Object(EqualChanced[i].guid); } } diff --git a/src/game/SocialMgr.cpp b/src/game/SocialMgr.cpp index d94cd422f11..2331b7ad839 100644 --- a/src/game/SocialMgr.cpp +++ b/src/game/SocialMgr.cpp @@ -208,7 +208,7 @@ void SocialMgr::GetFriendInfo(Player *player, uint32 friendGUID, FriendInfo &fri // MODERATOR, GAME MASTER, ADMINISTRATOR can see all if (pFriend && pFriend->GetName() && (security > SEC_PLAYER || - (pFriend->GetTeam() == team || allowTwoSideWhoList) && (pFriend->GetSession()->GetSecurity() <= gmLevelInWhoList)) && + ((pFriend->GetTeam() == team || allowTwoSideWhoList) && (pFriend->GetSession()->GetSecurity() <= gmLevelInWhoList))) && pFriend->IsVisibleGloballyFor(player)) { friendInfo.Status = FRIEND_STATUS_ONLINE; @@ -287,7 +287,7 @@ void SocialMgr::BroadcastToFriendListers(Player *player, WorldPacket *packet) // MODERATOR, GAME MASTER, ADMINISTRATOR can see all if (pFriend && pFriend->IsInWorld() && (pFriend->GetSession()->GetSecurity() > SEC_PLAYER || - (pFriend->GetTeam() == team || allowTwoSideWhoList) && security <= gmLevelInWhoList) && + ((pFriend->GetTeam() == team || allowTwoSideWhoList) && security <= gmLevelInWhoList)) && player->IsVisibleGloballyFor(pFriend)) { pFriend->GetSession()->SendPacket(packet); diff --git a/src/game/Spell.cpp b/src/game/Spell.cpp index 5944dd08df3..fbe5bce42d7 100644 --- a/src/game/Spell.cpp +++ b/src/game/Spell.cpp @@ -5363,6 +5363,7 @@ SpellCastResult Spell::CheckCasterAuras() const else if ( m_spellInfo->PreventionType==SPELL_PREVENTION_TYPE_SILENCE) return SPELL_FAILED_SILENCED; break; + default: break; } } } diff --git a/src/game/SpellAuras.cpp b/src/game/SpellAuras.cpp index 34a3ea2347d..e9027764b7d 100644 --- a/src/game/SpellAuras.cpp +++ b/src/game/SpellAuras.cpp @@ -333,7 +333,7 @@ pAuraHandler AuraHandler[TOTAL_AURAS]= &Aura::HandleNoImmediateEffect, //277 SPELL_AURA_MOD_ABILITY_AFFECTED_TARGETS implemented in spell::settargetmap &Aura::HandleAuraModDisarm, //278 SPELL_AURA_MOD_DISARM_RANGED disarm ranged weapon &Aura::HandleAuraInitializeImages, //279 SPELL_AURA_INITIALIZE_IMAGES - &Aura::HandleNoImmediateEffect, //280 SPELL_AURA_MOD_TARGET_ARMOR_PCT implemented in Unit::CalcArmorReducedDamage + &Aura::HandleModTargetArmorPct, //280 SPELL_AURA_MOD_TARGET_ARMOR_PCT &Aura::HandleNoImmediateEffect, //281 SPELL_AURA_MOD_HONOR_GAIN_PCT implemented in Player::RewardHonor &Aura::HandleAuraIncreaseBaseHealthPercent, //282 SPELL_AURA_INCREASE_BASE_HEALTH_PERCENT &Aura::HandleNoImmediateEffect, //283 SPELL_AURA_MOD_HEALING_RECEIVED implemented in Unit::SpellHealingBonus @@ -6998,3 +6998,10 @@ bool AuraEffect::IsPeriodicTickCrit(Unit const * pCaster) const return false; } +void Aura::HandleModTargetArmorPct(bool apply, bool Real) +{ + if(m_target->GetTypeId() != TYPEID_PLAYER) + return; + + ((Player*)m_target)->UpdateArmorPenetration(); +} diff --git a/src/game/SpellAuras.h b/src/game/SpellAuras.h index 4fe680f26fc..1c5c485291b 100644 --- a/src/game/SpellAuras.h +++ b/src/game/SpellAuras.h @@ -333,6 +333,7 @@ class TRINITY_DLL_SPEC AuraEffect void HandleAuraCloneCaster(bool Apply, bool Real, bool changeAmount); void HandleAuraModCritPct(bool Apply, bool Real, bool changeAmount); void HandleAuraLinked(bool Apply, bool Real, bool changeAmount); + void HandleModTargetArmorPct(bool Apply, bool Real); void HandleAuraEffectSpecificMods(bool apply, bool Real, bool changeAmount); int32 CalculateCrowdControlAuraAmount(Unit * caster); diff --git a/src/game/SpellMgr.h b/src/game/SpellMgr.h index f9ec824e668..1745b2572bc 100644 --- a/src/game/SpellMgr.h +++ b/src/game/SpellMgr.h @@ -239,16 +239,16 @@ inline bool IsElementalShield(SpellEntry const *spellInfo) inline bool IsExplicitDiscoverySpell(SpellEntry const *spellInfo) { - return spellInfo->Effect[0] == SPELL_EFFECT_CREATE_RANDOM_ITEM - && spellInfo->Effect[1] == SPELL_EFFECT_SCRIPT_EFFECT - || spellInfo->Id == 64323; // Book of Glyph Mastery (Effect0==SPELL_EFFECT_SCRIPT_EFFECT without any other data) + return ((spellInfo->Effect[0] == SPELL_EFFECT_CREATE_RANDOM_ITEM + && spellInfo->Effect[1] == SPELL_EFFECT_SCRIPT_EFFECT) + || spellInfo->Id == 64323); // Book of Glyph Mastery (Effect0==SPELL_EFFECT_SCRIPT_EFFECT without any other data) } inline bool IsLootCraftingSpell(SpellEntry const *spellInfo) { - return spellInfo->Effect[0]==SPELL_EFFECT_CREATE_RANDOM_ITEM || + return (spellInfo->Effect[0]==SPELL_EFFECT_CREATE_RANDOM_ITEM || // different random cards from Inscription (121==Virtuoso Inking Set category) - spellInfo->Effect[0]==SPELL_EFFECT_CREATE_ITEM_2 && spellInfo->TotemCategory[0] == 121; + (spellInfo->Effect[0]==SPELL_EFFECT_CREATE_ITEM_2 && spellInfo->TotemCategory[0] == 121)); } bool IsHigherHankOfSpell(uint32 spellId_1,uint32 spellId_2); diff --git a/src/game/StatSystem.cpp b/src/game/StatSystem.cpp index d991a96ebe6..a55f0bb47c3 100644 --- a/src/game/StatSystem.cpp +++ b/src/game/StatSystem.cpp @@ -151,6 +151,7 @@ bool Player::UpdateAllStats() UpdateAllSpellCritChances(); UpdateDefenseBonusesMod(); UpdateShieldBlockValue(); + UpdateArmorPenetration(); UpdateSpellDamageAndHealingBonus(); UpdateManaRegen(); UpdateExpertise(BASE_ATTACK); @@ -686,6 +687,30 @@ void Player::UpdateExpertise(WeaponAttackType attack) } } +void Player::UpdateArmorPenetration() +{ + m_armorPenetrationPct = GetRatingBonusValue(CR_ARMOR_PENETRATION); + + AuraList const& armorAuras = GetAurasByType(SPELL_AURA_MOD_TARGET_ARMOR_PCT); + for(AuraList::const_iterator itr = armorAuras.begin(); itr != armorAuras.end(); ++itr) + { + // affects all weapons + if((*itr)->GetSpellProto()->EquippedItemClass == -1) + { + m_armorPenetrationPct += (*itr)->GetModifier()->m_amount; + continue; + } + + // dependent on weapon class + for(uint8 i = 0; i < MAX_ATTACK; ++i) + { + Item *weapon = GetWeaponForAttack(WeaponAttackType(i)); + if(weapon && weapon->IsFitToSpellRequirements((*itr)->GetSpellProto())) + m_armorPenetrationPct += (*itr)->GetModifier()->m_amount; + } + } +} + void Player::ApplyManaRegenBonus(int32 amount, bool apply) { m_baseManaRegen+= apply ? amount : -amount; diff --git a/src/game/TradeHandler.cpp b/src/game/TradeHandler.cpp index 66781c1b63b..3044e8a3b51 100644 --- a/src/game/TradeHandler.cpp +++ b/src/game/TradeHandler.cpp @@ -594,7 +594,7 @@ void WorldSession::HandleSetTradeItemOpcode(WorldPacket& recvPacket) // check cheating, can't fail with correct client operations Item* item = _player->GetItemByPos(bag,slot); - if(!item || tradeSlot!=TRADE_SLOT_NONTRADED && !item->CanBeTraded()) + if (!item || (tradeSlot != TRADE_SLOT_NONTRADED && !item->CanBeTraded())) { SendTradeStatus(TRADE_STATUS_TRADE_CANCELED); return; diff --git a/src/game/Unit.cpp b/src/game/Unit.cpp index dac9f91a16e..5fec651dd47 100644 --- a/src/game/Unit.cpp +++ b/src/game/Unit.cpp @@ -1671,21 +1671,9 @@ uint32 Unit::CalcArmorReducedDamage(Unit* pVictim, const uint32 damage, SpellEnt } } - // Apply Player CR_ARMOR_PENETRATION rating + // Apply Player CR_ARMOR_PENETRATION rating and percent talents if (GetTypeId()==TYPEID_PLAYER) - { - float maxArmorPen=0; - if (getLevel()<60) - maxArmorPen=400+85*pVictim->getLevel(); - else - maxArmorPen=400+85*pVictim->getLevel()+4.5*85*(pVictim->getLevel()-59); - // Cap armor penetration to this number - maxArmorPen = std::min(((armor+maxArmorPen)/3),armor); - // Figure out how much armor do we ignore - float armorPen = maxArmorPen*((Player*)this)->GetRatingBonusValue(CR_ARMOR_PENETRATION) / 100.0f; - // Got the value, apply it - armor -= armorPen; - } + armor *= 1.0f - ((Player*)this)->GetArmorPenetrationPct() / 100.0f; // Ignore enemy armor by SPELL_AURA_MOD_TARGET_ARMOR_PCT //armor *= 1.0f - GetTotalAuraModifier(SPELL_AURA_MOD_ARMOR_PENETRATION_PCT) / 100.0f; diff --git a/src/game/Unit.h b/src/game/Unit.h index 4a62568f613..566c2fb6a1b 100644 --- a/src/game/Unit.h +++ b/src/game/Unit.h @@ -852,9 +852,9 @@ struct SpellPeriodicAuraLogInfo AuraEffect *auraEff; uint32 damage; + uint32 overDamage; // overkill/overheal uint32 absorb; uint32 resist; - uint32 overDamage; // overkill/overheal float multiplier; bool critical; }; diff --git a/src/game/WaypointMovementGenerator.cpp b/src/game/WaypointMovementGenerator.cpp index 8e5b8a501ff..de8f075ea38 100644 --- a/src/game/WaypointMovementGenerator.cpp +++ b/src/game/WaypointMovementGenerator.cpp @@ -306,7 +306,7 @@ void FlightPathMovementGenerator::SetCurrentNodeAfterTeleport() return; uint32 map0 = i_mapIds[0]; - for(int i = 1; i < i_mapIds.size(); ++i) + for (size_t i = 1; i < i_mapIds.size(); ++i) { if(i_mapIds[i]!=map0) { diff --git a/src/game/WorldSession.cpp b/src/game/WorldSession.cpp index 4cb251d6524..93e3937e168 100644 --- a/src/game/WorldSession.cpp +++ b/src/game/WorldSession.cpp @@ -603,14 +603,14 @@ void WorldSession::LoadAccountData(QueryResult* result, uint32 mask) if (type >= NUM_ACCOUNT_DATA_TYPES) { sLog.outError("Table `%s` have invalid account data type (%u), ignore.", - mask == GLOBAL_CACHE_MASK ? "account_data" : "character_account_data"); + mask == GLOBAL_CACHE_MASK ? "account_data" : "character_account_data", type); continue; } if ((mask & (1 << type))==0) { sLog.outError("Table `%s` have non appropriate for table account data type (%u), ignore.", - mask == GLOBAL_CACHE_MASK ? "account_data" : "character_account_data"); + mask == GLOBAL_CACHE_MASK ? "account_data" : "character_account_data", type); continue; } diff --git a/src/trinitycore/Master.cpp b/src/trinitycore/Master.cpp index b8c51461a67..94c5a4cc023 100644 --- a/src/trinitycore/Master.cpp +++ b/src/trinitycore/Master.cpp @@ -307,10 +307,6 @@ int Master::Run() uint32 socketSelecttime = sWorld.getConfig(CONFIG_SOCKET_SELECTTIME); - // maximum counter for next ping - uint32 numLoops = (sConfig.GetIntDefault( "MaxPingTime", 30 ) * (MINUTE * 1000000 / socketSelecttime)); - uint32 loopCounter = 0; - ///- Start up freeze catcher thread if(uint32 freeze_delay = sConfig.GetIntDefault("MaxCoreStuckTime", 0)) { |