mirror of
https://github.com/ErikasKontenis/SabrehavenServer.git
synced 2025-04-30 17:49:20 +02:00
41 lines
1.2 KiB
Lua
41 lines
1.2 KiB
Lua
function canJoin(player)
|
|
return player:getVocation():getId() ~= VOCATION_NONE or player:getAccountType() >= ACCOUNT_TYPE_SENIORTUTOR
|
|
end
|
|
|
|
local CHANNEL_TRADE = 6
|
|
|
|
local muted = Condition(CONDITION_CHANNELMUTEDTICKS, CONDITIONID_DEFAULT)
|
|
muted:setParameter(CONDITION_PARAM_SUBID, CHANNEL_TRADE)
|
|
muted:setParameter(CONDITION_PARAM_TICKS, 120000)
|
|
|
|
function onSpeak(player, type, message)
|
|
if player:getAccountType() >= ACCOUNT_TYPE_GAMEMASTER then
|
|
if type == TALKTYPE_CHANNEL_Y then
|
|
return TALKTYPE_CHANNEL_O
|
|
end
|
|
return true
|
|
end
|
|
|
|
if player:getLevel() == 1 then
|
|
player:sendCancelMessage("You may not speak into channels as long as you are on level 1.")
|
|
return false
|
|
end
|
|
|
|
if player:getCondition(CONDITION_CHANNELMUTEDTICKS, CONDITIONID_DEFAULT, CHANNEL_TRADE) then
|
|
player:sendCancelMessage("You may only place one offer in two minutes.")
|
|
return false
|
|
end
|
|
player:addCondition(muted)
|
|
|
|
if type == TALKTYPE_CHANNEL_O then
|
|
if player:getAccountType() < ACCOUNT_TYPE_GAMEMASTER then
|
|
type = TALKTYPE_CHANNEL_Y
|
|
end
|
|
elseif type == TALKTYPE_CHANNEL_R1 then
|
|
if not getPlayerFlagValue(player, PlayerFlag_CanTalkRedChannel) then
|
|
type = TALKTYPE_CHANNEL_Y
|
|
end
|
|
end
|
|
return type
|
|
end
|