-
Notifications
You must be signed in to change notification settings - Fork 11
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
5 changed files
with
125 additions
and
0 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,31 @@ | ||
local backpack = TalkAction("!bp") | ||
|
||
local itemConfig = { | ||
price = 20, | ||
itemId = 2854 | ||
} | ||
|
||
function backpack.onSay(player, words, param) | ||
local exhaustGroup = "talkactions" | ||
local exhaustTime = 2 | ||
|
||
if player:getExhaustion(exhaustGroup) > 0 then | ||
player:sendCancelMessage("You are exhausted. Please wait before using this command again.") | ||
return true | ||
end | ||
|
||
if player:removeMoneyBank(itemConfig.price) then | ||
player:getPosition():sendMagicEffect(CONST_ME_MAGIC_BLUE) | ||
player:addItem(itemConfig.itemId, 1) | ||
player:sendTextMessage(MESSAGE_LOOK, "You have bought a backpack!") | ||
player:setExhaustion(exhaustGroup, exhaustTime) | ||
else | ||
player:getPosition():sendMagicEffect(CONST_ME_POFF) | ||
player:sendCancelMessage("You do not have enough money.") | ||
end | ||
|
||
return true | ||
end | ||
|
||
backpack:groupType("normal") | ||
backpack: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,21 @@ | ||
local food = TalkAction("!food") | ||
|
||
local config = { | ||
price = 1000, | ||
itemId = 3731, | ||
quantity = 100 | ||
} | ||
|
||
function food.onSay(player, words, param) | ||
if player:removeMoneyBank(config.price) then | ||
player:getPosition():sendMagicEffect(CONST_ME_MAGIC_BLUE) | ||
player:addItem(config.itemId, config.quantity) | ||
player:sendTextMessage(MESSAGE_LOOK, string.format("You bought %d food for %d gold!", config.quantity, config.price)) | ||
else | ||
player:getPosition():sendMagicEffect(CONST_ME_POFF) | ||
player:sendCancelMessage(string.format("You need at least %d gold coins.", config.price)) | ||
end | ||
end | ||
|
||
food:groupType("normal") | ||
food: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,30 @@ | ||
local frags = TalkAction("!frags") | ||
|
||
function frags.onSay(player, words, param) | ||
local fragTime = configManager.getNumber(configKeys.FRAG_TIME) | ||
local skullTime = player:getSkullTime() | ||
local fragsList = player:getKills() | ||
local totalFrags = 0 | ||
|
||
for fragIndex, fragTable in pairs(fragsList) do | ||
for subKey, subValue in pairs(fragTable) do | ||
if subKey == 1 then | ||
local resultName = | ||
db.storeQuery("SELECT `name` FROM `players` WHERE `id` = " .. db.escapeString(subValue)) | ||
local name = Result.getString(resultName, "name") | ||
totalFrags = totalFrags + 1 | ||
elseif subKey == 2 then | ||
local formattedDate = os.date("%d %b %Y, %H:%M:%S", subValue) | ||
elseif subKey == 3 then | ||
else | ||
end | ||
end | ||
end | ||
|
||
player:sendTextMessage(MESSAGE_LOOK, "You have " .. totalFrags .. " unjustified kills.") | ||
return false | ||
end | ||
|
||
frags:separator(" ") | ||
frags:groupType("normal") | ||
frags: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,26 @@ | ||
local promotion = TalkAction("!promotion") | ||
|
||
local config = { | ||
requiredLevel = 20, | ||
cost = 20000 | ||
} | ||
|
||
function promotion.onSay(player, words, param) | ||
local promotion = player:getVocation():getPromotion() | ||
if player:isPromoted() then | ||
player:sendCancelMessage("You are already promoted!") | ||
player:getPosition():sendMagicEffect(CONST_ME_POFF) | ||
elseif player:getLevel() < config.requiredLevel then | ||
player:sendCancelMessage("Sorry, you need level " .. config.requiredLevel .. " to be promoted.") | ||
player:getPosition():sendMagicEffect(CONST_ME_POFF) | ||
elseif not player:removeMoneyBank(config.cost) then | ||
player:sendCancelMessage(string.format("You need at least %d gold coins to have a promotion.", config.price)) | ||
player:getPosition():sendMagicEffect(CONST_ME_POFF) | ||
else | ||
player:sendTextMessage(MESSAGE_LOOK, "You received a promotion!") | ||
player:setVocation(promotion) | ||
player:getPosition():sendMagicEffect(CONST_ME_HOLYDAMAGE) | ||
end | ||
end | ||
promotion:groupType("normal") | ||
promotion: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,17 @@ | ||
local shared = TalkAction("!shared") | ||
|
||
function shared.onSay(player, words, param) | ||
if player then | ||
local text = '-- Party Info -- \n\n' | ||
text = text .. '-----------\n' | ||
text = text .. 'Min Level: ' .. math.ceil((player:getLevel() * 2) / 3) .. ' \n' | ||
text = text .. 'Max Level: ' .. math.ceil((player:getLevel() * player:getLevel()) / ((player:getLevel() * 2) / 3)) .. ' \n' | ||
text = text .. '-----------\n' | ||
player:showTextDialog(34266, text) | ||
player:getPosition():sendMagicEffect(CONST_ME_MAGIC_BLUE) | ||
end | ||
return false | ||
end | ||
|
||
shared:groupType("normal") | ||
shared:register() |