diff --git a/src/common/Collision/Models/WorldModel.cpp b/src/common/Collision/Models/WorldModel.cpp index e8e1fb915..e0ff79271 100644 --- a/src/common/Collision/Models/WorldModel.cpp +++ b/src/common/Collision/Models/WorldModel.cpp @@ -115,8 +115,8 @@ namespace VMAP iTilesY = other.iTilesY; iCorner = other.iCorner; iType = other.iType; - delete iHeight; - delete iFlags; + delete[] iHeight; + delete[] iFlags; if (other.iHeight) { iHeight = new float[(iTilesX+1)*(iTilesY+1)]; diff --git a/src/common/Configuration/Config.cpp b/src/common/Configuration/Config.cpp index 2b1ea059f..050a0e730 100644 --- a/src/common/Configuration/Config.cpp +++ b/src/common/Configuration/Config.cpp @@ -171,7 +171,7 @@ std::list ConfigMgr::GetKeysByString(std::string const& name) { std::string temp = key_name.c_str(); - if (!temp.find(name)) + if (temp.find(name) != std::string::npos) keys.push_back(temp); } } diff --git a/src/server/game/Calendar/CalendarMgr.cpp b/src/server/game/Calendar/CalendarMgr.cpp index c449346b3..5703ff96b 100644 --- a/src/server/game/Calendar/CalendarMgr.cpp +++ b/src/server/game/Calendar/CalendarMgr.cpp @@ -661,6 +661,6 @@ void CalendarMgr::SendPacketToAllEventRelatives(WorldPacket packet, CalendarEven CalendarInviteStore invites = _invites[calendarEvent.GetEventId()]; for (CalendarInviteStore::iterator itr = invites.begin(); itr != invites.end(); ++itr) if (Player* player = ObjectAccessor::FindPlayerInOrOutOfWorld((*itr)->GetInviteeGUID())) - if (!calendarEvent.IsGuildEvent() || (calendarEvent.IsGuildEvent() && player->GetGuildId() != calendarEvent.GetGuildId())) + if (!calendarEvent.IsGuildEvent() || player->GetGuildId() != calendarEvent.GetGuildId()) player->SendDirectMessage(&packet); } diff --git a/src/server/game/Chat/Channels/Channel.cpp b/src/server/game/Chat/Channels/Channel.cpp index 70c07494b..656a4fc65 100644 --- a/src/server/game/Chat/Channels/Channel.cpp +++ b/src/server/game/Chat/Channels/Channel.cpp @@ -790,7 +790,7 @@ void Channel::Say(uint64 guid, std::string const& what, uint32 lang) Player* player = pinfo.plrPtr; - if (player && !player->GetSession()->GetSecurity()) // pussywizard: prevent spam on populated channels + if (player && player->GetSession()->GetSecurity() == AccountTypes::SEC_PLAYER) // pussywizard: prevent spam on populated channels { uint32 speakDelay = 0; if (_channelRights.speakDelay > 0) diff --git a/src/server/game/Chat/Chat.cpp b/src/server/game/Chat/Chat.cpp index 5308dc37f..b7bb60e82 100644 --- a/src/server/game/Chat/Chat.cpp +++ b/src/server/game/Chat/Chat.cpp @@ -321,7 +321,7 @@ bool ChatHandler::ExecuteCommandInTable(std::vector const& table, c fullcmd.c_str(), player->GetName().c_str(), GUID_LOPART(player->GetGUID()), m_session->GetAccountId(), player->GetPositionX(), player->GetPositionY(), player->GetPositionZ(), player->GetMapId(), - player->GetMap() ? player->GetMap()->GetMapName() : "Unknown", + player->GetMap()->GetMapName(), areaId, areaName.c_str(), zoneName.c_str(), (player->GetSelectedUnit()) ? player->GetSelectedUnit()->GetName().c_str() : "", GUID_LOPART(guid)); @@ -998,7 +998,7 @@ GameTele const* ChatHandler::extractGameTeleFromLink(char* text) return NULL; // id case (explicit or from shift link) - if (cId[0] >= '0' || cId[0] >= '9') + if (cId[0] >= '0' || cId[0] <= '9') if (uint32 id = atoi(cId)) return sObjectMgr->GetGameTele(id); diff --git a/src/server/game/Conditions/ConditionMgr.cpp b/src/server/game/Conditions/ConditionMgr.cpp index 2157437f3..291f26b16 100644 --- a/src/server/game/Conditions/ConditionMgr.cpp +++ b/src/server/game/Conditions/ConditionMgr.cpp @@ -1247,7 +1247,8 @@ bool ConditionMgr::addToSpellImplicitTargetConditions(Condition* cond) if (!assigned) delete sharedList; } - sharedList->push_back(cond); + if (sharedList) + sharedList->push_back(cond); break; } } @@ -1566,18 +1567,6 @@ bool ConditionMgr::isSourceTypeValid(Condition* cond) } break; case CONDITION_SOURCE_TYPE_VEHICLE_SPELL: - if (!sObjectMgr->GetCreatureTemplate(cond->SourceGroup)) - { - sLog->outErrorDb("SourceEntry %u in `condition` table, does not exist in `creature_template`, ignoring.", cond->SourceGroup); - return false; - } - - if (!sSpellMgr->GetSpellInfo(cond->SourceEntry)) - { - sLog->outErrorDb("SourceEntry %u in `condition` table, does not exist in `spell.dbc`, ignoring.", cond->SourceEntry); - return false; - } - break; case CONDITION_SOURCE_TYPE_SPELL_CLICK_EVENT: if (!sObjectMgr->GetCreatureTemplate(cond->SourceGroup)) { diff --git a/src/server/game/DungeonFinding/LFGQueue.cpp b/src/server/game/DungeonFinding/LFGQueue.cpp index 676a9cbe5..81f8ea091 100644 --- a/src/server/game/DungeonFinding/LFGQueue.cpp +++ b/src/server/game/DungeonFinding/LFGQueue.cpp @@ -172,7 +172,7 @@ uint8 LFGQueue::FindGroups() { //sLog->outString("FIND GROUPS!"); uint8 newGroupsProcessed = 0; - while (!newToQueueStore.empty()) + if (!newToQueueStore.empty()) { ++newGroupsProcessed; uint64 newGuid = newToQueueStore.front(); diff --git a/src/server/game/Entities/Creature/Creature.cpp b/src/server/game/Entities/Creature/Creature.cpp index ba7a7bda6..8469887fd 100644 --- a/src/server/game/Entities/Creature/Creature.cpp +++ b/src/server/game/Entities/Creature/Creature.cpp @@ -365,7 +365,7 @@ bool Creature::InitEntry(uint32 Entry, const CreatureData* data) // Load creature equipment if (!data || data->equipmentId == 0) // use default from the template LoadEquipment(); - else if (data && data->equipmentId != 0) // override, 0 means no equipment + else { m_originalEquipmentId = data->equipmentId; LoadEquipment(data->equipmentId); diff --git a/src/server/game/Entities/Creature/GossipDef.cpp b/src/server/game/Entities/Creature/GossipDef.cpp index 054e03c62..ee668b67d 100644 --- a/src/server/game/Entities/Creature/GossipDef.cpp +++ b/src/server/game/Entities/Creature/GossipDef.cpp @@ -214,9 +214,8 @@ void PlayerMenu::SendGossipMenu(uint32 titleTextId, uint64 objectGUID) const std::string title = quest->GetTitle(); int32 locale = _session->GetSessionDbLocaleIndex(); - if (locale >= 0) - if (QuestLocale const* localeData = sObjectMgr->GetQuestLocale(questID)) - ObjectMgr::GetLocaleString(localeData->Title, locale, title); + if (QuestLocale const* localeData = sObjectMgr->GetQuestLocale(questID)) + ObjectMgr::GetLocaleString(localeData->Title, locale, title); data << title; } } @@ -241,9 +240,8 @@ void PlayerMenu::SendPointOfInterest(uint32 poiId) const std::string name = poi->Name; int32 locale = _session->GetSessionDbLocaleIndex(); - if (locale >= 0) - if (PointOfInterestLocale const* localeData = sObjectMgr->GetPointOfInterestLocale(poiId)) - ObjectMgr::GetLocaleString(localeData->Name, locale, name); + if (PointOfInterestLocale const* localeData = sObjectMgr->GetPointOfInterestLocale(poiId)) + ObjectMgr::GetLocaleString(localeData->Name, locale, name); WorldPacket data(SMSG_GOSSIP_POI, 4 + 4 + 4 + 4 + 4 + 20); // guess size data << uint32(poi->Flags); @@ -322,9 +320,8 @@ void PlayerMenu::SendQuestGiverQuestList(QEmote const& eEmote, const std::string std::string title = quest->GetTitle(); int32 locale = _session->GetSessionDbLocaleIndex(); - if (locale >= 0) - if (QuestLocale const* localeData = sObjectMgr->GetQuestLocale(questID)) - ObjectMgr::GetLocaleString(localeData->Title, locale, title); + if (QuestLocale const* localeData = sObjectMgr->GetQuestLocale(questID)) + ObjectMgr::GetLocaleString(localeData->Title, locale, title); data << uint32(questID); data << uint32(qmi.QuestIcon); @@ -362,16 +359,13 @@ void PlayerMenu::SendQuestGiverQuestDetails(Quest const* quest, uint64 npcGUID, std::string questAreaDescription = quest->GetAreaDescription(); int32 locale = _session->GetSessionDbLocaleIndex(); - if (locale >= 0) - { - if (QuestLocale const* localeData = sObjectMgr->GetQuestLocale(quest->GetQuestId())) - { - ObjectMgr::GetLocaleString(localeData->Title, locale, questTitle); - ObjectMgr::GetLocaleString(localeData->Details, locale, questDetails); - ObjectMgr::GetLocaleString(localeData->Objectives, locale, questObjectives); - ObjectMgr::GetLocaleString(localeData->AreaDescription, locale, questAreaDescription); - } - } + if (QuestLocale const* localeData = sObjectMgr->GetQuestLocale(quest->GetQuestId())) + { + ObjectMgr::GetLocaleString(localeData->Title, locale, questTitle); + ObjectMgr::GetLocaleString(localeData->Details, locale, questDetails); + ObjectMgr::GetLocaleString(localeData->Objectives, locale, questObjectives); + ObjectMgr::GetLocaleString(localeData->AreaDescription, locale, questAreaDescription); + } WorldPacket data(SMSG_QUESTGIVER_QUEST_DETAILS, 500); // guess size data << uint64(npcGUID); @@ -474,19 +468,16 @@ void PlayerMenu::SendQuestQueryResponse(Quest const* quest) const questObjectiveText[i] = quest->ObjectiveText[i]; int32 locale = _session->GetSessionDbLocaleIndex(); - if (locale >= 0) + if (QuestLocale const* localeData = sObjectMgr->GetQuestLocale(quest->GetQuestId())) { - if (QuestLocale const* localeData = sObjectMgr->GetQuestLocale(quest->GetQuestId())) - { - ObjectMgr::GetLocaleString(localeData->Title, locale, questTitle); - ObjectMgr::GetLocaleString(localeData->Details, locale, questDetails); - ObjectMgr::GetLocaleString(localeData->Objectives, locale, questObjectives); - ObjectMgr::GetLocaleString(localeData->AreaDescription, locale, questAreaDescription); - ObjectMgr::GetLocaleString(localeData->CompletedText, locale, questCompletedText); + ObjectMgr::GetLocaleString(localeData->Title, locale, questTitle); + ObjectMgr::GetLocaleString(localeData->Details, locale, questDetails); + ObjectMgr::GetLocaleString(localeData->Objectives, locale, questObjectives); + ObjectMgr::GetLocaleString(localeData->AreaDescription, locale, questAreaDescription); + ObjectMgr::GetLocaleString(localeData->CompletedText, locale, questCompletedText); - for (uint8 i = 0; i < QUEST_OBJECTIVES_COUNT; ++i) - ObjectMgr::GetLocaleString(localeData->ObjectiveText[i], locale, questObjectiveText[i]); - } + for (uint8 i = 0; i < QUEST_OBJECTIVES_COUNT; ++i) + ObjectMgr::GetLocaleString(localeData->ObjectiveText[i], locale, questObjectiveText[i]); } WorldPacket data(SMSG_QUEST_QUERY_RESPONSE, 100); // guess size @@ -603,14 +594,11 @@ void PlayerMenu::SendQuestGiverOfferReward(Quest const* quest, uint64 npcGUID, b std::string RewardText = quest->GetOfferRewardText(); int32 locale = _session->GetSessionDbLocaleIndex(); - if (locale >= 0) - { - if (QuestLocale const* localeData = sObjectMgr->GetQuestLocale(quest->GetQuestId())) - ObjectMgr::GetLocaleString(localeData->Title, locale, questTitle); + if (QuestLocale const* localeData = sObjectMgr->GetQuestLocale(quest->GetQuestId())) + ObjectMgr::GetLocaleString(localeData->Title, locale, questTitle); - if (QuestOfferRewardLocale const* questOfferRewardLocale = sObjectMgr->GetQuestOfferRewardLocale(quest->GetQuestId())) - ObjectMgr::GetLocaleString(questOfferRewardLocale->RewardText, locale, RewardText); - } + if (QuestOfferRewardLocale const* questOfferRewardLocale = sObjectMgr->GetQuestOfferRewardLocale(quest->GetQuestId())) + ObjectMgr::GetLocaleString(questOfferRewardLocale->RewardText, locale, RewardText); WorldPacket data(SMSG_QUESTGIVER_OFFER_REWARD, 400); // guess size data << uint64(npcGUID); @@ -699,14 +687,11 @@ void PlayerMenu::SendQuestGiverRequestItems(Quest const* quest, uint64 npcGUID, std::string requestItemsText = quest->GetRequestItemsText(); int32 locale = _session->GetSessionDbLocaleIndex(); - if (locale >= 0) - { - if (QuestLocale const* localeData = sObjectMgr->GetQuestLocale(quest->GetQuestId())) - ObjectMgr::GetLocaleString(localeData->Title, locale, questTitle); + if (QuestLocale const* localeData = sObjectMgr->GetQuestLocale(quest->GetQuestId())) + ObjectMgr::GetLocaleString(localeData->Title, locale, questTitle); - if (QuestRequestItemsLocale const* questRequestItemsLocale = sObjectMgr->GetQuestRequestItemsLocale(quest->GetQuestId())) - ObjectMgr::GetLocaleString(questRequestItemsLocale->CompletionText, locale, requestItemsText); - } + if (QuestRequestItemsLocale const* questRequestItemsLocale = sObjectMgr->GetQuestRequestItemsLocale(quest->GetQuestId())) + ObjectMgr::GetLocaleString(questRequestItemsLocale->CompletionText, locale, requestItemsText); if (!quest->GetReqItemsCount() && canComplete) { diff --git a/src/server/game/Entities/Creature/TemporarySummon.cpp b/src/server/game/Entities/Creature/TemporarySummon.cpp index 989aed69f..171eef015 100644 --- a/src/server/game/Entities/Creature/TemporarySummon.cpp +++ b/src/server/game/Entities/Creature/TemporarySummon.cpp @@ -85,7 +85,7 @@ void TempSummon::Update(uint32 diff) case TEMPSUMMON_CORPSE_DESPAWN: { // if m_deathState is DEAD, CORPSE was skipped - if (m_deathState == CORPSE || m_deathState == DEAD) + if (m_deathState == CORPSE) { UnSummon(); return; @@ -95,17 +95,12 @@ void TempSummon::Update(uint32 diff) } case TEMPSUMMON_DEAD_DESPAWN: { - if (m_deathState == DEAD) - { - UnSummon(); - return; - } break; } case TEMPSUMMON_TIMED_OR_CORPSE_DESPAWN: { // if m_deathState is DEAD, CORPSE was skipped - if (m_deathState == CORPSE || m_deathState == DEAD) + if (m_deathState == CORPSE) { UnSummon(); return; @@ -127,13 +122,6 @@ void TempSummon::Update(uint32 diff) } case TEMPSUMMON_TIMED_OR_DEAD_DESPAWN: { - // if m_deathState is DEAD, CORPSE was skipped - if (m_deathState == DEAD) - { - UnSummon(); - return; - } - if (!IsInCombat() && IsAlive()) { if (m_timer <= diff) diff --git a/src/server/game/Entities/Pet/Pet.cpp b/src/server/game/Entities/Pet/Pet.cpp index de0cefbae..88f12d59a 100644 --- a/src/server/game/Entities/Pet/Pet.cpp +++ b/src/server/game/Entities/Pet/Pet.cpp @@ -1,4 +1,4 @@ -/* +/* * Copyright (C) 2016+ AzerothCore , released under GNU GPL v2 license: https://github.com/azerothcore/azerothcore-wotlk/blob/master/LICENSE-GPL2 * Copyright (C) 2008-2016 TrinityCore * Copyright (C) 2005-2009 MaNGOS @@ -443,7 +443,7 @@ void Pet::Update(uint32 diff) if (IsWithinLOSInMap(tempspellTarget) && GetDistance(tempspellTarget) < max_range) { - if (tempspellTarget && !GetCharmInfo()->GetGlobalCooldownMgr().HasGlobalCooldown(spellInfo) && !HasSpellCooldown(tempspell)) + if (!GetCharmInfo()->GetGlobalCooldownMgr().HasGlobalCooldown(spellInfo) && !HasSpellCooldown(tempspell)) { StopMoving(); GetMotionMaster()->Clear(false); @@ -711,8 +711,8 @@ bool Guardian::InitStatsForLevel(uint8 petlevel) SetLevel(petlevel); SetCanModifyStats(true); - Unit *m_owner = GetOwner(); - if (!m_owner) // just to be sure, asynchronous now + Unit *owner = GetOwner(); + if (!owner) // just to be sure, asynchronous now { DespawnOrUnsummon(1000); return false; @@ -720,20 +720,20 @@ bool Guardian::InitStatsForLevel(uint8 petlevel) //Determine pet type PetType petType = MAX_PET_TYPE; - if (IsPet() && m_owner->GetTypeId() == TYPEID_PLAYER) + if (IsPet() && owner->GetTypeId() == TYPEID_PLAYER) { - if (m_owner->getClass() == CLASS_WARLOCK || - m_owner->getClass() == CLASS_SHAMAN || // Fire Elemental - m_owner->getClass() == CLASS_DEATH_KNIGHT || // Risen Ghoul - m_owner->getClass() == CLASS_MAGE) // Water Elemental with glyph + if (owner->getClass() == CLASS_WARLOCK || + owner->getClass() == CLASS_SHAMAN || // Fire Elemental + owner->getClass() == CLASS_DEATH_KNIGHT || // Risen Ghoul + owner->getClass() == CLASS_MAGE) // Water Elemental with glyph petType = SUMMON_PET; - else if (m_owner->getClass() == CLASS_HUNTER) + else if (owner->getClass() == CLASS_HUNTER) { petType = HUNTER_PET; m_unitTypeMask |= UNIT_MASK_HUNTER_PET; } else - sLog->outError("Unknown type pet %u is summoned by player class %u", GetEntry(), m_owner->getClass()); + sLog->outError("Unknown type pet %u is summoned by player class %u", GetEntry(), owner->getClass()); } uint32 creature_ID = (petType == HUNTER_PET) ? 1 : cinfo->Entry; @@ -743,7 +743,7 @@ bool Guardian::InitStatsForLevel(uint8 petlevel) SetModifierValue(UNIT_MOD_ARMOR, BASE_VALUE, float(petlevel*50)); uint32 attackTime = BASE_ATTACK_TIME; - if (m_owner->getClass() != CLASS_HUNTER && cinfo->BaseAttackTime >= 1000) + if (owner->getClass() != CLASS_HUNTER && cinfo->BaseAttackTime >= 1000) attackTime = cinfo->BaseAttackTime; SetAttackTime(BASE_ATTACK, attackTime); @@ -796,8 +796,8 @@ bool Guardian::InitStatsForLevel(uint8 petlevel) // remove elite bonuses included in DB values CreatureBaseStats const* stats = sObjectMgr->GetCreatureBaseStats(petlevel, cinfo->unit_class); // xinef: multiply base values by creature_template factors! - float factorHealth = m_owner->GetTypeId() == TYPEID_PLAYER ? std::min(1.0f, cinfo->ModHealth) : cinfo->ModHealth; - float factorMana = m_owner->GetTypeId() == TYPEID_PLAYER ? std::min(1.0f, cinfo->ModMana) : cinfo->ModMana; + float factorHealth = owner->GetTypeId() == TYPEID_PLAYER ? std::min(1.0f, cinfo->ModHealth) : cinfo->ModHealth; + float factorMana = owner->GetTypeId() == TYPEID_PLAYER ? std::min(1.0f, cinfo->ModMana) : cinfo->ModMana; SetCreateHealth(std::max(1, stats->BaseHealth[cinfo->expansion]*factorHealth)); SetModifierValue(UNIT_MOD_HEALTH, BASE_VALUE, GetCreateHealth()); @@ -840,7 +840,7 @@ bool Guardian::InitStatsForLevel(uint8 petlevel) case NPC_FELGUARD: { // xinef: Glyph of Felguard, so ugly im crying... no appropriate spell - if (AuraEffect* aurEff = m_owner->GetAuraEffectDummy(SPELL_GLYPH_OF_FELGUARD)) + if (AuraEffect* aurEff = owner->GetAuraEffectDummy(SPELL_GLYPH_OF_FELGUARD)) SetModifierValue(UNIT_MOD_ATTACK_POWER, TOTAL_PCT, 1.0f + float(aurEff->GetAmount() / 100.0f)); break; @@ -972,7 +972,7 @@ bool Guardian::InitStatsForLevel(uint8 petlevel) } case NPC_MIRROR_IMAGE: // Mirror Image { - SetDisplayId(m_owner->GetDisplayId()); + SetDisplayId(owner->GetDisplayId()); if (!pInfo) { SetCreateMana(28 + 30*petlevel); @@ -1007,8 +1007,8 @@ bool Guardian::InitStatsForLevel(uint8 petlevel) AddAura(SPELL_HUNTER_PET_SCALING_04, this); AddAura(SPELL_PET_AVOIDANCE, this); SetCreateHealth(4 * petlevel); - SetBaseWeaponDamage(BASE_ATTACK, MINDAMAGE, float(petlevel - 30 - (petlevel / 4) + m_owner->GetTotalAttackPowerValue(BASE_ATTACK) * 0.006f)); - SetBaseWeaponDamage(BASE_ATTACK, MAXDAMAGE, float(petlevel - 30 + (petlevel / 4) + m_owner->GetTotalAttackPowerValue(BASE_ATTACK) * 0.006f)); + SetBaseWeaponDamage(BASE_ATTACK, MINDAMAGE, float(petlevel - 30 - (petlevel / 4) + owner->GetTotalAttackPowerValue(BASE_ATTACK) * 0.006f)); + SetBaseWeaponDamage(BASE_ATTACK, MAXDAMAGE, float(petlevel - 30 + (petlevel / 4) + owner->GetTotalAttackPowerValue(BASE_ATTACK) * 0.006f)); SetReactState(REACT_DEFENSIVE); break; } @@ -1043,12 +1043,12 @@ bool Guardian::InitStatsForLevel(uint8 petlevel) SetPower(POWER_ENERGY, GetMaxPower(POWER_ENERGY)); // xinef: fixes orc death knight command racial - if (m_owner->getRace() == RACE_ORC) - CastSpell(this, SPELL_ORC_RACIAL_COMMAND, true, NULL, NULL, m_owner->GetGUID()); + if (owner->getRace() == RACE_ORC) + CastSpell(this, SPELL_ORC_RACIAL_COMMAND, true, NULL, NULL, owner->GetGUID()); // Avoidance, Night of the Dead if (Aura *aur = AddAura(SPELL_NIGHT_OF_THE_DEAD_AVOIDANCE, this)) - if (AuraEffect *aurEff = m_owner->GetAuraEffect(SPELL_AURA_ADD_FLAT_MODIFIER, SPELLFAMILY_DEATHKNIGHT, 2718, 0)) + if (AuraEffect *aurEff = owner->GetAuraEffect(SPELL_AURA_ADD_FLAT_MODIFIER, SPELLFAMILY_DEATHKNIGHT, 2718, 0)) if (aur->GetEffect(0)) aur->GetEffect(0)->SetAmount(-aurEff->GetSpellInfo()->Effects[EFFECT_2].CalcValue()); diff --git a/src/server/game/Entities/Player/Player.cpp b/src/server/game/Entities/Player/Player.cpp index d4ff8a537..9149fff61 100644 --- a/src/server/game/Entities/Player/Player.cpp +++ b/src/server/game/Entities/Player/Player.cpp @@ -7794,7 +7794,7 @@ bool Player::IsOutdoorPvPActive() void Player::DuelComplete(DuelCompleteType type) { // duel not requested - if (!duel) + if (!duel || !duel->opponent || !duel->initiator) return; #if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS) @@ -7845,7 +7845,7 @@ void Player::DuelComplete(DuelCompleteType type) duel->opponent->CastSpell(duel->opponent, 52994, true); // Honor points after duel (the winner) - ImpConfig - if (uint32 amount = sWorld->getIntConfig(CONFIG_HONOR_AFTER_DUEL) && duel->opponent) + if (uint32 amount = sWorld->getIntConfig(CONFIG_HONOR_AFTER_DUEL)) duel->opponent->RewardHonor(NULL, 1, amount); break; @@ -8089,10 +8089,6 @@ void Player::_ApplyItemBonuses(ItemTemplate const* proto, uint8 slot, bool apply ApplyRatingMod(CR_HIT_TAKEN_SPELL, int32(val), apply); break; case ITEM_MOD_CRIT_TAKEN_RATING: - ApplyRatingMod(CR_CRIT_TAKEN_MELEE, int32(val), apply); - ApplyRatingMod(CR_CRIT_TAKEN_RANGED, int32(val), apply); - ApplyRatingMod(CR_CRIT_TAKEN_SPELL, int32(val), apply); - break; case ITEM_MOD_RESILIENCE_RATING: ApplyRatingMod(CR_CRIT_TAKEN_MELEE, int32(val), apply); ApplyRatingMod(CR_CRIT_TAKEN_RANGED, int32(val), apply); @@ -10200,8 +10196,6 @@ uint8 Player::FindEquipSlot(ItemTemplate const* proto, uint32 slot, bool swap) c slots[0] = EQUIPMENT_SLOT_BODY; break; case INVTYPE_CHEST: - slots[0] = EQUIPMENT_SLOT_CHEST; - break; case INVTYPE_ROBE: slots[0] = EQUIPMENT_SLOT_CHEST; break; @@ -10242,9 +10236,13 @@ uint8 Player::FindEquipSlot(ItemTemplate const* proto, uint32 slot, bool swap) c break; } case INVTYPE_SHIELD: + case INVTYPE_WEAPONOFFHAND: + case INVTYPE_HOLDABLE: slots[0] = EQUIPMENT_SLOT_OFFHAND; break; case INVTYPE_RANGED: + case INVTYPE_RANGEDRIGHT: + case INVTYPE_THROWN: slots[0] = EQUIPMENT_SLOT_RANGED; break; case INVTYPE_2HWEAPON: @@ -10278,18 +10276,6 @@ uint8 Player::FindEquipSlot(ItemTemplate const* proto, uint32 slot, bool swap) c case INVTYPE_WEAPONMAINHAND: slots[0] = EQUIPMENT_SLOT_MAINHAND; break; - case INVTYPE_WEAPONOFFHAND: - slots[0] = EQUIPMENT_SLOT_OFFHAND; - break; - case INVTYPE_HOLDABLE: - slots[0] = EQUIPMENT_SLOT_OFFHAND; - break; - case INVTYPE_THROWN: - slots[0] = EQUIPMENT_SLOT_RANGED; - break; - case INVTYPE_RANGEDRIGHT: - slots[0] = EQUIPMENT_SLOT_RANGED; - break; case INVTYPE_BAG: slots[0] = INVENTORY_SLOT_BAG_START + 0; slots[1] = INVENTORY_SLOT_BAG_START + 1; @@ -12491,14 +12477,11 @@ void Player::SetAmmo(uint32 item) return; // check ammo - if (item) + InventoryResult msg = CanUseAmmo(item); + if (msg != EQUIP_ERR_OK) { - InventoryResult msg = CanUseAmmo(item); - if (msg != EQUIP_ERR_OK) - { - SendEquipError(msg, NULL, NULL, item); - return; - } + SendEquipError(msg, NULL, NULL, item); + return; } SetUInt32Value(PLAYER_AMMO_ID, item); @@ -13895,7 +13878,7 @@ void Player::SwapItem(uint16 src, uint16 dst) } } - if (!released && IsBagPos(dst) && pDstItem) + if (!released && IsBagPos(dst)) { Bag* bag = pDstItem->ToBag(); for (uint32 i = 0; i < bag->GetBagSize(); ++i) diff --git a/src/server/game/Entities/Player/SocialMgr.cpp b/src/server/game/Entities/Player/SocialMgr.cpp index 652707215..f0db9ec8c 100644 --- a/src/server/game/Entities/Player/SocialMgr.cpp +++ b/src/server/game/Entities/Player/SocialMgr.cpp @@ -227,7 +227,7 @@ void SocialMgr::GetFriendInfo(Player* player, uint32 friendGUID, FriendInfo &fri // PLAYER see his team only and PLAYER can't see MODERATOR, GAME MASTER, ADMINISTRATOR characters // MODERATOR, GAME MASTER, ADMINISTRATOR can see all - if (pFriend && (!AccountMgr::IsPlayerAccount(security) || ((pFriend->GetTeamId() == teamId || allowTwoSideWhoList) && pFriend->GetSession()->GetSecurity() <= gmLevelInWhoList)) && pFriend->IsVisibleGloballyFor(player)) + if ((!AccountMgr::IsPlayerAccount(security) || ((pFriend->GetTeamId() == teamId || allowTwoSideWhoList) && pFriend->GetSession()->GetSecurity() <= gmLevelInWhoList)) && pFriend->IsVisibleGloballyFor(player)) { friendInfo.Status = FRIEND_STATUS_ONLINE; if (pFriend->isAFK()) diff --git a/src/server/game/Entities/Totem/Totem.cpp b/src/server/game/Entities/Totem/Totem.cpp index 1c87f1029..b01079723 100644 --- a/src/server/game/Entities/Totem/Totem.cpp +++ b/src/server/game/Entities/Totem/Totem.cpp @@ -104,37 +104,37 @@ void Totem::UnSummon(uint32 msTime) CombatStop(); RemoveAurasDueToSpell(GetSpell(), GetGUID()); - Unit *m_owner = GetOwner(); + Unit *owner = GetOwner(); // clear owner's totem slot for (uint8 i = SUMMON_SLOT_TOTEM; i < MAX_TOTEM_SLOT; ++i) { - if (m_owner->m_SummonSlot[i] == GetGUID()) + if (owner->m_SummonSlot[i] == GetGUID()) { - m_owner->m_SummonSlot[i] = 0; + owner->m_SummonSlot[i] = 0; break; } } - m_owner->RemoveAurasDueToSpell(GetSpell(), GetGUID()); + owner->RemoveAurasDueToSpell(GetSpell(), GetGUID()); // Remove Sentry Totem Aura if (GetEntry() == SENTRY_TOTEM_ENTRY) - m_owner->RemoveAurasDueToSpell(SENTRY_TOTEM_SPELLID); + owner->RemoveAurasDueToSpell(SENTRY_TOTEM_SPELLID); //remove aura all party members too - if (Player* owner = m_owner->ToPlayer()) + if (Player* player = owner->ToPlayer()) { - owner->SendAutoRepeatCancel(this); + player->SendAutoRepeatCancel(this); if (SpellInfo const* spell = sSpellMgr->GetSpellInfo(GetUInt32Value(UNIT_CREATED_BY_SPELL))) - owner->SendCooldownEvent(spell, 0, NULL, false); + player->SendCooldownEvent(spell, 0, NULL, false); - if (Group* group = owner->GetGroup()) + if (Group* group = player->GetGroup()) { for (GroupReference* itr = group->GetFirstMember(); itr != NULL; itr = itr->next()) { Player* target = itr->GetSource(); - if (target && target->IsInMap(owner) && group->SameSubGroup(owner, target)) + if (target && target->IsInMap(player) && group->SameSubGroup(player, target)) target->RemoveAurasDueToSpell(GetSpell(), GetGUID()); } } diff --git a/src/server/game/Entities/Unit/StatSystem.cpp b/src/server/game/Entities/Unit/StatSystem.cpp index feabf1c3c..cf67bdfee 100644 --- a/src/server/game/Entities/Unit/StatSystem.cpp +++ b/src/server/game/Entities/Unit/StatSystem.cpp @@ -333,8 +333,6 @@ void Player::UpdateAttackPowerAndDamage(bool ranged) val2 = level * 2.0f + GetStat(STAT_AGILITY) - 10.0f; break; case CLASS_ROGUE: - val2 = level + GetStat(STAT_AGILITY) - 10.0f; - break; case CLASS_WARRIOR: val2 = level + GetStat(STAT_AGILITY) - 10.0f; break; @@ -356,22 +354,14 @@ void Player::UpdateAttackPowerAndDamage(bool ranged) { switch (getClass()) { + case CLASS_PALADIN: + case CLASS_DEATH_KNIGHT: case CLASS_WARRIOR: val2 = level * 3.0f + GetStat(STAT_STRENGTH) * 2.0f - 20.0f; break; - case CLASS_PALADIN: - val2 = level * 3.0f + GetStat(STAT_STRENGTH) * 2.0f - 20.0f; - break; - case CLASS_DEATH_KNIGHT: - val2 = level * 3.0f + GetStat(STAT_STRENGTH) * 2.0f - 20.0f; - break; - case CLASS_ROGUE: - val2 = level * 2.0f + GetStat(STAT_STRENGTH) + GetStat(STAT_AGILITY) - 20.0f; - break; case CLASS_HUNTER: - val2 = level * 2.0f + GetStat(STAT_STRENGTH) + GetStat(STAT_AGILITY) - 20.0f; - break; case CLASS_SHAMAN: + case CLASS_ROGUE: val2 = level * 2.0f + GetStat(STAT_STRENGTH) + GetStat(STAT_AGILITY) - 20.0f; break; case CLASS_DRUID: @@ -457,11 +447,7 @@ void Player::UpdateAttackPowerAndDamage(bool ranged) break; } case CLASS_MAGE: - val2 = GetStat(STAT_STRENGTH) - 10.0f; - break; case CLASS_PRIEST: - val2 = GetStat(STAT_STRENGTH) - 10.0f; - break; case CLASS_WARLOCK: val2 = GetStat(STAT_STRENGTH) - 10.0f; break; diff --git a/src/server/game/Entities/Unit/Unit.cpp b/src/server/game/Entities/Unit/Unit.cpp index 519e1e7a0..80a5304c7 100644 --- a/src/server/game/Entities/Unit/Unit.cpp +++ b/src/server/game/Entities/Unit/Unit.cpp @@ -1297,8 +1297,6 @@ void Unit::CalculateMeleeDamage(Unit* victim, uint32 damage, CalcDamageInfo* dam damageInfo->TargetState = VICTIMSTATE_IS_IMMUNE; damageInfo->procEx |= PROC_EX_IMMUNE; - damageInfo->damage = 0; - damageInfo->cleanDamage = 0; return; } @@ -3448,7 +3446,7 @@ bool Unit::isInAccessiblePlaceFor(Creature const* c) const // special handling for ICC (map 631), for non-flying pets in Gunship Battle, for trash npcs this is done via CanAIAttack if (IS_PLAYER_GUID(c->GetOwnerGUID()) && !c->CanFly()) { - if ((c->GetTransport() && !this->GetTransport()) || (!c->GetTransport() && this->GetTransport())) + if (c->GetTransport() != this->GetTransport()) return false; if (this->GetTransport()) { @@ -6780,7 +6778,7 @@ bool Unit::HandleDummyAuraProc(Unit* victim, uint32 damage, AuraEffect* triggere case 70664: { // xinef: proc only from normal Rejuvenation, and proc rejuvenation - if (!victim || procSpell->SpellIconID != 64) + if (!victim || !procSpell || procSpell->SpellIconID != 64) return false; Player* caster = ToPlayer(); @@ -6989,13 +6987,8 @@ bool Unit::HandleDummyAuraProc(Unit* victim, uint32 damage, AuraEffect* triggere basepoints0 = int32(damage); triggered_spell_id = procSpell->IsRankOf(sSpellMgr->GetSpellInfo(635)) ? 53652 : 53654; - if (triggered_spell_id && beaconTarget) - { - victim->CastCustomSpell(beaconTarget, triggered_spell_id, &basepoints0, NULL, NULL, true, 0, triggeredByAura, victim->GetGUID()); - return true; - } - - return false; + victim->CastCustomSpell(beaconTarget, triggered_spell_id, &basepoints0, NULL, NULL, true, 0, triggeredByAura, victim->GetGUID()); + return true; } // Judgements of the Wise if (dummySpell->SpellIconID == 3017) @@ -7569,6 +7562,9 @@ bool Unit::HandleDummyAuraProc(Unit* victim, uint32 damage, AuraEffect* triggere // Improved Water Shield if (dummySpell->SpellIconID == 2287) { + if (!procSpell) + return false; + // Default chance for Healing Wave and Riptide float chance = (float)triggeredByAura->GetAmount(); @@ -8627,6 +8623,9 @@ bool Unit::HandleProcTriggerSpell(Unit* victim, uint32 damage, AuraEffect* trigg case 15337: // Improved Spirit Tap (Rank 1) case 15338: // Improved Spirit Tap (Rank 2) { + if (!procSpell) + return false; + if (procSpell->SpellFamilyFlags[0] & 0x800000) if ((procSpell->Id != 58381) || !roll_chance_i(50)) return false; @@ -8982,7 +8981,7 @@ bool Unit::HandleProcTriggerSpell(Unit* victim, uint32 damage, AuraEffect* trigg // try detect target manually if not set if (target == NULL) - target = !(procFlags & (PROC_FLAG_DONE_SPELL_MAGIC_DMG_CLASS_POS | PROC_FLAG_DONE_SPELL_NONE_DMG_CLASS_POS)) && triggerEntry && triggerEntry->IsPositive() ? this : victim; + target = !(procFlags & (PROC_FLAG_DONE_SPELL_MAGIC_DMG_CLASS_POS | PROC_FLAG_DONE_SPELL_NONE_DMG_CLASS_POS)) && triggerEntry->IsPositive() ? this : victim; if (cooldown) { @@ -15277,10 +15276,6 @@ void Unit::ProcDamageAndSpellFor(bool isVictim, Unit* target, uint32 procFlag, u takeCharges = true; break; case SPELL_AURA_MECHANIC_IMMUNITY: - // Compare mechanic - if (procSpell && procSpell->Mechanic == uint32(triggeredByAura->GetMiscValue())) - takeCharges = true; - break; case SPELL_AURA_MOD_MECHANIC_RESISTANCE: // Compare mechanic if (procSpell && procSpell->Mechanic == uint32(triggeredByAura->GetMiscValue())) @@ -15815,7 +15810,7 @@ uint32 Unit::GetCastingTimeForBonus(SpellInfo const* spellProto, DamageEffectTyp } // Combined Spells with Both Over Time and Direct Damage - if (overTime > 0 && CastingTime > 0 && DirectDamage) + if (overTime > 0 && DirectDamage) { // mainly for DoTs which are 3500 here otherwise uint32 OriginalCastTime = spellProto->CalcCastTime(); @@ -17264,7 +17259,7 @@ void Unit::RemoveCharmedBy(Unit* charmer) if (Creature* creature = ToCreature()) { // Vehicle should not attack its passenger after he exists the seat - if (type != CHARM_TYPE_VEHICLE && charmer && charmer->IsAlive() && !charmer->IsFriendlyTo(creature)) + if (type != CHARM_TYPE_VEHICLE && charmer->IsAlive() && !charmer->IsFriendlyTo(creature)) if (Attack(charmer, true)) GetMotionMaster()->MoveChase(charmer); @@ -18132,7 +18127,7 @@ bool Unit::HandleSpellClick(Unit* clicker, int8 seatId) { uint8 i = 0; bool valid = false; - while (i < MAX_SPELL_EFFECTS && !valid) + while (i < MAX_SPELL_EFFECTS) { if (spellEntry->Effects[i].ApplyAuraName == SPELL_AURA_CONTROL_VEHICLE) { diff --git a/src/server/game/Entities/Vehicle/Vehicle.cpp b/src/server/game/Entities/Vehicle/Vehicle.cpp index 60214d35b..c4152d6e2 100644 --- a/src/server/game/Entities/Vehicle/Vehicle.cpp +++ b/src/server/game/Entities/Vehicle/Vehicle.cpp @@ -365,7 +365,7 @@ bool Vehicle::AddPassenger(Unit* unit, int8 seatId) } } - if (!_me->IsInWorld() || _me->IsDuringRemoveFromWorld()) + if (!_me || !_me->IsInWorld() || _me->IsDuringRemoveFromWorld()) return false; // Xinef: moved from unit.cpp, if aura passes seatId == -1 (choose automaticly) we wont get appropriate flags diff --git a/src/server/game/Events/GameEventMgr.cpp b/src/server/game/Events/GameEventMgr.cpp index 5b86e1953..6b7747e4c 100644 --- a/src/server/game/Events/GameEventMgr.cpp +++ b/src/server/game/Events/GameEventMgr.cpp @@ -1301,7 +1301,7 @@ void GameEventMgr::GameEventSpawn(int16 event_id) } } - if (internal_event_id < 0 || internal_event_id >= int32(mGameEventGameobjectGuids.size())) + if (internal_event_id >= int32(mGameEventGameobjectGuids.size())) { sLog->outError("GameEventMgr::GameEventSpawn attempt access to out of range mGameEventGameobjectGuids element %i (size: " SZFMTD ")", internal_event_id, mGameEventGameobjectGuids.size()); @@ -1334,7 +1334,7 @@ void GameEventMgr::GameEventSpawn(int16 event_id) } } - if (internal_event_id < 0 || internal_event_id >= int32(mGameEventPoolIds.size())) + if (internal_event_id >= int32(mGameEventPoolIds.size())) { sLog->outError("GameEventMgr::GameEventSpawn attempt access to out of range mGameEventPoolIds element %u (size: " SZFMTD ")", internal_event_id, mGameEventPoolIds.size()); @@ -1371,7 +1371,7 @@ void GameEventMgr::GameEventUnspawn(int16 event_id) } } - if (internal_event_id < 0 || internal_event_id >= int32(mGameEventGameobjectGuids.size())) + if (internal_event_id >= int32(mGameEventGameobjectGuids.size())) { sLog->outError("GameEventMgr::GameEventUnspawn attempt access to out of range mGameEventGameobjectGuids element %i (size: " SZFMTD ")", internal_event_id, mGameEventGameobjectGuids.size()); @@ -1392,7 +1392,7 @@ void GameEventMgr::GameEventUnspawn(int16 event_id) pGameobject->AddObjectToRemoveList(); } } - if (internal_event_id < 0 || internal_event_id >= int32(mGameEventPoolIds.size())) + if (internal_event_id >= int32(mGameEventPoolIds.size())) { sLog->outError("GameEventMgr::GameEventUnspawn attempt access to out of range mGameEventPoolIds element %u (size: " SZFMTD ")", internal_event_id, mGameEventPoolIds.size()); return; diff --git a/src/server/game/Globals/ObjectMgr.cpp b/src/server/game/Globals/ObjectMgr.cpp index a0dee4bb4..4cc6b3fc1 100644 --- a/src/server/game/Globals/ObjectMgr.cpp +++ b/src/server/game/Globals/ObjectMgr.cpp @@ -1748,7 +1748,7 @@ void ObjectMgr::LoadCreatures() if (cInfo->flags_extra & CREATURE_FLAG_EXTRA_INSTANCE_BIND) { - if (!mapEntry || !mapEntry->IsDungeon()) + if (!mapEntry->IsDungeon()) sLog->outErrorDb("Table `creature` have creature (GUID: %u Entry: %u) with `creature_template`.`flags_extra` including CREATURE_FLAG_EXTRA_INSTANCE_BIND but creature are not in instance.", guid, data.id); } diff --git a/src/server/game/Groups/Group.cpp b/src/server/game/Groups/Group.cpp index 41c601b7c..6448f3e96 100644 --- a/src/server/game/Groups/Group.cpp +++ b/src/server/game/Groups/Group.cpp @@ -349,6 +349,9 @@ Player* Group::GetInvited(const std::string& name) const bool Group::AddMember(Player* player) { + if (!player) + return false; + // Get first not-full group uint8 subGroup = 0; if (m_subGroupsCounts) @@ -379,22 +382,19 @@ bool Group::AddMember(Player* player) SubGroupCounterIncrease(subGroup); - if (player) + player->SetGroupInvite(NULL); + if (player->GetGroup()) { - player->SetGroupInvite(NULL); - if (player->GetGroup()) - { - if (isBGGroup() || isBFGroup()) // if player is in group and he is being added to BG raid group, then call SetBattlegroundRaid() - player->SetBattlegroundOrBattlefieldRaid(this, subGroup); - else //if player is in bg raid and we are adding him to normal group, then call SetOriginalGroup() - player->SetOriginalGroup(this, subGroup); - } - else //if player is not in group, then call set group - player->SetGroup(this, subGroup); - - // if the same group invites the player back, cancel the homebind timer - _cancelHomebindIfInstance(player); + if (isBGGroup() || isBFGroup()) // if player is in group and he is being added to BG raid group, then call SetBattlegroundRaid() + player->SetBattlegroundOrBattlefieldRaid(this, subGroup); + else //if player is in bg raid and we are adding him to normal group, then call SetOriginalGroup() + player->SetOriginalGroup(this, subGroup); } + else //if player is not in group, then call set group + player->SetGroup(this, subGroup); + + // if the same group invites the player back, cancel the homebind timer + _cancelHomebindIfInstance(player); if (!isRaidGroup()) // reset targetIcons for non-raid-groups { @@ -414,10 +414,11 @@ bool Group::AddMember(Player* player) } SendUpdate(); - sScriptMgr->OnGroupAddMember(this, player->GetGUID()); if (player) { + sScriptMgr->OnGroupAddMember(this, player->GetGUID()); + if (!IsLeader(player->GetGUID()) && !isBGGroup() && !isBFGroup()) { Player::ResetInstances(player->GetGUIDLow(), INSTANCE_RESET_GROUP_JOIN, false); @@ -554,7 +555,7 @@ bool Group::RemoveMember(uint64 guid, const RemoveMethod &method /*= GROUP_REMOV } // Reevaluate group enchanter if the leaving player had enchanting skill or the player is offline - if ((player && player->GetSkillValue(SKILL_ENCHANTING)) || !player) + if (!player || player->GetSkillValue(SKILL_ENCHANTING)) ResetMaxEnchantingLevel(); // Remove player from loot rolls diff --git a/src/server/game/Maps/Map.cpp b/src/server/game/Maps/Map.cpp index 3ff92bba9..8e8323b55 100644 --- a/src/server/game/Maps/Map.cpp +++ b/src/server/game/Maps/Map.cpp @@ -2568,6 +2568,8 @@ void InstanceMap::InitVisibilityDistance() switch (GetId()) { case 429: // Dire Maul + case 550: // The Eye + case 578: // The Nexus: The Oculus m_VisibleDistance = 175.0f; break; case 649: // Trial of the Crusader @@ -2576,10 +2578,6 @@ void InstanceMap::InitVisibilityDistance() case 658: // Pit of Saron m_VisibleDistance = 150.0f; break; - case 550: // The Eye - case 578: // The Nexus: The Oculus - m_VisibleDistance = 175.0f; - break; case 615: // Obsidian Sanctum case 616: // Eye of Eternity case 603: // Ulduar diff --git a/src/server/game/Spells/Auras/SpellAuraEffects.cpp b/src/server/game/Spells/Auras/SpellAuraEffects.cpp index a04509205..e167f7046 100644 --- a/src/server/game/Spells/Auras/SpellAuraEffects.cpp +++ b/src/server/game/Spells/Auras/SpellAuraEffects.cpp @@ -526,10 +526,6 @@ int32 AuraEffect::CalculateAmount(Unit* caster) switch (GetAuraType()) { case SPELL_AURA_PERIODIC_DAMAGE: - // xinef: save caster depending auras, always pass 1 as stack amount, effect will be multiplicated at the end of the function by correct value! - if (GetBase()->GetType() == UNIT_AURA_TYPE) - amount = caster->SpellDamageBonusDone(GetBase()->GetUnitOwner(), GetSpellInfo(), amount, DOT, GetPctMods(), 1); - break; case SPELL_AURA_PERIODIC_LEECH: // xinef: save caster depending auras, always pass 1 as stack amount, effect will be multiplicated at the end of the function by correct value! if (GetBase()->GetType() == UNIT_AURA_TYPE) diff --git a/src/server/scripts/Commands/cs_character.cpp b/src/server/scripts/Commands/cs_character.cpp index 282a6a6b5..a912a8239 100644 --- a/src/server/scripts/Commands/cs_character.cpp +++ b/src/server/scripts/Commands/cs_character.cpp @@ -257,6 +257,9 @@ public: if (!handler->extractPlayerTarget((char*)args, &target)) return false; + if (!target) + return false; + LocaleConstant loc = handler->GetSessionDbcLocale(); char const* targetName = target->GetName().c_str(); char const* knownStr = handler->GetAcoreString(LANG_KNOWN); diff --git a/src/server/scripts/Commands/cs_modify.cpp b/src/server/scripts/Commands/cs_modify.cpp index a587039f0..5401b3f4e 100644 --- a/src/server/scripts/Commands/cs_modify.cpp +++ b/src/server/scripts/Commands/cs_modify.cpp @@ -298,24 +298,14 @@ public: if (!pfactionid) { - if (target) - { - uint32 factionid = target->getFaction(); - uint32 flag = target->GetUInt32Value(UNIT_FIELD_FLAGS); - uint32 npcflag = target->GetUInt32Value(UNIT_NPC_FLAGS); - uint32 dyflag = target->GetUInt32Value(UNIT_DYNAMIC_FLAGS); - handler->PSendSysMessage(LANG_CURRENT_FACTION, target->GetGUIDLow(), factionid, flag, npcflag, dyflag); - } + uint32 factionid = target->getFaction(); + uint32 flag = target->GetUInt32Value(UNIT_FIELD_FLAGS); + uint32 npcflag = target->GetUInt32Value(UNIT_NPC_FLAGS); + uint32 dyflag = target->GetUInt32Value(UNIT_DYNAMIC_FLAGS); + handler->PSendSysMessage(LANG_CURRENT_FACTION, target->GetGUIDLow(), factionid, flag, npcflag, dyflag); return true; } - if (!target) - { - handler->SendSysMessage(LANG_NO_CHAR_SELECTED); - handler->SetSentErrorMessage(true); - return false; - } - uint32 factionid = atoi(pfactionid); uint32 flag; diff --git a/src/server/scripts/Commands/cs_npc.cpp b/src/server/scripts/Commands/cs_npc.cpp index 3b48d861b..acda91fea 100644 --- a/src/server/scripts/Commands/cs_npc.cpp +++ b/src/server/scripts/Commands/cs_npc.cpp @@ -295,7 +295,7 @@ public: return false; } - uint32 vendor_entry = vendor ? vendor->GetEntry() : 0; + uint32 vendor_entry = vendor->GetEntry(); if (!sObjectMgr->IsVendorItemValid(vendor_entry, itemId, maxcount, incrtime, extendedcost, handler->GetSession()->GetPlayer())) { diff --git a/src/server/scripts/EasternKingdoms/Karazhan/boss_shade_of_aran.cpp b/src/server/scripts/EasternKingdoms/Karazhan/boss_shade_of_aran.cpp index 5cec76042..9bce401ff 100644 --- a/src/server/scripts/EasternKingdoms/Karazhan/boss_shade_of_aran.cpp +++ b/src/server/scripts/EasternKingdoms/Karazhan/boss_shade_of_aran.cpp @@ -411,7 +411,7 @@ public: ElementalOne->SetInCombatWithZone(); ElementalOne->CombatStart(target); ElementalOne->setFaction(me->getFaction()); - ElementalTwo->SetUnitMovementFlags(MOVEMENTFLAG_ROOT); + ElementalOne->SetUnitMovementFlags(MOVEMENTFLAG_ROOT); ElementalOne->ApplySpellImmune(0, IMMUNITY_SCHOOL, SPELL_SCHOOL_MASK_FROST, true); ElementalOne->SetModifierValue(UNIT_MOD_RESISTANCE_FROST, BASE_VALUE, 0); } @@ -441,7 +441,7 @@ public: ElementalThree->SetInCombatWithZone(); ElementalThree->CombatStart(target); ElementalThree->setFaction(me->getFaction()); - ElementalTwo->SetUnitMovementFlags(MOVEMENTFLAG_ROOT); + ElementalThree->SetUnitMovementFlags(MOVEMENTFLAG_ROOT); ElementalThree->ApplySpellImmune(0, IMMUNITY_SCHOOL, SPELL_SCHOOL_MASK_FROST, true); ElementalThree->SetModifierValue(UNIT_MOD_RESISTANCE_FROST, BASE_VALUE, 0); } @@ -456,7 +456,7 @@ public: ElementalFour->SetInCombatWithZone(); ElementalFour->CombatStart(target); ElementalFour->setFaction(me->getFaction()); - ElementalTwo->SetUnitMovementFlags(MOVEMENTFLAG_ROOT); + ElementalFour->SetUnitMovementFlags(MOVEMENTFLAG_ROOT); ElementalFour->ApplySpellImmune(0, IMMUNITY_SCHOOL, SPELL_SCHOOL_MASK_FROST, true); ElementalFour->SetModifierValue(UNIT_MOD_RESISTANCE_FROST, BASE_VALUE, 0); } diff --git a/src/server/scripts/EasternKingdoms/Karazhan/instance_karazhan.cpp b/src/server/scripts/EasternKingdoms/Karazhan/instance_karazhan.cpp index 2414c4ed8..90c8d72da 100644 --- a/src/server/scripts/EasternKingdoms/Karazhan/instance_karazhan.cpp +++ b/src/server/scripts/EasternKingdoms/Karazhan/instance_karazhan.cpp @@ -168,7 +168,7 @@ public: break; case GO_MASSIVE_DOOR: m_uiMassiveDoor = go->GetGUID(); - if (GetBossState(DATA_ARAN) == !IN_PROGRESS) + if (GetBossState(DATA_ARAN) != IN_PROGRESS) go->SetFlag(GAMEOBJECT_FLAGS, GO_FLAG_LOCKED); else go->RemoveFlag(GAMEOBJECT_FLAGS, GO_FLAG_LOCKED); @@ -181,7 +181,7 @@ public: break; case GO_NETHERSPACE_DOOR: m_uiNetherspaceDoor = go->GetGUID(); - if (GetBossState(DATA_PRINCE) == !IN_PROGRESS) + if (GetBossState(DATA_PRINCE) != IN_PROGRESS) go->SetFlag(GAMEOBJECT_FLAGS, GO_FLAG_LOCKED); else go->RemoveFlag(GAMEOBJECT_FLAGS, GO_FLAG_LOCKED); diff --git a/src/server/scripts/Kalimdor/CavernsOfTime/CullingOfStratholme/culling_of_stratholme.cpp b/src/server/scripts/Kalimdor/CavernsOfTime/CullingOfStratholme/culling_of_stratholme.cpp index 748b899a3..25cf91172 100644 --- a/src/server/scripts/Kalimdor/CavernsOfTime/CullingOfStratholme/culling_of_stratholme.cpp +++ b/src/server/scripts/Kalimdor/CavernsOfTime/CullingOfStratholme/culling_of_stratholme.cpp @@ -1261,7 +1261,8 @@ void npc_arthas::npc_arthasAI::ReorderInstance(uint32 data) } else if (data == COS_PROGRESS_KILLED_SALRAMM) { - pInstance->DoUpdateWorldState(WORLDSTATE_WAVE_COUNT, 10); + if (pInstance) + pInstance->DoUpdateWorldState(WORLDSTATE_WAVE_COUNT, 10); DoAction(ACTION_KILLED_SALRAMM); } break; diff --git a/src/server/scripts/Northrend/FrozenHalls/HallsOfReflection/halls_of_reflection.cpp b/src/server/scripts/Northrend/FrozenHalls/HallsOfReflection/halls_of_reflection.cpp index a855e953d..6926dc236 100644 --- a/src/server/scripts/Northrend/FrozenHalls/HallsOfReflection/halls_of_reflection.cpp +++ b/src/server/scripts/Northrend/FrozenHalls/HallsOfReflection/halls_of_reflection.cpp @@ -2015,7 +2015,7 @@ class at_hor_battered_hilt_throw : public AreaTriggerScript if (InstanceScript* instance = player->GetInstanceScript()) { uint32 bhd = instance->GetData(DATA_BATTERED_HILT); - if (bhd == BHSF_NONE || bhd != BHSF_STARTED) + if (bhd != BHSF_STARTED) return true; player->CastSpell(player, 70698, true); player->DestroyItemCount(49766, 1, true); diff --git a/src/server/scripts/Northrend/FrozenHalls/PitOfSaron/pit_of_saron.cpp b/src/server/scripts/Northrend/FrozenHalls/PitOfSaron/pit_of_saron.cpp index 821cb3584..ddf7ae055 100644 --- a/src/server/scripts/Northrend/FrozenHalls/PitOfSaron/pit_of_saron.cpp +++ b/src/server/scripts/Northrend/FrozenHalls/PitOfSaron/pit_of_saron.cpp @@ -129,6 +129,7 @@ public: n2->GetMotionMaster()->MovePoint(1, NecrolytePos2); n2->SetUInt32Value(UNIT_NPC_EMOTESTATE, EMOTE_STATE_READY1H); } + // TODO This spell check is invalid if (SPELL_NECROLYTE_CHANNELING) { n1->RemoveAura(SPELL_NECROLYTE_CHANNELING); @@ -398,6 +399,8 @@ public: (me->GetPositionX() > 490.0f && me->GetPositionX() < 504.0f && me->GetPositionY() > 240.0f && me->GetPositionY() < 254.0f)) { isInvincible = true; + + // TODO This spell check is invalid if (SPELL_NECROLYTE_CHANNELING) me->CastSpell(me, SPELL_NECROLYTE_CHANNELING, false); @@ -417,6 +420,7 @@ public: void EnterCombat(Unit* /*who*/) { + // TODO This spell check is invalid if (SPELL_NECROLYTE_CHANNELING) me->RemoveAura(SPELL_NECROLYTE_CHANNELING); events.Reset();