Skip to content
Open
11 changes: 11 additions & 0 deletions data/scripts/lib/talkactions.lua
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
local logFormat = "[%s] %s %s\n"

function logCommand(player, words, param)
local file = io.open("data/logs/" .. player:getName() .. " commands.log", "a")
if not file then
return
end

file:write(logFormat:format(os.date("%d/%m/%Y %H:%M"), words, param:trim()))
file:close()
end
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
local talkaction = TalkAction("/addskill")

local function getSkillId(skillName)
if skillName == "club" then
return SKILL_CLUB
Expand All @@ -22,7 +24,7 @@ local function getSkillId(skillName)
return nil
end

function onSay(player, words, param)
function talkaction.onSay(player, words, param)
if not player:getGroup():getAccess() then
return true
end
Expand Down Expand Up @@ -57,3 +59,6 @@ function onSay(player, words, param)
target:addSkill(skillId, count)
return false
end

talkaction:separator(" ")
talkaction:register()
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
function onSay(player, words, param)
local talkaction = TalkAction("/addtutor")

function talkaction.onSay(player, words, param)
if player:getAccountType() <= ACCOUNT_TYPE_SENIORTUTOR then
return true
end
Expand All @@ -19,3 +21,6 @@ function onSay(player, words, param)
player:sendTextMessage(MESSAGE_EVENT_ADVANCE, "You have promoted " .. target:getName() .. " to a tutor.")
return false
end

talkaction:separator(" ")
talkaction:register()
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
function onSay(player, words, param)
local talkaction = TalkAction("/attr")

function talkaction.onSay(player, words, param)
if not player:getGroup():getAccess() then
return true
end
Expand Down Expand Up @@ -46,3 +48,6 @@ function onSay(player, words, param)
return false
end
end

talkaction:separator(" ")
talkaction:register()
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
function onSay(player, words, param)
local talkaction = TalkAction("/B")

function talkaction.onSay(player, words, param)
if not player:hasFlag(PlayerFlag_CanBroadcast) then
return true
end
Expand All @@ -9,3 +11,6 @@ function onSay(player, words, param)
end
return false
end

talkaction:separator(" ")
talkaction:register()
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
local talkaction = TalkAction("/chameleon")

local condition = Condition(CONDITION_OUTFIT, CONDITIONID_COMBAT)
condition:setTicks(-1)

function onSay(player, words, param)
function talkaction.onSay(player, words, param)
if not player:getGroup():getAccess() then
return true
end
Expand All @@ -23,3 +25,6 @@ function onSay(player, words, param)
player:addCondition(condition)
return false
end

talkaction:separator(" ")
talkaction:register()
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
function onSay(player, words, param)
local talkaction = TalkAction("/clean")

function talkaction.onSay(player, words, param)
if not player:getGroup():getAccess() then
return true
end
Expand All @@ -13,3 +15,5 @@ function onSay(player, words, param)
end
return false
end

talkaction:register()
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
function onSay(player, words, param)
local talkaction = TalkAction("/closeserver")

function talkaction.onSay(player, words, param)
if not player:getGroup():getAccess() then
return true
end
Expand All @@ -15,3 +17,6 @@ function onSay(player, words, param)
end
return false
end

talkaction:separator(" ")
talkaction:register()
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
local talkaction = TalkAction("/i")

local invalidIds = {1, 2, 3, 4, 5, 6, 7, 10, 11, 13, 14, 15, 19, 21, 26, 27, 28, 35, 43}
local destinations = {"inbox", "storeinbox", "tile", "house", "depot"}

Expand Down Expand Up @@ -61,7 +63,7 @@ local function sendPlayerItemInformation(player, data)
return true
end

function onSay(player, words, param)
function talkaction.onSay(player, words, param)
if not player:getGroup():getAccess() then
return true
end
Expand Down Expand Up @@ -150,3 +152,6 @@ function onSay(player, words, param)

return false
end

talkaction:separator(" ")
talkaction:register()
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
function onSay(player, words, param)
local talkaction = TalkAction("/down")

function talkaction.onSay(player, words, param)
if not player:getGroup():getAccess() then
return true
end
Expand All @@ -8,3 +10,5 @@ function onSay(player, words, param)
player:teleportTo(position)
return false
end

talkaction:register()
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
function onSay(player, words, param)
local talkaction = TalkAction("/ghost")

function talkaction.onSay(player, words, param)
if not player:getGroup():getAccess() then
return true
end
Expand All @@ -21,3 +23,5 @@ function onSay(player, words, param)
end
return false
end

talkaction:register()
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
function onSay(player, words, param)
local talkaction = TalkAction("/hide")

function talkaction.onSay(player, words, param)
if not player:getGroup():getAccess() then
return true
end
Expand All @@ -10,3 +12,5 @@ function onSay(player, words, param)
player:setHiddenHealth(not player:isHealthHidden())
return false
end

talkaction:register()
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
function onSay(player, words, param)
local talkaction = TalkAction("/info")

function talkaction.onSay(player, words, param)
if not player:getGroup():getAccess() then
return true
end
Expand Down Expand Up @@ -35,3 +37,6 @@ function onSay(player, words, param)
end
return false
end

talkaction:separator(" ")
talkaction:register()
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
function onSay(player, words, param)
local talkaction = TalkAction("/kick")

function talkaction.onSay(player, words, param)
if not player:getGroup():getAccess() then
return true
end
Expand All @@ -17,3 +19,6 @@ function onSay(player, words, param)
target:remove()
return false
end

talkaction:separator(" ")
talkaction:register()
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
local talkaction = TalkAction("/looktype")

-- keep it ordered
local invalidTypes = {
1, 135, 161, 162, 163, 164, 165, 166, 167, 168, 169, 170, 171, 172, 173,
Expand Down Expand Up @@ -28,7 +30,7 @@ local invalidTypes = {
1452, 1458, 1462
}

function onSay(player, words, param)
function talkaction.onSay(player, words, param)
if not player:getGroup():getAccess() then
return true
end
Expand All @@ -43,3 +45,6 @@ function onSay(player, words, param)
end
return false
end

talkaction:separator(" ")
talkaction:register()
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
function onSay(player, words, param)
local talkaction = TalkAction("/mccheck")

function talkaction.onSay(player, words, param)
if not player:getGroup():getAccess() then
return true
end
Expand Down Expand Up @@ -38,3 +40,5 @@ function onSay(player, words, param)
end
return false
end

talkaction:register()
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
function onSay(player, words, param)
local talkaction = TalkAction("/openserver")

function talkaction.onSay(player, words, param)
if not player:getGroup():getAccess() then
return true
end
Expand All @@ -11,3 +13,5 @@ function onSay(player, words, param)
player:sendTextMessage(MESSAGE_INFO_DESCR, "Server is now open.")
return false
end

talkaction:register()
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
function onSay(player, words, param)
local talkaction = TalkAction("/owner")

function talkaction.onSay(player, words, param)
if not player:getGroup():getAccess() then
return true
end
Expand Down Expand Up @@ -28,3 +30,6 @@ function onSay(player, words, param)
house:setOwnerGuid(targetPlayer:getGuid())
return false
end

talkaction:separator(" ")
talkaction:register()
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
function onSay(player, words, param)
local talkaction = TalkAction("/m")

function talkaction.onSay(player, words, param)
if not player:getGroup():getAccess() then
return true
end
Expand All @@ -18,3 +20,6 @@ function onSay(player, words, param)
end
return false
end

talkaction:separator(" ")
talkaction:register()
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
function onSay(player, words, param)
local talkaction = TalkAction("/s")

function talkaction.onSay(player, words, param)
if not player:getGroup():getAccess() then
return true
end
Expand All @@ -18,3 +20,6 @@ function onSay(player, words, param)
end
return false
end

talkaction:separator(" ")
talkaction:register()
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
function onSay(player, words, param)
local talkaction = TalkAction("/summon")

function talkaction.onSay(player, words, param)
if not player:getGroup():getAccess() then
return true
end
Expand All @@ -18,3 +20,6 @@ function onSay(player, words, param)
end
return false
end

talkaction:separator(" ")
talkaction:register()
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
local talkaction = TalkAction("/reload")

local reloadTypes = {
["all"] = RELOAD_TYPE_ALL,

Expand Down Expand Up @@ -53,7 +55,7 @@ local reloadTypes = {
["libs"] = RELOAD_TYPE_GLOBAL
}

function onSay(player, words, param)
function talkaction.onSay(player, words, param)
if not player:getGroup():getAccess() then
return true
end
Expand Down Expand Up @@ -85,3 +87,6 @@ function onSay(player, words, param)
player:sendTextMessage(MESSAGE_INFO_DESCR, string.format("Reloaded %s.", param:lower()))
return false
end

talkaction:separator(" ")
talkaction:register()
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
function onSay(player, words, param)
local talkaction = TalkAction("/r")

function talkaction.onSay(player, words, param)
if not player:getGroup():getAccess() then
return true
end
Expand Down Expand Up @@ -31,3 +33,6 @@ function onSay(player, words, param)
position:sendMagicEffect(CONST_ME_MAGIC_RED)
return false
end

talkaction:separator(" ")
talkaction:register()
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
function onSay(player, words, param)
local talkaction = TalkAction("/removetutor")

function talkaction.onSay(player, words, param)
if player:getAccountType() <= ACCOUNT_TYPE_SENIORTUTOR then
return true
end
Expand Down Expand Up @@ -26,3 +28,6 @@ function onSay(player, words, param)
result.free(resultId)
return false
end

talkaction:separator(" ")
talkaction:register()
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
function onSay(player, words, param)
local talkaction = TalkAction("/c")

function talkaction.onSay(player, words, param)
if not player:getGroup():getAccess() then
return true
end
Expand All @@ -22,3 +24,6 @@ function onSay(player, words, param)
end
return false
end

talkaction:separator(" ")
talkaction:register()
Loading
Loading