Module:PlayerRename

local util_args = require('Module:ArgsUtil') local util_cargo = require("Module:CargoUtil") local util_esports = require("Module:EsportsUtil") local util_html = require("Module:HtmlUtil") local util_news = require("Module:NewsUtil") local util_table = require("Module:TableUtil") local util_vars = require("Module:VarsUtil") local i18n = require("Module:I18nUtil")

local m_team = require('Module:Team')

local h = {}

local p = {} function p.main(frame) local args = util_args.merge util_cargo.setStoreNamespace('Data') i18n.init('PlayerRename') util_news.setId args.Sentence = h.writeSentence(args) h.storeRenameCargo(args) local newsCargo = h.getNewsCargo(args) util_cargo.store(newsCargo) return util_news.makeSentenceOutput(args, newsCargo) end

function h.writeSentence(args) return i18n.default(		'sentence',		util_esports.playerLinked(args.original),		util_esports.playerDisplay(args.new)	) end

function h.storeRenameCargo(args) local tbl = { _table = 'PlayerRenames', Date = util_vars.getVar('Date'), OriginalName = args.original, NewName = args.new, NewsId = util_news.getId, IsRestyle = util_args.castAsBool(args.restyle), }	util_cargo.store(tbl) end

function h.getNewsCargo(args) local tbl = { Players = args.original, }	util_table.mergeDontOverwrite(		tbl,		util_news.getNewsCargoFieldsFromArgs(args),		h.getNewsSubjectTags(args)	) return tbl end

function h.getNewsSubjectTags(args) if not args.team then return {} end local ret = { SubjectType = 'Team', Subject = m_team.teamlinkname(args.team), Teams = m_team.teamlinkname(args.team), }	return ret

end

return p