diff --git a/zone/embparser_api.cpp b/zone/embparser_api.cpp index 8d4857d5e..a1174ae50 100644 --- a/zone/embparser_api.cpp +++ b/zone/embparser_api.cpp @@ -2870,6 +2870,20 @@ XS(XS__GetInstanceID) { XSRETURN_UV(id); } +XS(XS__GetInstanceIDByCharID); +XS(XS__GetInstanceIDByCharID) { + dXSARGS; + if (items != 3) + Perl_croak(aTHX_ "Usage: quest::GetInstanceIDByCharID(string zone_name, uint16 version, uint32 char_id)"); + + char *zone = (char *) SvPV_nolen(ST(0)); + uint16 version = (int) SvUV(ST(1)); + uint32 char_id = (int) SvUV(ST(2)); + uint16 id = quest_manager.GetInstanceIDByCharID(zone, version, char_id); + + XSRETURN_UV(id); +} + XS(XS__GetCharactersInInstance); XS(XS__GetCharactersInInstance) { dXSARGS; @@ -2921,6 +2935,19 @@ XS(XS__AssignToInstance) { XSRETURN_EMPTY; } +XS(XS__AssignToInstanceByCharID); +XS(XS__AssignToInstanceByCharID) { + dXSARGS; + if (items != 2) + Perl_croak(aTHX_ "Usage: quest::AssignToInstanceByCharID(uint16 instance_id, uint32 char_id)"); + + uint16 instance_id = (int) SvUV(ST(0)); + uint32 char_id = (int) SvUV(ST(1)); + quest_manager.AssignToInstanceByCharID(instance_id, char_id); + + XSRETURN_EMPTY; +} + XS(XS__AssignGroupToInstance); XS(XS__AssignGroupToInstance) { dXSARGS; @@ -2957,6 +2984,19 @@ XS(XS__RemoveFromInstance) { XSRETURN_EMPTY; } +XS(XS__RemoveFromInstanceByCharID); +XS(XS__RemoveFromInstanceByCharID) { + dXSARGS; + if (items != 2) + Perl_croak(aTHX_ "Usage: quest::RemoveFromInstanceByCharID(uint16 instance_id, uint32 char_id)"); + + uint16 instance_id = (int) SvUV(ST(0)); + uint32 char_id = (int) SvUV(ST(1)); + quest_manager.RemoveFromInstanceByCharID(instance_id, char_id); + + XSRETURN_EMPTY; +} + XS(XS__RemoveAllFromInstance); XS(XS__RemoveAllFromInstance) { dXSARGS; @@ -3675,6 +3715,7 @@ EXTERN_C XS(boot_quest) { newXS(strcpy(buf, "AssignGroupToInstance"), XS__AssignGroupToInstance, file); newXS(strcpy(buf, "AssignRaidToInstance"), XS__AssignRaidToInstance, file); newXS(strcpy(buf, "AssignToInstance"), XS__AssignToInstance, file); + newXS(strcpy(buf, "AssignToInstanceByCharID"), XS__AssignToInstanceByCharID, file); newXS(strcpy(buf, "ChooseRandom"), XS__ChooseRandom, file); newXS(strcpy(buf, "CreateInstance"), XS__CreateInstance, file); newXS(strcpy(buf, "DestroyInstance"), XS__DestroyInstance, file); @@ -3686,6 +3727,7 @@ EXTERN_C XS(boot_quest) { newXS(strcpy(buf, "FlyMode"), XS__FlyMode, file); newXS(strcpy(buf, "GetCharactersInInstance"), XS__GetCharactersInInstance, file); newXS(strcpy(buf, "GetInstanceID"), XS__GetInstanceID, file); + newXS(strcpy(buf, "GetInstanceIDByCharID"), XS__GetInstanceIDByCharID, file); newXS(strcpy(buf, "GetSpellResistType"), XS__GetSpellResistType, file); newXS(strcpy(buf, "GetSpellTargetType"), XS__GetSpellTargetType, file); newXS(strcpy(buf, "GetTimeSeconds"), XS__GetTimeSeconds, file); @@ -3704,6 +3746,7 @@ EXTERN_C XS(boot_quest) { newXS(strcpy(buf, "MovePCInstance"), XS__MovePCInstance, file); newXS(strcpy(buf, "RemoveAllFromInstance"), XS__RemoveAllFromInstance, file); newXS(strcpy(buf, "RemoveFromInstance"), XS__RemoveFromInstance, file); + newXS(strcpy(buf, "RemoveFromInstanceByCharID"), XS__RemoveFromInstanceByCharID, file); newXS(strcpy(buf, "SendMail"), XS__SendMail, file); newXS(strcpy(buf, "SetRunning"), XS__SetRunning, file); newXS(strcpy(buf, "activespeakactivity"), XS__activespeakactivity, file); diff --git a/zone/lua_general.cpp b/zone/lua_general.cpp index 6eb8ddf52..2bc769669 100644 --- a/zone/lua_general.cpp +++ b/zone/lua_general.cpp @@ -866,10 +866,18 @@ int lua_get_instance_id(const char *zone, uint32 version) { return quest_manager.GetInstanceID(zone, version); } +int lua_get_instance_id_by_char_id(const char *zone, uint32 version, uint32 char_id) { + return quest_manager.GetInstanceIDByCharID(zone, version, char_id); +} + void lua_assign_to_instance(uint32 instance_id) { quest_manager.AssignToInstance(instance_id); } +void lua_assign_to_instance_by_char_id(uint32 instance_id, uint32 char_id) { + quest_manager.AssignToInstanceByCharID(instance_id, char_id); +} + void lua_assign_group_to_instance(uint32 instance_id) { quest_manager.AssignGroupToInstance(instance_id); } @@ -882,6 +890,10 @@ void lua_remove_from_instance(uint32 instance_id) { quest_manager.RemoveFromInstance(instance_id); } +void lua_remove_from_instance_by_char_id(uint32 instance_id, uint32 char_id) { + quest_manager.RemoveFromInstanceByCharID(instance_id, char_id); +} + void lua_remove_all_from_instance(uint32 instance_id) { quest_manager.RemoveAllFromInstance(instance_id); } @@ -1689,13 +1701,16 @@ luabind::scope lua_register_general() { luabind::def("destroy_instance", &lua_destroy_instance), luabind::def("update_instance_timer", &lua_update_instance_timer), luabind::def("get_instance_id", &lua_get_instance_id), + luabind::def("get_instance_id_by_char_id", &lua_get_instance_id_by_char_id), luabind::def("get_instance_timer", &lua_get_instance_timer), luabind::def("get_instance_timer_by_id", &lua_get_instance_timer_by_id), luabind::def("get_characters_in_instance", &lua_get_characters_in_instance), luabind::def("assign_to_instance", &lua_assign_to_instance), + luabind::def("assign_to_instance_by_char_id", &lua_assign_to_instance_by_char_id), luabind::def("assign_group_to_instance", &lua_assign_group_to_instance), luabind::def("assign_raid_to_instance", &lua_assign_raid_to_instance), luabind::def("remove_from_instance", &lua_remove_from_instance), + luabind::def("remove_from_instance_by_char_id", &lua_remove_from_instance_by_char_id), luabind::def("remove_all_from_instance", &lua_remove_all_from_instance), luabind::def("flag_instance_by_group_leader", &lua_flag_instance_by_group_leader), luabind::def("flag_instance_by_raid_leader", &lua_flag_instance_by_raid_leader),