mirror of
https://github.com/EQEmu/Server.git
synced 2025-12-12 01:11:29 +00:00
Added GetInstanceTimerByID(instance_id) to Perl and Lua.
This commit is contained in:
parent
ce71b6d9f0
commit
ff876bd558
@ -2,6 +2,8 @@ EQEMu Changelog (Started on Sept 24, 2003 15:50)
|
||||
-------------------------------------------------------
|
||||
== 12/28/2015 ==
|
||||
Kinglykrab: Added GetInstanceTimer() to Perl and Lua.
|
||||
- Added GetInstanceTimerByID(instance_id) to Perl and Lua.
|
||||
- Note: If you do not provide an instance id in the method it defaults to instance id 0 and returns 0 for time remaining.
|
||||
|
||||
== 12/21/2015 ==
|
||||
Natedog: Updated item table fields and added a few missing fields for evolving items
|
||||
|
||||
@ -2930,6 +2930,18 @@ XS(XS__GetInstanceTimer) {
|
||||
XSRETURN_UV(timer);
|
||||
}
|
||||
|
||||
XS(XS__GetInstanceTimerByID);
|
||||
XS(XS__GetInstanceTimerByID) {
|
||||
dXSARGS;
|
||||
if (items != 1)
|
||||
Perl_croak(aTHX_ "Usage: GetInstanceTimerByID(instance_id)");
|
||||
|
||||
uint16 instance_id = (uint16)SvUV(ST(0));
|
||||
uint32 timer = quest_manager.GetInstanceTimerByID(instance_id);
|
||||
|
||||
XSRETURN_UV(timer);
|
||||
}
|
||||
|
||||
XS(XS__GetInstanceID);
|
||||
XS(XS__GetInstanceID) {
|
||||
dXSARGS;
|
||||
@ -3662,6 +3674,7 @@ EXTERN_C XS(boot_quest)
|
||||
newXS(strcpy(buf, "DestroyInstance"), XS__DestroyInstance, file);
|
||||
newXS(strcpy(buf, "UpdateInstanceTimer"), XS__UpdateInstanceTimer, file);
|
||||
newXS(strcpy(buf, "GetInstanceTimer"), XS__GetInstanceTimer, file);
|
||||
newXS(strcpy(buf, "GetInstanceTimerByID"), XS__GetInstanceTimerByID, file);
|
||||
newXS(strcpy(buf, "FlagInstanceByGroupLeader"), XS__FlagInstanceByGroupLeader, file);
|
||||
newXS(strcpy(buf, "FlagInstanceByRaidLeader"), XS__FlagInstanceByRaidLeader, file);
|
||||
newXS(strcpy(buf, "FlyMode"), XS__FlyMode, file);
|
||||
|
||||
@ -812,6 +812,10 @@ uint32 lua_get_instance_timer() {
|
||||
return quest_manager.GetInstanceTimer();
|
||||
}
|
||||
|
||||
uint32 lua_get_instance_timer_by_id(uint16 instance_id) {
|
||||
return quest_manager.GetInstanceTimerByID(instance_id);
|
||||
}
|
||||
|
||||
int lua_get_instance_id(const char *zone, uint32 version) {
|
||||
return quest_manager.GetInstanceID(zone, version);
|
||||
}
|
||||
|
||||
@ -2606,6 +2606,21 @@ uint32 QuestManager::GetInstanceTimer() {
|
||||
return 0;
|
||||
}
|
||||
|
||||
uint32 QuestManager::GetInstanceTimerByID(uint16 instance_id) {
|
||||
if (instance_id == 0)
|
||||
return 0;
|
||||
|
||||
std::string query = StringFormat("SELECT ((start_time + duration) - UNIX_TIMESTAMP()) AS `remaining` FROM `instance_list` WHERE `id` = %lu", (unsigned long)instance_id);
|
||||
auto results = database.QueryDatabase(query);
|
||||
|
||||
if (results.Success()) {
|
||||
auto row = results.begin();
|
||||
uint32 timer = atoi(row[0]);
|
||||
return timer;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
uint16 QuestManager::GetInstanceID(const char *zone, int16 version)
|
||||
{
|
||||
QuestManagerCurrentQuestVars();
|
||||
|
||||
@ -219,6 +219,7 @@ public:
|
||||
uint16 CreateInstance(const char *zone, int16 version, uint32 duration);
|
||||
void UpdateInstanceTimer(uint16 instance_id, uint32 new_duration);
|
||||
uint32 GetInstanceTimer();
|
||||
uint32 GetInstanceTimerByID(uint16 instance_id = 0);
|
||||
void DestroyInstance(uint16 instance_id);
|
||||
uint16 GetInstanceID(const char *zone, int16 version);
|
||||
void AssignToInstance(uint16 instance_id);
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user