5441
редагування
Admin (обговорення | внесок) Немає опису редагування |
Admin (обговорення | внесок) Немає опису редагування |
||
| Рядок 91: | Рядок 91: | ||
end | end | ||
--- | --- Отримує список ігор гравця | ||
function | local function get_player_games_list(player_name) | ||
local title = mw.title.new("Ігри") | local title = mw.title.new("Ігри") | ||
if not title or not title.exists then | if not title or not title.exists then | ||
return | return nil | ||
end | end | ||
local content = title:getContent() | local content = title:getContent() | ||
if not content then | if not content then | ||
return | return nil | ||
end | end | ||
| Рядок 114: | Рядок 108: | ||
if not table_start or not table_end then | if not table_start or not table_end then | ||
return | return nil | ||
end | end | ||
| Рядок 174: | Рядок 168: | ||
}) | }) | ||
end | end | ||
end | |||
return games | |||
end | |||
--- Головна функція для виведення ігор гравця | |||
function p.player_games(frame) | |||
local player_name = frame.args.player | |||
if not player_name or player_name == "" then | |||
return error_output("No Player Name", "") | |||
end | |||
local games = get_player_games_list(player_name) | |||
if not games then | |||
return error_output("Cannot Load Games", "Ігри") | |||
end | end | ||
| Рядок 197: | Рядок 208: | ||
local link_display = "" | local link_display = "" | ||
if game.link and game.link ~= "" then | if game.link and game.link ~= "" then | ||
link_display = string.format('[%s <span style="font-size:16px;">▶️</span>]', game.link | link_display = string.format('[%s Дивитися <span style="font-size:16px;">▶️</span>]', game.link) | ||
end | end | ||
| Рядок 217: | Рядок 228: | ||
return table.concat(table_html, '\n') | return table.concat(table_html, '\n') | ||
end | |||
--- Функція для отримання кількості ігор гравця | |||
function p.games_count(frame) | |||
local player_name = frame.args.player | |||
if not player_name or player_name == "" then | |||
return "0" | |||
end | |||
local games = get_player_games_list(player_name) | |||
if not games then | |||
return "0" | |||
end | |||
return tostring(#games) | |||
end | end | ||
return p | return p | ||