Implement Corpse counting methods for global/zone-specific counting.

Global:
- Perl: quest::getplayercorpsecount(uint32 char_id);
- Lua: eq.get_player_corpse_count(uint32 char_id);

Zone-specific:
- Perl: quest::getplayercorpsecountbyzoneid(uint32 char_id, uint32 zone_id);
- Lua: eq.get_player_corpse_count_by_zone_id(uint32 char_id, uint32 zone_id);
This commit is contained in:
Kinglykrab 2020-01-20 20:23:11 -05:00
parent 8e6dd638ff
commit caceae1028
4 changed files with 66 additions and 0 deletions

View File

@ -1812,6 +1812,43 @@ XS(XS__summonallplayercorpses) {
XSRETURN(1);
}
XS(XS__getplayercorpsecount);
XS(XS__getplayercorpsecount) {
dXSARGS;
if (items != 1)
Perl_croak(aTHX_ "Usage: quest::getplayercorpsecount(uint32 char_id)");
uint32 RETVAL;
dXSTARG;
uint32 char_id = (int) SvIV(ST(0));
RETVAL = quest_manager.getplayercorpsecount(char_id);
XSprePUSH;
PUSHu((IV) RETVAL);
XSRETURN(1);
}
XS(XS__getplayercorpsecountbyzoneid);
XS(XS__getplayercorpsecountbyzoneid) {
dXSARGS;
if (items != 2)
Perl_croak(aTHX_ "Usage: quest::getplayercorpsecountbyzoneid(uint32 char_id, uint32 zone_id)");
uint32 RETVAL;
dXSTARG;
uint32 char_id = (int) SvIV(ST(0));
uint32 zone_id = (int)SvIV(ST(1));
RETVAL = quest_manager.getplayercorpsecountbyzoneid(char_id, zone_id);
XSprePUSH;
PUSHu((IV) RETVAL);
XSRETURN(1);
}
XS(XS__getplayerburiedcorpsecount);
XS(XS__getplayerburiedcorpsecount) {
dXSARGS;
@ -3907,6 +3944,8 @@ EXTERN_C XS(boot_quest) {
newXS(strcpy(buf, "getguildnamebyid"), XS__getguildnamebyid, file);
newXS(strcpy(buf, "getlevel"), XS__getlevel, file);
newXS(strcpy(buf, "getplayerburiedcorpsecount"), XS__getplayerburiedcorpsecount, file);
newXS(strcpy(buf, "getplayercorpsecount"), XS__getplayercorpsecount, file);
newXS(strcpy(buf, "getplayercorpsecountbyzoneid"), XS__getplayercorpsecountbyzoneid, file);
newXS(strcpy(buf, "gettaskactivitydonecount"), XS__gettaskactivitydonecount, file);
newXS(strcpy(buf, "givecash"), XS__givecash, file);
newXS(strcpy(buf, "gmmove"), XS__gmmove, file);

View File

@ -549,6 +549,14 @@ void lua_summon_all_player_corpses(uint32 char_id, float x, float y, float z, fl
quest_manager.summonallplayercorpses(char_id, glm::vec4(x, y, z, h));
}
int lua_get_player_corpse_count(uint32 char_id) {
return database.CountCharacterCorpses(char_id);
}
int lua_get_player_corpse_count_by_zone_id(uint32 char_id, uint32 zone_id) {
return database.CountCharacterCorpsesByZoneID(char_id, zone_id);
}
int lua_get_player_buried_corpse_count(uint32 char_id) {
return quest_manager.getplayerburiedcorpsecount(char_id);
}
@ -1663,6 +1671,8 @@ luabind::scope lua_register_general() {
luabind::def("toggle_spawn_event", &lua_toggle_spawn_event),
luabind::def("summon_buried_player_corpse", &lua_summon_buried_player_corpse),
luabind::def("summon_all_player_corpses", &lua_summon_all_player_corpses),
luabind::def("get_player_corpse_count", &lua_get_player_corpse_count),
luabind::def("get_player_corpse_count_by_zone_id", &lua_get_player_corpse_count_by_zone_id),
luabind::def("get_player_buried_corpse_count", &lua_get_player_buried_corpse_count),
luabind::def("bury_player_corpse", &lua_bury_player_corpse),
luabind::def("task_selector", &lua_task_selector),

View File

@ -1910,6 +1910,21 @@ bool QuestManager::summonallplayercorpses(uint32 char_id, const glm::vec4& posit
return true;
}
int QuestManager::getplayercorpsecount(uint32 char_id) {
if (char_id > 0)
return database.CountCharacterCorpses(char_id);
return 0;
}
int QuestManager::getplayercorpsecountbyzoneid(uint32 char_id, uint32 zone_id) {
if (char_id > 0 && zone_id > 0)
return database.CountCharacterCorpsesByZoneID(char_id, zone_id);
return 0;
}
uint32 QuestManager::getplayerburiedcorpsecount(uint32 char_id) {
uint32 Result = 0;

View File

@ -172,6 +172,8 @@ public:
bool summonburiedplayercorpse(uint32 char_id, const glm::vec4& position);
bool summonallplayercorpses(uint32 char_id, const glm::vec4& position);
uint32 getplayerburiedcorpsecount(uint32 char_id);
int getplayercorpsecount(uint32 char_id);
int getplayercorpsecountbyzoneid(uint32 char_id, uint32 zone_id);
bool buryplayercorpse(uint32 char_id);
void forcedooropen(uint32 doorid, bool altmode);
void forcedoorclose(uint32 doorid, bool altmode);