canary/data/scripts/lib/proficiency_helper.lua
Eduardo Dantas f59ab0cffc
feat: protocol 15.11 (weapon proficiency and new imbuement scroll) (#3845)
Add the WeaponProficiency component with persistent per-weapon
progression, perk selection, experience tracking, and combat bonus
handling.

Implement serialization and deserialization for proficiency data, perk
management, active augments, stat bonuses, critical damage modifiers,
bestiary/boss/powerful foe bonuses, skill/spell percentage bonuses, and
perfect shot handling.

Also add related client support, imbuement scroll/tool flows, new items,
mounts, outfits, achievements, NPC shop updates, scheduled-save
notifications, and loot table adjustments.

Thanks to @phacUFPE and @FelipePaluco for the development base.

Client PR: https://github.com/dudantas/tibia-client/pull/17
---------

Co-authored-by: Felipe <87909998+FelipePaluco@users.noreply.github.com>
Co-authored-by: Pedro Cruz <pedro.ha.cruz2022@gmail.com>
Co-authored-by: Eduardo Dantas<eduardo.dantas@hotmail.com.br>
2026-05-21 14:34:39 -03:00

32 lines
804 B
Lua

function createProficiencyCatalyst(itemId, experience)
local catalyst = Action()
function catalyst.onUse(player, item, fromPosition, target, toPosition, isHotkey)
if not item or not item:isItem() then
return false
end
if not target or not target:isItem() then
return false
end
local weaponId = target:getId()
local itemType = ItemType(weaponId)
if not itemType:isWeapon() then
player:sendCancelMessage("You can only use this on weapons.")
return true
end
local success = player:addWeaponExperience(experience, weaponId)
if success then
item:remove(1)
player:getPosition():sendMagicEffect(CONST_ME_MAGIC_GREEN)
else
player:sendCancelMessage("Failed to apply proficiency experience.")
end
return true
end
catalyst:id(itemId)
catalyst:register()
end