From 6728a9769c62d0934169f17b129f5fe66df84a08 Mon Sep 17 00:00:00 2001 From: dowoge Date: Sat, 7 Jan 2023 16:22:30 -0500 Subject: [PATCH] comment maps out --- src/modules/commands/maps_init.lua | 118 ++++++++++++++--------------- 1 file changed, 59 insertions(+), 59 deletions(-) diff --git a/src/modules/commands/maps_init.lua b/src/modules/commands/maps_init.lua index a882134..e9ec84b 100644 --- a/src/modules/commands/maps_init.lua +++ b/src/modules/commands/maps_init.lua @@ -1,71 +1,71 @@ -local discordia=require('discordia') -local API=require('./../strafes_net.lua') -discordia.extensions() -API.MAPS={} +-- local discordia=require('discordia') +-- local API=require('./../strafes_net.lua') +-- discordia.extensions() +-- API.MAPS={} -local function insert(t, value) - local start, ending, mid, state = 1, #t, 1, 0 +-- local function insert(t, value) +-- local start, ending, mid, state = 1, #t, 1, 0 - while start <= ending do - mid = math.floor((start + ending) / 2) - if #value.DisplayName < #t[mid].DisplayName then - ending, state = mid - 1, 0 - else - start, state = mid + 1, 1 - end - end +-- while start <= ending do +-- mid = math.floor((start + ending) / 2) +-- if #value.DisplayName < #t[mid].DisplayName then +-- ending, state = mid - 1, 0 +-- else +-- start, state = mid + 1, 1 +-- end +-- end - table.insert(t, mid + state, value) -end +-- table.insert(t, mid + state, value) +-- end -for _, game in next, API.GAMES do - if type(tonumber(game)) == 'number' then - local count = 0 -- add into the maps table afterwards - local maps = {} - local res, headers = API:GetMaps(game) - local pages = tonumber(headers['Pagination-Count']) +-- for _, game in next, API.GAMES do +-- if type(tonumber(game)) == 'number' then +-- local count = 0 -- add into the maps table afterwards +-- local maps = {} +-- local res, headers = API:GetMaps(game) +-- local pages = tonumber(headers['Pagination-Count']) - count = count + #res +-- count = count + #res - for _, v in next, res do - insert(maps, v) - end +-- for _, v in next, res do +-- insert(maps, v) +-- end - if pages > 1 then - for i = 2, pages do - res, headers = API:GetMaps(game, i) - count = count + #res +-- if pages > 1 then +-- for i = 2, pages do +-- res, headers = API:GetMaps(game, i) +-- count = count + #res - for _, j in next, res do - insert(maps, j) - end - end - end +-- for _, j in next, res do +-- insert(maps, j) +-- end +-- end +-- end - setmetatable(maps, {__index = function(self, k) - if k=='count' then return self.count end +-- setmetatable(maps, {__index = function(self, k) +-- if k=='count' then return self.count end - -- Just to make sure it goes in the right order - if type(k)=='string' then - for i = 1, self.count do - local v = self[i] - if type(v) == 'table' and v.DisplayName:lower():find(tostring(k:gsub('%%', '%%%%'):gsub('^%^', '%%^'):gsub('%$$', '%%$'):gsub('%(', '%%('):gsub('%)', '%%)'):gsub('%.', '%%.'):gsub('%[', '%%['):gsub('%]', '%%]'):gsub('%*', '%%*'):gsub('%+', '%%+'):gsub('%-', '%%-'):gsub('%?', '%%?')):lower()) then - return v - end - end - elseif type(k)=='number' then - for i = 1, self.count do - local v = self[i] +-- -- Just to make sure it goes in the right order +-- if type(k)=='string' then +-- for i = 1, self.count do +-- local v = self[i] +-- if type(v) == 'table' and v.DisplayName:lower():find(tostring(k:gsub('%%', '%%%%'):gsub('^%^', '%%^'):gsub('%$$', '%%$'):gsub('%(', '%%('):gsub('%)', '%%)'):gsub('%.', '%%.'):gsub('%[', '%%['):gsub('%]', '%%]'):gsub('%*', '%%*'):gsub('%+', '%%+'):gsub('%-', '%%-'):gsub('%?', '%%?')):lower()) then +-- return v +-- end +-- end +-- elseif type(k)=='number' then +-- for i = 1, self.count do +-- local v = self[i] - if type(v) == 'table' and v.ID==k then - return v - end - end - end - end}) +-- if type(v) == 'table' and v.ID==k then +-- return v +-- end +-- end +-- end +-- end}) - maps.count = count - API.MAPS[game] = maps - print('map init done for game:', API.GAMES[game], 'count:', API.MAPS[game].count) - end -end \ No newline at end of file +-- maps.count = count +-- API.MAPS[game] = maps +-- print('map init done for game:', API.GAMES[game], 'count:', API.MAPS[game].count) +-- end +-- end \ No newline at end of file