MCPcopy Create free account
hub / github.com/EQEmu/EQEmu / MobProcess

Method MobProcess

zone/entity.cpp:471–584  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

469}
470
471void EntityList::MobProcess()
472{
473 bool mob_dead;
474
475 auto it = mob_list.begin();
476 while (it != mob_list.end()) {
477 uint16 id = it->first;
478 Mob *mob = it->second;
479
480 size_t sz = mob_list.size();
481
482 static int old_client_count = 0;
483 static Timer *mob_settle_timer = new Timer();
484
485 if (zone->IsIdleWhenEmpty()) {
486 if (
487 numclients == 0 &&
488 old_client_count > 0 &&
489 zone->GetSecondsBeforeIdle() > 0
490 ) {
491 LogInfo(
492 "Zone will go into an idle state after [{}] second{}.",
493 zone->GetSecondsBeforeIdle(),
494 zone->GetSecondsBeforeIdle() != 1 ? "s" : ""
495 );
496 mob_settle_timer->Start(zone->GetSecondsBeforeIdle() * 1000);
497 }
498
499 if (numclients == 0 && mob_settle_timer->Check()) {
500 LogInfo(
501 "Zone has gone idle after [{}] second{}.",
502 zone->GetSecondsBeforeIdle(),
503 zone->GetSecondsBeforeIdle() != 1 ? "s" : ""
504 );
505
506 CheckToClearTraderAndBuyerTables();
507
508 mob_settle_timer->Disable();
509 }
510
511 // Disable settle timer if someone zones into empty zone
512 if (numclients > 0 || mob_settle_timer->Check()) {
513 if (mob_settle_timer->Enabled()) {
514 LogInfo("Zone is no longer scheduled to go idle.");
515 mob_settle_timer->Disable();
516 }
517 }
518
519 old_client_count = numclients;
520
521 Spawn2* s2 = mob->CastToNPC()->respawn2;
522
523 // Perform normal mob processing if any of these are true:
524 // -- zone is not empty
525 // -- the entity's spawn2 point is marked as path_while_zone_idle
526 // -- the zone is newly empty and we're allowing mobs to settle
527 if (
528 numclients > 0 || zone->quest_idle_override ||

Callers 8

mainFunction · 0.80
SetupStateZoneFunction · 0.80
TestSpawnsFunction · 0.80
TestDataBucketsMethod · 0.80
SetupZoneFunction · 0.80
TestNpcHandinsMethod · 0.80

Calls 15

PathWhenZoneIdleMethod · 0.80
RemoveMercMethod · 0.80
RemoveBotMethod · 0.80
RemoveNPCMethod · 0.80
DelMemberMethod · 0.80
beginMethod · 0.45
endMethod · 0.45
sizeMethod · 0.45
IsIdleWhenEmptyMethod · 0.45
GetSecondsBeforeIdleMethod · 0.45
StartMethod · 0.45
CheckMethod · 0.45

Tested by 6

SetupStateZoneFunction · 0.64
TestSpawnsFunction · 0.64
TestDataBucketsMethod · 0.64
SetupZoneFunction · 0.64
TestNpcHandinsMethod · 0.64