[Zone] Make zone controller less likely to be visible, immune to all forms of combat (#4750)

* [Zone] Make zone controller less likely to be visible, immune to all forms of combat

* Exclude zone controller from scanning
This commit is contained in:
Chris Miles 2025-03-06 16:08:08 -06:00 committed by GitHub
parent d6a21be25e
commit 0c301419c2
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
4 changed files with 13 additions and 7 deletions

View File

@ -2914,7 +2914,7 @@ void EntityList::ScanCloseMobs(Mob *scanning_mob)
return;
}
if (scanning_mob->GetID() <= 0) {
if (scanning_mob->GetID() <= 0 || scanning_mob->IsZoneController()) {
return;
}
@ -2933,7 +2933,7 @@ void EntityList::ScanCloseMobs(Mob *scanning_mob)
for (auto &e : mob_list) {
auto mob = e.second;
if (mob && mob->GetID() <= 0) {
if (mob && (mob->GetID() <= 0 || mob->IsZoneController())) {
continue;
}

View File

@ -1453,6 +1453,10 @@ void Mob::FillSpawnStruct(NewSpawn_Struct* ns, Mob* ForWho)
ns->spawn.flymode = 0;
}
if (IsZoneController()) {
ns->spawn.invis = 255; // gm invis
}
if (RuleB(Character, AllowCrossClassTrainers) && ForWho) {
if (ns->spawn.class_ >= Class::WarriorGM && ns->spawn.class_ <= Class::BerserkerGM) {
int trainer_class = Class::WarriorGM + (ForWho->GetClass() - 1);
@ -8347,7 +8351,7 @@ int Mob::DispatchZoneControllerEvent(
RuleB(Zone, UseZoneController) &&
(
!IsNPC() ||
(IsNPC() && GetNPCTypeID() != ZONE_CONTROLLER_NPC_ID)
(IsNPC() && !IsZoneController())
)
) {
auto controller = entity_list.GetNPCByNPCTypeID(ZONE_CONTROLLER_NPC_ID);

View File

@ -671,6 +671,7 @@ public:
((static_cast<float>(current_mana) / max_mana) * 100); }
virtual int64 CalcMaxMana();
uint32 GetNPCTypeID() const { return npctype_id; }
inline bool IsZoneController() const { return npctype_id == ZONE_CONTROLLER_NPC_ID; }
void SetNPCTypeID(uint32 npctypeid) { npctype_id = npctypeid; }
inline const glm::vec4& GetPosition() const { return m_Position; }
inline void SetPosition(const float x, const float y, const float z) { m_Position.x = x; m_Position.y = y; m_Position.z = z; }

View File

@ -941,13 +941,14 @@ bool NPC::SpawnZoneController()
npc_type->findable = 0;
npc_type->trackable = 0;
npc_type->untargetable = 1;
strcpy(npc_type->special_abilities, "12,1^13,1^14,1^15,1^16,1^17,1^19,1^22,1^24,1^25,1^28,1^31,1^35,1^39,1^42,1");
strcpy(npc_type->special_abilities, "1,1,3000,50^12,1^14,1^16,1^18,1^19,1^20,1^21,1^22,1^23,1^24,1^25,1^26,1^32,1^33,1^35,1^46,1^47,1^48,1^49,1^50,1^52,1^53,1^54,1^55,1^56,1^57,1");
glm::vec4 point;
point.x = 3000;
point.y = 1000;
point.z = 500;
point.x = 30000;
point.y = 10000;
point.z = -10000;
auto npc = new NPC(npc_type, nullptr, point, GravityBehavior::Flying);
npc->GiveNPCTypeData(npc_type);