mirror of
https://github.com/edubart/otclient.git
synced 2025-10-16 04:24:54 +02:00
protocol login at lua
This commit is contained in:
@@ -151,6 +151,15 @@ void Protocol::generateXteaKey()
|
||||
m_xteaKey[3] = unif(eng);
|
||||
}
|
||||
|
||||
std::vector<int> Protocol::getXteaKey()
|
||||
{
|
||||
std::vector<int> xteaKey;
|
||||
xteaKey.resize(4);
|
||||
for(int i = 0; i < 4; ++i)
|
||||
xteaKey[i] = m_xteaKey[i];
|
||||
return xteaKey;
|
||||
}
|
||||
|
||||
bool Protocol::xteaDecrypt(const InputMessagePtr& inputMessage)
|
||||
{
|
||||
uint16 encryptedSize = inputMessage->getUnreadSize();
|
||||
@@ -215,3 +224,8 @@ void Protocol::xteaEncrypt(const OutputMessagePtr& outputMessage)
|
||||
readPos = readPos + 2;
|
||||
}
|
||||
}
|
||||
|
||||
void Protocol::onConnect()
|
||||
{
|
||||
callLuaField("onConnect");
|
||||
}
|
||||
|
@@ -41,20 +41,21 @@ public:
|
||||
bool isConnected();
|
||||
bool isConnecting();
|
||||
|
||||
void generateXteaKey();
|
||||
std::vector<int> getXteaKey();
|
||||
void enableXteaEncryption() { m_xteaEncryptionEnabled = true; }
|
||||
|
||||
void enableChecksum() { m_checksumEnabled = true; }
|
||||
|
||||
virtual void send(const OutputMessagePtr& outputMessage);
|
||||
void recv();
|
||||
|
||||
ProtocolPtr asProtocol() { return std::static_pointer_cast<Protocol>(shared_from_this()); }
|
||||
|
||||
protected:
|
||||
void recv();
|
||||
|
||||
virtual void onConnect() = 0;
|
||||
virtual void onRecv(const InputMessagePtr& inputMessage) = 0;
|
||||
virtual void onError(const boost::system::error_code& err) = 0;
|
||||
|
||||
void enableChecksum() { m_checksumEnabled = true; }
|
||||
void enableXteaEncryption() { m_xteaEncryptionEnabled = true; }
|
||||
void generateXteaKey();
|
||||
virtual void onConnect();
|
||||
virtual void onRecv(const InputMessagePtr& inputMessage) {}
|
||||
virtual void onError(const boost::system::error_code& err) {}
|
||||
|
||||
uint32 m_xteaKey[4];
|
||||
|
||||
|
Reference in New Issue
Block a user