mirror of
https://github.com/ErikasKontenis/SabrehavenServer.git
synced 2025-10-14 14:44:55 +02:00
Full Distribution
This commit is contained in:
22
data/chatchannels/scripts/englishchat.lua
Normal file
22
data/chatchannels/scripts/englishchat.lua
Normal file
@@ -0,0 +1,22 @@
|
||||
function onSpeak(player, type, message)
|
||||
local playerAccountType = player:getAccountType()
|
||||
if player:getLevel() == 1 and playerAccountType < ACCOUNT_TYPE_GAMEMASTER then
|
||||
player:sendCancelMessage("You may not speak into channels as long as you are on level 1.")
|
||||
return false
|
||||
end
|
||||
|
||||
if type == TALKTYPE_CHANNEL_Y then
|
||||
if playerAccountType >= ACCOUNT_TYPE_GAMEMASTER then
|
||||
type = TALKTYPE_CHANNEL_O
|
||||
end
|
||||
elseif type == TALKTYPE_CHANNEL_O then
|
||||
if playerAccountType < ACCOUNT_TYPE_GAMEMASTER then
|
||||
type = TALKTYPE_CHANNEL_Y
|
||||
end
|
||||
elseif type == TALKTYPE_CHANNEL_R1 then
|
||||
if playerAccountType < ACCOUNT_TYPE_GAMEMASTER and not getPlayerFlagValue(player, PlayerFlag_CanTalkRedChannel) then
|
||||
type = TALKTYPE_CHANNEL_Y
|
||||
end
|
||||
end
|
||||
return type
|
||||
end
|
21
data/chatchannels/scripts/gamemaster.lua
Normal file
21
data/chatchannels/scripts/gamemaster.lua
Normal file
@@ -0,0 +1,21 @@
|
||||
function canJoin(player)
|
||||
return player:getAccountType() >= ACCOUNT_TYPE_GAMEMASTER
|
||||
end
|
||||
|
||||
function onSpeak(player, type, message)
|
||||
local playerAccountType = player:getAccountType()
|
||||
if type == TALKTYPE_CHANNEL_Y then
|
||||
if playerAccountType == ACCOUNT_TYPE_GOD then
|
||||
type = TALKTYPE_CHANNEL_O
|
||||
end
|
||||
elseif type == TALKTYPE_CHANNEL_O then
|
||||
if playerAccountType ~= ACCOUNT_TYPE_GOD then
|
||||
type = TALKTYPE_CHANNEL_Y
|
||||
end
|
||||
elseif type == TALKTYPE_CHANNEL_R1 then
|
||||
if playerAccountType ~= ACCOUNT_TYPE_GOD and not getPlayerFlagValue(player, PlayerFlag_CanTalkRedChannel) then
|
||||
type = TALKTYPE_CHANNEL_Y
|
||||
end
|
||||
end
|
||||
return type
|
||||
end
|
77
data/chatchannels/scripts/help.lua
Normal file
77
data/chatchannels/scripts/help.lua
Normal file
@@ -0,0 +1,77 @@
|
||||
local CHANNEL_HELP = 7
|
||||
|
||||
local muted = Condition(CONDITION_CHANNELMUTEDTICKS, CONDITIONID_DEFAULT)
|
||||
muted:setParameter(CONDITION_PARAM_SUBID, CHANNEL_HELP)
|
||||
muted:setParameter(CONDITION_PARAM_TICKS, 3600000)
|
||||
|
||||
function onSpeak(player, type, message)
|
||||
local playerAccountType = player:getAccountType()
|
||||
if player:getLevel() == 1 and playerAccountType == ACCOUNT_TYPE_NORMAL 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_HELP) then
|
||||
player:sendCancelMessage("You are muted from the Help channel for using it inappropriately.")
|
||||
return false
|
||||
end
|
||||
|
||||
if playerAccountType >= ACCOUNT_TYPE_TUTOR then
|
||||
if string.sub(message, 1, 6) == "!mute " then
|
||||
local targetName = string.sub(message, 7)
|
||||
local target = Player(targetName)
|
||||
if target ~= nil then
|
||||
if playerAccountType > target:getAccountType() then
|
||||
if not target:getCondition(CONDITION_CHANNELMUTEDTICKS, CONDITIONID_DEFAULT, CHANNEL_HELP) then
|
||||
target:addCondition(muted)
|
||||
sendChannelMessage(CHANNEL_HELP, TALKTYPE_CHANNEL_R1, target:getName() .. " has been muted by " .. player:getName() .. " for using Help Channel inappropriately.")
|
||||
else
|
||||
player:sendCancelMessage("That player is already muted.")
|
||||
end
|
||||
else
|
||||
player:sendCancelMessage("You are not authorized to mute that player.")
|
||||
end
|
||||
else
|
||||
player:sendCancelMessage(RETURNVALUE_PLAYERWITHTHISNAMEISNOTONLINE)
|
||||
end
|
||||
return false
|
||||
elseif string.sub(message, 1, 8) == "!unmute " then
|
||||
local targetName = string.sub(message, 9)
|
||||
local target = Player(targetName)
|
||||
if target ~= nil then
|
||||
if playerAccountType > target:getAccountType() then
|
||||
if target:getCondition(CONDITION_CHANNELMUTEDTICKS, CONDITIONID_DEFAULT, CHANNEL_HELP) then
|
||||
target:removeCondition(CONDITION_CHANNELMUTEDTICKS, CONDITIONID_DEFAULT, CHANNEL_HELP)
|
||||
sendChannelMessage(CHANNEL_HELP, TALKTYPE_CHANNEL_R1, target:getName() .. " has been unmuted by " .. player:getName() .. ".")
|
||||
else
|
||||
player:sendCancelMessage("That player is not muted.")
|
||||
end
|
||||
else
|
||||
player:sendCancelMessage("You are not authorized to unmute that player.")
|
||||
end
|
||||
else
|
||||
player:sendCancelMessage(RETURNVALUE_PLAYERWITHTHISNAMEISNOTONLINE)
|
||||
end
|
||||
return false
|
||||
end
|
||||
end
|
||||
|
||||
if type == TALKTYPE_CHANNEL_Y then
|
||||
if playerAccountType >= ACCOUNT_TYPE_TUTOR or getPlayerFlagValue(player, PlayerFlag_TalkOrangeHelpChannel) then
|
||||
type = TALKTYPE_CHANNEL_O
|
||||
end
|
||||
elseif type == TALKTYPE_CHANNEL_O then
|
||||
if playerAccountType < ACCOUNT_TYPE_TUTOR and not getPlayerFlagValue(player, PlayerFlag_TalkOrangeHelpChannel) then
|
||||
type = TALKTYPE_CHANNEL_Y
|
||||
end
|
||||
elseif type == TALKTYPE_CHANNEL_R1 then
|
||||
if playerAccountType < ACCOUNT_TYPE_GAMEMASTER and not getPlayerFlagValue(player, PlayerFlag_CanTalkRedChannel) then
|
||||
if playerAccountType >= ACCOUNT_TYPE_TUTOR or getPlayerFlagValue(player, PlayerFlag_TalkOrangeHelpChannel) then
|
||||
type = TALKTYPE_CHANNEL_O
|
||||
else
|
||||
type = TALKTYPE_CHANNEL_Y
|
||||
end
|
||||
end
|
||||
end
|
||||
return type
|
||||
end
|
3
data/chatchannels/scripts/ruleviolations.lua
Normal file
3
data/chatchannels/scripts/ruleviolations.lua
Normal file
@@ -0,0 +1,3 @@
|
||||
function canJoin(player)
|
||||
return player:getAccountType() >= ACCOUNT_TYPE_GAMEMASTER
|
||||
end
|
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
|
21
data/chatchannels/scripts/tutor.lua
Normal file
21
data/chatchannels/scripts/tutor.lua
Normal file
@@ -0,0 +1,21 @@
|
||||
function canJoin(player)
|
||||
return player:getAccountType() >= ACCOUNT_TYPE_TUTOR
|
||||
end
|
||||
|
||||
function onSpeak(player, type, message)
|
||||
local playerAccountType = player:getAccountType()
|
||||
if type == TALKTYPE_CHANNEL_Y then
|
||||
if playerAccountType >= ACCOUNT_TYPE_SENIORTUTOR then
|
||||
type = TALKTYPE_CHANNEL_O
|
||||
end
|
||||
elseif type == TALKTYPE_CHANNEL_O then
|
||||
if playerAccountType < ACCOUNT_TYPE_SENIORTUTOR then
|
||||
type = TALKTYPE_CHANNEL_Y
|
||||
end
|
||||
elseif type == TALKTYPE_CHANNEL_R1 then
|
||||
if playerAccountType < ACCOUNT_TYPE_GAMEMASTER and not getPlayerFlagValue(player, PlayerFlag_CanTalkRedChannel) then
|
||||
type = TALKTYPE_CHANNEL_Y
|
||||
end
|
||||
end
|
||||
return type
|
||||
end
|
22
data/chatchannels/scripts/worldchat.lua
Normal file
22
data/chatchannels/scripts/worldchat.lua
Normal file
@@ -0,0 +1,22 @@
|
||||
function onSpeak(player, type, message)
|
||||
local playerAccountType = player:getAccountType()
|
||||
if player:getLevel() == 1 and playerAccountType < ACCOUNT_TYPE_GAMEMASTER then
|
||||
player:sendCancelMessage("You may not speak into channels as long as you are on level 1.")
|
||||
return false
|
||||
end
|
||||
|
||||
if type == TALKTYPE_CHANNEL_Y then
|
||||
if playerAccountType >= ACCOUNT_TYPE_GAMEMASTER then
|
||||
type = TALKTYPE_CHANNEL_O
|
||||
end
|
||||
elseif type == TALKTYPE_CHANNEL_O then
|
||||
if playerAccountType < ACCOUNT_TYPE_GAMEMASTER then
|
||||
type = TALKTYPE_CHANNEL_Y
|
||||
end
|
||||
elseif type == TALKTYPE_CHANNEL_R1 then
|
||||
if playerAccountType < ACCOUNT_TYPE_GAMEMASTER and not getPlayerFlagValue(player, PlayerFlag_CanTalkRedChannel) then
|
||||
type = TALKTYPE_CHANNEL_Y
|
||||
end
|
||||
end
|
||||
return type
|
||||
end
|
Reference in New Issue
Block a user