mirror of
https://github.com/EQEmu/Server.git
synced 2026-01-07 02:03:51 +00:00
Merge pull request #1026 from KinglyKrab/getclassname
Add getclassname(class_id, level) to Perl/Lua.
This commit is contained in:
commit
54b33f959e
@ -3313,6 +3313,26 @@ XS(XS__getcharidbyname) {
|
||||
XSRETURN(1);
|
||||
}
|
||||
|
||||
XS(XS__getclassname);
|
||||
XS(XS__getclassname) {
|
||||
dXSARGS;
|
||||
if (items < 1 || items > 2)
|
||||
Perl_croak(aTHX_ "Usage: quest::getclassname(uint8 class_id, [uint8 level = 0])");
|
||||
dXSTARG;
|
||||
|
||||
std::string RETVAL;
|
||||
uint8 class_id = (int) SvUV(ST(0));
|
||||
uint8 level = 0;
|
||||
if (items > 1)
|
||||
level = (int) SvUV(ST(1));
|
||||
|
||||
RETVAL = quest_manager.getclassname(class_id, level);
|
||||
sv_setpv(TARG, RETVAL.c_str());
|
||||
XSprePUSH;
|
||||
PUSHTARG;
|
||||
XSRETURN(1);
|
||||
}
|
||||
|
||||
XS(XS__getcurrencyitemid);
|
||||
XS(XS__getcurrencyitemid) {
|
||||
dXSARGS;
|
||||
@ -4188,6 +4208,7 @@ EXTERN_C XS(boot_quest) {
|
||||
newXS(strcpy(buf, "forcedoorclose"), XS__forcedoorclose, file);
|
||||
newXS(strcpy(buf, "forcedooropen"), XS__forcedooropen, file);
|
||||
newXS(strcpy(buf, "getcharidbyname"), XS__getcharidbyname, file);
|
||||
newXS(strcpy(buf, "getclassname"), XS__getclassname, file);
|
||||
newXS(strcpy(buf, "getcurrencyid"), XS__getcurrencyid, file);
|
||||
newXS(strcpy(buf, "getinventoryslotid"), XS__getinventoryslotid, file);
|
||||
newXS(strcpy(buf, "getitemname"), XS__getitemname, file);
|
||||
|
||||
@ -886,6 +886,14 @@ uint32 lua_get_char_id_by_name(const char* name) {
|
||||
return quest_manager.getcharidbyname(name);
|
||||
}
|
||||
|
||||
std::string lua_get_class_name(uint8 class_id) {
|
||||
return quest_manager.getclassname(class_id);
|
||||
}
|
||||
|
||||
std::string lua_get_class_name(uint8 class_id, uint8 level) {
|
||||
return quest_manager.getclassname(class_id, level);
|
||||
}
|
||||
|
||||
int lua_get_currency_id(uint32 item_id) {
|
||||
return quest_manager.getcurrencyid(item_id)
|
||||
}
|
||||
@ -1795,6 +1803,8 @@ luabind::scope lua_register_general() {
|
||||
luabind::def("delete_data", (bool(*)(std::string))&lua_delete_data),
|
||||
luabind::def("get_char_name_by_id", &lua_get_char_name_by_id),
|
||||
luabind::def("get_char_id_by_name", (uint32(*)(const char*))&lua_get_char_id_by_name),
|
||||
luabind::def("get_class_name", (std::string(*)(uint8))&lua_get_class_name),
|
||||
luabind::def("get_class_name", (std::string(*)(uint8,uint8))&lua_get_class_name),
|
||||
luabind::def("get_currency_id", &lua_get_currency_id),
|
||||
luabind::def("get_currency_item_id", &lua_get_currency_item_id),
|
||||
luabind::def("get_guild_name_by_id", &lua_get_guild_name_by_id),
|
||||
|
||||
@ -2962,6 +2962,10 @@ uint32 QuestManager::getcharidbyname(const char* name) {
|
||||
return database.GetCharacterID(name);
|
||||
}
|
||||
|
||||
std::string QuestManager::getclassname(uint8 class_id, uint8 level) {
|
||||
return GetClassIDName(class_id, level);
|
||||
}
|
||||
|
||||
int QuestManager::getcurrencyid(uint32 item_id) {
|
||||
auto iter = zone->AlternateCurrencies.begin();
|
||||
while (iter != zone->AlternateCurrencies.end()) {
|
||||
|
||||
@ -259,6 +259,7 @@ public:
|
||||
std::string saylink(char *saylink_text, bool silent, const char *link_name);
|
||||
const char* getcharnamebyid(uint32 char_id);
|
||||
uint32 getcharidbyname(const char* name);
|
||||
std::string getclassname(uint8 class_id, uint8 level = 0);
|
||||
int getcurrencyid(uint32 item_id);
|
||||
int getcurrencyitemid(int currency_id);
|
||||
const char* getguildnamebyid(int guild_id);
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user