forked from opentibiabr/canary
-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
badge & title system: improvements and created talkactions to manager…
… title e badges. summary: wip. friend system: wip.
- Loading branch information
1 parent
f45c7f1
commit 5bb5d38
Showing
16 changed files
with
505 additions
and
338 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
local addBadge = TalkAction("/addbadge") | ||
|
||
function addBadge.onSay(player, words, param) | ||
-- create log | ||
logCommand(player, words, param) | ||
|
||
if param == "" then | ||
player:sendCancelMessage("Command param required.") | ||
return true | ||
end | ||
|
||
local split = param:split(",") | ||
if not split[2] then | ||
player:sendCancelMessage("Insufficient parameters. Usage: /addbadge playerName, badgeID") | ||
return true | ||
end | ||
|
||
local target = Player(split[1]) | ||
if not target then | ||
player:sendCancelMessage("A player with that name is not online.") | ||
return true | ||
end | ||
|
||
-- Trim left | ||
split[2] = split[2]:gsub("^%s*(.-)$", "%1") | ||
local id = tonumber(split[2]) | ||
target:addBadge(id) | ||
return true | ||
end | ||
|
||
addBadge:separator(" ") | ||
addBadge:groupType("god") | ||
addBadge:register() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,68 @@ | ||
local addTitle = TalkAction("/addtitle") | ||
|
||
function addTitle.onSay(player, words, param) | ||
-- create log | ||
logCommand(player, words, param) | ||
|
||
if param == "" then | ||
player:sendCancelMessage("Command param required.") | ||
return true | ||
end | ||
|
||
local split = param:split(",") | ||
if not split[2] then | ||
player:sendCancelMessage("Insufficient parameters. Usage: /addtitle playerName, badgeID") | ||
return true | ||
end | ||
|
||
local target = Player(split[1]) | ||
if not target then | ||
player:sendCancelMessage("A player with that name is not online.") | ||
return true | ||
end | ||
|
||
-- Trim left | ||
split[2] = split[2]:gsub("^%s*(.-)$", "%1") | ||
local id = tonumber(split[2]) | ||
target:addTitle(id) | ||
return true | ||
end | ||
|
||
addTitle:separator(" ") | ||
addTitle:groupType("god") | ||
addTitle:register() | ||
|
||
----------------------------------------- | ||
local setTitle = TalkAction("/settitle") | ||
|
||
function setTitle.onSay(player, words, param) | ||
-- create log | ||
logCommand(player, words, param) | ||
|
||
if param == "" then | ||
player:sendCancelMessage("Command param required.") | ||
return true | ||
end | ||
|
||
local split = param:split(",") | ||
if not split[2] then | ||
player:sendCancelMessage("Insufficient parameters. Usage: /settitle playerName, badgeID") | ||
return true | ||
end | ||
|
||
local target = Player(split[1]) | ||
if not target then | ||
player:sendCancelMessage("A player with that name is not online.") | ||
return true | ||
end | ||
|
||
-- Trim left | ||
split[2] = split[2]:gsub("^%s*(.-)$", "%1") | ||
local id = tonumber(split[2]) | ||
target:setCurrentTitle(id) | ||
return true | ||
end | ||
|
||
setTitle:separator(" ") | ||
setTitle:groupType("god") | ||
setTitle:register() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.