You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

65 lines
1.8 KiB

MoveIt.Utils = {}
function MoveIt.Utils:GetPlayerData()
local roles = {
TANK = "Tank",
HEALER = "Healer",
DAMAGER = "Dps",
None = "None"
}
local playerName = UnitName("player")
local realm = GetRealmName()
local localizedClass, _, classIndex = UnitClass("player")
local currentSpecIndex = GetSpecialization()
local specId, specName, _, _, specRole, _ = GetSpecializationInfo(currentSpecIndex)
MoveIt.playerData.playerName = playerName
MoveIt.playerData.realmName = realm
MoveIt.playerData.className = localizedClass
MoveIt.playerData.classId = classIndex
MoveIt.playerData.specName = specName
MoveIt.playerData.specId = specId
MoveIt.playerData.role = roles[specRole]
end
function MoveIt.Utils:PrintPlayerData()
local pd = MoveIt.playerData
print(self.ColouredText("MoveIt Player Data:", "ffff00"))
print("Player: " .. pd.playerName)
print("Realm: " .. pd.realmName)
print("Class: " .. pd.className)
print("ClassId: " .. pd.classId)
print("Spec: " .. pd.specName)
print("SpecId: " .. pd.specId)
print("Role: " .. pd.role)
print(GetSpecializationInfo(pd.specId))
end
function MoveIt.Utils:SplitString(inputstr, sep)
local count = 0
if sep == nil then
sep = "%s"
end
local t={}
for str in string.gmatch(inputstr, "([^"..sep.."]+)") do
table.insert(t, str)
count = count + 1
end
return t, count
end
function MoveIt.Utils:SimpleTableCopy(sourceTable, destinationTable)
if sourceTable == nil then return end
if destinationTable == nil then destinationTable = {} end
for k, v in pairs(sourceTable) do
destinationTable[k] = v
end
end
function MoveIt.Utils.ColouredText(text, colour) return "\124cff" .. colour .. text .. "\124r" end
function MoveIt.Utils:Error(message) print(self.ColouredText(message, "ff0000")) end