From 8e08decd25209e669b0521ff73c63e3c299ec6e1 Mon Sep 17 00:00:00 2001 From: Eduardo Bart Date: Wed, 31 Aug 2011 13:49:51 -0300 Subject: [PATCH] enums for protocol opcodes --- src/otclient/const.h | 239 +++++++++++++++++++++---- src/otclient/core/thingattributes.h | 130 -------------- src/otclient/core/thingstype.cpp | 2 +- src/otclient/net/protocolgame.h | 3 - src/otclient/net/protocolgameparse.cpp | 174 ++++++++---------- src/otclient/net/protocolgamesend.cpp | 34 ++-- src/otclient/net/protocollogin.cpp | 22 +-- 7 files changed, 311 insertions(+), 293 deletions(-) delete mode 100644 src/otclient/core/thingattributes.h diff --git a/src/otclient/const.h b/src/otclient/const.h index 8d1cf5bb..d9349aa3 100644 --- a/src/otclient/const.h +++ b/src/otclient/const.h @@ -42,42 +42,211 @@ namespace Otc "6207862794310902180176810615217550567108238764764442605581471797" "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, - DatGroundClip, - DatOnBottom, - DatOnTop, - DatContainer, - DatStackable, - DatForceUse, - DatMultiUse, - DatWritable, - DatWritableOnce, - DatFluidContainer, - DatSplash, - DatBlockWalk, - DatNotMovable, - DatBlockProjectile, - DatBlockPathFind, - DatPickupable, - DatHangable, - DatHookSouth, - DatHookEast, - DatRotable, - DatLight, - DatDontHide, - DatTranslucent, - DatDisplacment, - DatElevation, - DatLyingCorpse, - DatAnimateAlways, - DatMinimapColor, - DatLensHelp, - DatFullGround, - DatIgnoreLook, - DatClothe, - DatAnimation, - LastDatFlag = 255 + DatGroundClip = 1, + DatOnBottom = 2, + DatOnTop = 3, + DatContainer = 4, + DatStackable = 5, + DatForceUse = 6, + DatMultiUse = 7, + DatWritable = 8, + DatWritableOnce = 9, + DatFluidContainer = 10, + DatSplash = 11, + DatBlockWalk = 12, + DatNotMovable = 13, + DatBlockProjectile = 14, + DatBlockPathFind = 15, + DatPickupable = 16, + DatHangable = 17, + DatHookSouth = 18, + DatHookEast = 19, + DatRotable = 20, + DatLight = 21, + DatDontHide = 22, + DatTranslucent = 23, + DatDisplacment = 24, + DatElevation = 25, + DatLyingCorpse = 26, + DatAnimateAlways = 27, + DatMinimapColor = 28, + DatLensHelp = 29, + DatFullGround = 30, + DatIgnoreLook = 31, + DatClothe = 32, + DatAnimation = 33, + 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 { diff --git a/src/otclient/core/thingattributes.h b/src/otclient/core/thingattributes.h deleted file mode 100644 index ee75c554..00000000 --- a/src/otclient/core/thingattributes.h +++ /dev/null @@ -1,130 +0,0 @@ -/* - * Copyright (c) 2010-2011 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 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 ThingAttributesList; - -#endif diff --git a/src/otclient/core/thingstype.cpp b/src/otclient/core/thingstype.cpp index d2628f48..493b025a 100644 --- a/src/otclient/core/thingstype.cpp +++ b/src/otclient/core/thingstype.cpp @@ -186,7 +186,7 @@ void ThingsType::parseThingType(std::stringstream& fin, ThingType& thingType) break; case Otc::DatAnimation: // Not used in 8.62 break; - case Otc::LastDatFlag: + case Otc::DatLastOpt: done = true; break; default: diff --git a/src/otclient/net/protocolgame.h b/src/otclient/net/protocolgame.h index ab358a20..09c7ec78 100644 --- a/src/otclient/net/protocolgame.h +++ b/src/otclient/net/protocolgame.h @@ -112,9 +112,6 @@ private: void parseOpenChannel(InputMessage& msg); void parseOpenPrivatePlayerChat(InputMessage& msg); void parseOpenRuleViolation(InputMessage& msg); - void parseRuleViolationAF(InputMessage& msg); - void parseRuleViolationB0(InputMessage& msg); - void parseRuleViolationB1(InputMessage& msg); void parseCreatePrivateChannel(InputMessage& msg); void parseClosePrivateChannel(InputMessage& msg); void parseSafeTradeRequest(InputMessage& msg); diff --git a/src/otclient/net/protocolgameparse.cpp b/src/otclient/net/protocolgameparse.cpp index ce278c27..9057e918 100644 --- a/src/otclient/net/protocolgameparse.cpp +++ b/src/otclient/net/protocolgameparse.cpp @@ -37,216 +37,216 @@ void ProtocolGame::parseMessage(InputMessage& msg) //dump << "protocol id:" << std::hex << (int)opt; switch(opt) { - case 0x0A: + case Otc::GameServerInitGame: parsePlayerLogin(msg); break; case 0x0B: parseGMActions(msg); break; - case 0x14: + case Otc::GameServerLoginError: parseErrorMessage(msg); break; - case 0x15: + case Otc::GameServerLoginAdvice: parseFYIMessage(msg); break; - case 0x16: + case Otc::GameServerLoginWait: parseWaitList(msg); break; - case 0x1E: + case Otc::GameServerPing: parsePing(msg); break; - case 0x28: + //case Otc::GameServerChallange: + case Otc::GameServerDead: parseDeath(msg); break; - case 0x32: - parseCanReportBugs(msg); - break; - case 0x64: + case Otc::GameServerFullMap: parseMapDescription(msg); break; - case 0x65: + case Otc::GameServerMapTopRow: parseMoveNorth(msg); break; - case 0x66: + case Otc::GameServerMapRightRow: parseMoveEast(msg); break; - case 0x67: + case Otc::GameServerMapBottomRow: parseMoveSouth(msg); break; - case 0x68: + case Otc::GameServerMapLeftRow: parseMoveWest(msg); break; - case 0x69: + case Otc::GameServerTileData: parseUpdateTile(msg); break; - case 0x6A: + case Otc::GameServerCreateOnMap: parseTileAddThing(msg); break; - case 0x6B: + case Otc::GameServerChangeOnMap: parseTileTransformThing(msg); break; - case 0x6C: + case Otc::GameServerDeleteOnMap: parseTileRemoveThing(msg); break; - case 0x6D: + case Otc::GameServerMoveCreature: parseCreatureMove(msg); break; - case 0x6E: + case Otc::GameServerOpenContainer: parseOpenContainer(msg); break; - case 0x6F: + case Otc::GameServerCloseContainer: parseCloseContainer(msg); break; - case 0x70: + case Otc::GameServerCreateContainer: parseContainerAddItem(msg); break; - case 0x71: + case Otc::GameServerChangeInContainer: parseContainerUpdateItem(msg); break; - case 0x72: + case Otc::GameServerDeleteInContainer: parseContainerRemoveItem(msg); break; - case 0x78: + case Otc::GameServerSetInventory: parseAddInventoryItem(msg); break; - case 0x79: + case Otc::GameServerDeleteInventory: parseRemoveInventoryItem(msg); break; - case 0x7A: + case Otc::GameServerNpcOffer: parseOpenShopWindow(msg); break; - case 0x7B: + case Otc::GameServerPlayerGoods: parsePlayerCash(msg); break; - case 0x7C: + case Otc::GameServerCloseNpcTrade: parseCloseShopWindow(msg); break; - case 0x7D: + case Otc::GameServerOwnOffer: parseSafeTradeRequest(msg); break; - case 0x7E: + case Otc::GameServerCounterOffer: parseSafeTradeRequest(msg); break; - case 0x7F: + case Otc::GameServerCloseTrade: parseSafeTradeClose(msg); break; - case 0x82: + case Otc::GameServerAmbient: parseWorldLight(msg); break; - case 0x83: + case Otc::GameServerGraphicalEffect: parseMagicEffect(msg); break; - case 0x84: + case Otc::GameServerTextEffect: parseAnimatedText(msg); break; - case 0x85: + case Otc::GameServerMissleEffect: parseDistanceShot(msg); break; - case 0x86: + case Otc::GameServerMarkCreature: parseCreatureSquare(msg); break; - case 0x8C: + //case Otc::GameServerTrappers + case Otc::GameServerCreatureHealth: parseCreatureHealth(msg); break; - case 0x8D: + case Otc::GameServerCreatureLight: parseCreatureLight(msg); break; - case 0x8E: + case Otc::GameServerCreatureOutfit: parseCreatureOutfit(msg); break; - case 0x8F: + case Otc::GameServerCreatureSpeed: parseCreatureSpeed(msg); break; - case 0x90: + case Otc::GameServerCreatureSkull: parseCreatureSkulls(msg); break; - case 0x91: + case Otc::GameServerCreatureParty: parseCreatureShields(msg); break; - case 0x96: + // case Otc::GameServerCreatureUnpass + case Otc::GameServerEditText: parseItemTextWindow(msg); break; - case 0x97: + case Otc::GameServerEditList: parseHouseTextWindow(msg); break; - case 0xA0: + case Otc::GameServerPlayerData: parsePlayerStats(msg); break; - case 0xA1: + case Otc::GameServerPlayerSkills: parsePlayerSkills(msg); break; - case 0xA2: + case Otc::GameServerPlayerState: parsePlayerIcons(msg); break; - case 0xA3: + case Otc::GameServerClearTarget: parsePlayerCancelAttack(msg); break; - case 0xAA: + //case Otc::GameServerSpellDelay: + //case Otc::GameServerSpellGroupDelay: + case Otc::GameServerTalk: parseCreatureSpeak(msg); break; - case 0xAB: + case Otc::GameServerChannels: parseChannelList(msg); break; - case 0xAC: + case Otc::GameServerOpenChannel: parseOpenChannel(msg); break; - case 0xAD: + case Otc::GameServerPrivateChannel: parseOpenPrivatePlayerChat(msg); break; - case 0xAE: + case Otc::GameServerRuleViolation: + case Otc::GameServerRuleViolation1: + case Otc::GameServerRuleViolation2: + case Otc::GameServerRuleViolation3: parseOpenRuleViolation(msg); break; - case 0xAF: - parseRuleViolationAF(msg); - break; - case 0xB0: - parseRuleViolationB0(msg); - break; - case 0xB1: - parseRuleViolationB1(msg); - break; - case 0xB2: + case Otc::GameServerOpenOwnChannel: parseCreatePrivateChannel(msg); break; - case 0xB3: + case Otc::GameServerCloseChannel: parseClosePrivateChannel(msg); break; - case 0xB4: + case Otc::GameServerMessage: parseTextMessage(msg); break; - case 0xB5: + case Otc::GameServerSnapBack: parseCancelWalk(msg); break; - case 0xBE: + //case Otc::GameServerWait: + case Otc::GameServerTopFloor: parseFloorChangeUp(msg); break; - case 0xBF: + case Otc::GameServerBottomFloor: parseFloorChangeDown(msg); break; - case 0xC8: + case Otc::GameServerOutfit: parseOutfitWindow(msg); break; - case 0xD2: + case Otc::GameServerBuddyData: parseVipState(msg); break; - case 0xD3: + case Otc::GameServerBuddyLogin: parseVipLogin(msg); break; - case 0xD4: + case Otc::GameServerBuddyLogout: parseVipLogout(msg); break; - case 0xDC: + case Otc::GameServerTutorialHint: parseShowTutorial(msg); break; - case 0xDD: + case Otc::GameServerAutomapFlag: parseAddMarker(msg); break; - case 0xF0: + case Otc::GameServerQuestLog: parseQuestList(msg); break; - case 0xF1: + case Otc::GameServerQuestLine: parseQuestPartList(msg); break; + //case Otc::GameServerChannelEvent: + //case Otc::GameServerObjectInfo: + //case Otc::GameServerPlayerInventory: default: logError("UNKNOWN PACKET OPT BYTE: 0x", std::hex, opt); break; @@ -299,11 +299,6 @@ void ProtocolGame::parseDeath(InputMessage&) } -void ProtocolGame::parseCanReportBugs(InputMessage& msg) -{ - msg.getU8(); // report bugs -} - void ProtocolGame::parseMapDescription(InputMessage& msg) { Position pos = parsePosition(msg); @@ -727,21 +722,6 @@ void ProtocolGame::parseOpenRuleViolation(InputMessage& msg) 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) { msg.getU16(); // channel id diff --git a/src/otclient/net/protocolgamesend.cpp b/src/otclient/net/protocolgamesend.cpp index 8a2076b2..640e17e3 100644 --- a/src/otclient/net/protocolgamesend.cpp +++ b/src/otclient/net/protocolgamesend.cpp @@ -27,9 +27,9 @@ void ProtocolGame::sendLoginPacket(uint32 timestamp, uint8 unknown) { OutputMessage oMsg; - oMsg.addU8(0x0A); // protocol id - oMsg.addU16(0x02); // os - oMsg.addU16(862); // client version + oMsg.addU8(Otc::ClientEnterGame); + oMsg.addU16(Otc::OsLinux); + oMsg.addU16(Otc::ClientVersion); oMsg.addU8(0); // first RSA byte must be 0 @@ -63,97 +63,97 @@ void ProtocolGame::sendLoginPacket(uint32 timestamp, uint8 unknown) void ProtocolGame::sendLogout() { OutputMessage oMsg; - oMsg.addU8(0x14); + oMsg.addU8(Otc::ClientQuitGame); send(oMsg); } void ProtocolGame::sendPing() { OutputMessage oMsg; - oMsg.addU8(0x1E); + oMsg.addU8(Otc::ClientPingBack); send(oMsg); } void ProtocolGame::sendWalkNorth() { OutputMessage oMsg; - oMsg.addU8(0x65); + oMsg.addU8(Otc::ClientGoNorth); send(oMsg); } void ProtocolGame::sendWalkEast() { OutputMessage oMsg; - oMsg.addU8(0x66); + oMsg.addU8(Otc::ClientGoEast); send(oMsg); } void ProtocolGame::sendWalkSouth() { OutputMessage oMsg; - oMsg.addU8(0x67); + oMsg.addU8(Otc::ClientGoSouth); send(oMsg); } void ProtocolGame::sendWalkWest() { OutputMessage oMsg; - oMsg.addU8(0x68); + oMsg.addU8(Otc::ClientGoWest); send(oMsg); } void ProtocolGame::sendWalkNorthEast() { OutputMessage oMsg; - oMsg.addU8(0x6A); + oMsg.addU8(Otc::ClientGoNorthEast); send(oMsg); } void ProtocolGame::sendWalkSouthEast() { OutputMessage oMsg; - oMsg.addU8(0x6B); + oMsg.addU8(Otc::ClientGoSouthEast); send(oMsg); } void ProtocolGame::sendWalkSouthWest() { OutputMessage oMsg; - oMsg.addU8(0x6C); + oMsg.addU8(Otc::ClientGoSouthWest); send(oMsg); } void ProtocolGame::sendWalkNorthWest() { OutputMessage oMsg; - oMsg.addU8(0x6D); + oMsg.addU8(Otc::ClientGoNorthWest); send(oMsg); } void ProtocolGame::sendTurnNorth() { OutputMessage oMsg; - oMsg.addU8(0x6F); + oMsg.addU8(Otc::ClientRotateNorth); send(oMsg); } void ProtocolGame::sendTurnEast() { OutputMessage oMsg; - oMsg.addU8(0x70); + oMsg.addU8(Otc::ClientRotateEast); send(oMsg); } void ProtocolGame::sendTurnSouth() { OutputMessage oMsg; - oMsg.addU8(0x71); + oMsg.addU8(Otc::ClientRotateSouth); send(oMsg); } void ProtocolGame::sendTurnWest() { OutputMessage oMsg; - oMsg.addU8(0x72); + oMsg.addU8(Otc::ClientRotateWest); send(oMsg); } diff --git a/src/otclient/net/protocollogin.cpp b/src/otclient/net/protocollogin.cpp index 537a3e50..d9677bcf 100644 --- a/src/otclient/net/protocollogin.cpp +++ b/src/otclient/net/protocollogin.cpp @@ -25,6 +25,8 @@ #include #include #include +#include +#include ProtocolLogin::ProtocolLogin() { @@ -57,16 +59,16 @@ void ProtocolLogin::onRecv(InputMessage& inputMessage) while(!inputMessage.eof()) { uint8 opt = inputMessage.getU8(); switch(opt) { - case 0x0A: + case Otc::LoginServerError: parseError(inputMessage); break; - case 0x14: + case Otc::LoginServerMotd: parseMOTD(inputMessage); break; - case 0x1e: + case Otc::LoginServerUpdateNeeded: callLuaField("onError", "Client needs update."); break; - case 0x64: + case Otc::LoginServerCharacterList: parseCharacterList(inputMessage); break; } @@ -83,13 +85,13 @@ void ProtocolLogin::sendLoginPacket() { OutputMessage oMsg; - oMsg.addU8(0x01); // protocol id - oMsg.addU16(0x02); // os - oMsg.addU16(862); // client version + oMsg.addU8(Otc::ClientEnterAccount); + oMsg.addU16(Otc::OsLinux); + oMsg.addU16(Otc::ClientVersion); - oMsg.addU32(0x4E12DAFF); // data signature - oMsg.addU32(0x4E12DB27); // sprite signature - oMsg.addU32(0x4E119CBF); // pic signature + oMsg.addU32(g_thingsType.getSignature()); // data signature + oMsg.addU32(g_sprites.getSignature()); // sprite signature + oMsg.addU32(Otc::PicSignature); // pic signature oMsg.addU8(0); // first RSA byte must be 0