Trinitycore: [Core/Spawns] Gameobjects are unable of being owners of their summoned units

Created on 4 May 2019  路  13Comments  路  Source: TrinityCore/TrinityCore

Description:

Right now, if gameobject happens to be the one summoning creatures it is unable to be owner of these creatures. It all starts from here where ToUnit() call fails when object is not Unit (gameobject case) and later into the summoning call stack it fails to set owner of that TempSummon (creation of the object) few moments later this owner is required in order to raise IsSummonedBy or JustSummoned hooks, thus leaving those hooks not being raised when summoner type is gameobject.

Expected behaviour: I think it is valid that gameobject can be owner if creature it summons.

Branch(es): 3.3.5/master

TC rev. hash/commit: https://github.com/TrinityCore/TrinityCore/commit/91409cc77e5076e43046dc9749308afcf52f04db (master) https://github.com/TrinityCore/TrinityCore/commit/758814f9098051e1eab21fde8d91a8a3cf0587aa (3.3.5)

Branch-3.3.5a Comp-Core Priority-FutureFeatureRequest Sub-GameObject

Most helpful comment

blizzard summon a world trigger

Invisible world triggers for GO casting are entirely a private server invention. Blizzard never used anything of the sort. They had the ability to script GOs and make them cast spells even in Alpha.

Now that GO-casting has been implemented in TC as well, there is now a need to track if something got summoned in the result of said casting, which is what this issue is about and what #23289 accomplishes.

All 13 comments

could you check what the sniffs say about the summoner in the case where a gameobject looks like being the summoner ?

Sadly I have no idea of what sniffs are and how to work with them (still new here :/).

I mean obviously that is some data sniffed from retail, but I don't know how to access it and understand it, maybe someone else can help you with that task, sorry :/

build 18414, sadly

ServerToClient: SMSG_SPELL_GO (0x09D8) Length: 59 ConnIdx: 0 Time: 08/12/2014 16:16:07.000 Number: 298488
Target Flags: 64 (DestinationLocation)
Int50: -889105499
Position: X: 271.599 Y: -221.3421 Z: -9.10098
DestLocationTargetGUID: 0x0
Cast Flags: 4869 (PendingCast, Unknown2, Unknown7, Unknown8, Unknown10)
CastCount: 0
Spell ID: 47947 (Crystal Spike)
casterUnitGUID: Full: 0xF112E0790000213A Type: GameObject Entry: 188537 (Crystal Spike) Low: 8506
CasterGUID: 0x0
targetGUID: 0x0
ItemTargetGUID: 0x0
UnkGUID: 0x0

ServerToClient: SMSG_SPELL_GO (0x09D8) Length: 59 ConnIdx: 0 Time: 08/12/2014 16:16:07.000 Number: 298489
Target Flags: 64 (DestinationLocation)
Int50: -889105498
Position: X: 265.3564 Y: -229.7953 Z: -9.10098
DestLocationTargetGUID: 0x0
Cast Flags: 4869 (PendingCast, Unknown2, Unknown7, Unknown8, Unknown10)
CastCount: 0
Spell ID: 47947 (Crystal Spike)
casterUnitGUID: Full: 0xF112E0790000213B Type: GameObject Entry: 188537 (Crystal Spike) Low: 8507
CasterGUID: 0x0
targetGUID: 0x0
ItemTargetGUID: 0x0
UnkGUID: 0x0


ServerToClient: SMSG_UPDATE_OBJECT (0x1792) Length: 4550 ConnIdx: 0 Time: 08/12/2014 16:16:07.000 Number: 298493
Map: 576
Count: 16

[12] UpdateType: CreateObject2
[12] GUID: Full: 0xF13069DB0001A845 Type: Creature Entry: 27099 (Crystal Spike) Low: 108613
[12] Object Type: 3 (Unit)
[12] bit676: False
[12] Has Anim Kits: False
[12] Is Living: True
[12] bit810: False
[12] Transport Frames Count: 0
[12] Has Vehicle Data: False
[12] bit1044: False
[12] bit476: False
[12] Has GameObject Rotation: False
[12] bit680: False
[12] Has Attacking Target: False
[12] Has Scene Object Data: False
[12] bit1064: False
[12] bit668: False
[12] Has Transport Position: False
[12] bit681: False
[12] Has Stationary Position: False
[12] Has Pitch: True
[12] Has Transport Data: False
[12] bits98: 0
[12] Movement Flags: 1536 (OnTransport, DisableGravity)
[12] Has SplineElevation: True
[12] Has SplineData: True
[12] Spline ID: 4115560
[12] Fly Speed: 7
[12] Turn Speed: 3.141593
[12] Time?: 3405861806
[12] Swim Speed: 4.5
[12] Pitch Speed: 3.141593
[12] Orientation: 4.365812
[12] Walk Speed: 2.5
[12] Fly Back Speed: 4.5
[12] Run Back Speed: 2.5
[12] Run Speed: 10
[12] Swim Back Speed: 4.72222
[12] Position: X: 271.599 Y: -221.3421 Z: -9.10098
[12] OBJECT_FIELD_GUID: 108613/1.521992E-40
[12] 1: 4046481883/-8.735573E+29
[12] OBJECT_FIELD_TYPE: 9/1.261169E-44
[12] OBJECT_FIELD_ENTRY: 27099/3.797379E-41
[12] OBJECT_FIELD_SCALE_X: 1065353216/1
[12] UNIT_FIELD_BYTES_0: 33554688/9.404242E-38
[12] UNIT_FIELD_DISPLAY_POWER: 1/1.401298E-45
[12] UNIT_FIELD_HEALTH: 9610/1.346648E-41
[12] UNIT_FIELD_MAXHEALTH: 9610/1.346648E-41
[12] UNIT_FIELD_LEVEL: 72/1.008935E-43
[12] UNIT_FIELD_FACTIONTEMPLATE: 16/2.242078E-44
[12] UNIT_FIELD_FLAGS: 33554944/9.404529E-38
[12] UNIT_FIELD_FLAGS_2: 2048/2.869859E-42
[12] UNIT_FIELD_BASEATTACKTIME: 2400/3.363116E-42
[12] UNIT_FIELD_BASEATTACKTIME + 1: 2400/3.363116E-42
[12] UNIT_FIELD_BOUNDINGRADIUS: 1053273620/0.39
[12] UNIT_FIELD_COMBATREACH: 1065353216/1
[12] UNIT_FIELD_DISPLAYID: 23767/3.330466E-41
[12] UNIT_FIELD_NATIVEDISPLAYID: 23767/3.330466E-41
[12] UNIT_MOD_CAST_SPEED: 1065353216/1
[12] UNIT_MOD_CAST_HASTE: 1065353216/1
[12] UNIT_FIELD_MOD_HASTE: 1065353216/1
[12] UNIT_FIELD_MOD_RANGED_HASTE: 1065353216/1
[12] UNIT_FIELD_MOD_HASTE_REGEN: 1065353216/1
[12] UNIT_CREATED_BY_SPELL: 47947/6.718806E-41
[12] UNIT_FIELD_BYTES_2: 1/1.401298E-45
[12] UNIT_FIELD_HOVERHEIGHT: 1065353216/1
[13] UpdateType: CreateObject2
[13] GUID: Full: 0xF13069DB0001A846 Type: Creature Entry: 27099 (Crystal Spike) Low: 108614
[13] Object Type: 3 (Unit)
[13] bit676: False
[13] Has Anim Kits: False
[13] Is Living: True
[13] bit810: False
[13] Transport Frames Count: 0
[13] Has Vehicle Data: False
[13] bit1044: False
[13] bit476: False
[13] Has GameObject Rotation: False
[13] bit680: False
[13] Has Attacking Target: False
[13] Has Scene Object Data: False
[13] bit1064: False
[13] bit668: False
[13] Has Transport Position: False
[13] bit681: False
[13] Has Stationary Position: False
[13] Has Pitch: True
[13] Has Transport Data: False
[13] bits98: 0
[13] Movement Flags: 1536 (OnTransport, DisableGravity)
[13] Has SplineElevation: True
[13] Has SplineData: True
[13] Spline ID: 4115562
[13] Fly Speed: 7
[13] Turn Speed: 3.141593
[13] Time?: 3405861806
[13] Swim Speed: 4.5
[13] Pitch Speed: 3.141593
[13] Orientation: 5.936605
[13] Walk Speed: 2.5
[13] Fly Back Speed: 4.5
[13] Run Back Speed: 2.5
[13] Run Speed: 10
[13] Swim Back Speed: 4.72222
[13] Position: X: 265.3564 Y: -229.7953 Z: -9.10098
[13] OBJECT_FIELD_GUID: 108614/1.522006E-40
[13] 1: 4046481883/-8.735573E+29
[13] OBJECT_FIELD_TYPE: 9/1.261169E-44
[13] OBJECT_FIELD_ENTRY: 27099/3.797379E-41
[13] OBJECT_FIELD_SCALE_X: 1065353216/1
[13] UNIT_FIELD_BYTES_0: 33554688/9.404242E-38
[13] UNIT_FIELD_DISPLAY_POWER: 1/1.401298E-45
[13] UNIT_FIELD_HEALTH: 9610/1.346648E-41
[13] UNIT_FIELD_MAXHEALTH: 9610/1.346648E-41
[13] UNIT_FIELD_LEVEL: 72/1.008935E-43
[13] UNIT_FIELD_FACTIONTEMPLATE: 16/2.242078E-44
[13] UNIT_FIELD_FLAGS: 33554944/9.404529E-38
[13] UNIT_FIELD_FLAGS_2: 2048/2.869859E-42
[13] UNIT_FIELD_BASEATTACKTIME: 2400/3.363116E-42
[13] UNIT_FIELD_BASEATTACKTIME + 1: 2400/3.363116E-42
[13] UNIT_FIELD_BOUNDINGRADIUS: 1053273620/0.39
[13] UNIT_FIELD_COMBATREACH: 1065353216/1
[13] UNIT_FIELD_DISPLAYID: 23767/3.330466E-41
[13] UNIT_FIELD_NATIVEDISPLAYID: 23767/3.330466E-41
[13] UNIT_MOD_CAST_SPEED: 1065353216/1
[13] UNIT_MOD_CAST_HASTE: 1065353216/1
[13] UNIT_FIELD_MOD_HASTE: 1065353216/1
[13] UNIT_FIELD_MOD_RANGED_HASTE: 1065353216/1
[13] UNIT_FIELD_MOD_HASTE_REGEN: 1065353216/1
[13] UNIT_CREATED_BY_SPELL: 47947/6.718806E-41
[13] UNIT_FIELD_BYTES_2: 1/1.401298E-45
[13] UNIT_FIELD_HOVERHEIGHT: 1065353216/1

@xvwyh does that tell us anything useful ?

I dunno, you asked for sniffs. 馃槃
The only thing that can be taken from this is that GO's GUID is not written to UNIT_FIELD_SUMMONEDBY or UNIT_FIELD_CREATEDBY. But then again, TempSummon::GetSummoner() doesn't take data from that field anyway, so that changes nothing.

@kuskmen please check if https://github.com/TrinityCore/TrinityCore/pull/23289 fits your need

I will take a look whenever I got the chance, currently I have some exams so I am kinda busy but I will try to find couple of hours next week :)

Realy needed?
In my experience, normally when game object needs some logic like that, blizzard summon a world trigger to handle with it.
I think that @Ovahlord already scripted more game objects then me, may he know better.

blizzard summon a world trigger

Invisible world triggers for GO casting are entirely a private server invention. Blizzard never used anything of the sort. They had the ability to script GOs and make them cast spells even in Alpha.

Now that GO-casting has been implemented in TC as well, there is now a need to track if something got summoned in the result of said casting, which is what this issue is about and what #23289 accomplishes.

I think you miss-aimed here a bit. He did not mean that world triggers are used for gameobject prior to the spell internals rework but he said that Blizzard is using controller npcs and the bosses or the instance itself to handle summons as they serve as the handler for scripted behaivior.

From what I have seen over the years gameobjects never are used for deeper AI behaivior at all. The most complex ones I have seen were 'click --> inform instance about some action', that's all. The only thing where I would consider such a summon handling useful would for despawning encounter related summons but I am pretty sure Blizz has a container for all encounter related entities instead of creating ugly AI call chains and even then I would prefer using bosses and controller npcs as the handlers so I would redirect the JustSummoned call over to the gameobject's summoner.

Well, them not using GO scripting extensively doesn't mean it didn't exist. #6388, for example, shows us that GO scripts can execute actions with delays if my assumptions are correct, so one can extrapolate that GOs also use blizzard's actionlist/actionset system (partly because there are no traces of any other scripting systems in executables and .IDBs that GOs could use instead of actionsets. In later expansions, however, a new scripting system was created to script worldstates, and that one is indeed present in executables). The reason why creatures are more often used as event controllers might be because creatures have a much wider array of things that you can do with them: they have spell sets that can be switched around, action triggers that can be switched around, they care enter and leave combat, react to combat-only triggers, share aggro, change "mode" (entry) at will, have spellclicks which essentially allows them to pretend that they are objects (cata has numerous creatures that look like GOs, act like GOs, but are creatures with spellclicks).

jackpoz's inclusion of GameObjectAI::JustSummoned, SummonedCreatureDespawn and SummonedCreatureDies does seem not very useful, but they came essentially "for free" after TempSummon's summoner was changed to WorldObject, so why the hell not? You don't have to use it if you don't need it. The root cause behind the issue and the PR was that IsSummonedBy is not being called on summons if they are summoned not by units but by objects. I don't think there's reason to argue that IsSummonedBy should not be called in case a GO summoned it, it's not called IsSummonedByUnit, so why should the behavior differ depending on who's the summoner? There are probably plenty of other places with similar issues that came to be with the introduction of GO-casting.

I am pretty sure Blizz has a container for all encounter related entities instead of creating ugly AI call chains

I actually think that it's quite the opposite. Perhaps by now blizzard has better infrastructure for instance scripting, but I doubt they had it during vanilla days and early expansion. I imagine that everything back then was haphazardly scripted and held together by duct tape and prayers, and that the tools we have in Trinity now far exceed what blizzard had (even though far too often we have to get code involved, while proper developers like blizzard will have all the content as data). SAI alone, I'd say, beats blizzard's actionsets, albeit SAI is much less convenient to use. But all this is just my guesses, I have nothing to back my words.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

besplash picture besplash  路  3Comments

chilito picture chilito  路  3Comments

Rushor picture Rushor  路  3Comments

Rushor picture Rushor  路  3Comments

daddycaddy picture daddycaddy  路  3Comments