Module:RankParserDD2

local RankParserDD2 = {}

local empty = "Empty circle dd2" local yellows = {"Yellow circle", "Yellow circle lasso r", "Yellow circle lasso l", "Yellow circle lasso lr", empty} local blues = {"Blue circle", "Blue circle lassor", "Blue circle lassol", "Blue circle lasso lr", empty}

local dot = string.byte(".") local o = string.byte("o") local dash = string.byte("-")

local fmt = ""

local function encode(s) code = {} for i = 1, #s do		if s:byte(i) == o then table.insert(code, 1 + ((i > 1 and s:byte(i - 1) == dash) and 1 or 0) + 2 * ((i < #s and s:byte(i + 1) == dash) and 1 or 0)) elseif s:byte(i) == dot then table.insert(code, 5) end end return code end

local function parse(file_names, s)	code = encode(s) tags = {} for i = 1, #code do		table.insert(tags, fmt:format(file_names[code[i]])) end return table.concat(tags) end

function RankParserDD2.parse_ally(frame) return parse(yellows, frame.args[1]) end

function RankParserDD2.parse_enemy(frame) return parse(blues, frame.args[1]) end

return RankParserDD2