mirror of
https://github.com/EQEmu/Server.git
synced 2025-12-13 02:11:30 +00:00
added GetCharactersInInstance
This commit is contained in:
parent
b16ce6f809
commit
4191c195c1
@ -1,5 +1,8 @@
|
||||
EQEMu Changelog (Started on Sept 24, 2003 15:50)
|
||||
-------------------------------------------------------
|
||||
== 01/18/2014 ==
|
||||
sorvani: Implemented for Lua eq.get_characters_in_instance(uint16 instance_id), return a Lua HashTable
|
||||
|
||||
== 01/13/2014 ==
|
||||
Kayen: Numerous minor fixes to spell effects.
|
||||
Kayen: Changed SE_ArcheryDoubleAttack -> SE_DoubleRangedAttack (now works with throwing ect)
|
||||
|
||||
@ -2834,6 +2834,26 @@ uint16 Database::GetInstanceID(uint32 zone, uint32 charid, int16 version)
|
||||
return 0;
|
||||
}
|
||||
|
||||
void Database::GetCharactersInInstance(uint16 instance_id, std::list<uint32> &charid_list) {
|
||||
char errbuf[MYSQL_ERRMSG_SIZE];
|
||||
char *query = 0;
|
||||
MYSQL_RES *result;
|
||||
MYSQL_ROW row;
|
||||
|
||||
if (RunQuery(query, MakeAnyLenString(&query, "SELECT charid FROM instance_lockout_player WHERE id=%u", instance_id), errbuf, &result)) {
|
||||
safe_delete_array(query);
|
||||
while ((row = mysql_fetch_row(result)))
|
||||
{
|
||||
charid_list.push_back(atoi(row[0]));
|
||||
}
|
||||
mysql_free_result(result);
|
||||
}
|
||||
else {
|
||||
LogFile->write(EQEMuLog::Error, "Error in GetCharactersInInstace query '%s': %s", query, errbuf);
|
||||
safe_delete_array(query);
|
||||
}
|
||||
}
|
||||
|
||||
void Database::AssignGroupToInstance(uint32 gid, uint32 instance_id)
|
||||
{
|
||||
char errbuf[MYSQL_ERRMSG_SIZE];
|
||||
|
||||
@ -163,6 +163,7 @@ public:
|
||||
uint16 GetInstanceVersion(uint16 instance_id);
|
||||
uint16 GetInstanceID(const char* zone, uint32 charid, int16 version);
|
||||
uint16 GetInstanceID(uint32 zone, uint32 charid, int16 version);
|
||||
void GetCharactersInInstance(uint16 instance_id, std::list<uint32> &charid_list);
|
||||
void AssignGroupToInstance(uint32 gid, uint32 instance_id);
|
||||
void AssignRaidToInstance(uint32 rid, uint32 instance_id);
|
||||
void FlagInstanceByGroupLeader(uint32 zone, int16 version, uint32 charid, uint32 gid);
|
||||
|
||||
@ -781,6 +781,21 @@ int lua_get_zone_instance_version() {
|
||||
return zone->GetInstanceVersion();
|
||||
}
|
||||
|
||||
luabind::object lua_get_characters_in_instance(lua_State *L, uint16 instance_id) {
|
||||
luabind::object ret = luabind::newtable(L);
|
||||
|
||||
std::list<uint32> charid_list;
|
||||
uint16 i = 1;
|
||||
database.GetCharactersInInstance(instance_id,charid_list);
|
||||
auto iter = charid_list.begin();
|
||||
while(iter != charid_list.end()) {
|
||||
ret[i] = *iter;
|
||||
++i;
|
||||
++iter;
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
|
||||
int lua_get_zone_weather() {
|
||||
if(!zone)
|
||||
return 0;
|
||||
@ -1164,6 +1179,7 @@ luabind::scope lua_register_general() {
|
||||
luabind::def("create_instance", &lua_create_instance),
|
||||
luabind::def("destroy_instance", &lua_destroy_instance),
|
||||
luabind::def("get_instance_id", &lua_get_instance_id),
|
||||
luabind::def("get_characters_in_instance", &lua_get_characters_in_instance),
|
||||
luabind::def("assign_to_instance", &lua_assign_to_instance),
|
||||
luabind::def("assign_group_to_instance", &lua_assign_group_to_instance),
|
||||
luabind::def("assign_raid_to_instance", &lua_assign_raid_to_instance),
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user