Skip to content

Commit 7d560c5

Browse files
authored
enhancement: add ability to give minor charms to players as god (#3622)
1 parent 301e1cd commit 7d560c5

1 file changed

Lines changed: 37 additions & 0 deletions

File tree

data/scripts/talkactions/god/charms.lua

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,43 @@ addCharm:groupType("god")
3333
addCharm:register()
3434

3535
---------------- // ----------------
36+
37+
local addMinorCharm = TalkAction("/addminorcharms")
38+
39+
function addMinorCharm.onSay(player, words, param)
40+
-- create log
41+
logCommand(player, words, param)
42+
43+
local usage = "/addminorcharms PLAYER NAME,AMOUNT"
44+
if param == "" then
45+
player:sendCancelMessage("Command param required. Usage: " .. usage)
46+
return true
47+
end
48+
local split = param:split(",")
49+
if not split[2] then
50+
player:sendCancelMessage("Insufficient parameters. Usage: " .. usage)
51+
return true
52+
end
53+
local target = Player(split[1])
54+
if not target then
55+
player:sendCancelMessage("A player with that name is not online.")
56+
return true
57+
end
58+
59+
split[2] = split[2]:trimSpace()
60+
61+
player:sendCancelMessage("Added " .. split[2] .. " minor charm points to character '" .. target:getName() .. "'.")
62+
target:sendCancelMessage("Received " .. split[2] .. " minor charm points!")
63+
target:addMinorCharmEchoes(tonumber(split[2]))
64+
target:getPosition():sendMagicEffect(CONST_ME_HOLYAREA)
65+
end
66+
67+
addMinorCharm:separator(" ")
68+
addMinorCharm:groupType("god")
69+
addMinorCharm:register()
70+
71+
---------------- // ----------------
72+
3673
local resetCharm = TalkAction("/resetcharms")
3774

3875
function resetCharm.onSay(player, words, param)

0 commit comments

Comments
 (0)