Merge pull request #1100 from noudess/empty_processing

Allow quests to turn on mob processing in empty zones
This commit is contained in:
Chris Miles 2020-08-16 02:03:22 -05:00 committed by GitHub
commit 24a8ca39d3
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
7 changed files with 32 additions and 1 deletions

View File

@ -2071,6 +2071,19 @@ XS(XS__repopzone) {
XSRETURN_EMPTY;
}
XS(XS__processmobswhilezoneempty);
XS(XS__processmobswhilezoneempty) {
dXSARGS;
if (items != 1)
Perl_croak(aTHX_ "Usage: quest::processmobswhilezoneempty(bool on)");
bool ProcessingOn = ((int) SvIV(ST(0))) == 0 ? false : true;
quest_manager.processmobswhilezoneempty(ProcessingOn);
XSRETURN_EMPTY;
}
XS(XS__npcrace);
XS(XS__npcrace) {
dXSARGS;
@ -6291,6 +6304,7 @@ EXTERN_C XS(boot_quest) {
newXS(strcpy(buf, "playersize"), XS__playersize, file);
newXS(strcpy(buf, "playertexture"), XS__playertexture, file);
newXS(strcpy(buf, "popup"), XS__popup, file);
newXS(strcpy(buf, "processmobswhilezoneempty"), XS__processmobswhilezoneempty, file);
newXS(strcpy(buf, "pvp"), XS__pvp, file);
newXS(strcpy(buf, "qs_player_event"), XS__qs_player_event, file);
newXS(strcpy(buf, "qs_send_query"), XS__qs_send_query, file);

View File

@ -515,7 +515,7 @@ void EntityList::MobProcess()
mob_settle_timer->Disable();
}
if (numclients > 0 ||
if (zone->process_mobs_while_empty || numclients > 0 ||
mob->GetWanderType() == 4 || mob->GetWanderType() == 6 ||
mob_settle_timer->Enabled()) {
// Normal processing, or assuring that spawns that should

View File

@ -390,6 +390,10 @@ void lua_repop_zone() {
quest_manager.repopzone();
}
void lua_process_mobs_while_zone_empty(bool on) {
quest_manager.processmobswhilezoneempty(on);
}
bool lua_is_disc_tome(int item_id) {
return quest_manager.isdisctome(item_id);
}
@ -2396,6 +2400,7 @@ luabind::scope lua_register_general() {
luabind::def("depop_all", (void(*)(int))&lua_depop_all),
luabind::def("depop_zone", &lua_depop_zone),
luabind::def("repop_zone", &lua_repop_zone),
luabind::def("process_mobs_while_zone_empty", &lua_process_mobs_while_zone_empty),
luabind::def("is_disc_tome", &lua_is_disc_tome),
luabind::def("get_race_name", (std::string(*)(uint16))&lua_get_race_name),
luabind::def("get_spell_name", (std::string(*)(uint32))&lua_get_spell_name),

View File

@ -857,6 +857,15 @@ void QuestManager::repopzone() {
}
}
void QuestManager::processmobswhilezoneempty(bool on) {
if(zone) {
zone->process_mobs_while_empty = on;
}
else {
LogQuests("QuestManager::processmobswhilezoneempty called with nullptr zone. Probably syntax error in quest file");
}
}
void QuestManager::settarget(const char *type, int target_id) {
QuestManagerCurrentQuestVars();
if (!owner || !owner->IsNPC())

View File

@ -101,6 +101,7 @@ public:
void depopall(int npc_type = 0);
void depopzone(bool StartSpawnTimer = true);
void repopzone();
void processmobswhilezoneempty(bool on);
void settarget(const char *type, int target_id);
void follow(int entity_id, int distance);
void sfollow();

View File

@ -953,6 +953,7 @@ Zone::Zone(uint32 in_zoneid, uint32 in_instanceid, const char* in_short_name)
default_ruleset = 0;
is_zone_time_localized = false;
process_mobs_while_empty = false;
loglevelvar = 0;
merchantvar = 0;

View File

@ -101,6 +101,7 @@ public:
AA::Ability *GetAlternateAdvancementAbilityByRank(int rank_id);
AA::Rank *GetAlternateAdvancementRank(int rank_id);
bool is_zone_time_localized;
bool process_mobs_while_empty;
bool AggroLimitReached() { return (aggroedmobs > 10) ? true : false; }
bool AllowMercs() const { return (allow_mercs); }
bool CanBind() const { return (can_bind); }