Implement rule violations, closes #218

This commit is contained in:
Eduardo Bart 2013-01-27 07:44:15 -02:00
parent 6c59124cb2
commit 9aca1644e6
15 changed files with 282 additions and 38 deletions

View File

@ -47,7 +47,8 @@ g_modules.ensureModuleLoaded("game_interface")
-- mods 1000-9999 -- mods 1000-9999
g_modules.autoLoadModules(9999) g_modules.autoLoadModules(9999)
if g_resources.fileExists("/otclientrc") then local script = '/' .. g_app.getCompactName() .. 'rc'
dofile("/otclientrc") if g_resources.fileExists(script) then
dofile(script)
end end

View File

@ -13,7 +13,12 @@ end
function reloadScripts() function reloadScripts()
g_textures.clearTexturesCache() g_textures.clearTexturesCache()
g_modules.reloadModules() g_modules.reloadModules()
dofile('/' .. g_app.getCompactName() .. 'rc')
local script = '/' .. g_app.getCompactName() .. 'rc'
if g_resources.fileExists(script) then
dofile(script)
end
local message = tr('All modules and scripts were reloaded.') local message = tr('All modules and scripts were reloaded.')
modules.game_textmessage.displayGameMessage(message) modules.game_textmessage.displayGameMessage(message)

View File

@ -15,6 +15,9 @@ SpeakTypesSettings = {
channelOrange = { speakType = MessageModes.ChannelHighlight, color = '#FE6500' }, channelOrange = { speakType = MessageModes.ChannelHighlight, color = '#FE6500' },
monsterSay = { speakType = MessageModes.MonsterSay, color = '#FE6500', hideInConsole = true}, monsterSay = { speakType = MessageModes.MonsterSay, color = '#FE6500', hideInConsole = true},
monsterYell = { speakType = MessageModes.MonsterYell, color = '#FE6500', hideInConsole = true}, monsterYell = { speakType = MessageModes.MonsterYell, color = '#FE6500', hideInConsole = true},
rvrAnswerFrom = { speakType = MessageModes.RVRAnswer, color = '#FE6500' },
rvrAnswerTo = { speakType = MessageModes.RVRAnswer, color = '#FE6500' },
rvrContinue = { speakType = MessageModes.RVRContinue, color = '#FFFF00' },
} }
SpeakTypes = { SpeakTypes = {
@ -32,6 +35,9 @@ SpeakTypes = {
[MessageModes.ChannelHighlight] = SpeakTypesSettings.channelOrange, [MessageModes.ChannelHighlight] = SpeakTypesSettings.channelOrange,
[MessageModes.MonsterSay] = SpeakTypesSettings.monsterSay, [MessageModes.MonsterSay] = SpeakTypesSettings.monsterSay,
[MessageModes.MonsterYell] = SpeakTypesSettings.monsterYell, [MessageModes.MonsterYell] = SpeakTypesSettings.monsterYell,
[MessageModes.RVRChannel] = SpeakTypesSettings.channelWhite,
[MessageModes.RVRContinue] = SpeakTypesSettings.rvrContinue,
[MessageModes.RVRAnswer] = SpeakTypesSettings.rvrAnswerFrom,
-- ignored types -- ignored types
[MessageModes.Spell] = SpeakTypesSettings.none, [MessageModes.Spell] = SpeakTypesSettings.none,
@ -62,6 +68,9 @@ currentMessageIndex = 0
ignoreNpcMessages = false ignoreNpcMessages = false
defaultTab = nil defaultTab = nil
serverTab = nil serverTab = nil
violationsChannelId = nil
violationWindow = nil
violationReportTab = nil
local ignoreSettings = { local ignoreSettings = {
privateMessages = false, privateMessages = false,
@ -76,8 +85,12 @@ function init()
onOpenPrivateChannel = onOpenPrivateChannel, onOpenPrivateChannel = onOpenPrivateChannel,
onOpenOwnPrivateChannel = onOpenOwnPrivateChannel, onOpenOwnPrivateChannel = onOpenOwnPrivateChannel,
onCloseChannel = onCloseChannel, onCloseChannel = onCloseChannel,
onGameStart = onGameStart, onRuleViolationChannel = onRuleViolationChannel,
onGameEnd = clear }) onRuleViolationRemove = onRuleViolationRemove,
onRuleViolationCancel = onRuleViolationCancel,
onRuleViolationLock = onRuleViolationLock,
onGameStart = online,
onGameEnd = offline })
consolePanel = g_ui.loadUI('console', modules.game_interface.getBottomPanel()) consolePanel = g_ui.loadUI('console', modules.game_interface.getBottomPanel())
consoleTextEdit = consolePanel:getChildById('consoleTextEdit') consoleTextEdit = consolePanel:getChildById('consoleTextEdit')
@ -134,8 +147,12 @@ function terminate()
onOpenPrivateChannel = onOpenPrivateChannel, onOpenPrivateChannel = onOpenPrivateChannel,
onOpenOwnPrivateChannel = onOpenPrivateChannel, onOpenOwnPrivateChannel = onOpenPrivateChannel,
onCloseChannel = onCloseChannel, onCloseChannel = onCloseChannel,
onGameStart = onGameStart, onRuleViolationChannel = onRuleViolationChannel,
onGameEnd = clear }) onRuleViolationRemove = onRuleViolationRemove,
onRuleViolationCancel = onRuleViolationCancel,
onRuleViolationLock = onRuleViolationLock,
onGameStart = online,
onGameEnd = offline })
if g_game.isOnline() then clear() end if g_game.isOnline() then clear() end
@ -155,6 +172,11 @@ function terminate()
ignoreWindow = nil ignoreWindow = nil
end end
if violationWindow then
violationWindow:destroy()
violationWindow = nil
end
consolePanel:destroy() consolePanel:destroy()
consolePanel = nil consolePanel = nil
consoleTextEdit = nil consoleTextEdit = nil
@ -208,8 +230,18 @@ function clear()
consoleTabBar:removeTab(npcTab) consoleTabBar:removeTab(npcTab)
end end
if violationReportTab then
consoleTabBar:removeTab(violationReportTab)
violationReportTab = nil
end
consoleTextEdit:clearText() consoleTextEdit:clearText()
if violationWindow then
violationWindow:destroy()
violationWindow = nil
end
if channelsWindow then if channelsWindow then
channelsWindow:destroy() channelsWindow:destroy()
channelsWindow = nil channelsWindow = nil
@ -234,6 +266,24 @@ function openHelp()
g_game.joinChannel(helpChannel) g_game.joinChannel(helpChannel)
end end
function openPlayerReportRuleViolationWindow()
if violationWindow or violationReportTab then return end
violationWindow = g_ui.loadUI('violationwindow', rootWidget)
violationWindow.onEscape = function()
violationWindow:destroy()
violationWindow = nil
end
violationWindow.onEnter = function()
local text = violationWindow:getChildById('text'):getText()
g_game.talkChannel(MessageModes.RVRChannel, 0, text)
violationReportTab = addTab(tr('Report Rule') .. '...', true)
addTabText(tr('Please wait patiently for a gamemaster to reply') .. '.', SpeakTypesSettings.privateRed, violationReportTab)
violationReportTab.locked = true
violationWindow:destroy()
violationWindow = nil
end
end
function addTab(name, focus) function addTab(name, focus)
local tab = getTab(name) local tab = getTab(name)
if tab then -- is channel already open if tab then -- is channel already open
@ -249,12 +299,20 @@ function addTab(name, focus)
return tab return tab
end end
function removeTab(name) function removeTab(tab)
local tab = consoleTabBar:getTab(name) if type(tab) == 'string' then
tab = consoleTabBar:getTab(name)
end
if tab == defaultTab or tab == serverTab then return end if tab == defaultTab or tab == serverTab then return end
if tab == violationReportTab then
g_game.cancelRuleViolation()
violationReportTab = nil
elseif tab.violationChatName then
g_game.closeRuleViolation(tab.violationChatName)
-- notificate the server that we are leaving the channel -- notificate the server that we are leaving the channel
if tab.channelId then elseif tab.channelId then
for k, v in pairs(channels) do for k, v in pairs(channels) do
if (k == tab.channelId) then channels[k] = nil end if (k == tab.channelId) then channels[k] = nil end
end end
@ -268,25 +326,28 @@ end
function removeCurrentTab() function removeCurrentTab()
local tab = consoleTabBar:getCurrentTab() local tab = consoleTabBar:getCurrentTab()
if tab == defaultTab or tab == serverTab then return end removeTab(tab)
-- notificate the server that we are leaving the channel
if tab.channelId then
for k, v in pairs(channels) do
if (k == tab.channelId) then channels[k] = nil end
end
g_game.leaveChannel(tab.channelId)
elseif tab:getText() == "NPCs" then
g_game.closeNpcChannel()
end
consoleTabBar:removeTab(tab)
end end
function getTab(name) function getTab(name)
return consoleTabBar:getTab(name) return consoleTabBar:getTab(name)
end end
function getChannelTab(channelId)
local channel = channels[channelId]
if channel then
return getTab(channel)
end
return nil
end
function getRuleViolationsTab()
if violationsChannelId then
return getChannelTab(violationsChannelId)
end
return nil
end
function getCurrentTab() function getCurrentTab()
return consoleTabBar:getCurrentTab() return consoleTabBar:getCurrentTab()
end end
@ -365,6 +426,8 @@ function getHighlightedText(text)
end end
function addTabText(text, speaktype, tab, creatureName) function addTabText(text, speaktype, tab, creatureName)
if not tab or tab.locked or not text or #text == 0 then return end
if modules.client_options.getOption('showTimestampsInConsole') then if modules.client_options.getOption('showTimestampsInConsole') then
text = os.date('%H:%M') .. ' ' .. text text = os.date('%H:%M') .. ' ' .. text
end end
@ -432,8 +495,11 @@ function addTabText(text, speaktype, tab, creatureName)
labelHighlight:setText("") labelHighlight:setText("")
end end
label.onMouseRelease = function (self, mousePos, mouseButton) label.name = creatureName
processMessageMenu(mousePos, mouseButton, creatureName, text, self) if creatureName and #creatureName > 0 then
label.onMouseRelease = function (self, mousePos, mouseButton)
processMessageMenu(mousePos, mouseButton, creatureName, text, self, tab)
end
end end
if consoleBuffer:getChildCount() > MAX_LINES then if consoleBuffer:getChildCount() > MAX_LINES then
@ -445,6 +511,16 @@ function addTabText(text, speaktype, tab, creatureName)
end end
end end
function removeTabLabelByName(tab, name)
local panel = consoleTabBar:getTabPanel(tab)
local consoleBuffer = panel:getChildById('consoleBuffer')
for _,label in pairs(consoleBuffer:getChildren()) do
if label.name == name then
label:destroy()
end
end
end
function processChannelTabMenu(tab, mousePos, mouseButton) function processChannelTabMenu(tab, mousePos, mouseButton)
local menu = g_ui.createWidget('PopupMenu') local menu = g_ui.createWidget('PopupMenu')
@ -460,7 +536,7 @@ function processChannelTabMenu(tab, mousePos, mouseButton)
menu:display(mousePos) menu:display(mousePos)
end end
function processMessageMenu(mousePos, mouseButton, creatureName, text, label) function processMessageMenu(mousePos, mouseButton, creatureName, text, label, tab)
if mouseButton == MouseRightButton then if mouseButton == MouseRightButton then
local menu = g_ui.createWidget('PopupMenu') local menu = g_ui.createWidget('PopupMenu')
if creatureName then if creatureName then
@ -493,6 +569,11 @@ function processMessageMenu(mousePos, mouseButton, creatureName, text, label)
end end
menu:addOption(tr('Copy message'), function() g_window.setClipboardText(text) end) menu:addOption(tr('Copy message'), function() g_window.setClipboardText(text) end)
menu:addOption(tr('Select all'), function() label:selectAll() end) menu:addOption(tr('Select all'), function() label:selectAll() end)
if tab.violations then
menu:addSeparator()
menu:addOption(tr('Process') .. ' ' .. creatureName, function() processViolation(creatureName, text) end)
menu:addOption(tr('Remove') .. ' ' .. creatureName, function() g_game.closeRuleViolation(creatureName) end)
end
menu:display(mousePos) menu:display(mousePos)
end end
end end
@ -509,6 +590,8 @@ end
function sendMessage(message, tab) function sendMessage(message, tab)
local tab = tab or getCurrentTab() local tab = tab or getCurrentTab()
if tab == getRuleViolationsTab() then return end
-- handling chat commands -- handling chat commands
local originalMessage = message local originalMessage = message
local chatCommandSayMode local chatCommandSayMode
@ -567,12 +650,21 @@ function sendMessage(message, tab)
return return
else else
local isPrivateCommand = false local isPrivateCommand = false
local priv = true
local tabname = name
if chatCommandPrivateReady then if chatCommandPrivateReady then
speaktypedesc = 'privatePlayerToPlayer' speaktypedesc = 'privatePlayerToPlayer'
name = chatCommandPrivate name = chatCommandPrivate
isPrivateCommand = true isPrivateCommand = true
elseif tab.npcChat then elseif tab.npcChat then
speaktypedesc = 'privatePlayerToNpc' speaktypedesc = 'privatePlayerToNpc'
elseif tab == violationReportTab then
speaktypedesc = 'rvrContinue'
tabname = tr('Report Rule') .. '...'
elseif tab.violationChatName then
speaktypedesc = 'rvrAnswerTo'
name = tab.violationChatName
tabname = tab.violationChatName .. '\'...'
else else
speaktypedesc = 'privatePlayerToPlayer' speaktypedesc = 'privatePlayerToPlayer'
end end
@ -583,7 +675,7 @@ function sendMessage(message, tab)
g_game.talkPrivate(speaktype.speakType, name, message) g_game.talkPrivate(speaktype.speakType, name, message)
message = applyMessagePrefixies(player:getName(), player:getLevel(), message) message = applyMessagePrefixies(player:getName(), player:getLevel(), message)
addPrivateText(message, speaktype, name, isPrivateCommand, g_game.getCharacterName()) addPrivateText(message, speaktype, tabname, isPrivateCommand, g_game.getCharacterName())
end end
end end
@ -641,6 +733,12 @@ function onTalk(name, level, mode, message, channelId, creaturePos)
if ignoreNpcMessages and mode == MessageModes.NpcFrom then return end if ignoreNpcMessages and mode == MessageModes.NpcFrom then return end
speaktype = SpeakTypes[mode] speaktype = SpeakTypes[mode]
if not speaktype then
perror('unhandled onTalk message mode ' .. mode .. ': ' .. message)
return
end
if name ~= g_game.getLocalPlayer():getName() then if name ~= g_game.getLocalPlayer():getName() then
if mode == MessageModes.Yell and isIgnoringYelling() then if mode == MessageModes.Yell and isIgnoringYelling() then
return return
@ -651,6 +749,10 @@ function onTalk(name, level, mode, message, channelId, creaturePos)
end end
end end
if mode == MessageModes.RVRChannel then
channelId = violationsChannelId
end
if (mode == MessageModes.Say or mode == MessageModes.Whisper or mode == MessageModes.Yell or if (mode == MessageModes.Say or mode == MessageModes.Whisper or mode == MessageModes.Yell or
mode == MessageModes.Spell or mode == MessageModes.MonsterSay or mode == MessageModes.MonsterYell or mode == MessageModes.Spell or mode == MessageModes.MonsterSay or mode == MessageModes.MonsterYell or
mode == MessageModes.NpcFrom or mode == MessageModes.BarkLow or mode == MessageModes.BarkLoud) and mode == MessageModes.NpcFrom or mode == MessageModes.BarkLow or mode == MessageModes.BarkLoud) and
@ -674,18 +776,18 @@ function onTalk(name, level, mode, message, channelId, creaturePos)
local defaultMessage = mode <= 3 and true or false local defaultMessage = mode <= 3 and true or false
if not speaktype then
perror('unhandled onTalk message mode ' .. mode .. ': ' .. message)
return
end
if speaktype == SpeakTypesSettings.none then return end if speaktype == SpeakTypesSettings.none then return end
if speaktype.hideInConsole then return end if speaktype.hideInConsole then return end
local composedMessage = applyMessagePrefixies(name, level, message) local composedMessage = applyMessagePrefixies(name, level, message)
if speaktype.private then if mode == MessageModes.RVRAnswer then
violationReportTab.locked = false
addTabText(composedMessage, speaktype, violationReportTab, name)
elseif mode == MessageModes.RVRContinue then
addText(composedMessage, speaktype, name .. '\'...', name)
elseif speaktype.private then
addPrivateText(composedMessage, speaktype, name, false, name) addPrivateText(composedMessage, speaktype, name, false, name)
if modules.client_options.getOption('showPrivateMessagesOnScreen') and speaktype ~= SpeakTypesSettings.privateNpcToPlayer then if modules.client_options.getOption('showPrivateMessagesOnScreen') and speaktype ~= SpeakTypesSettings.privateNpcToPlayer then
modules.game_textmessage.displayPrivateMessage(name .. ':\n' .. message) modules.game_textmessage.displayPrivateMessage(name .. ':\n' .. message)
@ -734,6 +836,40 @@ function onCloseChannel(channelId)
end end
end end
function processViolation(name, text)
local tabname = name .. '\'...'
local tab = addTab(tabname, true)
channels[tabname] = tabname
tab.violationChatName = name
g_game.openRuleViolation(name)
addTabText(text, SpeakTypesSettings.say, tab)
end
function onRuleViolationChannel(channelId)
violationsChannelId = channelId
local tab = addChannel(tr('Rule Violations'), channelId)
tab.violations = true
end
function onRuleViolationRemove(name)
local tab = getRuleViolationsTab()
if not tab then return end
removeTabLabelByName(tab, name)
end
function onRuleViolationCancel(name)
local tab = getTab(name .. '\'...')
if not tab then return end
addTabText(tr('%s has finished the request', name) .. '.', SpeakTypesSettings.privateRed, tab)
tab.locked = true
end
function onRuleViolationLock()
if not violationReportTab then return end
addTabText(tr('Your request has been closed') .. '.', SpeakTypesSettings.privateRed, violationReportTab)
violationReportTab.locked = true
end
function doChannelListSubmit() function doChannelListSubmit()
local channelListPanel = channelsWindow:getChildById('channelList') local channelListPanel = channelsWindow:getChildById('channelList')
local openPrivateChannelWith = channelsWindow:getChildById('openPrivateChannelWith'):getText() local openPrivateChannelWith = channelsWindow:getChildById('openPrivateChannelWith'):getText()
@ -884,7 +1020,10 @@ function onClickIgnoreButton()
end end
end end
function onGameStart() function online()
if g_game.getProtocolVersion() < 862 then
g_keyboard.bindKeyDown('Ctrl+R', openPlayerReportRuleViolationWindow)
end
-- open last channels -- open last channels
local lastChannelsOpen = g_settings.getNode('lastChannelsOpen') local lastChannelsOpen = g_settings.getNode('lastChannelsOpen')
if lastChannelsOpen then if lastChannelsOpen then
@ -913,3 +1052,9 @@ function onGameStart()
end end
end end
function offline()
if g_game.getProtocolVersion() < 862 then
g_keyboard.unbindKeyDown('Ctrl+R')
end
clear()
end

View File

@ -8,6 +8,8 @@ ConsoleLabel < UITextEdit
selection-color: #111416 selection-color: #111416
selection-background-color: #999999 selection-background-color: #999999
change-cursor-image: false change-cursor-image: false
cursor-visible: false
editable: false
ConsolePhantomLabel < UILabel ConsolePhantomLabel < UILabel
font: verdana-11px-antialised font: verdana-11px-antialised

View File

@ -22,10 +22,10 @@ Module
- game_npctrade - game_npctrade
- game_textwindow - game_textwindow
- game_playertrade - game_playertrade
- game_ruleviolation
- game_bugreport - game_bugreport
- game_playerdeath - game_playerdeath
- game_playermount - game_playermount
- game_ruleviolation
- game_market - game_market
- game_spelllist - game_spelllist
- game_cooldown - game_cooldown

View File

@ -56,6 +56,11 @@ function init()
end end
function terminate() function terminate()
g_keyboard.unbindKeyPress('Alt+Left')
g_keyboard.unbindKeyPress('Alt+Right')
g_keyboard.unbindKeyPress('Alt+Up')
g_keyboard.unbindKeyPress('Alt+Down')
disconnect(g_game, { disconnect(g_game, {
onGameStart = online, onGameStart = online,
onGameEnd = offline, onGameEnd = offline,

View File

@ -22,6 +22,7 @@ capacityLabel = nil
tradeButton = nil tradeButton = nil
buyTab = nil buyTab = nil
sellTab = nil sellTab = nil
initialized = false
showWeight = true showWeight = true
buyWithBackpack = nil buyWithBackpack = nil
@ -82,9 +83,12 @@ function init()
connect(LocalPlayer, { onFreeCapacityChange = onFreeCapacityChange, connect(LocalPlayer, { onFreeCapacityChange = onFreeCapacityChange,
onInventoryChange = onInventoryChange } ) onInventoryChange = onInventoryChange } )
initialized = true
end end
function terminate() function terminate()
initialized = false
npcWindow:destroy() npcWindow:destroy()
disconnect(g_game, { onGameEnd = hide, disconnect(g_game, { onGameEnd = hide,
@ -352,7 +356,7 @@ function refreshTradeItems()
end end
function refreshPlayerGoods() function refreshPlayerGoods()
if not g_game.isOnline() then return end if not initialized then return end
moneyLabel:setText(playerMoney .. ' ' .. CURRENCY) moneyLabel:setText(playerMoney .. ' ' .. CURRENCY)
capacityLabel:setText(string.format('%.2f', playerFreeCapacity) .. ' ' .. WEIGHT_UNIT) capacityLabel:setText(string.format('%.2f', playerFreeCapacity) .. ' ' .. WEIGHT_UNIT)

View File

@ -1,9 +1,28 @@
function init() function init()
g_keyboard.bindKeyDown('Ctrl+R', toggleMount, gameRootPanel) connect(g_game, {
onGameStart = online,
onGameEnd = offline
})
if g_game.isOnline() then online() end
end end
function terminate() function terminate()
g_keyboard.unbindKeyDown('Ctrl+R', gameRootPanel) disconnect(g_game, {
onGameStart = online,
onGameEnd = offline
})
end
function online()
if g_game.getFeature(GamePlayerMounts) then
g_keyboard.bindKeyDown('Ctrl+R', toggleMount)
end
end
function offline()
if g_game.getFeature(GamePlayerMounts) then
g_keyboard.unbindKeyDown('Ctrl+R')
end
end end
function toggleMount() function toggleMount()

View File

@ -1156,6 +1156,27 @@ void Game::editList(uint id, int doorId, const std::string& text)
m_protocolGame->sendEditList(id, doorId, text); m_protocolGame->sendEditList(id, doorId, text);
} }
void Game::openRuleViolation(const std::string& reporter)
{
if(!canPerformGameAction())
return;
m_protocolGame->sendOpenRuleViolation(reporter);
}
void Game::closeRuleViolation(const std::string& reporter)
{
if(!canPerformGameAction())
return;
m_protocolGame->sendCloseRuleViolation(reporter);
}
void Game::cancelRuleViolation()
{
if(!canPerformGameAction())
return;
m_protocolGame->sendCancelRuleViolation();
}
void Game::reportBug(const std::string& comment) void Game::reportBug(const std::string& comment)
{ {
if(!canPerformGameAction()) if(!canPerformGameAction())

View File

@ -225,6 +225,11 @@ public:
void editText(uint id, const std::string& text); void editText(uint id, const std::string& text);
void editList(uint id, int doorId, const std::string& text); void editList(uint id, int doorId, const std::string& text);
// rule violations (only gms)
void openRuleViolation(const std::string& reporter);
void closeRuleViolation(const std::string& reporter);
void cancelRuleViolation();
// reports // reports
void reportBug(const std::string& comment); void reportBug(const std::string& comment);
void reportRuleViolation(const std::string& target, int reason, int action, const std::string& comment, const std::string& statement, int statementId, bool ipBanishment); void reportRuleViolation(const std::string& target, int reason, int action, const std::string& comment, const std::string& statement, int statementId, bool ipBanishment);

View File

@ -196,6 +196,9 @@ void Client::registerLuaFunctions()
g_lua.bindSingletonFunction("g_game", "inspectTrade", &Game::inspectTrade, &g_game); g_lua.bindSingletonFunction("g_game", "inspectTrade", &Game::inspectTrade, &g_game);
g_lua.bindSingletonFunction("g_game", "acceptTrade", &Game::acceptTrade, &g_game); g_lua.bindSingletonFunction("g_game", "acceptTrade", &Game::acceptTrade, &g_game);
g_lua.bindSingletonFunction("g_game", "rejectTrade", &Game::rejectTrade, &g_game); g_lua.bindSingletonFunction("g_game", "rejectTrade", &Game::rejectTrade, &g_game);
g_lua.bindSingletonFunction("g_game", "openRuleViolation", &Game::openRuleViolation, &g_game);
g_lua.bindSingletonFunction("g_game", "closeRuleViolation", &Game::closeRuleViolation, &g_game);
g_lua.bindSingletonFunction("g_game", "cancelRuleViolation", &Game::cancelRuleViolation, &g_game);
g_lua.bindSingletonFunction("g_game", "reportBug", &Game::reportBug, &g_game); g_lua.bindSingletonFunction("g_game", "reportBug", &Game::reportBug, &g_game);
g_lua.bindSingletonFunction("g_game", "reportRuleViolation", &Game::reportRuleViolation, &g_game); g_lua.bindSingletonFunction("g_game", "reportRuleViolation", &Game::reportRuleViolation, &g_game);
g_lua.bindSingletonFunction("g_game", "debugReport", &Game::debugReport, &g_game); g_lua.bindSingletonFunction("g_game", "debugReport", &Game::debugReport, &g_game);

View File

@ -204,6 +204,9 @@ namespace Proto {
ClientJoinChannel = 152, ClientJoinChannel = 152,
ClientLeaveChannel = 153, ClientLeaveChannel = 153,
ClientOpenPrivateChannel = 154, ClientOpenPrivateChannel = 154,
ClientOpenRuleViolation = 155,
ClientCloseRuleViolation = 156,
ClientCancelRuleViolation = 157,
ClientCloseNpcChannel = 158, ClientCloseNpcChannel = 158,
ClientChangeFightModes = 160, ClientChangeFightModes = 160,
ClientAttack = 161, ClientAttack = 161,

View File

@ -79,6 +79,9 @@ public:
void sendJoinChannel(int channelId); void sendJoinChannel(int channelId);
void sendLeaveChannel(int channelId); void sendLeaveChannel(int channelId);
void sendOpenPrivateChannel(const std::string& receiver); void sendOpenPrivateChannel(const std::string& receiver);
void sendOpenRuleViolation(const std::string& reporter);
void sendCloseRuleViolation(const std::string& reporter);
void sendCancelRuleViolation();
void sendCloseNpcChannel(); void sendCloseNpcChannel();
void sendChangeFightModes(Otc::FightModes fightMode, Otc::ChaseModes chaseMode, bool safeFight); void sendChangeFightModes(Otc::FightModes fightMode, Otc::ChaseModes chaseMode, bool safeFight);
void sendAttack(uint creatureId, uint seq); void sendAttack(uint creatureId, uint seq);

View File

@ -1123,6 +1123,8 @@ void ProtocolGame::parseTalk(const InputMessagePtr& msg)
case Otc::MessagePrivateFrom: case Otc::MessagePrivateFrom:
case Otc::MessageGamemasterBroadcast: case Otc::MessageGamemasterBroadcast:
case Otc::MessageGamemasterPrivateFrom: case Otc::MessageGamemasterPrivateFrom:
case Otc::MessageRVRAnswer:
case Otc::MessageRVRContinue:
break; break;
case Otc::MessageRVRChannel: case Otc::MessageRVRChannel:
msg->getU32(); msg->getU32();

View File

@ -502,6 +502,7 @@ void ProtocolGame::sendTalk(Otc::MessageMode mode, int channelId, const std::str
switch(mode) { switch(mode) {
case Otc::MessagePrivateTo: case Otc::MessagePrivateTo:
case Otc::MessageGamemasterPrivateTo: case Otc::MessageGamemasterPrivateTo:
case Otc::MessageRVRAnswer:
msg->addString(receiver); msg->addString(receiver);
break; break;
case Otc::MessageChannel: case Otc::MessageChannel:
@ -549,6 +550,31 @@ void ProtocolGame::sendOpenPrivateChannel(const std::string& receiver)
send(msg); send(msg);
} }
void ProtocolGame::sendOpenRuleViolation(const std::string& reporter)
{
OutputMessagePtr msg(new OutputMessage);
msg->addU8(Proto::ClientOpenRuleViolation);
msg->addString(reporter);
send(msg);
}
void ProtocolGame::sendCloseRuleViolation(const std::string& reporter)
{
OutputMessagePtr msg(new OutputMessage);
msg->addU8(Proto::ClientCloseRuleViolation);
msg->addString(reporter);
dump << "ProtocolGame::sendCloseRuleViolation" << reporter;
send(msg);
}
void ProtocolGame::sendCancelRuleViolation()
{
OutputMessagePtr msg(new OutputMessage);
msg->addU8(Proto::ClientCancelRuleViolation);
dump << "ProtocolGame::sendCancelRuleViolation";
send(msg);
}
void ProtocolGame::sendCloseNpcChannel() void ProtocolGame::sendCloseNpcChannel()
{ {
OutputMessagePtr msg(new OutputMessage); OutputMessagePtr msg(new OutputMessage);