Description:
I've noticed that almost every NPC with waypoint movement in classic zones have their equipments sheathed, and this should not be.
Branch(es):
3.3.5
TC rev. hash/commit:
TrinityCore rev. 9fa6885 2017-08-08 11:36:46 -0300 (3.3.5 branch) (Win64, Release, Static) (worldserver-daemon)
TDB version: 335.63
Operating system: Windows 7
Suggested Fix:
There's too many of them to fix them one by one, so I think it's better to use a general fix. Of course, it may affect some creatures that should actually have their equipment sheathed (Don't know any, I'm just speculating).
``sql
UPDATEcreature_addonSETbytes2=4097 WHEREpath_id`>0;
That seems to be mildly retarded
@malcrom Sorry, what did you mean?
You just can't set the sheath state for all NPCs with no path
WHERE `path_id` > 0;
This will set the sheath state for all NPCs with path
Of course, it may affect some creatures that should actually have their equipment sheathed (Don't know any, I'm just speculating).
Then maybe better to use this?
``sql
UPDATEcreature_addonSETbytes2=4097 WHEREpath_id> 0 AND !bytes2`;
What about something like this:
``sql
UPDATEcreature_addonSETbytes2=4097 WHEREpath_id> 0 ANDguidIN ( SELECTguidFROMcreatureWHEREidIN (SELECTCreatureIDFROMcreature_equip_template`));
or we can use equipment_id IN (1,-1) directly from creature.
``sql
UPDATEcreature_addonSETbytes2=4097 WHEREpath_id> 0 ANDguidIN ( SELECTguidFROMcreatureWHEREequipment_id` IN (1,-1));
I thought bytes2 was a sniffed value?
Are there NPCs that have bytes2 already set to something that doesn't include the 2 bit? As these would get overwritten.
edit: the above query would overwrite 1319 existing spawns which have bytes2 already set to something non-zero and not 4097.
In this case we can update this npcs only:
Than check the ones manually.
``sql
SELECT * FROMcreature_addonWHEREpath_id> 0 ANDguidIN ( SELECTguidFROMcreatureWHEREidIN (SELECTCreatureIDFROMcreature_equip_template)) ANDbytes2`=0;
Limiting it to creature entries that have 0 for bytes2 and a path set and an equipped weapon would seem to be the least likely to cause a problem. I think global updates are a bit of a risk though. Also a huge number of existing spawns have bytes2 set to 1, which may or may not have the same effect as 4097.
bytes2=0 and bytes2=4097 have the same result, is always unsheathed.
You mean = 1? If it's just the first bit then any odd number will give that effect.
You have to fix the wrong ones individually not set them all the same.
Yes bytes2=1 and bytes2=4097 have the same result.
For a global update you should OR the bytes2, you shouldn't set them in this case. This prevents overwriting already existing states from bytes2 - so basicly
UPDATE `creature_addon` SET `bytes2`=`bytes2`|0xblah WHERE some conditions are met
``sql
UPDATEcreature_addonSETbytes2=2 WHEREpath_id> 0 ANDguidIN ( SELECTguidFROMcreatureWHEREidIN (SELECTCreatureIDFROMcreature_equip_templateWHEREItemID1=0 ANDItemID2=0 ANDItemID3>0)) ANDbytes2=0;
UPDATEcreature_addonSETbytes2=1 WHEREpath_id> 0 ANDguidIN ( SELECTguidFROMcreatureWHEREidIN (SELECTCreatureIDFROMcreature_equip_templateWHEREItemID1>0)) ANDbytes2`=0;