mirror of
https://github.com/EQEmu/Server.git
synced 2026-06-10 19:10:25 +00:00
[Quest API] Add Bot Methods to Perl/Lua (#4113)
* [Quest API] Add Bot Methods to Perl/Lua # Perl - Add `quest::GetBotClassByID(bot_id)`. - Add `quest::GetBotGenderByID(bot_id)`. - Add `quest::GetBotIDsByCharacterID(character_id)`. - Add `quest::GetBotIDsByCharacterID(character_id, class_id)`. - Add `quest::GetBotLevelByID(bot_id)`. - Add `quest::GetBotNameByID(bot_id)`. - Add `quest::GetBotRaceByID(bot_id)`. # Lua - Add `eq.get_bot_class_by_id(bot_id)`. - Add `eq.get_bot_gender_by_id(bot_id)`. - Add `eq.get_bot_ids_by_character_id(character_id)`. - Add `eq.get_bot_ids_by_character_id(character_id, class_id)`. - Add `eq.get_bot_level_by_id(bot_id)`. - Add `eq.get_bot_name_by_id(bot_id)`. - Add `eq.get_bot_race_by_id(bot_id)`. # Notes - Allows operators to get a list of a player's bot IDs, get a bot's class, gender, level, name, and race. * Update bot_database.cpp
This commit is contained in:
@@ -5416,6 +5416,65 @@ void lua_self_cast(uint16 spell_id)
|
||||
quest_manager.selfcast(spell_id);
|
||||
}
|
||||
|
||||
uint8 lua_get_bot_class_by_id(uint32 bot_id)
|
||||
{
|
||||
return database.botdb.GetBotClassByID(bot_id);
|
||||
}
|
||||
|
||||
uint8 lua_get_bot_gender_by_id(uint32 bot_id)
|
||||
{
|
||||
return database.botdb.GetBotGenderByID(bot_id);
|
||||
}
|
||||
|
||||
luabind::object lua_get_bot_ids_by_character_id(lua_State* L, uint32 character_id)
|
||||
{
|
||||
auto lua_table = luabind::newtable(L);
|
||||
|
||||
const auto& l = database.botdb.GetBotIDsByCharacterID(character_id);
|
||||
|
||||
if (!l.empty()) {
|
||||
int index = 1;
|
||||
for (const auto& i : l) {
|
||||
lua_table[index] = i;
|
||||
index++;
|
||||
}
|
||||
}
|
||||
|
||||
return lua_table;
|
||||
}
|
||||
|
||||
luabind::object lua_get_bot_ids_by_character_id(lua_State* L, uint32 character_id, uint8 class_id)
|
||||
{
|
||||
auto lua_table = luabind::newtable(L);
|
||||
|
||||
const auto& l = database.botdb.GetBotIDsByCharacterID(character_id, class_id);
|
||||
|
||||
if (!l.empty()) {
|
||||
int index = 1;
|
||||
for (const auto& i : l) {
|
||||
lua_table[index] = i;
|
||||
index++;
|
||||
}
|
||||
}
|
||||
|
||||
return lua_table;
|
||||
}
|
||||
|
||||
uint8 lua_get_bot_level_by_id(uint32 bot_id)
|
||||
{
|
||||
return database.botdb.GetBotLevelByID(bot_id);
|
||||
}
|
||||
|
||||
std::string lua_get_bot_name_by_id(uint32 bot_id)
|
||||
{
|
||||
return database.botdb.GetBotNameByID(bot_id);
|
||||
}
|
||||
|
||||
uint16 lua_get_bot_race_by_id(uint32 bot_id)
|
||||
{
|
||||
return database.botdb.GetBotRaceByID(bot_id);
|
||||
}
|
||||
|
||||
#define LuaCreateNPCParse(name, c_type, default_value) do { \
|
||||
cur = table[#name]; \
|
||||
if(luabind::type(cur) != LUA_TNIL) { \
|
||||
@@ -6199,6 +6258,13 @@ luabind::scope lua_register_general() {
|
||||
luabind::def("convert_money_to_string", &lua_convert_money_to_string),
|
||||
luabind::def("cast_spell", &lua_cast_spell),
|
||||
luabind::def("self_cast", &lua_self_cast),
|
||||
luabind::def("get_bot_class_by_id", &lua_get_bot_class_by_id),
|
||||
luabind::def("get_bot_gender_by_id", &lua_get_bot_gender_by_id),
|
||||
luabind::def("get_bot_ids_by_character_id", (luabind::object(*)(lua_State*, uint32))&lua_get_bot_ids_by_character_id),
|
||||
luabind::def("get_bot_ids_by_character_id", (luabind::object(*)(lua_State*, uint32,uint8))&lua_get_bot_ids_by_character_id),
|
||||
luabind::def("get_bot_level_by_id", &lua_get_bot_level_by_id),
|
||||
luabind::def("get_bot_name_by_id", &lua_get_bot_name_by_id),
|
||||
luabind::def("get_bot_race_by_id", &lua_get_bot_race_by_id),
|
||||
/*
|
||||
Cross Zone
|
||||
*/
|
||||
|
||||
Reference in New Issue
Block a user