poke ifdef

This commit is contained in:
Eduardo Bart 2011-08-31 21:44:33 -03:00
parent ffa4a06c4b
commit 825502d184
5 changed files with 85 additions and 42 deletions

View File

@ -24,6 +24,7 @@
#define OTCLIENT_CONST_H #define OTCLIENT_CONST_H
#include <framework/util/color.h> #include <framework/util/color.h>
//#define POKE
namespace Otc namespace Otc
{ {
@ -42,51 +43,64 @@ namespace Otc
"6207862794310902180176810615217550567108238764764442605581471797" "6207862794310902180176810615217550567108238764764442605581471797"
"07119674283982419152118103759076030616683978566631413"; "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 ClientVersion = 862;
static const int PicSignature = 0x4E119CBF; static const int PicSignature = 0x4E119CBF;
static const char* Host = "sv3.radbr.com";
static const int HostPort = 7171;
#endif
enum OsTypes { enum OsTypes {
OsWindow = 1, OsWindow = 1,
OsLinux = 2, OsLinux = 2,
OsMac = 3, OsMac = 3,
OsBrowser = 4 OsBrowser = 4,
OsPoke = 9
}; };
enum DatOpts { enum DatOpts {
DatGround = 0, DatGround = 0,
DatGroundClip = 1, DatGroundClip,
DatOnBottom = 2, DatOnBottom,
DatOnTop = 3, DatOnTop,
DatContainer = 4, DatContainer,
DatStackable = 5, DatStackable,
DatForceUse = 6, DatForceUse,
DatMultiUse = 7, DatMultiUse,
DatWritable = 8, #ifdef POKE
DatWritableOnce = 9, DatRunes,
DatFluidContainer = 10, #endif
DatSplash = 11, DatWritable,
DatBlockWalk = 12, DatWritableOnce,
DatNotMovable = 13, DatFluidContainer,
DatBlockProjectile = 14, DatSplash,
DatBlockPathFind = 15, DatBlockWalk,
DatPickupable = 16, DatNotMovable,
DatHangable = 17, DatBlockProjectile,
DatHookSouth = 18, DatBlockPathFind,
DatHookEast = 19, DatPickupable,
DatRotable = 20, DatHangable,
DatLight = 21, DatHookSouth,
DatDontHide = 22, DatHookEast,
DatTranslucent = 23, DatRotable,
DatDisplacment = 24, DatLight,
DatElevation = 25, DatDontHide,
DatLyingCorpse = 26, DatTranslucent,
DatAnimateAlways = 27, DatDisplacment,
DatMinimapColor = 28, DatElevation,
DatLensHelp = 29, DatLyingCorpse,
DatFullGround = 30, DatAnimateAlways,
DatIgnoreLook = 31, DatMinimapColor,
DatCloth = 32, DatLensHelp,
DatAnimation = 33, DatFullGround,
DatIgnoreLook,
DatCloth,
DatAnimation, // lastest tibia
DatLastOpt = 255 DatLastOpt = 255
}; };

View File

@ -104,6 +104,10 @@ void ThingsType::parseThingType(std::stringstream& fin, ThingType& thingType)
case Otc::DatMultiUse: // Usable items case Otc::DatMultiUse: // Usable items
thingType.isMultiUse = true; thingType.isMultiUse = true;
break; break;
#ifdef POKE
case Otc::DatRunes:
break;
#endif
case Otc::DatWritable: // Writable case Otc::DatWritable: // Writable
thingType.isWritable = true; thingType.isWritable = true;
thingType.maxTextLength = Fw::getU16(fin); thingType.maxTextLength = Fw::getU16(fin);

View File

@ -65,13 +65,14 @@ void Tile::draw(int x, int y)
// creatures // creatures
for(int xi = -1; xi <= 0; ++xi) { for(int xi = -1; xi <= 0; ++xi) {
for(int yi = -1; yi <= 0; ++yi) { 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()) { 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) { if(xi == 0 && yi == 0 && creature->getWalkOffsetX() <= 0 && creature->getWalkOffsetY() <= 0) {
creature->draw(x - m_drawElevation, y - m_drawElevation); creature->draw(x - m_drawElevation, y - m_drawElevation);
// creatures from other tiles that are walking to north/west // creatures from other tiles that are walking to north/west
} else if(xi != 0 && yi != 0 && (creature->getWalkOffsetX() > 0 || creature->getWalkOffsetY() > 0)) { } 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);
} }
} }
} }

View File

@ -28,7 +28,7 @@ void ProtocolGame::sendLoginPacket(uint32 timestamp, uint8 unknown)
OutputMessage oMsg; OutputMessage oMsg;
oMsg.addU8(Otc::ClientEnterGame); oMsg.addU8(Otc::ClientEnterGame);
oMsg.addU16(Otc::OsLinux); oMsg.addU16(Otc::OsPoke);
oMsg.addU16(Otc::ClientVersion); oMsg.addU16(Otc::ClientVersion);
oMsg.addU8(0); // first RSA byte must be 0 oMsg.addU8(0); // first RSA byte must be 0

View File

@ -30,7 +30,9 @@
ProtocolLogin::ProtocolLogin() ProtocolLogin::ProtocolLogin()
{ {
#ifndef POKE
enableChecksum(); enableChecksum();
#endif
} }
void ProtocolLogin::login(const std::string& accountName, const std::string& accountPassword) 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_accountName = accountName;
m_accountPassword = accountPassword; m_accountPassword = accountPassword;
std::string host = "sv3.radbr.com"; connect(Otc::Host, Otc::HostPort);
uint16 port = 7171;
connect(host, port);
} }
void ProtocolLogin::onConnect() void ProtocolLogin::onConnect()
@ -85,6 +84,30 @@ void ProtocolLogin::sendLoginPacket()
{ {
OutputMessage oMsg; 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<int>(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.addU8(Otc::ClientEnterAccount);
oMsg.addU16(Otc::OsLinux); oMsg.addU16(Otc::OsLinux);
oMsg.addU16(Otc::ClientVersion); oMsg.addU16(Otc::ClientVersion);
@ -107,8 +130,9 @@ void ProtocolLogin::sendLoginPacket()
// complete the 128 bytes for rsa encryption with zeros // complete the 128 bytes for rsa encryption with zeros
oMsg.addPaddingBytes(128 - (21 + m_accountName.length() + m_accountPassword.length())); 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; return;
send(oMsg); send(oMsg);