diff --git a/src/game/Chat.cpp b/src/game/Chat.cpp index 04bec4603..3539a2af7 100644 --- a/src/game/Chat.cpp +++ b/src/game/Chat.cpp @@ -1238,7 +1238,7 @@ bool ChatHandler::SetDataForCommandInTable(ChatCommand *commandTable, const char { // command have subcommands, but not '' subcommand and then any data in `command` useless for it. if (cmdName.empty()) - sLog.outErrorDb("Table `command` have command '%s' that only used with some subcommand selection, it can't have help or overwritten access level, skip.", cmdName.c_str(), fullcommand.c_str()); + sLog.outErrorDb("Table `command` have command '%s' that only used with some subcommand selection, it can't have help or overwritten access level, skip.", cmdName.c_str()); else sLog.outErrorDb("Table `command` have unexpected subcommand '%s' in command '%s', skip.", cmdName.c_str(), fullcommand.c_str()); return false; @@ -2303,7 +2303,7 @@ char* ChatHandler::ExtractQuotedArg( char** args, bool asis /*= false*/ ) while (*tail && *tail != guard) ++tail; - if (!*tail || tail[1] && !isWhiteSpace(tail[1])) // fail + if (!*tail || (tail[1] && !isWhiteSpace(tail[1]))) // fail return NULL; if (!tail[1]) // quote is last char in string @@ -2521,7 +2521,7 @@ char* ChatHandler::ExtractLinkArg(char** args, char const* const* linkTypes /*= tail += 2; // skip h| // r - if (!*tail || *tail != 'r' || *(tail+1) && !isWhiteSpace(*(tail+1))) + if (!*tail || *tail != 'r' || (*(tail+1) && !isWhiteSpace(*(tail+1)))) return NULL; ++tail; // skip r diff --git a/src/game/Creature.cpp b/src/game/Creature.cpp index 35f4e83c9..f1fcbcdbb 100644 --- a/src/game/Creature.cpp +++ b/src/game/Creature.cpp @@ -864,7 +864,7 @@ void Creature::PrepareBodyLootState() // have normal loot if (GetCreatureInfo()->maxgold > 0 || GetCreatureInfo()->lootid || // ... or can have skinning after - GetCreatureInfo()->SkinLootId && sWorld.getConfig(CONFIG_BOOL_CORPSE_EMPTY_LOOT_SHOW)) + (GetCreatureInfo()->SkinLootId && sWorld.getConfig(CONFIG_BOOL_CORPSE_EMPTY_LOOT_SHOW))) { SetFlag(UNIT_DYNAMIC_FLAGS, UNIT_DYNFLAG_LOOTABLE); return; diff --git a/src/game/CreatureEventAI.cpp b/src/game/CreatureEventAI.cpp index 21c8f68f7..0156696ea 100644 --- a/src/game/CreatureEventAI.cpp +++ b/src/game/CreatureEventAI.cpp @@ -540,10 +540,14 @@ void CreatureEventAI::ProcessAction(CreatureEventAI_Action const& action, uint32 m_creature->GetMotionMaster()->Clear(false); m_creature->GetMotionMaster()->MoveChase(m_creature->getVictim(), m_AttackDistance, m_AttackAngle); break; + default: + break; } } break; } + default: + break; } break; diff --git a/src/game/DBCEnums.h b/src/game/DBCEnums.h index a1fbe08ec..ace7b3d6c 100644 --- a/src/game/DBCEnums.h +++ b/src/game/DBCEnums.h @@ -206,9 +206,10 @@ enum AchievementCriteriaTypes // 122 // 123 // 0..123 => 124 criteria types total - ACHIEVEMENT_CRITERIA_TYPE_TOTAL = 124, }; +#define ACHIEVEMENT_CRITERIA_TYPE_TOTAL 124 + enum AreaFlags { AREA_FLAG_SNOW = 0x00000001, // snow (only Dun Morogh, Naxxramas, Razorfen Downs and Winterspring) diff --git a/src/game/DBCStores.cpp b/src/game/DBCStores.cpp index 96044dc01..c2f36ef3f 100644 --- a/src/game/DBCStores.cpp +++ b/src/game/DBCStores.cpp @@ -189,7 +189,7 @@ bool IsAcceptableClientBuild(uint32 build) { int accepted_versions[] = EXPECTED_MANGOSD_CLIENT_BUILD; for(int i = 0; accepted_versions[i]; ++i) - if(build == accepted_versions[i]) + if(int(build) == accepted_versions[i]) return true; return false; diff --git a/src/game/GMTicketMgr.cpp b/src/game/GMTicketMgr.cpp index 7dfbe1652..a4b0930f1 100644 --- a/src/game/GMTicketMgr.cpp +++ b/src/game/GMTicketMgr.cpp @@ -74,7 +74,7 @@ void GMTicketMgr::LoadGMTickets() delete result; sLog.outString(); - sLog.outString(">> Loaded %d GM tickets", GetTicketCount()); + sLog.outString(">> Loaded " SIZEFMTD " GM tickets", GetTicketCount()); } void GMTicketMgr::DeleteAll() diff --git a/src/game/GroupHandler.cpp b/src/game/GroupHandler.cpp index e541595f4..d340b1a2a 100644 --- a/src/game/GroupHandler.cpp +++ b/src/game/GroupHandler.cpp @@ -240,7 +240,7 @@ void WorldSession::HandleGroupUninviteGuidOpcode(WorldPacket & recv_data) // can't uninvite yourself if (guid == GetPlayer()->GetObjectGuid()) { - sLog.outError("WorldSession::HandleGroupUninviteGuidOpcode: leader %s tried to uninvite himself from the group.", GetPlayer()->GetName(), GetPlayer()->GetObjectGuid().GetString().c_str()); + sLog.outError("WorldSession::HandleGroupUninviteGuidOpcode: leader %s tried to uninvite himself from the group.", GetPlayer()->GetObjectGuid().GetString().c_str()); return; } diff --git a/src/game/Item.cpp b/src/game/Item.cpp index 771aae9f1..d3e5b7142 100644 --- a/src/game/Item.cpp +++ b/src/game/Item.cpp @@ -991,7 +991,7 @@ uint8 Item::GetGemCountWithLimitCategory(uint32 limitCategory) const bool Item::IsLimitedToAnotherMapOrZone( uint32 cur_mapId, uint32 cur_zoneId) const { ItemPrototype const* proto = GetProto(); - return proto && (proto->Map && proto->Map != cur_mapId || proto->Area && proto->Area != cur_zoneId ); + return proto && ((proto->Map && proto->Map != cur_mapId) || (proto->Area && proto->Area != cur_zoneId)); } // Though the client has the information in the item's data field, diff --git a/src/game/Level2.cpp b/src/game/Level2.cpp index df243a277..4d8de0cbd 100644 --- a/src/game/Level2.cpp +++ b/src/game/Level2.cpp @@ -4252,7 +4252,7 @@ bool ChatHandler::HandleEventStartCommand(char* args) GameEventMgr::GameEventDataMap const& events = sGameEventMgr.GetEventMap(); - if (event_id < 1 || event_id >=(int32)events.size()) + if (event_id < 1 || event_id >= events.size()) { SendSysMessage(LANG_EVENT_NOT_EXIST); SetSentErrorMessage(true); @@ -4292,7 +4292,7 @@ bool ChatHandler::HandleEventStopCommand(char* args) GameEventMgr::GameEventDataMap const& events = sGameEventMgr.GetEventMap(); - if (event_id < 1 || event_id >=(int32)events.size()) + if (event_id < 1 || event_id >= events.size()) { SendSysMessage(LANG_EVENT_NOT_EXIST); SetSentErrorMessage(true); diff --git a/src/game/LootHandler.cpp b/src/game/LootHandler.cpp index 0fde4f482..04908a83c 100644 --- a/src/game/LootHandler.cpp +++ b/src/game/LootHandler.cpp @@ -416,8 +416,6 @@ void WorldSession::DoLootRelease(ObjectGuid lguid) if (!pItem) return; - ItemPrototype const* proto = pItem->GetProto(); - switch (pItem->loot.loot_type) { // temporary loot in stacking items, clear loot state, no auto loot move diff --git a/src/game/Map.cpp b/src/game/Map.cpp index 4501b24f5..532b3b4e6 100644 --- a/src/game/Map.cpp +++ b/src/game/Map.cpp @@ -1171,7 +1171,8 @@ uint16 Map::GetAreaFlag(float x, float y, float z, bool *isOutdoors) const if(GetAreaInfo(x, y, z, mogpFlags, adtId, rootId, groupId)) { haveAreaInfo = true; - if(wmoEntry = GetWMOAreaTableEntryByTripple(rootId, adtId, groupId)) + wmoEntry = GetWMOAreaTableEntryByTripple(rootId, adtId, groupId); + if (wmoEntry) atEntry = GetAreaEntryByAreaID(wmoEntry->areaId); } diff --git a/src/game/MotionMaster.cpp b/src/game/MotionMaster.cpp index 27a30cb2c..b77585992 100644 --- a/src/game/MotionMaster.cpp +++ b/src/game/MotionMaster.cpp @@ -128,7 +128,7 @@ void MotionMaster::DelayedClean(bool reset, bool all) else m_cleanFlag &= ~MMCF_RESET; - if (empty() || !all && size() == 1) + if (empty() || (!all && size() == 1)) return; if (!m_expList) diff --git a/src/game/ObjectMgr.cpp b/src/game/ObjectMgr.cpp index c624ca7cb..a202d2c09 100644 --- a/src/game/ObjectMgr.cpp +++ b/src/game/ObjectMgr.cpp @@ -3826,11 +3826,11 @@ void ObjectMgr::LoadQuests() } //check for proper RequiredSkill value (skill case) - if (int32 skill_id = SkillByQuestSort(-int32(qinfo->ZoneOrSort))) + if (uint32 skill_id = SkillByQuestSort(-int32(qinfo->ZoneOrSort))) { if (qinfo->RequiredSkill != skill_id) { - sLog.outErrorDb("Quest %u has `ZoneOrSort` = %i but `RequiredSkill` does not have a corresponding value (%i).", + sLog.outErrorDb("Quest %u has `ZoneOrSort` = %i but `RequiredSkill` does not have a corresponding value (%u).", qinfo->GetQuestId(),qinfo->ZoneOrSort,skill_id); //override, and force proper value here? } @@ -5939,7 +5939,7 @@ WorldSafeLocsEntry const *ObjectMgr::GetClosestGraveYard(float x, float y, float // if find graveyard at different map from where entrance placed (or no entrance data), use any first if (!mapEntry || mapEntry->ghost_entrance_map < 0 || - mapEntry->ghost_entrance_map != entry->map_id || + uint32(mapEntry->ghost_entrance_map) != entry->map_id || (mapEntry->ghost_entrance_x == 0 && mapEntry->ghost_entrance_y == 0)) { // not have any coordinates for check distance anyway @@ -6174,10 +6174,12 @@ void ObjectMgr::LoadAreaTriggerTeleports() AreaTrigger const* ObjectMgr::GetGoBackTrigger(uint32 map_id) const { const MapEntry *mapEntry = sMapStore.LookupEntry(map_id); - if(!mapEntry) return NULL; + if (!mapEntry || mapEntry->ghost_entrance_map < 0) + return NULL; + for (AreaTriggerMap::const_iterator itr = mAreaTriggers.begin(); itr != mAreaTriggers.end(); ++itr) { - if(itr->second.target_mapId == mapEntry->ghost_entrance_map) + if (itr->second.target_mapId == uint32(mapEntry->ghost_entrance_map)) { AreaTriggerEntry const* atEntry = sAreaTriggerStore.LookupEntry(itr->first); if(atEntry && atEntry->mapid == map_id) @@ -8867,8 +8869,6 @@ void ObjectMgr::LoadTrainerSpell() void ObjectMgr::LoadVendors(char const* tableName, bool isTemplates) { CacheVendorItemMap& vendorList = isTemplates ? m_mCacheVendorTemplateItemMap : m_mCacheVendorItemMap; - CacheVendorItemMap const* parentList = isTemplates ? NULL : &m_mCacheVendorTemplateItemMap; - // For reload case for (CacheVendorItemMap::iterator itr = vendorList.begin(); itr != vendorList.end(); ++itr) @@ -8878,7 +8878,7 @@ void ObjectMgr::LoadVendors(char const* tableName, bool isTemplates) std::set skip_vendors; QueryResult *result = WorldDatabase.PQuery("SELECT entry, item, maxcount, incrtime, ExtendedCost FROM %s", tableName); - if( !result ) + if (!result) { barGoLink bar( 1 ); @@ -8915,7 +8915,7 @@ void ObjectMgr::LoadVendors(char const* tableName, bool isTemplates) delete result; sLog.outString(); - sLog.outString( ">> Loaded %d vendor items", count); + sLog.outString( ">> Loaded %u vendor items", count); } diff --git a/src/game/Pet.cpp b/src/game/Pet.cpp index 0147df081..d7ee0e3b5 100644 --- a/src/game/Pet.cpp +++ b/src/game/Pet.cpp @@ -596,7 +596,7 @@ void Pet::Regenerate(Powers power) // Apply modifiers (if any). AuraList const& ModPowerRegenPCTAuras = GetAurasByType(SPELL_AURA_MOD_POWER_REGEN_PERCENT); for(AuraList::const_iterator i = ModPowerRegenPCTAuras.begin(); i != ModPowerRegenPCTAuras.end(); ++i) - if ((*i)->GetModifier()->m_miscvalue == power) + if ((*i)->GetModifier()->m_miscvalue == int32(power)) addvalue *= ((*i)->GetModifier()->m_amount + 100) / 100.0f; ModifyPower(power, (int32)addvalue); diff --git a/src/game/PetAI.cpp b/src/game/PetAI.cpp index 4cdd42dcf..eaa733292 100644 --- a/src/game/PetAI.cpp +++ b/src/game/PetAI.cpp @@ -138,13 +138,13 @@ void PetAI::UpdateAI(const uint32 diff) Unit* owner = m_creature->GetCharmerOrOwner(); - if(m_updateAlliesTimer <= diff) + if (m_updateAlliesTimer <= diff) // UpdateAllies self set update timer UpdateAllies(); else m_updateAlliesTimer -= diff; - if (inCombat && (!m_creature->getVictim() || m_creature->IsPet() && ((Pet*)m_creature)->GetModeFlags() & PET_MODE_DISABLE_ACTIONS)) + if (inCombat && (!m_creature->getVictim() || (m_creature->IsPet() && ((Pet*)m_creature)->GetModeFlags() & PET_MODE_DISABLE_ACTIONS))) _stopAttack(); // i_pet.getVictim() can't be used for check in case stop fighting, i_pet.getVictim() clear at Unit death etc. diff --git a/src/game/Player.cpp b/src/game/Player.cpp index e844c8790..d1747b824 100644 --- a/src/game/Player.cpp +++ b/src/game/Player.cpp @@ -2140,7 +2140,7 @@ void Player::Regenerate(Powers power, uint32 diff) uint32 cd_diff = diff; AuraList const& ModPowerRegenPCTAuras = GetAurasByType(SPELL_AURA_MOD_POWER_REGEN_PERCENT); for(AuraList::const_iterator i = ModPowerRegenPCTAuras.begin(); i != ModPowerRegenPCTAuras.end(); ++i) - if ((*i)->GetModifier()->m_miscvalue == power && (*i)->GetMiscBValue()==GetCurrentRune(rune)) + if ((*i)->GetModifier()->m_miscvalue == int32(power) && (*i)->GetMiscBValue()==GetCurrentRune(rune)) cd_diff = cd_diff * ((*i)->GetModifier()->m_amount + 100) / 100; SetRuneCooldown(rune, (cd < cd_diff) ? 0 : cd - cd_diff); @@ -2159,7 +2159,7 @@ void Player::Regenerate(Powers power, uint32 diff) { AuraList const& ModPowerRegenPCTAuras = GetAurasByType(SPELL_AURA_MOD_POWER_REGEN_PERCENT); for(AuraList::const_iterator i = ModPowerRegenPCTAuras.begin(); i != ModPowerRegenPCTAuras.end(); ++i) - if ((*i)->GetModifier()->m_miscvalue == power) + if ((*i)->GetModifier()->m_miscvalue == int32(power)) addvalue *= ((*i)->GetModifier()->m_amount + 100) / 100.0f; } @@ -3511,8 +3511,8 @@ void Player::removeSpell(uint32 spell_id, bool disabled, bool learn_low_rank, bo if (!pSkill) continue; - 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) + 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)) { @@ -5234,6 +5234,8 @@ void Player::ApplyRatingMod(CombatRating cr, int32 value, bool apply) ApplyCastTimePercentMod(RatingChange,apply); break; } + default: + break; } UpdateRating(cr); @@ -6269,7 +6271,7 @@ int32 Player::CalculateReputationGain(ReputationSource source, int32 rep, int32 percent += rep > 0 ? repMod : -repMod; - float rate = 1.0f; + float rate; switch (source) { case REPUTATION_SOURCE_KILL: @@ -6278,6 +6280,10 @@ int32 Player::CalculateReputationGain(ReputationSource source, int32 rep, int32 case REPUTATION_SOURCE_QUEST: rate = sWorld.getConfig(CONFIG_FLOAT_RATE_REPUTATION_LOWLEVEL_QUEST); break; + case REPUTATION_SOURCE_SPELL: + default: + rate = 1.0f; + break; } if (rate != 1.0f && creatureOrQuestLevel <= MaNGOS::XP::GetGrayLevel(getLevel())) @@ -9446,7 +9452,7 @@ uint8 Player::_CanStoreItem_InSpecificSlot( uint8 bag, uint8 slot, ItemPosCountV return EQUIP_ERR_ITEM_DOESNT_GO_INTO_BAG; // prevent cheating - if (slot >= BUYBACK_SLOT_START && slot < BUYBACK_SLOT_END || slot >= PLAYER_SLOT_END) + if ((slot >= BUYBACK_SLOT_START && slot < BUYBACK_SLOT_END) || slot >= PLAYER_SLOT_END) return EQUIP_ERR_ITEM_DOESNT_GO_INTO_BAG; } else @@ -13242,7 +13248,7 @@ bool Player::IsCurrentQuest( uint32 quest_id ) const if (itr == mQuestStatus.end()) return false; - return itr->second.m_status == QUEST_STATUS_INCOMPLETE || itr->second.m_status == QUEST_STATUS_COMPLETE && !itr->second.m_rewarded; + return itr->second.m_status == QUEST_STATUS_INCOMPLETE || (itr->second.m_status == QUEST_STATUS_COMPLETE && !itr->second.m_rewarded); } Quest const* Player::GetNextQuest(ObjectGuid guid, Quest const *pQuest) @@ -16113,8 +16119,8 @@ void Player::_LoadMailedItems(QueryResult *result) void Player::_LoadMails(QueryResult *result) { m_mail.clear(); - // 0 1 2 3 4 5 6 7 8 9 10 11 12 13 - //"SELECT id,messageType,sender,receiver,subject,body,has_items,expire_time,deliver_time,money,cod,checked,stationery,mailTemplateId FROM mail WHERE receiver = '%u' ORDER BY id DESC", GetGUIDLow() + // 0 1 2 3 4 5 6 7 8 9 10 11 12 + //"SELECT id,messageType,sender,receiver,subject,body,expire_time,deliver_time,money,cod,checked,stationery,mailTemplateId FROM mail WHERE receiver = '%u' ORDER BY id DESC", GetGUIDLow() if(!result) return; @@ -16128,14 +16134,13 @@ void Player::_LoadMails(QueryResult *result) m->receiver = fields[3].GetUInt32(); m->subject = fields[4].GetCppString(); m->body = fields[5].GetCppString(); - bool has_items = fields[6].GetBool(); - m->expire_time = (time_t)fields[7].GetUInt64(); - m->deliver_time = (time_t)fields[8].GetUInt64(); - m->money = fields[9].GetUInt32(); - m->COD = fields[10].GetUInt32(); - m->checked = fields[11].GetUInt32(); - m->stationery = fields[12].GetUInt8(); - m->mailTemplateId = fields[13].GetInt16(); + m->expire_time = (time_t)fields[6].GetUInt64(); + m->deliver_time = (time_t)fields[7].GetUInt64(); + m->money = fields[8].GetUInt32(); + m->COD = fields[9].GetUInt32(); + m->checked = fields[10].GetUInt32(); + m->stationery = fields[11].GetUInt8(); + m->mailTemplateId = fields[12].GetInt16(); if(m->mailTemplateId && !sMailTemplateStore.LookupEntry(m->mailTemplateId)) { @@ -16390,7 +16395,8 @@ void Player::_LoadSpells(QueryResult *result) // skip talents & drop unneeded data if(GetTalentSpellPos(spell_id)) { - sLog.outError("Player::_LoadSpells: Player (GUID: %u) has talent spell in character_spell, removing it.", GetGUIDLow(), spell_id); + sLog.outError("Player::_LoadSpells: %s has talent spell %u in character_spell, removing it.", + GetObjectGuid().GetString().c_str(), spell_id); CharacterDatabase.PExecute("DELETE FROM character_spell WHERE spell = '%u'", spell_id); continue; } @@ -17374,6 +17380,10 @@ void Player::_SaveSkills() CharacterDatabase.PExecute("UPDATE character_skills SET value = '%u',max = '%u'WHERE guid = '%u' AND skill = '%u' ", value, max, GetGUIDLow(), itr->first ); break; + case SKILL_UNCHANGED: + case SKILL_DELETED: + MANGOS_ASSERT(false); + break; }; itr->second.uState = SKILL_UNCHANGED; @@ -19003,13 +19013,13 @@ void Player::AddSpellAndCategoryCooldowns(SpellEntry const* spellInfo, uint32 it // cooldown information stored in item prototype // This used in same way in WorldSession::HandleItemQuerySingleOpcode data sending to client. - if(itemId) + if (itemId) { - if(ItemPrototype const* proto = ObjectMgr::GetItemPrototype(itemId)) + if (ItemPrototype const* proto = ObjectMgr::GetItemPrototype(itemId)) { for(int idx = 0; idx < 5; ++idx) { - if(proto->Spells[idx].SpellId == spellInfo->Id) + if (proto->Spells[idx].SpellId == spellInfo->Id) { cat = proto->Spells[idx].SpellCategory; rec = proto->Spells[idx].SpellCooldown; @@ -19021,7 +19031,7 @@ void Player::AddSpellAndCategoryCooldowns(SpellEntry const* spellInfo, uint32 it } // if no cooldown found above then base at DBC data - if(rec < 0 && catrec < 0) + if (rec < 0 && catrec < 0) { cat = spellInfo->Category; rec = spellInfo->RecoveryTime; @@ -19034,7 +19044,7 @@ void Player::AddSpellAndCategoryCooldowns(SpellEntry const* spellInfo, uint32 it time_t recTime; // overwrite time for selected category - if(infinityCooldown) + if (infinityCooldown) { // use +MONTH as infinity mark for spell cooldown (will checked as MONTH/2 at save ans skipped) // but not allow ignore until reset or re-login @@ -19045,14 +19055,14 @@ void Player::AddSpellAndCategoryCooldowns(SpellEntry const* spellInfo, uint32 it { // shoot spells used equipped item cooldown values already assigned in GetAttackTime(RANGED_ATTACK) // prevent 0 cooldowns set by another way - if (rec <= 0 && catrec <= 0 && (cat == 76 || IsAutoRepeatRangedSpell(spellInfo) && spellInfo->Id != SPELL_ID_AUTOSHOT)) + if (rec <= 0 && catrec <= 0 && (cat == 76 || (IsAutoRepeatRangedSpell(spellInfo) && spellInfo->Id != SPELL_ID_AUTOSHOT))) rec = GetAttackTime(RANGED_ATTACK); // Now we have cooldown data (if found any), time to apply mods - if(rec > 0) + if (rec > 0) ApplySpellMod(spellInfo->Id, SPELLMOD_COOLDOWN, rec, spell); - if(catrec > 0) + if (catrec > 0) ApplySpellMod(spellInfo->Id, SPELLMOD_COOLDOWN, catrec, spell); // replace negative cooldowns by 0 @@ -19060,7 +19070,7 @@ void Player::AddSpellAndCategoryCooldowns(SpellEntry const* spellInfo, uint32 it if (catrec < 0) catrec = 0; // no cooldown after applying spell mods - if( rec == 0 && catrec == 0) + if (rec == 0 && catrec == 0) return; catrecTime = catrec ? curTime+catrec/IN_MILLISECONDS : 0; @@ -19068,18 +19078,18 @@ void Player::AddSpellAndCategoryCooldowns(SpellEntry const* spellInfo, uint32 it } // self spell cooldown - if(recTime > 0) + if (recTime > 0) AddSpellCooldown(spellInfo->Id, itemId, recTime); // category spells if (cat && catrec > 0) { SpellCategoryStore::const_iterator i_scstore = sSpellCategoryStore.find(cat); - if(i_scstore != sSpellCategoryStore.end()) + if (i_scstore != sSpellCategoryStore.end()) { for(SpellCategorySet::const_iterator i_scset = i_scstore->second.begin(); i_scset != i_scstore->second.end(); ++i_scset) { - if(*i_scset == spellInfo->Id) // skip main spell, already handled above + if (*i_scset == spellInfo->Id) // skip main spell, already handled above continue; AddSpellCooldown(*i_scset, itemId, catrecTime); @@ -20705,23 +20715,23 @@ void Player::UpdateCorpseReclaimDelay() void Player::SendCorpseReclaimDelay(bool load) { Corpse* corpse = GetCorpse(); - if(!corpse) + if (!corpse) return; uint32 delay; - if(load) + if (load) { - if(corpse->GetGhostTime() > m_deathExpireTime) + if (corpse->GetGhostTime() > m_deathExpireTime) return; bool pvp = corpse->GetType()==CORPSE_RESURRECTABLE_PVP; uint32 count; - if( pvp && sWorld.getConfig(CONFIG_BOOL_DEATH_CORPSE_RECLAIM_DELAY_PVP) || - !pvp && sWorld.getConfig(CONFIG_BOOL_DEATH_CORPSE_RECLAIM_DELAY_PVE) ) + if ((pvp && sWorld.getConfig(CONFIG_BOOL_DEATH_CORPSE_RECLAIM_DELAY_PVP)) || + (!pvp && sWorld.getConfig(CONFIG_BOOL_DEATH_CORPSE_RECLAIM_DELAY_PVE))) { count = uint32(m_deathExpireTime-corpse->GetGhostTime())/DEATH_EXPIRE_STEP; - if(count>=MAX_DEATH_COUNT) + if (count>=MAX_DEATH_COUNT) count = MAX_DEATH_COUNT-1; } else @@ -20730,7 +20740,7 @@ void Player::SendCorpseReclaimDelay(bool load) time_t expected_time = corpse->GetGhostTime()+copseReclaimDelay[count]; time_t now = time(NULL); - if(now >= expected_time) + if (now >= expected_time) return; delay = uint32(expected_time-now); @@ -22457,6 +22467,7 @@ Object* Player::GetObjectByTypeMask(ObjectGuid guid, TypeMask typemask) case HIGHGUID_TRANSPORT: case HIGHGUID_CORPSE: case HIGHGUID_MO_TRANSPORT: + case HIGHGUID_INSTANCE: break; } diff --git a/src/game/QueryHandler.cpp b/src/game/QueryHandler.cpp index 8ccd2fe93..8515ed975 100644 --- a/src/game/QueryHandler.cpp +++ b/src/game/QueryHandler.cpp @@ -281,22 +281,22 @@ void WorldSession::HandleCorpseQueryOpcode(WorldPacket & /*recv_data*/) return; } - int32 mapid = corpse->GetMapId(); + uint32 corpsemapid = corpse->GetMapId(); float x = corpse->GetPositionX(); float y = corpse->GetPositionY(); float z = corpse->GetPositionZ(); - int32 corpsemapid = mapid; + int32 mapid = corpsemapid; // if corpse at different map - if(mapid != _player->GetMapId()) + if (corpsemapid != _player->GetMapId()) { // search entrance map for proper show entrance - if(MapEntry const* corpseMapEntry = sMapStore.LookupEntry(mapid)) + if (MapEntry const* corpseMapEntry = sMapStore.LookupEntry(corpsemapid)) { - if(corpseMapEntry->IsDungeon() && corpseMapEntry->ghost_entrance_map >= 0) + if (corpseMapEntry->IsDungeon() && corpseMapEntry->ghost_entrance_map >= 0) { // if corpse map have entrance - if(Map const* entranceMap = sMapMgr.CreateBaseMap(corpseMapEntry->ghost_entrance_map)) + if (Map const* entranceMap = sMapMgr.CreateBaseMap(corpseMapEntry->ghost_entrance_map)) { mapid = corpseMapEntry->ghost_entrance_map; x = corpseMapEntry->ghost_entrance_x; @@ -313,7 +313,7 @@ void WorldSession::HandleCorpseQueryOpcode(WorldPacket & /*recv_data*/) data << float(x); data << float(y); data << float(z); - data << int32(corpsemapid); + data << uint32(corpsemapid); data << uint32(0); // unknown SendPacket(&data); } diff --git a/src/game/QuestHandler.cpp b/src/game/QuestHandler.cpp index cd0854438..d503b928a 100644 --- a/src/game/QuestHandler.cpp +++ b/src/game/QuestHandler.cpp @@ -242,7 +242,7 @@ void WorldSession::HandleQuestgiverQueryQuestOpcode( WorldPacket & recv_data ) // Verify that the guid is valid and is a questgiver or involved in the requested quest Object* pObject = _player->GetObjectByTypeMask(guid, TYPEMASK_CREATURE_GAMEOBJECT_OR_ITEM); - if(!pObject||!pObject->HasQuest(quest) && !pObject->HasInvolvedQuest(quest)) + if (!pObject || (!pObject->HasQuest(quest) && !pObject->HasInvolvedQuest(quest))) { _player->PlayerTalkClass->CloseGossip(); return; diff --git a/src/game/Spell.cpp b/src/game/Spell.cpp index 0c2368c6e..be8e533c2 100644 --- a/src/game/Spell.cpp +++ b/src/game/Spell.cpp @@ -4375,10 +4375,11 @@ SpellCastResult Spell::CheckCast(bool strict) if (m_targets.m_targetMask == TARGET_FLAG_SELF && m_spellInfo->EffectImplicitTargetA[EFFECT_INDEX_1] == TARGET_CHAIN_DAMAGE) { - if (target = m_caster->GetMap()->GetUnit(((Player *)m_caster)->GetSelectionGuid())) - m_targets.setUnitTarget(target); - else + target = m_caster->GetMap()->GetUnit(((Player *)m_caster)->GetSelectionGuid()); + if (!target) return SPELL_FAILED_BAD_TARGETS; + + m_targets.setUnitTarget(target); } } @@ -4944,9 +4945,9 @@ SpellCastResult Spell::CheckCast(bool strict) case SPELL_EFFECT_POWER_DRAIN: { // Can be area effect, Check only for players and not check if target - caster (spell can have multiply drain/burn effects) - if(m_caster->GetTypeId() == TYPEID_PLAYER) - if(Unit* target = m_targets.getUnitTarget()) - if(target != m_caster && target->getPowerType() != m_spellInfo->EffectMiscValue[i]) + if (m_caster->GetTypeId() == TYPEID_PLAYER) + if (Unit* target = m_targets.getUnitTarget()) + if (target != m_caster && int32(target->getPowerType()) != m_spellInfo->EffectMiscValue[i]) return SPELL_FAILED_BAD_TARGETS; break; } @@ -6403,7 +6404,7 @@ bool Spell::CheckTarget( Unit* target, SpellEffectIndex eff ) bool Spell::IsNeedSendToClient() const { return m_spellInfo->SpellVisual[0] || m_spellInfo->SpellVisual[1] || IsChanneledSpell(m_spellInfo) || - m_spellInfo->speed > 0.0f || !m_triggeredByAuraSpell && !m_IsTriggeredSpell; + m_spellInfo->speed > 0.0f || (!m_triggeredByAuraSpell && !m_IsTriggeredSpell); } diff --git a/src/game/SpellAuras.cpp b/src/game/SpellAuras.cpp index 3975e1efc..320fef26e 100644 --- a/src/game/SpellAuras.cpp +++ b/src/game/SpellAuras.cpp @@ -390,7 +390,7 @@ m_isPersistent(false), m_in_use(0), m_spellAuraHolder(holder) m_applyTime = time(NULL); int32 damage; - if(!caster) + if (!caster) { damage = m_currentBasePoints; m_maxduration = target->CalculateSpellDuration(spellproto, m_effIndex, target); @@ -403,34 +403,36 @@ m_isPersistent(false), m_in_use(0), m_spellAuraHolder(holder) if (!damage && castItem && castItem->GetItemSuffixFactor()) { ItemRandomSuffixEntry const *item_rand_suffix = sItemRandomSuffixStore.LookupEntry(abs(castItem->GetItemRandomPropertyId())); - if(item_rand_suffix) + if (item_rand_suffix) { for (int k = 0; k < 3; ++k) { SpellItemEnchantmentEntry const *pEnchant = sSpellItemEnchantmentStore.LookupEntry(item_rand_suffix->enchant_id[k]); - if(pEnchant) + if (pEnchant) { for (int t = 0; t < 3; ++t) - if(pEnchant->spellid[t] == spellproto->Id) { + if(pEnchant->spellid[t] != spellproto->Id) + continue; + damage = uint32((item_rand_suffix->prefix[k]*castItem->GetItemSuffixFactor()) / 10000 ); break; } } - if(damage) + if (damage) break; } } } } - if(m_maxduration == -1 || isPassive && spellproto->DurationIndex == 0) + if (m_maxduration == -1 || (isPassive && spellproto->DurationIndex == 0)) isPermanent = true; Player* modOwner = caster ? caster->GetSpellModOwner() : NULL; - if(!isPermanent && modOwner) + if (!isPermanent && modOwner) { modOwner->ApplySpellMod(spellproto->Id, SPELLMOD_DURATION, m_maxduration); // Get zero duration aura after - need set m_maxduration > 0 for apply/remove aura work @@ -961,7 +963,7 @@ void Aura::ReapplyAffectedPassiveAuras( Unit* target, bool owner_mode ) { // permanent passive or permanent area aura // passive spells can be affected only by own or owner spell mods) - if (itr->second->IsPermanent() && (owner_mode && itr->second->IsPassive() || itr->second->IsAreaAura()) && + if ((itr->second->IsPermanent() && (owner_mode && itr->second->IsPassive() || itr->second->IsAreaAura())) && // non deleted and not same aura (any with same spell id) !itr->second->IsDeleted() && itr->second->GetId() != GetId() && // and affected by aura @@ -2903,10 +2905,10 @@ void Aura::HandleAuraModShapeshift(bool apply, bool Real) uint32 aurMechMask = GetAllSpellMechanicMask(aurSpellInfo); // If spell that caused this aura has Croud Control or Daze effect - if((aurMechMask & MECHANIC_NOT_REMOVED_BY_SHAPESHIFT) || + if ((aurMechMask & MECHANIC_NOT_REMOVED_BY_SHAPESHIFT) || // some Daze spells have these parameters instead of MECHANIC_DAZE (skip snare spells) - aurSpellInfo->SpellIconID == 15 && aurSpellInfo->Dispel == 0 && - (aurMechMask & (1 << (MECHANIC_SNARE-1)))==0) + (aurSpellInfo->SpellIconID == 15 && aurSpellInfo->Dispel == 0 && + (aurMechMask & (1 << (MECHANIC_SNARE-1))) == 0)) { ++iter; continue; @@ -3259,7 +3261,7 @@ void Aura::HandleForceReaction(bool apply, bool Real) player->GetReputationMgr().SendForceReactions(); // stop fighting if at apply forced rank friendly or at remove real rank friendly - if (apply && faction_rank >= REP_FRIENDLY || !apply && player->GetReputationRank(faction_id) >= REP_FRIENDLY) + if ((apply && faction_rank >= REP_FRIENDLY) || (!apply && player->GetReputationRank(faction_id) >= REP_FRIENDLY)) player->StopAttackFaction(faction_id); } @@ -3278,16 +3280,16 @@ void Aura::HandleAuraModSkill(bool apply, bool /*Real*/) void Aura::HandleChannelDeathItem(bool apply, bool Real) { - if(Real && !apply) + if (Real && !apply) { - if(m_removeMode != AURA_REMOVE_BY_DEATH) + if (m_removeMode != AURA_REMOVE_BY_DEATH) return; // Item amount if (m_modifier.m_amount <= 0) return; SpellEntry const *spellInfo = GetSpellProto(); - if(spellInfo->EffectItemType[m_effIndex] == 0) + if (spellInfo->EffectItemType[m_effIndex] == 0) return; Unit* victim = GetTarget(); @@ -3300,7 +3302,7 @@ void Aura::HandleChannelDeathItem(bool apply, bool Real) { // Only from non-grey units if (!((Player*)caster)->isHonorOrXPTarget(victim) || - victim->GetTypeId() == TYPEID_UNIT && !((Player*)caster)->isAllowedToLoot((Creature*)victim)) + (victim->GetTypeId() == TYPEID_UNIT && !((Player*)caster)->isAllowedToLoot((Creature*)victim))) return; } @@ -7798,7 +7800,7 @@ m_permanent(false), m_isRemovedOnShapeLost(true), m_deleted(false), m_in_use(0) m_isDeathPersist = IsDeathPersistentSpell(m_spellProto); m_isSingleTarget = IsSingleTargetSpell(spellproto); - if(GetSpellMaxDuration(m_spellProto) == -1 || m_isPassive && m_spellProto->DurationIndex == 0) + if (GetSpellMaxDuration(m_spellProto) == -1 || (m_isPassive && m_spellProto->DurationIndex == 0)) m_permanent = true; m_isRemovedOnShapeLost = (m_caster_guid==m_target->GetGUID() && @@ -8091,8 +8093,8 @@ void SpellAuraHolder::CleanupTriggeredSpells() // needed for spell 43680, maybe others // TODO: is there a spell flag, which can solve this in a more sophisticated way? - if(m_spellProto->EffectApplyAuraName[i] == SPELL_AURA_PERIODIC_TRIGGER_SPELL && - GetSpellDuration(m_spellProto) == m_spellProto->EffectAmplitude[i]) + if (m_spellProto->EffectApplyAuraName[i] == SPELL_AURA_PERIODIC_TRIGGER_SPELL && + GetSpellDuration(m_spellProto) == int32(m_spellProto->EffectAmplitude[i])) continue; m_target->RemoveAurasDueToSpell(tSpellId); @@ -8313,7 +8315,7 @@ void SpellAuraHolder::HandleSpellSpecificBoosts(bool apply) // Ice Barrier (non stacking from one caster) if (m_spellProto->SpellIconID == 32) { - if (!apply && m_removeMode == AURA_REMOVE_BY_DISPEL || m_removeMode == AURA_REMOVE_BY_SHIELD_BREAK) + if ((!apply && m_removeMode == AURA_REMOVE_BY_DISPEL) || m_removeMode == AURA_REMOVE_BY_SHIELD_BREAK) { Unit::AuraList const& dummyAuras = m_target->GetAurasByType(SPELL_AURA_DUMMY); for(Unit::AuraList::const_iterator itr = dummyAuras.begin(); itr != dummyAuras.end(); ++itr) @@ -8449,7 +8451,7 @@ void SpellAuraHolder::HandleSpellSpecificBoosts(bool apply) case SPELLFAMILY_PRIEST: { // Shadow Word: Pain (need visual check fro skip improvement talent) or Vampiric Touch - if (m_spellProto->SpellIconID == 234 && m_spellProto->SpellVisual[0] || m_spellProto->SpellIconID == 2213) + if ((m_spellProto->SpellIconID == 234 && m_spellProto->SpellVisual[0]) || m_spellProto->SpellIconID == 2213) { if (!apply && m_removeMode == AURA_REMOVE_BY_DISPEL) { diff --git a/src/game/SpellEffects.cpp b/src/game/SpellEffects.cpp index 0cfc6119e..8e1480aef 100644 --- a/src/game/SpellEffects.cpp +++ b/src/game/SpellEffects.cpp @@ -1641,8 +1641,9 @@ void Spell::EffectDummy(SpellEffectIndex eff_idx) m_caster->CastSpell(m_caster, spellID, true, NULL); return; } - case EFFECT_INDEX_1: - return; // additional data for dummy[0] + case EFFECT_INDEX_1: // additional data for dummy[0] + case EFFECT_INDEX_2: + return; } return; } @@ -3807,8 +3808,8 @@ void Spell::EffectOpenLock(SpellEffectIndex eff_idx) { GameObjectInfo const* goInfo = gameObjTarget->GetGOInfo(); // Arathi Basin banner opening ! - if (goInfo->type == GAMEOBJECT_TYPE_BUTTON && goInfo->button.noDamageImmune || - goInfo->type == GAMEOBJECT_TYPE_GOOBER && goInfo->goober.losOK) + if ((goInfo->type == GAMEOBJECT_TYPE_BUTTON && goInfo->button.noDamageImmune) || + (goInfo->type == GAMEOBJECT_TYPE_GOOBER && goInfo->goober.losOK)) { //CanUseBattleGroundObject() already called in CheckCast() // in battleground check @@ -5831,7 +5832,7 @@ void Spell::EffectScriptEffect(SpellEffectIndex eff_idx) if (const SpellEntry *pSpell = sSpellStore.LookupEntry(m_spellInfo->CalculateSimpleValue(eff_idx))) { // if we used item at least once... - if (pTarget->IsTemporarySummon() && pTarget->GetEntry() == pSpell->EffectMiscValue[eff_idx]) + if (pTarget->IsTemporarySummon() && int32(pTarget->GetEntry()) == pSpell->EffectMiscValue[eff_idx]) { TemporarySummon* pSummon = (TemporarySummon*)pTarget; diff --git a/src/game/SpellMgr.cpp b/src/game/SpellMgr.cpp index 5aa713f1e..f07c353b6 100644 --- a/src/game/SpellMgr.cpp +++ b/src/game/SpellMgr.cpp @@ -193,7 +193,7 @@ uint32 GetSpellCastTimeForBonus( SpellEntry const *spellProto, DamageEffectType for(int j = 0; j < MAX_EFFECT_INDEX; ++j) { if (spellProto->Effect[j] == SPELL_EFFECT_HEALTH_LEECH || - spellProto->Effect[j] == SPELL_EFFECT_APPLY_AURA && spellProto->EffectApplyAuraName[j] == SPELL_AURA_PERIODIC_LEECH) + (spellProto->Effect[j] == SPELL_EFFECT_APPLY_AURA && spellProto->EffectApplyAuraName[j] == SPELL_AURA_PERIODIC_LEECH)) { CastingTime /= 2; break; @@ -1018,7 +1018,7 @@ void SpellMgr::LoadSpellTargetPositions() if (spellInfo->Effect[i]==SPELL_EFFECT_BIND && spellInfo->EffectMiscValue[i]) { uint32 zone_id = sMapMgr.GetAreaId(st.target_mapId, st.target_X, st.target_Y, st.target_Z); - if (zone_id != spellInfo->EffectMiscValue[i]) + if (int32(zone_id) != spellInfo->EffectMiscValue[i]) { sLog.outErrorDb("Spell (Id: %u) listed in `spell_target_position` expected point to zone %u bit point to zone %u.",Spell_ID, spellInfo->EffectMiscValue[i], zone_id); break; @@ -1742,22 +1742,22 @@ bool SpellMgr::IsNoStackSpellDueToSpell(uint32 spellId_1, uint32 spellId_2) cons return false; // Soulstone Resurrection and Twisting Nether (resurrector) - if( spellInfo_1->SpellIconID == 92 && spellInfo_2->SpellIconID == 92 && ( - spellInfo_1->SpellVisual[0] == 99 && spellInfo_2->SpellVisual[0] == 0 || - spellInfo_2->SpellVisual[0] == 99 && spellInfo_1->SpellVisual[0] == 0 ) ) + if (spellInfo_1->SpellIconID == 92 && spellInfo_2->SpellIconID == 92 && ( + (spellInfo_1->SpellVisual[0] == 99 && spellInfo_2->SpellVisual[0] == 0) || + (spellInfo_2->SpellVisual[0] == 99 && spellInfo_1->SpellVisual[0] == 0))) return false; // Heart of the Wild, Agility and various Idol Triggers - if(spellInfo_1->SpellIconID == 240 && spellInfo_2->SpellIconID == 240) + if (spellInfo_1->SpellIconID == 240 && spellInfo_2->SpellIconID == 240) return false; // Personalized Weather (thunder effect should overwrite rainy aura) - if(spellInfo_1->SpellIconID == 2606 && spellInfo_2->SpellIconID == 2606) + if (spellInfo_1->SpellIconID == 2606 && spellInfo_2->SpellIconID == 2606) return false; // Brood Affliction: Bronze - if( (spellInfo_1->Id == 23170 && spellInfo_2->Id == 23171) || - (spellInfo_2->Id == 23170 && spellInfo_1->Id == 23171) ) + if ((spellInfo_1->Id == 23170 && spellInfo_2->Id == 23171) || + (spellInfo_2->Id == 23170 && spellInfo_1->Id == 23171)) return false; // Cool Down (See PeriodicAuraTick()) @@ -1766,34 +1766,34 @@ bool SpellMgr::IsNoStackSpellDueToSpell(uint32 spellId_1, uint32 spellId_2) cons return false; // See Chapel Invisibility and See Noth Invisibility - if( (spellInfo_1->Id == 52950 && spellInfo_2->Id == 52707) || - (spellInfo_2->Id == 52950 && spellInfo_1->Id == 52707) ) + if ((spellInfo_1->Id == 52950 && spellInfo_2->Id == 52707) || + (spellInfo_2->Id == 52950 && spellInfo_1->Id == 52707)) return false; // Regular and Night Elf Ghost - if( (spellInfo_1->Id == 8326 && spellInfo_2->Id == 20584) || - (spellInfo_2->Id == 8326 && spellInfo_1->Id == 20584) ) + if ((spellInfo_1->Id == 8326 && spellInfo_2->Id == 20584) || + (spellInfo_2->Id == 8326 && spellInfo_1->Id == 20584)) return false; // Kindred Spirits - if( spellInfo_1->SpellIconID == 3559 && spellInfo_2->SpellIconID == 3559 ) + if (spellInfo_1->SpellIconID == 3559 && spellInfo_2->SpellIconID == 3559) return false; break; } case SPELLFAMILY_MAGE: // Arcane Intellect and Insight - if( spellInfo_2->SpellIconID == 125 && spellInfo_1->Id == 18820 ) + if (spellInfo_2->SpellIconID == 125 && spellInfo_1->Id == 18820) return false; break; case SPELLFAMILY_WARRIOR: { // Scroll of Protection and Defensive Stance (multi-family check) - if( spellInfo_1->SpellIconID == 276 && spellInfo_1->SpellVisual[0] == 196 && spellInfo_2->Id == 71) + if (spellInfo_1->SpellIconID == 276 && spellInfo_1->SpellVisual[0] == 196 && spellInfo_2->Id == 71) return false; // Improved Hamstring -> Hamstring (multi-family check) - if( (spellInfo_2->SpellFamilyFlags & UI64LIT(0x2)) && spellInfo_1->Id == 23694 ) + if ((spellInfo_2->SpellFamilyFlags & UI64LIT(0x2)) && spellInfo_1->Id == 23694) return false; break; @@ -1801,11 +1801,11 @@ bool SpellMgr::IsNoStackSpellDueToSpell(uint32 spellId_1, uint32 spellId_2) cons case SPELLFAMILY_DRUID: { // Scroll of Stamina and Leader of the Pack (multi-family check) - if( spellInfo_1->SpellIconID == 312 && spellInfo_1->SpellVisual[0] == 216 && spellInfo_2->Id == 24932 ) + if (spellInfo_1->SpellIconID == 312 && spellInfo_1->SpellVisual[0] == 216 && spellInfo_2->Id == 24932) return false; // Dragonmaw Illusion (multi-family check) - if (spellId_1 == 40216 && spellId_2 == 42016 ) + if (spellId_1 == 40216 && spellId_2 == 42016) return false; break; @@ -1813,7 +1813,7 @@ bool SpellMgr::IsNoStackSpellDueToSpell(uint32 spellId_1, uint32 spellId_2) cons case SPELLFAMILY_ROGUE: { // Garrote-Silence -> Garrote (multi-family check) - if( spellInfo_1->SpellIconID == 498 && spellInfo_1->SpellVisual[0] == 0 && spellInfo_2->SpellIconID == 498 ) + if (spellInfo_1->SpellIconID == 498 && spellInfo_1->SpellVisual[0] == 0 && spellInfo_2->SpellIconID == 498) return false; break; @@ -1821,22 +1821,22 @@ bool SpellMgr::IsNoStackSpellDueToSpell(uint32 spellId_1, uint32 spellId_2) cons case SPELLFAMILY_HUNTER: { // Concussive Shot and Imp. Concussive Shot (multi-family check) - if( spellInfo_1->Id == 19410 && spellInfo_2->Id == 5116 ) + if (spellInfo_1->Id == 19410 && spellInfo_2->Id == 5116) return false; // Improved Wing Clip -> Wing Clip (multi-family check) - if( (spellInfo_2->SpellFamilyFlags & UI64LIT(0x40)) && spellInfo_1->Id == 19229 ) + if ((spellInfo_2->SpellFamilyFlags & UI64LIT(0x40)) && spellInfo_1->Id == 19229) return false; break; } case SPELLFAMILY_PALADIN: { // Unstable Currents and other -> *Sanctity Aura (multi-family check) - if( spellInfo_2->SpellIconID==502 && spellInfo_1->SpellIconID==502 && spellInfo_1->SpellVisual[0]==969 ) + if (spellInfo_2->SpellIconID==502 && spellInfo_1->SpellIconID==502 && spellInfo_1->SpellVisual[0]==969) return false; // *Band of Eternal Champion and Seal of Command(multi-family check) - if( spellId_1 == 35081 && spellInfo_2->SpellIconID==561 && spellInfo_2->SpellVisual[0]==7992) + if (spellId_1 == 35081 && spellInfo_2->SpellIconID==561 && spellInfo_2->SpellVisual[0]==7992) return false; // Blessing of Sanctuary (multi-family check, some from 16 spell icon spells) @@ -1854,60 +1854,60 @@ bool SpellMgr::IsNoStackSpellDueToSpell(uint32 spellId_1, uint32 spellId_2) cons if( spellInfo_2->SpellFamilyName == SPELLFAMILY_MAGE ) { // Blizzard & Chilled (and some other stacked with blizzard spells - if( (spellInfo_1->SpellFamilyFlags & UI64LIT(0x80)) && (spellInfo_2->SpellFamilyFlags & UI64LIT(0x100000)) || - (spellInfo_2->SpellFamilyFlags & UI64LIT(0x80)) && (spellInfo_1->SpellFamilyFlags & UI64LIT(0x100000)) ) + if (((spellInfo_1->SpellFamilyFlags & UI64LIT(0x80)) && (spellInfo_2->SpellFamilyFlags & UI64LIT(0x100000))) || + ((spellInfo_2->SpellFamilyFlags & UI64LIT(0x80)) && (spellInfo_1->SpellFamilyFlags & UI64LIT(0x100000)))) return false; // Blink & Improved Blink - if( (spellInfo_1->SpellFamilyFlags & UI64LIT(0x0000000000010000)) && (spellInfo_2->SpellVisual[0] == 72 && spellInfo_2->SpellIconID == 1499) || - (spellInfo_2->SpellFamilyFlags & UI64LIT(0x0000000000010000)) && (spellInfo_1->SpellVisual[0] == 72 && spellInfo_1->SpellIconID == 1499) ) + if (((spellInfo_1->SpellFamilyFlags & UI64LIT(0x0000000000010000)) && (spellInfo_2->SpellVisual[0] == 72 && spellInfo_2->SpellIconID == 1499)) || + ((spellInfo_2->SpellFamilyFlags & UI64LIT(0x0000000000010000)) && (spellInfo_1->SpellVisual[0] == 72 && spellInfo_1->SpellIconID == 1499))) return false; // Living Bomb & Ignite (Dots) - if( (spellInfo_1->SpellFamilyFlags & UI64LIT(0x2000000000000)) && (spellInfo_2->SpellFamilyFlags & UI64LIT(0x8000000)) || - (spellInfo_2->SpellFamilyFlags & UI64LIT(0x2000000000000)) && (spellInfo_1->SpellFamilyFlags & UI64LIT(0x8000000)) ) + if (((spellInfo_1->SpellFamilyFlags & UI64LIT(0x2000000000000)) && (spellInfo_2->SpellFamilyFlags & UI64LIT(0x8000000))) || + ((spellInfo_2->SpellFamilyFlags & UI64LIT(0x2000000000000)) && (spellInfo_1->SpellFamilyFlags & UI64LIT(0x8000000)))) return false; // Fireball & Pyroblast (Dots) - if( (spellInfo_1->SpellFamilyFlags & UI64LIT(0x1)) && (spellInfo_2->SpellFamilyFlags & UI64LIT(0x400000)) || - (spellInfo_2->SpellFamilyFlags & UI64LIT(0x1)) && (spellInfo_1->SpellFamilyFlags & UI64LIT(0x400000)) ) + if (((spellInfo_1->SpellFamilyFlags & UI64LIT(0x1)) && (spellInfo_2->SpellFamilyFlags & UI64LIT(0x400000))) || + ((spellInfo_2->SpellFamilyFlags & UI64LIT(0x1)) && (spellInfo_1->SpellFamilyFlags & UI64LIT(0x400000)))) return false; } // Detect Invisibility and Mana Shield (multi-family check) - if( spellInfo_2->Id == 132 && spellInfo_1->SpellIconID == 209 && spellInfo_1->SpellVisual[0] == 968 ) + if (spellInfo_2->Id == 132 && spellInfo_1->SpellIconID == 209 && spellInfo_1->SpellVisual[0] == 968) return false; // Combustion and Fire Protection Aura (multi-family check) - if( spellInfo_1->Id == 11129 && spellInfo_2->SpellIconID == 33 && spellInfo_2->SpellVisual[0] == 321 ) + if (spellInfo_1->Id == 11129 && spellInfo_2->SpellIconID == 33 && spellInfo_2->SpellVisual[0] == 321) return false; // Arcane Intellect and Insight - if( spellInfo_1->SpellIconID == 125 && spellInfo_2->Id == 18820 ) + if (spellInfo_1->SpellIconID == 125 && spellInfo_2->Id == 18820) return false; break; case SPELLFAMILY_WARLOCK: - if( spellInfo_2->SpellFamilyName == SPELLFAMILY_WARLOCK ) + if (spellInfo_2->SpellFamilyName == SPELLFAMILY_WARLOCK) { // Siphon Life and Drain Life - if( spellInfo_1->SpellIconID == 152 && spellInfo_2->SpellIconID == 546 || - spellInfo_2->SpellIconID == 152 && spellInfo_1->SpellIconID == 546 ) + if ((spellInfo_1->SpellIconID == 152 && spellInfo_2->SpellIconID == 546) || + (spellInfo_2->SpellIconID == 152 && spellInfo_1->SpellIconID == 546)) return false; //Corruption & Seed of corruption - if( spellInfo_1->SpellIconID == 313 && spellInfo_2->SpellIconID == 1932 || - spellInfo_2->SpellIconID == 313 && spellInfo_1->SpellIconID == 1932 ) + if ((spellInfo_1->SpellIconID == 313 && spellInfo_2->SpellIconID == 1932) || + (spellInfo_2->SpellIconID == 313 && spellInfo_1->SpellIconID == 1932)) if(spellInfo_1->SpellVisual[0] != 0 && spellInfo_2->SpellVisual[0] != 0) return true; // can't be stacked // Corruption and Unstable Affliction - if( spellInfo_1->SpellIconID == 313 && spellInfo_2->SpellIconID == 2039 || - spellInfo_2->SpellIconID == 313 && spellInfo_1->SpellIconID == 2039 ) + if ((spellInfo_1->SpellIconID == 313 && spellInfo_2->SpellIconID == 2039) || + (spellInfo_2->SpellIconID == 313 && spellInfo_1->SpellIconID == 2039)) return false; // (Corruption or Unstable Affliction) and (Curse of Agony or Curse of Doom) - if( (spellInfo_1->SpellIconID == 313 || spellInfo_1->SpellIconID == 2039) && (spellInfo_2->SpellIconID == 544 || spellInfo_2->SpellIconID == 91) || - (spellInfo_2->SpellIconID == 313 || spellInfo_2->SpellIconID == 2039) && (spellInfo_1->SpellIconID == 544 || spellInfo_1->SpellIconID == 91) ) + if (((spellInfo_1->SpellIconID == 313 || spellInfo_1->SpellIconID == 2039) && (spellInfo_2->SpellIconID == 544 || spellInfo_2->SpellIconID == 91)) || + ((spellInfo_2->SpellIconID == 313 || spellInfo_2->SpellIconID == 2039) && (spellInfo_1->SpellIconID == 544 || spellInfo_1->SpellIconID == 91))) return false; // Metamorphosis, diff effects @@ -1915,47 +1915,47 @@ bool SpellMgr::IsNoStackSpellDueToSpell(uint32 spellId_1, uint32 spellId_2) cons return false; } // Detect Invisibility and Mana Shield (multi-family check) - if( spellInfo_1->Id == 132 && spellInfo_2->SpellIconID == 209 && spellInfo_2->SpellVisual[0] == 968 ) + if (spellInfo_1->Id == 132 && spellInfo_2->SpellIconID == 209 && spellInfo_2->SpellVisual[0] == 968) return false; break; case SPELLFAMILY_WARRIOR: - if( spellInfo_2->SpellFamilyName == SPELLFAMILY_WARRIOR ) + if (spellInfo_2->SpellFamilyName == SPELLFAMILY_WARRIOR) { // Rend and Deep Wound - if( (spellInfo_1->SpellFamilyFlags & UI64LIT(0x20)) && (spellInfo_2->SpellFamilyFlags & UI64LIT(0x1000000000)) || - (spellInfo_2->SpellFamilyFlags & UI64LIT(0x20)) && (spellInfo_1->SpellFamilyFlags & UI64LIT(0x1000000000)) ) + if (((spellInfo_1->SpellFamilyFlags & UI64LIT(0x20)) && (spellInfo_2->SpellFamilyFlags & UI64LIT(0x1000000000))) || + ((spellInfo_2->SpellFamilyFlags & UI64LIT(0x20)) && (spellInfo_1->SpellFamilyFlags & UI64LIT(0x1000000000)))) return false; // Battle Shout and Rampage - if( (spellInfo_1->SpellIconID == 456 && spellInfo_2->SpellIconID == 2006) || - (spellInfo_2->SpellIconID == 456 && spellInfo_1->SpellIconID == 2006) ) + if ((spellInfo_1->SpellIconID == 456 && spellInfo_2->SpellIconID == 2006) || + (spellInfo_2->SpellIconID == 456 && spellInfo_1->SpellIconID == 2006)) return false; } // Hamstring -> Improved Hamstring (multi-family check) - if( (spellInfo_1->SpellFamilyFlags & UI64LIT(0x2)) && spellInfo_2->Id == 23694 ) + if ((spellInfo_1->SpellFamilyFlags & UI64LIT(0x2)) && spellInfo_2->Id == 23694) return false; // Defensive Stance and Scroll of Protection (multi-family check) - if( spellInfo_1->Id == 71 && spellInfo_2->SpellIconID == 276 && spellInfo_2->SpellVisual[0] == 196 ) + if (spellInfo_1->Id == 71 && spellInfo_2->SpellIconID == 276 && spellInfo_2->SpellVisual[0] == 196) return false; // Bloodlust and Bloodthirst (multi-family check) - if( spellInfo_2->Id == 2825 && spellInfo_1->SpellIconID == 38 && spellInfo_1->SpellVisual[0] == 0 ) + if (spellInfo_2->Id == 2825 && spellInfo_1->SpellIconID == 38 && spellInfo_1->SpellVisual[0] == 0) return false; break; case SPELLFAMILY_PRIEST: - if( spellInfo_2->SpellFamilyName == SPELLFAMILY_PRIEST ) + if (spellInfo_2->SpellFamilyName == SPELLFAMILY_PRIEST) { //Devouring Plague and Shadow Vulnerability - if ((spellInfo_1->SpellFamilyFlags & UI64LIT(0x2000000)) && (spellInfo_2->SpellFamilyFlags & UI64LIT(0x800000000)) || - (spellInfo_2->SpellFamilyFlags & UI64LIT(0x2000000)) && (spellInfo_1->SpellFamilyFlags & UI64LIT(0x800000000))) + if (((spellInfo_1->SpellFamilyFlags & UI64LIT(0x2000000)) && (spellInfo_2->SpellFamilyFlags & UI64LIT(0x800000000))) || + ((spellInfo_2->SpellFamilyFlags & UI64LIT(0x2000000)) && (spellInfo_1->SpellFamilyFlags & UI64LIT(0x800000000)))) return false; //StarShards and Shadow Word: Pain - if ((spellInfo_1->SpellFamilyFlags & UI64LIT(0x200000)) && (spellInfo_2->SpellFamilyFlags & UI64LIT(0x8000)) || - (spellInfo_2->SpellFamilyFlags & UI64LIT(0x200000)) && (spellInfo_1->SpellFamilyFlags & UI64LIT(0x8000))) + if (((spellInfo_1->SpellFamilyFlags & UI64LIT(0x200000)) && (spellInfo_2->SpellFamilyFlags & UI64LIT(0x8000))) || + ((spellInfo_2->SpellFamilyFlags & UI64LIT(0x200000)) && (spellInfo_1->SpellFamilyFlags & UI64LIT(0x8000)))) return false; // Dispersion if ((spellInfo_1->Id == 47585 && spellInfo_2->Id == 60069) || @@ -1964,11 +1964,11 @@ bool SpellMgr::IsNoStackSpellDueToSpell(uint32 spellId_1, uint32 spellId_2) cons } break; case SPELLFAMILY_DRUID: - if( spellInfo_2->SpellFamilyName == SPELLFAMILY_DRUID ) + if (spellInfo_2->SpellFamilyName == SPELLFAMILY_DRUID) { //Omen of Clarity and Blood Frenzy - if( (spellInfo_1->SpellFamilyFlags == UI64LIT(0x0) && spellInfo_1->SpellIconID == 108) && (spellInfo_2->SpellFamilyFlags & UI64LIT(0x20000000000000)) || - (spellInfo_2->SpellFamilyFlags == UI64LIT(0x0) && spellInfo_2->SpellIconID == 108) && (spellInfo_1->SpellFamilyFlags & UI64LIT(0x20000000000000)) ) + if (((spellInfo_1->SpellFamilyFlags == UI64LIT(0x0) && spellInfo_1->SpellIconID == 108) && (spellInfo_2->SpellFamilyFlags & UI64LIT(0x20000000000000))) || + ((spellInfo_2->SpellFamilyFlags == UI64LIT(0x0) && spellInfo_2->SpellIconID == 108) && (spellInfo_1->SpellFamilyFlags & UI64LIT(0x20000000000000)))) return false; // Tree of Life (Shapeshift) and 34123 Tree of Life (Passive) @@ -1977,8 +1977,8 @@ bool SpellMgr::IsNoStackSpellDueToSpell(uint32 spellId_1, uint32 spellId_2) cons return false; // Lifebloom and Wild Growth - if (spellInfo_1->SpellIconID == 2101 && spellInfo_2->SpellIconID == 2864 || - spellInfo_2->SpellIconID == 2101 && spellInfo_1->SpellIconID == 2864 ) + if ((spellInfo_1->SpellIconID == 2101 && spellInfo_2->SpellIconID == 2864) || + (spellInfo_2->SpellIconID == 2101 && spellInfo_1->SpellIconID == 2864)) return false; // Innervate and Glyph of Innervate and some other spells @@ -1986,19 +1986,23 @@ bool SpellMgr::IsNoStackSpellDueToSpell(uint32 spellId_1, uint32 spellId_2) cons return false; // Wrath of Elune and Nature's Grace - if( spellInfo_1->Id == 16886 && spellInfo_2->Id == 46833 || spellInfo_2->Id == 16886 && spellInfo_1->Id == 46833 ) + if ((spellInfo_1->Id == 16886 && spellInfo_2->Id == 46833) || + (spellInfo_2->Id == 16886 && spellInfo_1->Id == 46833)) return false; // Bear Rage (Feral T4 (2)) and Omen of Clarity - if( spellInfo_1->Id == 16864 && spellInfo_2->Id == 37306 || spellInfo_2->Id == 16864 && spellInfo_1->Id == 37306 ) + if ((spellInfo_1->Id == 16864 && spellInfo_2->Id == 37306) || + (spellInfo_2->Id == 16864 && spellInfo_1->Id == 37306)) return false; // Cat Energy (Feral T4 (2)) and Omen of Clarity - if( spellInfo_1->Id == 16864 && spellInfo_2->Id == 37311 || spellInfo_2->Id == 16864 && spellInfo_1->Id == 37311 ) + if ((spellInfo_1->Id == 16864 && spellInfo_2->Id == 37311) || + (spellInfo_2->Id == 16864 && spellInfo_1->Id == 37311)) return false; // Survival Instincts and Survival Instincts - if( spellInfo_1->Id == 61336 && spellInfo_2->Id == 50322 || spellInfo_2->Id == 61336 && spellInfo_1->Id == 50322 ) + if ((spellInfo_1->Id == 61336 && spellInfo_2->Id == 50322) || + (spellInfo_2->Id == 61336 && spellInfo_1->Id == 50322)) return false; // Savage Roar and Savage Roar (triggered) @@ -2006,12 +2010,13 @@ bool SpellMgr::IsNoStackSpellDueToSpell(uint32 spellId_1, uint32 spellId_2) cons return false; // Frenzied Regeneration and Savage Defense - if( spellInfo_1->Id == 22842 && spellInfo_2->Id == 62606 || spellInfo_2->Id == 22842 && spellInfo_1->Id == 62606 ) + if ((spellInfo_1->Id == 22842 && spellInfo_2->Id == 62606) || + (spellInfo_2->Id == 22842 && spellInfo_1->Id == 62606)) return false; } // Leader of the Pack and Scroll of Stamina (multi-family check) - if( spellInfo_1->Id == 24932 && spellInfo_2->SpellIconID == 312 && spellInfo_2->SpellVisual[0] == 216 ) + if (spellInfo_1->Id == 24932 && spellInfo_2->SpellIconID == 312 && spellInfo_2->SpellVisual[0] == 216) return false; // Dragonmaw Illusion (multi-family check) @@ -2020,63 +2025,64 @@ bool SpellMgr::IsNoStackSpellDueToSpell(uint32 spellId_1, uint32 spellId_2) cons break; case SPELLFAMILY_ROGUE: - if( spellInfo_2->SpellFamilyName == SPELLFAMILY_ROGUE ) + if (spellInfo_2->SpellFamilyName == SPELLFAMILY_ROGUE) { // Master of Subtlety - if (spellId_1 == 31665 && spellId_2 == 31666 || spellId_1 == 31666 && spellId_2 == 31665 ) + if ((spellId_1 == 31665 && spellId_2 == 31666) || + (spellId_1 == 31666 && spellId_2 == 31665)) return false; // Sprint & Sprint (waterwalk) - if( spellInfo_1->SpellIconID == 516 && spellInfo_2->SpellIconID == 516 && - (spellInfo_1->Category == 44 && spellInfo_2->Category == 0 || - spellInfo_2->Category == 44 && spellInfo_1->Category == 0)) + if (spellInfo_1->SpellIconID == 516 && spellInfo_2->SpellIconID == 516 && + ((spellInfo_1->Category == 44 && spellInfo_2->Category == 0) || + (spellInfo_2->Category == 44 && spellInfo_1->Category == 0))) return false; } //Overkill - if( spellInfo_1->SpellIconID == 2285 && spellInfo_2->SpellIconID == 2285 ) + if (spellInfo_1->SpellIconID == 2285 && spellInfo_2->SpellIconID == 2285) return false; // Garrote -> Garrote-Silence (multi-family check) - if( spellInfo_1->SpellIconID == 498 && spellInfo_2->SpellIconID == 498 && spellInfo_2->SpellVisual[0] == 0 ) + if (spellInfo_1->SpellIconID == 498 && spellInfo_2->SpellIconID == 498 && spellInfo_2->SpellVisual[0] == 0) return false; break; case SPELLFAMILY_HUNTER: - if( spellInfo_2->SpellFamilyName == SPELLFAMILY_HUNTER ) + if (spellInfo_2->SpellFamilyName == SPELLFAMILY_HUNTER) { // Rapid Fire & Quick Shots - if( (spellInfo_1->SpellFamilyFlags & UI64LIT(0x20)) && (spellInfo_2->SpellFamilyFlags & UI64LIT(0x20000000000)) || - (spellInfo_2->SpellFamilyFlags & UI64LIT(0x20)) && (spellInfo_1->SpellFamilyFlags & UI64LIT(0x20000000000)) ) + if (((spellInfo_1->SpellFamilyFlags & UI64LIT(0x20)) && (spellInfo_2->SpellFamilyFlags & UI64LIT(0x20000000000))) || + ((spellInfo_2->SpellFamilyFlags & UI64LIT(0x20)) && (spellInfo_1->SpellFamilyFlags & UI64LIT(0x20000000000))) ) return false; // Serpent Sting & (Immolation/Explosive Trap Effect) - if( (spellInfo_1->SpellFamilyFlags & UI64LIT(0x4)) && (spellInfo_2->SpellFamilyFlags & UI64LIT(0x00000004000)) || - (spellInfo_2->SpellFamilyFlags & UI64LIT(0x4)) && (spellInfo_1->SpellFamilyFlags & UI64LIT(0x00000004000)) ) + if (((spellInfo_1->SpellFamilyFlags & UI64LIT(0x4)) && (spellInfo_2->SpellFamilyFlags & UI64LIT(0x00000004000))) || + ((spellInfo_2->SpellFamilyFlags & UI64LIT(0x4)) && (spellInfo_1->SpellFamilyFlags & UI64LIT(0x00000004000)))) return false; // Bestial Wrath - if( spellInfo_1->SpellIconID == 1680 && spellInfo_2->SpellIconID == 1680 ) + if (spellInfo_1->SpellIconID == 1680 && spellInfo_2->SpellIconID == 1680) return false; } // Wing Clip -> Improved Wing Clip (multi-family check) - if( (spellInfo_1->SpellFamilyFlags & UI64LIT(0x40)) && spellInfo_2->Id == 19229 ) + if ((spellInfo_1->SpellFamilyFlags & UI64LIT(0x40)) && spellInfo_2->Id == 19229) return false; // Concussive Shot and Imp. Concussive Shot (multi-family check) - if( spellInfo_2->Id == 19410 && spellInfo_1->Id == 5116 ) + if (spellInfo_2->Id == 19410 && spellInfo_1->Id == 5116) return false; break; case SPELLFAMILY_PALADIN: - if( spellInfo_2->SpellFamilyName == SPELLFAMILY_PALADIN ) + if (spellInfo_2->SpellFamilyName == SPELLFAMILY_PALADIN) { // Paladin Seals if (IsSealSpell(spellInfo_1) && IsSealSpell(spellInfo_2)) return true; // Swift Retribution / Improved Devotion Aura (talents) and Paladin Auras - if ((spellInfo_1->SpellFamilyFlags2 & 0x00000020) && (spellInfo_2->SpellIconID == 291 || spellInfo_2->SpellIconID == 3028) || - (spellInfo_2->SpellFamilyFlags2 & 0x00000020) && (spellInfo_1->SpellIconID == 291 || spellInfo_1->SpellIconID == 3028)) + if (((spellInfo_1->SpellFamilyFlags2 & 0x00000020) && (spellInfo_2->SpellIconID == 291 || spellInfo_2->SpellIconID == 3028)) || + ((spellInfo_2->SpellFamilyFlags2 & 0x00000020) && (spellInfo_1->SpellIconID == 291 || spellInfo_1->SpellIconID == 3028))) return false; // Beacon of Light and Light's Beacon @@ -2101,23 +2107,23 @@ bool SpellMgr::IsNoStackSpellDueToSpell(uint32 spellId_1, uint32 spellId_2) cons return false; // Combustion and Fire Protection Aura (multi-family check) - if( spellInfo_2->Id == 11129 && spellInfo_1->SpellIconID == 33 && spellInfo_1->SpellVisual[0] == 321 ) + if (spellInfo_2->Id == 11129 && spellInfo_1->SpellIconID == 33 && spellInfo_1->SpellVisual[0] == 321) return false; // *Sanctity Aura -> Unstable Currents and other (multi-family check) - if( spellInfo_1->SpellIconID==502 && spellInfo_2->SpellFamilyName == SPELLFAMILY_GENERIC && spellInfo_2->SpellIconID==502 && spellInfo_2->SpellVisual[0]==969 ) + if (spellInfo_1->SpellIconID==502 && spellInfo_2->SpellFamilyName == SPELLFAMILY_GENERIC && spellInfo_2->SpellIconID==502 && spellInfo_2->SpellVisual[0]==969) return false; // *Seal of Command and Band of Eternal Champion (multi-family check) - if( spellInfo_1->SpellIconID==561 && spellInfo_1->SpellVisual[0]==7992 && spellId_2 == 35081) + if (spellInfo_1->SpellIconID==561 && spellInfo_1->SpellVisual[0]==7992 && spellId_2 == 35081) return false; break; case SPELLFAMILY_SHAMAN: - if( spellInfo_2->SpellFamilyName == SPELLFAMILY_SHAMAN ) + if (spellInfo_2->SpellFamilyName == SPELLFAMILY_SHAMAN) { // Windfury weapon - if( spellInfo_1->SpellIconID==220 && spellInfo_2->SpellIconID==220 && - spellInfo_1->SpellFamilyFlags != spellInfo_2->SpellFamilyFlags ) + if (spellInfo_1->SpellIconID==220 && spellInfo_2->SpellIconID==220 && + spellInfo_1->SpellFamilyFlags != spellInfo_2->SpellFamilyFlags) return false; // Ghost Wolf @@ -2129,7 +2135,7 @@ bool SpellMgr::IsNoStackSpellDueToSpell(uint32 spellId_1, uint32 spellId_2) cons return false; } // Bloodlust and Bloodthirst (multi-family check) - if( spellInfo_1->Id == 2825 && spellInfo_2->SpellIconID == 38 && spellInfo_2->SpellVisual[0] == 0 ) + if (spellInfo_1->Id == 2825 && spellInfo_2->SpellIconID == 38 && spellInfo_2->SpellVisual[0] == 0) return false; break; case SPELLFAMILY_DEATHKNIGHT: @@ -2187,13 +2193,13 @@ bool SpellMgr::IsNoStackSpellDueToSpell(uint32 spellId_1, uint32 spellId_2) cons for (int i = 0; i < MAX_EFFECT_INDEX; ++i) { if (spellInfo_1->Effect[i] != spellInfo_2->Effect[i] || - spellInfo_1->EffectItemType[i] != spellInfo_2->EffectItemType[i] || - spellInfo_1->EffectMiscValue[i] != spellInfo_2->EffectMiscValue[i] || - spellInfo_1->EffectApplyAuraName[i] != spellInfo_2->EffectApplyAuraName[i]) + spellInfo_1->EffectItemType[i] != spellInfo_2->EffectItemType[i] || + spellInfo_1->EffectMiscValue[i] != spellInfo_2->EffectMiscValue[i] || + spellInfo_1->EffectApplyAuraName[i] != spellInfo_2->EffectApplyAuraName[i]) return false; // ignore dummy only spells - if(spellInfo_1->Effect[i] && spellInfo_1->Effect[i] != SPELL_EFFECT_DUMMY && spellInfo_1->EffectApplyAuraName[i] != SPELL_AURA_DUMMY) + if (spellInfo_1->Effect[i] && spellInfo_1->Effect[i] != SPELL_EFFECT_DUMMY && spellInfo_1->EffectApplyAuraName[i] != SPELL_AURA_DUMMY) dummy_only = false; } if (dummy_only) @@ -3505,27 +3511,27 @@ void SpellMgr::LoadSpellAreas() continue; } - if(abs(spellArea.auraSpell)==spellArea.spellId) + if(uint32(abs(spellArea.auraSpell))==spellArea.spellId) { - sLog.outErrorDb("Spell %u listed in `spell_area` have aura spell (%u) requirement for itself", spell,abs(spellArea.auraSpell)); + sLog.outErrorDb("Spell %u listed in `spell_area` have aura spell (%u) requirement for itself", spell, abs(spellArea.auraSpell)); continue; } // not allow autocast chains by auraSpell field (but allow use as alternative if not present) - if(spellArea.autocast && spellArea.auraSpell > 0) + if (spellArea.autocast && spellArea.auraSpell > 0) { bool chain = false; SpellAreaForAuraMapBounds saBound = GetSpellAreaForAuraMapBounds(spellArea.spellId); for(SpellAreaForAuraMap::const_iterator itr = saBound.first; itr != saBound.second; ++itr) { - if(itr->second->autocast && itr->second->auraSpell > 0) + if (itr->second->autocast && itr->second->auraSpell > 0) { chain = true; break; } } - if(chain) + if (chain) { sLog.outErrorDb("Spell %u listed in `spell_area` have aura spell (%u) requirement that itself autocast from aura", spell,spellArea.auraSpell); continue; @@ -3534,7 +3540,7 @@ void SpellMgr::LoadSpellAreas() SpellAreaMapBounds saBound2 = GetSpellAreaMapBounds(spellArea.auraSpell); for(SpellAreaMap::const_iterator itr2 = saBound2.first; itr2 != saBound2.second; ++itr2) { - if(itr2->second.autocast && itr2->second.auraSpell > 0) + if (itr2->second.autocast && itr2->second.auraSpell > 0) { chain = true; break; @@ -3807,7 +3813,7 @@ void SpellMgr::CheckUsedSpells(char const* table) } // TODO: for spellCategory better check need dbc loading - if (category < -1 || category >=0 && sSpellCategoryStore.find(category) == sSpellCategoryStore.end()) + if (category < -1 || (category >=0 && sSpellCategoryStore.find(category) == sSpellCategoryStore.end())) { sLog.outError("Table '%s' for spell %u have wrong SpellCategory value(%u), skipped.",table,spell,category); continue; @@ -3844,7 +3850,7 @@ void SpellMgr::CheckUsedSpells(char const* table) continue; } - if(family >= 0 && spellEntry->SpellFamilyName != family) + if (family >= 0 && spellEntry->SpellFamilyName != uint32(family)) { sLog.outError("Spell %u '%s' family(%u) <> %u but used in %s.",spell,name.c_str(),spellEntry->SpellFamilyName,family,code.c_str()); continue; @@ -3873,19 +3879,19 @@ void SpellMgr::CheckUsedSpells(char const* table) } } - if(spellIcon >= 0 && spellEntry->SpellIconID != spellIcon) + if (spellIcon >= 0 && spellEntry->SpellIconID != uint32(spellIcon)) { sLog.outError("Spell %u '%s' icon(%u) <> %u but used in %s.",spell,name.c_str(),spellEntry->SpellIconID,spellIcon,code.c_str()); continue; } - if(spellVisual >= 0 && spellEntry->SpellVisual[0] != spellVisual) + if (spellVisual >= 0 && spellEntry->SpellVisual[0] != uint32(spellVisual)) { sLog.outError("Spell %u '%s' visual(%u) <> %u but used in %s.",spell,name.c_str(),spellEntry->SpellVisual[0],spellVisual,code.c_str()); continue; } - if(category >= 0 && spellEntry->Category != category) + if (category >= 0 && spellEntry->Category != uint32(category)) { sLog.outError("Spell %u '%s' category(%u) <> %u but used in %s.",spell,name.c_str(),spellEntry->Category,category,code.c_str()); continue; @@ -3893,13 +3899,13 @@ void SpellMgr::CheckUsedSpells(char const* table) if (effectIdx >= EFFECT_INDEX_0) { - if(effectType >= 0 && spellEntry->Effect[effectIdx] != effectType) + if (effectType >= 0 && spellEntry->Effect[effectIdx] != uint32(effectType)) { sLog.outError("Spell %u '%s' effect%d <> %u but used in %s.",spell,name.c_str(),effectIdx+1,effectType,code.c_str()); continue; } - if(auraType >= 0 && spellEntry->EffectApplyAuraName[effectIdx] != auraType) + if (auraType >= 0 && spellEntry->EffectApplyAuraName[effectIdx] != uint32(auraType)) { sLog.outError("Spell %u '%s' aura%d <> %u but used in %s.",spell,name.c_str(),effectIdx+1,auraType,code.c_str()); continue; @@ -3908,13 +3914,13 @@ void SpellMgr::CheckUsedSpells(char const* table) } else { - if(effectType >= 0 && !IsSpellHaveEffect(spellEntry,SpellEffects(effectType))) + if (effectType >= 0 && !IsSpellHaveEffect(spellEntry,SpellEffects(effectType))) { sLog.outError("Spell %u '%s' not have effect %u but used in %s.",spell,name.c_str(),effectType,code.c_str()); continue; } - if(auraType >= 0 && !IsSpellHaveAura(spellEntry,AuraType(auraType))) + if (auraType >= 0 && !IsSpellHaveAura(spellEntry, AuraType(auraType))) { sLog.outError("Spell %u '%s' not have aura %u but used in %s.",spell,name.c_str(),auraType,code.c_str()); continue; @@ -3929,13 +3935,13 @@ void SpellMgr::CheckUsedSpells(char const* table) for(uint32 spellId = 1; spellId < sSpellStore.GetNumRows(); ++spellId) { SpellEntry const* spellEntry = sSpellStore.LookupEntry(spellId); - if(!spellEntry) + if (!spellEntry) continue; - if(family >=0 && spellEntry->SpellFamilyName != family) + if (family >=0 && spellEntry->SpellFamilyName != uint32(family)) continue; - if(familyMaskA != UI64LIT(0xFFFFFFFFFFFFFFFF) || familyMaskB != 0xFFFFFFFF) + if (familyMaskA != UI64LIT(0xFFFFFFFFFFFFFFFF) || familyMaskB != 0xFFFFFFFF) { if(familyMaskA == UI64LIT(0x0000000000000000) && familyMaskB == 0x00000000) { @@ -3944,34 +3950,34 @@ void SpellMgr::CheckUsedSpells(char const* table) } else { - if((spellEntry->SpellFamilyFlags & familyMaskA)==0 && (spellEntry->SpellFamilyFlags2 & familyMaskB)==0) + if ((spellEntry->SpellFamilyFlags & familyMaskA)==0 && (spellEntry->SpellFamilyFlags2 & familyMaskB)==0) continue; } } - if(spellIcon >= 0 && spellEntry->SpellIconID != spellIcon) + if (spellIcon >= 0 && spellEntry->SpellIconID != uint32(spellIcon)) continue; - if(spellVisual >= 0 && spellEntry->SpellVisual[0] != spellVisual) + if (spellVisual >= 0 && spellEntry->SpellVisual[0] != uint32(spellVisual)) continue; - if(category >= 0 && spellEntry->Category != category) + if (category >= 0 && spellEntry->Category != uint32(category)) continue; - if(effectIdx >= 0) + if (effectIdx >= 0) { - if(effectType >=0 && spellEntry->Effect[effectIdx] != effectType) + if (effectType >=0 && spellEntry->Effect[effectIdx] != uint32(effectType)) continue; - if(auraType >=0 && spellEntry->EffectApplyAuraName[effectIdx] != auraType) + if (auraType >=0 && spellEntry->EffectApplyAuraName[effectIdx] !=uint32(auraType)) continue; } else { - if(effectType >=0 && !IsSpellHaveEffect(spellEntry,SpellEffects(effectType))) + if (effectType >=0 && !IsSpellHaveEffect(spellEntry,SpellEffects(effectType))) continue; - if(auraType >=0 && !IsSpellHaveAura(spellEntry,AuraType(auraType))) + if (auraType >=0 && !IsSpellHaveAura(spellEntry,AuraType(auraType))) continue; } @@ -3979,9 +3985,9 @@ void SpellMgr::CheckUsedSpells(char const* table) break; } - if(!found) + if (!found) { - if(effectIdx >= 0) + if (effectIdx >= 0) sLog.outError("Spells '%s' not found for family %i (" I64FMT "," I32FMT ") icon(%i) visual(%i) category(%i) effect%d(%i) aura%d(%i) but used in %s", name.c_str(),family,familyMaskA,familyMaskB,spellIcon,spellVisual,category,effectIdx+1,effectType,effectIdx+1,auraType,code.c_str()); else diff --git a/src/game/TradeHandler.cpp b/src/game/TradeHandler.cpp index 1f885b672..20371880a 100644 --- a/src/game/TradeHandler.cpp +++ b/src/game/TradeHandler.cpp @@ -326,7 +326,7 @@ void WorldSession::HandleAcceptTradeOpcode(WorldPacket& recvPacket) Item* castItem = my_trade->GetSpellCastItem(); if (!spellEntry || !his_trade->GetItem(TRADE_SLOT_NONTRADED) || - my_trade->HasSpellCastItem() && !castItem) + (my_trade->HasSpellCastItem() && !castItem)) { clearAcceptTradeMode(my_trade, his_trade); clearAcceptTradeMode(myItems, hisItems); @@ -361,7 +361,7 @@ void WorldSession::HandleAcceptTradeOpcode(WorldPacket& recvPacket) Item* castItem = his_trade->GetSpellCastItem(); if (!spellEntry || !my_trade->GetItem(TRADE_SLOT_NONTRADED) || - his_trade->HasSpellCastItem() && !castItem) + (his_trade->HasSpellCastItem() && !castItem)) { delete my_spell; his_trade->SetSpell(0); diff --git a/src/game/Unit.cpp b/src/game/Unit.cpp index cf5b7a604..ad97f4bbf 100644 --- a/src/game/Unit.cpp +++ b/src/game/Unit.cpp @@ -492,9 +492,9 @@ void Unit::RemoveSpellbyDamageTaken(AuraType auraType, uint32 damage) void Unit::DealDamageMods(Unit *pVictim, uint32 &damage, uint32* absorb) { - if (!pVictim->isAlive() || pVictim->IsTaxiFlying() || pVictim->GetTypeId() == TYPEID_UNIT && ((Creature*)pVictim)->IsInEvadeMode()) + if (!pVictim->isAlive() || pVictim->IsTaxiFlying() || (pVictim->GetTypeId() == TYPEID_UNIT && ((Creature*)pVictim)->IsInEvadeMode())) { - if(absorb) + if (absorb) *absorb += damage; damage = 0; return; @@ -1332,7 +1332,7 @@ void Unit::DealSpellDamage(SpellNonMeleeDamage *damageInfo, bool durabilityLoss) if(!this || !pVictim) return; - if (!pVictim->isAlive() || pVictim->IsTaxiFlying() || pVictim->GetTypeId() == TYPEID_UNIT && ((Creature*)pVictim)->IsInEvadeMode()) + if (!pVictim->isAlive() || pVictim->IsTaxiFlying() || (pVictim->GetTypeId() == TYPEID_UNIT && ((Creature*)pVictim)->IsInEvadeMode())) return; SpellEntry const *spellProto = sSpellStore.LookupEntry(damageInfo->SpellID); @@ -1639,7 +1639,7 @@ void Unit::DealMeleeDamage(CalcDamageInfo *damageInfo, bool durabilityLoss) if(!this || !pVictim) return; - if (!pVictim->isAlive() || pVictim->IsTaxiFlying() || pVictim->GetTypeId() == TYPEID_UNIT && ((Creature*)pVictim)->IsInEvadeMode()) + if (!pVictim->isAlive() || pVictim->IsTaxiFlying() || (pVictim->GetTypeId() == TYPEID_UNIT && ((Creature*)pVictim)->IsInEvadeMode())) return; //You don't lose health from damage taken from another player while in a sanctuary @@ -2380,7 +2380,7 @@ void Unit::CalculateAbsorbResistBlock(Unit *pCaster, SpellNonMeleeDamage *damage if (blocked) { damageInfo->blocked = GetShieldBlockValue(); - if (damageInfo->damage < (int32)damageInfo->blocked) + if (damageInfo->damage < damageInfo->blocked) damageInfo->blocked = damageInfo->damage; damageInfo->damage-=damageInfo->blocked; } @@ -2679,8 +2679,8 @@ MeleeHitOutcome Unit::RollMeleeOutcomeAgainst (const Unit *pVictim, WeaponAttack // mobs can score crushing blows if they're 4 or more levels above victim if (GetLevelForTarget(pVictim) >= pVictim->GetLevelForTarget(this) + 4 && // can be from by creature (if can) or from controlled player that considered as creature - (GetTypeId()!=TYPEID_PLAYER && !((Creature*)this)->IsPet() && - !(((Creature*)this)->GetCreatureInfo()->flags_extra & CREATURE_FLAG_EXTRA_NO_CRUSH) || + ((GetTypeId()!=TYPEID_PLAYER && !((Creature*)this)->IsPet() && + !(((Creature*)this)->GetCreatureInfo()->flags_extra & CREATURE_FLAG_EXTRA_NO_CRUSH)) || GetTypeId()==TYPEID_PLAYER && !GetCharmerOrOwnerGuid().IsEmpty())) { // when their weapon skill is 15 or more above victim's defense skill @@ -3926,7 +3926,7 @@ bool Unit::AddSpellAuraHolder(SpellAuraHolder *holder) } // passive and persistent auras can stack with themselves any number of times - if (!holder->IsPassive() && !holder->IsPersistent() || holder->IsAreaAura()) + if ((!holder->IsPassive() && !holder->IsPersistent()) || holder->IsAreaAura()) { SpellAuraHolderBounds spair = GetSpellAuraHolderBounds(aurSpellInfo->Id); @@ -4181,7 +4181,7 @@ bool Unit::RemoveNoStackAurasDueToAuraHolder(SpellAuraHolder *holder) // single allowed spell specific from same caster or from any caster at target bool is_spellSpecPerTargetPerCaster = IsSingleFromSpellSpecificPerTargetPerCaster(spellId_spec,i_spellId_spec); bool is_spellSpecPerTarget = IsSingleFromSpellSpecificPerTarget(spellId_spec,i_spellId_spec); - if( is_spellSpecPerTarget || is_spellSpecPerTargetPerCaster && holder->GetCasterGUID() == (*i).second->GetCasterGUID() ) + if (is_spellSpecPerTarget || (is_spellSpecPerTargetPerCaster && holder->GetCasterGUID() == (*i).second->GetCasterGUID())) { // cannot remove higher rank if (sSpellMgr.IsRankSpellDueToSpell(spellProto, i_spellId)) @@ -5741,7 +5741,7 @@ void Unit::ModifyAuraState(AuraState flag, bool apply) if(itr->second.state == PLAYERSPELL_REMOVED) continue; SpellEntry const *spellInfo = sSpellStore.LookupEntry(itr->first); if (!spellInfo || !IsPassiveSpell(spellInfo)) continue; - if (spellInfo->CasterAuraState == flag) + if (AuraState(spellInfo->CasterAuraState) == flag) CastSpell(this, itr->first, true, NULL); } } @@ -5759,7 +5759,7 @@ void Unit::ModifyAuraState(AuraState flag, bool apply) for (Unit::SpellAuraHolderMap::iterator itr = tAuras.begin(); itr != tAuras.end();) { SpellEntry const* spellProto = (*itr).second->GetSpellProto(); - if (spellProto->CasterAuraState == flag) + if (AuraState(spellProto->CasterAuraState) == flag) { RemoveSpellAuraHolder(itr->second); itr = tAuras.begin(); @@ -7107,10 +7107,10 @@ uint32 Unit::MeleeDamageBonusDone(Unit *pVictim, uint32 pdamage,WeaponAttackType AuraList const& mModDamageDone = GetAurasByType(SPELL_AURA_MOD_DAMAGE_DONE); for(AuraList::const_iterator i = mModDamageDone.begin(); i != mModDamageDone.end(); ++i) { - if ((*i)->GetModifier()->m_miscvalue & schoolMask && // schoolmask has to fit with the intrinsic spell school + if (((*i)->GetModifier()->m_miscvalue & schoolMask && // schoolmask has to fit with the intrinsic spell school (*i)->GetModifier()->m_miscvalue & GetMeleeDamageSchoolMask() && // AND schoolmask has to fit with weapon damage school (essential for non-physical spells) - ((*i)->GetSpellProto()->EquippedItemClass == -1 || // general, weapon independent - pWeapon && pWeapon->IsFitToSpellRequirements((*i)->GetSpellProto()))) // OR used weapon fits aura requirements + ((*i)->GetSpellProto()->EquippedItemClass == -1) || // general, weapon independent + (pWeapon && pWeapon->IsFitToSpellRequirements((*i)->GetSpellProto())))) // OR used weapon fits aura requirements { DoneFlat += (*i)->GetModifier()->m_amount; } @@ -7146,10 +7146,10 @@ uint32 Unit::MeleeDamageBonusDone(Unit *pVictim, uint32 pdamage,WeaponAttackType AuraList const& mModDamagePercentDone = GetAurasByType(SPELL_AURA_MOD_DAMAGE_PERCENT_DONE); for(AuraList::const_iterator i = mModDamagePercentDone.begin(); i != mModDamagePercentDone.end(); ++i) { - if ((*i)->GetModifier()->m_miscvalue & schoolMask && // schoolmask has to fit with the intrinsic spell school + if (((*i)->GetModifier()->m_miscvalue & schoolMask && // schoolmask has to fit with the intrinsic spell school (*i)->GetModifier()->m_miscvalue & GetMeleeDamageSchoolMask() && // AND schoolmask has to fit with weapon damage school (essential for non-physical spells) - ((*i)->GetSpellProto()->EquippedItemClass == -1 || // general, weapon independent - pWeapon && pWeapon->IsFitToSpellRequirements((*i)->GetSpellProto()))) // OR used weapon fits aura requirements + ((*i)->GetSpellProto()->EquippedItemClass == -1) || // general, weapon independent + (pWeapon && pWeapon->IsFitToSpellRequirements((*i)->GetSpellProto())))) // OR used weapon fits aura requirements { DonePercent *= ((*i)->GetModifier()->m_amount+100.0f) / 100.0f; } @@ -7280,8 +7280,8 @@ uint32 Unit::MeleeDamageBonusDone(Unit *pVictim, uint32 pdamage,WeaponAttackType { // search for glyph dummy aura if (Aura *aur = GetDummyAura(56826)) - // check for Serpent Sting - if (Aura *serpentSting = pVictim->GetAura(SPELL_AURA_PERIODIC_DAMAGE, SPELLFAMILY_HUNTER, UI64LIT(0x0000000000004000))) + // check for Serpent Sting at target + if (pVictim->GetAura(SPELL_AURA_PERIODIC_DAMAGE, SPELLFAMILY_HUNTER, UI64LIT(0x0000000000004000))) DonePercent *= (aur->GetModifier()->m_amount+100.0f) / 100.0f; } } @@ -8000,7 +8000,7 @@ bool Unit::canDetectInvisibilityOf(Unit const* u) const { if(uint32 mask = (m_detectInvisibilityMask & u->m_invisibilityMask)) { - for(uint32 i = 0; i < 10; ++i) + for(int32 i = 0; i < 10; ++i) { if(((1 << i) & mask)==0) continue; @@ -8009,22 +8009,20 @@ bool Unit::canDetectInvisibilityOf(Unit const* u) const int32 invLevel = 0; Unit::AuraList const& iAuras = u->GetAurasByType(SPELL_AURA_MOD_INVISIBILITY); for(Unit::AuraList::const_iterator itr = iAuras.begin(); itr != iAuras.end(); ++itr) - if(((*itr)->GetModifier()->m_miscvalue)==i && invLevel < (*itr)->GetModifier()->m_amount) + if ((*itr)->GetModifier()->m_miscvalue==i && invLevel < (*itr)->GetModifier()->m_amount) invLevel = (*itr)->GetModifier()->m_amount; // find invisibility detect level int32 detectLevel = 0; Unit::AuraList const& dAuras = GetAurasByType(SPELL_AURA_MOD_INVISIBILITY_DETECTION); for(Unit::AuraList::const_iterator itr = dAuras.begin(); itr != dAuras.end(); ++itr) - if(((*itr)->GetModifier()->m_miscvalue)==i && detectLevel < (*itr)->GetModifier()->m_amount) + if ((*itr)->GetModifier()->m_miscvalue==i && detectLevel < (*itr)->GetModifier()->m_amount) detectLevel = (*itr)->GetModifier()->m_amount; - if(i==6 && GetTypeId()==TYPEID_PLAYER) // special drunk detection case - { + if (i==6 && GetTypeId()==TYPEID_PLAYER) // special drunk detection case detectLevel = ((Player*)this)->GetDrunkValue(); - } - if(invLevel <= detectLevel) + if (invLevel <= detectLevel) return true; } } @@ -8081,6 +8079,8 @@ void Unit::UpdateSpeed(UnitMoveType mtype, bool forced, float ratio) } } break; + default: + break; } int32 main_speed_mod = 0; @@ -9698,6 +9698,8 @@ void Unit::ProcDamageAndSpellFor( bool isVictim, Unit * pTarget, uint32 procFlag case SPELL_AURA_PROC_FAILED: procSuccess = false; break; + case SPELL_AURA_PROC_OK: + break; } anyAuraProc = true; @@ -10254,18 +10256,20 @@ void Unit::SetContestedPvP(Player *attackedPlayer) { Player* player = GetCharmerOrOwnerPlayerOrPlayerItself(); - if(!player || attackedPlayer && (attackedPlayer == player || player->duel && player->duel->opponent == attackedPlayer)) + if (!player || (attackedPlayer && (attackedPlayer == player || (player->duel && player->duel->opponent == attackedPlayer)))) return; player->SetContestedPvPTimer(30000); - if(!player->hasUnitState(UNIT_STAT_ATTACK_PLAYER)) + + if (!player->hasUnitState(UNIT_STAT_ATTACK_PLAYER)) { player->addUnitState(UNIT_STAT_ATTACK_PLAYER); player->SetFlag(PLAYER_FLAGS, PLAYER_FLAGS_CONTESTED_PVP); // call MoveInLineOfSight for nearby contested guards SetVisibility(GetVisibility()); } - if(!hasUnitState(UNIT_STAT_ATTACK_PLAYER)) + + if (!hasUnitState(UNIT_STAT_ATTACK_PLAYER)) { addUnitState(UNIT_STAT_ATTACK_PLAYER); // call MoveInLineOfSight for nearby contested guards diff --git a/src/game/UnitAuraProcHandler.cpp b/src/game/UnitAuraProcHandler.cpp index 43f668e53..66066d54c 100644 --- a/src/game/UnitAuraProcHandler.cpp +++ b/src/game/UnitAuraProcHandler.cpp @@ -479,18 +479,18 @@ SpellAuraProcResult Unit::HandleHasteAuraProc(Unit *pVictim, uint32 damage, Aura } // default case - if(!target || target!=this && !target->isAlive()) + if (!target || (target != this && !target->isAlive())) return SPELL_AURA_PROC_FAILED; - if( cooldown && GetTypeId()==TYPEID_PLAYER && ((Player*)this)->HasSpellCooldown(triggered_spell_id)) + if (cooldown && GetTypeId()==TYPEID_PLAYER && ((Player*)this)->HasSpellCooldown(triggered_spell_id)) return SPELL_AURA_PROC_FAILED; - if(basepoints0) + if (basepoints0) CastCustomSpell(target,triggered_spell_id,&basepoints0,NULL,NULL,true,castItem,triggeredByAura); else CastSpell(target,triggered_spell_id,true,castItem,triggeredByAura); - if( cooldown && GetTypeId()==TYPEID_PLAYER ) + if (cooldown && GetTypeId()==TYPEID_PLAYER) ((Player*)this)->AddSpellCooldown(triggered_spell_id,0,time(NULL) + cooldown); return SPELL_AURA_PROC_OK; @@ -520,7 +520,7 @@ SpellAuraProcResult Unit::HandleSpellCritChanceAuraProc(Unit *pVictim, uint32 /* case 54646: { Unit* caster = triggeredByAura->GetCaster(); - if(!caster) + if (!caster) return SPELL_AURA_PROC_FAILED; triggered_spell_id = 54648; @@ -532,7 +532,7 @@ SpellAuraProcResult Unit::HandleSpellCritChanceAuraProc(Unit *pVictim, uint32 /* } // processed charge only counting case - if(!triggered_spell_id) + if (!triggered_spell_id) return SPELL_AURA_PROC_OK; SpellEntry const* triggerEntry = sSpellStore.LookupEntry(triggered_spell_id); @@ -544,18 +544,18 @@ SpellAuraProcResult Unit::HandleSpellCritChanceAuraProc(Unit *pVictim, uint32 /* } // default case - if(!target || target!=this && !target->isAlive()) + if (!target || (target != this && !target->isAlive())) return SPELL_AURA_PROC_FAILED; - if( cooldown && GetTypeId()==TYPEID_PLAYER && ((Player*)this)->HasSpellCooldown(triggered_spell_id)) + if (cooldown && GetTypeId()==TYPEID_PLAYER && ((Player*)this)->HasSpellCooldown(triggered_spell_id)) return SPELL_AURA_PROC_FAILED; - if(basepoints0) + if (basepoints0) CastCustomSpell(target,triggered_spell_id,&basepoints0,NULL,NULL,true,castItem,triggeredByAura); else CastSpell(target,triggered_spell_id,true,castItem,triggeredByAura); - if( cooldown && GetTypeId()==TYPEID_PLAYER ) + if (cooldown && GetTypeId()==TYPEID_PLAYER) ((Player*)this)->AddSpellCooldown(triggered_spell_id,0,time(NULL) + cooldown); return SPELL_AURA_PROC_OK; @@ -2646,22 +2646,22 @@ SpellAuraProcResult Unit::HandleDummyAuraProc(Unit *pVictim, uint32 damage, Aura } // processed charge only counting case - if(!triggered_spell_id) + if (!triggered_spell_id) return SPELL_AURA_PROC_OK; SpellEntry const* triggerEntry = sSpellStore.LookupEntry(triggered_spell_id); - if(!triggerEntry) + if (!triggerEntry) { sLog.outError("Unit::HandleDummyAuraProc: Spell %u have nonexistent triggered spell %u",dummySpell->Id,triggered_spell_id); return SPELL_AURA_PROC_FAILED; } // default case - if(!target || target!=this && !target->isAlive()) + if (!target || (target != this && !target->isAlive())) return SPELL_AURA_PROC_FAILED; - if( cooldown && GetTypeId()==TYPEID_PLAYER && ((Player*)this)->HasSpellCooldown(triggered_spell_id)) + if (cooldown && GetTypeId()==TYPEID_PLAYER && ((Player*)this)->HasSpellCooldown(triggered_spell_id)) return SPELL_AURA_PROC_FAILED; if (basepoints[EFFECT_INDEX_0] || basepoints[EFFECT_INDEX_1] || basepoints[EFFECT_INDEX_2]) @@ -3457,7 +3457,7 @@ SpellAuraProcResult Unit::HandleProcTriggerSpellAuraProc(Unit *pVictim, uint32 d } } - if( cooldown && GetTypeId()==TYPEID_PLAYER && ((Player*)this)->HasSpellCooldown(trigger_spell_id)) + if (cooldown && GetTypeId()==TYPEID_PLAYER && ((Player*)this)->HasSpellCooldown(trigger_spell_id)) return SPELL_AURA_PROC_FAILED; // try detect target manually if not set @@ -3465,7 +3465,7 @@ SpellAuraProcResult Unit::HandleProcTriggerSpellAuraProc(Unit *pVictim, uint32 d target = !(procFlags & PROC_FLAG_SUCCESSFUL_POSITIVE_SPELL) && IsPositiveSpell(trigger_spell_id) ? this : pVictim; // default case - if (!target || target!=this && !target->isAlive()) + if (!target || (target != this && !target->isAlive())) return SPELL_AURA_PROC_FAILED; if (basepoints[EFFECT_INDEX_0] || basepoints[EFFECT_INDEX_1] || basepoints[EFFECT_INDEX_2]) @@ -3477,7 +3477,7 @@ SpellAuraProcResult Unit::HandleProcTriggerSpellAuraProc(Unit *pVictim, uint32 d else CastSpell(target,trigger_spell_id,true,castItem,triggeredByAura); - if( cooldown && GetTypeId()==TYPEID_PLAYER ) + if (cooldown && GetTypeId()==TYPEID_PLAYER) ((Player*)this)->AddSpellCooldown(trigger_spell_id,0,time(NULL) + cooldown); return SPELL_AURA_PROC_OK; @@ -3684,7 +3684,8 @@ SpellAuraProcResult Unit::HandleModPowerCostSchoolAuraProc(Unit* /*pVictim*/, ui SpellAuraProcResult Unit::HandleMechanicImmuneResistanceAuraProc(Unit* /*pVictim*/, uint32 /*damage*/, Aura* triggeredByAura, SpellEntry const* procSpell, uint32 /*procFlag*/, uint32 /*procEx*/, uint32 /*cooldown*/) { // Compare mechanic - return !(procSpell==NULL || procSpell->Mechanic != triggeredByAura->GetModifier()->m_miscvalue) ? SPELL_AURA_PROC_OK : SPELL_AURA_PROC_FAILED; + return !(procSpell==NULL || int32(procSpell->Mechanic) != triggeredByAura->GetModifier()->m_miscvalue) + ? SPELL_AURA_PROC_OK : SPELL_AURA_PROC_FAILED; } SpellAuraProcResult Unit::HandleModDamageFromCasterAuraProc(Unit* pVictim, uint32 /*damage*/, Aura* triggeredByAura, SpellEntry const* /*procSpell*/, uint32 /*procFlag*/, uint32 /*procEx*/, uint32 /*cooldown*/) diff --git a/src/game/World.cpp b/src/game/World.cpp index 416c1009b..977378b56 100644 --- a/src/game/World.cpp +++ b/src/game/World.cpp @@ -883,15 +883,15 @@ void World::SetInitialWorldSettings() LoadConfigSettings(); ///- Check the existence of the map files for all races' startup areas. - if( !MapManager::ExistMapAndVMap(0,-6240.32f, 331.033f) - ||!MapManager::ExistMapAndVMap(0,-8949.95f,-132.493f) - ||!MapManager::ExistMapAndVMap(0,-8949.95f,-132.493f) - ||!MapManager::ExistMapAndVMap(1,-618.518f,-4251.67f) - ||!MapManager::ExistMapAndVMap(0, 1676.35f, 1677.45f) - ||!MapManager::ExistMapAndVMap(1, 10311.3f, 832.463f) - ||!MapManager::ExistMapAndVMap(1,-2917.58f,-257.98f) - ||m_configUint32Values[CONFIG_UINT32_EXPANSION] && ( - !MapManager::ExistMapAndVMap(530,10349.6f,-6357.29f) || !MapManager::ExistMapAndVMap(530,-3961.64f,-13931.2f) ) ) + if (!MapManager::ExistMapAndVMap(0,-6240.32f, 331.033f) || + !MapManager::ExistMapAndVMap(0,-8949.95f,-132.493f) || + !MapManager::ExistMapAndVMap(0,-8949.95f,-132.493f) || + !MapManager::ExistMapAndVMap(1,-618.518f,-4251.67f) || + !MapManager::ExistMapAndVMap(0, 1676.35f, 1677.45f) || + !MapManager::ExistMapAndVMap(1, 10311.3f, 832.463f) || + !MapManager::ExistMapAndVMap(1,-2917.58f,-257.98f) || + (m_configUint32Values[CONFIG_UINT32_EXPANSION] && + (!MapManager::ExistMapAndVMap(530,10349.6f,-6357.29f) || !MapManager::ExistMapAndVMap(530,-3961.64f,-13931.2f)))) { sLog.outError("Correct *.map files not found in path '%smaps' or *.vmtree/*.vmtile files in '%svmaps'. Please place *.map and vmap files in appropriate directories or correct the DataDir value in the mangosd.conf file.",m_dataPath.c_str(),m_dataPath.c_str()); Log::WaitBeforeContinueIfNeed(); @@ -1338,7 +1338,7 @@ void World::DetectDBCLang() { uint32 m_lang_confid = sConfig.GetIntDefault("DBC.Locale", 255); - if(m_lang_confid != 255 && m_lang_confid >= MAX_LOCALE) + if (m_lang_confid != 255 && m_lang_confid >= MAX_LOCALE) { sLog.outError("Incorrect DBC.Locale! Must be >= 0 and < %d (set to 0)",MAX_LOCALE); m_lang_confid = LOCALE_enUS; @@ -1348,10 +1348,10 @@ void World::DetectDBCLang() std::string availableLocalsStr; - int default_locale = MAX_LOCALE; + uint32 default_locale = MAX_LOCALE; for (int i = MAX_LOCALE-1; i >= 0; --i) { - if ( strlen(race->name[i]) > 0) // check by race names + if (strlen(race->name[i]) > 0) // check by race names { default_locale = i; m_availableDbcLocaleMask |= (1 << i); @@ -1360,13 +1360,13 @@ void World::DetectDBCLang() } } - if( default_locale != m_lang_confid && m_lang_confid < MAX_LOCALE && + if (default_locale != m_lang_confid && m_lang_confid < MAX_LOCALE && (m_availableDbcLocaleMask & (1 << m_lang_confid)) ) { default_locale = m_lang_confid; } - if(default_locale >= MAX_LOCALE) + if (default_locale >= MAX_LOCALE) { sLog.outError("Unable to determine your DBC Locale! (corrupt DBC?)"); Log::WaitBeforeContinueIfNeed(); diff --git a/src/game/WorldSession.cpp b/src/game/WorldSession.cpp index f5fa93759..1e7c00ccd 100644 --- a/src/game/WorldSession.cpp +++ b/src/game/WorldSession.cpp @@ -705,6 +705,8 @@ void WorldSession::SaveTutorialsData() CharacterDatabase.PExecute("INSERT INTO character_tutorial (account,tut0,tut1,tut2,tut3,tut4,tut5,tut6,tut7) VALUES ('%u', '%u', '%u', '%u', '%u', '%u', '%u', '%u', '%u')", GetAccountId(), m_Tutorials[0], m_Tutorials[1], m_Tutorials[2], m_Tutorials[3], m_Tutorials[4], m_Tutorials[5], m_Tutorials[6], m_Tutorials[7]); break; + case TUTORIALDATA_UNCHANGED: + break; } m_tutorialState = TUTORIALDATA_UNCHANGED; diff --git a/src/game/WorldSocket.cpp b/src/game/WorldSocket.cpp index f44f1dc85..57dea422a 100644 --- a/src/game/WorldSocket.cpp +++ b/src/game/WorldSocket.cpp @@ -612,7 +612,7 @@ int WorldSocket::handle_input_missing_data (void) } } - return n == recv_size ? 1 : 2; + return size_t(n) == recv_size ? 1 : 2; } int WorldSocket::cancel_wakeup_output (GuardType& g) diff --git a/src/shared/Database/Database.cpp b/src/shared/Database/Database.cpp index a0d9cc8b8..e414865bd 100644 --- a/src/shared/Database/Database.cpp +++ b/src/shared/Database/Database.cpp @@ -237,11 +237,11 @@ bool Database::CheckRequiredField( char const* table_name, char const* required_ if(!reqName.empty()) { sLog.outErrorDb("The table `%s` in your [%s] database indicates that this database is out of date!",table_name,db_name); - sLog.outErrorDb(""); + sLog.outErrorDb(); sLog.outErrorDb(" [A] You have: --> `%s.sql`",cur_sql_update_name.c_str()); - sLog.outErrorDb(""); + sLog.outErrorDb(); sLog.outErrorDb(" [B] You need: --> `%s.sql`",req_sql_update_name); - sLog.outErrorDb(""); + sLog.outErrorDb(); sLog.outErrorDb("You must apply all updates after [A] to [B] to use mangos with this database."); sLog.outErrorDb("These updates are included in the sql/updates folder."); sLog.outErrorDb("Please read the included [README] in sql/updates for instructions on updating."); @@ -250,10 +250,10 @@ bool Database::CheckRequiredField( char const* table_name, char const* required_ { sLog.outErrorDb("The table `%s` in your [%s] database is missing its version info.",table_name,db_name); sLog.outErrorDb("MaNGOS cannot find the version info needed to check that the db is up to date.",table_name,db_name); - sLog.outErrorDb(""); + sLog.outErrorDb(); sLog.outErrorDb("This revision of MaNGOS requires a database updated to:"); sLog.outErrorDb("`%s.sql`",req_sql_update_name); - sLog.outErrorDb(""); + sLog.outErrorDb(); if(!strcmp(db_name, "WORLD")) sLog.outErrorDb("Post this error to your database provider forum or find a solution there."); @@ -265,10 +265,10 @@ bool Database::CheckRequiredField( char const* table_name, char const* required_ { sLog.outErrorDb("The table `%s` in your [%s] database is missing or corrupt.",table_name,db_name); sLog.outErrorDb("MaNGOS cannot find the version info needed to check that the db is up to date.",table_name,db_name); - sLog.outErrorDb(""); + sLog.outErrorDb(); sLog.outErrorDb("This revision of mangos requires a database updated to:"); sLog.outErrorDb("`%s.sql`",req_sql_update_name); - sLog.outErrorDb(""); + sLog.outErrorDb(); if(!strcmp(db_name, "WORLD")) sLog.outErrorDb("Post this error to your database provider forum or find a solution there."); diff --git a/src/shared/Log.cpp b/src/shared/Log.cpp index c64199e4c..925e9ba90 100644 --- a/src/shared/Log.cpp +++ b/src/shared/Log.cpp @@ -460,6 +460,30 @@ void Log::outError( const char * err, ... ) fflush(stderr); } +void Log::outErrorDb() +{ + if (m_includeTime) + outTime(); + + fprintf( stderr, "\n" ); + + if (logfile) + { + outTimestamp(logfile); + fprintf(logfile, "ERROR:\n" ); + fflush(logfile); + } + + if (dberLogfile) + { + outTimestamp(dberLogfile); + fprintf(dberLogfile, "\n" ); + fflush(dberLogfile); + } + + fflush(stderr); +} + void Log::outErrorDb( const char * err, ... ) { if (!err) diff --git a/src/shared/Log.h b/src/shared/Log.h index 1e9eb435f..0aaad2a77 100644 --- a/src/shared/Log.h +++ b/src/shared/Log.h @@ -135,6 +135,7 @@ class Log : public MaNGOS::Singleton