mirror of
https://github.com/EQEmu/Server.git
synced 2025-12-12 01:11:29 +00:00
Add getitemname(item_id) to Perl/Lua.
This commit is contained in:
parent
3a7908b1de
commit
51b31b5e53
@ -2810,6 +2810,22 @@ XS(XS__countitem) {
|
||||
XSRETURN_IV(quantity);
|
||||
}
|
||||
|
||||
XS(XS__getitemname);
|
||||
XS(XS__getitemname) {
|
||||
dXSARGS;
|
||||
if (items != 1)
|
||||
Perl_croak(aTHX_ "Usage: quest::getitemname(uint32 item_id)");
|
||||
|
||||
dXSTARG;
|
||||
uint32 item_id = (int) SvIV(ST(0));
|
||||
std::string item_name = quest_manager.getitemname(item_id);
|
||||
|
||||
sv_setpv(TARG, item_name.c_str());
|
||||
XSprePUSH;
|
||||
PUSHTARG;
|
||||
XSRETURN(1);
|
||||
}
|
||||
|
||||
XS(XS__UpdateSpawnTimer);
|
||||
XS(XS__UpdateSpawnTimer) {
|
||||
dXSARGS;
|
||||
@ -4005,6 +4021,7 @@ EXTERN_C XS(boot_quest) {
|
||||
newXS(strcpy(buf, "forcedoorclose"), XS__forcedoorclose, file);
|
||||
newXS(strcpy(buf, "forcedooropen"), XS__forcedooropen, file);
|
||||
newXS(strcpy(buf, "getinventoryslotid"), XS__getinventoryslotid, file);
|
||||
newXS(strcpy(buf, "getitemname"), XS__getitemname, file);
|
||||
newXS(strcpy(buf, "getItemName"), XS_qc_getItemName, file);
|
||||
newXS(strcpy(buf, "get_spawn_condition"), XS__get_spawn_condition, file);
|
||||
newXS(strcpy(buf, "getguildnamebyid"), XS__getguildnamebyid, file);
|
||||
|
||||
@ -807,6 +807,10 @@ std::string lua_item_link(int item_id) {
|
||||
return quest_manager.varlink(text, item_id);
|
||||
}
|
||||
|
||||
std::string lua_get_item_name(uint32 item_id) {
|
||||
return quest_manager.getitemname(item_id);
|
||||
}
|
||||
|
||||
std::string lua_say_link(const char *phrase, bool silent, const char *link_name) {
|
||||
char text[256] = { 0 };
|
||||
strncpy(text, phrase, 255);
|
||||
@ -1734,6 +1738,7 @@ luabind::scope lua_register_general() {
|
||||
luabind::def("merchant_set_item", (void(*)(uint32,uint32,uint32))&lua_merchant_set_item),
|
||||
luabind::def("merchant_count_item", &lua_merchant_count_item),
|
||||
luabind::def("item_link", &lua_item_link),
|
||||
luabind::def("get_item_name", (std::string(*)(uint32))&lua_get_item_name),
|
||||
luabind::def("say_link", (std::string(*)(const char*,bool,const char*))&lua_say_link),
|
||||
luabind::def("say_link", (std::string(*)(const char*,bool))&lua_say_link),
|
||||
luabind::def("say_link", (std::string(*)(const char*))&lua_say_link),
|
||||
|
||||
@ -2696,6 +2696,16 @@ const char* QuestManager::varlink(char* perltext, int item_id) {
|
||||
return perltext;
|
||||
}
|
||||
|
||||
std::string QuestManager::getitemname(uint32 item_id) {
|
||||
const EQEmu::ItemData* item_data = database.GetItem(item_id);
|
||||
if (!item_data) {
|
||||
return "INVALID ITEM ID IN GETITEMNAME";
|
||||
}
|
||||
|
||||
std::string item_name = item_data->Name;
|
||||
return item_name;
|
||||
}
|
||||
|
||||
uint16 QuestManager::CreateInstance(const char *zone, int16 version, uint32 duration)
|
||||
{
|
||||
QuestManagerCurrentQuestVars();
|
||||
|
||||
@ -220,6 +220,7 @@ public:
|
||||
int collectitems(uint32 item_id, bool remove);
|
||||
int collectitems_processSlot(int16 slot_id, uint32 item_id, bool remove);
|
||||
int countitem(uint32 item_id);
|
||||
std::string getitemname(uint32 item_id);
|
||||
void enabletitle(int titleset);
|
||||
bool checktitle(int titlecheck);
|
||||
void removetitle(int titlecheck);
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user