aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rwxr-xr-xsrc/server/game/Entities/Creature/Creature.cpp7
-rwxr-xr-xsrc/server/game/Entities/Creature/Creature.h14
-rwxr-xr-xsrc/server/game/Entities/Player/Player.cpp7
-rwxr-xr-xsrc/server/game/Globals/ObjectMgr.cpp54
4 files changed, 51 insertions, 31 deletions
diff --git a/src/server/game/Entities/Creature/Creature.cpp b/src/server/game/Entities/Creature/Creature.cpp
index f03aff46869..782a2a2aace 100755
--- a/src/server/game/Entities/Creature/Creature.cpp
+++ b/src/server/game/Entities/Creature/Creature.cpp
@@ -265,7 +265,6 @@ bool Creature::InitEntry(uint32 Entry, uint32 /*team*/, const CreatureData *data
}
// get difficulty 1 mode entry
- uint32 actualEntry = Entry;
CreatureInfo const *cinfo = normalInfo;
for (uint8 diff = uint8(GetMap()->GetSpawnMode()); diff > 0;)
{
@@ -2409,3 +2408,9 @@ void Creature::FarTeleportTo(Map* map, float X, float Y, float Z, float O)
SetPosition(X, Y, Z, O, true);
}
+
+bool Creature::IsDungeonBoss() const
+{
+ CreatureInfo const *cinfo = ObjectMgr::GetCreatureTemplate(GetEntry());
+ return cinfo && (cinfo->flags_extra & CREATURE_FLAG_EXTRA_DUNGEON_BOSS);
+}
diff --git a/src/server/game/Entities/Creature/Creature.h b/src/server/game/Entities/Creature/Creature.h
index 360522c4531..2cb9d6f859b 100755
--- a/src/server/game/Entities/Creature/Creature.h
+++ b/src/server/game/Entities/Creature/Creature.h
@@ -54,9 +54,15 @@ enum CreatureFlagsExtra
CREATURE_FLAG_EXTRA_NO_SKILLGAIN = 0x00040000, // creature won't increase weapon skills
CREATURE_FLAG_EXTRA_TAUNT_DIMINISH = 0x00080000, // Taunt is a subject to diminishing returns on this creautre
CREATURE_FLAG_EXTRA_ALL_DIMINISH = 0x00100000, // Creature is subject to all diminishing returns as player are
- CREATURE_FLAG_EXTRA_DUNGEON_BOSS = 0x00200000, // creature is a dungeon boss
+ CREATURE_FLAG_EXTRA_DUNGEON_BOSS = 0x10000000, // creature is a dungeon boss (SET DYNAMICALLY, DO NOT ADD IN DB)
};
+#define CREATURE_FLAG_EXTRA_DB_ALLOWED (CREATURE_FLAG_EXTRA_INSTANCE_BIND | CREATURE_FLAG_EXTRA_CIVILIAN | \
+ CREATURE_FLAG_EXTRA_NO_PARRY | CREATURE_FLAG_EXTRA_NO_PARRY_HASTEN | CREATURE_FLAG_EXTRA_NO_BLOCK | \
+ CREATURE_FLAG_EXTRA_NO_CRUSH | CREATURE_FLAG_EXTRA_NO_XP_AT_KILL | CREATURE_FLAG_EXTRA_TRIGGER | \
+ CREATURE_FLAG_EXTRA_NO_TAUNT | CREATURE_FLAG_EXTRA_WORLDEVENT | CREATURE_FLAG_EXTRA_NO_CRIT | \
+ CREATURE_FLAG_EXTRA_NO_SKILLGAIN | CREATURE_FLAG_EXTRA_TAUNT_DIMINISH | CREATURE_FLAG_EXTRA_ALL_DIMINISH)
+
// GCC have alternative #pragma pack(N) syntax and old gcc version not support pack(push,N), also any gcc version not support it at some platform
#if defined(__GNUC__)
#pragma pack(1)
@@ -472,6 +478,8 @@ class Creature : public Unit, public GridObject<Creature>
return GetCreatureInfo()->rank == CREATURE_ELITE_WORLDBOSS;
}
+ bool IsDungeonBoss() const;
+
uint8 getLevelForTarget(WorldObject const* target) const; // overwrite Unit::getLevelForTarget for boss level support
bool IsInEvadeMode() const { return HasUnitState(UNIT_STAT_EVADE); }
@@ -679,8 +687,6 @@ class Creature : public Unit, public GridObject<Creature>
// vendor items
VendorItemCounts m_vendorItemCounts;
- void _RealtimeSetCreatureInfo();
-
static float _GetHealthMod(int32 Rank);
uint32 m_lootMoney;
@@ -716,7 +722,7 @@ class Creature : public Unit, public GridObject<Creature>
bool DisableReputationGain;
- CreatureInfo const* m_creatureInfo; // in difficulty mode > 0 can different from sObjectMgr->::GetCreatureTemplate(GetEntry())
+ CreatureInfo const* m_creatureInfo; // in difficulty mode > 0 can different from ObjectMgr::GetCreatureTemplate(GetEntry())
CreatureData const* m_creatureData;
uint16 m_LootMode; // bitmask, default LOOT_MODE_DEFAULT, determines what loot will be lootable
diff --git a/src/server/game/Entities/Player/Player.cpp b/src/server/game/Entities/Player/Player.cpp
index a6a8e9a6bb0..5655f55e20e 100755
--- a/src/server/game/Entities/Player/Player.cpp
+++ b/src/server/game/Entities/Player/Player.cpp
@@ -22123,9 +22123,10 @@ bool Player::RewardPlayerAndGroupAtKill(Unit* pVictim)
}
// Credit encounter in instance
- if (pVictim->GetTypeId() == TYPEID_UNIT && GetMap()->IsDungeon())
- if (InstanceScript* instance = pVictim->GetInstanceScript())
- instance->UpdateEncounterState(ENCOUNTER_CREDIT_KILL_CREATURE, pVictim->GetEntry(), pVictim);
+ if (Creature* victim = pVictim->ToCreature())
+ if (victim->IsDungeonBoss())
+ if (InstanceScript* instance = pVictim->GetInstanceScript())
+ instance->UpdateEncounterState(ENCOUNTER_CREDIT_KILL_CREATURE, pVictim->GetEntry(), pVictim);
return xp || honored_kill;
}
diff --git a/src/server/game/Globals/ObjectMgr.cpp b/src/server/game/Globals/ObjectMgr.cpp
index 940f3c5ad1a..16198d2c86c 100755
--- a/src/server/game/Globals/ObjectMgr.cpp
+++ b/src/server/game/Globals/ObjectMgr.cpp
@@ -855,6 +855,12 @@ void ObjectMgr::CheckCreatureTemplate(CreatureInfo const* cInfo)
const_cast<CreatureInfo*>(cInfo)->expansion = 0;
}
+ if (uint32 badFlags = (cInfo->flags_extra & ~CREATURE_FLAG_EXTRA_DB_ALLOWED))
+ {
+ sLog->outErrorDb("Table `creature_template` lists creature (Entry: %u) with disallowed `flags_extra` %u, removing incorrect flag.", cInfo->Entry, badFlags);
+ const_cast<CreatureInfo*>(cInfo)->flags_extra &= CREATURE_FLAG_EXTRA_DB_ALLOWED;
+ }
+
const_cast<CreatureInfo*>(cInfo)->dmg_multiplier *= Creature::_GetDamageMod(cInfo->rank);
}
@@ -5571,6 +5577,9 @@ void ObjectMgr::LoadInstanceEncounters()
{
Field* fields = result->Fetch();
uint32 entry = fields[0].GetUInt32();
+ uint8 creditType = fields[1].GetUInt8();
+ uint32 creditEntry = fields[2].GetUInt32();
+ uint32 lastEncounterDungeon = fields[3].GetUInt32();
DungeonEncounterEntry const* dungeonEncounter = sDungeonEncounterStore.LookupEntry(entry);
if (!dungeonEncounter)
{
@@ -5578,18 +5587,37 @@ void ObjectMgr::LoadInstanceEncounters()
continue;
}
- uint8 creditType = fields[1].GetUInt8();
- uint32 creditEntry = fields[2].GetUInt32();
+ if (lastEncounterDungeon && !sLFGDungeonStore.LookupEntry(lastEncounterDungeon))
+ {
+ sLog->outErrorDb("Table `instance_encounters` has an encounter %u (%s) marked as final for invalid dungeon id %u, skipped!", entry, dungeonEncounter->encounterName[0], lastEncounterDungeon);
+ continue;
+ }
+
+ std::map<uint32, DungeonEncounterEntry const*>::const_iterator itr = dungeonLastBosses.find(lastEncounterDungeon);
+ if (lastEncounterDungeon)
+ {
+ if (itr != dungeonLastBosses.end())
+ {
+ sLog->outErrorDb("Table `instance_encounters` specified encounter %u (%s) as last encounter but %u (%s) is already marked as one, skipped!", entry, dungeonEncounter->encounterName[0], itr->second->id, itr->second->encounterName[0]);
+ continue;
+ }
+
+ dungeonLastBosses[lastEncounterDungeon] = dungeonEncounter;
+ }
switch (creditType)
{
case ENCOUNTER_CREDIT_KILL_CREATURE:
- if (!GetCreatureInfo(creditEntry))
+ {
+ CreatureInfo const* creatureInfo = GetCreatureInfo(creditEntry);
+ if (!creatureInfo)
{
sLog->outErrorDb("Table `instance_encounters` has an invalid creature (entry %u) linked to the encounter %u (%s), skipped!", creditEntry, entry, dungeonEncounter->encounterName[0]);
continue;
}
break;
+ const_cast<CreatureInfo*>(creatureInfo)->flags_extra |= CREATURE_FLAG_EXTRA_DUNGEON_BOSS;
+ }
case ENCOUNTER_CREDIT_CAST_SPELL:
if (!sSpellStore.LookupEntry(creditEntry))
{
@@ -5602,26 +5630,6 @@ void ObjectMgr::LoadInstanceEncounters()
continue;
}
- uint32 lastEncounterDungeon = fields[3].GetUInt32();
-
- if (lastEncounterDungeon && !sLFGDungeonStore.LookupEntry(lastEncounterDungeon))
- {
- sLog->outErrorDb("Table `instance_encounters` has an encounter %u (%s) marked as final for invalid dungeon id %u, skipped!", entry, dungeonEncounter->encounterName[0], lastEncounterDungeon);
- continue;
- }
-
- std::map<uint32, DungeonEncounterEntry const*>::const_iterator itr = dungeonLastBosses.find(lastEncounterDungeon);
- if (lastEncounterDungeon)
- {
- if (itr != dungeonLastBosses.end())
- {
- sLog->outErrorDb("Table `instance_encounters` specified encounter %u (%s) as last encounter but %u (%s) is already marked as one, skipped!", entry, dungeonEncounter->encounterName[0], itr->second->id, itr->second->encounterName[0]);
- continue;
- }
-
- dungeonLastBosses[lastEncounterDungeon] = dungeonEncounter;
- }
-
DungeonEncounterList& encounters = mDungeonEncounters[MAKE_PAIR32(dungeonEncounter->mapId, dungeonEncounter->difficulty)];
encounters.push_back(new DungeonEncounter(dungeonEncounter, EncounterCreditType(creditType), creditEntry, lastEncounterDungeon));
++count;