Started updating to 9.8+ features, not yet finished (unsafe version).
Need to finish: * Pending login state * New creature speed changes * Vip state displays Fixed: * Creature light * Missing lua constants If someone can finish this off that would be good, I will be busy for a while :)
This commit is contained in:
parent
a86449dea9
commit
619285069c
|
@ -38,7 +38,13 @@ end
|
|||
|
||||
-- parsing protocols
|
||||
local function parseMarketEnter(msg)
|
||||
local balance = msg:getU32()
|
||||
local balance
|
||||
if(g_game.getClientVersion() >= 980) then
|
||||
balance = msg:getU64()
|
||||
else
|
||||
balance = msg:getU32()
|
||||
end
|
||||
|
||||
local vocation = -1
|
||||
if g_game.getClientVersion() < 950 then
|
||||
vocation = msg:getU8() -- get vocation id
|
||||
|
|
|
@ -65,6 +65,8 @@ GamePurseSlot = 21
|
|||
GameFormatCreatureName = 22
|
||||
GameSpellList = 23
|
||||
GameClientPing = 24
|
||||
GameLoginPending = 25
|
||||
GameNewSpeedLaw = 26
|
||||
|
||||
TextColors = {
|
||||
red = '#f55e5e', --'#c83200'
|
||||
|
|
|
@ -50,7 +50,7 @@ function g_game.getSupportedProtocols()
|
|||
return {
|
||||
810, 853, 854, 860, 861, 862, 870,
|
||||
910, 940, 944, 953, 954, 960, 961,
|
||||
963, 970, 971
|
||||
963, 970, 971, 980, 981
|
||||
}
|
||||
end
|
||||
|
||||
|
|
|
@ -1,9 +1,11 @@
|
|||
GameServerOpcodes = {
|
||||
GameServerInitGame = 10,
|
||||
GameServerGMActions = 11,
|
||||
GameServerEnterGame = 15,
|
||||
GameServerLoginError = 20,
|
||||
GameServerLoginAdvice = 21,
|
||||
GameServerLoginWait = 22,
|
||||
GameServerAddCreature = 23,
|
||||
GameServerPingBack = 29,
|
||||
GameServerPing = 30,
|
||||
GameServerChallange = 31,
|
||||
|
@ -94,7 +96,8 @@ GameServerOpcodes = {
|
|||
GameServerMarketEnter = 246, -- 944
|
||||
GameServerMarketLeave = 247, -- 944
|
||||
GameServerMarketDetail = 248, -- 944
|
||||
GameServerMarketBrowse = 249 -- 944
|
||||
GameServerMarketBrowse = 249, -- 944
|
||||
GameServerShowModalDialog = 250 -- 960
|
||||
}
|
||||
|
||||
ClientOpcodes = {
|
||||
|
@ -184,5 +187,6 @@ ClientOpcodes = {
|
|||
ClientMarketBrowse = 245, -- 944
|
||||
ClientMarketCreate = 246, -- 944
|
||||
ClientMarketCancel = 247, -- 944
|
||||
ClientMarketAccept = 248 -- 944
|
||||
}
|
||||
ClientMarketAccept = 248, -- 944
|
||||
ClientAnswerModalDialog = 249 -- 960
|
||||
}
|
||||
|
|
|
@ -86,6 +86,13 @@ std::string InputMessage::getString()
|
|||
return std::string(v, stringLength);
|
||||
}
|
||||
|
||||
double InputMessage::getDouble()
|
||||
{
|
||||
uint8 precision = getU8();
|
||||
uint32 v = getU32();
|
||||
return (v / std::pow((float)10, precision));
|
||||
}
|
||||
|
||||
bool InputMessage::decryptRsa(int size)
|
||||
{
|
||||
checkRead(size);
|
||||
|
|
|
@ -46,6 +46,7 @@ public:
|
|||
uint32 getU32();
|
||||
uint64 getU64();
|
||||
std::string getString();
|
||||
double getDouble();
|
||||
|
||||
uint8 peekU8() { uint8 v = getU8(); m_readPos-=1; return v; }
|
||||
uint16 peekU16() { uint16 v = getU16(); m_readPos-=2; return v; }
|
||||
|
|
|
@ -340,6 +340,8 @@ namespace Otc
|
|||
GameFormatCreatureName = 22,
|
||||
GameSpellList = 23,
|
||||
GameClientPing = 24,
|
||||
GameLoginPending = 25,
|
||||
GameNewSpeedLaw = 26,
|
||||
// 23-50 unused yet
|
||||
// 51-100 reserved to be defined in lua
|
||||
LastGameFeature = 101
|
||||
|
@ -383,6 +385,13 @@ namespace Otc
|
|||
MAPMARK_GREENNORTH,
|
||||
MAPMARK_GREENSOUTH
|
||||
};
|
||||
|
||||
enum VipState
|
||||
{
|
||||
VIPSTATE_OFFLINE = 0,
|
||||
VIPSTATE_ONLINE = 1,
|
||||
VIPSTATE_PENDING = 2
|
||||
};
|
||||
}
|
||||
|
||||
#endif
|
||||
|
|
|
@ -83,7 +83,7 @@ void Creature::draw(const Point& dest, float scaleFactor, bool animate, LightVie
|
|||
|
||||
if(lightView) {
|
||||
Light light = rawGetThingType()->getLight();
|
||||
if(m_light.intensity > light.intensity)
|
||||
if(m_light.intensity != light.intensity && m_light.color != light.color)
|
||||
light = m_light;
|
||||
|
||||
// local player always have a minimum light in complete darkness
|
||||
|
|
|
@ -305,16 +305,16 @@ void Game::processRuleViolationLock()
|
|||
g_lua.callGlobalField("g_game", "onRuleViolationLock");
|
||||
}
|
||||
|
||||
void Game::processVipAdd(uint id, const std::string& name, bool online)
|
||||
void Game::processVipAdd(uint id, const std::string& name, uint status)
|
||||
{
|
||||
m_vips[id] = Vip(name, online);
|
||||
g_lua.callGlobalField("g_game", "onAddVip", id, name, online);
|
||||
m_vips[id] = Vip(name, status);
|
||||
g_lua.callGlobalField("g_game", "onAddVip", id, name, status);
|
||||
}
|
||||
|
||||
void Game::processVipStateChange(uint id, bool online)
|
||||
void Game::processVipStateChange(uint id, uint status)
|
||||
{
|
||||
std::get<1>(m_vips[id]) = online;
|
||||
g_lua.callGlobalField("g_game", "onVipStateChange", id, online);
|
||||
std::get<1>(m_vips[id]) = status;
|
||||
g_lua.callGlobalField("g_game", "onVipStateChange", id, status);
|
||||
}
|
||||
|
||||
void Game::processTutorialHint(int id)
|
||||
|
@ -1181,7 +1181,7 @@ void Game::setClientVersion(int version)
|
|||
if(isOnline())
|
||||
stdext::throw_exception("Unable to change client version while online");
|
||||
|
||||
if(version != 0 && (version < 810 || version > 970))
|
||||
if(version != 0 && (version < 810 || version > 981))
|
||||
stdext::throw_exception(stdext::format("Protocol version %d not supported", version));
|
||||
|
||||
m_features.reset();
|
||||
|
@ -1233,6 +1233,11 @@ void Game::setClientVersion(int version)
|
|||
enableFeature(Otc::GameOfflineTrainingTime);
|
||||
}
|
||||
|
||||
if(version >= 980) {
|
||||
enableFeature(Otc::GameLoginPending);
|
||||
enableFeature(Otc::GameNewSpeedLaw);
|
||||
}
|
||||
|
||||
m_clientVersion = version;
|
||||
|
||||
Proto::buildMessageModesMap(version);
|
||||
|
|
|
@ -36,7 +36,7 @@
|
|||
|
||||
#include <bitset>
|
||||
|
||||
typedef std::tuple<std::string, bool> Vip;
|
||||
typedef std::tuple<std::string, uint> Vip;
|
||||
|
||||
//@bindsingleton g_game
|
||||
class Game
|
||||
|
@ -93,8 +93,8 @@ protected:
|
|||
void processRuleViolationLock();
|
||||
|
||||
// vip related
|
||||
void processVipAdd(uint id, const std::string& name, bool online);
|
||||
void processVipStateChange(uint id, bool online);
|
||||
void processVipAdd(uint id, const std::string& name, uint status);
|
||||
void processVipStateChange(uint id, uint status);
|
||||
|
||||
// tutorial hint
|
||||
void processTutorialHint(int id);
|
||||
|
|
|
@ -43,9 +43,11 @@ namespace Proto {
|
|||
{
|
||||
GameServerInitGame = 10,
|
||||
GameServerGMActions = 11,
|
||||
GameServerEnterGame = 15,
|
||||
GameServerLoginError = 20,
|
||||
GameServerLoginAdvice = 21,
|
||||
GameServerLoginWait = 22,
|
||||
GameServerAddCreature = 23,
|
||||
GameServerPingBack = 29,
|
||||
GameServerPing = 30,
|
||||
GameServerChallange = 31,
|
||||
|
@ -124,7 +126,7 @@ namespace Proto {
|
|||
GameServerFloorChangeDown = 191,
|
||||
GameServerChooseOutfit = 200,
|
||||
GameServerVipAdd = 210,
|
||||
GameServerVipLogin = 211,
|
||||
GameServerVipState = 211,
|
||||
GameServerVipLogout = 212,
|
||||
GameServerTutorialHint = 220,
|
||||
GameServerAutomapFlag = 221,
|
||||
|
|
|
@ -119,6 +119,8 @@ public:
|
|||
|
||||
private:
|
||||
void parseMessage(const InputMessagePtr& msg);
|
||||
void parsePendingGame(const InputMessagePtr& msg);
|
||||
void parseEnterGame(const InputMessagePtr& msg);
|
||||
void parseInitGame(const InputMessagePtr& msg);
|
||||
void parseGMActions(const InputMessagePtr& msg);
|
||||
void parseLoginError(const InputMessagePtr& msg);
|
||||
|
@ -191,7 +193,7 @@ private:
|
|||
void parseFloorChangeDown(const InputMessagePtr& msg);
|
||||
void parseOpenOutfitWindow(const InputMessagePtr& msg);
|
||||
void parseVipAdd(const InputMessagePtr& msg);
|
||||
void parseVipLogin(const InputMessagePtr& msg);
|
||||
void parseVipState(const InputMessagePtr& msg);
|
||||
void parseVipLogout(const InputMessagePtr& msg);
|
||||
void parseTutorialHint(const InputMessagePtr& msg);
|
||||
void parseAutomapFlag(const InputMessagePtr& msg);
|
||||
|
|
|
@ -57,7 +57,15 @@ void ProtocolGame::parseMessage(const InputMessagePtr& msg)
|
|||
|
||||
switch(opcode) {
|
||||
case Proto::GameServerInitGame:
|
||||
parseInitGame(msg);
|
||||
case Proto::GameServerAddCreature:
|
||||
if(opcode == Proto::GameServerInitGame && g_game.getFeature(Otc::GameLoginPending))
|
||||
parsePendingGame(msg);
|
||||
else
|
||||
parseInitGame(msg);
|
||||
break;
|
||||
case Proto::GameServerEnterGame:
|
||||
if(g_game.getFeature(Otc::GameLoginPending))
|
||||
parseEnterGame(msg);
|
||||
break;
|
||||
case Proto::GameServerGMActions:
|
||||
parseGMActions(msg);
|
||||
|
@ -262,8 +270,8 @@ void ProtocolGame::parseMessage(const InputMessagePtr& msg)
|
|||
case Proto::GameServerVipAdd:
|
||||
parseVipAdd(msg);
|
||||
break;
|
||||
case Proto::GameServerVipLogin:
|
||||
parseVipLogin(msg);
|
||||
case Proto::GameServerVipState:
|
||||
parseVipState(msg);
|
||||
break;
|
||||
case Proto::GameServerVipLogout:
|
||||
parseVipLogout(msg);
|
||||
|
@ -328,6 +336,13 @@ void ProtocolGame::parseInitGame(const InputMessagePtr& msg)
|
|||
{
|
||||
uint playerId = msg->getU32();
|
||||
int serverBeat = msg->getU16();
|
||||
|
||||
if(g_game.getFeature(Otc::GameNewSpeedLaw))
|
||||
{
|
||||
double speedA = msg->getDouble();
|
||||
double speedB = msg->getDouble();
|
||||
double speedC = msg->getDouble();
|
||||
}
|
||||
bool canReportBugs = msg->getU8();
|
||||
|
||||
m_localPlayer->setId(playerId);
|
||||
|
@ -335,6 +350,16 @@ void ProtocolGame::parseInitGame(const InputMessagePtr& msg)
|
|||
g_game.setCanReportBugs(canReportBugs);
|
||||
}
|
||||
|
||||
void ProtocolGame::parsePendingGame(const InputMessagePtr& msg)
|
||||
{
|
||||
//set player to pending game state
|
||||
}
|
||||
|
||||
void ProtocolGame::parseEnterGame(const InputMessagePtr& msg)
|
||||
{
|
||||
//set player to entered game state
|
||||
}
|
||||
|
||||
void ProtocolGame::parseGMActions(const InputMessagePtr& msg)
|
||||
{
|
||||
std::vector<uint8> actions;
|
||||
|
@ -618,7 +643,12 @@ void ProtocolGame::parsePlayerGoods(const InputMessagePtr& msg)
|
|||
{
|
||||
std::vector<std::tuple<ItemPtr, int>> goods;
|
||||
|
||||
int money = msg->getU32();
|
||||
int money;
|
||||
if(g_game.getClientVersion() >= 980)
|
||||
money = msg->getU64();
|
||||
else
|
||||
money = msg->getU32();
|
||||
|
||||
int size = msg->getU8();
|
||||
for(int i = 0; i < size; i++) {
|
||||
int itemId = msg->getU16();
|
||||
|
@ -1259,9 +1289,9 @@ void ProtocolGame::parseOpenOutfitWindow(const InputMessagePtr& msg)
|
|||
|
||||
void ProtocolGame::parseVipAdd(const InputMessagePtr& msg)
|
||||
{
|
||||
uint id, markId;
|
||||
uint id, markId, status;
|
||||
std::string name, desc;
|
||||
bool online, notifyLogin;
|
||||
bool notifyLogin;
|
||||
|
||||
id = msg->getU32();
|
||||
name = g_game.formatCreatureName(msg->getString());
|
||||
|
@ -1270,21 +1300,27 @@ void ProtocolGame::parseVipAdd(const InputMessagePtr& msg)
|
|||
markId = msg->getU32();
|
||||
notifyLogin = msg->getU8();
|
||||
}
|
||||
online = msg->getU8();
|
||||
status = msg->getU8();
|
||||
|
||||
g_game.processVipAdd(id, name, online);
|
||||
g_game.processVipAdd(id, name, status);
|
||||
}
|
||||
|
||||
void ProtocolGame::parseVipLogin(const InputMessagePtr& msg)
|
||||
void ProtocolGame::parseVipState(const InputMessagePtr& msg)
|
||||
{
|
||||
uint id = msg->getU32();
|
||||
g_game.processVipStateChange(id, true);
|
||||
if(g_game.getFeature(Otc::GameLoginPending)) {
|
||||
uint status = msg->getU8();
|
||||
g_game.processVipStateChange(id, status);
|
||||
}
|
||||
else {
|
||||
g_game.processVipStateChange(id, 1);
|
||||
}
|
||||
}
|
||||
|
||||
void ProtocolGame::parseVipLogout(const InputMessagePtr& msg)
|
||||
{
|
||||
uint id = msg->getU32();
|
||||
g_game.processVipStateChange(id, false);
|
||||
g_game.processVipStateChange(id, 0);
|
||||
}
|
||||
|
||||
void ProtocolGame::parseTutorialHint(const InputMessagePtr& msg)
|
||||
|
|
Loading…
Reference in New Issue