mirror of
https://github.com/EQEmu/Server.git
synced 2026-03-09 13:22:25 +00:00
Allow updating instance timers through perl and lua.
This commit is contained in:
parent
baaf5801ff
commit
b3afc684de
@ -2906,6 +2906,19 @@ XS(XS__DestroyInstance) {
|
|||||||
XSRETURN_EMPTY;
|
XSRETURN_EMPTY;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
XS(XS__UpdateInstanceTimer);
|
||||||
|
XS(XS__UpdateInstanceTimer) {
|
||||||
|
dXSARGS;
|
||||||
|
if (items != 2)
|
||||||
|
Perl_croak(aTHX_ "Usage: UpdateInstanceTimer(instance_id, new_duration)");
|
||||||
|
|
||||||
|
uint16 instance_id = (uint16)SvUV(ST(0));
|
||||||
|
uint32 new_duration = (uint32)SvUV(ST(1));
|
||||||
|
quest_manager.UpdateInstanceTimer(instance_id, new_duration);
|
||||||
|
|
||||||
|
XSRETURN_EMPTY;
|
||||||
|
}
|
||||||
|
|
||||||
XS(XS__GetInstanceID);
|
XS(XS__GetInstanceID);
|
||||||
XS(XS__GetInstanceID) {
|
XS(XS__GetInstanceID) {
|
||||||
dXSARGS;
|
dXSARGS;
|
||||||
@ -3636,6 +3649,7 @@ EXTERN_C XS(boot_quest)
|
|||||||
newXS(strcpy(buf, "ChooseRandom"), XS__ChooseRandom, file);
|
newXS(strcpy(buf, "ChooseRandom"), XS__ChooseRandom, file);
|
||||||
newXS(strcpy(buf, "CreateInstance"), XS__CreateInstance, file);
|
newXS(strcpy(buf, "CreateInstance"), XS__CreateInstance, file);
|
||||||
newXS(strcpy(buf, "DestroyInstance"), XS__DestroyInstance, file);
|
newXS(strcpy(buf, "DestroyInstance"), XS__DestroyInstance, file);
|
||||||
|
newXS(strcpy(buf, "UpdateInstanceTimer"), XS__UpdateInstanceTimer, file);
|
||||||
newXS(strcpy(buf, "FlagInstanceByGroupLeader"), XS__FlagInstanceByGroupLeader, file);
|
newXS(strcpy(buf, "FlagInstanceByGroupLeader"), XS__FlagInstanceByGroupLeader, file);
|
||||||
newXS(strcpy(buf, "FlagInstanceByRaidLeader"), XS__FlagInstanceByRaidLeader, file);
|
newXS(strcpy(buf, "FlagInstanceByRaidLeader"), XS__FlagInstanceByRaidLeader, file);
|
||||||
newXS(strcpy(buf, "FlyMode"), XS__FlyMode, file);
|
newXS(strcpy(buf, "FlyMode"), XS__FlyMode, file);
|
||||||
|
|||||||
@ -804,6 +804,10 @@ void lua_destroy_instance(uint32 instance_id) {
|
|||||||
quest_manager.DestroyInstance(instance_id);
|
quest_manager.DestroyInstance(instance_id);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void lua_update_instance_timer(uint16 instance_id, uint32 new_duration) {
|
||||||
|
quest_manager.UpdateInstanceTimer(instance_id, new_duration);
|
||||||
|
}
|
||||||
|
|
||||||
int lua_get_instance_id(const char *zone, uint32 version) {
|
int lua_get_instance_id(const char *zone, uint32 version) {
|
||||||
return quest_manager.GetInstanceID(zone, version);
|
return quest_manager.GetInstanceID(zone, version);
|
||||||
}
|
}
|
||||||
@ -1576,6 +1580,7 @@ luabind::scope lua_register_general() {
|
|||||||
luabind::def("get_guild_name_by_id", &lua_get_guild_name_by_id),
|
luabind::def("get_guild_name_by_id", &lua_get_guild_name_by_id),
|
||||||
luabind::def("create_instance", &lua_create_instance),
|
luabind::def("create_instance", &lua_create_instance),
|
||||||
luabind::def("destroy_instance", &lua_destroy_instance),
|
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", &lua_get_instance_id),
|
||||||
luabind::def("get_characters_in_instance", &lua_get_characters_in_instance),
|
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", &lua_assign_to_instance),
|
||||||
|
|||||||
@ -2582,6 +2582,22 @@ void QuestManager::DestroyInstance(uint16 instance_id)
|
|||||||
database.DeleteInstance(instance_id);
|
database.DeleteInstance(instance_id);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void QuestManager::UpdateInstanceTimer(uint16 instance_id, uint32 new_duration)
|
||||||
|
{
|
||||||
|
std::string query = StringFormat("UPDATE instance_list SET duration = %lu, start_time = UNIX_TIMESTAMP() WHERE id = %lu",
|
||||||
|
(unsigned long)new_duration, (unsigned long)instance_id);
|
||||||
|
auto results = database.QueryDatabase(query);
|
||||||
|
|
||||||
|
if (results.Success()) {
|
||||||
|
auto pack = new ServerPacket(ServerOP_InstanceUpdateTime, sizeof(ServerInstanceUpdateTime_Struct));
|
||||||
|
ServerInstanceUpdateTime_Struct *ut = (ServerInstanceUpdateTime_Struct*)pack->pBuffer;
|
||||||
|
ut->instance_id = instance_id;
|
||||||
|
ut->new_duration = new_duration;
|
||||||
|
worldserver.SendPacket(pack);
|
||||||
|
safe_delete(pack);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
uint16 QuestManager::GetInstanceID(const char *zone, int16 version)
|
uint16 QuestManager::GetInstanceID(const char *zone, int16 version)
|
||||||
{
|
{
|
||||||
QuestManagerCurrentQuestVars();
|
QuestManagerCurrentQuestVars();
|
||||||
|
|||||||
@ -217,6 +217,7 @@ public:
|
|||||||
void MerchantSetItem(uint32 NPCid, uint32 itemid, uint32 quantity = 0);
|
void MerchantSetItem(uint32 NPCid, uint32 itemid, uint32 quantity = 0);
|
||||||
uint32 MerchantCountItem(uint32 NPCid, uint32 itemid);
|
uint32 MerchantCountItem(uint32 NPCid, uint32 itemid);
|
||||||
uint16 CreateInstance(const char *zone, int16 version, uint32 duration);
|
uint16 CreateInstance(const char *zone, int16 version, uint32 duration);
|
||||||
|
void UpdateInstanceTimer(uint16 instance_id, uint32 new_duration);
|
||||||
void DestroyInstance(uint16 instance_id);
|
void DestroyInstance(uint16 instance_id);
|
||||||
uint16 GetInstanceID(const char *zone, int16 version);
|
uint16 GetInstanceID(const char *zone, int16 version);
|
||||||
void AssignToInstance(uint16 instance_id);
|
void AssignToInstance(uint16 instance_id);
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user