6194
редагування
Admin (обговорення | внесок) Немає опису редагування |
Admin (обговорення | внесок) Немає опису редагування |
||
| (Не показано 5 проміжних версій цього користувача) | |||
| Рядок 431: | Рядок 431: | ||
local raw = mw.text.trim(player_info[4]) | local raw = mw.text.trim(player_info[4]) | ||
if raw ~= "Відсутній" and raw ~= "-" and raw ~= "" then | if raw ~= "Відсутній" and raw ~= "-" and raw ~= "" then | ||
recruiter = raw | recruiter = raw | ||
end | end | ||
end | end | ||
| Рядок 444: | Рядок 444: | ||
local output = {} | local output = {} | ||
table.insert(output, "{{MCC Player New") | table.insert(output, "{{MCC Player New") | ||
table.insert(output, "| nickname = " .. player_name) | table.insert(output, "| nickname = " .. player_name) | ||
if stats and #stats >= 6 then | if stats and #stats >= 6 then | ||
local games = stats[3] or "0" | local games = stats[3] or "0" | ||
| Рядок 456: | Рядок 453: | ||
local winrate = stats[6] or "0" | local winrate = stats[6] or "0" | ||
winrate = mw.ustring.gsub(winrate, "%%", "") | winrate = mw.ustring.gsub(winrate, "%%", "") | ||
winrate = mw.text.trim(winrate) | winrate = mw.text.trim(winrate) | ||
| Рядок 475: | Рядок 471: | ||
table.insert(output, "| date_added = " .. date_added) | table.insert(output, "| date_added = " .. date_added) | ||
if foundation and #foundation >= 3 then | if foundation and #foundation >= 3 then | ||
local found = mw.ustring.gsub(foundation[3] or "0", "[^%d]", "") | local found = mw.ustring.gsub(foundation[3] or "0", "[^%d]", "") | ||
| Рядок 483: | Рядок 478: | ||
end | end | ||
if prize_pool and #prize_pool >= 2 then | if prize_pool and #prize_pool >= 2 then | ||
local prize = mw.ustring.gsub(prize_pool[2] or "0", "[^%d]", "") | local prize = mw.ustring.gsub(prize_pool[2] or "0", "[^%d]", "") | ||
| Рядок 491: | Рядок 485: | ||
end | end | ||
if finalist and #finalist >= 3 then | if finalist and #finalist >= 3 then | ||
local fin = mw.ustring.gsub(finalist[3] or "0", "[^%d]", "") | local fin = mw.ustring.gsub(finalist[3] or "0", "[^%d]", "") | ||
| Рядок 498: | Рядок 491: | ||
table.insert(output, "| finalist = 0") | table.insert(output, "| finalist = 0") | ||
end | end | ||
table.insert(output, "}}") | table.insert(output, "}}") | ||
table.insert(output, "") | table.insert(output, "") | ||
table.insert(output, "''[Тут додай опис гравця]''") | table.insert(output, "''[Тут додай опис гравця]''") | ||
table.insert(output, "") | table.insert(output, "") | ||
table.insert(output, "== Сезони ==") | table.insert(output, "== Сезони ==") | ||
table.insert(output, "{{#invoke:FetchData|season_achievements|player=" .. player_name .. "}}") | table.insert(output, "{{#invoke:FetchData|season_achievements|player=" .. player_name .. "}}") | ||
table.insert(output, "") | table.insert(output, "") | ||
table.insert(output, "== Нагороди в MCC ==") | table.insert(output, "== Нагороди в MCC ==") | ||
table.insert(output, titles_code) | table.insert(output, titles_code) | ||
table.insert(output, "") | table.insert(output, "") | ||
table.insert(output, "== Записи ігор ({{#invoke:FetchData|games_count_records|player=" .. player_name .. "}}) ==") | table.insert(output, "== Записи ігор ({{#invoke:FetchData|games_count_records|player=" .. player_name .. "}}) ==") | ||
table.insert(output, "{{#invoke:FetchData|player_games|player=" .. player_name .. "}}") | table.insert(output, "{{#invoke:FetchData|player_games|player=" .. player_name .. "}}") | ||
table.insert(output, "") | table.insert(output, "") | ||
table.insert(output, "== Цікаві факти ==") | table.insert(output, "== Цікаві факти ==") | ||
table.insert(output, facts_code) | table.insert(output, facts_code) | ||
-- НАЙПРОСТІШЕ РІШЕННЯ: Додаємо пробіл на початку кожного рядка | |||
local final_code = table.concat(output, "\n") | |||
-- Розбиваємо на рядки та додаємо пробіл | |||
local result = {} | |||
for line in final_code:gmatch("([^\n]*)\n?") do | |||
if line ~= "" then | |||
table.insert(result, " " .. line) | |||
else | |||
table.insert(result, "") | |||
end | |||
end | |||
-- Додаємо заголовок | |||
return "'''Код для гравця " .. player_name .. ":'''\n\n" .. table.concat(result, "\n") | |||
end | end | ||
-- Генерувати для всіх гравців | -- Генерувати для всіх гравців | ||