Fix for chat commands #s #w #y

* Some progressbar changes
This commit is contained in:
Eduardo Bart 2013-02-14 16:34:33 -02:00
parent 07dd78002b
commit 62f38d678d
5 changed files with 39 additions and 15 deletions

View File

@ -38,7 +38,7 @@ CreatureButton < UICreatureButton
margin-left: 2 margin-left: 2
phantom: true phantom: true
ProgressBar LifeProgressBar
id: lifeBar id: lifeBar
height: 5 height: 5
anchors.left: spacer.right anchors.left: spacer.right

View File

@ -1,19 +1,23 @@
ProgressBar < UIProgressBar ProgressBar < UIProgressBar
height: 16 height: 16
background-color: red background-color: red
border: 1 black
image-source: /images/ui/progressbar image-source: /images/ui/progressbar
image-border: 1 image-border: 1
font: verdana-11px-rounded font: verdana-11px-rounded
text-offset: 0 2 text-offset: 0 2
on: true
$!on: $!on:
visible: false visible: false
margin-top: 0
margin-bottom: 0
height: 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 ProgressRect < UIProgressRect
anchors.fill: parent anchors.fill: parent
phantom: true phantom: true

View File

@ -4,6 +4,7 @@ UIProgressBar = extends(UIWidget)
function UIProgressBar.create() function UIProgressBar.create()
local progressbar = UIProgressBar.internalCreate() local progressbar = UIProgressBar.internalCreate()
progressbar:setFocusable(false) progressbar:setFocusable(false)
progressbar:setOn(true)
progressbar.min = 0 progressbar.min = 0
progressbar.max = 100 progressbar.max = 100
progressbar.value = 0 progressbar.value = 0

View File

@ -605,18 +605,36 @@ function sendMessage(message, tab)
end end
-- handling chat commands -- handling chat commands
local channel = tab.channelId
local originalMessage = message local originalMessage = message
local chatCommandSayMode local chatCommandSayMode
local chatCommandPrivate local chatCommandPrivate
local chatCommandPrivateReady local chatCommandPrivateReady
local chatCommandMessage
local chatCommandMessage = message:match("^%#y (.*)") -- player used yell command
if chatCommandMessage ~= nil then chatCommandSayMode = 'yell' end -- player used yell command chatCommandMessage = message:match("^%#y (.*)")
message = chatCommandMessage or message if chatCommandMessage ~= nil then
chatCommandSayMode = 'yell'
channel = 0
message = chatCommandMessage
end
-- player used whisper
local chatCommandMessage = message:match("^%#w (.*)") local chatCommandMessage = message:match("^%#w (.*)")
if chatCommandMessage ~= nil then chatCommandSayMode = 'whisper' end -- player used whisper if chatCommandMessage ~= nil then
message = chatCommandMessage or message 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("([%*%@])(.+)([%*%@])(.*)") local findIni, findEnd, chatCommandInitial, chatCommandPrivate, chatCommandEnd, chatCommandMessage = message:find("([%*%@])(.+)([%*%@])(.*)")
if findIni ~= nil and findIni == 1 then -- player used private chat command if findIni ~= nil and findIni == 1 then -- player used private chat command
@ -643,15 +661,15 @@ function sendMessage(message, tab)
end end
local speaktypedesc 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 if tab == defaultTab then
speaktypedesc = chatCommandSayMode or SayModes[consolePanel:getChildById('sayModeButton').sayMode].speakTypeDesc speaktypedesc = chatCommandSayMode or SayModes[consolePanel:getChildById('sayModeButton').sayMode].speakTypeDesc
if speaktypedesc ~= 'say' then sayModeChange(2) end -- head back to say mode if speaktypedesc ~= 'say' then sayModeChange(2) end -- head back to say mode
else else
speaktypedesc = 'channelYellow' speaktypedesc = chatCommandSayMode or 'channelYellow'
end end
g_game.talkChannel(SpeakTypesSettings[speaktypedesc].speakType, tab.channelId, message) g_game.talkChannel(SpeakTypesSettings[speaktypedesc].speakType, channel, message)
return return
else else
local isPrivateCommand = false local isPrivateCommand = false

View File

@ -4,6 +4,7 @@ HealthBar < ProgressBar
anchors.top: parent.top anchors.top: parent.top
anchors.left: parent.left anchors.left: parent.left
anchors.right: parent.right anchors.right: parent.right
margin: 1
ManaBar < ProgressBar ManaBar < ProgressBar
id: manaBar id: manaBar
@ -11,6 +12,7 @@ ManaBar < ProgressBar
anchors.top: prev.bottom anchors.top: prev.bottom
anchors.left: parent.left anchors.left: parent.left
anchors.right: parent.right anchors.right: parent.right
margin: 1
margin-top: 3 margin-top: 3
ExperienceBar < ProgressBar ExperienceBar < ProgressBar
@ -19,9 +21,8 @@ ExperienceBar < ProgressBar
anchors.top: prev.bottom anchors.top: prev.bottom
anchors.left: parent.left anchors.left: parent.left
anchors.right: parent.right anchors.right: parent.right
margin: 1
margin-top: 3 margin-top: 3
//margin-top: 6
//height: 12
SoulLabel < GameLabel SoulLabel < GameLabel
id: soulLabel id: soulLabel