diff --git a/changelog.txt b/changelog.txt index 74b6ab113..abb096988 100644 --- a/changelog.txt +++ b/changelog.txt @@ -1,5 +1,8 @@ EQEMu Changelog (Started on Sept 24, 2003 15:50) ------------------------------------------------------- +== 12/28/2015 == +Kinglykrab: Added GetInstanceTimer() to Perl and Lua. + == 12/21/2015 == Natedog: Updated item table fields and added a few missing fields for evolving items -DO NOT implement Heirloom items till the inventory code is fixed to allow placing NO DROP diff --git a/zone/embparser_api.cpp b/zone/embparser_api.cpp index 126e8169d..8ac6d61bf 100644 --- a/zone/embparser_api.cpp +++ b/zone/embparser_api.cpp @@ -2919,6 +2919,17 @@ XS(XS__UpdateInstanceTimer) { XSRETURN_EMPTY; } +XS(XS__GetInstanceTimer); +XS(XS__GetInstanceTimer) { + dXSARGS; + if (items != 0) + Perl_croak(aTHX_ "Usage: GetInstanceTimer()"); + + uint32 timer = quest_manager.GetInstanceTimer(); + + XSRETURN_UV(timer); +} + XS(XS__GetInstanceID); XS(XS__GetInstanceID) { dXSARGS; @@ -3650,6 +3661,7 @@ EXTERN_C XS(boot_quest) newXS(strcpy(buf, "CreateInstance"), XS__CreateInstance, file); newXS(strcpy(buf, "DestroyInstance"), XS__DestroyInstance, file); newXS(strcpy(buf, "UpdateInstanceTimer"), XS__UpdateInstanceTimer, file); + newXS(strcpy(buf, "GetInstanceTimer"), XS__GetInstanceTimer, file); newXS(strcpy(buf, "FlagInstanceByGroupLeader"), XS__FlagInstanceByGroupLeader, file); newXS(strcpy(buf, "FlagInstanceByRaidLeader"), XS__FlagInstanceByRaidLeader, file); newXS(strcpy(buf, "FlyMode"), XS__FlyMode, file); diff --git a/zone/lua_general.cpp b/zone/lua_general.cpp index bed0fd7bc..0af3ed365 100644 --- a/zone/lua_general.cpp +++ b/zone/lua_general.cpp @@ -808,6 +808,10 @@ void lua_update_instance_timer(uint16 instance_id, uint32 new_duration) { quest_manager.UpdateInstanceTimer(instance_id, new_duration); } +uint32 lua_get_instance_timer() { + return quest_manager.GetInstanceTimer(); +} + int lua_get_instance_id(const char *zone, uint32 version) { return quest_manager.GetInstanceID(zone, version); } diff --git a/zone/questmgr.cpp b/zone/questmgr.cpp index cb70f93d3..d1cf87dad 100644 --- a/zone/questmgr.cpp +++ b/zone/questmgr.cpp @@ -2598,6 +2598,14 @@ void QuestManager::UpdateInstanceTimer(uint16 instance_id, uint32 new_duration) } } +uint32 QuestManager::GetInstanceTimer() { + if (zone && zone->GetInstanceID() > 0 && zone->GetInstanceTimer()) { + uint32 ttime = zone->GetInstanceTimer()->GetRemainingTime(); + return ttime; + } + return 0; +} + uint16 QuestManager::GetInstanceID(const char *zone, int16 version) { QuestManagerCurrentQuestVars(); diff --git a/zone/questmgr.h b/zone/questmgr.h index cd1c4a303..276fcfeca 100644 --- a/zone/questmgr.h +++ b/zone/questmgr.h @@ -218,6 +218,7 @@ public: uint32 MerchantCountItem(uint32 NPCid, uint32 itemid); uint16 CreateInstance(const char *zone, int16 version, uint32 duration); void UpdateInstanceTimer(uint16 instance_id, uint32 new_duration); + uint32 GetInstanceTimer(); void DestroyInstance(uint16 instance_id); uint16 GetInstanceID(const char *zone, int16 version); void AssignToInstance(uint16 instance_id);