diff --git a/src/world/Management/LootMgr.cpp b/src/world/Management/LootMgr.cpp index fa8d47b29..f7cd7f573 100644 --- a/src/world/Management/LootMgr.cpp +++ b/src/world/Management/LootMgr.cpp @@ -587,7 +587,11 @@ LootItem::LootItem(LootStoreItem const& li) itemId = li.itemId; itemproto = li.itemproto; count = Util::getRandomUInt(li.mincount, li.maxcount); - iRandomProperty = sLootMgr.GetRandomProperties(itemproto); + if (iRandomProperty = sLootMgr.GetRandomProperties(itemproto)) + is_ffa = itemproto->Flags & ITEM_FLAG_FREE_FOR_ALL; + else + is_ffa = false; + iRandomSuffix = sLootMgr.GetRandomSuffix(itemproto); roll = nullptr; @@ -595,7 +599,6 @@ LootItem::LootItem(LootStoreItem const& li) is_passed = false; is_looted = false; is_blocked = false; - is_ffa = itemproto && itemproto->Flags & ITEM_FLAG_FREE_FOR_ALL; is_underthreshold = false; needs_quest = li.needs_quest; } diff --git a/src/world/Objects/Units/Creatures/Creature.cpp b/src/world/Objects/Units/Creatures/Creature.cpp index e90683843..f9cada38c 100644 --- a/src/world/Objects/Units/Creatures/Creature.cpp +++ b/src/world/Objects/Units/Creatures/Creature.cpp @@ -661,17 +661,12 @@ void Creature::Update(unsigned long time_passed) { if (m_respawnTime <= now) respawn(); - } - break; + } break; case CORPSE: { - if (m_deathState != CORPSE) - break; - if (m_corpseRemoveTime <= now) OnRemoveCorpse(); - } - break; + } break; default: break; } @@ -1993,17 +1988,16 @@ void Creature::OnPushToWorld() if (m_spawn) { if (m_spawn->channel_target_creature) - { sEventMgr.AddEvent(this, &Creature::ChannelLinkUpCreature, m_spawn->channel_target_creature, EVENT_CREATURE_CHANNEL_LINKUP, 1000, 5, EVENT_FLAG_DO_NOT_EXECUTE_IN_WORLD_CONTEXT); // only 5 attempts - } if (m_spawn->channel_target_go) - { sEventMgr.AddEvent(this, &Creature::ChannelLinkUpGO, m_spawn->channel_target_go, EVENT_CREATURE_CHANNEL_LINKUP, 1000, 5, EVENT_FLAG_DO_NOT_EXECUTE_IN_WORLD_CONTEXT); // only 5 attempts - } } - m_aiInterface->m_is_in_instance = (!m_WorldMap->getBaseMap()->getMapInfo()->isNonInstanceMap()) ? true : false; + if (m_WorldMap) + m_aiInterface->m_is_in_instance = (!m_WorldMap->getBaseMap()->getMapInfo()->isNonInstanceMap()) ? true : false; + else + m_aiInterface->m_is_in_instance = false; if (this->HasItems()) { @@ -2022,9 +2016,7 @@ void Creature::OnPushToWorld() if (mEvent != nullptr) { if (mEvent->mEventScript != nullptr) - { mEvent->mEventScript->OnCreaturePushToWorld(mEvent, this); - } } if (m_WorldMap && m_WorldMap->getScript()) diff --git a/src/world/Objects/Units/Creatures/Summons/Summon.cpp b/src/world/Objects/Units/Creatures/Summons/Summon.cpp index ba03ea251..61daffd27 100644 --- a/src/world/Objects/Units/Creatures/Summons/Summon.cpp +++ b/src/world/Objects/Units/Creatures/Summons/Summon.cpp @@ -417,22 +417,30 @@ void TotemSummon::load(CreatureProperties const* creatureProperties, Unit* unitO { Summon::load(creatureProperties, unitOwner, position, duration, spellId); + const MySQLStructure::TotemDisplayIds* displayIds = nullptr; + // Summoner if (unitOwner) { setCreatedByGuid(unitOwner->getGuid()); setSummonedByGuid(unitOwner->getGuid()); setFaction(unitOwner->getFactionTemplate()); + + displayIds = sMySQLStore.getTotemDisplayId(unitOwner->getRace(), creature_properties->Male_DisplayID); + + setLevel(unitOwner->getLevel()); + } + else + { + setLevel(1); } uint32_t displayId; - const auto displayIds = sMySQLStore.getTotemDisplayId(unitOwner->getRace(), creature_properties->Male_DisplayID); if (displayIds != nullptr) displayId = displayIds->race_specific_id; else displayId = creature_properties->Male_DisplayID; - setLevel(unitOwner->getLevel()); setRace(0); setClass(1); // Creature class warrior setGender(GENDER_NONE); @@ -446,21 +454,24 @@ void TotemSummon::load(CreatureProperties const* creatureProperties, Unit* unitO setModCastSpeed(1.0f); setDynamicFlags(0); - for (uint8_t school = 0; school < TOTAL_SPELL_SCHOOLS; school++) + if (unitOwner) { - ModDamageDone[school] = unitOwner->GetDamageDoneMod(school); - m_healDoneMod[school] = unitOwner->m_healDoneMod[school]; - } + for (uint8_t school = 0; school < TOTAL_SPELL_SCHOOLS; school++) + { + ModDamageDone[school] = unitOwner->GetDamageDoneMod(school); + m_healDoneMod[school] = unitOwner->m_healDoneMod[school]; + } - m_aiInterface->Init(this, unitOwner); + m_aiInterface->Init(this, unitOwner); - setAItoUse(false); + setAItoUse(false); - if (unitOwner != nullptr && unitOwner->isPlayer()) - { - uint32_t slot = m_Properties->Slot; - if (slot >= SUMMON_SLOT_TOTEM_FIRE && slot < SUMMON_SLOT_MINIPET) - dynamic_cast(unitOwner)->sendTotemCreatedPacket(static_cast(slot - SUMMON_SLOT_TOTEM_FIRE), getGuid(), getTimeLeft(), getCreatedBySpellId()); + if (unitOwner->isPlayer()) + { + uint32_t slot = m_Properties->Slot; + if (slot >= SUMMON_SLOT_TOTEM_FIRE && slot < SUMMON_SLOT_MINIPET) + dynamic_cast(unitOwner)->sendTotemCreatedPacket(static_cast(slot - SUMMON_SLOT_TOTEM_FIRE), getGuid(), getTimeLeft(), getCreatedBySpellId()); + } } }