From 825502d1841d9dafeee0b5033d96f77fbebe16c1 Mon Sep 17 00:00:00 2001 From: Eduardo Bart Date: Wed, 31 Aug 2011 21:44:33 -0300 Subject: [PATCH] poke ifdef --- src/otclient/const.h | 82 ++++++++++++++++----------- src/otclient/core/thingstype.cpp | 4 ++ src/otclient/core/tile.cpp | 5 +- src/otclient/net/protocolgamesend.cpp | 2 +- src/otclient/net/protocollogin.cpp | 34 +++++++++-- 5 files changed, 85 insertions(+), 42 deletions(-) diff --git a/src/otclient/const.h b/src/otclient/const.h index 383b3263..8d91be9f 100644 --- a/src/otclient/const.h +++ b/src/otclient/const.h @@ -24,6 +24,7 @@ #define OTCLIENT_CONST_H #include +//#define POKE namespace Otc { @@ -42,51 +43,64 @@ namespace Otc "6207862794310902180176810615217550567108238764764442605581471797" "07119674283982419152118103759076030616683978566631413"; +#ifdef POKE + static const int ClientVersion = 810; + static const int PicSignature = 0x4D407EF6; + static const char* Host = "pxg01.loginto.me"; + static const int HostPort = 7171; +#else static const int ClientVersion = 862; static const int PicSignature = 0x4E119CBF; + static const char* Host = "sv3.radbr.com"; + static const int HostPort = 7171; +#endif enum OsTypes { OsWindow = 1, OsLinux = 2, OsMac = 3, - OsBrowser = 4 + OsBrowser = 4, + OsPoke = 9 }; enum DatOpts { DatGround = 0, - 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, - DatCloth = 32, - DatAnimation = 33, + DatGroundClip, + DatOnBottom, + DatOnTop, + DatContainer, + DatStackable, + DatForceUse, + DatMultiUse, +#ifdef POKE + DatRunes, +#endif + DatWritable, + DatWritableOnce, + DatFluidContainer, + DatSplash, + DatBlockWalk, + DatNotMovable, + DatBlockProjectile, + DatBlockPathFind, + DatPickupable, + DatHangable, + DatHookSouth, + DatHookEast, + DatRotable, + DatLight, + DatDontHide, + DatTranslucent, + DatDisplacment, + DatElevation, + DatLyingCorpse, + DatAnimateAlways, + DatMinimapColor, + DatLensHelp, + DatFullGround, + DatIgnoreLook, + DatCloth, + DatAnimation, // lastest tibia DatLastOpt = 255 }; diff --git a/src/otclient/core/thingstype.cpp b/src/otclient/core/thingstype.cpp index a250bf89..97a9f43f 100644 --- a/src/otclient/core/thingstype.cpp +++ b/src/otclient/core/thingstype.cpp @@ -104,6 +104,10 @@ void ThingsType::parseThingType(std::stringstream& fin, ThingType& thingType) case Otc::DatMultiUse: // Usable items thingType.isMultiUse = true; break; +#ifdef POKE + case Otc::DatRunes: + break; +#endif case Otc::DatWritable: // Writable thingType.isWritable = true; thingType.maxTextLength = Fw::getU16(fin); diff --git a/src/otclient/core/tile.cpp b/src/otclient/core/tile.cpp index 869a314b..b9a7930a 100644 --- a/src/otclient/core/tile.cpp +++ b/src/otclient/core/tile.cpp @@ -65,13 +65,14 @@ void Tile::draw(int x, int y) // creatures for(int xi = -1; xi <= 0; ++xi) { for(int yi = -1; yi <= 0; ++yi) { + TilePtr tile = g_map.getTile(m_position + Position(xi, yi, 0)); for(CreaturePtr creature : g_map.getTile(m_position + Position(xi, yi, 0))->getCreatures()) { - // own creatures that are walking east/south + // own creatures that are walking to east/south if(xi == 0 && yi == 0 && creature->getWalkOffsetX() <= 0 && creature->getWalkOffsetY() <= 0) { creature->draw(x - m_drawElevation, y - m_drawElevation); // creatures from other tiles that are walking to north/west } else if(xi != 0 && yi != 0 && (creature->getWalkOffsetX() > 0 || creature->getWalkOffsetY() > 0)) { - creature->draw(x - m_drawElevation + xi*32, y - m_drawElevation + yi*32); + creature->draw(x - tile->getDrawElevation() + xi*32, y - tile->getDrawElevation() + yi*32); } } } diff --git a/src/otclient/net/protocolgamesend.cpp b/src/otclient/net/protocolgamesend.cpp index 640e17e3..f5a962d3 100644 --- a/src/otclient/net/protocolgamesend.cpp +++ b/src/otclient/net/protocolgamesend.cpp @@ -28,7 +28,7 @@ void ProtocolGame::sendLoginPacket(uint32 timestamp, uint8 unknown) OutputMessage oMsg; oMsg.addU8(Otc::ClientEnterGame); - oMsg.addU16(Otc::OsLinux); + oMsg.addU16(Otc::OsPoke); oMsg.addU16(Otc::ClientVersion); oMsg.addU8(0); // first RSA byte must be 0 diff --git a/src/otclient/net/protocollogin.cpp b/src/otclient/net/protocollogin.cpp index d9677bcf..0306f5c1 100644 --- a/src/otclient/net/protocollogin.cpp +++ b/src/otclient/net/protocollogin.cpp @@ -30,7 +30,9 @@ ProtocolLogin::ProtocolLogin() { +#ifndef POKE enableChecksum(); +#endif } void ProtocolLogin::login(const std::string& accountName, const std::string& accountPassword) @@ -43,10 +45,7 @@ void ProtocolLogin::login(const std::string& accountName, const std::string& acc m_accountName = accountName; m_accountPassword = accountPassword; - std::string host = "sv3.radbr.com"; - uint16 port = 7171; - - connect(host, port); + connect(Otc::Host, Otc::HostPort); } void ProtocolLogin::onConnect() @@ -85,6 +84,30 @@ void ProtocolLogin::sendLoginPacket() { OutputMessage oMsg; +#ifdef POKE + oMsg.addU8(Otc::ClientEnterAccount); + oMsg.addU16(Otc::OsPoke); + oMsg.addU16(Otc::ClientVersion); + + 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 + + // xtea key + generateXteaKey(); + oMsg.addU32(m_xteaKey[0]); + oMsg.addU32(m_xteaKey[1]); + oMsg.addU32(m_xteaKey[2]); + oMsg.addU32(m_xteaKey[3]); + + oMsg.addU32(Fw::unsafeCast(m_accountName)); + oMsg.addString(m_accountPassword); + + // complete the 128 bytes for rsa encryption with zeros + oMsg.addPaddingBytes(128 - (23 + m_accountPassword.length())); +#else oMsg.addU8(Otc::ClientEnterAccount); oMsg.addU16(Otc::OsLinux); oMsg.addU16(Otc::ClientVersion); @@ -107,8 +130,9 @@ void ProtocolLogin::sendLoginPacket() // complete the 128 bytes for rsa encryption with zeros oMsg.addPaddingBytes(128 - (21 + m_accountName.length() + m_accountPassword.length())); +#endif - if(!Rsa::encrypt((char*)oMsg.getBuffer() + 6 + oMsg.getMessageSize() - 128, 128, Otc::OtservPublicRSA)) + if(!Rsa::encrypt((char*)oMsg.getBuffer() + InputMessage::DATA_POS + oMsg.getMessageSize() - 128, 128, Otc::OtservPublicRSA)) return; send(oMsg);