diff --git a/src/game/CreatureEventAI.h b/src/game/CreatureEventAI.h index 577112993..5bcd49112 100644 --- a/src/game/CreatureEventAI.h +++ b/src/game/CreatureEventAI.h @@ -33,7 +33,7 @@ class WorldObject; enum EventAI_Type { - EVENT_T_TIMER = 0, // InitialMin, InitialMax, RepeatMin, RepeatMax + EVENT_T_TIMER_IN_COMBAT = 0, // InitialMin, InitialMax, RepeatMin, RepeatMax EVENT_T_TIMER_OOC = 1, // InitialMin, InitialMax, RepeatMin, RepeatMax EVENT_T_HP = 2, // HPMax%, HPMin%, RepeatMin, RepeatMax EVENT_T_MANA = 3, // ManaMax%,ManaMin% RepeatMin, RepeatMax @@ -62,6 +62,7 @@ enum EventAI_Type EVENT_T_SUMMONED_JUST_DESPAWN = 26, // CreatureId, RepeatMin, RepeatMax EVENT_T_MISSING_AURA = 27, // Param1 = SpellID, Param2 = Number of time stacked expected, Param3/4 Repeat Min/Max EVENT_T_TARGET_MISSING_AURA = 28, // Param1 = SpellID, Param2 = Number of time stacked expected, Param3/4 Repeat Min/Max + EVENT_T_TIMER_GENERIC = 29, // InitialMin, InitialMax, RepeatMin, RepeatMax EVENT_T_END, }; @@ -130,15 +131,11 @@ enum Target // Invoker targets (if pet then returns pet owner) TARGET_T_ACTION_INVOKER, // Unit who caused this Event to occur (only works for EVENT_T_AGGRO, EVENT_T_KILL, EVENT_T_DEATH, EVENT_T_SPELLHIT, EVENT_T_OOC_LOS, EVENT_T_FRIENDLY_HP, EVENT_T_FRIENDLY_IS_CC, EVENT_T_FRIENDLY_MISSING_BUFF) + TARGET_T_ACTION_INVOKER_OWNER, // Unit who is responsible for Event to occur (only works for EVENT_T_AGGRO, EVENT_T_KILL, EVENT_T_DEATH, EVENT_T_SPELLHIT, EVENT_T_OOC_LOS, EVENT_T_FRIENDLY_HP, EVENT_T_FRIENDLY_IS_CC, EVENT_T_FRIENDLY_MISSING_BUFF) // Hostile targets (including pets) - TARGET_T_HOSTILE_WPET, // Current target (can be a pet) - TARGET_T_HOSTILE_WPET_SECOND_AGGRO, // Second highest aggro (generaly used for cleaves and some special attacks) - TARGET_T_HOSTILE_WPET_LAST_AGGRO, // Dead last on aggro (no idea what this could be used for) - TARGET_T_HOSTILE_WPET_RANDOM, // Just any random target on our threat list - TARGET_T_HOSTILE_WPET_RANDOM_NOT_TOP, // Any random target except top threat - - TARGET_T_ACTION_INVOKER_WPET, + TARGET_T_HOSTILE_RANDOM_PLAYER, // Just any random player on our threat list + TARGET_T_HOSTILE_RANDOM_NOT_TOP_PLAYER, // Any random player from threat list except top threat TARGET_T_END }; @@ -419,8 +416,9 @@ struct CreatureEventAI_Event union { - // EVENT_T_TIMER = 0 + // EVENT_T_TIMER_IN_COMBAT = 0 // EVENT_T_TIMER_OOC = 1 + // EVENT_T_TIMER_GENERIC = 29 struct { uint32 initialMin; @@ -616,10 +614,9 @@ class MANGOS_DLL_SPEC CreatureEventAI : public CreatureAI void ProcessAction(CreatureEventAI_Action const& action, uint32 rnd, uint32 EventId, Unit* pActionInvoker); inline uint32 GetRandActionParam(uint32 rnd, uint32 param1, uint32 param2, uint32 param3); inline int32 GetRandActionParam(uint32 rnd, int32 param1, int32 param2, int32 param3); - inline Unit* GetTargetByType(uint32 Target, Unit* pActionInvoker); + inline Unit* GetTargetByType(uint32 Target, Unit* pActionInvoker, uint32 forSpellId = 0, uint32 selectFlags = 0); void DoScriptText(int32 textEntry, WorldObject* pSource, Unit* target); - bool CanCast(Unit* Target, SpellEntry const* Spell, bool Triggered); bool SpawnedEventConditionsCheck(CreatureEventAI_Event const& event); @@ -637,10 +634,7 @@ class MANGOS_DLL_SPEC CreatureEventAI : public CreatureAI CreatureEventAIList m_CreatureEventAIList; // Holder for events (stores enabled, time, and eventid) uint8 m_Phase; // Current phase, max 32 phases - bool m_CombatMovementEnabled; // If we allow targeted movment gen (movement twoards top threat) bool m_MeleeEnabled; // If we allow melee auto attack - float m_AttackDistance; // Distance to attack from - float m_AttackAngle; // Angle of attack uint32 m_InvinceabilityHpLevel; // Minimal health level allowed at damage apply }; diff --git a/src/game/GameObject.h b/src/game/GameObject.h index 29fdc4976..d5bde6b5d 100644 --- a/src/game/GameObject.h +++ b/src/game/GameObject.h @@ -48,152 +48,152 @@ struct GameObjectInfo uint32 questItems[6]; union // different GO types have different data field { - //0 GAMEOBJECT_TYPE_DOOR + // 0 GAMEOBJECT_TYPE_DOOR struct { - uint32 startOpen; //0 used client side to determine GO_ACTIVATED means open/closed - uint32 lockId; //1 -> Lock.dbc + uint32 startOpen; // 0 used client side to determine GO_ACTIVATED means open/closed + uint32 lockId; // 1 -> Lock.dbc uint32 autoCloseTime; //2 secs till autoclose = autoCloseTime / IN_MILLISECONDS (previous was 0x10000) - uint32 noDamageImmune; //3 break opening whenever you recieve damage? - uint32 openTextID; //4 can be used to replace castBarCaption? - uint32 closeTextID; //5 + uint32 noDamageImmune; // 3 break opening whenever you recieve damage? + uint32 openTextID; // 4 can be used to replace castBarCaption? + uint32 closeTextID; // 5 uint32 ignoredByPathing; //6 } door; - //1 GAMEOBJECT_TYPE_BUTTON + // 1 GAMEOBJECT_TYPE_BUTTON struct { - uint32 startOpen; //0 - uint32 lockId; //1 -> Lock.dbc + uint32 startOpen; // 0 + uint32 lockId; // 1 -> Lock.dbc uint32 autoCloseTime; //2 secs till autoclose = autoCloseTime / IN_MILLISECONDS (previous was 0x10000) - uint32 linkedTrapId; //3 - uint32 noDamageImmune; //4 isBattlegroundObject - uint32 large; //5 - uint32 openTextID; //6 can be used to replace castBarCaption? - uint32 closeTextID; //7 - uint32 losOK; //8 + uint32 linkedTrapId; // 3 + uint32 noDamageImmune; // 4 isBattlegroundObject + uint32 large; // 5 + uint32 openTextID; // 6 can be used to replace castBarCaption? + uint32 closeTextID; // 7 + uint32 losOK; // 8 } button; - //2 GAMEOBJECT_TYPE_QUESTGIVER + // 2 GAMEOBJECT_TYPE_QUESTGIVER struct { - uint32 lockId; //0 -> Lock.dbc - uint32 questList; //1 - uint32 pageMaterial; //2 - uint32 gossipID; //3 - uint32 customAnim; //4 - uint32 noDamageImmune; //5 - uint32 openTextID; //6 can be used to replace castBarCaption? - uint32 losOK; //7 - uint32 allowMounted; //8 - uint32 large; //9 + uint32 lockId; // 0 -> Lock.dbc + uint32 questList; // 1 + uint32 pageMaterial; // 2 + uint32 gossipID; // 3 + uint32 customAnim; // 4 + uint32 noDamageImmune; // 5 + uint32 openTextID; // 6 can be used to replace castBarCaption? + uint32 losOK; // 7 + uint32 allowMounted; // 8 + uint32 large; // 9 } questgiver; - //3 GAMEOBJECT_TYPE_CHEST + // 3 GAMEOBJECT_TYPE_CHEST struct { - uint32 lockId; //0 -> Lock.dbc - uint32 lootId; //1 - uint32 chestRestockTime; //2 - uint32 consumable; //3 - uint32 minSuccessOpens; //4 - uint32 maxSuccessOpens; //5 - uint32 eventId; //6 lootedEvent - uint32 linkedTrapId; //7 - uint32 questId; //8 not used currently but store quest required for GO activation for player - uint32 level; //9 - uint32 losOK; //10 - uint32 leaveLoot; //11 - uint32 notInCombat; //12 - uint32 logLoot; //13 - uint32 openTextID; //14 can be used to replace castBarCaption? - uint32 groupLootRules; //15 + uint32 lockId; // 0 -> Lock.dbc + uint32 lootId; // 1 + uint32 chestRestockTime; // 2 + uint32 consumable; // 3 + uint32 minSuccessOpens; // 4 + uint32 maxSuccessOpens; // 5 + uint32 eventId; // 6 lootedEvent + uint32 linkedTrapId; // 7 + uint32 questId; // 8 not used currently but store quest required for GO activation for player + uint32 level; // 9 + uint32 losOK; // 10 + uint32 leaveLoot; // 11 + uint32 notInCombat; // 12 + uint32 logLoot; // 13 + uint32 openTextID; // 14 can be used to replace castBarCaption? + uint32 groupLootRules; // 15 uint32 floatingTooltip; //16 } chest; - //4 GAMEOBJECT_TYPE_BINDER - empty - //5 GAMEOBJECT_TYPE_GENERIC + // 4 GAMEOBJECT_TYPE_BINDER - empty + // 5 GAMEOBJECT_TYPE_GENERIC struct { - uint32 floatingTooltip; //0 - uint32 highlight; //1 - uint32 serverOnly; //2 - uint32 large; //3 - uint32 floatOnWater; //4 - uint32 questID; //5 + uint32 floatingTooltip; // 0 + uint32 highlight; // 1 + uint32 serverOnly; // 2 + uint32 large; // 3 + uint32 floatOnWater; // 4 + uint32 questID; // 5 } _generic; - //6 GAMEOBJECT_TYPE_TRAP + // 6 GAMEOBJECT_TYPE_TRAP struct { - uint32 lockId; //0 -> Lock.dbc - uint32 level; //1 - uint32 radius; //2 radius for trap activation - uint32 spellId; //3 - uint32 charges; //4 need respawn (if > 0) - uint32 cooldown; //5 time in secs + uint32 lockId; // 0 -> Lock.dbc + uint32 level; // 1 + uint32 radius; // 2 radius for trap activation + uint32 spellId; // 3 + uint32 charges; // 4 need respawn (if > 0) + uint32 cooldown; // 5 time in secs uint32 autoCloseTime; //6 secs till autoclose = autoCloseTime / IN_MILLISECONDS (previous was 0x10000) - uint32 startDelay; //7 - uint32 serverOnly; //8 - uint32 stealthed; //9 - uint32 large; //10 - uint32 stealthAffected; //11 - uint32 openTextID; //12 can be used to replace castBarCaption? - uint32 closeTextID; //13 + uint32 startDelay; // 7 + uint32 serverOnly; // 8 + uint32 stealthed; // 9 + uint32 large; // 10 + uint32 stealthAffected; // 11 + uint32 openTextID; // 12 can be used to replace castBarCaption? + uint32 closeTextID; // 13 uint32 ignoreTotems; //14 } trap; - //7 GAMEOBJECT_TYPE_CHAIR + // 7 GAMEOBJECT_TYPE_CHAIR struct { - uint32 slots; //0 - uint32 height; //1 - uint32 onlyCreatorUse; //2 + uint32 slots; // 0 + uint32 height; // 1 + uint32 onlyCreatorUse; // 2 uint32 triggeredEvent; //3 } chair; - //8 GAMEOBJECT_TYPE_SPELL_FOCUS + // 8 GAMEOBJECT_TYPE_SPELL_FOCUS struct { - uint32 focusId; //0 - uint32 dist; //1 - uint32 linkedTrapId; //2 - uint32 serverOnly; //3 - uint32 questID; //4 - uint32 large; //5 + uint32 focusId; // 0 + uint32 dist; // 1 + uint32 linkedTrapId; // 2 + uint32 serverOnly; // 3 + uint32 questID; // 4 + uint32 large; // 5 uint32 floatingTooltip; //6 } spellFocus; - //9 GAMEOBJECT_TYPE_TEXT + // 9 GAMEOBJECT_TYPE_TEXT struct { - uint32 pageID; //0 - uint32 language; //1 - uint32 pageMaterial; //2 - uint32 allowMounted; //3 + uint32 pageID; // 0 + uint32 language; // 1 + uint32 pageMaterial; // 2 + uint32 allowMounted; // 3 } text; - //10 GAMEOBJECT_TYPE_GOOBER + // 10 GAMEOBJECT_TYPE_GOOBER struct { - uint32 lockId; //0 -> Lock.dbc - uint32 questId; //1 - uint32 eventId; //2 + uint32 lockId; // 0 -> Lock.dbc + uint32 questId; // 1 + uint32 eventId; // 2 uint32 autoCloseTime; //3 secs till autoclose = autoCloseTime / IN_MILLISECONDS (previous was 0x10000) - uint32 customAnim; //4 - uint32 consumable; //5 - uint32 cooldown; //6 - uint32 pageId; //7 - uint32 language; //8 - uint32 pageMaterial; //9 - uint32 spellId; //10 - uint32 noDamageImmune; //11 - uint32 linkedTrapId; //12 - uint32 large; //13 - uint32 openTextID; //14 can be used to replace castBarCaption? - uint32 closeTextID; //15 - uint32 losOK; //16 isBattlegroundObject - uint32 allowMounted; //17 - uint32 floatingTooltip; //18 - uint32 gossipID; //19 + uint32 customAnim; // 4 + uint32 consumable; // 5 + uint32 cooldown; // 6 + uint32 pageId; // 7 + uint32 language; // 8 + uint32 pageMaterial; // 9 + uint32 spellId; // 10 + uint32 noDamageImmune; // 11 + uint32 linkedTrapId; // 12 + uint32 large; // 13 + uint32 openTextID; // 14 can be used to replace castBarCaption? + uint32 closeTextID; // 15 + uint32 losOK; // 16 isBattlegroundObject + uint32 allowMounted; // 17 + uint32 floatingTooltip; // 18 + uint32 gossipID; // 19 uint32 WorldStateSetsState; //20 } goober; - //11 GAMEOBJECT_TYPE_TRANSPORT + // 11 GAMEOBJECT_TYPE_TRANSPORT struct { uint32 startFrame; //0 - uint32 startOpen; //1 + uint32 startOpen; // 1 uint32 autoCloseTime; //2 secs till autoclose = autoCloseTime / IN_MILLISECONDS (previous was 0x10000) uint32 pause1EventID; //3 uint32 pause2EventID; //4 @@ -217,148 +217,148 @@ struct GameObjectInfo uint32 unk22; //22 ring of valor elevators uint32 unk23; //23 ring of valor elevators } transport; - //12 GAMEOBJECT_TYPE_AREADAMAGE + // 12 GAMEOBJECT_TYPE_AREADAMAGE struct { - uint32 lockId; //0 - uint32 radius; //1 - uint32 damageMin; //2 - uint32 damageMax; //3 - uint32 damageSchool; //4 + uint32 lockId; // 0 + uint32 radius; // 1 + uint32 damageMin; // 2 + uint32 damageMax; // 3 + uint32 damageSchool; // 4 uint32 autoCloseTime; //5 secs till autoclose = autoCloseTime / IN_MILLISECONDS (previous was 0x10000) - uint32 openTextID; //6 - uint32 closeTextID; //7 + uint32 openTextID; // 6 + uint32 closeTextID; // 7 } areadamage; - //13 GAMEOBJECT_TYPE_CAMERA + // 13 GAMEOBJECT_TYPE_CAMERA struct { - uint32 lockId; //0 -> Lock.dbc - uint32 cinematicId; //1 - uint32 eventID; //2 - uint32 openTextID; //3 can be used to replace castBarCaption? + uint32 lockId; // 0 -> Lock.dbc + uint32 cinematicId; // 1 + uint32 eventID; // 2 + uint32 openTextID; // 3 can be used to replace castBarCaption? } camera; - //14 GAMEOBJECT_TYPE_MAPOBJECT - empty - //15 GAMEOBJECT_TYPE_MO_TRANSPORT + // 14 GAMEOBJECT_TYPE_MAPOBJECT - empty + // 15 GAMEOBJECT_TYPE_MO_TRANSPORT struct { - uint32 taxiPathId; //0 - uint32 moveSpeed; //1 - uint32 accelRate; //2 - uint32 startEventID; //3 - uint32 stopEventID; //4 - uint32 transportPhysics; //5 - uint32 mapID; //6 + uint32 taxiPathId; // 0 + uint32 moveSpeed; // 1 + uint32 accelRate; // 2 + uint32 startEventID; // 3 + uint32 stopEventID; // 4 + uint32 transportPhysics; // 5 + uint32 mapID; // 6 uint32 worldState1; //7 } moTransport; - //16 GAMEOBJECT_TYPE_DUELFLAG - empty + // 16 GAMEOBJECT_TYPE_DUELFLAG - empty //17 GAMEOBJECT_TYPE_FISHINGNODE - empty - //18 GAMEOBJECT_TYPE_SUMMONING_RITUAL + // 18 GAMEOBJECT_TYPE_SUMMONING_RITUAL struct { - uint32 reqParticipants; //0 - uint32 spellId; //1 - uint32 animSpell; //2 - uint32 ritualPersistent; //3 - uint32 casterTargetSpell; //4 - uint32 casterTargetSpellTargets; //5 - uint32 castersGrouped; //6 - uint32 ritualNoTargetCheck; //7 + uint32 reqParticipants; // 0 + uint32 spellId; // 1 + uint32 animSpell; // 2 + uint32 ritualPersistent; // 3 + uint32 casterTargetSpell; // 4 + uint32 casterTargetSpellTargets; // 5 + uint32 castersGrouped; // 6 + uint32 ritualNoTargetCheck; // 7 } summoningRitual; - //19 GAMEOBJECT_TYPE_MAILBOX - empty + // 19 GAMEOBJECT_TYPE_MAILBOX - empty //20 GAMEOBJECT_TYPE_DONOTUSE - empty - //21 GAMEOBJECT_TYPE_GUARDPOST + // 21 GAMEOBJECT_TYPE_GUARDPOST struct { - uint32 creatureID; //0 - uint32 charges; //1 + uint32 creatureID; // 0 + uint32 charges; // 1 } guardpost; - //22 GAMEOBJECT_TYPE_SPELLCASTER + // 22 GAMEOBJECT_TYPE_SPELLCASTER struct { - uint32 spellId; //0 - uint32 charges; //1 - uint32 partyOnly; //2 + uint32 spellId; // 0 + uint32 charges; // 1 + uint32 partyOnly; // 2 uint32 allowMounted; //3 uint32 large; //4 } spellcaster; - //23 GAMEOBJECT_TYPE_MEETINGSTONE + // 23 GAMEOBJECT_TYPE_MEETINGSTONE struct { - uint32 minLevel; //0 - uint32 maxLevel; //1 - uint32 areaID; //2 + uint32 minLevel; // 0 + uint32 maxLevel; // 1 + uint32 areaID; // 2 } meetingstone; - //24 GAMEOBJECT_TYPE_FLAGSTAND + // 24 GAMEOBJECT_TYPE_FLAGSTAND struct { - uint32 lockId; //0 - uint32 pickupSpell; //1 - uint32 radius; //2 - uint32 returnAura; //3 - uint32 returnSpell; //4 - uint32 noDamageImmune; //5 - uint32 openTextID; //6 - uint32 losOK; //7 + uint32 lockId; // 0 + uint32 pickupSpell; // 1 + uint32 radius; // 2 + uint32 returnAura; // 3 + uint32 returnSpell; // 4 + uint32 noDamageImmune; // 5 + uint32 openTextID; // 6 + uint32 losOK; // 7 } flagstand; - //25 GAMEOBJECT_TYPE_FISHINGHOLE + // 25 GAMEOBJECT_TYPE_FISHINGHOLE struct { - uint32 radius; //0 how close bobber must land for sending loot - uint32 lootId; //1 - uint32 minSuccessOpens; //2 - uint32 maxSuccessOpens; //3 - uint32 lockId; //4 -> Lock.dbc; possibly 1628 for all? + uint32 radius; // 0 how close bobber must land for sending loot + uint32 lootId; // 1 + uint32 minSuccessOpens; // 2 + uint32 maxSuccessOpens; // 3 + uint32 lockId; // 4 -> Lock.dbc; possibly 1628 for all? } fishinghole; - //26 GAMEOBJECT_TYPE_FLAGDROP + // 26 GAMEOBJECT_TYPE_FLAGDROP struct { - uint32 lockId; //0 - uint32 eventID; //1 - uint32 pickupSpell; //2 - uint32 noDamageImmune; //3 - uint32 openTextID; //4 + uint32 lockId; // 0 + uint32 eventID; // 1 + uint32 pickupSpell; // 2 + uint32 noDamageImmune; // 3 + uint32 openTextID; // 4 } flagdrop; - //27 GAMEOBJECT_TYPE_MINI_GAME + // 27 GAMEOBJECT_TYPE_MINI_GAME struct { - uint32 gameType; //0 + uint32 gameType; // 0 } miniGame; - //29 GAMEOBJECT_TYPE_CAPTURE_POINT + // 29 GAMEOBJECT_TYPE_CAPTURE_POINT struct { - uint32 radius; //0 - uint32 spell; //1 - uint32 worldState1; //2 - uint32 worldState2; //3 - uint32 winEventID1; //4 - uint32 winEventID2; //5 - uint32 contestedEventID1; //6 - uint32 contestedEventID2; //7 - uint32 progressEventID1; //8 - uint32 progressEventID2; //9 - uint32 neutralEventID1; //10 - uint32 neutralEventID2; //11 - uint32 neutralPercent; //12 - uint32 worldState3; //13 - uint32 minSuperiority; //14 - uint32 maxSuperiority; //15 - uint32 minTime; //16 - uint32 maxTime; //17 - uint32 large; //18 - uint32 highlight; //19 + uint32 radius; // 0 + uint32 spell; // 1 + uint32 worldState1; // 2 + uint32 worldState2; // 3 + uint32 winEventID1; // 4 + uint32 winEventID2; // 5 + uint32 contestedEventID1; // 6 + uint32 contestedEventID2; // 7 + uint32 progressEventID1; // 8 + uint32 progressEventID2; // 9 + uint32 neutralEventID1; // 10 + uint32 neutralEventID2; // 11 + uint32 neutralPercent; // 12 + uint32 worldState3; // 13 + uint32 minSuperiority; // 14 + uint32 maxSuperiority; // 15 + uint32 minTime; // 16 + uint32 maxTime; // 17 + uint32 large; // 18 + uint32 highlight; // 19 uint32 startingValue; //20 uint32 unidirectional; //21 } capturePoint; - //30 GAMEOBJECT_TYPE_AURA_GENERATOR + // 30 GAMEOBJECT_TYPE_AURA_GENERATOR struct { - uint32 startOpen; //0 - uint32 radius; //1 - uint32 auraID1; //2 - uint32 conditionID1; //3 - uint32 auraID2; //4 - uint32 conditionID2; //5 - uint32 serverOnly; //6 + uint32 startOpen; // 0 + uint32 radius; // 1 + uint32 auraID1; // 2 + uint32 conditionID1; // 3 + uint32 auraID2; // 4 + uint32 conditionID2; // 5 + uint32 serverOnly; // 6 } auraGenerator; //31 GAMEOBJECT_TYPE_DUNGEON_DIFFICULTY struct @@ -372,33 +372,33 @@ struct GameObjectInfo uint32 chairheight; //0 uint32 heightOffset; //1 } barberChair; - //33 GAMEOBJECT_TYPE_DESTRUCTIBLE_BUILDING + //33 GAMEOBJECT_TYPE_DESTRUCTIBLE_BUILDING // Much guesswork struct { uint32 intactNumHits; //0 uint32 creditProxyCreature; //1 uint32 empty1; //2 uint32 intactEvent; //3 - uint32 empty2; //4 + uint32 damagedDisplayId; //4 uint32 damagedNumHits; //5 - uint32 empty3; //6 - uint32 empty4; //7 - uint32 empty5; //8 + uint32 unk1; //6 + uint32 unk2; //7 + uint32 unk3; //8 uint32 damagedEvent; //9 - uint32 empty6; //10 - uint32 empty7; //11 - uint32 empty8; //12 - uint32 empty9; //13 + uint32 destroyedDisplayId; //10 + uint32 unk4; //11 + uint32 unk5; //12 + uint32 unk6; //13 uint32 destroyedEvent; //14 uint32 empty10; //15 - uint32 debuildingTimeSecs; //16 + uint32 debuildingTimeSecs; //16 // unk, only few with value 300) uint32 empty11; //17 - uint32 destructibleData; //18 - uint32 rebuildingEvent; //19 - uint32 empty12; //20 + uint32 destructibleData; //18 m_ID of DestructibleModelData.DBC + uint32 empty12; //19 + uint32 unk7; //20 uint32 empty13; //21 - uint32 damageEvent; //22 - uint32 empty14; //23 + uint32 rebuildingEvent; //22 + uint32 unk8; //23 } destructibleBuilding; //34 GAMEOBJECT_TYPE_GUILDBANK - empty //35 GAMEOBJECT_TYPE_TRAPDOOR @@ -533,17 +533,6 @@ struct GameObjectInfo default: return 0; } } - - uint32 GetEventScriptId() const - { - switch (type) - { - case GAMEOBJECT_TYPE_GOOBER: return goober.eventId; - case GAMEOBJECT_TYPE_CHEST: return chest.eventId; - case GAMEOBJECT_TYPE_CAMERA: return camera.eventID; - default: return 0; - } - } }; // GCC have alternative #pragma pack() syntax and old gcc version not support pack(pop), also any gcc version not support it at some platform @@ -635,6 +624,7 @@ enum CapturePointSlider }; class Unit; +class GameObjectModel; struct GameObjectDisplayInfoEntry; // 5 sec for bobber catch @@ -723,20 +713,21 @@ class MANGOS_DLL_SPEC GameObject : public WorldObject GameobjectTypes GetGoType() const { return GameobjectTypes(GetByteValue(GAMEOBJECT_BYTES_1, 1)); } void SetGoType(GameobjectTypes type) { SetByteValue(GAMEOBJECT_BYTES_1, 1, type); } GOState GetGoState() const { return GOState(GetByteValue(GAMEOBJECT_BYTES_1, 0)); } - void SetGoState(GOState state) { SetByteValue(GAMEOBJECT_BYTES_1, 0, state); } + void SetGoState(GOState state); uint8 GetGoArtKit() const { return GetByteValue(GAMEOBJECT_BYTES_1, 2); } void SetGoArtKit(uint8 artkit) { SetByteValue(GAMEOBJECT_BYTES_1, 2, artkit); } uint8 GetGoAnimProgress() const { return GetByteValue(GAMEOBJECT_BYTES_1, 3); } void SetGoAnimProgress(uint8 animprogress) { SetByteValue(GAMEOBJECT_BYTES_1, 3, animprogress); } uint32 GetDisplayId() const { return GetUInt32Value(GAMEOBJECT_DISPLAYID); } void SetDisplayId(uint32 modelId); + void SetPhaseMask(uint32 newPhaseMask, bool update); float GetObjectBoundingRadius() const override; // overwrite WorldObject version void Use(Unit* user); LootState getLootState() const { return m_lootState; } - void SetLootState(LootState s) { m_lootState = s; } + void SetLootState(LootState s); void AddToSkillupList(Player* player); bool IsInSkillupList(Player* player) const; @@ -759,7 +750,6 @@ class MANGOS_DLL_SPEC GameObject : public WorldObject // Loot System Loot loot; - void getFishLoot(Loot* loot, Player* loot_owner); void StartGroupLoot(Group* group, uint32 timer) override; ObjectGuid GetLootRecipientGuid() const { return m_lootRecipientGuid; } @@ -784,8 +774,17 @@ class MANGOS_DLL_SPEC GameObject : public WorldObject void SummonLinkedTrapIfAny(); void TriggerLinkedGameObject(Unit* target); + // Destructible GO handling + void DealGameObjectDamage(uint32 damage, uint32 spell, Unit* caster); + void RebuildGameObject(uint32 spell, Unit* caster); + void ForceGameObjectHealth(int32 diff, Unit* caster); + uint32 GetHealth() const { return m_useTimes; } + uint32 GetMaxHealth() const { return m_goInfo->destructibleBuilding.intactNumHits + m_goInfo->destructibleBuilding.damagedNumHits; } + bool isVisibleForInState(Player const* u, WorldObject const* viewPoint, bool inVisibleList) const override; + bool IsCollisionEnabled() const; // Check if a go should collide. Like if a door is closed + GameObject* LookupFishingHoleAround(float range); void SetCapturePointSlider(float value); @@ -793,6 +792,8 @@ class MANGOS_DLL_SPEC GameObject : public WorldObject GridReference& GetGridRef() { return m_gridRef; } + GameObjectModel* m_model; + protected: uint32 m_spellId; time_t m_respawnTime; // (secs) time of next respawn (or despawn if GO have owner()), @@ -808,7 +809,7 @@ class MANGOS_DLL_SPEC GameObject : public WorldObject GuidSet m_SkillupSet; // players that already have skill-up at GO use - uint32 m_useTimes; // amount uses/charges triggered + uint32 m_useTimes; // amount uses/charges triggered - also used for health for DESTRUCTIBLE_BUILDING // collected only for GAMEOBJECT_TYPE_SUMMONING_RITUAL ObjectGuid m_firstUser; // first GO user, in most used cases owner, but in some cases no, for example non-summoned multi-use GAMEOBJECT_TYPE_SUMMONING_RITUAL @@ -829,7 +830,10 @@ class MANGOS_DLL_SPEC GameObject : public WorldObject private: void SwitchDoorOrButton(bool activate, bool alternative = false); void TickCapturePoint(); + void UpdateModel(); // updates model in case displayId were changed + void UpdateCollisionState() const; // updates state in Map's dynamic collision tree GridReference m_gridRef; }; + #endif