Skip to content

Commit d1fedf6

Browse files
committed
Fix individual map poll image.
1 parent d68f3d6 commit d1fedf6

4 files changed

Lines changed: 24 additions & 19 deletions

File tree

LuaMenu/widgets/api_notification_handler.lua

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ local function AddListeners()
2727
end
2828
lobby:AddListener("OnRung", OnRung)
2929

30-
local function OnVoteUpdate(listener, voteMessage, pollType, notify, mapPoll, candidates, votesNeeded, pollUrl)
30+
local function OnVoteUpdate(listener, voteMessage, pollType, notify, mapPoll, candidates, votesNeeded, pollUrl, mapName)
3131
if notify and not lobby:GetMyIsSpectator() and MouseOutside() then
3232
WG.WrapperLoopback.Alert("Vote to start the battle.")
3333
end

LuaMenu/widgets/gui_battle_room_window.lua

Lines changed: 17 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1050,7 +1050,7 @@ local function SetupVotePanel(votePanel, battle, battleID)
10501050
local buttonNoClickOverride
10511051
local matchmakerModeEnabled = false
10521052

1053-
local currentMapName
1053+
local currentMapUrl
10541054

10551055
local minimapPanel = Panel:New {
10561056
x = 0,
@@ -1071,9 +1071,12 @@ local function SetupVotePanel(votePanel, battle, battleID)
10711071
padding = {1,1,1,1},
10721072
OnClick = {
10731073
function ()
1074-
if currentMapName and config.gameConfig.link_particularMapPage ~= nil then
1075-
WG.BrowserHandler.OpenUrl(config.gameConfig.link_particularMapPage(currentMapName))
1074+
if currentMapUrl then
1075+
WG.BrowserHandler.OpenUrl(currentMapUrl)
10761076
end
1077+
--if currentMapUrl and config.gameConfig.link_particularMapPage ~= nil then
1078+
-- WG.BrowserHandler.OpenUrl(config.gameConfig.link_particularMapPage(currentMapName))
1079+
--end
10771080
end
10781081
},
10791082
}
@@ -1284,23 +1287,23 @@ local function SetupVotePanel(votePanel, battle, battleID)
12841287

12851288
local externalFunctions = {}
12861289

1287-
local oldPollType, oldMapPoll, oldPollUrl
1288-
local function UpdatePollType(pollType, mapPoll, pollUrl)
1289-
if oldPollType == pollType and oldMapPoll == mapPoll and oldPollUrl == pollUrl then
1290+
local oldPollType, oldMapPoll, oldMapUrl, oldPollUrl
1291+
local function UpdatePollType(pollType, mapPoll, mapName, pollUrl)
1292+
if oldPollType == pollType and oldMapPoll == mapPoll and oldMapUrl == mapName and oldPollUrl == pollUrl then
12901293
return
12911294
end
1292-
oldPollType, oldMapPoll, oldPollUrl = pollType, mapPoll, pollUrl
1295+
oldPollType, oldMapPoll, oldMapUrl, oldPollUrl = pollType, mapPoll, mapName, pollUrl
12931296

12941297
if pollType ~= "multi" then
12951298
if mapPoll then
12961299
minimapPanel:SetVisibility(true)
12971300
activePanel:SetPos(height + 2)
12981301
activePanel._relativeBounds.right = 0
12991302
activePanel:UpdateClientArea()
1300-
if pollUrl then
1301-
imMinimap.file, imMinimap.checkFileExists = config:GetMinimapSmallImage(pollUrl)
1303+
if mapName then
1304+
imMinimap.file, imMinimap.checkFileExists = config:GetMinimapSmallImage(mapName)
13021305
imMinimap:Invalidate()
1303-
currentMapName = pollUrl
1306+
currentMapUrl = pollUrl
13041307
end
13051308
else
13061309
minimapPanel:SetVisibility(false)
@@ -1323,8 +1326,8 @@ local function SetupVotePanel(votePanel, battle, battleID)
13231326
end
13241327
end
13251328

1326-
function externalFunctions.VoteUpdate(voteMessage, pollType, mapPoll, candidates, votesNeeded, pollUrl)
1327-
UpdatePollType(pollType, mapPoll, pollUrl)
1329+
function externalFunctions.VoteUpdate(voteMessage, pollType, mapPoll, candidates, votesNeeded, pollUrl, mapName)
1330+
UpdatePollType(pollType, mapPoll, mapName, pollUrl)
13281331
-- Update votes
13291332
if pollType == "multi" then
13301333
SetMultiPollCandidates(candidates)
@@ -1909,8 +1912,8 @@ local function InitializeControls(battleID, oldLobby, topPoportion, setupData)
19091912
playerHandler.RemoveAi(botName)
19101913
end
19111914

1912-
local function OnVoteUpdate(listener, voteMessage, pollType, _, mapPoll, candidates, votesNeeded, pollUrl)
1913-
votePanel.VoteUpdate(voteMessage, pollType, mapPoll, candidates, votesNeeded, pollUrl)
1915+
local function OnVoteUpdate(listener, voteMessage, pollType, _, mapPoll, candidates, votesNeeded, pollUrl, mapName)
1916+
votePanel.VoteUpdate(voteMessage, pollType, mapPoll, candidates, votesNeeded, pollUrl, mapName)
19141917
end
19151918

19161919
local function OnVoteEnd(listener, message, success)

libs/liblobby/lobby/interface_zerok.lua

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1248,7 +1248,7 @@ function Interface:ProcessVote(data, battle, duplicateMessageTime)
12481248
local mapStart = string.find(voteMessage, "Change map to ")
12491249
if mapStart then
12501250
mapStart = mapStart + 14
1251-
pollUrl = string.sub(voteMessage, mapStart, lasturl - 1)
1251+
pollUrl = data.MapName
12521252
mapPoll = true
12531253
elseif string.find(voteMessage, "start the game?") then
12541254
notify = true
@@ -1277,6 +1277,8 @@ end
12771277
function Interface:_BattlePoll(data)
12781278
-- BattlePoll {"Topic":"Choose the next map","Options":[{"Name":"IncultaV2","Id":1,"Votes":0,"URL":"http://test.zero-k.info/Maps/Detail/7514"},{"Name":"Otago 1.1","Id":2,"Votes":0,"URL":"http://test.zero-k.info/Maps/Detail/56587"},{"Name":"Wanderlust v03","Id":3,"Votes":0,"URL":"http://test.zero-k.info/Maps/Detail/55669"},{"Name":"DunePatrol_wip_v03","Id":4,"Votes":0,"URL":"http://test.zero-k.info/Maps/Detail/23549"}],"VotesToWin":3,"YesNoVote":false,"MapSelection":true}
12791279

1280+
--[11:15] <--BattlePoll {"Topic":"Change map to Adansonia v4.1 (16x14)?","Url":"http://zero-k.info/Maps/Detail/55567","Options":[{"Name":"Yes","DisplayName":"Yes","Id":1,"Votes":1,"Url":"http://zero-k.info/Maps/Detail/55567"},{"Name":"No","DisplayName":"No","Id":2,"Votes":0,"Url":""}],"VotesToWin":2,"YesNoVote":true,"MapSelection":true,"NotifyPoll":false,"MapName":"Adansonia v4.1"}
1281+
12801282
if self.REVERSE_COMPAT_2 and data.YesNoVote then
12811283
return
12821284
end
@@ -1306,7 +1308,7 @@ function Interface:_BattlePoll(data)
13061308
pollType = "multi"
13071309
end
13081310

1309-
self:_OnVoteUpdate(voteMessage, pollType, data.NotifyPoll, data.MapName or data.MapSelection, candidates, data.VotesToWin, data.Url)
1311+
self:_OnVoteUpdate(voteMessage, pollType, data.NotifyPoll, data.MapName or data.MapSelection, candidates, data.VotesToWin, data.Url, data.MapName)
13101312
end
13111313
Interface.jsonCommands["BattlePoll"] = Interface._BattlePoll
13121314

libs/liblobby/lobby/lobby.lua

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -900,8 +900,8 @@ function Lobby:_OnSaidBattleEx(userName, message, sayTime)
900900
self:_CallListeners("OnSaidBattleEx", userName, message, sayTime)
901901
end
902902

903-
function Lobby:_OnVoteUpdate(voteMessage, pollType, notify, mapPoll, candidates, votesNeeded, pollUrl)
904-
self:_CallListeners("OnVoteUpdate", voteMessage, pollType, notify, mapPoll, candidates, votesNeeded, pollUrl)
903+
function Lobby:_OnVoteUpdate(voteMessage, pollType, notify, mapPoll, candidates, votesNeeded, pollUrl, mapName)
904+
self:_CallListeners("OnVoteUpdate", voteMessage, pollType, notify, mapPoll, candidates, votesNeeded, pollUrl, mapName)
905905
end
906906

907907
function Lobby:_OnVoteEnd(message, success)

0 commit comments

Comments
 (0)