Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- -- NEW FUNCTION
- function Skada:find_player_by_name(set, playername)
- if set then
- for i, p in ipairs(set.players) do
- if p.name == playername then
- return p
- end
- end
- end
- end
- -- REPLACES OLD FUNCTION
- -- Returns or creates a player in the current.
- function Skada:get_player(set, playerid, playername)
- --if playerid then
- -- self:Print("Getting player with playerid "..playerid)
- --end
- --if playername then
- -- self:Print("Getting player with name "..playername)
- --end
- -- Add player to set if it does not exist.
- local player = Skada:find_player(set, playerid)
- if not player then
- -- If we do not supply a playername (often the case in submodes), we can not create an entry.
- if not playername then
- return
- end
- player = Skada:find_player_by_name(set, playername)
- if not player then
- player = {id = playerid, class = select(2, UnitClass(playername)), name = playername, first = time(), ["time"] = 0}
- -- Tell each mode to apply its needed attributes.
- for i, mode in ipairs(modes) do
- if mode.AddPlayerAttributes ~= nil then
- mode:AddPlayerAttributes(player)
- end
- end
- -- Strip realm name
- -- This is done after module processing due to cross-realm names messing with modules (death log for example, which needs to do UnitHealthMax on the playername).
- local player_name, realm = string.split("-", playername, 2)
- player.name = player_name or playername
- table.insert(set.players, player)
- end
- end
- -- The total set clears out first and last timestamps.
- if not player.first then
- player.first = time()
- end
- -- Mark now as the last time player did something worthwhile.
- player.last = time()
- changed = true
- return player
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement