more bindings/sends for 870-953

This commit is contained in:
Eduardo Bart 2012-05-12 08:55:22 -03:00
parent fa9c942471
commit ae2a476872
7 changed files with 211 additions and 60 deletions

View File

@ -974,6 +974,20 @@ void Game::requestQuestLine(int questId)
m_protocolGame->sendRequestQuestLine(questId); m_protocolGame->sendRequestQuestLine(questId);
} }
void Game::equipItem(const ItemPtr& item)
{
if(!canPerformGameAction())
return;
m_protocolGame->sendEquipItem(item->getId(), item->getCountOrSubType());
}
void Game::mount(bool mount)
{
if(!canPerformGameAction())
return;
m_protocolGame->sendMount(mount);
}
bool Game::checkBotProtection() bool Game::checkBotProtection()
{ {
#ifdef BOT_PROTECTION #ifdef BOT_PROTECTION

View File

@ -220,6 +220,15 @@ public:
void requestQuestLog(); void requestQuestLog();
void requestQuestLine(int questId); void requestQuestLine(int questId);
// 870 only
void equipItem(const ItemPtr& item);
void mount(bool mount);
// 910 only
//void requestItemInfo();
//void reportRuleViolation2();
// TODO: market related
bool canPerformGameAction(); bool canPerformGameAction();
bool canReportBugs() { return m_canReportBugs; } bool canReportBugs() { return m_canReportBugs; }
bool checkBotProtection(); bool checkBotProtection();

View File

@ -146,6 +146,8 @@ void OTClient::registerLuaFunctions()
g_lua.bindClassStaticFunction("g_game", "editList", std::bind(&Game::editList, &g_game, std::placeholders::_1, std::placeholders::_2, std::placeholders::_3)); g_lua.bindClassStaticFunction("g_game", "editList", std::bind(&Game::editList, &g_game, std::placeholders::_1, std::placeholders::_2, std::placeholders::_3));
g_lua.bindClassStaticFunction("g_game", "requestQuestLog", std::bind(&Game::requestQuestLog, &g_game)); g_lua.bindClassStaticFunction("g_game", "requestQuestLog", std::bind(&Game::requestQuestLog, &g_game));
g_lua.bindClassStaticFunction("g_game", "requestQuestLine", std::bind(&Game::requestQuestLine, &g_game, std::placeholders::_1)); g_lua.bindClassStaticFunction("g_game", "requestQuestLine", std::bind(&Game::requestQuestLine, &g_game, std::placeholders::_1));
g_lua.bindClassStaticFunction("g_game", "equipItem", std::bind(&Game::equipItem, &g_game, std::placeholders::_1));
g_lua.bindClassStaticFunction("g_game", "mount", std::bind(&Game::mount, &g_game, std::placeholders::_1));
g_lua.bindClassStaticFunction("g_game", "canPerformGameAction", std::bind(&Game::canPerformGameAction, &g_game)); g_lua.bindClassStaticFunction("g_game", "canPerformGameAction", std::bind(&Game::canPerformGameAction, &g_game));
g_lua.bindClassStaticFunction("g_game", "canReportBugs", std::bind(&Game::canReportBugs, &g_game)); g_lua.bindClassStaticFunction("g_game", "canReportBugs", std::bind(&Game::canReportBugs, &g_game));
g_lua.bindClassStaticFunction("g_game", "checkBotProtection", std::bind(&Game::checkBotProtection, &g_game)); g_lua.bindClassStaticFunction("g_game", "checkBotProtection", std::bind(&Game::checkBotProtection, &g_game));

View File

@ -81,7 +81,7 @@ namespace Proto {
LoginServerCharacterList = 100 LoginServerCharacterList = 100
}; };
enum GameServerOpts { enum GameServerOpcodes {
GameServerInitGame = 10, GameServerInitGame = 10,
GameServerGMActions = 11, GameServerGMActions = 11,
GameServerLoginError = 20, GameServerLoginError = 20,
@ -96,6 +96,18 @@ namespace Proto {
#endif #endif
GameServerChallange = 31, GameServerChallange = 31,
GameServerDeath = 40, GameServerDeath = 40,
// all in game opcodes must be equal or greater than 50
GameServerFirstGameOpcode = 50,
// NOTE: add any custom opcodes in this range
// 50 - 97
// otclient ONLY
GameServerExtendedP2POpcode = 98,
GameServerExtendedOpcode = 99,
// original tibia ONLY
GameServerFullMap = 100, GameServerFullMap = 100,
GameServerMapTopRow = 101, GameServerMapTopRow = 101,
GameServerMapRightRow = 102, GameServerMapRightRow = 102,
@ -134,13 +146,14 @@ namespace Proto {
GameServerCreatureUnpass = 146, GameServerCreatureUnpass = 146,
GameServerEditText = 150, GameServerEditText = 150,
GameServerEditList = 151, GameServerEditList = 151,
GameServerPlayerDataBasic = 159, GameServerPlayerDataBasic = 159, // 910
GameServerPlayerData = 160, GameServerPlayerData = 160,
GameServerPlayerSkills = 161, GameServerPlayerSkills = 161,
GameServerPlayerState = 162, GameServerPlayerState = 162,
GameServerClearTarget = 163, GameServerClearTarget = 163,
GameServerSpellDelay = 164, // 870 GameServerSpellDelay = 164, // 870
GameServerSpellGroupDelay = 165, // 870 GameServerSpellGroupDelay = 165, // 870
GameServerMultiUseDelay = 166, // 870
GameServerTalk = 170, GameServerTalk = 170,
GameServerChannels = 171, GameServerChannels = 171,
GameServerOpenChannel = 172, GameServerOpenChannel = 172,
@ -153,7 +166,7 @@ namespace Proto {
GameServerCloseChannel = 179, GameServerCloseChannel = 179,
GameServerTextMessage = 180, GameServerTextMessage = 180,
GameServerCancelWalk = 181, GameServerCancelWalk = 181,
GameServerWait = 182, GameServerWalkWait = 182,
GameServerFloorChangeUp = 190, GameServerFloorChangeUp = 190,
GameServerFloorChangeDown = 191, GameServerFloorChangeDown = 191,
GameServerChooseOutfit = 200, GameServerChooseOutfit = 200,
@ -164,25 +177,33 @@ namespace Proto {
GameServerAutomapFlag = 221, GameServerAutomapFlag = 221,
GameServerQuestLog = 240, GameServerQuestLog = 240,
GameServerQuestLine = 241, GameServerQuestLine = 241,
GameServerChannelEvent = 243, GameServerChannelEvent = 243, // 910
GameServerObjectInfo = 244, // 910 GameServerItemInfo = 244, // 910
GameServerPlayerInventory = 245, // 910 GameServerPlayerInventory = 245, // 910
GameServerMarketEnter = 246, // 944 GameServerMarketEnter = 246, // 944
GameServerMarketLeave = 247, // 944 GameServerMarketLeave = 247, // 944
GameServerMarketBrowseItem = 248, // 944 GameServerMarketDetail = 248, // 944
GameServerMarketAcceptOffer = 249, // 944 GameServerMarketBrowse = 249, // 944
GameServerMarketOwnOffers = 250, // 944
GameServerMarketCancelOffer = 251, // 944
GameServerMarketBrowseOwnHistory = 252, // 944
GameServerMarketMarketDetail = 253, // 944
GameServerExtendedOpcode = 254 // otclient only
}; };
enum ClientOpts { enum ClientOpcodes {
ClientEnterAccount = 1, ClientEnterAccount = 1,
ClientEnterGame = 10, ClientEnterGame = 10,
ClientLeaveGame = 20, ClientLeaveGame = 20,
ClientPingResponse = 30, ClientPing = 29,
ClientPingBack = 30,
// all in game opcodes must be equal or greater than 50
ClientFirstGameOpcode = 50,
// NOTE: add any custom opcodes in this range
// 50 - 97
// otclient ONLY
ClientExtendedP2POpcode = 98,
ClientExtendedOpcode = 99,
// original tibia ONLY
ClientAutoWalk = 100, ClientAutoWalk = 100,
ClientWalkNorth = 101, ClientWalkNorth = 101,
ClientWalkEast = 102, ClientWalkEast = 102,
@ -197,7 +218,7 @@ namespace Proto {
ClientTurnEast = 112, ClientTurnEast = 112,
ClientTurnSouth = 113, ClientTurnSouth = 113,
ClientTurnWest = 114, ClientTurnWest = 114,
ClientEquipObject = 119, // 910 ClientEquipItem = 119, // 910
ClientMove = 120, ClientMove = 120,
ClientInspectNpcTrade = 121, ClientInspectNpcTrade = 121,
ClientBuyItem = 122, ClientBuyItem = 122,
@ -247,14 +268,13 @@ namespace Proto {
ClientDebugReport = 232, ClientDebugReport = 232,
ClientRequestQuestLog = 240, ClientRequestQuestLog = 240,
ClientRequestQuestLine = 241, ClientRequestQuestLine = 241,
ClientRuleViolationReport = 242, // 910 ClientNewRuleViolation = 242, // 910
ClientGetObjectInfo = 243, // 910 ClientRequestItemInfo = 243, // 910
ClientMarketLeave = 244, // 944 ClientMarketLeave = 244, // 944
ClientMarketBrowse = 245, // 944 ClientMarketBrowse = 245, // 944
ClientMarketCreateOffer = 246, // 944 ClientMarketCreate = 246, // 944
ClientMarketCancelOffer = 247, // 944 ClientMarketCancel = 247, // 944
ClientMarketAcceptOffer = 248, // 944 ClientMarketAccept = 248, // 944
ClientExtendedOpcode = 254 // otclient only
}; };
enum ServerSpeakType { enum ServerSpeakType {
@ -274,7 +294,7 @@ namespace Proto {
ServerSpeakChannelRed, ServerSpeakChannelRed,
ServerSpeakPrivateRedFrom, // new ServerSpeakPrivateRedFrom, // new
ServerSpeakPrivateRedTo, // new ServerSpeakPrivateRedTo, // new
// 16 - 33 ?? // 16 - 33
ServerSpeakMonsterSay = 34, ServerSpeakMonsterSay = 34,
ServerSpeakMonsterYell, ServerSpeakMonsterYell,
@ -324,9 +344,9 @@ namespace Proto {
ServerSpeakPrivateRedTo, ServerSpeakPrivateRedTo,
ServerSpeakPrivateRedFrom = ServerSpeakPrivateRedTo, ServerSpeakPrivateRedFrom = ServerSpeakPrivateRedTo,
ServerSpeakChannelOrange, ServerSpeakChannelOrange,
// 16 ?? // 16
ServerSpeakChannelRed2 = 17, ServerSpeakChannelRed2 = 17,
// 18 ?? // 18
ServerSpeakMonsterSay = 19, ServerSpeakMonsterSay = 19,
ServerSpeakMonsterYell ServerSpeakMonsterYell
#elif PROTOCOL>=810 #elif PROTOCOL>=810
@ -344,9 +364,9 @@ namespace Proto {
ServerSpeakPrivateRedTo, ServerSpeakPrivateRedTo,
ServerSpeakPrivateRedFrom = ServerSpeakPrivateRedTo, ServerSpeakPrivateRedFrom = ServerSpeakPrivateRedTo,
ServerSpeakChannelOrange, ServerSpeakChannelOrange,
// 13 ?? // 13
ServerSpeakChannelRed2 = 14, ServerSpeakChannelRed2 = 14,
// 15 ?? // 15
ServerSpeakMonsterSay = 16, ServerSpeakMonsterSay = 16,
ServerSpeakMonsterYell, ServerSpeakMonsterYell,
@ -359,11 +379,11 @@ namespace Proto {
enum MessageTypes { enum MessageTypes {
#if PROTOCOL>=910 #if PROTOCOL>=910
// 1-3 ?? // 1-3
MessageConsoleBlue = 4, // old MessageConsoleBlue = 4, // old
// 5-11 ?? // 5-11
MessageConsoleRed = 12, // old MessageConsoleRed = 12, // old
// 13-15 ?? // 13-15
MessageStatusDefault = 16, // old MessageStatusDefault = 16, // old
MessageWarning, // old MessageWarning, // old
MessageEventAdvance, // old MessageEventAdvance, // old

View File

@ -38,7 +38,8 @@ public:
void onError(const boost::system::error_code& error); void onError(const boost::system::error_code& error);
void sendLogout(); void sendLogout();
void sendPingResponse(); void sendPing();
void sendPingBack();
void sendAutoWalk(const std::vector<Otc::Direction>& path); void sendAutoWalk(const std::vector<Otc::Direction>& path);
void sendWalkNorth(); void sendWalkNorth();
void sendWalkEast(); void sendWalkEast();
@ -53,6 +54,7 @@ public:
void sendTurnEast(); void sendTurnEast();
void sendTurnSouth(); void sendTurnSouth();
void sendTurnWest(); void sendTurnWest();
void sendEquipItem(int itemId, int countOrSubType);
void sendMove(const Position& fromPos, int itemId, int stackpos, const Position& toPos, int count); void sendMove(const Position& fromPos, int itemId, int stackpos, const Position& toPos, int count);
void sendInspectNpcTrade(int itemId, int count); void sendInspectNpcTrade(int itemId, int count);
void sendBuyItem(int itemId, int subType, int amount, bool ignoreCapacity, bool buyWithBackpack); void sendBuyItem(int itemId, int subType, int amount, bool ignoreCapacity, bool buyWithBackpack);
@ -93,6 +95,7 @@ public:
void sendRefreshContainer(); void sendRefreshContainer();
void sendRequestOutfit(); void sendRequestOutfit();
void sendChangeOutfit(const Outfit& outfit); void sendChangeOutfit(const Outfit& outfit);
void sendMount(bool mount);
void sendAddVip(const std::string& name); void sendAddVip(const std::string& name);
void sendRemoveVip(uint playerId); void sendRemoveVip(uint playerId);
void sendBugReport(const std::string& comment); void sendBugReport(const std::string& comment);
@ -100,6 +103,15 @@ 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 sendNewNewRuleViolation(int reason, int action, const std::string& characterName, const std::string& comment, const std::string& translation);
void sendRequestItemInfo(int itemId, int index);
/*
void sendMarketLeave();
void sendMarketBrowse();
void sendMarketCreate();
void sendMarketCancel();
void sendMarketAccept();
*/
void sendExtendedOpcode(uint8 opcode, const std::string& buffer); void sendExtendedOpcode(uint8 opcode, const std::string& buffer);
private: private:
@ -114,6 +126,7 @@ private:
void parseLoginAdvice(InputMessage& msg); void parseLoginAdvice(InputMessage& msg);
void parseLoginWait(InputMessage& msg); void parseLoginWait(InputMessage& msg);
void parsePing(InputMessage& msg); void parsePing(InputMessage& msg);
void parsePingBack(InputMessage& msg);
void parseChallange(InputMessage& msg); void parseChallange(InputMessage& msg);
void parseDeath(InputMessage& msg); void parseDeath(InputMessage& msg);
void parseMapDescription(InputMessage& msg); void parseMapDescription(InputMessage& msg);
@ -141,6 +154,7 @@ private:
void parseAnimatedText(InputMessage& msg); void parseAnimatedText(InputMessage& msg);
void parseDistanceMissile(InputMessage& msg); void parseDistanceMissile(InputMessage& msg);
void parseCreatureMark(InputMessage& msg); void parseCreatureMark(InputMessage& msg);
void parseTrappers(InputMessage& msg);
void parseCreatureHealth(InputMessage& msg); void parseCreatureHealth(InputMessage& msg);
void parseCreatureLight(InputMessage& msg); void parseCreatureLight(InputMessage& msg);
void parseCreatureOutfit(InputMessage& msg); void parseCreatureOutfit(InputMessage& msg);
@ -158,6 +172,7 @@ private:
void parsePlayerCancelAttack(InputMessage& msg); void parsePlayerCancelAttack(InputMessage& msg);
void parseSpellDelay(InputMessage& msg); void parseSpellDelay(InputMessage& msg);
void parseSpellGroupDelay(InputMessage& msg); void parseSpellGroupDelay(InputMessage& msg);
void parseMultiUseDelay(InputMessage& msg);
void parseCreatureSpeak(InputMessage& msg); void parseCreatureSpeak(InputMessage& msg);
void parseChannelList(InputMessage& msg); void parseChannelList(InputMessage& msg);
void parseOpenChannel(InputMessage& msg); void parseOpenChannel(InputMessage& msg);
@ -173,6 +188,7 @@ private:
void parseCloseTrade(InputMessage&); void parseCloseTrade(InputMessage&);
void parseTextMessage(InputMessage& msg); void parseTextMessage(InputMessage& msg);
void parseCancelWalk(InputMessage& msg); void parseCancelWalk(InputMessage& msg);
void parseWalkWait(InputMessage& msg);
void parseFloorChangeUp(InputMessage& msg); void parseFloorChangeUp(InputMessage& msg);
void parseFloorChangeDown(InputMessage& msg); void parseFloorChangeDown(InputMessage& msg);
void parseOpenOutfitWindow(InputMessage& msg); void parseOpenOutfitWindow(InputMessage& msg);
@ -184,7 +200,7 @@ private:
void parseQuestLog(InputMessage& msg); void parseQuestLog(InputMessage& msg);
void parseQuestLine(InputMessage& msg); void parseQuestLine(InputMessage& msg);
void parseChannelEvent(InputMessage& msg); void parseChannelEvent(InputMessage& msg);
void parseObjectInfo(InputMessage& msg); void parseItemInfo(InputMessage& msg);
void parsePlayerInventory(InputMessage& msg); void parsePlayerInventory(InputMessage& msg);
void parseExtendedOpcode(InputMessage& msg); void parseExtendedOpcode(InputMessage& msg);

View File

@ -42,8 +42,8 @@ void ProtocolGame::parseMessage(InputMessage& msg)
while(!msg.eof()) { while(!msg.eof()) {
opcode = msg.getU8(); opcode = msg.getU8();
if(!m_gameInitialized && opcode >= Proto::GameServerFullMap) if(!m_gameInitialized && opcode >= Proto::GameServerFirstGameOpcode)
logWarning("first game network opcode is not GameServerInitGame"); logWarning("received a game opcode from the server, but the game is not initialized yet, this is a server side bug");
switch(opcode) { switch(opcode) {
case Proto::GameServerInitGame: case Proto::GameServerInitGame:
@ -65,7 +65,7 @@ void ProtocolGame::parseMessage(InputMessage& msg)
parsePing(msg); parsePing(msg);
break; break;
case Proto::GameServerPingBack: case Proto::GameServerPingBack:
// nothing todo parsePingBack(msg);
break; break;
case Proto::GameServerChallange: case Proto::GameServerChallange:
parseChallange(msg); parseChallange(msg);
@ -157,6 +157,9 @@ void ProtocolGame::parseMessage(InputMessage& msg)
case Proto::GameServerMarkCreature: case Proto::GameServerMarkCreature:
parseCreatureMark(msg); parseCreatureMark(msg);
break; break;
case Proto::GameServerTrappers:
parseTrappers(msg);
break;
case Proto::GameServerCreatureHealth: case Proto::GameServerCreatureHealth:
parseCreatureHealth(msg); parseCreatureHealth(msg);
break; break;
@ -232,6 +235,9 @@ void ProtocolGame::parseMessage(InputMessage& msg)
case Proto::GameServerCancelWalk: case Proto::GameServerCancelWalk:
parseCancelWalk(msg); parseCancelWalk(msg);
break; break;
case Proto::GameServerWalkWait:
parseWalkWait(msg);
break;
case Proto::GameServerFloorChangeUp: case Proto::GameServerFloorChangeUp:
parseFloorChangeUp(msg); parseFloorChangeUp(msg);
break; break;
@ -262,47 +268,40 @@ void ProtocolGame::parseMessage(InputMessage& msg)
case Proto::GameServerQuestLine: case Proto::GameServerQuestLine:
parseQuestLine(msg); parseQuestLine(msg);
break; break;
#if PROTOCOL>=870 // PROTOCOL>=870
case Proto::GameServerSpellDelay: case Proto::GameServerSpellDelay:
parseSpellDelay(msg); parseSpellDelay(msg);
break; break;
case Proto::GameServerSpellGroupDelay: case Proto::GameServerSpellGroupDelay:
parseSpellGroupDelay(msg); parseSpellGroupDelay(msg);
break; break;
#endif case Proto::GameServerMultiUseDelay:
#if PROTOCOL>=910 parseMultiUseDelay(msg);
break;
// PROTOCOL>=910
case Proto::GameServerPlayerDataBasic: case Proto::GameServerPlayerDataBasic:
parsePlayerInfo(msg); parsePlayerInfo(msg);
break; break;
case Proto::GameServerChannelEvent: case Proto::GameServerChannelEvent:
parseChannelEvent(msg); parseChannelEvent(msg);
break; break;
case Proto::GameServerObjectInfo: case Proto::GameServerItemInfo:
parseObjectInfo(msg); parseItemInfo(msg);
break; break;
case Proto::GameServerPlayerInventory: case Proto::GameServerPlayerInventory:
parsePlayerInventory(msg); parsePlayerInventory(msg);
break; break;
#endif // PROTOCOL>=944
#if PROTOCOL>=944 /*
case Proto::GameServerMarketEnter: case Proto::GameServerMarketEnter:
case Proto::GameServerMarketLeave: case Proto::GameServerMarketLeave:
case Proto::GameServerMarketBrowseItem: case Proto::GameServerMarketDetail:
case Proto::GameServerMarketAcceptOffer: case Proto::GameServerMarketBrowse:
case Proto::GameServerMarketOwnOffers: */
case Proto::GameServerMarketCancelOffer: // otclient ONLY
case Proto::GameServerMarketBrowseOwnHistory:
case Proto::GameServerMarketMarketDetail:
//TODO
break;
#endif
// additional opcode used by otclient only
case Proto::GameServerExtendedOpcode: case Proto::GameServerExtendedOpcode:
parseExtendedOpcode(msg); parseExtendedOpcode(msg);
break; break;
// not handled yet
//case Proto::GameServerTrappers
//case Proto::GameServerWait:
default: default:
Fw::throwException("unknown opcode"); Fw::throwException("unknown opcode");
break; break;
@ -358,7 +357,12 @@ void ProtocolGame::parseLoginWait(InputMessage& msg)
void ProtocolGame::parsePing(InputMessage& msg) void ProtocolGame::parsePing(InputMessage& msg)
{ {
g_game.processPing(); g_game.processPing();
sendPingResponse(); sendPingBack();
}
void ProtocolGame::parsePingBack(InputMessage& msg)
{
// nothing to do
} }
void ProtocolGame::parseChallange(InputMessage& msg) void ProtocolGame::parseChallange(InputMessage& msg)
@ -688,6 +692,23 @@ void ProtocolGame::parseCreatureMark(InputMessage& msg)
logTraceError("could not get creature"); logTraceError("could not get creature");
} }
void ProtocolGame::parseTrappers(InputMessage& msg)
{
int numTrappers = msg.getU8();
if(numTrappers > 8)
logTraceError("too many trappers");
for(int i=0;i<numTrappers;++i) {
uint id = msg.getU32();
CreaturePtr creature = g_map.getCreatureById(id);
if(creature) {
//TODO: set creature as trapper
} else
logTraceError("could not get creature");
}
}
void ProtocolGame::parseCreatureHealth(InputMessage& msg) void ProtocolGame::parseCreatureHealth(InputMessage& msg)
{ {
uint id = msg.getU32(); uint id = msg.getU32();
@ -814,7 +835,7 @@ void ProtocolGame::parsePlayerInfo(InputMessage& msg)
msg.getU8(); // profession msg.getU8(); // profession
int numSpells = msg.getU16(); int numSpells = msg.getU16();
for(int i=0;i<numSpells;++i) { for(int i=0;i<numSpells;++i) {
msg.getU16(); // spell msg.getU16(); // spell id
} }
} }
@ -906,6 +927,12 @@ void ProtocolGame::parseSpellGroupDelay(InputMessage& msg)
msg.getU8(); // unknown msg.getU8(); // unknown
} }
void ProtocolGame::parseMultiUseDelay(InputMessage& msg)
{
//TODO
}
void ProtocolGame::parseCreatureSpeak(InputMessage& msg) void ProtocolGame::parseCreatureSpeak(InputMessage& msg)
{ {
msg.getU32(); // channel statement guid msg.getU32(); // channel statement guid
@ -1040,6 +1067,12 @@ void ProtocolGame::parseCancelWalk(InputMessage& msg)
g_game.processWalkCancel(direction); g_game.processWalkCancel(direction);
} }
void ProtocolGame::parseWalkWait(InputMessage& msg)
{
//TODO: implement walk wait time
msg.getU16(); // time
}
void ProtocolGame::parseFloorChangeUp(InputMessage& msg) void ProtocolGame::parseFloorChangeUp(InputMessage& msg)
{ {
Position pos = g_map.getCentralPosition(); Position pos = g_map.getCentralPosition();
@ -1171,7 +1204,7 @@ void ProtocolGame::parseChannelEvent(InputMessage& msg)
msg.getU8(); // event type msg.getU8(); // event type
} }
void ProtocolGame::parseObjectInfo(InputMessage& msg) void ProtocolGame::parseItemInfo(InputMessage& msg)
{ {
//TODO //TODO
} }

View File

@ -23,6 +23,19 @@
#include "protocolgame.h" #include "protocolgame.h"
#include <framework/net/rsa.h> #include <framework/net/rsa.h>
/*
ClientEquipObject
ClientRefreshContainer
ClientMount
ClientRuleViolationReport
ClientGetItemInfo
ClientMarketLeave
ClientMarketBrowse
ClientMarketCreate
ClientMarketCancel
ClientMarketAccept
ClientExtendedOpcode = 254 // otclient only
*/
void ProtocolGame::sendLoginPacket(uint challangeTimestamp, uint8 challangeRandom) void ProtocolGame::sendLoginPacket(uint challangeTimestamp, uint8 challangeRandom)
{ {
OutputMessage msg; OutputMessage msg;
@ -83,10 +96,17 @@ void ProtocolGame::sendLogout()
send(msg); send(msg);
} }
void ProtocolGame::sendPingResponse() void ProtocolGame::sendPing()
{ {
OutputMessage msg; OutputMessage msg;
msg.addU8(Proto::ClientPingResponse); msg.addU8(Proto::ClientPing);
send(msg);
}
void ProtocolGame::sendPingBack()
{
OutputMessage msg;
msg.addU8(Proto::ClientPingBack);
send(msg); send(msg);
} }
@ -222,6 +242,15 @@ void ProtocolGame::sendTurnWest()
send(msg); send(msg);
} }
void ProtocolGame::sendEquipItem(int itemId, int countOrSubType)
{
OutputMessage msg;
msg.addU8(Proto::ClientEquipItem);
msg.addU16(itemId);
msg.addU8(countOrSubType);
send(msg);
}
void ProtocolGame::sendMove(const Position& fromPos, int thingId, int stackpos, const Position& toPos, int count) void ProtocolGame::sendMove(const Position& fromPos, int thingId, int stackpos, const Position& toPos, int count)
{ {
OutputMessage msg; OutputMessage msg;
@ -587,14 +616,20 @@ void ProtocolGame::sendChangeOutfit(const Outfit& outfit)
{ {
OutputMessage msg; OutputMessage msg;
msg.addU8(Proto::ClientChangeOutfit); msg.addU8(Proto::ClientChangeOutfit);
msg.addU16(outfit.getId()); msg.addU16(outfit.getId());
msg.addU8(outfit.getHead()); msg.addU8(outfit.getHead());
msg.addU8(outfit.getBody()); msg.addU8(outfit.getBody());
msg.addU8(outfit.getLegs()); msg.addU8(outfit.getLegs());
msg.addU8(outfit.getFeet()); msg.addU8(outfit.getFeet());
msg.addU8(outfit.getAddons()); msg.addU8(outfit.getAddons());
send(msg);
}
void ProtocolGame::sendMount(bool mount)
{
OutputMessage msg;
msg.addU8(Proto::ClientMount);
msg.addU8(mount);
send(msg); send(msg);
} }
@ -662,6 +697,28 @@ void ProtocolGame::sendRequestQuestLine(int questId)
send(msg); send(msg);
} }
void ProtocolGame::sendNewNewRuleViolation(int reason, int action, const std::string& characterName, const std::string& comment, const std::string& translation)
{
OutputMessage msg;
msg.addU8(Proto::ClientNewRuleViolation);
msg.addU8(reason);
msg.addU8(action);
msg.addString(characterName);
msg.addString(comment);
msg.addString(translation);
send(msg);
}
void ProtocolGame::sendRequestItemInfo(int itemId, int index)
{
OutputMessage msg;
msg.addU8(Proto::ClientRequestItemInfo);
msg.addU8(1); // count, 1 for just one item
msg.addU16(itemId);
msg.addU8(index);
send(msg);
}
void ProtocolGame::sendExtendedOpcode(uint8 opcode, const std::string& buffer) void ProtocolGame::sendExtendedOpcode(uint8 opcode, const std::string& buffer)
{ {
OutputMessage msg; OutputMessage msg;