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
#include <framework/util/color.h>
//#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
};

View File

@ -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);

View File

@ -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);
}
}
}

View File

@ -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

View File

@ -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<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.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);