Merge pull request #480 from KinglyKrab/master

Added GetInstanceTimer to Perl and Lua.
This commit is contained in:
Akkadius 2015-12-28 22:42:14 -06:00
commit b9d00f91de
5 changed files with 28 additions and 0 deletions

View File

@ -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

View File

@ -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);

View File

@ -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);
}

View File

@ -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();

View File

@ -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);