protocol 860 fixes
This commit is contained in:
parent
e46f5fcb69
commit
23ebcd9048
10
TODO
10
TODO
|
@ -44,10 +44,12 @@
|
|||
[bart] review and make more error prone with more warnings
|
||||
[bart] a real working border and background property in otui
|
||||
[bart] reapply anchor styles when adding new childs
|
||||
[bart] ui text selection
|
||||
|
||||
== Client modules
|
||||
[bart] modules managment interface
|
||||
[bart] console history, text selection, scrolling
|
||||
[bart] make possible to reload modules
|
||||
|
||||
== Client
|
||||
[bart] implement left panel with dragging windows
|
||||
|
@ -64,7 +66,6 @@
|
|||
[bart] draw lights using shaders
|
||||
[bart] chat with tabs
|
||||
[bart] limit FPS in options
|
||||
[baxnie] display 'You are dead.' message
|
||||
[baxnie] display exit box when exiting from game
|
||||
[baxnie] do lua game event calls from Game instead from GameProtocol
|
||||
[baxnie] classic control
|
||||
|
@ -89,3 +90,10 @@
|
|||
[baxnie] fix walk jump when cancel creature following
|
||||
[baxnie] fix creature outfit when invisible or with item appearance
|
||||
|
||||
===== KNOWN BUGS
|
||||
2x2 corpses is drawn above players
|
||||
cratures with invisible effect is not rendered correctly
|
||||
animatedtext is displayed in non visible floors
|
||||
attack while walking cancels the walk
|
||||
if a spell is used while pressing arrows keys the walk is canceled and it doesnt starts walking again
|
||||
game map text message boxes is not displayed like tibia
|
||||
|
|
|
@ -1,22 +1,27 @@
|
|||
Chat = {}
|
||||
|
||||
-- private variables
|
||||
--[[
|
||||
local SpeakTypes = {
|
||||
say = { color = },
|
||||
whisper = { color = },
|
||||
yell,
|
||||
monsterSay,
|
||||
npcToPlayer,
|
||||
cgannelYellow,
|
||||
channelWhite,
|
||||
channelRed,
|
||||
channelOrange,
|
||||
private,
|
||||
playerToNpc,
|
||||
broadcast,
|
||||
privateRed
|
||||
}
|
||||
]]--
|
||||
|
||||
local chatPanel
|
||||
local chatBuffer
|
||||
|
||||
-- private functions
|
||||
local function onCreatureSpeak(name, level, msgtype, message)
|
||||
style = 'ChatLabel'
|
||||
if name and level > 0 then
|
||||
message = name .. ' [' .. level .. ']: ' .. message
|
||||
style = 'YellowChatLabel'
|
||||
end
|
||||
|
||||
local label = createWidget(style)
|
||||
label:setText(message)
|
||||
chatBuffer:addChild(label)
|
||||
end
|
||||
|
||||
-- public functions
|
||||
function Chat.create()
|
||||
chatPanel = displayUI('chat.otui', { parent = Game.gameBottomPanel } )
|
||||
|
@ -29,6 +34,17 @@ function Chat.destroy()
|
|||
end
|
||||
|
||||
-- hooked events
|
||||
local function onCreatureSpeak(name, level, msgtype, message)
|
||||
style = 'ChatLabel'
|
||||
if name and level > 0 then
|
||||
message = name .. ' [' .. level .. ']: ' .. message
|
||||
style = 'YellowChatLabel'
|
||||
end
|
||||
|
||||
local label = createWidget(style)
|
||||
label:setText(message)
|
||||
chatBuffer:addChild(label)
|
||||
end
|
||||
|
||||
connect(Game, { onLogin = Chat.create,
|
||||
onLogout = Chat.destroy,
|
||||
|
|
|
@ -5,15 +5,15 @@ importStyle 'textmessage.otui'
|
|||
|
||||
-- private variables
|
||||
local MessageTypes = {
|
||||
warning = { color = '#F55E5E', showOnConsole = true, showOnWindow = true, windowLocation = 'CenterLabel' },
|
||||
eventAdvance = { color = '#FFFFFF', showOnConsole = true, showOnWindow = true, windowLocation = 'CenterLabel' },
|
||||
eventDefault = { color = '#FFFFFF', showOnConsole = true, showOnWindow = true, windowLocation = 'BottomLabel' },
|
||||
statusDefault = { color = '#FFFFFF', showOnConsole = true, showOnWindow = true, windowLocation = 'BottomLabel' },
|
||||
infoDesc = { color = '#00EB00', showOnConsole = true, showOnWindow = true, windowLocation = 'CenterLabel' },
|
||||
statusSmall = { color = '#FFFFFF', showOnConsole = false, showOnWindow = true, windowLocation = 'BottomLabel' },
|
||||
consoleOrange = { color = '#FE6500', showOnConsole = true, showOnWindow = false },
|
||||
consoleBlue = { color = '#9F9DFD', showOnConsole = true, showOnWindow = false },
|
||||
consoleRed = { color = '#F55E5E', showOnConsole = true, showOnWindow = false }
|
||||
warning = { color = '#F55E5E', showOnConsole = true, windowLocation = 'center' },
|
||||
eventAdvance = { color = '#FFFFFF', showOnConsole = true, windowLocation = 'center' },
|
||||
eventDefault = { color = '#FFFFFF', showOnConsole = true, windowLocation = 'bottom' },
|
||||
statusDefault = { color = '#FFFFFF', showOnConsole = true, windowLocation = 'bottom' },
|
||||
infoDescription = { color = '#00EB00', showOnConsole = true, windowLocation = 'center' },
|
||||
statusSmall = { color = '#FFFFFF', showOnConsole = false, windowLocation = 'bottom' },
|
||||
consoleOrange = { color = '#FE6500', showOnConsole = true },
|
||||
consoleBlue = { color = '#9F9DFD', showOnConsole = true },
|
||||
consoleRed = { color = '#F55E5E', showOnConsole = true }
|
||||
}
|
||||
|
||||
local bottomLabelWidget
|
||||
|
@ -23,21 +23,26 @@ local centerLabelHideEvent
|
|||
|
||||
-- private functions
|
||||
local function displayMessage(msgtype, msg, time)
|
||||
if not Game.isOnline() then return end
|
||||
|
||||
if msgtype.showOnConsole then
|
||||
-- TODO
|
||||
end
|
||||
|
||||
if msgtype.showOnWindow then
|
||||
if msgtype.windowLocation then
|
||||
local label
|
||||
if msgtype.windowLocation == 'BottomLabel' then
|
||||
local style
|
||||
if msgtype.windowLocation == 'bottom' then
|
||||
label = bottomLabelWidget
|
||||
elseif msgtype.windowLocation == 'CenterLabel' then
|
||||
style = 'BottomLabel'
|
||||
elseif msgtype.windowLocation == 'center' then
|
||||
label = centerLabelWidget
|
||||
style = 'CenterLabel'
|
||||
end
|
||||
|
||||
label:setVisible(true)
|
||||
label:setText(msg)
|
||||
label:setStyle(msgtype.windowLocation)
|
||||
label:setStyle(style)
|
||||
label:setForegroundColor(msgtype.color)
|
||||
|
||||
if not time then
|
||||
|
@ -66,11 +71,9 @@ end
|
|||
|
||||
function TextMessage.display(msgtypedesc, msg)
|
||||
local msgtype = MessageTypes[msgtypedesc]
|
||||
if msgtype == nil then
|
||||
error('unknown text msg type ' .. msgtype)
|
||||
return
|
||||
if msgtype then
|
||||
displayMessage(msgtype, msg)
|
||||
end
|
||||
displayMessage(msgtype, msg)
|
||||
end
|
||||
|
||||
-- hooked events
|
||||
|
|
|
@ -105,7 +105,7 @@ void Game::processDeath()
|
|||
|
||||
void Game::processCreatureSpeak(const std::string& name, int level, const std::string& type, const std::string& message, int channelId, const Position& creaturePos)
|
||||
{
|
||||
if(creaturePos.isValid()) {
|
||||
if(creaturePos.isValid() && (type == "say" || type == "whisper" || type == "yell" || type == "monsterSay" || type == "monsterYell")) {
|
||||
StaticTextPtr staticText = StaticTextPtr(new StaticText);
|
||||
staticText->addMessage(name, type, message);
|
||||
g_map.addThing(staticText, creaturePos);
|
||||
|
|
|
@ -228,7 +228,13 @@ namespace Proto {
|
|||
SpeakPrivateRed,
|
||||
SpeakChannelOrange,
|
||||
SpeakMonsterSay,
|
||||
SpeakMonsterYell
|
||||
SpeakMonsterYell,
|
||||
|
||||
// removed
|
||||
SpeakRVRChannel = 255,
|
||||
SpeakRVRAnswer,
|
||||
SpeakRVRContinue,
|
||||
SpeakChannelRed2
|
||||
#elif PROTOCOL==860
|
||||
SpeakSay = 1,
|
||||
SpeakWhisper,
|
||||
|
@ -238,17 +244,15 @@ namespace Proto {
|
|||
SpeakPrivate,
|
||||
SpeakChannelYellow,
|
||||
SpeakChannelWhite,
|
||||
SpeakReportChannel,
|
||||
SpeakReportAnswer,
|
||||
SpeakReportContinue,
|
||||
SpeakRVRChannel,
|
||||
SpeakRVRAnswer,
|
||||
SpeakRVRContinue,
|
||||
SpeakBroadcast,
|
||||
SpeakChannelRed,
|
||||
SpeakPrivateRed,
|
||||
SpeakChannelOrange,
|
||||
SpeakUnk1,
|
||||
SpeakUnk2,
|
||||
SpeakUnk3,
|
||||
SpeakMonsterSay,
|
||||
SpeakChannelRed2 = 17,
|
||||
SpeakMonsterSay = 19,
|
||||
SpeakMonsterYell
|
||||
#endif
|
||||
};
|
||||
|
@ -256,18 +260,18 @@ namespace Proto {
|
|||
enum MessageTypes {
|
||||
#if PROTOCOL==860
|
||||
MessageConsoleRed = 18,
|
||||
MessageConsoleOrange1,
|
||||
MessageConsoleOrange2,
|
||||
MessageEventOrange,
|
||||
MessageConsoleOrange,
|
||||
MessageWarning,
|
||||
MessageEventAdvance,
|
||||
MessageEventDefault,
|
||||
MessageStatusDefault,
|
||||
MessageInfoDescription,
|
||||
MessageInfoDescription ,
|
||||
MessageStatusSmall,
|
||||
MessageConsoleBlue
|
||||
#elif PROTOCOL==862
|
||||
MessageConsoleOrange1 = 12,
|
||||
MessageConsoleOrange2,
|
||||
MessageEventOrange = 12,
|
||||
MessageConsoleOrange,
|
||||
MessageWarning,
|
||||
MessageEventAdvance,
|
||||
MessageEventDefault,
|
||||
|
@ -302,12 +306,12 @@ namespace Proto {
|
|||
return "monsterYell";
|
||||
case Proto::SpeakPrivateNpcToPlayer:
|
||||
return "npcToPlayer";
|
||||
break;
|
||||
case Proto::SpeakChannelYellow:
|
||||
return "channelYellow";
|
||||
case Proto::SpeakChannelWhite:
|
||||
return "channelWhite";
|
||||
case Proto::SpeakChannelRed:
|
||||
case Proto::SpeakChannelRed2:
|
||||
return "channelRed";
|
||||
case Proto::SpeakChannelOrange:
|
||||
return "channelOrange";
|
||||
|
@ -320,18 +324,17 @@ namespace Proto {
|
|||
case Proto::SpeakPrivateRed:
|
||||
return "privateRed";
|
||||
default:
|
||||
logError("unknown protocol speak type ", type);
|
||||
return "unknown";
|
||||
}
|
||||
}
|
||||
|
||||
inline std::string translateMessageType(int type) {
|
||||
inline std::string translateTextMessageType(int type) {
|
||||
switch(type) {
|
||||
case Proto::MessageConsoleRed:
|
||||
return "consoleRed";
|
||||
case Proto::MessageConsoleOrange1:
|
||||
return "consoleOrange";
|
||||
case Proto::MessageConsoleOrange2:
|
||||
case Proto::MessageConsoleOrange:
|
||||
return "consoleOrange";
|
||||
case Proto::MessageEventOrange:
|
||||
return "eventOrange";
|
||||
case Proto::MessageWarning:
|
||||
return "warning";
|
||||
case Proto::MessageEventAdvance:
|
||||
|
@ -346,7 +349,10 @@ namespace Proto {
|
|||
return "statusSmall";
|
||||
case Proto::MessageConsoleBlue:
|
||||
return "consoleBlue";
|
||||
case Proto::MessageConsoleRed:
|
||||
return "consoleRed";
|
||||
default:
|
||||
logError("unknown protocol text message type ", type);
|
||||
return "unknown";
|
||||
}
|
||||
}
|
||||
|
|
|
@ -755,9 +755,7 @@ void ProtocolGame::parseCreatureSpeak(InputMessage& msg)
|
|||
case Proto::SpeakChannelYellow:
|
||||
case Proto::SpeakChannelWhite:
|
||||
case Proto::SpeakChannelRed:
|
||||
#if PROTOCOL==860
|
||||
case Proto::SpeakUnk2:
|
||||
#endif
|
||||
case Proto::SpeakChannelRed2:
|
||||
case Proto::SpeakChannelOrange:
|
||||
channelId = msg.getU16();
|
||||
break;
|
||||
|
@ -766,11 +764,9 @@ void ProtocolGame::parseCreatureSpeak(InputMessage& msg)
|
|||
case Proto::SpeakBroadcast:
|
||||
case Proto::SpeakPrivateRed:
|
||||
break;
|
||||
#if PROTOCOL==860
|
||||
case Proto::SpeakReportChannel:
|
||||
case Proto::SpeakRVRChannel:
|
||||
msg.getU32();
|
||||
break;
|
||||
#endif
|
||||
default:
|
||||
logTraceError("unknown speak type ", type);
|
||||
break;
|
||||
|
@ -834,7 +830,7 @@ void ProtocolGame::parseTextMessage(InputMessage& msg)
|
|||
{
|
||||
uint8 type = msg.getU8();
|
||||
|
||||
std::string typeDesc = Proto::translateMessageType(type);
|
||||
std::string typeDesc = Proto::translateTextMessageType(type);
|
||||
std::string message = msg.getString();
|
||||
|
||||
g_dispatcher.addEvent(std::bind(&Game::processTextMessage, &g_game, typeDesc, message));
|
||||
|
|
|
@ -96,7 +96,6 @@ bool UIMap::onMousePress(const Point& mousePos, Fw::MouseButton button)
|
|||
EffectPtr effect = EffectPtr(new Effect);
|
||||
static int id = 0;
|
||||
effect->setId(id++);
|
||||
dump << id;
|
||||
g_map.addThing(effect, tilePos);
|
||||
}
|
||||
else if(button == Fw::MouseRightButton) {
|
||||
|
|
Loading…
Reference in New Issue