Export clear_npctype_cache as both lua/perl general functions.

This commit is contained in:
KimLS 2014-02-01 14:55:51 -08:00
parent 6e0a214bcc
commit 8b1262b198
5 changed files with 31 additions and 2 deletions

View File

@ -3353,6 +3353,22 @@ XS(XS__disablerecipe)
XSRETURN_YES; XSRETURN_YES;
} }
XS(XS__clear_npctype_cache);
XS(XS__clear_npctype_cache)
{
dXSARGS;
if (items != 1) {
Perl_croak(aTHX_ "Usage: clear_npctype_cache(npc_id)");
}
else {
int32 npctype_id = (int32)SvIV(ST(0));
quest_manager.ClearNPCTypeCache(npctype_id);
}
XSRETURN_EMPTY;
}
/* /*
This is the callback perl will look for to setup the This is the callback perl will look for to setup the
quest package's XSUBs quest package's XSUBs
@ -3573,6 +3589,7 @@ EXTERN_C XS(boot_quest)
newXS(strcpy(buf, "crosszonemessageplayerbyname"), XS__crosszonemessageplayerbyname, file); newXS(strcpy(buf, "crosszonemessageplayerbyname"), XS__crosszonemessageplayerbyname, file);
newXS(strcpy(buf, "enablerecipe"), XS__enablerecipe, file); newXS(strcpy(buf, "enablerecipe"), XS__enablerecipe, file);
newXS(strcpy(buf, "disablerecipe"), XS__disablerecipe, file); newXS(strcpy(buf, "disablerecipe"), XS__disablerecipe, file);
newXS(strcpy(buf, "clear_npctype_cache"), XS__clear_npctype_cache, file);
XSRETURN_YES; XSRETURN_YES;
} }

View File

@ -1060,6 +1060,10 @@ bool lua_disable_recipe(uint32 recipe_id) {
return quest_manager.DisableRecipe(recipe_id); return quest_manager.DisableRecipe(recipe_id);
} }
void lua_clear_npctype_cache(int npctype_id) {
quest_manager.ClearNPCTypeCache(npctype_id);
}
luabind::scope lua_register_general() { luabind::scope lua_register_general() {
return luabind::namespace_("eq") return luabind::namespace_("eq")
[ [
@ -1226,7 +1230,8 @@ luabind::scope lua_register_general() {
luabind::def("map_opcodes", &lua_map_opcodes), luabind::def("map_opcodes", &lua_map_opcodes),
luabind::def("clear_opcode", &lua_clear_opcode), luabind::def("clear_opcode", &lua_clear_opcode),
luabind::def("enable_recipe", &lua_enable_recipe), luabind::def("enable_recipe", &lua_enable_recipe),
luabind::def("disable_recipe", &lua_disable_recipe) luabind::def("disable_recipe", &lua_disable_recipe),
luabind::def("clear_npctype_cache", &lua_clear_npctype_cache)
]; ];
} }

View File

@ -2908,6 +2908,12 @@ bool QuestManager::DisableRecipe(uint32 recipe_id)
return (success); return (success);
} }
void QuestManager::ClearNPCTypeCache(int npctype_id) {
if (zone) {
zone->ClearNPCTypeCache(npctype_id);
}
}
Client *QuestManager::GetInitiator() const { Client *QuestManager::GetInitiator() const {
if(!quests_running_.empty()) { if(!quests_running_.empty()) {
running_quest e = quests_running_.top(); running_quest e = quests_running_.top();

View File

@ -233,6 +233,7 @@ public:
void CrossZoneMessagePlayerByName(uint32 Type, const char *CharName, const char *Message); void CrossZoneMessagePlayerByName(uint32 Type, const char *CharName, const char *Message);
bool EnableRecipe(uint32 recipe_id); bool EnableRecipe(uint32 recipe_id);
bool DisableRecipe(uint32 recipe_id); bool DisableRecipe(uint32 recipe_id);
void ClearNPCTypeCache(int npctype_id);
Client *GetInitiator() const; Client *GetInitiator() const;
NPC *GetNPC() const; NPC *GetNPC() const;