mirror of
https://github.com/EQEmu/Server.git
synced 2025-12-12 01:11:29 +00:00
Add getcurrencyid(item_id) to Perl/Lua.
This commit is contained in:
parent
4c348baabd
commit
6ddcc2bb8a
@ -3265,6 +3265,23 @@ XS(XS__getcharidbyname) {
|
||||
XSRETURN(1);
|
||||
}
|
||||
|
||||
XS(XS__getcurrencyid);
|
||||
XS(XS__getcurrencyid) {
|
||||
dXSARGS;
|
||||
if (items != 1)
|
||||
Perl_croak(aTHX_ "Usage: quest::getcurrencyid(uint32 item_id)");
|
||||
dXSTARG;
|
||||
|
||||
int RETVAL;
|
||||
uint32 item_id = (int) SvUV(ST(0));;
|
||||
|
||||
RETVAL = quest_manager.getcurrencyid(item_id);
|
||||
XSprePUSH;
|
||||
PUSHi((IV)RETVAL);
|
||||
|
||||
XSRETURN(1);
|
||||
}
|
||||
|
||||
XS(XS__getguildnamebyid);
|
||||
XS(XS__getguildnamebyid) {
|
||||
dXSARGS;
|
||||
@ -4107,6 +4124,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, "getcurrencyid"), XS__getcurrencyid, file);
|
||||
newXS(strcpy(buf, "getinventoryslotid"), XS__getinventoryslotid, file);
|
||||
newXS(strcpy(buf, "getitemname"), XS__getitemname, file);
|
||||
newXS(strcpy(buf, "getItemName"), XS_qc_getItemName, file);
|
||||
|
||||
@ -878,6 +878,10 @@ uint32 lua_get_char_id_by_name(const char* name) {
|
||||
return quest_manager.getcharidbyname(name);
|
||||
}
|
||||
|
||||
int lua_get_currency_id(uint32 item_id) {
|
||||
return quest_manager.getcurrencyid(item_id);
|
||||
}
|
||||
|
||||
const char *lua_get_guild_name_by_id(uint32 guild_id) {
|
||||
return quest_manager.getguildnamebyid(guild_id);
|
||||
}
|
||||
@ -1773,6 +1777,7 @@ 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_currency_id", &lua_get_currency_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),
|
||||
|
||||
@ -2939,6 +2939,17 @@ uint32 QuestManager::getcharidbyname(const char* name) {
|
||||
return database.GetCharacterID(name);
|
||||
}
|
||||
|
||||
int QuestManager::getcurrencyid(uint32 item_id) {
|
||||
auto iter = zone->AlternateCurrencies.begin();
|
||||
while (iter != zone->AlternateCurrencies.end()) {
|
||||
if (item_id == (*iter).item_id) {
|
||||
return (*iter).id;
|
||||
}
|
||||
++iter;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
const char* QuestManager::getguildnamebyid(int guild_id) {
|
||||
if (guild_id > 0)
|
||||
return guild_mgr.GetGuildName(guild_id);
|
||||
|
||||
@ -257,6 +257,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);
|
||||
int getcurrencyid(uint32 item_id);
|
||||
const char* getguildnamebyid(int guild_id);
|
||||
int getguildidbycharid(uint32 char_id);
|
||||
int getgroupidbycharid(uint32 char_id);
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user