missing files

* add questlog icon
* add playertrade otui
* some protocol changes for extended messages
This commit is contained in:
Eduardo Bart 2012-05-01 21:41:42 -03:00
parent 0fbd196c55
commit 02c5e7b8ff
10 changed files with 83 additions and 19 deletions

View File

@ -1,3 +1,6 @@
class UIWidget
end
class g_game class g_game
def self.login() end def self.login() end
def self.logout() end def self.logout() end

View File

@ -0,0 +1,38 @@
TradeWindow < MiniWindow
!text: tr('Trade')
height: 150
UIItem
id: tradeItem
virtual: true
item-id: 3253
size: 32 32
anchors.top: parent.top
anchors.left: parent.left
margin-top: -6
margin-left: -6
MiniWindowContents
padding: 6
FlatPanel
id: ownTradeContainer
anchors.fill: parent
anchors.right: parent.horizontalCenter
margin-right: 2
layout:
type: grid
cell-size: 40 40
flow: true
cell-spacing: 0
FlatPanel
id: counterTradeContainer
anchors.fill: parent
anchors.left: parent.horizontalCenter
margin-left: 2
layout:
type: grid
cell-size: 40 40
flow: true
cell-spacing: 0

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.0 KiB

View File

@ -65,21 +65,20 @@ void OutputMessage::addU64(uint64 value)
m_messageSize += 8; m_messageSize += 8;
} }
void OutputMessage::addString(const char* value) void OutputMessage::addString(const char* value, int length)
{ {
size_t stringLength = strlen(value); if(length > 65535)
if(stringLength > 65535)
throw NetworkException("[OutputMessage::addString] string length > 65535"); throw NetworkException("[OutputMessage::addString] string length > 65535");
checkWrite(stringLength + 2); checkWrite(length + 2);
addU16(stringLength); addU16(length);
strcpy((char*)(m_buffer + m_writePos), value); memcpy((char*)(m_buffer + m_writePos), value, length);
m_writePos += stringLength; m_writePos += length;
m_messageSize += stringLength; m_messageSize += length;
} }
void OutputMessage::addString(const std::string& value) void OutputMessage::addString(const std::string& value)
{ {
addString(value.c_str()); addString(value.c_str(), value.length());
} }
void OutputMessage::addPaddingBytes(int bytes, uint8 byte) void OutputMessage::addPaddingBytes(int bytes, uint8 byte)

View File

@ -49,7 +49,7 @@ public:
void addU16(uint16 value); void addU16(uint16 value);
void addU32(uint32 value); void addU32(uint32 value);
void addU64(uint64 value); void addU64(uint64 value);
void addString(const char* value); void addString(const char* value, int length);
void addString(const std::string& value); void addString(const std::string& value);
void addPaddingBytes(int bytes, uint8 byte = 0); void addPaddingBytes(int bytes, uint8 byte = 0);

View File

@ -145,7 +145,8 @@ namespace Proto {
GameServerQuestLine = 241, GameServerQuestLine = 241,
GameServerChannelEvent = 243, GameServerChannelEvent = 243,
GameServerObjectInfo = 244, GameServerObjectInfo = 244,
GameServerPlayerInventory = 245 GameServerPlayerInventory = 245,
GameServerExtendedOpcode = 254 // otclient only
}; };
enum ClientOpts { enum ClientOpts {
@ -221,6 +222,7 @@ namespace Proto {
ClientRequestQuestLine = 241, ClientRequestQuestLine = 241,
//ClientRuleViolationReport = 242, //ClientRuleViolationReport = 242,
//ClientGetObjectInfo = 243 //ClientGetObjectInfo = 243
ClientExtendedOpcode = 254 // otclient only
}; };
enum ServerSpeakType { enum ServerSpeakType {

View File

@ -103,6 +103,7 @@ public:
void sendDebugReport(const std::string& a, const std::string& b, const std::string& c, const std::string& d); void sendDebugReport(const std::string& a, const std::string& b, const std::string& c, const std::string& d);
void sendRequestQuestLog(); void sendRequestQuestLog();
void sendRequestQuestLine(int questId); void sendRequestQuestLine(int questId);
void sendExtendedOpcode(uint8 opcode, const std::string& buffer);
private: private:
void sendLoginPacket(uint timestamp, uint8 unknown); void sendLoginPacket(uint timestamp, uint8 unknown);
@ -183,6 +184,7 @@ private:
void parseAutomapFlag(InputMessage& msg); void parseAutomapFlag(InputMessage& msg);
void parseQuestLog(InputMessage& msg); void parseQuestLog(InputMessage& msg);
void parseQuestLine(InputMessage& msg); void parseQuestLine(InputMessage& msg);
void parseExtendedOpcode(InputMessage& msg);
void setMapDescription(InputMessage& msg, int x, int y, int z, int width, int height); void setMapDescription(InputMessage& msg, int x, int y, int z, int width, int height);
void setFloorDescription(InputMessage& msg, int x, int y, int z, int width, int height, int offset, int* skipTiles); void setFloorDescription(InputMessage& msg, int x, int y, int z, int width, int height, int offset, int* skipTiles);

View File

@ -37,9 +37,9 @@ void ProtocolGame::parseMessage(InputMessage& msg)
{ {
try { try {
while(!msg.eof()) { while(!msg.eof()) {
int opt = msg.getU8(); int opcode = msg.getU8();
switch(opt) { switch(opcode) {
case Proto::GameServerInitGame: case Proto::GameServerInitGame:
parseInitGame(msg); parseInitGame(msg);
break; break;
@ -264,8 +264,11 @@ void ProtocolGame::parseMessage(InputMessage& msg)
//case Proto::GameServerChannelEvent: //case Proto::GameServerChannelEvent:
//case Proto::GameServerObjectInfo: //case Proto::GameServerObjectInfo:
//case Proto::GameServerPlayerInventory: //case Proto::GameServerPlayerInventory:
case Proto::GameServerExtendedOpcode: // additional opcode used by otclient
parseExtendedOpcode(msg);
break;
default: default:
Fw::throwException("unknown opt byte ", (int)opt); Fw::throwException("unknown opcode ", opcode);
break; break;
} }
} }
@ -1079,6 +1082,14 @@ void ProtocolGame::parseQuestLine(InputMessage& msg)
g_game.processQuestLine(questId, questMissions); g_game.processQuestLine(questId, questMissions);
} }
void ProtocolGame::parseExtendedOpcode(InputMessage& msg)
{
int opcode = msg.getU8();
std::string buffer = msg.getString();
callLuaField("onExtendedOpcode", opcode, buffer);
}
void ProtocolGame::setMapDescription(InputMessage& msg, int32 x, int32 y, int32 z, int32 width, int32 height) void ProtocolGame::setMapDescription(InputMessage& msg, int32 x, int32 y, int32 z, int32 width, int32 height)
{ {
int startz, endz, zstep, skip = 0; int startz, endz, zstep, skip = 0;

View File

@ -649,6 +649,15 @@ void ProtocolGame::sendRequestQuestLine(int questId)
send(msg); send(msg);
} }
void ProtocolGame::sendExtendedOpcode(uint8 opcode, const std::string& buffer)
{
OutputMessage msg;
msg.addU8(Proto::ClientExtendedOpcode);
msg.addU8(opcode);
msg.addString(buffer);
send(msg);
}
void ProtocolGame::addPosition(OutputMessage& msg, const Position& position) void ProtocolGame::addPosition(OutputMessage& msg, const Position& position)
{ {
msg.addU16(position.x); msg.addU16(position.x);

View File

@ -55,8 +55,8 @@ void ProtocolLogin::onRecv(InputMessage& inputMessage)
{ {
try { try {
while(!inputMessage.eof()) { while(!inputMessage.eof()) {
int opt = inputMessage.getU8(); int opcode = inputMessage.getU8();
switch(opt) { switch(opcode) {
case Proto::LoginServerError: case Proto::LoginServerError:
parseError(inputMessage); parseError(inputMessage);
break; break;
@ -70,7 +70,7 @@ void ProtocolLogin::onRecv(InputMessage& inputMessage)
parseCharacterList(inputMessage); parseCharacterList(inputMessage);
break; break;
default: default:
Fw::throwException("unknown opt byte ", opt); Fw::throwException("unknown opt byte ", opcode);
break; break;
} }
} }