mirror of
https://github.com/ErikasKontenis/SabrehavenServer.git
synced 2025-10-14 22:54:53 +02:00
Full Distribution
This commit is contained in:
40
data/chatchannels/scripts/trade.lua
Normal file
40
data/chatchannels/scripts/trade.lua
Normal file
@@ -0,0 +1,40 @@
|
||||
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
|
Reference in New Issue
Block a user