From 62f38d678d78943304bb2e47c0958df6a2faf1ed Mon Sep 17 00:00:00 2001 From: Eduardo Bart Date: Thu, 14 Feb 2013 16:34:33 -0200 Subject: [PATCH] Fix for chat commands #s #w #y * Some progressbar changes --- data/styles/10-creaturebuttons.otui | 2 +- data/styles/10-progressbars.otui | 12 ++++++--- modules/corelib/ui/uiprogressbar.lua | 1 + modules/game_console/console.lua | 36 ++++++++++++++++++------- modules/game_healthinfo/healthinfo.otui | 5 ++-- 5 files changed, 40 insertions(+), 16 deletions(-) diff --git a/data/styles/10-creaturebuttons.otui b/data/styles/10-creaturebuttons.otui index 9a2c9170..9e879f3b 100644 --- a/data/styles/10-creaturebuttons.otui +++ b/data/styles/10-creaturebuttons.otui @@ -38,7 +38,7 @@ CreatureButton < UICreatureButton margin-left: 2 phantom: true - ProgressBar + LifeProgressBar id: lifeBar height: 5 anchors.left: spacer.right diff --git a/data/styles/10-progressbars.otui b/data/styles/10-progressbars.otui index 8718efa9..2b36a00f 100644 --- a/data/styles/10-progressbars.otui +++ b/data/styles/10-progressbars.otui @@ -1,19 +1,23 @@ ProgressBar < UIProgressBar height: 16 background-color: red - border: 1 black image-source: /images/ui/progressbar image-border: 1 font: verdana-11px-rounded text-offset: 0 2 - on: true $!on: visible: false - margin-top: 0 - margin-bottom: 0 height: 0 +LifeProgressBar < UIProgressBar + height: 16 + background-color: green + border: 1 black + font: verdana-11px-rounded + text-offset: 0 2 + margin: 2 + ProgressRect < UIProgressRect anchors.fill: parent phantom: true diff --git a/modules/corelib/ui/uiprogressbar.lua b/modules/corelib/ui/uiprogressbar.lua index dd4d8343..6e54642e 100644 --- a/modules/corelib/ui/uiprogressbar.lua +++ b/modules/corelib/ui/uiprogressbar.lua @@ -4,6 +4,7 @@ UIProgressBar = extends(UIWidget) function UIProgressBar.create() local progressbar = UIProgressBar.internalCreate() progressbar:setFocusable(false) + progressbar:setOn(true) progressbar.min = 0 progressbar.max = 100 progressbar.value = 0 diff --git a/modules/game_console/console.lua b/modules/game_console/console.lua index 818c796c..aa304234 100644 --- a/modules/game_console/console.lua +++ b/modules/game_console/console.lua @@ -605,18 +605,36 @@ function sendMessage(message, tab) end -- handling chat commands + local channel = tab.channelId local originalMessage = message local chatCommandSayMode local chatCommandPrivate local chatCommandPrivateReady + local chatCommandMessage + + -- player used yell command + chatCommandMessage = message:match("^%#y (.*)") + if chatCommandMessage ~= nil then + chatCommandSayMode = 'yell' + channel = 0 + message = chatCommandMessage + end - local chatCommandMessage = message:match("^%#y (.*)") - if chatCommandMessage ~= nil then chatCommandSayMode = 'yell' end -- player used yell command - message = chatCommandMessage or message - + -- player used whisper local chatCommandMessage = message:match("^%#w (.*)") - if chatCommandMessage ~= nil then chatCommandSayMode = 'whisper' end -- player used whisper - message = chatCommandMessage or message + if chatCommandMessage ~= nil then + chatCommandSayMode = 'whisper' + message = chatCommandMessage + channel = 0 + end + + -- player say + local chatCommandMessage = message:match("^%#s (.*)") + if chatCommandMessage ~= nil then + chatCommandSayMode = 'say' + message = chatCommandMessage + channel = 0 + end local findIni, findEnd, chatCommandInitial, chatCommandPrivate, chatCommandEnd, chatCommandMessage = message:find("([%*%@])(.+)([%*%@])(.*)") if findIni ~= nil and findIni == 1 then -- player used private chat command @@ -643,15 +661,15 @@ function sendMessage(message, tab) end local speaktypedesc - if (tab.channelId or tab == defaultTab) and not chatCommandPrivateReady then + if (channel or tab == defaultTab) and not chatCommandPrivateReady then if tab == defaultTab then speaktypedesc = chatCommandSayMode or SayModes[consolePanel:getChildById('sayModeButton').sayMode].speakTypeDesc if speaktypedesc ~= 'say' then sayModeChange(2) end -- head back to say mode else - speaktypedesc = 'channelYellow' + speaktypedesc = chatCommandSayMode or 'channelYellow' end - g_game.talkChannel(SpeakTypesSettings[speaktypedesc].speakType, tab.channelId, message) + g_game.talkChannel(SpeakTypesSettings[speaktypedesc].speakType, channel, message) return else local isPrivateCommand = false diff --git a/modules/game_healthinfo/healthinfo.otui b/modules/game_healthinfo/healthinfo.otui index 81948319..4dc3783b 100644 --- a/modules/game_healthinfo/healthinfo.otui +++ b/modules/game_healthinfo/healthinfo.otui @@ -4,6 +4,7 @@ HealthBar < ProgressBar anchors.top: parent.top anchors.left: parent.left anchors.right: parent.right + margin: 1 ManaBar < ProgressBar id: manaBar @@ -11,6 +12,7 @@ ManaBar < ProgressBar anchors.top: prev.bottom anchors.left: parent.left anchors.right: parent.right + margin: 1 margin-top: 3 ExperienceBar < ProgressBar @@ -19,9 +21,8 @@ ExperienceBar < ProgressBar anchors.top: prev.bottom anchors.left: parent.left anchors.right: parent.right + margin: 1 margin-top: 3 - //margin-top: 6 - //height: 12 SoulLabel < GameLabel id: soulLabel