diff options
author | joschiwald <joschiwald.trinity@gmail.com> | 2017-05-21 14:15:04 +0200 |
---|---|---|
committer | joschiwald <joschiwald.trinity@gmail.com> | 2017-05-21 14:17:47 +0200 |
commit | b192c46b063d6b3b14b6b45f56ef6c4b03ee0839 (patch) | |
tree | dcef29c7e770685046d45c34fe07a4db83767153 /src | |
parent | 7cc3d1387d12b9d128fd812b6548113eb883c098 (diff) |
Core/Creature: Added UnitFlags3 to creature_template
Diffstat (limited to 'src')
-rw-r--r-- | src/server/database/Database/Implementation/WorldDatabase.cpp | 4 | ||||
-rw-r--r-- | src/server/game/Entities/Creature/Creature.cpp | 61 | ||||
-rw-r--r-- | src/server/game/Entities/Creature/Creature.h | 6 | ||||
-rw-r--r-- | src/server/game/Entities/Unit/UnitDefines.h | 12 | ||||
-rw-r--r-- | src/server/game/Globals/ObjectMgr.cpp | 121 | ||||
-rw-r--r-- | src/server/game/Globals/ObjectMgr.h | 2 | ||||
-rw-r--r-- | src/server/game/Miscellaneous/Language.h | 8 | ||||
-rw-r--r-- | src/server/scripts/Commands/cs_npc.cpp | 47 |
8 files changed, 173 insertions, 88 deletions
diff --git a/src/server/database/Database/Implementation/WorldDatabase.cpp b/src/server/database/Database/Implementation/WorldDatabase.cpp index 52a2ca918c1..ef469b4e1e7 100644 --- a/src/server/database/Database/Implementation/WorldDatabase.cpp +++ b/src/server/database/Database/Implementation/WorldDatabase.cpp @@ -77,12 +77,12 @@ void WorldDatabaseConnection::DoPrepareStatements() PrepareStatement(WORLD_SEL_WAYPOINT_SCRIPT_ID_BY_GUID, "SELECT id FROM waypoint_scripts WHERE guid = ?", CONNECTION_SYNCH); PrepareStatement(WORLD_DEL_CREATURE, "DELETE FROM creature WHERE guid = ?", CONNECTION_ASYNC); PrepareStatement(WORLD_SEL_COMMANDS, "SELECT name, permission, help FROM command", CONNECTION_SYNCH); - PrepareStatement(WORLD_SEL_CREATURE_TEMPLATE, "SELECT entry, difficulty_entry_1, difficulty_entry_2, difficulty_entry_3, KillCredit1, KillCredit2, modelid1, modelid2, modelid3, modelid4, name, femaleName, subname, IconName, gossip_menu_id, minlevel, maxlevel, HealthScalingExpansion, RequiredExpansion, VignetteID, faction, npcflag, speed_walk, speed_run, scale, rank, dmgschool, BaseAttackTime, RangeAttackTime, BaseVariance, RangeVariance, unit_class, unit_flags, unit_flags2, dynamicflags, family, trainer_type, trainer_class, trainer_race, type, type_flags, type_flags2, lootid, pickpocketloot, skinloot, resistance1, resistance2, resistance3, resistance4, resistance5, resistance6, spell1, spell2, spell3, spell4, spell5, spell6, spell7, spell8, VehicleId, mingold, maxgold, AIName, MovementType, InhabitType, HoverHeight, HealthModifier, HealthModifierExtra, ManaModifier, ManaModifierExtra, ArmorModifier, DamageModifier, ExperienceModifier, RacialLeader, movementId, RegenHealth, mechanic_immune_mask, flags_extra, ScriptName FROM creature_template WHERE entry = ?", CONNECTION_SYNCH); + PrepareStatement(WORLD_SEL_CREATURE_TEMPLATE, "SELECT entry, difficulty_entry_1, difficulty_entry_2, difficulty_entry_3, KillCredit1, KillCredit2, modelid1, modelid2, modelid3, modelid4, name, femaleName, subname, IconName, gossip_menu_id, minlevel, maxlevel, HealthScalingExpansion, RequiredExpansion, VignetteID, faction, npcflag, speed_walk, speed_run, scale, rank, dmgschool, BaseAttackTime, RangeAttackTime, BaseVariance, RangeVariance, unit_class, unit_flags, unit_flags2, unit_flags3, dynamicflags, family, trainer_type, trainer_class, trainer_race, type, type_flags, type_flags2, lootid, pickpocketloot, skinloot, resistance1, resistance2, resistance3, resistance4, resistance5, resistance6, spell1, spell2, spell3, spell4, spell5, spell6, spell7, spell8, VehicleId, mingold, maxgold, AIName, MovementType, InhabitType, HoverHeight, HealthModifier, HealthModifierExtra, ManaModifier, ManaModifierExtra, ArmorModifier, DamageModifier, ExperienceModifier, RacialLeader, movementId, RegenHealth, mechanic_immune_mask, flags_extra, ScriptName FROM creature_template WHERE entry = ?", CONNECTION_SYNCH); PrepareStatement(WORLD_SEL_WAYPOINT_SCRIPT_BY_ID, "SELECT guid, delay, command, datalong, datalong2, dataint, x, y, z, o FROM waypoint_scripts WHERE id = ?", CONNECTION_SYNCH); PrepareStatement(WORLD_SEL_CREATURE_BY_ID, "SELECT guid FROM creature WHERE id = ?", CONNECTION_SYNCH); PrepareStatement(WORLD_SEL_GAMEOBJECT_NEAREST, "SELECT guid, id, position_x, position_y, position_z, map, (POW(position_x - ?, 2) + POW(position_y - ?, 2) + POW(position_z - ?, 2)) AS order_ FROM gameobject WHERE map = ? AND (POW(position_x - ?, 2) + POW(position_y - ?, 2) + POW(position_z - ?, 2)) <= ? ORDER BY order_", CONNECTION_SYNCH); PrepareStatement(WORLD_SEL_CREATURE_NEAREST, "SELECT guid, id, position_x, position_y, position_z, map, (POW(position_x - ?, 2) + POW(position_y - ?, 2) + POW(position_z - ?, 2)) AS order_ FROM creature WHERE map = ? AND (POW(position_x - ?, 2) + POW(position_y - ?, 2) + POW(position_z - ?, 2)) <= ? ORDER BY order_", CONNECTION_SYNCH); - PrepareStatement(WORLD_INS_CREATURE, "INSERT INTO creature (guid, id , map, spawnMask, PhaseId, PhaseGroup, modelid, equipment_id, position_x, position_y, position_z, orientation, spawntimesecs, spawndist, currentwaypoint, curhealth, curmana, MovementType, npcflag, unit_flags, dynamicflags) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)", CONNECTION_ASYNC); + PrepareStatement(WORLD_INS_CREATURE, "INSERT INTO creature (guid, id , map, spawnMask, PhaseId, PhaseGroup, modelid, equipment_id, position_x, position_y, position_z, orientation, spawntimesecs, spawndist, currentwaypoint, curhealth, curmana, MovementType, npcflag, unit_flags, unit_flags2, unit_flags3, dynamicflags) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)", CONNECTION_ASYNC); PrepareStatement(WORLD_DEL_GAME_EVENT_CREATURE, "DELETE FROM game_event_creature WHERE guid = ?", CONNECTION_ASYNC); PrepareStatement(WORLD_DEL_GAME_EVENT_MODEL_EQUIP, "DELETE FROM game_event_model_equip WHERE guid = ?", CONNECTION_ASYNC); PrepareStatement(WORLD_INS_GAMEOBJECT, "INSERT INTO gameobject (guid, id, map, spawnMask, position_x, position_y, position_z, orientation, rotation0, rotation1, rotation2, rotation3, spawntimesecs, animprogress, state) VALUES ( ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)", CONNECTION_ASYNC); diff --git a/src/server/game/Entities/Creature/Creature.cpp b/src/server/game/Entities/Creature/Creature.cpp index 5dd98eb1762..9c8985e63c3 100644 --- a/src/server/game/Entities/Creature/Creature.cpp +++ b/src/server/game/Entities/Creature/Creature.cpp @@ -422,19 +422,20 @@ bool Creature::UpdateEntry(uint32 entry, CreatureData const* data /*= nullptr*/, setFaction(cInfo->faction); - uint32 unit_flags, dynamicflags; - uint64 npcflag; - ObjectMgr::ChooseCreatureFlags(cInfo, npcflag, unit_flags, dynamicflags, data); + uint64 npcFlags; + uint32 unitFlags, unitFlags2, unitFlags3, dynamicFlags; + ObjectMgr::ChooseCreatureFlags(cInfo, npcFlags, unitFlags, unitFlags2, unitFlags3, dynamicFlags, data); if (cInfo->flags_extra & CREATURE_FLAG_EXTRA_WORLDEVENT) - SetUInt64Value(UNIT_NPC_FLAGS, npcflag | sGameEventMgr->GetNPCFlag(this)); + SetUInt64Value(UNIT_NPC_FLAGS, npcFlags | sGameEventMgr->GetNPCFlag(this)); else - SetUInt64Value(UNIT_NPC_FLAGS, npcflag); + SetUInt64Value(UNIT_NPC_FLAGS, npcFlags); - SetUInt32Value(UNIT_FIELD_FLAGS, unit_flags); - SetUInt32Value(UNIT_FIELD_FLAGS_2, cInfo->unit_flags2); + SetUInt32Value(UNIT_FIELD_FLAGS, unitFlags); + SetUInt32Value(UNIT_FIELD_FLAGS_2, unitFlags2); + SetUInt32Value(UNIT_FIELD_FLAGS_3, unitFlags3); - SetUInt32Value(OBJECT_DYNAMIC_FLAGS, dynamicflags); + SetUInt32Value(OBJECT_DYNAMIC_FLAGS, dynamicFlags); RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_IN_COMBAT); @@ -1083,7 +1084,9 @@ void Creature::SaveToDB(uint32 mapid, uint32 spawnMask, uint32 phaseMask) uint32 displayId = GetNativeDisplayId(); uint64 npcflag = GetUInt64Value(UNIT_NPC_FLAGS); - uint32 unit_flags = GetUInt32Value(UNIT_FIELD_FLAGS); + uint32 unitFlags = GetUInt32Value(UNIT_FIELD_FLAGS); + uint32 unitFlags2 = GetUInt32Value(UNIT_FIELD_FLAGS_2); + uint32 unitFlags3 = GetUInt32Value(UNIT_FIELD_FLAGS_3); uint32 dynamicflags = GetUInt32Value(OBJECT_DYNAMIC_FLAGS); // check if it's a custom model and if not, use 0 for displayId @@ -1097,8 +1100,14 @@ void Creature::SaveToDB(uint32 mapid, uint32 spawnMask, uint32 phaseMask) if (npcflag == cinfo->npcflag) npcflag = 0; - if (unit_flags == cinfo->unit_flags) - unit_flags = 0; + if (unitFlags == cinfo->unit_flags) + unitFlags = 0; + + if (unitFlags2 == cinfo->unit_flags2) + unitFlags2 = 0; + + if (unitFlags3 == cinfo->unit_flags3) + unitFlags3 = 0; if (dynamicflags == cinfo->dynamicflags) dynamicflags = 0; @@ -1136,7 +1145,9 @@ void Creature::SaveToDB(uint32 mapid, uint32 spawnMask, uint32 phaseMask) ? IDLE_MOTION_TYPE : GetDefaultMovementType(); data.spawnMask = spawnMask; data.npcflag = npcflag; - data.unit_flags = unit_flags; + data.unit_flags = unitFlags; + data.unit_flags2 = unitFlags2; + data.unit_flags3 = unitFlags3; data.dynamicflags = dynamicflags; data.phaseid = GetDBPhase() > 0 ? GetDBPhase() : 0; @@ -1171,7 +1182,9 @@ void Creature::SaveToDB(uint32 mapid, uint32 spawnMask, uint32 phaseMask) stmt->setUInt32(index++, GetPower(POWER_MANA)); stmt->setUInt8(index++, uint8(GetDefaultMovementType())); stmt->setUInt64(index++, npcflag); - stmt->setUInt32(index++, unit_flags); + stmt->setUInt32(index++, unitFlags); + stmt->setUInt32(index++, unitFlags2); + stmt->setUInt32(index++, unitFlags3); stmt->setUInt32(index++, dynamicflags); trans->Append(stmt); @@ -1722,19 +1735,25 @@ void Creature::setDeathState(DeathState s) if (!IsPet()) { CreatureData const* creatureData = GetCreatureData(); - CreatureTemplate const* cinfo = GetCreatureTemplate(); + CreatureTemplate const* cInfo = GetCreatureTemplate(); - uint64 npcflag; - uint32 unit_flags, dynamicflags; - ObjectMgr::ChooseCreatureFlags(cinfo, npcflag, unit_flags, dynamicflags, creatureData); + uint64 npcFlags; + uint32 unitFlags, unitFlags2, unitFlags3, dynamicFlags; + ObjectMgr::ChooseCreatureFlags(cInfo, npcFlags, unitFlags, unitFlags2, unitFlags3, dynamicFlags, creatureData); + + if (cInfo->flags_extra & CREATURE_FLAG_EXTRA_WORLDEVENT) + SetUInt64Value(UNIT_NPC_FLAGS, npcFlags | sGameEventMgr->GetNPCFlag(this)); + else + SetUInt64Value(UNIT_NPC_FLAGS, npcFlags); - SetUInt64Value(UNIT_NPC_FLAGS, npcflag); - SetUInt32Value(UNIT_FIELD_FLAGS, unit_flags); - SetUInt32Value(OBJECT_DYNAMIC_FLAGS, dynamicflags); + SetUInt32Value(UNIT_FIELD_FLAGS, unitFlags); + SetUInt32Value(UNIT_FIELD_FLAGS_2, unitFlags2); + SetUInt32Value(UNIT_FIELD_FLAGS_3, unitFlags3); + SetUInt32Value(OBJECT_DYNAMIC_FLAGS, dynamicFlags); RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_IN_COMBAT); - SetMeleeDamageSchool(SpellSchools(cinfo->dmgschool)); + SetMeleeDamageSchool(SpellSchools(cInfo->dmgschool)); } Motion_Initialize(); diff --git a/src/server/game/Entities/Creature/Creature.h b/src/server/game/Entities/Creature/Creature.h index 2ebc31a291e..2b6bde797ad 100644 --- a/src/server/game/Entities/Creature/Creature.h +++ b/src/server/game/Entities/Creature/Creature.h @@ -334,6 +334,7 @@ struct TC_GAME_API CreatureTemplate uint32 unit_class; // enum Classes. Note only 4 classes are known for creatures. uint32 unit_flags; // enum UnitFlags mask values uint32 unit_flags2; // enum UnitFlags2 mask values + uint32 unit_flags3; // enum UnitFlags3 mask values uint32 dynamicflags; CreatureFamily family; // enum CreatureFamily values (optional) uint32 trainer_type; @@ -511,7 +512,8 @@ struct CreatureData CreatureData() : id(0), mapid(0), phaseMask(0), displayid(0), equipmentId(0), posX(0.0f), posY(0.0f), posZ(0.0f), orientation(0.0f), spawntimesecs(0), spawndist(0.0f), currentwaypoint(0), curhealth(0), curmana(0), movementType(0), - spawnMask(0), npcflag(0), unit_flags(0), dynamicflags(0), phaseid(0), phaseGroup(0), dbData(true) { } + spawnMask(0), npcflag(0), unit_flags(0), unit_flags2(0), unit_flags3(0), dynamicflags(0), + phaseid(0), phaseGroup(0), dbData(true) { } uint32 id; // entry in creature_template uint16 mapid; uint32 phaseMask; @@ -530,6 +532,8 @@ struct CreatureData uint32 spawnMask; uint64 npcflag; uint32 unit_flags; // enum UnitFlags mask values + uint32 unit_flags2; // enum UnitFlags2 mask values + uint32 unit_flags3; // enum UnitFlags3 mask values uint32 dynamicflags; uint32 phaseid; uint32 phaseGroup; diff --git a/src/server/game/Entities/Unit/UnitDefines.h b/src/server/game/Entities/Unit/UnitDefines.h index 03bff121ebf..6b853057751 100644 --- a/src/server/game/Entities/Unit/UnitDefines.h +++ b/src/server/game/Entities/Unit/UnitDefines.h @@ -153,7 +153,7 @@ enum UnitFlags : uint32 UNIT_FLAG_UNK_29 = 0x20000000, // used in Feing Death spell UNIT_FLAG_SHEATHE = 0x40000000, UNIT_FLAG_UNK_31 = 0x80000000, - MAX_UNIT_FLAGS = 33 + MAX_UNIT_FLAGS = 32 }; // Value masks for UNIT_FIELD_FLAGS_2 @@ -177,7 +177,15 @@ enum UnitFlags2 : uint32 UNIT_FLAG2_UNK2 = 0x00010000, UNIT_FLAG2_PLAY_DEATH_ANIM = 0x00020000, // Plays special death animation upon death UNIT_FLAG2_ALLOW_CHEAT_SPELLS = 0x00040000, // Allows casting spells with AttributesEx7 & SPELL_ATTR7_IS_CHEAT_SPELL - UNIT_FLAG2_NO_ACTIONS = 0x00800000 + UNIT_FLAG2_NO_ACTIONS = 0x00800000, + MAX_UNIT_FLAGS_2 = 19 +}; + +// Value masks for UNIT_FIELD_FLAGS_3 +enum UnitFlags3 : uint32 +{ + UNIT_FLAG3_UNK1 = 0x00000001, + MAX_UNIT_FLAGS_3 = 1 }; /// Non Player Character flags diff --git a/src/server/game/Globals/ObjectMgr.cpp b/src/server/game/Globals/ObjectMgr.cpp index f6a29f9b10f..dfa88d4faaa 100644 --- a/src/server/game/Globals/ObjectMgr.cpp +++ b/src/server/game/Globals/ObjectMgr.cpp @@ -423,15 +423,15 @@ void ObjectMgr::LoadCreatureTemplates() "modelid4, name, femaleName, subname, IconName, gossip_menu_id, minlevel, maxlevel, HealthScalingExpansion, RequiredExpansion, VignetteID, " // 20 21 22 23 24 25 26 27 28 29 30 "faction, npcflag, speed_walk, speed_run, scale, rank, dmgschool, BaseAttackTime, RangeAttackTime, BaseVariance, RangeVariance, " - // 31 32 33 34 35 36 37 38 39 - "unit_class, unit_flags, unit_flags2, dynamicflags, family, trainer_type, trainer_class, trainer_race, type, " - // 40 41 42 43 44 45 46 47 48 49 50 + // 31 32 33 34 35 36 37 38 39 40 + "unit_class, unit_flags, unit_flags2, unit_flags3, dynamicflags, family, trainer_type, trainer_class, trainer_race, type, " + // 41 42 43 44 45 46 47 48 49 50 51 "type_flags, type_flags2, lootid, pickpocketloot, skinloot, resistance1, resistance2, resistance3, resistance4, resistance5, resistance6, " - // 51 52 53 54 55 56 57 58 59 60 61 62 63 + // 52 53 54 55 56 57 58 59 60 61 62 63 64 "spell1, spell2, spell3, spell4, spell5, spell6, spell7, spell8, VehicleId, mingold, maxgold, AIName, MovementType, " - // 64 65 66 67 68 69 70 71 72 + // 65 66 67 68 69 70 71 72 73 "InhabitType, HoverHeight, HealthModifier, HealthModifierExtra, ManaModifier, ManaModifierExtra, ArmorModifier, DamageModifier, ExperienceModifier, " - // 73 74 75 76 77 78 + // 74 75 76 77 78 79 "RacialLeader, movementId, RegenHealth, mechanic_immune_mask, flags_extra, ScriptName FROM creature_template"); if (!result) @@ -499,44 +499,45 @@ void ObjectMgr::LoadCreatureTemplate(Field* fields) creatureTemplate.unit_class = uint32(fields[31].GetUInt8()); creatureTemplate.unit_flags = fields[32].GetUInt32(); creatureTemplate.unit_flags2 = fields[33].GetUInt32(); - creatureTemplate.dynamicflags = fields[34].GetUInt32(); - creatureTemplate.family = CreatureFamily(fields[35].GetUInt8()); - creatureTemplate.trainer_type = uint32(fields[36].GetUInt8()); - creatureTemplate.trainer_class = uint32(fields[37].GetUInt8()); - creatureTemplate.trainer_race = uint32(fields[38].GetUInt8()); - creatureTemplate.type = uint32(fields[39].GetUInt8()); - creatureTemplate.type_flags = fields[40].GetUInt32(); - creatureTemplate.type_flags2 = fields[41].GetUInt32(); - creatureTemplate.lootid = fields[42].GetUInt32(); - creatureTemplate.pickpocketLootId = fields[43].GetUInt32(); - creatureTemplate.SkinLootId = fields[44].GetUInt32(); + creatureTemplate.unit_flags3 = fields[34].GetUInt32(); + creatureTemplate.dynamicflags = fields[35].GetUInt32(); + creatureTemplate.family = CreatureFamily(fields[36].GetUInt8()); + creatureTemplate.trainer_type = uint32(fields[37].GetUInt8()); + creatureTemplate.trainer_class = uint32(fields[38].GetUInt8()); + creatureTemplate.trainer_race = uint32(fields[39].GetUInt8()); + creatureTemplate.type = uint32(fields[40].GetUInt8()); + creatureTemplate.type_flags = fields[41].GetUInt32(); + creatureTemplate.type_flags2 = fields[42].GetUInt32(); + creatureTemplate.lootid = fields[43].GetUInt32(); + creatureTemplate.pickpocketLootId = fields[44].GetUInt32(); + creatureTemplate.SkinLootId = fields[45].GetUInt32(); for (uint8 i = SPELL_SCHOOL_HOLY; i < MAX_SPELL_SCHOOL; ++i) - creatureTemplate.resistance[i] = fields[45 + i - 1].GetInt16(); + creatureTemplate.resistance[i] = fields[46 + i - 1].GetInt16(); for (uint8 i = 0; i < MAX_CREATURE_SPELLS; ++i) - creatureTemplate.spells[i] = fields[51 + i].GetUInt32(); - - creatureTemplate.VehicleId = fields[59].GetUInt32(); - creatureTemplate.mingold = fields[60].GetUInt32(); - creatureTemplate.maxgold = fields[61].GetUInt32(); - creatureTemplate.AIName = fields[62].GetString(); - creatureTemplate.MovementType = uint32(fields[63].GetUInt8()); - creatureTemplate.InhabitType = uint32(fields[64].GetUInt8()); - creatureTemplate.HoverHeight = fields[65].GetFloat(); - creatureTemplate.ModHealth = fields[66].GetFloat(); - creatureTemplate.ModHealthExtra = fields[67].GetFloat(); - creatureTemplate.ModMana = fields[68].GetFloat(); - creatureTemplate.ModManaExtra = fields[69].GetFloat(); - creatureTemplate.ModArmor = fields[70].GetFloat(); - creatureTemplate.ModDamage = fields[71].GetFloat(); - creatureTemplate.ModExperience = fields[72].GetFloat(); - creatureTemplate.RacialLeader = fields[73].GetBool(); - creatureTemplate.movementId = fields[74].GetUInt32(); - creatureTemplate.RegenHealth = fields[75].GetBool(); - creatureTemplate.MechanicImmuneMask = fields[76].GetUInt32(); - creatureTemplate.flags_extra = fields[77].GetUInt32(); - creatureTemplate.ScriptID = GetScriptId(fields[78].GetString()); + creatureTemplate.spells[i] = fields[52 + i].GetUInt32(); + + creatureTemplate.VehicleId = fields[60].GetUInt32(); + creatureTemplate.mingold = fields[61].GetUInt32(); + creatureTemplate.maxgold = fields[62].GetUInt32(); + creatureTemplate.AIName = fields[63].GetString(); + creatureTemplate.MovementType = uint32(fields[64].GetUInt8()); + creatureTemplate.InhabitType = uint32(fields[65].GetUInt8()); + creatureTemplate.HoverHeight = fields[66].GetFloat(); + creatureTemplate.ModHealth = fields[67].GetFloat(); + creatureTemplate.ModHealthExtra = fields[68].GetFloat(); + creatureTemplate.ModMana = fields[69].GetFloat(); + creatureTemplate.ModManaExtra = fields[70].GetFloat(); + creatureTemplate.ModArmor = fields[71].GetFloat(); + creatureTemplate.ModDamage = fields[72].GetFloat(); + creatureTemplate.ModExperience = fields[73].GetFloat(); + creatureTemplate.RacialLeader = fields[74].GetBool(); + creatureTemplate.movementId = fields[75].GetUInt32(); + creatureTemplate.RegenHealth = fields[76].GetBool(); + creatureTemplate.MechanicImmuneMask = fields[77].GetUInt32(); + creatureTemplate.flags_extra = fields[78].GetUInt32(); + creatureTemplate.ScriptID = GetScriptId(fields[79].GetString()); } void ObjectMgr::LoadCreatureTemplateAddons() @@ -1401,22 +1402,30 @@ uint32 ObjectMgr::ChooseDisplayId(CreatureTemplate const* cinfo, CreatureData co return cinfo->GetFirstInvisibleModel(); } -void ObjectMgr::ChooseCreatureFlags(const CreatureTemplate* cinfo, uint64& npcflag, uint32& unit_flags, uint32& dynamicflags, const CreatureData* data /*= nullptr*/) +void ObjectMgr::ChooseCreatureFlags(CreatureTemplate const* cInfo, uint64& npcFlags, uint32& unitFlags, uint32& unitFlags2, uint32& unitFlags3, uint32& dynamicFlags, CreatureData const* data /*= nullptr*/) { - npcflag = cinfo->npcflag; - unit_flags = cinfo->unit_flags; - dynamicflags = cinfo->dynamicflags; + npcFlags = cInfo->npcflag; + unitFlags = cInfo->unit_flags; + unitFlags2 = cInfo->unit_flags2; + unitFlags3 = cInfo->unit_flags3; + dynamicFlags = cInfo->dynamicflags; if (data) { if (data->npcflag) - npcflag = data->npcflag; + npcFlags = data->npcflag; if (data->unit_flags) - unit_flags = data->unit_flags; + unitFlags = data->unit_flags; + + if (data->unit_flags2) + unitFlags2 = data->unit_flags2; + + if (data->unit_flags3) + unitFlags3 = data->unit_flags3; if (data->dynamicflags) - dynamicflags = data->dynamicflags; + dynamicFlags = data->dynamicflags; } } @@ -1846,10 +1855,10 @@ void ObjectMgr::LoadCreatures() // 0 1 2 3 4 5 6 7 8 9 10 QueryResult result = WorldDatabase.Query("SELECT creature.guid, id, map, modelid, equipment_id, position_x, position_y, position_z, orientation, spawntimesecs, spawndist, " - // 11 12 13 14 15 16 17 18 19 20 21 - "currentwaypoint, curhealth, curmana, MovementType, spawnMask, eventEntry, pool_entry, creature.npcflag, creature.unit_flags, creature.dynamicflags, creature.phaseid, " - // 22 23 - "creature.phasegroup, creature.ScriptName " + // 11 12 13 14 15 16 17 18 19 20 21 + "currentwaypoint, curhealth, curmana, MovementType, spawnMask, eventEntry, pool_entry, creature.npcflag, creature.unit_flags, creature.unit_flags2, creature.unit_flags3, " + // 22 23 24 25 + "creature.dynamicflags, creature.phaseid, creature.phasegroup, creature.ScriptName " "FROM creature " "LEFT OUTER JOIN game_event_creature ON creature.guid = game_event_creature.guid " "LEFT OUTER JOIN pool_creature ON creature.guid = pool_creature.guid"); @@ -1903,10 +1912,12 @@ void ObjectMgr::LoadCreatures() uint32 PoolId = fields[17].GetUInt32(); data.npcflag = fields[18].GetUInt64(); data.unit_flags = fields[19].GetUInt32(); - data.dynamicflags = fields[20].GetUInt32(); - data.phaseid = fields[21].GetUInt32(); - data.phaseGroup = fields[22].GetUInt32(); - data.ScriptId = GetScriptId(fields[23].GetString()); + data.unit_flags2 = fields[20].GetUInt32(); + data.unit_flags3 = fields[21].GetUInt32(); + data.dynamicflags = fields[22].GetUInt32(); + data.phaseid = fields[23].GetUInt32(); + data.phaseGroup = fields[24].GetUInt32(); + data.ScriptId = GetScriptId(fields[25].GetString()); if (!data.ScriptId) data.ScriptId = cInfo->ScriptID; diff --git a/src/server/game/Globals/ObjectMgr.h b/src/server/game/Globals/ObjectMgr.h index 6b76a98b425..ad7b4b4a76b 100644 --- a/src/server/game/Globals/ObjectMgr.h +++ b/src/server/game/Globals/ObjectMgr.h @@ -844,7 +844,7 @@ class TC_GAME_API ObjectMgr CreatureModelInfo const* GetCreatureModelInfo(uint32 modelId) const; CreatureModelInfo const* GetCreatureModelRandomGender(uint32* displayID) const; static uint32 ChooseDisplayId(CreatureTemplate const* cinfo, CreatureData const* data = nullptr); - static void ChooseCreatureFlags(CreatureTemplate const* cinfo, uint64& npcflag, uint32& unit_flags, uint32& dynamicflags, CreatureData const* data = nullptr); + static void ChooseCreatureFlags(CreatureTemplate const* cInfo, uint64& npcFlags, uint32& unitFlags, uint32& unitFlags2, uint32& unitFlags3, uint32& dynamicFlags, CreatureData const* data = nullptr); EquipmentInfo const* GetEquipmentInfo(uint32 entry, int8& id) const; CreatureAddon const* GetCreatureAddon(ObjectGuid::LowType lowguid) const; GameObjectAddon const* GetGameObjectAddon(ObjectGuid::LowType lowguid) const; diff --git a/src/server/game/Miscellaneous/Language.h b/src/server/game/Miscellaneous/Language.h index e27e389cefc..ca7190756ac 100644 --- a/src/server/game/Miscellaneous/Language.h +++ b/src/server/game/Miscellaneous/Language.h @@ -561,7 +561,7 @@ enum TrinityStrings LANG_NPCINFO_CHAR = 539, LANG_NPCINFO_LEVEL = 540, LANG_NPCINFO_HEALTH = 541, - LANG_NPCINFO_FLAGS = 542, + LANG_NPCINFO_DYNAMIC_FLAGS = 542, LANG_NPCINFO_LOOT = 543, LANG_NPCINFO_POSITION = 544, LANG_NPCINFO_VENDOR = 545, @@ -1150,7 +1150,11 @@ enum TrinityStrings LANG_DEBUG_SCENE_OBJECT_LIST = 5068, LANG_DEBUG_SCENE_OBJECT_DETAIL = 5069, - // Room for more Trinity strings 5070-9999 + LANG_NPCINFO_UNIT_FIELD_FLAGS_2 = 5070, + LANG_NPCINFO_UNIT_FIELD_FLAGS_3 = 5071, + LANG_NPCINFO_NPC_FLAGS = 5072, + + // Room for more Trinity strings 5073-9999 // Level requirement notifications LANG_SAY_REQ = 6604, diff --git a/src/server/scripts/Commands/cs_npc.cpp b/src/server/scripts/Commands/cs_npc.cpp index 981d33c9537..4ad73cb4121 100644 --- a/src/server/scripts/Commands/cs_npc.cpp +++ b/src/server/scripts/Commands/cs_npc.cpp @@ -46,10 +46,10 @@ struct EnumName #define CREATE_NAMED_ENUM(VALUE) { VALUE, STRINGIZE(VALUE) } -#define NPCFLAG_COUNT 24 +#define NPC_FLAG_COUNT 24 #define FLAGS_EXTRA_COUNT 19 -EnumName<NPCFlags, int32> const npcFlagTexts[NPCFLAG_COUNT] = +EnumName<NPCFlags, uint32> const npcFlagTexts[NPC_FLAG_COUNT] = { { UNIT_NPC_FLAG_AUCTIONEER, LANG_NPCINFO_AUCTIONEER }, { UNIT_NPC_FLAG_BANKER, LANG_NPCINFO_BANKER }, @@ -150,6 +150,34 @@ EnumName<UnitFlags> const unitFlags[MAX_UNIT_FLAGS] = CREATE_NAMED_ENUM(UNIT_FLAG_UNK_31) }; +EnumName<UnitFlags2> const unitFlags2[MAX_UNIT_FLAGS_2] = +{ + CREATE_NAMED_ENUM(UNIT_FLAG2_FEIGN_DEATH), + CREATE_NAMED_ENUM(UNIT_FLAG2_UNK1), + CREATE_NAMED_ENUM(UNIT_FLAG2_IGNORE_REPUTATION), + CREATE_NAMED_ENUM(UNIT_FLAG2_COMPREHEND_LANG), + CREATE_NAMED_ENUM(UNIT_FLAG2_MIRROR_IMAGE), + CREATE_NAMED_ENUM(UNIT_FLAG2_INSTANTLY_APPEAR_MODEL), + CREATE_NAMED_ENUM(UNIT_FLAG2_FORCE_MOVEMENT), + CREATE_NAMED_ENUM(UNIT_FLAG2_DISARM_OFFHAND), + CREATE_NAMED_ENUM(UNIT_FLAG2_DISABLE_PRED_STATS), + CREATE_NAMED_ENUM(UNIT_FLAG2_DISARM_RANGED), + CREATE_NAMED_ENUM(UNIT_FLAG2_REGENERATE_POWER), + CREATE_NAMED_ENUM(UNIT_FLAG2_RESTRICT_PARTY_INTERACTION), + CREATE_NAMED_ENUM(UNIT_FLAG2_PREVENT_SPELL_CLICK), + CREATE_NAMED_ENUM(UNIT_FLAG2_ALLOW_ENEMY_INTERACT), + CREATE_NAMED_ENUM(UNIT_FLAG2_DISABLE_TURN), + CREATE_NAMED_ENUM(UNIT_FLAG2_UNK2), + CREATE_NAMED_ENUM(UNIT_FLAG2_PLAY_DEATH_ANIM), + CREATE_NAMED_ENUM(UNIT_FLAG2_ALLOW_CHEAT_SPELLS), + CREATE_NAMED_ENUM(UNIT_FLAG2_NO_ACTIONS) +}; + +EnumName<UnitFlags3> const unitFlags3[MAX_UNIT_FLAGS_3] = +{ + CREATE_NAMED_ENUM(UNIT_FLAG3_UNK1) +}; + EnumName<CreatureFlagsExtra> const flagsExtra[FLAGS_EXTRA_COUNT] = { CREATE_NAMED_ENUM(CREATURE_FLAG_EXTRA_INSTANCE_BIND), @@ -708,7 +736,17 @@ public: if (target->GetUInt32Value(UNIT_FIELD_FLAGS) & unitFlags[i].Value) handler->PSendSysMessage("%s (0x%X)", unitFlags[i].Name, unitFlags[i].Value); - handler->PSendSysMessage(LANG_NPCINFO_FLAGS, target->GetUInt32Value(UNIT_FIELD_FLAGS_2), target->GetUInt32Value(OBJECT_DYNAMIC_FLAGS), target->getFaction()); + handler->PSendSysMessage(LANG_NPCINFO_UNIT_FIELD_FLAGS_2, target->GetUInt32Value(UNIT_FIELD_FLAGS_2)); + for (uint8 i = 0; i < MAX_UNIT_FLAGS_2; ++i) + if (target->GetUInt32Value(UNIT_FIELD_FLAGS_2) & unitFlags2[i].Value) + handler->PSendSysMessage("%s (0x%X)", unitFlags2[i].Name, unitFlags2[i].Value); + + handler->PSendSysMessage(LANG_NPCINFO_UNIT_FIELD_FLAGS_3, target->GetUInt32Value(UNIT_FIELD_FLAGS_3)); + for (uint8 i = 0; i < MAX_UNIT_FLAGS_3; ++i) + if (target->GetUInt32Value(UNIT_FIELD_FLAGS_3) & unitFlags3[i].Value) + handler->PSendSysMessage("%s (0x%X)", unitFlags3[i].Name, unitFlags3[i].Value); + + handler->PSendSysMessage(LANG_NPCINFO_DYNAMIC_FLAGS, target->GetUInt32Value(OBJECT_DYNAMIC_FLAGS)); handler->PSendSysMessage(LANG_COMMAND_RAWPAWNTIMES, defRespawnDelayStr.c_str(), curRespawnDelayStr.c_str()); handler->PSendSysMessage(LANG_NPCINFO_LOOT, cInfo->lootid, cInfo->pickpocketLootId, cInfo->SkinLootId); handler->PSendSysMessage(LANG_NPCINFO_DUNGEON_ID, target->GetInstanceId()); @@ -737,7 +775,8 @@ public: if (cInfo->flags_extra & flagsExtra[i].Value) handler->PSendSysMessage("%s (0x%X)", flagsExtra[i].Name, flagsExtra[i].Value); - for (uint8 i = 0; i < NPCFLAG_COUNT; i++) + handler->PSendSysMessage(LANG_NPCINFO_NPC_FLAGS, npcflags); + for (uint8 i = 0; i < NPC_FLAG_COUNT; i++) if (npcflags & npcFlagTexts[i].Value) handler->PSendSysMessage(npcFlagTexts[i].Name, npcFlagTexts[i].Value); |