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

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -436,6 +436,14 @@ void ProtocolGame::sendLook(const Position& position, int thingId, int stackpos)
send(msg); 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) void ProtocolGame::sendTalk(Otc::MessageMode mode, int channelId, const std::string& receiver, const std::string& message)
{ {
if(message.empty()) if(message.empty())