--[[
-- this is here just for reference
COLOR_BLACK = 0
COLOR_BLUE = 5
COLOR_GREEN = 18
COLOR_TEAL = 35
COLOR_LIGHTGREEN = 66
COLOR_DARKBROWN = 78
COLOR_LIGHTBLUE = 89
COLOR_DARKPURPLE = 112
COLOR_BROWN = 120
COLOR_GREY = 129
COLOR_DARKRED = 144
COLOR_DARKPINK = 152
COLOR_PURPLE = 154
COLOR_DARKORANGE = 156
COLOR_RED = 180
COLOR_PINK = 190
COLOR_ORANGE = 192
COLOR_DARKYELLOW = 205
COLOR_YELLOW = 210
COLOR_WHITE = 215
COLOR_NONE = 255
]]
function useRandomColor()
local colors = {0, 5, 18, 35, 66, 78, 89, 112, 120, 129, 144, 152, 154, 156, 180, 190, 192, 205, 210, 215, 255}
return colors[math.random(1, #colors)]
end
local config = {
[0] = "Fist skill UP",
[1] = "Club skill UP",
[2] = "Sword skill UP",
[3] = "Axe skill UP",
[4] = "Distance skill UP",
[5] = "Shield skill UP",
[6] = "Fishing skill UP",
[7] = "Magic level UP",
[8] = "Level UP"
}
function onAdvance(cid, skill, oldlevel, newlevel)
local pos = getThingPosition(cid)
local effectPositions = {
{x = pos.x, y = pos.y - 3, z = pos.z},
{x = pos.x, y = pos.y + 3, z = pos.z},
{x = pos.x - 3, y = pos.y, z = pos.z},
{x = pos.x + 3, y = pos.y, z = pos.z},
{x = pos.x - 2, y = pos.y - 2, z = pos.z},
{x = pos.x + 2, y = pos.y - 2, z = pos.z},
{x = pos.x + 2, y = pos.y + 2, z = pos.z},
{x = pos.x - 2, y = pos.y + 2, z = pos.z}
}
doSendAnimatedText(pos, config[skill], useRandomColor())
for _, ePos in ipairs(effectPositions) do
doSendDistanceShoot(pos, ePos, CONST_ANI_SMALLHOLY)
doSendMagicEffect(pos, ePos, CONST_ME_FIREWORK_YELLOW)
end
return true
end