enums for protocol opcodes

This commit is contained in:
Eduardo Bart 2011-08-31 13:49:51 -03:00
parent e69a6d1140
commit 8e08decd25
7 changed files with 311 additions and 293 deletions

View File

@ -42,42 +42,211 @@ namespace Otc
"6207862794310902180176810615217550567108238764764442605581471797" "6207862794310902180176810615217550567108238764764442605581471797"
"07119674283982419152118103759076030616683978566631413"; "07119674283982419152118103759076030616683978566631413";
enum DatFlag { static const int ClientVersion = 862;
static const int PicSignature = 0x4E119CBF;
enum OsTypes {
OsWindow = 1,
OsLinux = 2,
OsMac = 3,
OsBrowser = 4
};
enum DatOpts {
DatGround = 0, DatGround = 0,
DatGroundClip, DatGroundClip = 1,
DatOnBottom, DatOnBottom = 2,
DatOnTop, DatOnTop = 3,
DatContainer, DatContainer = 4,
DatStackable, DatStackable = 5,
DatForceUse, DatForceUse = 6,
DatMultiUse, DatMultiUse = 7,
DatWritable, DatWritable = 8,
DatWritableOnce, DatWritableOnce = 9,
DatFluidContainer, DatFluidContainer = 10,
DatSplash, DatSplash = 11,
DatBlockWalk, DatBlockWalk = 12,
DatNotMovable, DatNotMovable = 13,
DatBlockProjectile, DatBlockProjectile = 14,
DatBlockPathFind, DatBlockPathFind = 15,
DatPickupable, DatPickupable = 16,
DatHangable, DatHangable = 17,
DatHookSouth, DatHookSouth = 18,
DatHookEast, DatHookEast = 19,
DatRotable, DatRotable = 20,
DatLight, DatLight = 21,
DatDontHide, DatDontHide = 22,
DatTranslucent, DatTranslucent = 23,
DatDisplacment, DatDisplacment = 24,
DatElevation, DatElevation = 25,
DatLyingCorpse, DatLyingCorpse = 26,
DatAnimateAlways, DatAnimateAlways = 27,
DatMinimapColor, DatMinimapColor = 28,
DatLensHelp, DatLensHelp = 29,
DatFullGround, DatFullGround = 30,
DatIgnoreLook, DatIgnoreLook = 31,
DatClothe, DatClothe = 32,
DatAnimation, DatAnimation = 33,
LastDatFlag = 255 DatLastOpt = 255
};
enum LoginServerOpts {
LoginServerError = 10,
LoginServerMotd = 20,
LoginServerUpdateNeeded = 30,
LoginServerCharacterList = 100
};
enum GameServerOpts {
GameServerInitGame = 10,
GameServerLoginError = 20,
GameServerLoginAdvice = 21,
GameServerLoginWait = 22,
GameServerPing = 30,
GameServerChallange = 31,
GameServerDead = 40,
GameServerFullMap = 100,
GameServerMapTopRow = 101,
GameServerMapRightRow = 102,
GameServerMapBottomRow = 103,
GameServerMapLeftRow = 104,
GameServerTileData = 105,
GameServerCreateOnMap = 106,
GameServerChangeOnMap = 107,
GameServerDeleteOnMap = 108,
GameServerMoveCreature = 109,
GameServerOpenContainer = 110,
GameServerCloseContainer = 111,
GameServerCreateContainer = 112,
GameServerChangeInContainer = 113,
GameServerDeleteInContainer = 114,
GameServerSetInventory = 120,
GameServerDeleteInventory = 121,
GameServerNpcOffer = 122,
GameServerPlayerGoods = 123,
GameServerCloseNpcTrade = 124,
GameServerOwnOffer = 125,
GameServerCounterOffer = 126,
GameServerCloseTrade = 127,
GameServerAmbient = 130,
GameServerGraphicalEffect = 131,
GameServerTextEffect = 132, // absolate in last tibia?
GameServerMissleEffect = 133,
GameServerMarkCreature = 134,
GameServerTrappers = 135,
GameServerCreatureHealth = 140,
GameServerCreatureLight = 141,
GameServerCreatureOutfit = 142,
GameServerCreatureSpeed = 143,
GameServerCreatureSkull = 144,
GameServerCreatureParty = 145,
GameServerCreatureUnpass = 146,
GameServerEditText = 150,
GameServerEditList = 151,
GameServerPlayerData = 160,
GameServerPlayerSkills = 161,
GameServerPlayerState = 162,
GameServerClearTarget = 163,
GameServerSpellDelay = 164,
GameServerSpellGroupDelay = 165,
GameServerTalk = 170,
GameServerChannels = 171,
GameServerOpenChannel = 172,
GameServerPrivateChannel = 173,
GameServerRuleViolation = 174, // absolate in last tibia?
GameServerRuleViolation1 = 175, // absolate in last tibia?
GameServerRuleViolation2 = 176, // absolate in last tibia?
GameServerRuleViolation3 = 177, // absolate in last tibia?
GameServerOpenOwnChannel = 178,
GameServerCloseChannel = 179,
GameServerMessage = 180,
GameServerSnapBack = 181,
GameServerWait = 182,
GameServerTopFloor = 190,
GameServerBottomFloor = 191,
GameServerOutfit = 200,
GameServerBuddyData = 210,
GameServerBuddyLogin = 211,
GameServerBuddyLogout = 212,
GameServerTutorialHint = 220,
GameServerAutomapFlag = 221,
GameServerQuestLog = 240,
GameServerQuestLine = 241,
GameServerChannelEvent = 243,
GameServerObjectInfo = 244,
GameServerPlayerInventory = 245
};
enum ClientOpts {
ClientEnterAccount = 1,
ClientEnterGame = 10,
ClientQuitGame = 20,
ClientPingBack = 30,
ClientGoPath = 100,
ClientGoNorth = 101,
ClientGoEast = 102,
ClientGoSouth = 103,
ClientGoWest = 104,
ClientStop = 105,
ClientGoNorthEast = 106,
ClientGoSouthEast = 107,
ClientGoSouthWest = 108,
ClientGoNorthWest = 109,
ClientRotateNorth = 111,
ClientRotateEast = 112,
ClientRotateSouth = 113,
ClientRotateWest = 114,
ClientEquipObject = 119,
ClientMoveObject = 120,
ClientInspectNpcTrade = 121,
ClientBuyObject = 122,
ClientSellObject = 123,
ClientCloseNpcTrade = 124,
ClientTradeObject = 125,
ClientInspectTrade = 126,
ClientAcceptTrade = 127,
ClientRejectTrade = 128,
ClientUseObject = 130,
ClientUseTwoObjects = 131,
ClientUseOnCreature = 132,
ClientTurnObject = 133,
ClientCloseContainer = 135,
ClientUpContainer = 136,
ClientEditText = 137,
ClientEditList = 138,
ClientLook = 140,
ClientTalk = 150,
ClientGetChannels = 151,
ClientJoinChannel = 152,
ClientLeaveChannel = 153,
ClientPrivateChannel = 154,
ClientCloseNpcChannel = 158,
ClientSetTactics = 160,
ClientAttack = 161,
ClientFollow = 162,
ClientInviteToParty = 163,
ClientJoinParty = 164,
ClientRevokeInvitation = 165,
ClientPassLeadership = 166,
ClientLeaveParty = 167,
ClientShareExperience = 168,
ClientDisbandParty = 169,
ClientOpenChannel = 170,
ClientInviteToChannel = 171,
ClientExcludeFromChannel = 172,
ClientCancel = 190,
ClientRefreshContainer = 202,
ClientGetOutfit = 210,
ClientSetOutfit = 211,
ClientMount = 212,
ClientAddBuddy = 220,
ClientRemoveBuddy = 221,
ClientBugReport = 230,
ClientErrorFileEntry = 232,
ClientGetQuestLog = 240,
ClientGetQuestLine = 241,
ClientRuleViolationReport = 242,
ClientGetObjectInfo = 243
}; };
enum ThingType { enum ThingType {

View File

@ -1,130 +0,0 @@
/*
* Copyright (c) 2010-2011 OTClient <https://github.com/edubart/otclient>
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE.
*/
#ifndef THINGATTRIBUTES_H
#define THINGATTRIBUTES_H
#include "declarations.h"
struct ThingAttributes
{
ThingAttributes() {
layers = 0;
width = height = 0;
exactSize = 0;
xPattern = yPattern = zPattern = 0;
animationPhases = 0;
xDisplacment = yDisplacment = 0;
elevation = 0;
isGround = false;
isGroundClip = false;
isOnBottom = false;
isOnTop = false;
isContainer = false;
isStackable = false;
isForceUse = false;
isMultiUse = false;
isWritable = false;
isWritableOnce = false;
isFluidContainer = false;
isSplash = false;
isNotWalkable = false;
isNotMoveable = false;
isNotProjectable = false;
isNotPathable = false;
isPickupable = false;
isHangable = false;
isHookSouth = false;
isHookEast = false;
isRotable = false;
isDontHide = false;
isTranslucent = false;
isLyingCorpse = false;
isAnimatedAlways = false;
isLensHelp = false;
isFullGround = false;
isIgnoreLook = false;
isClothe = false;
hasLight = false;
hasMiniMapColor = false;
groundSpeed = 0;
fluidParam = 0;
maxTextLength = 0;
lightLevel = lightColor = 0;
miniMapColor = 0;
lensHelpParam = 0;
}
uint8 layers;
uint8 width, height;
uint8 exactSize;
uint8 xPattern, yPattern, zPattern;
uint8 animationPhases;
uint16 xDisplacment, yDisplacment;
uint16 elevation;
std::vector<int> sprites;
bool isGround;
bool isGroundClip;
bool isOnBottom;
bool isOnTop;
bool isContainer;
bool isStackable;
bool isForceUse;
bool isMultiUse;
bool isWritable;
bool isWritableOnce;
bool isFluidContainer;
bool isSplash;
bool isNotWalkable;
bool isNotMoveable;
bool isNotProjectable;
bool isNotPathable;
bool isPickupable;
bool isHangable;
bool isHookSouth;
bool isHookEast;
bool isRotable;
bool isDontHide;
bool isTranslucent;
bool isLyingCorpse;
bool isAnimatedAlways;
bool isLensHelp;
bool isFullGround;
bool isIgnoreLook;
bool isClothe;
bool hasLight;
bool hasMiniMapColor;
uint16 groundSpeed;
uint8 fluidParam;
uint16 maxTextLength;
uint16 lightLevel, lightColor;
uint16 miniMapColor;
uint16 lensHelpParam;
};
typedef std::vector<ThingAttributes> ThingAttributesList;
#endif

View File

@ -186,7 +186,7 @@ void ThingsType::parseThingType(std::stringstream& fin, ThingType& thingType)
break; break;
case Otc::DatAnimation: // Not used in 8.62 case Otc::DatAnimation: // Not used in 8.62
break; break;
case Otc::LastDatFlag: case Otc::DatLastOpt:
done = true; done = true;
break; break;
default: default:

View File

@ -112,9 +112,6 @@ private:
void parseOpenChannel(InputMessage& msg); void parseOpenChannel(InputMessage& msg);
void parseOpenPrivatePlayerChat(InputMessage& msg); void parseOpenPrivatePlayerChat(InputMessage& msg);
void parseOpenRuleViolation(InputMessage& msg); void parseOpenRuleViolation(InputMessage& msg);
void parseRuleViolationAF(InputMessage& msg);
void parseRuleViolationB0(InputMessage& msg);
void parseRuleViolationB1(InputMessage& msg);
void parseCreatePrivateChannel(InputMessage& msg); void parseCreatePrivateChannel(InputMessage& msg);
void parseClosePrivateChannel(InputMessage& msg); void parseClosePrivateChannel(InputMessage& msg);
void parseSafeTradeRequest(InputMessage& msg); void parseSafeTradeRequest(InputMessage& msg);

View File

@ -37,216 +37,216 @@ void ProtocolGame::parseMessage(InputMessage& msg)
//dump << "protocol id:" << std::hex << (int)opt; //dump << "protocol id:" << std::hex << (int)opt;
switch(opt) { switch(opt) {
case 0x0A: case Otc::GameServerInitGame:
parsePlayerLogin(msg); parsePlayerLogin(msg);
break; break;
case 0x0B: case 0x0B:
parseGMActions(msg); parseGMActions(msg);
break; break;
case 0x14: case Otc::GameServerLoginError:
parseErrorMessage(msg); parseErrorMessage(msg);
break; break;
case 0x15: case Otc::GameServerLoginAdvice:
parseFYIMessage(msg); parseFYIMessage(msg);
break; break;
case 0x16: case Otc::GameServerLoginWait:
parseWaitList(msg); parseWaitList(msg);
break; break;
case 0x1E: case Otc::GameServerPing:
parsePing(msg); parsePing(msg);
break; break;
case 0x28: //case Otc::GameServerChallange:
case Otc::GameServerDead:
parseDeath(msg); parseDeath(msg);
break; break;
case 0x32: case Otc::GameServerFullMap:
parseCanReportBugs(msg);
break;
case 0x64:
parseMapDescription(msg); parseMapDescription(msg);
break; break;
case 0x65: case Otc::GameServerMapTopRow:
parseMoveNorth(msg); parseMoveNorth(msg);
break; break;
case 0x66: case Otc::GameServerMapRightRow:
parseMoveEast(msg); parseMoveEast(msg);
break; break;
case 0x67: case Otc::GameServerMapBottomRow:
parseMoveSouth(msg); parseMoveSouth(msg);
break; break;
case 0x68: case Otc::GameServerMapLeftRow:
parseMoveWest(msg); parseMoveWest(msg);
break; break;
case 0x69: case Otc::GameServerTileData:
parseUpdateTile(msg); parseUpdateTile(msg);
break; break;
case 0x6A: case Otc::GameServerCreateOnMap:
parseTileAddThing(msg); parseTileAddThing(msg);
break; break;
case 0x6B: case Otc::GameServerChangeOnMap:
parseTileTransformThing(msg); parseTileTransformThing(msg);
break; break;
case 0x6C: case Otc::GameServerDeleteOnMap:
parseTileRemoveThing(msg); parseTileRemoveThing(msg);
break; break;
case 0x6D: case Otc::GameServerMoveCreature:
parseCreatureMove(msg); parseCreatureMove(msg);
break; break;
case 0x6E: case Otc::GameServerOpenContainer:
parseOpenContainer(msg); parseOpenContainer(msg);
break; break;
case 0x6F: case Otc::GameServerCloseContainer:
parseCloseContainer(msg); parseCloseContainer(msg);
break; break;
case 0x70: case Otc::GameServerCreateContainer:
parseContainerAddItem(msg); parseContainerAddItem(msg);
break; break;
case 0x71: case Otc::GameServerChangeInContainer:
parseContainerUpdateItem(msg); parseContainerUpdateItem(msg);
break; break;
case 0x72: case Otc::GameServerDeleteInContainer:
parseContainerRemoveItem(msg); parseContainerRemoveItem(msg);
break; break;
case 0x78: case Otc::GameServerSetInventory:
parseAddInventoryItem(msg); parseAddInventoryItem(msg);
break; break;
case 0x79: case Otc::GameServerDeleteInventory:
parseRemoveInventoryItem(msg); parseRemoveInventoryItem(msg);
break; break;
case 0x7A: case Otc::GameServerNpcOffer:
parseOpenShopWindow(msg); parseOpenShopWindow(msg);
break; break;
case 0x7B: case Otc::GameServerPlayerGoods:
parsePlayerCash(msg); parsePlayerCash(msg);
break; break;
case 0x7C: case Otc::GameServerCloseNpcTrade:
parseCloseShopWindow(msg); parseCloseShopWindow(msg);
break; break;
case 0x7D: case Otc::GameServerOwnOffer:
parseSafeTradeRequest(msg); parseSafeTradeRequest(msg);
break; break;
case 0x7E: case Otc::GameServerCounterOffer:
parseSafeTradeRequest(msg); parseSafeTradeRequest(msg);
break; break;
case 0x7F: case Otc::GameServerCloseTrade:
parseSafeTradeClose(msg); parseSafeTradeClose(msg);
break; break;
case 0x82: case Otc::GameServerAmbient:
parseWorldLight(msg); parseWorldLight(msg);
break; break;
case 0x83: case Otc::GameServerGraphicalEffect:
parseMagicEffect(msg); parseMagicEffect(msg);
break; break;
case 0x84: case Otc::GameServerTextEffect:
parseAnimatedText(msg); parseAnimatedText(msg);
break; break;
case 0x85: case Otc::GameServerMissleEffect:
parseDistanceShot(msg); parseDistanceShot(msg);
break; break;
case 0x86: case Otc::GameServerMarkCreature:
parseCreatureSquare(msg); parseCreatureSquare(msg);
break; break;
case 0x8C: //case Otc::GameServerTrappers
case Otc::GameServerCreatureHealth:
parseCreatureHealth(msg); parseCreatureHealth(msg);
break; break;
case 0x8D: case Otc::GameServerCreatureLight:
parseCreatureLight(msg); parseCreatureLight(msg);
break; break;
case 0x8E: case Otc::GameServerCreatureOutfit:
parseCreatureOutfit(msg); parseCreatureOutfit(msg);
break; break;
case 0x8F: case Otc::GameServerCreatureSpeed:
parseCreatureSpeed(msg); parseCreatureSpeed(msg);
break; break;
case 0x90: case Otc::GameServerCreatureSkull:
parseCreatureSkulls(msg); parseCreatureSkulls(msg);
break; break;
case 0x91: case Otc::GameServerCreatureParty:
parseCreatureShields(msg); parseCreatureShields(msg);
break; break;
case 0x96: // case Otc::GameServerCreatureUnpass
case Otc::GameServerEditText:
parseItemTextWindow(msg); parseItemTextWindow(msg);
break; break;
case 0x97: case Otc::GameServerEditList:
parseHouseTextWindow(msg); parseHouseTextWindow(msg);
break; break;
case 0xA0: case Otc::GameServerPlayerData:
parsePlayerStats(msg); parsePlayerStats(msg);
break; break;
case 0xA1: case Otc::GameServerPlayerSkills:
parsePlayerSkills(msg); parsePlayerSkills(msg);
break; break;
case 0xA2: case Otc::GameServerPlayerState:
parsePlayerIcons(msg); parsePlayerIcons(msg);
break; break;
case 0xA3: case Otc::GameServerClearTarget:
parsePlayerCancelAttack(msg); parsePlayerCancelAttack(msg);
break; break;
case 0xAA: //case Otc::GameServerSpellDelay:
//case Otc::GameServerSpellGroupDelay:
case Otc::GameServerTalk:
parseCreatureSpeak(msg); parseCreatureSpeak(msg);
break; break;
case 0xAB: case Otc::GameServerChannels:
parseChannelList(msg); parseChannelList(msg);
break; break;
case 0xAC: case Otc::GameServerOpenChannel:
parseOpenChannel(msg); parseOpenChannel(msg);
break; break;
case 0xAD: case Otc::GameServerPrivateChannel:
parseOpenPrivatePlayerChat(msg); parseOpenPrivatePlayerChat(msg);
break; break;
case 0xAE: case Otc::GameServerRuleViolation:
case Otc::GameServerRuleViolation1:
case Otc::GameServerRuleViolation2:
case Otc::GameServerRuleViolation3:
parseOpenRuleViolation(msg); parseOpenRuleViolation(msg);
break; break;
case 0xAF: case Otc::GameServerOpenOwnChannel:
parseRuleViolationAF(msg);
break;
case 0xB0:
parseRuleViolationB0(msg);
break;
case 0xB1:
parseRuleViolationB1(msg);
break;
case 0xB2:
parseCreatePrivateChannel(msg); parseCreatePrivateChannel(msg);
break; break;
case 0xB3: case Otc::GameServerCloseChannel:
parseClosePrivateChannel(msg); parseClosePrivateChannel(msg);
break; break;
case 0xB4: case Otc::GameServerMessage:
parseTextMessage(msg); parseTextMessage(msg);
break; break;
case 0xB5: case Otc::GameServerSnapBack:
parseCancelWalk(msg); parseCancelWalk(msg);
break; break;
case 0xBE: //case Otc::GameServerWait:
case Otc::GameServerTopFloor:
parseFloorChangeUp(msg); parseFloorChangeUp(msg);
break; break;
case 0xBF: case Otc::GameServerBottomFloor:
parseFloorChangeDown(msg); parseFloorChangeDown(msg);
break; break;
case 0xC8: case Otc::GameServerOutfit:
parseOutfitWindow(msg); parseOutfitWindow(msg);
break; break;
case 0xD2: case Otc::GameServerBuddyData:
parseVipState(msg); parseVipState(msg);
break; break;
case 0xD3: case Otc::GameServerBuddyLogin:
parseVipLogin(msg); parseVipLogin(msg);
break; break;
case 0xD4: case Otc::GameServerBuddyLogout:
parseVipLogout(msg); parseVipLogout(msg);
break; break;
case 0xDC: case Otc::GameServerTutorialHint:
parseShowTutorial(msg); parseShowTutorial(msg);
break; break;
case 0xDD: case Otc::GameServerAutomapFlag:
parseAddMarker(msg); parseAddMarker(msg);
break; break;
case 0xF0: case Otc::GameServerQuestLog:
parseQuestList(msg); parseQuestList(msg);
break; break;
case 0xF1: case Otc::GameServerQuestLine:
parseQuestPartList(msg); parseQuestPartList(msg);
break; break;
//case Otc::GameServerChannelEvent:
//case Otc::GameServerObjectInfo:
//case Otc::GameServerPlayerInventory:
default: default:
logError("UNKNOWN PACKET OPT BYTE: 0x", std::hex, opt); logError("UNKNOWN PACKET OPT BYTE: 0x", std::hex, opt);
break; break;
@ -299,11 +299,6 @@ void ProtocolGame::parseDeath(InputMessage&)
} }
void ProtocolGame::parseCanReportBugs(InputMessage& msg)
{
msg.getU8(); // report bugs
}
void ProtocolGame::parseMapDescription(InputMessage& msg) void ProtocolGame::parseMapDescription(InputMessage& msg)
{ {
Position pos = parsePosition(msg); Position pos = parsePosition(msg);
@ -727,21 +722,6 @@ void ProtocolGame::parseOpenRuleViolation(InputMessage& msg)
msg.getU16(); // a msg.getU16(); // a
} }
void ProtocolGame::parseRuleViolationAF(InputMessage& msg)
{
msg.getU16(); // a
}
void ProtocolGame::parseRuleViolationB0(InputMessage& msg)
{
msg.getU16(); // a
}
void ProtocolGame::parseRuleViolationB1(InputMessage& msg)
{
msg.getU16(); // a
}
void ProtocolGame::parseCreatePrivateChannel(InputMessage& msg) void ProtocolGame::parseCreatePrivateChannel(InputMessage& msg)
{ {
msg.getU16(); // channel id msg.getU16(); // channel id

View File

@ -27,9 +27,9 @@ void ProtocolGame::sendLoginPacket(uint32 timestamp, uint8 unknown)
{ {
OutputMessage oMsg; OutputMessage oMsg;
oMsg.addU8(0x0A); // protocol id oMsg.addU8(Otc::ClientEnterGame);
oMsg.addU16(0x02); // os oMsg.addU16(Otc::OsLinux);
oMsg.addU16(862); // client version oMsg.addU16(Otc::ClientVersion);
oMsg.addU8(0); // first RSA byte must be 0 oMsg.addU8(0); // first RSA byte must be 0
@ -63,97 +63,97 @@ void ProtocolGame::sendLoginPacket(uint32 timestamp, uint8 unknown)
void ProtocolGame::sendLogout() void ProtocolGame::sendLogout()
{ {
OutputMessage oMsg; OutputMessage oMsg;
oMsg.addU8(0x14); oMsg.addU8(Otc::ClientQuitGame);
send(oMsg); send(oMsg);
} }
void ProtocolGame::sendPing() void ProtocolGame::sendPing()
{ {
OutputMessage oMsg; OutputMessage oMsg;
oMsg.addU8(0x1E); oMsg.addU8(Otc::ClientPingBack);
send(oMsg); send(oMsg);
} }
void ProtocolGame::sendWalkNorth() void ProtocolGame::sendWalkNorth()
{ {
OutputMessage oMsg; OutputMessage oMsg;
oMsg.addU8(0x65); oMsg.addU8(Otc::ClientGoNorth);
send(oMsg); send(oMsg);
} }
void ProtocolGame::sendWalkEast() void ProtocolGame::sendWalkEast()
{ {
OutputMessage oMsg; OutputMessage oMsg;
oMsg.addU8(0x66); oMsg.addU8(Otc::ClientGoEast);
send(oMsg); send(oMsg);
} }
void ProtocolGame::sendWalkSouth() void ProtocolGame::sendWalkSouth()
{ {
OutputMessage oMsg; OutputMessage oMsg;
oMsg.addU8(0x67); oMsg.addU8(Otc::ClientGoSouth);
send(oMsg); send(oMsg);
} }
void ProtocolGame::sendWalkWest() void ProtocolGame::sendWalkWest()
{ {
OutputMessage oMsg; OutputMessage oMsg;
oMsg.addU8(0x68); oMsg.addU8(Otc::ClientGoWest);
send(oMsg); send(oMsg);
} }
void ProtocolGame::sendWalkNorthEast() void ProtocolGame::sendWalkNorthEast()
{ {
OutputMessage oMsg; OutputMessage oMsg;
oMsg.addU8(0x6A); oMsg.addU8(Otc::ClientGoNorthEast);
send(oMsg); send(oMsg);
} }
void ProtocolGame::sendWalkSouthEast() void ProtocolGame::sendWalkSouthEast()
{ {
OutputMessage oMsg; OutputMessage oMsg;
oMsg.addU8(0x6B); oMsg.addU8(Otc::ClientGoSouthEast);
send(oMsg); send(oMsg);
} }
void ProtocolGame::sendWalkSouthWest() void ProtocolGame::sendWalkSouthWest()
{ {
OutputMessage oMsg; OutputMessage oMsg;
oMsg.addU8(0x6C); oMsg.addU8(Otc::ClientGoSouthWest);
send(oMsg); send(oMsg);
} }
void ProtocolGame::sendWalkNorthWest() void ProtocolGame::sendWalkNorthWest()
{ {
OutputMessage oMsg; OutputMessage oMsg;
oMsg.addU8(0x6D); oMsg.addU8(Otc::ClientGoNorthWest);
send(oMsg); send(oMsg);
} }
void ProtocolGame::sendTurnNorth() void ProtocolGame::sendTurnNorth()
{ {
OutputMessage oMsg; OutputMessage oMsg;
oMsg.addU8(0x6F); oMsg.addU8(Otc::ClientRotateNorth);
send(oMsg); send(oMsg);
} }
void ProtocolGame::sendTurnEast() void ProtocolGame::sendTurnEast()
{ {
OutputMessage oMsg; OutputMessage oMsg;
oMsg.addU8(0x70); oMsg.addU8(Otc::ClientRotateEast);
send(oMsg); send(oMsg);
} }
void ProtocolGame::sendTurnSouth() void ProtocolGame::sendTurnSouth()
{ {
OutputMessage oMsg; OutputMessage oMsg;
oMsg.addU8(0x71); oMsg.addU8(Otc::ClientRotateSouth);
send(oMsg); send(oMsg);
} }
void ProtocolGame::sendTurnWest() void ProtocolGame::sendTurnWest()
{ {
OutputMessage oMsg; OutputMessage oMsg;
oMsg.addU8(0x72); oMsg.addU8(Otc::ClientRotateWest);
send(oMsg); send(oMsg);
} }

View File

@ -25,6 +25,8 @@
#include <framework/net/rsa.h> #include <framework/net/rsa.h>
#include <framework/luascript/luainterface.h> #include <framework/luascript/luainterface.h>
#include <boost/bind.hpp> #include <boost/bind.hpp>
#include <otclient/core/thingstype.h>
#include <otclient/core/spritemanager.h>
ProtocolLogin::ProtocolLogin() ProtocolLogin::ProtocolLogin()
{ {
@ -57,16 +59,16 @@ void ProtocolLogin::onRecv(InputMessage& inputMessage)
while(!inputMessage.eof()) { while(!inputMessage.eof()) {
uint8 opt = inputMessage.getU8(); uint8 opt = inputMessage.getU8();
switch(opt) { switch(opt) {
case 0x0A: case Otc::LoginServerError:
parseError(inputMessage); parseError(inputMessage);
break; break;
case 0x14: case Otc::LoginServerMotd:
parseMOTD(inputMessage); parseMOTD(inputMessage);
break; break;
case 0x1e: case Otc::LoginServerUpdateNeeded:
callLuaField("onError", "Client needs update."); callLuaField("onError", "Client needs update.");
break; break;
case 0x64: case Otc::LoginServerCharacterList:
parseCharacterList(inputMessage); parseCharacterList(inputMessage);
break; break;
} }
@ -83,13 +85,13 @@ void ProtocolLogin::sendLoginPacket()
{ {
OutputMessage oMsg; OutputMessage oMsg;
oMsg.addU8(0x01); // protocol id oMsg.addU8(Otc::ClientEnterAccount);
oMsg.addU16(0x02); // os oMsg.addU16(Otc::OsLinux);
oMsg.addU16(862); // client version oMsg.addU16(Otc::ClientVersion);
oMsg.addU32(0x4E12DAFF); // data signature oMsg.addU32(g_thingsType.getSignature()); // data signature
oMsg.addU32(0x4E12DB27); // sprite signature oMsg.addU32(g_sprites.getSignature()); // sprite signature
oMsg.addU32(0x4E119CBF); // pic signature oMsg.addU32(Otc::PicSignature); // pic signature
oMsg.addU8(0); // first RSA byte must be 0 oMsg.addU8(0); // first RSA byte must be 0