Вложений: 3
API GetInstanceLockTimeRemaining
1) Функция API GetInstanceLockTimeRemaining() https://wowwiki.fandom.com/wiki/API_...kTimeRemaining
2) Либо вообще не отображает количество убитых боссов в сохраненном инсте, либо возвращает неправильное значение.
3) Четвертый аргумент должен возвращать количество убитых боссов (Number of bosses already dead in the instance. )
4) 22-23.07.2019 логон х100
5) Неизвестно как давно это не работает
6) 10/10 (влияет не только на работу аддонов, использующих эту функцию, но и на игровой интерфейс, так как используется в StaticPopup.lua)
Скрытый текст
PHP код:
StaticPopupDialogs["INSTANCE_LOCK"] = {
-- we use a custom timer called lockTimeleft in here to avoid special casing the static popup code
-- if you use timeout or timeleft then you will go through the StaticPopup system's standard OnUpdate
-- code which we don't want for this dialog
text = INSTANCE_LOCK_TIMER,
button1 = ACCEPT,
button2 = INSTANCE_LEAVE,
OnShow = function(self)
local lockTimeleft, isPreviousInstance =GetInstanceLockTimeRemaining();
if ( lockTimeleft <= 0 ) then
self:Hide();
return;
end
self.lockTimeleft = lockTimeleft;
self.isPreviousInstance = isPreviousInstance;
local type, difficulty;
self.name, type, difficulty, self.difficultyName = GetInstanceInfo();
self.extraFrame:SetAllPoints(self.text)
self.extraFrame:Show()
self.extraFrame:SetScript("OnEnter", InstanceLock_OnEnter)
self.extraFrame:SetScript("OnLeave", GameTooltip_Hide)
end,
OnHide = function(self)
self.extraFrame:SetScript("OnEnter", nil)
self.extraFrame:SetScript("OnLeave", nil)
end,
OnUpdate = function(self, elapsed)
local lockTimeleft = self.lockTimeleft - elapsed;
if ( lockTimeleft <= 0 ) then
local OnCancel = StaticPopupDialogs["INSTANCE_LOCK"].OnCancel;
if ( OnCancel ) then
OnCancel(self, nil, "timeout");
end
self:Hide();
return;
end
self.lockTimeleft = lockTimeleft;
local name = GetDungeonNameWithDifficulty(self.name, self.difficultyName);
-- Set dialog message using information that describes which bosses are still around
local text = _G[self:GetName().."Text"];
local lockstring = string.format((self.isPreviousInstance and INSTANCE_LOCK_TIMER_PREVIOUSLY_SAVED or INSTANCE_LOCK_TIMER), name, SecondsToTime(ceil(lockTimeleft), nil, 1));
local time, extending;
time, extending, self.extraFrame.encountersTotal, self.extraFrame.encountersComplete = GetInstanceLockTimeRemaining();
local bosses = string.format(BOSSES_KILLED, self.extraFrame.encountersComplete, self.extraFrame.encountersTotal);
text:SetFormattedText(INSTANCE_LOCK_SEPARATOR, lockstring, bosses);
-- make sure the dialog fits the text
StaticPopup_Resize(self, "INSTANCE_LOCK");
end,
OnAccept = function(self)
RespondInstanceLock(true);
self.name, self.difficultyName = nil, nil;
self.lockTimeleft = nil;
end,
OnCancel = function(self, data, reason)
if ( reason == "timeout" ) then
self:Hide();
return;
end
RespondInstanceLock(false);
self.name, self.difficultyName = nil, nil;
self.lockTimeleft = nil;
end,
timeout = 0,
showAlert = 1,
whileDead = 1,
interruptCinematic = 1,
notClosableByLogout = 1,
noCancelOnReuse = 1,
};
[свернуть]
Здесь также задействована функция GetInstanceInfo() https://forum.wowcircle.com/showthread.php?t=896593
7) Код который использовался при проверке:
PHP код:
local lockTimeleft, isPreviousInstance, encountersTotal, encountersComplete = GetInstanceLockTimeRemaining();
print("---GetInstanceLockTimeRemaining")
print("1= "..tostring(lockTimeleft))
print("2= "..tostring(isPreviousInstance))
print("3= "..tostring(encountersTotal))
print("4= "..tostring(encountersComplete))
print("----GetInstanceLockTimeRemainingEncounter")
for id = 1,encountersTotal do
local bossName, texture, isKilled = GetInstanceLockTimeRemainingEncounter(id);
print("id= "..id.." bossName= "..tostring(bossName).." texture= "..tostring(texture).." isKilled= "..tostring(isKilled))
end
print("---")
Результат: