trickerer / Trinity-Bots

NPCBots for TrinityCore and AzerothCore 3.3.5
https://github.com/trickerer/TrinityCore-3.3.5-with-NPCBots/
472 stars 157 forks source link

[AC] [Question] [Core] Are NPC Bots counts as player in ObjectAccessor? #872

Closed jacatinelord closed 2 months ago

jacatinelord commented 2 months ago

DO NOT REMOVE OR SKIP THE ISSUE TEMPLATE

Description

Hello, just wondering if NPC Bots counts as player? i tried to fix something on the code that related to the ObjectAccessor that affect something in Item and Guild thing. Crashing sometimes because of invalid provided guid. I do a console logging, and the ObjectAccessor constantly giving update, and i assume it is from the NPC Bots because the wandering NPC Bot is enabled and spawned many Free NPC Bot too, is that true?

Just wondering and asking, thank you for your time.

TrinityCore or AzerothCore

AzerothCore

Core rev. hash/commit

No response

Operating system

No response

trickerer commented 2 months ago

NPCBots don't count as players. NPCBots are creatures and thus have creature guids (always starting with 0xF130). This 'high part' of a guid ensures that guids of different types do not intesect

The main implication regarding ObjectAccessor is: just like with any other creature, passing bot's guid to ObjectAccessor::FindPlayer type methods will always return nullptr

jacatinelord commented 2 months ago

I see, got it! Thank you for your explanation