Support for protocol 963

This commit is contained in:
Eduardo Bart 2012-08-29 12:09:05 -03:00
parent fe6f6c2d20
commit 97e1c9d5a9
7 changed files with 42 additions and 16 deletions

View File

@ -48,8 +48,9 @@ end
function g_game.getSupportedProtocols()
return {
810, 853, 854, 860, 861, 862, 870,
910, 940, 944, 953, 954, 960, 961
810, 853, 854, 860, 861, 862, 870,
910, 940, 944, 953, 954, 960, 961,
963
}
end

View File

@ -692,13 +692,6 @@ void LuaInterface::createLuaState()
rawSeti(5);
pop(2);
// replace loadfile
getGlobal("package");
getField("loaders");
pushCFunction(&LuaInterface::luaScriptLoader);
rawSeti(5);
pop(2);
// replace dofile
pushCFunction(&LuaInterface::lua_dofile);
setGlobal("dofile");

View File

@ -635,7 +635,10 @@ void Game::look(const ThingPtr& thing)
if(!canPerformGameAction() || !thing)
return;
m_protocolGame->sendLook(thing->getPosition(), thing->getId(), thing->getStackpos());
if(thing->isCreature() && m_clientVersion >= 961)
m_protocolGame->sendLookCreature(thing->getId());
else
m_protocolGame->sendLook(thing->getPosition(), thing->getId(), thing->getStackpos());
}
void Game::move(const ThingPtr& thing, const Position& toPos, int count)
@ -774,7 +777,12 @@ void Game::attack(CreaturePtr creature)
cancelFollow();
setAttackingCreature(creature);
m_seq++;
if(m_clientVersion >= 963)
m_seq = creature->getId();
else
m_seq++;
m_protocolGame->sendAttack(creature ? creature->getId() : 0, m_seq);
}
@ -791,7 +799,12 @@ void Game::follow(CreaturePtr creature)
cancelAttack();
setFollowingCreature(creature);
m_seq++;
if(m_clientVersion >= 963)
m_seq = creature->getId();
else
m_seq++;
m_protocolGame->sendFollow(creature ? creature->getId() : 0, m_seq);
}
@ -1151,7 +1164,7 @@ void Game::setClientVersion(int version)
if(isOnline())
stdext::throw_exception("Unable to change client version while online");
if(version != 0 && (version < 810 || version > 961))
if(version != 0 && (version < 810 || version > 963))
stdext::throw_exception(stdext::format("Protocol version %d not supported", version));
m_features.reset();

View File

@ -191,6 +191,7 @@ namespace Proto {
ClientEditText = 137,
ClientEditList = 138,
ClientLook = 140,
ClientLookCreature = 141,
ClientTalk = 150,
ClientRequestChannels = 151,
ClientJoinChannel = 152,

View File

@ -72,6 +72,7 @@ public:
void sendEditText(uint id, const std::string& text);
void sendEditList(uint id, int doorId, const std::string& text);
void sendLook(const Position& position, int thingId, int stackpos);
void sendLookCreature(uint creatureId);
void sendTalk(Otc::MessageMode mode, int channelId, const std::string& receiver, const std::string& message);
void sendRequestChannels();
void sendJoinChannel(int channelId);

View File

@ -1254,9 +1254,18 @@ void ProtocolGame::parseOpenOutfitWindow(const InputMessagePtr& msg)
void ProtocolGame::parseVipAdd(const InputMessagePtr& msg)
{
uint id = msg->getU32();
std::string name = g_game.formatCreatureName(msg->getString());
bool online = msg->getU8() != 0;
uint id, markId;
std::string name, desc;
bool online, notifyLogin;
id = msg->getU32();
name = g_game.formatCreatureName(msg->getString());
if(g_game.getClientVersion() >= 963) {
desc = msg->getString();
markId = msg->getU32();
notifyLogin = msg->getU8();
}
online = msg->getU8();
g_game.processVipAdd(id, name, online);
}

View File

@ -436,6 +436,14 @@ void ProtocolGame::sendLook(const Position& position, int thingId, int stackpos)
send(msg);
}
void ProtocolGame::sendLookCreature(uint32 creatureId)
{
OutputMessagePtr msg(new OutputMessage);
msg->addU8(0x8D);
msg->addU32(creatureId);
send(msg);
}
void ProtocolGame::sendTalk(Otc::MessageMode mode, int channelId, const std::string& receiver, const std::string& message)
{
if(message.empty())