2011-08-28 15:17:58 +02:00
|
|
|
/*
|
2012-01-02 17:58:37 +01:00
|
|
|
* Copyright (c) 2010-2012 OTClient <https://github.com/edubart/otclient>
|
2011-08-28 15:17:58 +02:00
|
|
|
*
|
|
|
|
* 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.
|
|
|
|
*/
|
|
|
|
|
2011-08-15 16:11:24 +02:00
|
|
|
#include "protocolgame.h"
|
2012-05-14 23:36:54 +02:00
|
|
|
#include <otclient/core/game.h>
|
|
|
|
|
2012-05-15 02:04:04 +02:00
|
|
|
void ProtocolGame::safeSend(const OutputMessagePtr& outputMessage)
|
2012-05-14 23:36:54 +02:00
|
|
|
{
|
|
|
|
// avoid usage of automated sends (bot modules)
|
|
|
|
if(!g_game.checkBotProtection())
|
|
|
|
return;
|
|
|
|
Protocol::send(outputMessage);
|
|
|
|
}
|
|
|
|
|
|
|
|
void ProtocolGame::sendExtendedOpcode(uint8 opcode, const std::string& buffer)
|
|
|
|
{
|
2012-05-17 17:24:41 +02:00
|
|
|
if(m_enableSendExtendedOpcode) {
|
|
|
|
OutputMessagePtr msg(new OutputMessage);
|
|
|
|
msg->addU8(Proto::ClientExtendedOpcode);
|
|
|
|
msg->addU8(opcode);
|
|
|
|
msg->addString(buffer);
|
|
|
|
safeSend(msg);
|
2012-05-28 15:06:26 +02:00
|
|
|
} else {
|
2012-05-29 00:04:44 +02:00
|
|
|
logError("Unable to send extended opcode %d, extended opcodes are not enabled", opcode);
|
2012-05-17 17:24:41 +02:00
|
|
|
}
|
2012-05-14 23:36:54 +02:00
|
|
|
}
|
2011-08-16 02:30:31 +02:00
|
|
|
|
2012-05-12 06:52:16 +02:00
|
|
|
void ProtocolGame::sendLoginPacket(uint challangeTimestamp, uint8 challangeRandom)
|
2011-08-16 02:30:31 +02:00
|
|
|
{
|
2012-05-14 23:36:54 +02:00
|
|
|
OutputMessagePtr msg(new OutputMessage);
|
2011-08-16 02:30:31 +02:00
|
|
|
|
2012-05-14 23:36:54 +02:00
|
|
|
msg->addU8(Proto::ClientEnterGame);
|
|
|
|
msg->addU16(Proto::ClientOs);
|
|
|
|
msg->addU16(Proto::ClientVersion);
|
2012-02-08 22:23:15 +01:00
|
|
|
|
2012-05-11 20:02:57 +02:00
|
|
|
int paddingBytes = 128;
|
2012-05-14 23:36:54 +02:00
|
|
|
msg->addU8(0); // first RSA byte must be 0
|
2012-05-11 20:02:57 +02:00
|
|
|
paddingBytes -= 1;
|
2011-08-16 02:30:31 +02:00
|
|
|
|
2011-08-16 05:27:46 +02:00
|
|
|
// xtea key
|
|
|
|
generateXteaKey();
|
2012-05-14 23:36:54 +02:00
|
|
|
msg->addU32(m_xteaKey[0]);
|
|
|
|
msg->addU32(m_xteaKey[1]);
|
|
|
|
msg->addU32(m_xteaKey[2]);
|
|
|
|
msg->addU32(m_xteaKey[3]);
|
|
|
|
msg->addU8(0); // is gm set?
|
2012-05-11 20:02:57 +02:00
|
|
|
paddingBytes -= 17;
|
|
|
|
|
2012-05-29 00:04:44 +02:00
|
|
|
if(g_game.getFeature(Otc::GameProtocolChecksum))
|
|
|
|
enableChecksum();
|
|
|
|
|
|
|
|
if(g_game.getFeature(Otc::GameAccountNames)) {
|
|
|
|
msg->addString(m_accountName);
|
|
|
|
msg->addString(m_characterName);
|
|
|
|
msg->addString(m_accountPassword);
|
|
|
|
paddingBytes -= 6 + m_accountName.length() + m_characterName.length() + m_accountPassword.length();
|
|
|
|
} else {
|
|
|
|
msg->addU32(stdext::from_string<uint32>(m_accountName));
|
|
|
|
msg->addString(m_characterName);
|
|
|
|
msg->addString(m_accountPassword);
|
|
|
|
paddingBytes -= 8 + m_characterName.length() + m_accountPassword.length();
|
|
|
|
}
|
|
|
|
|
|
|
|
if(g_game.getFeature(Otc::GameChallangeOnLogin)) {
|
|
|
|
msg->addU32(challangeTimestamp);
|
|
|
|
msg->addU8(challangeRandom);
|
|
|
|
paddingBytes -= 5;
|
|
|
|
}
|
2011-08-16 02:30:31 +02:00
|
|
|
|
2011-08-16 06:24:20 +02:00
|
|
|
// complete the 128 bytes for rsa encryption with zeros
|
2012-05-14 23:36:54 +02:00
|
|
|
msg->addPaddingBytes(paddingBytes);
|
2011-08-16 02:30:31 +02:00
|
|
|
|
2011-08-16 05:27:46 +02:00
|
|
|
// encrypt with RSA
|
2012-05-14 23:36:54 +02:00
|
|
|
msg->encryptRSA(128, Proto::RSA);
|
2011-08-16 02:30:31 +02:00
|
|
|
|
2012-02-08 22:23:15 +01:00
|
|
|
send(msg);
|
2011-08-16 02:30:31 +02:00
|
|
|
|
2011-08-16 05:27:46 +02:00
|
|
|
enableXteaEncryption();
|
2011-08-16 02:30:31 +02:00
|
|
|
}
|
2011-08-15 16:11:24 +02:00
|
|
|
|
|
|
|
void ProtocolGame::sendLogout()
|
|
|
|
{
|
2012-05-14 23:36:54 +02:00
|
|
|
OutputMessagePtr msg(new OutputMessage);
|
|
|
|
msg->addU8(Proto::ClientLeaveGame);
|
2012-02-08 22:23:15 +01:00
|
|
|
send(msg);
|
2011-08-15 16:11:24 +02:00
|
|
|
}
|
|
|
|
|
2012-05-12 13:55:22 +02:00
|
|
|
void ProtocolGame::sendPing()
|
|
|
|
{
|
2012-05-14 23:36:54 +02:00
|
|
|
OutputMessagePtr msg(new OutputMessage);
|
|
|
|
msg->addU8(Proto::ClientPing);
|
2012-05-12 13:55:22 +02:00
|
|
|
send(msg);
|
|
|
|
}
|
|
|
|
|
|
|
|
void ProtocolGame::sendPingBack()
|
2011-08-15 16:11:24 +02:00
|
|
|
{
|
2012-05-14 23:36:54 +02:00
|
|
|
OutputMessagePtr msg(new OutputMessage);
|
|
|
|
msg->addU8(Proto::ClientPingBack);
|
2012-02-08 22:23:15 +01:00
|
|
|
send(msg);
|
2011-08-15 16:11:24 +02:00
|
|
|
}
|
|
|
|
|
2012-03-23 15:48:00 +01:00
|
|
|
void ProtocolGame::sendAutoWalk(const std::vector<Otc::Direction>& path)
|
2012-02-08 22:23:15 +01:00
|
|
|
{
|
2012-05-14 23:36:54 +02:00
|
|
|
OutputMessagePtr msg(new OutputMessage);
|
|
|
|
msg->addU8(Proto::ClientAutoWalk);
|
|
|
|
msg->addU8(path.size());
|
2012-03-23 15:48:00 +01:00
|
|
|
for(Otc::Direction dir : path) {
|
|
|
|
uint8 byte;
|
|
|
|
switch(dir) {
|
|
|
|
case Otc::East:
|
|
|
|
byte = 1;
|
|
|
|
break;
|
|
|
|
case Otc::NorthEast:
|
|
|
|
byte = 2;
|
|
|
|
break;
|
|
|
|
case Otc::North:
|
|
|
|
byte = 3;
|
|
|
|
break;
|
|
|
|
case Otc::NorthWest:
|
|
|
|
byte = 4;
|
|
|
|
break;
|
|
|
|
case Otc::West:
|
|
|
|
byte = 5;
|
|
|
|
break;
|
|
|
|
case Otc::SouthWest:
|
|
|
|
byte = 6;
|
|
|
|
break;
|
|
|
|
case Otc::South:
|
|
|
|
byte = 7;
|
|
|
|
break;
|
|
|
|
case Otc::SouthEast:
|
|
|
|
byte = 8;
|
|
|
|
break;
|
|
|
|
default:
|
|
|
|
byte = 0;
|
|
|
|
break;
|
|
|
|
}
|
2012-05-14 23:36:54 +02:00
|
|
|
msg->addU8(byte);
|
2012-03-23 15:48:00 +01:00
|
|
|
}
|
2012-02-08 22:23:15 +01:00
|
|
|
send(msg);
|
|
|
|
}
|
2012-01-02 23:23:54 +01:00
|
|
|
|
2011-08-15 16:11:24 +02:00
|
|
|
void ProtocolGame::sendWalkNorth()
|
|
|
|
{
|
2012-05-14 23:36:54 +02:00
|
|
|
OutputMessagePtr msg(new OutputMessage);
|
|
|
|
msg->addU8(Proto::ClientWalkNorth);
|
2012-02-08 22:23:15 +01:00
|
|
|
send(msg);
|
2011-08-15 16:11:24 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
void ProtocolGame::sendWalkEast()
|
|
|
|
{
|
2012-05-14 23:36:54 +02:00
|
|
|
OutputMessagePtr msg(new OutputMessage);
|
|
|
|
msg->addU8(Proto::ClientWalkEast);
|
2012-02-08 22:23:15 +01:00
|
|
|
send(msg);
|
2011-08-15 16:11:24 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
void ProtocolGame::sendWalkSouth()
|
|
|
|
{
|
2012-05-14 23:36:54 +02:00
|
|
|
OutputMessagePtr msg(new OutputMessage);
|
|
|
|
msg->addU8(Proto::ClientWalkSouth);
|
2012-02-08 22:23:15 +01:00
|
|
|
send(msg);
|
2011-08-15 16:11:24 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
void ProtocolGame::sendWalkWest()
|
|
|
|
{
|
2012-05-14 23:36:54 +02:00
|
|
|
OutputMessagePtr msg(new OutputMessage);
|
|
|
|
msg->addU8(Proto::ClientWalkWest);
|
2012-02-08 22:23:15 +01:00
|
|
|
send(msg);
|
2011-08-15 16:11:24 +02:00
|
|
|
}
|
|
|
|
|
2012-02-08 22:23:15 +01:00
|
|
|
void ProtocolGame::sendStop()
|
2012-01-02 23:23:54 +01:00
|
|
|
{
|
2012-05-14 23:36:54 +02:00
|
|
|
OutputMessagePtr msg(new OutputMessage);
|
|
|
|
msg->addU8(Proto::ClientStop);
|
2012-02-08 22:23:15 +01:00
|
|
|
send(msg);
|
2012-01-02 23:23:54 +01:00
|
|
|
}
|
|
|
|
|
2011-08-29 07:54:28 +02:00
|
|
|
void ProtocolGame::sendWalkNorthEast()
|
|
|
|
{
|
2012-05-14 23:36:54 +02:00
|
|
|
OutputMessagePtr msg(new OutputMessage);
|
|
|
|
msg->addU8(Proto::ClientWalkNorthEast);
|
2012-02-08 22:23:15 +01:00
|
|
|
send(msg);
|
2011-08-29 07:54:28 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
void ProtocolGame::sendWalkSouthEast()
|
|
|
|
{
|
2012-05-14 23:36:54 +02:00
|
|
|
OutputMessagePtr msg(new OutputMessage);
|
|
|
|
msg->addU8(Proto::ClientWalkSouthEast);
|
2012-02-08 22:23:15 +01:00
|
|
|
send(msg);
|
2011-08-29 07:54:28 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
void ProtocolGame::sendWalkSouthWest()
|
|
|
|
{
|
2012-05-14 23:36:54 +02:00
|
|
|
OutputMessagePtr msg(new OutputMessage);
|
|
|
|
msg->addU8(Proto::ClientWalkSouthWest);
|
2012-02-08 22:23:15 +01:00
|
|
|
send(msg);
|
2011-08-29 07:54:28 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
void ProtocolGame::sendWalkNorthWest()
|
|
|
|
{
|
2012-05-14 23:36:54 +02:00
|
|
|
OutputMessagePtr msg(new OutputMessage);
|
|
|
|
msg->addU8(Proto::ClientWalkNorthWest);
|
2012-02-08 22:23:15 +01:00
|
|
|
send(msg);
|
2011-08-29 07:54:28 +02:00
|
|
|
}
|
|
|
|
|
2011-08-17 06:45:55 +02:00
|
|
|
void ProtocolGame::sendTurnNorth()
|
|
|
|
{
|
2012-05-14 23:36:54 +02:00
|
|
|
OutputMessagePtr msg(new OutputMessage);
|
|
|
|
msg->addU8(Proto::ClientTurnNorth);
|
2012-02-08 22:23:15 +01:00
|
|
|
send(msg);
|
2011-08-17 06:45:55 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
void ProtocolGame::sendTurnEast()
|
|
|
|
{
|
2012-05-14 23:36:54 +02:00
|
|
|
OutputMessagePtr msg(new OutputMessage);
|
|
|
|
msg->addU8(Proto::ClientTurnEast);
|
2012-02-08 22:23:15 +01:00
|
|
|
send(msg);
|
2011-08-17 06:45:55 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
void ProtocolGame::sendTurnSouth()
|
|
|
|
{
|
2012-05-14 23:36:54 +02:00
|
|
|
OutputMessagePtr msg(new OutputMessage);
|
|
|
|
msg->addU8(Proto::ClientTurnSouth);
|
2012-02-08 22:23:15 +01:00
|
|
|
send(msg);
|
2011-08-17 06:45:55 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
void ProtocolGame::sendTurnWest()
|
|
|
|
{
|
2012-05-14 23:36:54 +02:00
|
|
|
OutputMessagePtr msg(new OutputMessage);
|
|
|
|
msg->addU8(Proto::ClientTurnWest);
|
2012-02-08 22:23:15 +01:00
|
|
|
send(msg);
|
2011-08-17 06:45:55 +02:00
|
|
|
}
|
2011-09-03 00:52:40 +02:00
|
|
|
|
2012-05-12 13:55:22 +02:00
|
|
|
void ProtocolGame::sendEquipItem(int itemId, int countOrSubType)
|
|
|
|
{
|
2012-05-14 23:36:54 +02:00
|
|
|
OutputMessagePtr msg(new OutputMessage);
|
|
|
|
msg->addU8(Proto::ClientEquipItem);
|
|
|
|
msg->addU16(itemId);
|
|
|
|
msg->addU8(countOrSubType);
|
2012-05-12 13:55:22 +02:00
|
|
|
send(msg);
|
|
|
|
}
|
|
|
|
|
2012-02-08 22:23:15 +01:00
|
|
|
void ProtocolGame::sendMove(const Position& fromPos, int thingId, int stackpos, const Position& toPos, int count)
|
2012-01-02 23:23:54 +01:00
|
|
|
{
|
2012-05-14 23:36:54 +02:00
|
|
|
OutputMessagePtr msg(new OutputMessage);
|
|
|
|
msg->addU8(Proto::ClientMove);
|
2012-02-08 22:23:15 +01:00
|
|
|
addPosition(msg, fromPos);
|
2012-05-14 23:36:54 +02:00
|
|
|
msg->addU16(thingId);
|
|
|
|
msg->addU8(stackpos);
|
2012-02-08 22:23:15 +01:00
|
|
|
addPosition(msg, toPos);
|
2012-05-14 23:36:54 +02:00
|
|
|
msg->addU8(count);
|
2012-02-08 22:23:15 +01:00
|
|
|
send(msg);
|
2012-01-02 23:23:54 +01:00
|
|
|
}
|
|
|
|
|
2012-02-09 04:45:19 +01:00
|
|
|
void ProtocolGame::sendInspectNpcTrade(int itemId, int count)
|
2012-01-02 23:23:54 +01:00
|
|
|
{
|
2012-05-14 23:36:54 +02:00
|
|
|
OutputMessagePtr msg(new OutputMessage);
|
|
|
|
msg->addU8(Proto::ClientInspectNpcTrade);
|
|
|
|
msg->addU16(itemId);
|
|
|
|
msg->addU8(count);
|
2012-02-08 22:23:15 +01:00
|
|
|
send(msg);
|
2012-01-02 23:23:54 +01:00
|
|
|
}
|
|
|
|
|
2012-04-28 02:44:55 +02:00
|
|
|
void ProtocolGame::sendBuyItem(int itemId, int subType, int amount, bool ignoreCapacity, bool buyWithBackpack)
|
2012-01-02 23:23:54 +01:00
|
|
|
{
|
2012-05-14 23:36:54 +02:00
|
|
|
OutputMessagePtr msg(new OutputMessage);
|
|
|
|
msg->addU8(Proto::ClientBuyItem);
|
|
|
|
msg->addU16(itemId);
|
|
|
|
msg->addU8(subType);
|
|
|
|
msg->addU8(amount);
|
|
|
|
msg->addU8(ignoreCapacity ? 0x01 : 0x00);
|
|
|
|
msg->addU8(buyWithBackpack ? 0x01 : 0x00);
|
2012-02-08 22:23:15 +01:00
|
|
|
send(msg);
|
2012-01-02 23:23:54 +01:00
|
|
|
}
|
|
|
|
|
2012-04-28 02:44:55 +02:00
|
|
|
void ProtocolGame::sendSellItem(int itemId, int subType, int amount, bool ignoreEquipped)
|
2012-01-02 23:23:54 +01:00
|
|
|
{
|
2012-05-14 23:36:54 +02:00
|
|
|
OutputMessagePtr msg(new OutputMessage);
|
|
|
|
msg->addU8(Proto::ClientSellItem);
|
|
|
|
msg->addU16(itemId);
|
|
|
|
msg->addU8(subType);
|
|
|
|
msg->addU8(amount);
|
|
|
|
msg->addU8(ignoreEquipped ? 0x01 : 0x00);
|
2012-02-08 22:23:15 +01:00
|
|
|
send(msg);
|
2012-01-02 23:23:54 +01:00
|
|
|
}
|
|
|
|
|
2012-02-08 22:23:15 +01:00
|
|
|
void ProtocolGame::sendCloseNpcTrade()
|
2012-01-02 23:23:54 +01:00
|
|
|
{
|
2012-05-14 23:36:54 +02:00
|
|
|
OutputMessagePtr msg(new OutputMessage);
|
|
|
|
msg->addU8(Proto::ClientCloseNpcTrade);
|
2012-02-08 22:23:15 +01:00
|
|
|
send(msg);
|
2012-01-02 23:23:54 +01:00
|
|
|
}
|
|
|
|
|
2012-02-09 04:45:19 +01:00
|
|
|
void ProtocolGame::sendRequestTrade(const Position& pos, int thingId, int stackpos, uint creatureId)
|
2012-01-02 23:23:54 +01:00
|
|
|
{
|
2012-05-14 23:36:54 +02:00
|
|
|
OutputMessagePtr msg(new OutputMessage);
|
|
|
|
msg->addU8(Proto::ClientRequestTrade);
|
2012-02-08 22:23:15 +01:00
|
|
|
addPosition(msg, pos);
|
2012-05-14 23:36:54 +02:00
|
|
|
msg->addU16(thingId);
|
|
|
|
msg->addU8(stackpos);
|
|
|
|
msg->addU32(creatureId);
|
2012-02-08 22:23:15 +01:00
|
|
|
send(msg);
|
2012-01-02 23:23:54 +01:00
|
|
|
}
|
|
|
|
|
2012-02-08 22:23:15 +01:00
|
|
|
void ProtocolGame::sendInspectTrade(bool counterOffer, int index)
|
2012-01-02 23:23:54 +01:00
|
|
|
{
|
2012-05-14 23:36:54 +02:00
|
|
|
OutputMessagePtr msg(new OutputMessage);
|
|
|
|
msg->addU8(Proto::ClientInspectTrade);
|
|
|
|
msg->addU8(counterOffer ? 0x01 : 0x00);
|
|
|
|
msg->addU8(index);
|
2012-02-08 22:23:15 +01:00
|
|
|
send(msg);
|
2012-01-02 23:23:54 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
void ProtocolGame::sendAcceptTrade()
|
|
|
|
{
|
2012-05-14 23:36:54 +02:00
|
|
|
OutputMessagePtr msg(new OutputMessage);
|
|
|
|
msg->addU8(Proto::ClientAcceptTrade);
|
2012-02-08 22:23:15 +01:00
|
|
|
send(msg);
|
2012-01-02 23:23:54 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
void ProtocolGame::sendRejectTrade()
|
|
|
|
{
|
2012-05-14 23:36:54 +02:00
|
|
|
OutputMessagePtr msg(new OutputMessage);
|
|
|
|
msg->addU8(Proto::ClientRejectTrade);
|
2012-02-08 22:23:15 +01:00
|
|
|
send(msg);
|
2012-01-02 23:23:54 +01:00
|
|
|
}
|
|
|
|
|
2011-11-10 07:53:16 +01:00
|
|
|
void ProtocolGame::sendUseItem(const Position& position, int itemId, int stackpos, int index)
|
|
|
|
{
|
2012-05-14 23:36:54 +02:00
|
|
|
OutputMessagePtr msg(new OutputMessage);
|
|
|
|
msg->addU8(Proto::ClientUseItem);
|
2012-02-08 22:23:15 +01:00
|
|
|
addPosition(msg, position);
|
2012-05-14 23:36:54 +02:00
|
|
|
msg->addU16(itemId);
|
|
|
|
msg->addU8(stackpos);
|
|
|
|
msg->addU8(index);
|
2012-02-08 22:23:15 +01:00
|
|
|
send(msg);
|
2011-11-10 07:53:16 +01:00
|
|
|
}
|
|
|
|
|
2012-02-08 22:23:15 +01:00
|
|
|
void ProtocolGame::sendUseItemWith(const Position& fromPos, int itemId, int fromStackpos, const Position& toPos, int toThingId, int toStackpos)
|
2012-01-03 14:13:54 +01:00
|
|
|
{
|
2012-05-14 23:36:54 +02:00
|
|
|
OutputMessagePtr msg(new OutputMessage);
|
|
|
|
msg->addU8(Proto::ClientUseItemWith);
|
2012-02-08 22:23:15 +01:00
|
|
|
addPosition(msg, fromPos);
|
2012-05-14 23:36:54 +02:00
|
|
|
msg->addU16(itemId);
|
|
|
|
msg->addU8(fromStackpos);
|
2012-02-08 22:23:15 +01:00
|
|
|
addPosition(msg, toPos);
|
2012-05-14 23:36:54 +02:00
|
|
|
msg->addU16(toThingId);
|
|
|
|
msg->addU8(toStackpos);
|
2012-02-08 22:23:15 +01:00
|
|
|
send(msg);
|
2012-01-03 14:13:54 +01:00
|
|
|
}
|
2012-01-02 23:23:54 +01:00
|
|
|
|
2012-01-17 23:28:55 +01:00
|
|
|
void ProtocolGame::sendUseOnCreature(const Position& pos, int thingId, int stackpos, uint creatureId)
|
2012-01-03 14:13:54 +01:00
|
|
|
{
|
2012-05-14 23:36:54 +02:00
|
|
|
OutputMessagePtr msg(new OutputMessage);
|
|
|
|
msg->addU8(Proto::ClientUseOnCreature);
|
2012-02-08 22:23:15 +01:00
|
|
|
addPosition(msg, pos);
|
2012-05-14 23:36:54 +02:00
|
|
|
msg->addU16(thingId);
|
|
|
|
msg->addU8(stackpos);
|
|
|
|
msg->addU32(creatureId);
|
2012-02-08 22:23:15 +01:00
|
|
|
send(msg);
|
2012-01-03 14:13:54 +01:00
|
|
|
}
|
2012-01-02 23:23:54 +01:00
|
|
|
|
2012-01-03 14:13:54 +01:00
|
|
|
void ProtocolGame::sendRotateItem(const Position& pos, int thingId, int stackpos)
|
|
|
|
{
|
2012-05-14 23:36:54 +02:00
|
|
|
OutputMessagePtr msg(new OutputMessage);
|
|
|
|
msg->addU8(Proto::ClientRotateItem);
|
2012-02-08 22:23:15 +01:00
|
|
|
addPosition(msg, pos);
|
2012-05-14 23:36:54 +02:00
|
|
|
msg->addU16(thingId);
|
|
|
|
msg->addU8(stackpos);
|
2012-02-08 22:23:15 +01:00
|
|
|
send(msg);
|
2012-01-03 14:13:54 +01:00
|
|
|
}
|
2012-01-02 23:23:54 +01:00
|
|
|
|
2012-01-03 14:13:54 +01:00
|
|
|
void ProtocolGame::sendCloseContainer(int containerId)
|
|
|
|
{
|
2012-05-14 23:36:54 +02:00
|
|
|
OutputMessagePtr msg(new OutputMessage);
|
|
|
|
msg->addU8(Proto::ClientCloseContainer);
|
|
|
|
msg->addU8(containerId);
|
2012-02-08 22:23:15 +01:00
|
|
|
send(msg);
|
2012-01-03 14:13:54 +01:00
|
|
|
}
|
2012-01-02 23:23:54 +01:00
|
|
|
|
2012-01-03 14:13:54 +01:00
|
|
|
void ProtocolGame::sendUpContainer(int containerId)
|
|
|
|
{
|
2012-05-14 23:36:54 +02:00
|
|
|
OutputMessagePtr msg(new OutputMessage);
|
|
|
|
msg->addU8(Proto::ClientUpContainer);
|
|
|
|
msg->addU8(containerId);
|
2012-02-08 22:23:15 +01:00
|
|
|
send(msg);
|
2012-01-03 14:13:54 +01:00
|
|
|
}
|
2012-01-02 23:23:54 +01:00
|
|
|
|
2012-02-09 04:45:19 +01:00
|
|
|
void ProtocolGame::sendEditText(uint id, const std::string& text)
|
2012-01-03 14:13:54 +01:00
|
|
|
{
|
2012-05-14 23:36:54 +02:00
|
|
|
OutputMessagePtr msg(new OutputMessage);
|
|
|
|
msg->addU8(Proto::ClientEditText);
|
|
|
|
msg->addU32(id);
|
|
|
|
msg->addString(text);
|
2012-02-08 22:23:15 +01:00
|
|
|
send(msg);
|
2012-01-03 14:13:54 +01:00
|
|
|
}
|
2012-01-02 23:23:54 +01:00
|
|
|
|
2012-05-01 02:53:02 +02:00
|
|
|
void ProtocolGame::sendEditList(uint id, int doorId, const std::string& text)
|
2012-01-03 14:13:54 +01:00
|
|
|
{
|
2012-05-14 23:36:54 +02:00
|
|
|
OutputMessagePtr msg(new OutputMessage);
|
|
|
|
msg->addU8(Proto::ClientEditList);
|
|
|
|
msg->addU8(doorId);
|
|
|
|
msg->addU32(id);
|
|
|
|
msg->addString(text);
|
2012-02-08 22:23:15 +01:00
|
|
|
send(msg);
|
2012-01-03 14:13:54 +01:00
|
|
|
}
|
2012-01-02 23:23:54 +01:00
|
|
|
|
2012-02-08 22:23:15 +01:00
|
|
|
void ProtocolGame::sendLook(const Position& position, int thingId, int stackpos)
|
2011-12-30 19:14:50 +01:00
|
|
|
{
|
2012-05-14 23:36:54 +02:00
|
|
|
OutputMessagePtr msg(new OutputMessage);
|
|
|
|
msg->addU8(Proto::ClientLook);
|
2012-02-08 22:23:15 +01:00
|
|
|
addPosition(msg, position);
|
2012-05-14 23:36:54 +02:00
|
|
|
msg->addU16(thingId);
|
|
|
|
msg->addU8(stackpos);
|
2012-02-08 22:23:15 +01:00
|
|
|
send(msg);
|
2011-12-30 19:14:50 +01:00
|
|
|
}
|
|
|
|
|
2012-02-03 01:25:18 +01:00
|
|
|
void ProtocolGame::sendTalk(Otc::SpeakType speakType, int channelId, const std::string& receiver, const std::string& message)
|
2011-11-03 17:07:51 +01:00
|
|
|
{
|
2011-11-03 17:26:17 +01:00
|
|
|
if(message.length() > 255 || message.length() <= 0)
|
2011-11-03 17:07:51 +01:00
|
|
|
return;
|
|
|
|
|
2012-02-03 01:25:18 +01:00
|
|
|
int serverSpeakType = Proto::translateSpeakTypeToServer(speakType);
|
2012-01-14 02:37:15 +01:00
|
|
|
|
2012-05-14 23:36:54 +02:00
|
|
|
OutputMessagePtr msg(new OutputMessage);
|
|
|
|
msg->addU8(Proto::ClientTalk);
|
|
|
|
msg->addU8(serverSpeakType);
|
2011-11-03 17:07:51 +01:00
|
|
|
|
2012-02-03 01:25:18 +01:00
|
|
|
switch(serverSpeakType) {
|
2012-05-12 03:44:13 +02:00
|
|
|
case Proto::ServerSpeakPrivateFrom:
|
|
|
|
case Proto::ServerSpeakPrivateRedFrom:
|
2012-05-14 23:36:54 +02:00
|
|
|
msg->addString(receiver);
|
2011-11-03 17:07:51 +01:00
|
|
|
break;
|
2012-02-03 01:25:18 +01:00
|
|
|
case Proto::ServerSpeakChannelYellow:
|
|
|
|
case Proto::ServerSpeakChannelRed:
|
2012-05-14 23:36:54 +02:00
|
|
|
msg->addU16(channelId);
|
2011-11-03 17:07:51 +01:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
2012-05-14 23:36:54 +02:00
|
|
|
msg->addString(message);
|
2012-02-08 22:23:15 +01:00
|
|
|
send(msg);
|
2011-11-03 17:07:51 +01:00
|
|
|
}
|
|
|
|
|
2012-02-08 22:23:15 +01:00
|
|
|
void ProtocolGame::sendRequestChannels()
|
2012-01-03 14:13:54 +01:00
|
|
|
{
|
2012-05-14 23:36:54 +02:00
|
|
|
OutputMessagePtr msg(new OutputMessage);
|
|
|
|
msg->addU8(Proto::ClientRequestChannels);
|
2012-02-08 22:23:15 +01:00
|
|
|
send(msg);
|
2012-01-03 14:13:54 +01:00
|
|
|
}
|
2012-01-02 23:23:54 +01:00
|
|
|
|
2012-01-03 14:13:54 +01:00
|
|
|
void ProtocolGame::sendJoinChannel(int channelId)
|
|
|
|
{
|
2012-05-14 23:36:54 +02:00
|
|
|
OutputMessagePtr msg(new OutputMessage);
|
|
|
|
msg->addU8(Proto::ClientJoinChannel);
|
|
|
|
msg->addU16(channelId);
|
2012-02-08 22:23:15 +01:00
|
|
|
send(msg);
|
2012-01-03 14:13:54 +01:00
|
|
|
}
|
2012-01-02 23:23:54 +01:00
|
|
|
|
2012-01-03 14:13:54 +01:00
|
|
|
void ProtocolGame::sendLeaveChannel(int channelId)
|
|
|
|
{
|
2012-05-14 23:36:54 +02:00
|
|
|
OutputMessagePtr msg(new OutputMessage);
|
|
|
|
msg->addU8(Proto::ClientLeaveChannel);
|
|
|
|
msg->addU16(channelId);
|
2012-02-08 22:23:15 +01:00
|
|
|
send(msg);
|
2012-01-03 14:13:54 +01:00
|
|
|
}
|
2012-01-02 23:23:54 +01:00
|
|
|
|
2012-02-02 23:29:44 +01:00
|
|
|
void ProtocolGame::sendOpenPrivateChannel(const std::string& receiver)
|
2012-01-03 14:13:54 +01:00
|
|
|
{
|
2012-05-14 23:36:54 +02:00
|
|
|
OutputMessagePtr msg(new OutputMessage);
|
|
|
|
msg->addU8(Proto::ClientOpenPrivateChannel);
|
|
|
|
msg->addString(receiver);
|
2012-02-08 22:23:15 +01:00
|
|
|
send(msg);
|
2012-01-03 14:13:54 +01:00
|
|
|
}
|
2012-01-02 23:23:54 +01:00
|
|
|
|
2012-01-03 14:13:54 +01:00
|
|
|
void ProtocolGame::sendCloseNpcChannel()
|
|
|
|
{
|
2012-05-14 23:36:54 +02:00
|
|
|
OutputMessagePtr msg(new OutputMessage);
|
|
|
|
msg->addU8(Proto::ClientCloseNpcChannel);
|
2012-02-08 22:23:15 +01:00
|
|
|
send(msg);
|
2012-01-03 14:13:54 +01:00
|
|
|
}
|
2012-01-02 23:23:54 +01:00
|
|
|
|
2012-02-08 22:23:15 +01:00
|
|
|
void ProtocolGame::sendChangeFightModes(Otc::FightModes fightMode, Otc::ChaseModes chaseMode, bool safeFight)
|
2012-01-03 14:13:54 +01:00
|
|
|
{
|
2012-05-14 23:36:54 +02:00
|
|
|
OutputMessagePtr msg(new OutputMessage);
|
|
|
|
msg->addU8(Proto::ClientChangeFightModes);
|
|
|
|
msg->addU8(fightMode);
|
|
|
|
msg->addU8(chaseMode);
|
|
|
|
msg->addU8(safeFight ? 0x01: 0x00);
|
2012-02-08 22:23:15 +01:00
|
|
|
send(msg);
|
2012-01-03 14:13:54 +01:00
|
|
|
}
|
2012-01-02 23:23:54 +01:00
|
|
|
|
2012-01-12 20:20:18 +01:00
|
|
|
void ProtocolGame::sendAttack(uint creatureId)
|
2012-01-03 14:13:54 +01:00
|
|
|
{
|
2012-05-14 23:36:54 +02:00
|
|
|
OutputMessagePtr msg(new OutputMessage);
|
|
|
|
msg->addU8(Proto::ClientAttack);
|
|
|
|
msg->addU32(creatureId);
|
|
|
|
msg->addU32(0);
|
|
|
|
msg->addU32(0);
|
2012-02-08 22:23:15 +01:00
|
|
|
send(msg);
|
2012-01-03 14:13:54 +01:00
|
|
|
}
|
2012-01-02 23:23:54 +01:00
|
|
|
|
2012-01-12 20:20:18 +01:00
|
|
|
void ProtocolGame::sendFollow(uint creatureId)
|
2012-01-03 14:13:54 +01:00
|
|
|
{
|
2012-05-14 23:36:54 +02:00
|
|
|
OutputMessagePtr msg(new OutputMessage);
|
|
|
|
msg->addU8(Proto::ClientFollow);
|
|
|
|
msg->addU32(creatureId);
|
2012-02-08 22:23:15 +01:00
|
|
|
send(msg);
|
2012-01-03 14:13:54 +01:00
|
|
|
}
|
2012-01-02 23:23:54 +01:00
|
|
|
|
2012-01-12 20:20:18 +01:00
|
|
|
void ProtocolGame::sendInviteToParty(uint creatureId)
|
2012-01-03 14:13:54 +01:00
|
|
|
{
|
2012-05-14 23:36:54 +02:00
|
|
|
OutputMessagePtr msg(new OutputMessage);
|
|
|
|
msg->addU8(Proto::ClientInviteToParty);
|
|
|
|
msg->addU32(creatureId);
|
2012-02-08 22:23:15 +01:00
|
|
|
send(msg);
|
2012-01-03 14:13:54 +01:00
|
|
|
}
|
2012-01-02 23:23:54 +01:00
|
|
|
|
2012-01-12 20:20:18 +01:00
|
|
|
void ProtocolGame::sendJoinParty(uint creatureId)
|
2012-01-03 14:13:54 +01:00
|
|
|
{
|
2012-05-14 23:36:54 +02:00
|
|
|
OutputMessagePtr msg(new OutputMessage);
|
|
|
|
msg->addU8(Proto::ClientJoinParty);
|
|
|
|
msg->addU32(creatureId);
|
2012-02-08 22:23:15 +01:00
|
|
|
send(msg);
|
2012-01-03 14:13:54 +01:00
|
|
|
}
|
2012-01-02 23:23:54 +01:00
|
|
|
|
2012-01-12 20:20:18 +01:00
|
|
|
void ProtocolGame::sendRevokeInvitation(uint creatureId)
|
2012-01-03 14:13:54 +01:00
|
|
|
{
|
2012-05-14 23:36:54 +02:00
|
|
|
OutputMessagePtr msg(new OutputMessage);
|
|
|
|
msg->addU8(Proto::ClientRevokeInvitation);
|
|
|
|
msg->addU32(creatureId);
|
2012-02-08 22:23:15 +01:00
|
|
|
send(msg);
|
2012-01-03 14:13:54 +01:00
|
|
|
}
|
2012-01-02 23:23:54 +01:00
|
|
|
|
2012-01-12 20:20:18 +01:00
|
|
|
void ProtocolGame::sendPassLeadership(uint creatureId)
|
2012-01-03 14:13:54 +01:00
|
|
|
{
|
2012-05-14 23:36:54 +02:00
|
|
|
OutputMessagePtr msg(new OutputMessage);
|
|
|
|
msg->addU8(Proto::ClientPassLeadership);
|
|
|
|
msg->addU32(creatureId);
|
2012-02-08 22:23:15 +01:00
|
|
|
send(msg);
|
2012-01-03 14:13:54 +01:00
|
|
|
}
|
2012-01-02 23:23:54 +01:00
|
|
|
|
2012-01-03 14:13:54 +01:00
|
|
|
void ProtocolGame::sendLeaveParty()
|
|
|
|
{
|
2012-05-14 23:36:54 +02:00
|
|
|
OutputMessagePtr msg(new OutputMessage);
|
|
|
|
msg->addU8(Proto::ClientLeaveParty);
|
2012-02-08 22:23:15 +01:00
|
|
|
send(msg);
|
2012-01-03 14:13:54 +01:00
|
|
|
}
|
2012-01-02 23:23:54 +01:00
|
|
|
|
2012-01-03 14:13:54 +01:00
|
|
|
void ProtocolGame::sendShareExperience(bool active, int unknown)
|
|
|
|
{
|
2012-05-14 23:36:54 +02:00
|
|
|
OutputMessagePtr msg(new OutputMessage);
|
|
|
|
msg->addU8(Proto::ClientShareExperience);
|
|
|
|
msg->addU8(active ? 0x01 : 0x00);
|
2012-05-12 03:44:13 +02:00
|
|
|
#if PROTOCOL<910
|
2012-05-14 23:36:54 +02:00
|
|
|
msg->addU8(unknown);
|
2012-05-12 03:44:13 +02:00
|
|
|
#endif
|
2012-02-08 22:23:15 +01:00
|
|
|
send(msg);
|
2012-01-03 14:13:54 +01:00
|
|
|
}
|
2012-01-02 23:23:54 +01:00
|
|
|
|
2012-02-08 22:23:15 +01:00
|
|
|
void ProtocolGame::sendOpenOwnChannel()
|
2012-01-03 14:13:54 +01:00
|
|
|
{
|
2012-05-14 23:36:54 +02:00
|
|
|
OutputMessagePtr msg(new OutputMessage);
|
|
|
|
msg->addU8(Proto::ClientOpenOwnChannel);
|
2012-02-08 22:23:15 +01:00
|
|
|
send(msg);
|
2012-01-03 14:13:54 +01:00
|
|
|
}
|
2012-01-02 23:23:54 +01:00
|
|
|
|
2012-02-08 22:23:15 +01:00
|
|
|
void ProtocolGame::sendInviteToOwnChannel(const std::string& name)
|
2012-01-03 14:13:54 +01:00
|
|
|
{
|
2012-05-14 23:36:54 +02:00
|
|
|
OutputMessagePtr msg(new OutputMessage);
|
|
|
|
msg->addU8(Proto::ClientInviteToOwnChannel);
|
|
|
|
msg->addString(name);
|
2012-02-08 22:23:15 +01:00
|
|
|
send(msg);
|
2012-01-03 14:13:54 +01:00
|
|
|
}
|
2012-01-02 23:23:54 +01:00
|
|
|
|
2012-02-08 22:23:15 +01:00
|
|
|
void ProtocolGame::sendExcludeFromOwnChannel(const std::string& name)
|
2012-01-03 14:13:54 +01:00
|
|
|
{
|
2012-05-14 23:36:54 +02:00
|
|
|
OutputMessagePtr msg(new OutputMessage);
|
|
|
|
msg->addU8(Proto::ClientExcludeFromOwnChannel);
|
|
|
|
msg->addString(name);
|
2012-02-08 22:23:15 +01:00
|
|
|
send(msg);
|
2012-01-03 14:13:54 +01:00
|
|
|
}
|
2012-01-02 23:23:54 +01:00
|
|
|
|
2012-02-08 22:23:15 +01:00
|
|
|
void ProtocolGame::sendCancelAttackAndFollow()
|
2012-01-03 14:13:54 +01:00
|
|
|
{
|
2012-05-14 23:36:54 +02:00
|
|
|
OutputMessagePtr msg(new OutputMessage);
|
|
|
|
msg->addU8(Proto::ClientCancelAttackAndFollow);
|
2012-02-08 22:23:15 +01:00
|
|
|
send(msg);
|
2012-01-03 14:13:54 +01:00
|
|
|
}
|
2012-01-02 23:23:54 +01:00
|
|
|
|
2012-02-08 22:23:15 +01:00
|
|
|
void ProtocolGame::sendRefreshContainer()
|
2012-01-03 14:13:54 +01:00
|
|
|
{
|
2012-05-14 23:36:54 +02:00
|
|
|
OutputMessagePtr msg(new OutputMessage);
|
|
|
|
msg->addU8(Proto::ClientRefreshContainer);
|
2012-02-08 22:23:15 +01:00
|
|
|
send(msg);
|
2012-01-03 14:13:54 +01:00
|
|
|
}
|
2012-01-02 23:23:54 +01:00
|
|
|
|
2012-02-08 22:23:15 +01:00
|
|
|
void ProtocolGame::sendRequestOutfit()
|
2011-11-14 23:32:55 +01:00
|
|
|
{
|
2012-05-14 23:36:54 +02:00
|
|
|
OutputMessagePtr msg(new OutputMessage);
|
|
|
|
msg->addU8(Proto::ClientRequestOutfit);
|
2012-02-08 22:23:15 +01:00
|
|
|
send(msg);
|
2011-11-14 23:32:55 +01:00
|
|
|
}
|
|
|
|
|
2012-02-08 22:23:15 +01:00
|
|
|
void ProtocolGame::sendChangeOutfit(const Outfit& outfit)
|
2011-11-14 23:47:36 +01:00
|
|
|
{
|
2012-05-14 23:36:54 +02:00
|
|
|
OutputMessagePtr msg(new OutputMessage);
|
|
|
|
msg->addU8(Proto::ClientChangeOutfit);
|
|
|
|
msg->addU16(outfit.getId());
|
|
|
|
msg->addU8(outfit.getHead());
|
|
|
|
msg->addU8(outfit.getBody());
|
|
|
|
msg->addU8(outfit.getLegs());
|
|
|
|
msg->addU8(outfit.getFeet());
|
|
|
|
msg->addU8(outfit.getAddons());
|
2012-05-12 13:55:22 +02:00
|
|
|
send(msg);
|
|
|
|
}
|
2011-11-14 23:47:36 +01:00
|
|
|
|
2012-05-12 13:55:22 +02:00
|
|
|
void ProtocolGame::sendMount(bool mount)
|
|
|
|
{
|
2012-05-14 23:36:54 +02:00
|
|
|
OutputMessagePtr msg(new OutputMessage);
|
|
|
|
msg->addU8(Proto::ClientMount);
|
|
|
|
msg->addU8(mount);
|
2012-02-08 22:23:15 +01:00
|
|
|
send(msg);
|
2011-11-14 23:47:36 +01:00
|
|
|
}
|
|
|
|
|
2011-09-03 00:52:40 +02:00
|
|
|
void ProtocolGame::sendAddVip(const std::string& name)
|
|
|
|
{
|
2012-05-14 23:36:54 +02:00
|
|
|
OutputMessagePtr msg(new OutputMessage);
|
|
|
|
msg->addU8(Proto::ClientAddVip);
|
|
|
|
msg->addString(name);
|
2012-02-08 22:23:15 +01:00
|
|
|
send(msg);
|
2011-09-03 00:52:40 +02:00
|
|
|
}
|
|
|
|
|
2012-01-12 20:20:18 +01:00
|
|
|
void ProtocolGame::sendRemoveVip(uint playerId)
|
2011-09-03 00:52:40 +02:00
|
|
|
{
|
2012-05-14 23:36:54 +02:00
|
|
|
OutputMessagePtr msg(new OutputMessage);
|
|
|
|
msg->addU8(Proto::ClientRemoveVip);
|
|
|
|
msg->addU32(playerId);
|
2012-02-08 22:23:15 +01:00
|
|
|
send(msg);
|
2011-09-03 00:52:40 +02:00
|
|
|
}
|
2011-11-10 07:53:16 +01:00
|
|
|
|
2012-05-01 00:24:50 +02:00
|
|
|
void ProtocolGame::sendBugReport(const std::string& comment)
|
|
|
|
{
|
2012-05-14 23:36:54 +02:00
|
|
|
OutputMessagePtr msg(new OutputMessage);
|
|
|
|
msg->addU8(Proto::ClientBugReport);
|
|
|
|
msg->addString(comment);
|
2012-05-01 00:24:50 +02:00
|
|
|
send(msg);
|
|
|
|
}
|
|
|
|
|
|
|
|
void ProtocolGame::sendRuleVilation(const std::string& target, int reason, int action, const std::string& comment, const std::string& statement, int statementId, bool ipBanishment)
|
|
|
|
{
|
2012-05-14 23:36:54 +02:00
|
|
|
OutputMessagePtr msg(new OutputMessage);
|
|
|
|
msg->addU8(Proto::ClientRuleViolation);
|
|
|
|
msg->addString(target);
|
|
|
|
msg->addU8(reason);
|
|
|
|
msg->addU8(action);
|
|
|
|
msg->addString(comment);
|
|
|
|
msg->addString(statement);
|
|
|
|
msg->addU16(statementId);
|
|
|
|
msg->addU8(ipBanishment);
|
2012-05-01 00:24:50 +02:00
|
|
|
send(msg);
|
|
|
|
}
|
|
|
|
|
|
|
|
void ProtocolGame::sendDebugReport(const std::string& a, const std::string& b, const std::string& c, const std::string& d)
|
|
|
|
{
|
2012-05-14 23:36:54 +02:00
|
|
|
OutputMessagePtr msg(new OutputMessage);
|
|
|
|
msg->addU8(Proto::ClientDebugReport);
|
|
|
|
msg->addString(a);
|
|
|
|
msg->addString(b);
|
|
|
|
msg->addString(c);
|
|
|
|
msg->addString(d);
|
2012-05-01 00:24:50 +02:00
|
|
|
send(msg);
|
|
|
|
}
|
|
|
|
|
2012-02-08 22:23:15 +01:00
|
|
|
void ProtocolGame::sendRequestQuestLog()
|
2012-01-03 14:13:54 +01:00
|
|
|
{
|
2012-05-14 23:36:54 +02:00
|
|
|
OutputMessagePtr msg(new OutputMessage);
|
|
|
|
msg->addU8(Proto::ClientRequestQuestLog);
|
2012-02-08 22:23:15 +01:00
|
|
|
send(msg);
|
2012-01-03 14:13:54 +01:00
|
|
|
}
|
2012-01-02 23:23:54 +01:00
|
|
|
|
2012-02-09 04:45:19 +01:00
|
|
|
void ProtocolGame::sendRequestQuestLine(int questId)
|
2012-01-03 14:13:54 +01:00
|
|
|
{
|
2012-05-14 23:36:54 +02:00
|
|
|
OutputMessagePtr msg(new OutputMessage);
|
|
|
|
msg->addU8(Proto::ClientRequestQuestLine);
|
|
|
|
msg->addU16(questId);
|
2012-02-08 22:23:15 +01:00
|
|
|
send(msg);
|
2012-01-03 14:13:54 +01:00
|
|
|
}
|
2012-01-02 23:23:54 +01:00
|
|
|
|
2012-05-12 13:55:22 +02:00
|
|
|
void ProtocolGame::sendNewNewRuleViolation(int reason, int action, const std::string& characterName, const std::string& comment, const std::string& translation)
|
|
|
|
{
|
2012-05-14 23:36:54 +02:00
|
|
|
OutputMessagePtr msg(new OutputMessage);
|
|
|
|
msg->addU8(Proto::ClientNewRuleViolation);
|
|
|
|
msg->addU8(reason);
|
|
|
|
msg->addU8(action);
|
|
|
|
msg->addString(characterName);
|
|
|
|
msg->addString(comment);
|
|
|
|
msg->addString(translation);
|
2012-05-12 13:55:22 +02:00
|
|
|
send(msg);
|
|
|
|
}
|
|
|
|
|
|
|
|
void ProtocolGame::sendRequestItemInfo(int itemId, int index)
|
|
|
|
{
|
2012-05-14 23:36:54 +02:00
|
|
|
OutputMessagePtr msg(new OutputMessage);
|
|
|
|
msg->addU8(Proto::ClientRequestItemInfo);
|
|
|
|
msg->addU8(1); // count, 1 for just one item
|
|
|
|
msg->addU16(itemId);
|
|
|
|
msg->addU8(index);
|
2012-05-02 02:41:42 +02:00
|
|
|
send(msg);
|
|
|
|
}
|
|
|
|
|
2012-05-14 23:36:54 +02:00
|
|
|
void ProtocolGame::addPosition(const OutputMessagePtr& msg, const Position& position)
|
2011-11-10 07:53:16 +01:00
|
|
|
{
|
2012-05-14 23:36:54 +02:00
|
|
|
msg->addU16(position.x);
|
|
|
|
msg->addU16(position.y);
|
|
|
|
msg->addU8(position.z);
|
2011-11-10 07:53:16 +01:00
|
|
|
}
|