fix(Core): potential crashes/bugs reported by static analysis #2 (#2622)

This commit is contained in:
Kaev
2020-02-03 07:52:27 +01:00
committed by GitHub
parent 8cfdfd0af0
commit 2fa9f5c249
30 changed files with 148 additions and 229 deletions
+2 -2
View File
@@ -115,8 +115,8 @@ namespace VMAP
iTilesY = other.iTilesY; iTilesY = other.iTilesY;
iCorner = other.iCorner; iCorner = other.iCorner;
iType = other.iType; iType = other.iType;
delete iHeight; delete[] iHeight;
delete iFlags; delete[] iFlags;
if (other.iHeight) if (other.iHeight)
{ {
iHeight = new float[(iTilesX+1)*(iTilesY+1)]; iHeight = new float[(iTilesX+1)*(iTilesY+1)];
+1 -1
View File
@@ -171,7 +171,7 @@ std::list<std::string> ConfigMgr::GetKeysByString(std::string const& name)
{ {
std::string temp = key_name.c_str(); std::string temp = key_name.c_str();
if (!temp.find(name)) if (temp.find(name) != std::string::npos)
keys.push_back(temp); keys.push_back(temp);
} }
} }
+1 -1
View File
@@ -661,6 +661,6 @@ void CalendarMgr::SendPacketToAllEventRelatives(WorldPacket packet, CalendarEven
CalendarInviteStore invites = _invites[calendarEvent.GetEventId()]; CalendarInviteStore invites = _invites[calendarEvent.GetEventId()];
for (CalendarInviteStore::iterator itr = invites.begin(); itr != invites.end(); ++itr) for (CalendarInviteStore::iterator itr = invites.begin(); itr != invites.end(); ++itr)
if (Player* player = ObjectAccessor::FindPlayerInOrOutOfWorld((*itr)->GetInviteeGUID())) 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); player->SendDirectMessage(&packet);
} }
+1 -1
View File
@@ -790,7 +790,7 @@ void Channel::Say(uint64 guid, std::string const& what, uint32 lang)
Player* player = pinfo.plrPtr; 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; uint32 speakDelay = 0;
if (_channelRights.speakDelay > 0) if (_channelRights.speakDelay > 0)
+2 -2
View File
@@ -321,7 +321,7 @@ bool ChatHandler::ExecuteCommandInTable(std::vector<ChatCommand> const& table, c
fullcmd.c_str(), player->GetName().c_str(), GUID_LOPART(player->GetGUID()), fullcmd.c_str(), player->GetName().c_str(), GUID_LOPART(player->GetGUID()),
m_session->GetAccountId(), player->GetPositionX(), player->GetPositionY(), m_session->GetAccountId(), player->GetPositionX(), player->GetPositionY(),
player->GetPositionZ(), player->GetMapId(), player->GetPositionZ(), player->GetMapId(),
player->GetMap() ? player->GetMap()->GetMapName() : "Unknown", player->GetMap()->GetMapName(),
areaId, areaName.c_str(), zoneName.c_str(), areaId, areaName.c_str(), zoneName.c_str(),
(player->GetSelectedUnit()) ? player->GetSelectedUnit()->GetName().c_str() : "", (player->GetSelectedUnit()) ? player->GetSelectedUnit()->GetName().c_str() : "",
GUID_LOPART(guid)); GUID_LOPART(guid));
@@ -998,7 +998,7 @@ GameTele const* ChatHandler::extractGameTeleFromLink(char* text)
return NULL; return NULL;
// id case (explicit or from shift link) // 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)) if (uint32 id = atoi(cId))
return sObjectMgr->GetGameTele(id); return sObjectMgr->GetGameTele(id);
+2 -13
View File
@@ -1247,7 +1247,8 @@ bool ConditionMgr::addToSpellImplicitTargetConditions(Condition* cond)
if (!assigned) if (!assigned)
delete sharedList; delete sharedList;
} }
sharedList->push_back(cond); if (sharedList)
sharedList->push_back(cond);
break; break;
} }
} }
@@ -1566,18 +1567,6 @@ bool ConditionMgr::isSourceTypeValid(Condition* cond)
} }
break; break;
case CONDITION_SOURCE_TYPE_VEHICLE_SPELL: 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: case CONDITION_SOURCE_TYPE_SPELL_CLICK_EVENT:
if (!sObjectMgr->GetCreatureTemplate(cond->SourceGroup)) if (!sObjectMgr->GetCreatureTemplate(cond->SourceGroup))
{ {
+1 -1
View File
@@ -172,7 +172,7 @@ uint8 LFGQueue::FindGroups()
{ {
//sLog->outString("FIND GROUPS!"); //sLog->outString("FIND GROUPS!");
uint8 newGroupsProcessed = 0; uint8 newGroupsProcessed = 0;
while (!newToQueueStore.empty()) if (!newToQueueStore.empty())
{ {
++newGroupsProcessed; ++newGroupsProcessed;
uint64 newGuid = newToQueueStore.front(); uint64 newGuid = newToQueueStore.front();
@@ -365,7 +365,7 @@ bool Creature::InitEntry(uint32 Entry, const CreatureData* data)
// Load creature equipment // Load creature equipment
if (!data || data->equipmentId == 0) // use default from the template if (!data || data->equipmentId == 0) // use default from the template
LoadEquipment(); LoadEquipment();
else if (data && data->equipmentId != 0) // override, 0 means no equipment else
{ {
m_originalEquipmentId = data->equipmentId; m_originalEquipmentId = data->equipmentId;
LoadEquipment(data->equipmentId); LoadEquipment(data->equipmentId);
+29 -44
View File
@@ -214,9 +214,8 @@ void PlayerMenu::SendGossipMenu(uint32 titleTextId, uint64 objectGUID) const
std::string title = quest->GetTitle(); std::string title = quest->GetTitle();
int32 locale = _session->GetSessionDbLocaleIndex(); int32 locale = _session->GetSessionDbLocaleIndex();
if (locale >= 0) if (QuestLocale const* localeData = sObjectMgr->GetQuestLocale(questID))
if (QuestLocale const* localeData = sObjectMgr->GetQuestLocale(questID)) ObjectMgr::GetLocaleString(localeData->Title, locale, title);
ObjectMgr::GetLocaleString(localeData->Title, locale, title);
data << title; data << title;
} }
} }
@@ -241,9 +240,8 @@ void PlayerMenu::SendPointOfInterest(uint32 poiId) const
std::string name = poi->Name; std::string name = poi->Name;
int32 locale = _session->GetSessionDbLocaleIndex(); int32 locale = _session->GetSessionDbLocaleIndex();
if (locale >= 0) if (PointOfInterestLocale const* localeData = sObjectMgr->GetPointOfInterestLocale(poiId))
if (PointOfInterestLocale const* localeData = sObjectMgr->GetPointOfInterestLocale(poiId)) ObjectMgr::GetLocaleString(localeData->Name, locale, name);
ObjectMgr::GetLocaleString(localeData->Name, locale, name);
WorldPacket data(SMSG_GOSSIP_POI, 4 + 4 + 4 + 4 + 4 + 20); // guess size WorldPacket data(SMSG_GOSSIP_POI, 4 + 4 + 4 + 4 + 4 + 20); // guess size
data << uint32(poi->Flags); data << uint32(poi->Flags);
@@ -322,9 +320,8 @@ void PlayerMenu::SendQuestGiverQuestList(QEmote const& eEmote, const std::string
std::string title = quest->GetTitle(); std::string title = quest->GetTitle();
int32 locale = _session->GetSessionDbLocaleIndex(); int32 locale = _session->GetSessionDbLocaleIndex();
if (locale >= 0) if (QuestLocale const* localeData = sObjectMgr->GetQuestLocale(questID))
if (QuestLocale const* localeData = sObjectMgr->GetQuestLocale(questID)) ObjectMgr::GetLocaleString(localeData->Title, locale, title);
ObjectMgr::GetLocaleString(localeData->Title, locale, title);
data << uint32(questID); data << uint32(questID);
data << uint32(qmi.QuestIcon); data << uint32(qmi.QuestIcon);
@@ -362,16 +359,13 @@ void PlayerMenu::SendQuestGiverQuestDetails(Quest const* quest, uint64 npcGUID,
std::string questAreaDescription = quest->GetAreaDescription(); std::string questAreaDescription = quest->GetAreaDescription();
int32 locale = _session->GetSessionDbLocaleIndex(); 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->Title, locale, questTitle); ObjectMgr::GetLocaleString(localeData->Objectives, locale, questObjectives);
ObjectMgr::GetLocaleString(localeData->Details, locale, questDetails); ObjectMgr::GetLocaleString(localeData->AreaDescription, locale, questAreaDescription);
ObjectMgr::GetLocaleString(localeData->Objectives, locale, questObjectives); }
ObjectMgr::GetLocaleString(localeData->AreaDescription, locale, questAreaDescription);
}
}
WorldPacket data(SMSG_QUESTGIVER_QUEST_DETAILS, 500); // guess size WorldPacket data(SMSG_QUESTGIVER_QUEST_DETAILS, 500); // guess size
data << uint64(npcGUID); data << uint64(npcGUID);
@@ -474,19 +468,16 @@ void PlayerMenu::SendQuestQueryResponse(Quest const* quest) const
questObjectiveText[i] = quest->ObjectiveText[i]; questObjectiveText[i] = quest->ObjectiveText[i];
int32 locale = _session->GetSessionDbLocaleIndex(); 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->Title, locale, questTitle); ObjectMgr::GetLocaleString(localeData->Objectives, locale, questObjectives);
ObjectMgr::GetLocaleString(localeData->Details, locale, questDetails); ObjectMgr::GetLocaleString(localeData->AreaDescription, locale, questAreaDescription);
ObjectMgr::GetLocaleString(localeData->Objectives, locale, questObjectives); ObjectMgr::GetLocaleString(localeData->CompletedText, locale, questCompletedText);
ObjectMgr::GetLocaleString(localeData->AreaDescription, locale, questAreaDescription);
ObjectMgr::GetLocaleString(localeData->CompletedText, locale, questCompletedText);
for (uint8 i = 0; i < QUEST_OBJECTIVES_COUNT; ++i) for (uint8 i = 0; i < QUEST_OBJECTIVES_COUNT; ++i)
ObjectMgr::GetLocaleString(localeData->ObjectiveText[i], locale, questObjectiveText[i]); ObjectMgr::GetLocaleString(localeData->ObjectiveText[i], locale, questObjectiveText[i]);
}
} }
WorldPacket data(SMSG_QUEST_QUERY_RESPONSE, 100); // guess size 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(); std::string RewardText = quest->GetOfferRewardText();
int32 locale = _session->GetSessionDbLocaleIndex(); 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())) if (QuestOfferRewardLocale const* questOfferRewardLocale = sObjectMgr->GetQuestOfferRewardLocale(quest->GetQuestId()))
ObjectMgr::GetLocaleString(questOfferRewardLocale->RewardText, locale, RewardText); ObjectMgr::GetLocaleString(questOfferRewardLocale->RewardText, locale, RewardText);
}
WorldPacket data(SMSG_QUESTGIVER_OFFER_REWARD, 400); // guess size WorldPacket data(SMSG_QUESTGIVER_OFFER_REWARD, 400); // guess size
data << uint64(npcGUID); data << uint64(npcGUID);
@@ -699,14 +687,11 @@ void PlayerMenu::SendQuestGiverRequestItems(Quest const* quest, uint64 npcGUID,
std::string requestItemsText = quest->GetRequestItemsText(); std::string requestItemsText = quest->GetRequestItemsText();
int32 locale = _session->GetSessionDbLocaleIndex(); 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())) if (QuestRequestItemsLocale const* questRequestItemsLocale = sObjectMgr->GetQuestRequestItemsLocale(quest->GetQuestId()))
ObjectMgr::GetLocaleString(questRequestItemsLocale->CompletionText, locale, requestItemsText); ObjectMgr::GetLocaleString(questRequestItemsLocale->CompletionText, locale, requestItemsText);
}
if (!quest->GetReqItemsCount() && canComplete) if (!quest->GetReqItemsCount() && canComplete)
{ {
@@ -85,7 +85,7 @@ void TempSummon::Update(uint32 diff)
case TEMPSUMMON_CORPSE_DESPAWN: case TEMPSUMMON_CORPSE_DESPAWN:
{ {
// if m_deathState is DEAD, CORPSE was skipped // if m_deathState is DEAD, CORPSE was skipped
if (m_deathState == CORPSE || m_deathState == DEAD) if (m_deathState == CORPSE)
{ {
UnSummon(); UnSummon();
return; return;
@@ -95,17 +95,12 @@ void TempSummon::Update(uint32 diff)
} }
case TEMPSUMMON_DEAD_DESPAWN: case TEMPSUMMON_DEAD_DESPAWN:
{ {
if (m_deathState == DEAD)
{
UnSummon();
return;
}
break; break;
} }
case TEMPSUMMON_TIMED_OR_CORPSE_DESPAWN: case TEMPSUMMON_TIMED_OR_CORPSE_DESPAWN:
{ {
// if m_deathState is DEAD, CORPSE was skipped // if m_deathState is DEAD, CORPSE was skipped
if (m_deathState == CORPSE || m_deathState == DEAD) if (m_deathState == CORPSE)
{ {
UnSummon(); UnSummon();
return; return;
@@ -127,13 +122,6 @@ void TempSummon::Update(uint32 diff)
} }
case TEMPSUMMON_TIMED_OR_DEAD_DESPAWN: case TEMPSUMMON_TIMED_OR_DEAD_DESPAWN:
{ {
// if m_deathState is DEAD, CORPSE was skipped
if (m_deathState == DEAD)
{
UnSummon();
return;
}
if (!IsInCombat() && IsAlive()) if (!IsInCombat() && IsAlive())
{ {
if (m_timer <= diff) if (m_timer <= diff)
+21 -21
View File
@@ -1,4 +1,4 @@
/* /*
* Copyright (C) 2016+ AzerothCore <www.azerothcore.org>, released under GNU GPL v2 license: https://github.com/azerothcore/azerothcore-wotlk/blob/master/LICENSE-GPL2 * Copyright (C) 2016+ AzerothCore <www.azerothcore.org>, released under GNU GPL v2 license: https://github.com/azerothcore/azerothcore-wotlk/blob/master/LICENSE-GPL2
* Copyright (C) 2008-2016 TrinityCore <http://www.trinitycore.org/> * Copyright (C) 2008-2016 TrinityCore <http://www.trinitycore.org/>
* Copyright (C) 2005-2009 MaNGOS <http://getmangos.com/> * Copyright (C) 2005-2009 MaNGOS <http://getmangos.com/>
@@ -443,7 +443,7 @@ void Pet::Update(uint32 diff)
if (IsWithinLOSInMap(tempspellTarget) && GetDistance(tempspellTarget) < max_range) if (IsWithinLOSInMap(tempspellTarget) && GetDistance(tempspellTarget) < max_range)
{ {
if (tempspellTarget && !GetCharmInfo()->GetGlobalCooldownMgr().HasGlobalCooldown(spellInfo) && !HasSpellCooldown(tempspell)) if (!GetCharmInfo()->GetGlobalCooldownMgr().HasGlobalCooldown(spellInfo) && !HasSpellCooldown(tempspell))
{ {
StopMoving(); StopMoving();
GetMotionMaster()->Clear(false); GetMotionMaster()->Clear(false);
@@ -711,8 +711,8 @@ bool Guardian::InitStatsForLevel(uint8 petlevel)
SetLevel(petlevel); SetLevel(petlevel);
SetCanModifyStats(true); SetCanModifyStats(true);
Unit *m_owner = GetOwner(); Unit *owner = GetOwner();
if (!m_owner) // just to be sure, asynchronous now if (!owner) // just to be sure, asynchronous now
{ {
DespawnOrUnsummon(1000); DespawnOrUnsummon(1000);
return false; return false;
@@ -720,20 +720,20 @@ bool Guardian::InitStatsForLevel(uint8 petlevel)
//Determine pet type //Determine pet type
PetType petType = MAX_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 || if (owner->getClass() == CLASS_WARLOCK ||
m_owner->getClass() == CLASS_SHAMAN || // Fire Elemental owner->getClass() == CLASS_SHAMAN || // Fire Elemental
m_owner->getClass() == CLASS_DEATH_KNIGHT || // Risen Ghoul owner->getClass() == CLASS_DEATH_KNIGHT || // Risen Ghoul
m_owner->getClass() == CLASS_MAGE) // Water Elemental with glyph owner->getClass() == CLASS_MAGE) // Water Elemental with glyph
petType = SUMMON_PET; petType = SUMMON_PET;
else if (m_owner->getClass() == CLASS_HUNTER) else if (owner->getClass() == CLASS_HUNTER)
{ {
petType = HUNTER_PET; petType = HUNTER_PET;
m_unitTypeMask |= UNIT_MASK_HUNTER_PET; m_unitTypeMask |= UNIT_MASK_HUNTER_PET;
} }
else 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; 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)); SetModifierValue(UNIT_MOD_ARMOR, BASE_VALUE, float(petlevel*50));
uint32 attackTime = BASE_ATTACK_TIME; 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; attackTime = cinfo->BaseAttackTime;
SetAttackTime(BASE_ATTACK, attackTime); SetAttackTime(BASE_ATTACK, attackTime);
@@ -796,8 +796,8 @@ bool Guardian::InitStatsForLevel(uint8 petlevel)
// remove elite bonuses included in DB values // remove elite bonuses included in DB values
CreatureBaseStats const* stats = sObjectMgr->GetCreatureBaseStats(petlevel, cinfo->unit_class); CreatureBaseStats const* stats = sObjectMgr->GetCreatureBaseStats(petlevel, cinfo->unit_class);
// xinef: multiply base values by creature_template factors! // xinef: multiply base values by creature_template factors!
float factorHealth = m_owner->GetTypeId() == TYPEID_PLAYER ? std::min(1.0f, cinfo->ModHealth) : cinfo->ModHealth; float factorHealth = 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 factorMana = owner->GetTypeId() == TYPEID_PLAYER ? std::min(1.0f, cinfo->ModMana) : cinfo->ModMana;
SetCreateHealth(std::max<uint32>(1, stats->BaseHealth[cinfo->expansion]*factorHealth)); SetCreateHealth(std::max<uint32>(1, stats->BaseHealth[cinfo->expansion]*factorHealth));
SetModifierValue(UNIT_MOD_HEALTH, BASE_VALUE, GetCreateHealth()); SetModifierValue(UNIT_MOD_HEALTH, BASE_VALUE, GetCreateHealth());
@@ -840,7 +840,7 @@ bool Guardian::InitStatsForLevel(uint8 petlevel)
case NPC_FELGUARD: case NPC_FELGUARD:
{ {
// xinef: Glyph of Felguard, so ugly im crying... no appropriate spell // 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)); SetModifierValue(UNIT_MOD_ATTACK_POWER, TOTAL_PCT, 1.0f + float(aurEff->GetAmount() / 100.0f));
break; break;
@@ -972,7 +972,7 @@ bool Guardian::InitStatsForLevel(uint8 petlevel)
} }
case NPC_MIRROR_IMAGE: // Mirror Image case NPC_MIRROR_IMAGE: // Mirror Image
{ {
SetDisplayId(m_owner->GetDisplayId()); SetDisplayId(owner->GetDisplayId());
if (!pInfo) if (!pInfo)
{ {
SetCreateMana(28 + 30*petlevel); SetCreateMana(28 + 30*petlevel);
@@ -1007,8 +1007,8 @@ bool Guardian::InitStatsForLevel(uint8 petlevel)
AddAura(SPELL_HUNTER_PET_SCALING_04, this); AddAura(SPELL_HUNTER_PET_SCALING_04, this);
AddAura(SPELL_PET_AVOIDANCE, this); AddAura(SPELL_PET_AVOIDANCE, this);
SetCreateHealth(4 * petlevel); SetCreateHealth(4 * petlevel);
SetBaseWeaponDamage(BASE_ATTACK, MINDAMAGE, 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) + m_owner->GetTotalAttackPowerValue(BASE_ATTACK) * 0.006f)); SetBaseWeaponDamage(BASE_ATTACK, MAXDAMAGE, float(petlevel - 30 + (petlevel / 4) + owner->GetTotalAttackPowerValue(BASE_ATTACK) * 0.006f));
SetReactState(REACT_DEFENSIVE); SetReactState(REACT_DEFENSIVE);
break; break;
} }
@@ -1043,12 +1043,12 @@ bool Guardian::InitStatsForLevel(uint8 petlevel)
SetPower(POWER_ENERGY, GetMaxPower(POWER_ENERGY)); SetPower(POWER_ENERGY, GetMaxPower(POWER_ENERGY));
// xinef: fixes orc death knight command racial // xinef: fixes orc death knight command racial
if (m_owner->getRace() == RACE_ORC) if (owner->getRace() == RACE_ORC)
CastSpell(this, SPELL_ORC_RACIAL_COMMAND, true, NULL, NULL, m_owner->GetGUID()); CastSpell(this, SPELL_ORC_RACIAL_COMMAND, true, NULL, NULL, owner->GetGUID());
// Avoidance, Night of the Dead // Avoidance, Night of the Dead
if (Aura *aur = AddAura(SPELL_NIGHT_OF_THE_DEAD_AVOIDANCE, this)) 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)) if (aur->GetEffect(0))
aur->GetEffect(0)->SetAmount(-aurEff->GetSpellInfo()->Effects[EFFECT_2].CalcValue()); aur->GetEffect(0)->SetAmount(-aurEff->GetSpellInfo()->Effects[EFFECT_2].CalcValue());
+11 -28
View File
@@ -7794,7 +7794,7 @@ bool Player::IsOutdoorPvPActive()
void Player::DuelComplete(DuelCompleteType type) void Player::DuelComplete(DuelCompleteType type)
{ {
// duel not requested // duel not requested
if (!duel) if (!duel || !duel->opponent || !duel->initiator)
return; return;
#if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS) #if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS)
@@ -7845,7 +7845,7 @@ void Player::DuelComplete(DuelCompleteType type)
duel->opponent->CastSpell(duel->opponent, 52994, true); duel->opponent->CastSpell(duel->opponent, 52994, true);
// Honor points after duel (the winner) - ImpConfig // 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); duel->opponent->RewardHonor(NULL, 1, amount);
break; break;
@@ -8089,10 +8089,6 @@ void Player::_ApplyItemBonuses(ItemTemplate const* proto, uint8 slot, bool apply
ApplyRatingMod(CR_HIT_TAKEN_SPELL, int32(val), apply); ApplyRatingMod(CR_HIT_TAKEN_SPELL, int32(val), apply);
break; break;
case ITEM_MOD_CRIT_TAKEN_RATING: 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: case ITEM_MOD_RESILIENCE_RATING:
ApplyRatingMod(CR_CRIT_TAKEN_MELEE, int32(val), apply); ApplyRatingMod(CR_CRIT_TAKEN_MELEE, int32(val), apply);
ApplyRatingMod(CR_CRIT_TAKEN_RANGED, 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; slots[0] = EQUIPMENT_SLOT_BODY;
break; break;
case INVTYPE_CHEST: case INVTYPE_CHEST:
slots[0] = EQUIPMENT_SLOT_CHEST;
break;
case INVTYPE_ROBE: case INVTYPE_ROBE:
slots[0] = EQUIPMENT_SLOT_CHEST; slots[0] = EQUIPMENT_SLOT_CHEST;
break; break;
@@ -10242,9 +10236,13 @@ uint8 Player::FindEquipSlot(ItemTemplate const* proto, uint32 slot, bool swap) c
break; break;
} }
case INVTYPE_SHIELD: case INVTYPE_SHIELD:
case INVTYPE_WEAPONOFFHAND:
case INVTYPE_HOLDABLE:
slots[0] = EQUIPMENT_SLOT_OFFHAND; slots[0] = EQUIPMENT_SLOT_OFFHAND;
break; break;
case INVTYPE_RANGED: case INVTYPE_RANGED:
case INVTYPE_RANGEDRIGHT:
case INVTYPE_THROWN:
slots[0] = EQUIPMENT_SLOT_RANGED; slots[0] = EQUIPMENT_SLOT_RANGED;
break; break;
case INVTYPE_2HWEAPON: case INVTYPE_2HWEAPON:
@@ -10278,18 +10276,6 @@ uint8 Player::FindEquipSlot(ItemTemplate const* proto, uint32 slot, bool swap) c
case INVTYPE_WEAPONMAINHAND: case INVTYPE_WEAPONMAINHAND:
slots[0] = EQUIPMENT_SLOT_MAINHAND; slots[0] = EQUIPMENT_SLOT_MAINHAND;
break; 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: case INVTYPE_BAG:
slots[0] = INVENTORY_SLOT_BAG_START + 0; slots[0] = INVENTORY_SLOT_BAG_START + 0;
slots[1] = INVENTORY_SLOT_BAG_START + 1; slots[1] = INVENTORY_SLOT_BAG_START + 1;
@@ -12491,14 +12477,11 @@ void Player::SetAmmo(uint32 item)
return; return;
// check ammo // check ammo
if (item) InventoryResult msg = CanUseAmmo(item);
if (msg != EQUIP_ERR_OK)
{ {
InventoryResult msg = CanUseAmmo(item); SendEquipError(msg, NULL, NULL, item);
if (msg != EQUIP_ERR_OK) return;
{
SendEquipError(msg, NULL, NULL, item);
return;
}
} }
SetUInt32Value(PLAYER_AMMO_ID, item); 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(); Bag* bag = pDstItem->ToBag();
for (uint32 i = 0; i < bag->GetBagSize(); ++i) for (uint32 i = 0; i < bag->GetBagSize(); ++i)
@@ -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 // PLAYER see his team only and PLAYER can't see MODERATOR, GAME MASTER, ADMINISTRATOR characters
// MODERATOR, GAME MASTER, ADMINISTRATOR can see all // 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; friendInfo.Status = FRIEND_STATUS_ONLINE;
if (pFriend->isAFK()) if (pFriend->isAFK())
+10 -10
View File
@@ -104,37 +104,37 @@ void Totem::UnSummon(uint32 msTime)
CombatStop(); CombatStop();
RemoveAurasDueToSpell(GetSpell(), GetGUID()); RemoveAurasDueToSpell(GetSpell(), GetGUID());
Unit *m_owner = GetOwner(); Unit *owner = GetOwner();
// clear owner's totem slot // clear owner's totem slot
for (uint8 i = SUMMON_SLOT_TOTEM; i < MAX_TOTEM_SLOT; ++i) 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; break;
} }
} }
m_owner->RemoveAurasDueToSpell(GetSpell(), GetGUID()); owner->RemoveAurasDueToSpell(GetSpell(), GetGUID());
// Remove Sentry Totem Aura // Remove Sentry Totem Aura
if (GetEntry() == SENTRY_TOTEM_ENTRY) if (GetEntry() == SENTRY_TOTEM_ENTRY)
m_owner->RemoveAurasDueToSpell(SENTRY_TOTEM_SPELLID); owner->RemoveAurasDueToSpell(SENTRY_TOTEM_SPELLID);
//remove aura all party members too //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))) 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()) for (GroupReference* itr = group->GetFirstMember(); itr != NULL; itr = itr->next())
{ {
Player* target = itr->GetSource(); 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()); target->RemoveAurasDueToSpell(GetSpell(), GetGUID());
} }
} }
+3 -17
View File
@@ -333,8 +333,6 @@ void Player::UpdateAttackPowerAndDamage(bool ranged)
val2 = level * 2.0f + GetStat(STAT_AGILITY) - 10.0f; val2 = level * 2.0f + GetStat(STAT_AGILITY) - 10.0f;
break; break;
case CLASS_ROGUE: case CLASS_ROGUE:
val2 = level + GetStat(STAT_AGILITY) - 10.0f;
break;
case CLASS_WARRIOR: case CLASS_WARRIOR:
val2 = level + GetStat(STAT_AGILITY) - 10.0f; val2 = level + GetStat(STAT_AGILITY) - 10.0f;
break; break;
@@ -356,22 +354,14 @@ void Player::UpdateAttackPowerAndDamage(bool ranged)
{ {
switch (getClass()) switch (getClass())
{ {
case CLASS_PALADIN:
case CLASS_DEATH_KNIGHT:
case CLASS_WARRIOR: case CLASS_WARRIOR:
val2 = level * 3.0f + GetStat(STAT_STRENGTH) * 2.0f - 20.0f; val2 = level * 3.0f + GetStat(STAT_STRENGTH) * 2.0f - 20.0f;
break; 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: case CLASS_HUNTER:
val2 = level * 2.0f + GetStat(STAT_STRENGTH) + GetStat(STAT_AGILITY) - 20.0f;
break;
case CLASS_SHAMAN: case CLASS_SHAMAN:
case CLASS_ROGUE:
val2 = level * 2.0f + GetStat(STAT_STRENGTH) + GetStat(STAT_AGILITY) - 20.0f; val2 = level * 2.0f + GetStat(STAT_STRENGTH) + GetStat(STAT_AGILITY) - 20.0f;
break; break;
case CLASS_DRUID: case CLASS_DRUID:
@@ -457,11 +447,7 @@ void Player::UpdateAttackPowerAndDamage(bool ranged)
break; break;
} }
case CLASS_MAGE: case CLASS_MAGE:
val2 = GetStat(STAT_STRENGTH) - 10.0f;
break;
case CLASS_PRIEST: case CLASS_PRIEST:
val2 = GetStat(STAT_STRENGTH) - 10.0f;
break;
case CLASS_WARLOCK: case CLASS_WARLOCK:
val2 = GetStat(STAT_STRENGTH) - 10.0f; val2 = GetStat(STAT_STRENGTH) - 10.0f;
break; break;
+14 -19
View File
@@ -1297,8 +1297,6 @@ void Unit::CalculateMeleeDamage(Unit* victim, uint32 damage, CalcDamageInfo* dam
damageInfo->TargetState = VICTIMSTATE_IS_IMMUNE; damageInfo->TargetState = VICTIMSTATE_IS_IMMUNE;
damageInfo->procEx |= PROC_EX_IMMUNE; damageInfo->procEx |= PROC_EX_IMMUNE;
damageInfo->damage = 0;
damageInfo->cleanDamage = 0;
return; 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 // 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 (IS_PLAYER_GUID(c->GetOwnerGUID()) && !c->CanFly())
{ {
if ((c->GetTransport() && !this->GetTransport()) || (!c->GetTransport() && this->GetTransport())) if (c->GetTransport() != this->GetTransport())
return false; return false;
if (this->GetTransport()) if (this->GetTransport())
{ {
@@ -6780,7 +6778,7 @@ bool Unit::HandleDummyAuraProc(Unit* victim, uint32 damage, AuraEffect* triggere
case 70664: case 70664:
{ {
// xinef: proc only from normal Rejuvenation, and proc rejuvenation // xinef: proc only from normal Rejuvenation, and proc rejuvenation
if (!victim || procSpell->SpellIconID != 64) if (!victim || !procSpell || procSpell->SpellIconID != 64)
return false; return false;
Player* caster = ToPlayer(); Player* caster = ToPlayer();
@@ -6989,13 +6987,8 @@ bool Unit::HandleDummyAuraProc(Unit* victim, uint32 damage, AuraEffect* triggere
basepoints0 = int32(damage); basepoints0 = int32(damage);
triggered_spell_id = procSpell->IsRankOf(sSpellMgr->GetSpellInfo(635)) ? 53652 : 53654; 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;
victim->CastCustomSpell(beaconTarget, triggered_spell_id, &basepoints0, NULL, NULL, true, 0, triggeredByAura, victim->GetGUID());
return true;
}
return false;
} }
// Judgements of the Wise // Judgements of the Wise
if (dummySpell->SpellIconID == 3017) if (dummySpell->SpellIconID == 3017)
@@ -7569,6 +7562,9 @@ bool Unit::HandleDummyAuraProc(Unit* victim, uint32 damage, AuraEffect* triggere
// Improved Water Shield // Improved Water Shield
if (dummySpell->SpellIconID == 2287) if (dummySpell->SpellIconID == 2287)
{ {
if (!procSpell)
return false;
// Default chance for Healing Wave and Riptide // Default chance for Healing Wave and Riptide
float chance = (float)triggeredByAura->GetAmount(); 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 15337: // Improved Spirit Tap (Rank 1)
case 15338: // Improved Spirit Tap (Rank 2) case 15338: // Improved Spirit Tap (Rank 2)
{ {
if (!procSpell)
return false;
if (procSpell->SpellFamilyFlags[0] & 0x800000) if (procSpell->SpellFamilyFlags[0] & 0x800000)
if ((procSpell->Id != 58381) || !roll_chance_i(50)) if ((procSpell->Id != 58381) || !roll_chance_i(50))
return false; return false;
@@ -8982,7 +8981,7 @@ bool Unit::HandleProcTriggerSpell(Unit* victim, uint32 damage, AuraEffect* trigg
// try detect target manually if not set // try detect target manually if not set
if (target == NULL) 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) if (cooldown)
{ {
@@ -15277,10 +15276,6 @@ void Unit::ProcDamageAndSpellFor(bool isVictim, Unit* target, uint32 procFlag, u
takeCharges = true; takeCharges = true;
break; break;
case SPELL_AURA_MECHANIC_IMMUNITY: case SPELL_AURA_MECHANIC_IMMUNITY:
// Compare mechanic
if (procSpell && procSpell->Mechanic == uint32(triggeredByAura->GetMiscValue()))
takeCharges = true;
break;
case SPELL_AURA_MOD_MECHANIC_RESISTANCE: case SPELL_AURA_MOD_MECHANIC_RESISTANCE:
// Compare mechanic // Compare mechanic
if (procSpell && procSpell->Mechanic == uint32(triggeredByAura->GetMiscValue())) 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 // 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 // mainly for DoTs which are 3500 here otherwise
uint32 OriginalCastTime = spellProto->CalcCastTime(); uint32 OriginalCastTime = spellProto->CalcCastTime();
@@ -17264,7 +17259,7 @@ void Unit::RemoveCharmedBy(Unit* charmer)
if (Creature* creature = ToCreature()) if (Creature* creature = ToCreature())
{ {
// Vehicle should not attack its passenger after he exists the seat // 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)) if (Attack(charmer, true))
GetMotionMaster()->MoveChase(charmer); GetMotionMaster()->MoveChase(charmer);
@@ -18132,7 +18127,7 @@ bool Unit::HandleSpellClick(Unit* clicker, int8 seatId)
{ {
uint8 i = 0; uint8 i = 0;
bool valid = false; bool valid = false;
while (i < MAX_SPELL_EFFECTS && !valid) while (i < MAX_SPELL_EFFECTS)
{ {
if (spellEntry->Effects[i].ApplyAuraName == SPELL_AURA_CONTROL_VEHICLE) if (spellEntry->Effects[i].ApplyAuraName == SPELL_AURA_CONTROL_VEHICLE)
{ {
+1 -1
View File
@@ -365,7 +365,7 @@ bool Vehicle::AddPassenger(Unit* unit, int8 seatId)
} }
} }
if (!_me->IsInWorld() || _me->IsDuringRemoveFromWorld()) if (!_me || !_me->IsInWorld() || _me->IsDuringRemoveFromWorld())
return false; return false;
// Xinef: moved from unit.cpp, if aura passes seatId == -1 (choose automaticly) we wont get appropriate flags // Xinef: moved from unit.cpp, if aura passes seatId == -1 (choose automaticly) we wont get appropriate flags
+4 -4
View File
@@ -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 ")", sLog->outError("GameEventMgr::GameEventSpawn attempt access to out of range mGameEventGameobjectGuids element %i (size: " SZFMTD ")",
internal_event_id, mGameEventGameobjectGuids.size()); 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 ")", sLog->outError("GameEventMgr::GameEventSpawn attempt access to out of range mGameEventPoolIds element %u (size: " SZFMTD ")",
internal_event_id, mGameEventPoolIds.size()); 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 ")", sLog->outError("GameEventMgr::GameEventUnspawn attempt access to out of range mGameEventGameobjectGuids element %i (size: " SZFMTD ")",
internal_event_id, mGameEventGameobjectGuids.size()); internal_event_id, mGameEventGameobjectGuids.size());
@@ -1392,7 +1392,7 @@ void GameEventMgr::GameEventUnspawn(int16 event_id)
pGameobject->AddObjectToRemoveList(); 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()); sLog->outError("GameEventMgr::GameEventUnspawn attempt access to out of range mGameEventPoolIds element %u (size: " SZFMTD ")", internal_event_id, mGameEventPoolIds.size());
return; return;
+1 -1
View File
@@ -1748,7 +1748,7 @@ void ObjectMgr::LoadCreatures()
if (cInfo->flags_extra & CREATURE_FLAG_EXTRA_INSTANCE_BIND) 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); 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);
} }
+17 -16
View File
@@ -349,6 +349,9 @@ Player* Group::GetInvited(const std::string& name) const
bool Group::AddMember(Player* player) bool Group::AddMember(Player* player)
{ {
if (!player)
return false;
// Get first not-full group // Get first not-full group
uint8 subGroup = 0; uint8 subGroup = 0;
if (m_subGroupsCounts) if (m_subGroupsCounts)
@@ -379,22 +382,19 @@ bool Group::AddMember(Player* player)
SubGroupCounterIncrease(subGroup); SubGroupCounterIncrease(subGroup);
if (player) player->SetGroupInvite(NULL);
if (player->GetGroup())
{ {
player->SetGroupInvite(NULL); if (isBGGroup() || isBFGroup()) // if player is in group and he is being added to BG raid group, then call SetBattlegroundRaid()
if (player->GetGroup()) player->SetBattlegroundOrBattlefieldRaid(this, subGroup);
{ else //if player is in bg raid and we are adding him to normal group, then call SetOriginalGroup()
if (isBGGroup() || isBFGroup()) // if player is in group and he is being added to BG raid group, then call SetBattlegroundRaid() player->SetOriginalGroup(this, subGroup);
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);
} }
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 if (!isRaidGroup()) // reset targetIcons for non-raid-groups
{ {
@@ -414,10 +414,11 @@ bool Group::AddMember(Player* player)
} }
SendUpdate(); SendUpdate();
sScriptMgr->OnGroupAddMember(this, player->GetGUID());
if (player) if (player)
{ {
sScriptMgr->OnGroupAddMember(this, player->GetGUID());
if (!IsLeader(player->GetGUID()) && !isBGGroup() && !isBFGroup()) if (!IsLeader(player->GetGUID()) && !isBGGroup() && !isBFGroup())
{ {
Player::ResetInstances(player->GetGUIDLow(), INSTANCE_RESET_GROUP_JOIN, false); 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 // 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(); ResetMaxEnchantingLevel();
// Remove player from loot rolls // Remove player from loot rolls
+2 -4
View File
@@ -2568,6 +2568,8 @@ void InstanceMap::InitVisibilityDistance()
switch (GetId()) switch (GetId())
{ {
case 429: // Dire Maul case 429: // Dire Maul
case 550: // The Eye
case 578: // The Nexus: The Oculus
m_VisibleDistance = 175.0f; m_VisibleDistance = 175.0f;
break; break;
case 649: // Trial of the Crusader case 649: // Trial of the Crusader
@@ -2576,10 +2578,6 @@ void InstanceMap::InitVisibilityDistance()
case 658: // Pit of Saron case 658: // Pit of Saron
m_VisibleDistance = 150.0f; m_VisibleDistance = 150.0f;
break; break;
case 550: // The Eye
case 578: // The Nexus: The Oculus
m_VisibleDistance = 175.0f;
break;
case 615: // Obsidian Sanctum case 615: // Obsidian Sanctum
case 616: // Eye of Eternity case 616: // Eye of Eternity
case 603: // Ulduar case 603: // Ulduar
@@ -526,10 +526,6 @@ int32 AuraEffect::CalculateAmount(Unit* caster)
switch (GetAuraType()) switch (GetAuraType())
{ {
case SPELL_AURA_PERIODIC_DAMAGE: 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: 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! // 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) if (GetBase()->GetType() == UNIT_AURA_TYPE)
@@ -257,6 +257,9 @@ public:
if (!handler->extractPlayerTarget((char*)args, &target)) if (!handler->extractPlayerTarget((char*)args, &target))
return false; return false;
if (!target)
return false;
LocaleConstant loc = handler->GetSessionDbcLocale(); LocaleConstant loc = handler->GetSessionDbcLocale();
char const* targetName = target->GetName().c_str(); char const* targetName = target->GetName().c_str();
char const* knownStr = handler->GetAcoreString(LANG_KNOWN); char const* knownStr = handler->GetAcoreString(LANG_KNOWN);
+5 -15
View File
@@ -298,24 +298,14 @@ public:
if (!pfactionid) if (!pfactionid)
{ {
if (target) uint32 factionid = target->getFaction();
{ uint32 flag = target->GetUInt32Value(UNIT_FIELD_FLAGS);
uint32 factionid = target->getFaction(); uint32 npcflag = target->GetUInt32Value(UNIT_NPC_FLAGS);
uint32 flag = target->GetUInt32Value(UNIT_FIELD_FLAGS); uint32 dyflag = target->GetUInt32Value(UNIT_DYNAMIC_FLAGS);
uint32 npcflag = target->GetUInt32Value(UNIT_NPC_FLAGS); handler->PSendSysMessage(LANG_CURRENT_FACTION, target->GetGUIDLow(), factionid, flag, npcflag, dyflag);
uint32 dyflag = target->GetUInt32Value(UNIT_DYNAMIC_FLAGS);
handler->PSendSysMessage(LANG_CURRENT_FACTION, target->GetGUIDLow(), factionid, flag, npcflag, dyflag);
}
return true; return true;
} }
if (!target)
{
handler->SendSysMessage(LANG_NO_CHAR_SELECTED);
handler->SetSentErrorMessage(true);
return false;
}
uint32 factionid = atoi(pfactionid); uint32 factionid = atoi(pfactionid);
uint32 flag; uint32 flag;
+1 -1
View File
@@ -295,7 +295,7 @@ public:
return false; 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())) if (!sObjectMgr->IsVendorItemValid(vendor_entry, itemId, maxcount, incrtime, extendedcost, handler->GetSession()->GetPlayer()))
{ {
@@ -411,7 +411,7 @@ public:
ElementalOne->SetInCombatWithZone(); ElementalOne->SetInCombatWithZone();
ElementalOne->CombatStart(target); ElementalOne->CombatStart(target);
ElementalOne->setFaction(me->getFaction()); ElementalOne->setFaction(me->getFaction());
ElementalTwo->SetUnitMovementFlags(MOVEMENTFLAG_ROOT); ElementalOne->SetUnitMovementFlags(MOVEMENTFLAG_ROOT);
ElementalOne->ApplySpellImmune(0, IMMUNITY_SCHOOL, SPELL_SCHOOL_MASK_FROST, true); ElementalOne->ApplySpellImmune(0, IMMUNITY_SCHOOL, SPELL_SCHOOL_MASK_FROST, true);
ElementalOne->SetModifierValue(UNIT_MOD_RESISTANCE_FROST, BASE_VALUE, 0); ElementalOne->SetModifierValue(UNIT_MOD_RESISTANCE_FROST, BASE_VALUE, 0);
} }
@@ -441,7 +441,7 @@ public:
ElementalThree->SetInCombatWithZone(); ElementalThree->SetInCombatWithZone();
ElementalThree->CombatStart(target); ElementalThree->CombatStart(target);
ElementalThree->setFaction(me->getFaction()); ElementalThree->setFaction(me->getFaction());
ElementalTwo->SetUnitMovementFlags(MOVEMENTFLAG_ROOT); ElementalThree->SetUnitMovementFlags(MOVEMENTFLAG_ROOT);
ElementalThree->ApplySpellImmune(0, IMMUNITY_SCHOOL, SPELL_SCHOOL_MASK_FROST, true); ElementalThree->ApplySpellImmune(0, IMMUNITY_SCHOOL, SPELL_SCHOOL_MASK_FROST, true);
ElementalThree->SetModifierValue(UNIT_MOD_RESISTANCE_FROST, BASE_VALUE, 0); ElementalThree->SetModifierValue(UNIT_MOD_RESISTANCE_FROST, BASE_VALUE, 0);
} }
@@ -456,7 +456,7 @@ public:
ElementalFour->SetInCombatWithZone(); ElementalFour->SetInCombatWithZone();
ElementalFour->CombatStart(target); ElementalFour->CombatStart(target);
ElementalFour->setFaction(me->getFaction()); ElementalFour->setFaction(me->getFaction());
ElementalTwo->SetUnitMovementFlags(MOVEMENTFLAG_ROOT); ElementalFour->SetUnitMovementFlags(MOVEMENTFLAG_ROOT);
ElementalFour->ApplySpellImmune(0, IMMUNITY_SCHOOL, SPELL_SCHOOL_MASK_FROST, true); ElementalFour->ApplySpellImmune(0, IMMUNITY_SCHOOL, SPELL_SCHOOL_MASK_FROST, true);
ElementalFour->SetModifierValue(UNIT_MOD_RESISTANCE_FROST, BASE_VALUE, 0); ElementalFour->SetModifierValue(UNIT_MOD_RESISTANCE_FROST, BASE_VALUE, 0);
} }
@@ -168,7 +168,7 @@ public:
break; break;
case GO_MASSIVE_DOOR: case GO_MASSIVE_DOOR:
m_uiMassiveDoor = go->GetGUID(); m_uiMassiveDoor = go->GetGUID();
if (GetBossState(DATA_ARAN) == !IN_PROGRESS) if (GetBossState(DATA_ARAN) != IN_PROGRESS)
go->SetFlag(GAMEOBJECT_FLAGS, GO_FLAG_LOCKED); go->SetFlag(GAMEOBJECT_FLAGS, GO_FLAG_LOCKED);
else else
go->RemoveFlag(GAMEOBJECT_FLAGS, GO_FLAG_LOCKED); go->RemoveFlag(GAMEOBJECT_FLAGS, GO_FLAG_LOCKED);
@@ -181,7 +181,7 @@ public:
break; break;
case GO_NETHERSPACE_DOOR: case GO_NETHERSPACE_DOOR:
m_uiNetherspaceDoor = go->GetGUID(); m_uiNetherspaceDoor = go->GetGUID();
if (GetBossState(DATA_PRINCE) == !IN_PROGRESS) if (GetBossState(DATA_PRINCE) != IN_PROGRESS)
go->SetFlag(GAMEOBJECT_FLAGS, GO_FLAG_LOCKED); go->SetFlag(GAMEOBJECT_FLAGS, GO_FLAG_LOCKED);
else else
go->RemoveFlag(GAMEOBJECT_FLAGS, GO_FLAG_LOCKED); go->RemoveFlag(GAMEOBJECT_FLAGS, GO_FLAG_LOCKED);
@@ -1261,7 +1261,8 @@ void npc_arthas::npc_arthasAI::ReorderInstance(uint32 data)
} }
else if (data == COS_PROGRESS_KILLED_SALRAMM) 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); DoAction(ACTION_KILLED_SALRAMM);
} }
break; break;
@@ -2015,7 +2015,7 @@ class at_hor_battered_hilt_throw : public AreaTriggerScript
if (InstanceScript* instance = player->GetInstanceScript()) if (InstanceScript* instance = player->GetInstanceScript())
{ {
uint32 bhd = instance->GetData(DATA_BATTERED_HILT); uint32 bhd = instance->GetData(DATA_BATTERED_HILT);
if (bhd == BHSF_NONE || bhd != BHSF_STARTED) if (bhd != BHSF_STARTED)
return true; return true;
player->CastSpell(player, 70698, true); player->CastSpell(player, 70698, true);
player->DestroyItemCount(49766, 1, true); player->DestroyItemCount(49766, 1, true);
@@ -129,6 +129,7 @@ public:
n2->GetMotionMaster()->MovePoint(1, NecrolytePos2); n2->GetMotionMaster()->MovePoint(1, NecrolytePos2);
n2->SetUInt32Value(UNIT_NPC_EMOTESTATE, EMOTE_STATE_READY1H); n2->SetUInt32Value(UNIT_NPC_EMOTESTATE, EMOTE_STATE_READY1H);
} }
// TODO This spell check is invalid
if (SPELL_NECROLYTE_CHANNELING) if (SPELL_NECROLYTE_CHANNELING)
{ {
n1->RemoveAura(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)) (me->GetPositionX() > 490.0f && me->GetPositionX() < 504.0f && me->GetPositionY() > 240.0f && me->GetPositionY() < 254.0f))
{ {
isInvincible = true; isInvincible = true;
// TODO This spell check is invalid
if (SPELL_NECROLYTE_CHANNELING) if (SPELL_NECROLYTE_CHANNELING)
me->CastSpell(me, SPELL_NECROLYTE_CHANNELING, false); me->CastSpell(me, SPELL_NECROLYTE_CHANNELING, false);
@@ -417,6 +420,7 @@ public:
void EnterCombat(Unit* /*who*/) void EnterCombat(Unit* /*who*/)
{ {
// TODO This spell check is invalid
if (SPELL_NECROLYTE_CHANNELING) if (SPELL_NECROLYTE_CHANNELING)
me->RemoveAura(SPELL_NECROLYTE_CHANNELING); me->RemoveAura(SPELL_NECROLYTE_CHANNELING);
events.Reset(); events.Reset();