Skip to content
Merged
Changes from all commits
Commits
Show all changes
32 commits
Select commit Hold shift + click to select a range
498228c
Update login.lua
LeoTKBR Oct 4, 2023
e492edf
Create autosync.yml
LeoTKBR Nov 1, 2023
b312e75
Update autosync.yml
LeoTKBR Nov 1, 2023
13c7799
Update autosync.yml
LeoTKBR Nov 1, 2023
abcc3a2
Update autosync.yml
LeoTKBR Nov 1, 2023
a383e95
Update autosync.yml
LeoTKBR Nov 1, 2023
e0b9d70
Update autosync.yml
LeoTKBR Nov 1, 2023
467fe4e
Update autosync.yml
LeoTKBR Nov 1, 2023
ae7e3ec
Update autosync.yml
LeoTKBR Nov 1, 2023
40f9d9e
Update autosync.yml
LeoTKBR Nov 1, 2023
430c489
Update autosync.yml
LeoTKBR Nov 1, 2023
965160d
Merge branch 'opentibiabr:main' into main
LeoTKBR Nov 4, 2023
708239f
Update autosync.yml
LeoTKBR Nov 4, 2023
203fa21
Merge branch 'opentibiabr:main' into main
LeoTKBR Nov 4, 2023
6927683
Merge branch 'main' of https://github.com/LeoTKBR/canary
LeoTKBR Nov 5, 2023
6dbe8ea
Merge branch 'opentibiabr:main' into main
LeoTKBR Nov 7, 2023
bfaef08
Merge branch 'opentibiabr:main' into main
LeoTKBR Nov 9, 2023
eabbcc5
Merge branch 'opentibiabr:main' into main
LeoTKBR Nov 16, 2023
61541d4
Merge branch 'opentibiabr:main' into main
LeoTKBR Nov 19, 2023
82c3ebf
Merge branch 'opentibiabr:main' into main
LeoTKBR Nov 23, 2023
67f7a9a
Merge branch 'opentibiabr:main' into main
LeoTKBR Nov 30, 2023
65f4896
Merge branch 'opentibiabr:main' into main
LeoTKBR Dec 5, 2023
45c764f
Merge branch 'opentibiabr:main' into main
LeoTKBR Sep 17, 2024
9c2f4db
Merge branch 'opentibiabr:main' into main
LeoTKBR Nov 7, 2024
d35e4a8
Merge branch 'opentibiabr:main' into main
LeoTKBR Nov 21, 2024
691870f
Merge branch 'opentibiabr:main' into main
LeoTKBR Nov 22, 2024
325a906
Merge branch 'opentibiabr:main' into main
LeoTKBR Mar 28, 2025
29bc04c
#Remove autosync
LeoTKBR Mar 28, 2025
40f44fb
#Add playericon
LeoTKBR Apr 11, 2025
16ee404
Lua code format - (Stylua)
github-actions[bot] Apr 11, 2025
7de8263
remove comments in code
LeoTKBR Apr 11, 2025
50610ca
Lua code format - (Stylua)
github-actions[bot] Apr 11, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
105 changes: 105 additions & 0 deletions data/scripts/talkactions/god/icons_functions.lua
Original file line number Diff line number Diff line change
Expand Up @@ -103,3 +103,108 @@ end
bakragoreIcon:separator(" ")
bakragoreIcon:groupType("god")
bakragoreIcon:register()

local creatureIconQuests = {
[0] = "None",
[1] = "WhiteCross",
[2] = "RedCross",
[3] = "RedBall",
[4] = "GreenBall",
[5] = "RedGreenBall",
[6] = "GreenShield",
[7] = "YellowShield",
[8] = "BlueShield",
[9] = "PurpleShield",
[10] = "RedShield",
[11] = "Dove",
[12] = "Energy",
[13] = "Earth",
[14] = "Water",
[15] = "Fire",
[16] = "Ice",
[17] = "ArrowUp",
[18] = "ArrowDown",
[19] = "ExclamationMark",
[20] = "QuestionMark",
[21] = "CancelMark",
[22] = "Hazard",
[23] = "BrownSkull",
[24] = "BloodDrop",
}

local creatureIconAction = TalkAction("/playericon")

function creatureIconAction.onSay(player, words, param)
if param == "" then
player:sendCancelMessage("Usage: /playericon {icon_id}, {quantity}, {direction (optional: up/down)}")
return true
end

local split = param:split(",")
local iconId = tonumber(split[1] and split[1]:trim())
local count = tonumber(split[2] and split[2]:trim()) or 0
local direction = (split[3] and split[3]:trim():lower()) or "down"

local maxIconId = 0
for id in pairs(creatureIconQuests) do
if id > maxIconId then
maxIconId = id
end
end

if not iconId or not creatureIconQuests[iconId] then
iconId = maxIconId
player:sendTextMessage(MESSAGE_EVENT_ADVANCE, "Invalid icon ID. Using maximum valid ID: " .. iconId .. " (" .. creatureIconQuests[iconId] .. ")")
end

if count <= 0 then
player:sendCancelMessage("Invalid quantity. It must be greater than 0.")
return true
end

if direction ~= "up" and direction ~= "down" then
player:sendCancelMessage("Invalid direction. Use 'up' or 'down'.")
return true
end

local iconName = creatureIconQuests[iconId]
local key = "player-test-icon"
local category = CreatureIconCategory_Quests

player:sendTextMessage(MESSAGE_EVENT_ADVANCE, string.format("Applied icon '%s' in %s mode with quantity: %d", iconName, direction, count))

local function updateIcon(current, target, step)
if not player or not player:isPlayer() then
return
end

player:setIcon(key, category, iconId, current)

if (step > 0 and current < target) or (step < 0 and current > target) then
addEvent(function()
updateIcon(current + step, target, step)
end, 1000)
else
player:sendTextMessage(MESSAGE_EVENT_ADVANCE, "Icon countdown ended. Removing in 10 seconds...")
addEvent(function()
if player and player:isPlayer() then
player:setIcon(key, category, 0, 0)
player:sendTextMessage(MESSAGE_EVENT_ADVANCE, "Icon removed.")
end
end, 10000)
end
end

if direction == "down" then
updateIcon(count, 0, -1)
else
updateIcon(0, count, 1)
end

return true
end

creatureIconAction:separator(" ")
creatureIconAction:setDescription("[Usage]: /playericon {icon_id}, {quantity}, {direction (up/down)}")
creatureIconAction:groupType("god")
creatureIconAction:register()