mirror of
https://github.com/EQEmu/Server.git
synced 2025-12-13 10:31:29 +00:00
Add GetGroupIDByCharID and GetGuildIDByCharID to Perl/Lua.
This commit is contained in:
parent
581d5b1289
commit
2a9248697e
@ -2158,6 +2158,28 @@ uint32 Database::GetGuildIDByCharID(uint32 character_id)
|
|||||||
return atoi(row[0]);
|
return atoi(row[0]);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
uint32 Database::GetGroupIDByCharID(uint32 character_id)
|
||||||
|
{
|
||||||
|
std::string query = fmt::format(
|
||||||
|
SQL(
|
||||||
|
SELECT groupid
|
||||||
|
FROM group_id
|
||||||
|
WHERE charid = '{}'
|
||||||
|
),
|
||||||
|
character_id
|
||||||
|
);
|
||||||
|
auto results = QueryDatabase(query);
|
||||||
|
|
||||||
|
if (!results.Success())
|
||||||
|
return 0;
|
||||||
|
|
||||||
|
if (results.RowCount() == 0)
|
||||||
|
return 0;
|
||||||
|
|
||||||
|
auto row = results.begin();
|
||||||
|
return atoi(row[0]);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param log_settings
|
* @param log_settings
|
||||||
*/
|
*/
|
||||||
|
|||||||
@ -133,6 +133,7 @@ public:
|
|||||||
uint32 GetCharacterID(const char *name);
|
uint32 GetCharacterID(const char *name);
|
||||||
uint32 GetCharacterInfo(const char* iName, uint32* oAccID = 0, uint32* oZoneID = 0, uint32* oInstanceID = 0, float* oX = 0, float* oY = 0, float* oZ = 0);
|
uint32 GetCharacterInfo(const char* iName, uint32* oAccID = 0, uint32* oZoneID = 0, uint32* oInstanceID = 0, float* oX = 0, float* oY = 0, float* oZ = 0);
|
||||||
uint32 GetGuildIDByCharID(uint32 char_id);
|
uint32 GetGuildIDByCharID(uint32 char_id);
|
||||||
|
uint32 GetGroupIDByCharID(uint32 char_id);
|
||||||
|
|
||||||
void GetAccountName(uint32 accountid, char* name, uint32* oLSAccountID = 0);
|
void GetAccountName(uint32 accountid, char* name, uint32* oLSAccountID = 0);
|
||||||
void GetCharName(uint32 char_id, char* name);
|
void GetCharName(uint32 char_id, char* name);
|
||||||
|
|||||||
@ -3169,6 +3169,41 @@ XS(XS__getguildnamebyid) {
|
|||||||
XSRETURN(1);
|
XSRETURN(1);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
XS(XS__getguildidbycharid);
|
||||||
|
XS(XS__getguildidbycharid) {
|
||||||
|
dXSARGS;
|
||||||
|
if (items != 1)
|
||||||
|
Perl_croak(aTHX_ "Usage: quest::getguildidbycharid(uint32 char_id)");
|
||||||
|
dXSTARG;
|
||||||
|
|
||||||
|
int RETVAL;
|
||||||
|
uint32 char_id = (int) SvUV(ST(0));
|
||||||
|
|
||||||
|
RETVAL = quest_manager.getguildidbycharid(char_id);
|
||||||
|
|
||||||
|
XSprePUSH;
|
||||||
|
PUSHi((IV)RETVAL);
|
||||||
|
|
||||||
|
XSRETURN(1);
|
||||||
|
}
|
||||||
|
|
||||||
|
XS(XS__getgroupidbycharid);
|
||||||
|
XS(XS__getgroupidbycharid) {
|
||||||
|
dXSARGS;
|
||||||
|
if (items != 1)
|
||||||
|
Perl_croak(aTHX_ "Usage: quest::getgroupidbycharid(uint32 char_id)");
|
||||||
|
dXSTARG;
|
||||||
|
|
||||||
|
int RETVAL;
|
||||||
|
uint32 char_id = (int) SvUV(ST(0));
|
||||||
|
|
||||||
|
RETVAL = quest_manager.getgroupidbycharid(char_id);
|
||||||
|
XSprePUSH;
|
||||||
|
PUSHi((IV)RETVAL);
|
||||||
|
|
||||||
|
XSRETURN(1);
|
||||||
|
}
|
||||||
|
|
||||||
XS(XS__SetRunning);
|
XS(XS__SetRunning);
|
||||||
XS(XS__SetRunning) {
|
XS(XS__SetRunning) {
|
||||||
dXSARGS;
|
dXSARGS;
|
||||||
@ -3942,6 +3977,8 @@ EXTERN_C XS(boot_quest) {
|
|||||||
newXS(strcpy(buf, "getItemName"), XS_qc_getItemName, file);
|
newXS(strcpy(buf, "getItemName"), XS_qc_getItemName, file);
|
||||||
newXS(strcpy(buf, "get_spawn_condition"), XS__get_spawn_condition, file);
|
newXS(strcpy(buf, "get_spawn_condition"), XS__get_spawn_condition, file);
|
||||||
newXS(strcpy(buf, "getguildnamebyid"), XS__getguildnamebyid, file);
|
newXS(strcpy(buf, "getguildnamebyid"), XS__getguildnamebyid, file);
|
||||||
|
newXS(strcpy(buf, "getguildidbycharid"), XS__getguildidbycharid, file);
|
||||||
|
newXS(strcpy(buf, "getgroupidbycharid"), XS__getgroupidbycharid, file);
|
||||||
newXS(strcpy(buf, "getlevel"), XS__getlevel, file);
|
newXS(strcpy(buf, "getlevel"), XS__getlevel, file);
|
||||||
newXS(strcpy(buf, "getplayerburiedcorpsecount"), XS__getplayerburiedcorpsecount, file);
|
newXS(strcpy(buf, "getplayerburiedcorpsecount"), XS__getplayerburiedcorpsecount, file);
|
||||||
newXS(strcpy(buf, "getplayercorpsecount"), XS__getplayercorpsecount, file);
|
newXS(strcpy(buf, "getplayercorpsecount"), XS__getplayercorpsecount, file);
|
||||||
|
|||||||
@ -858,6 +858,14 @@ const char *lua_get_guild_name_by_id(uint32 guild_id) {
|
|||||||
return quest_manager.getguildnamebyid(guild_id);
|
return quest_manager.getguildnamebyid(guild_id);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int lua_get_guild_id_by_char_id(uint32 char_id) {
|
||||||
|
return database.GetGuildIDByCharID(char_id);
|
||||||
|
}
|
||||||
|
|
||||||
|
int lua_get_group_id_by_char_id(uint32 char_id) {
|
||||||
|
return database.GetGroupIDByCharID(char_id);
|
||||||
|
}
|
||||||
|
|
||||||
uint32 lua_create_instance(const char *zone, uint32 version, uint32 duration) {
|
uint32 lua_create_instance(const char *zone, uint32 version, uint32 duration) {
|
||||||
return quest_manager.CreateInstance(zone, version, duration);
|
return quest_manager.CreateInstance(zone, version, duration);
|
||||||
}
|
}
|
||||||
@ -1728,6 +1736,8 @@ luabind::scope lua_register_general() {
|
|||||||
luabind::def("set_data", (void(*)(std::string, std::string, std::string))&lua_set_data),
|
luabind::def("set_data", (void(*)(std::string, std::string, std::string))&lua_set_data),
|
||||||
luabind::def("delete_data", (bool(*)(std::string))&lua_delete_data),
|
luabind::def("delete_data", (bool(*)(std::string))&lua_delete_data),
|
||||||
luabind::def("get_guild_name_by_id", &lua_get_guild_name_by_id),
|
luabind::def("get_guild_name_by_id", &lua_get_guild_name_by_id),
|
||||||
|
luabind::def("get_guild_id_by_char_id", &lua_get_guild_id_by_char_id),
|
||||||
|
luabind::def("get_group_id_by_char_id", &lua_get_group_id_by_char_id),
|
||||||
luabind::def("create_instance", &lua_create_instance),
|
luabind::def("create_instance", &lua_create_instance),
|
||||||
luabind::def("destroy_instance", &lua_destroy_instance),
|
luabind::def("destroy_instance", &lua_destroy_instance),
|
||||||
luabind::def("update_instance_timer", &lua_update_instance_timer),
|
luabind::def("update_instance_timer", &lua_update_instance_timer),
|
||||||
|
|||||||
@ -2876,6 +2876,20 @@ const char* QuestManager::getguildnamebyid(int guild_id) {
|
|||||||
return("");
|
return("");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int QuestManager::getguildidbycharid(uint32 char_id) {
|
||||||
|
if (char_id > 0) {
|
||||||
|
return database.GetGuildIDByCharID(char_id);
|
||||||
|
}
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
int QuestManager::getgroupidbycharid(uint32 char_id) {
|
||||||
|
if (char_id > 0) {
|
||||||
|
return database.GetGroupIDByCharID(char_id);
|
||||||
|
}
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
void QuestManager::SetRunning(bool val)
|
void QuestManager::SetRunning(bool val)
|
||||||
{
|
{
|
||||||
QuestManagerCurrentQuestVars();
|
QuestManagerCurrentQuestVars();
|
||||||
|
|||||||
@ -251,6 +251,8 @@ public:
|
|||||||
const char* varlink(char* perltext, int item_id);
|
const char* varlink(char* perltext, int item_id);
|
||||||
std::string saylink(char *saylink_text, bool silent, const char *link_name);
|
std::string saylink(char *saylink_text, bool silent, const char *link_name);
|
||||||
const char* getguildnamebyid(int guild_id);
|
const char* getguildnamebyid(int guild_id);
|
||||||
|
int getguildidbycharid(uint32 char_id);
|
||||||
|
int getgroupidbycharid(uint32 char_id);
|
||||||
void SetRunning(bool val);
|
void SetRunning(bool val);
|
||||||
bool IsRunning();
|
bool IsRunning();
|
||||||
void FlyMode(GravityBehavior flymode);
|
void FlyMode(GravityBehavior flymode);
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user