server icon indicating copy to clipboard operation
server copied to clipboard

[database] Mob fields are confusingly named

Open zach2good opened this issue 3 years ago • 2 comments

I'm trying to turn my caps into mob entries, and it's a nightmare jumping between the db, the flag enums, and the caps trying to figure out what goes where.

Shall we rename everything to be sane, or leave comments explaining what each thing does:

  `flag` int(11) unsigned NOT NULL DEFAULT '0', -- Doesn't appear to be used by Mobs
  `entityFlags` int(11) unsigned NOT NULL DEFAULT '0', -- Maps to m_flags in Mob
  • [x] I have paid attention to this example and will edit again if need be to not break the formatting, or I will be ignored
  • [x] I have searched existing issues to see if the issue has already been opened
  • [x] I have checked the commit log to see if the issue has been resolved since my server was last updated
  • [x] I have read the Contributing Guide
  • [x] I have specified what branch this happens on branch: all

Additional Information (Steps to reproduce/Expected behavior) :

zach2good avatar Jun 19 '21 08:06 zach2good

They used to be "flag" and "flags" which lead to everyone updating the wrong one constantly. I renamed it to entityFlags in both SQL and parts of the core dealing with it (but still m_flags in places) and the otehr field is unused. nobody knows what it would have been for but I think it was a placeholder for something that never happened. Possibly the older framework of pathing (think rapido) before navmeshing happened. I think that is a possibility because pathed NPC's DID use it in the far distant past, and you can actually see it in retail and seems to auto count upward as they move so its likely a step counter. When they reach they reach the spot they started at it resets to zero. They names were simply copied from the packet capture tool of the day (plogger). I have plans to wipe out that field in NPCs and place something completely different there, but haven't had time to do the deed.

in truth entityFlags is mainly "nameflags, but for mobs and npcs." - their values will not line up with values used on a player though. everything seems shifted over by 2 bytes, a handful of bit flags do different things, they have a few players do not and player have a few that mobs/npc's do not. Mobs and NPCs do share the entire mask though - to the client there isn't really a difference here being one type or the other is just a few switches flipped and stats tacked on (like, npc's don't have levels)

worth noting there are more byte at different offset from where this is. That goes for players as well and for many of those we've just been hard coding in packets to get accurate in game depictions (rather than making another enum). There's also the fact we have nameflags and nnameflags with 2 n as a result of someone merging a pr before the author was really done with it.

This concludes old man Teo story time slash Ted Talk. /bow

TeoTwawki avatar Jun 19 '21 18:06 TeoTwawki

Recently I learned ashita just calls our "entityFlags" nameflags, and has another flag field in the client it labels "Entity Flags" that has to do with bits for things like your shadow on the ground. And that there are 8x 32bit flag fields in the client and we have several bytes from several fields jammed into our "entityFlags" field we use on mob/npc AND our "nameflags" we use on the players. OH BROTHER.


Flags0 (Render Flags)

  • unknown

Flags1 (nameflages)

  • Party
  • Away
  • Anon
  • etc.

Flags2 (nameflags)

  • Bazaar
  • GM Icon
  • etc.

Flags3 ("Entity Flags" in ashita)

  • Shadow detail

Flags4 (more nameflags)

  • Name Visibility

Flags5 (animation)

  • Geomancer Indi's

Flags6 (Unknown)

  • Unknown

Flags7 (Overhead Flags)

  • Hi-word: Jump Emote, Model Visibility etc.
  • Low-word: Job Mastery Stars, Party Seek Mastery Star, etc.
  • Low-Byte: Timer of some sort.

Flags8 (Overhead Flags)

  • Job mastery

TeoTwawki avatar Sep 20 '22 18:09 TeoTwawki