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
|
-- parsing protocols
|
||||||
local function parseMarketEnter(msg)
|
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
|
local vocation = -1
|
||||||
if g_game.getClientVersion() < 950 then
|
if g_game.getClientVersion() < 950 then
|
||||||
vocation = msg:getU8() -- get vocation id
|
vocation = msg:getU8() -- get vocation id
|
||||||
|
|
|
@ -65,6 +65,8 @@ GamePurseSlot = 21
|
||||||
GameFormatCreatureName = 22
|
GameFormatCreatureName = 22
|
||||||
GameSpellList = 23
|
GameSpellList = 23
|
||||||
GameClientPing = 24
|
GameClientPing = 24
|
||||||
|
GameLoginPending = 25
|
||||||
|
GameNewSpeedLaw = 26
|
||||||
|
|
||||||
TextColors = {
|
TextColors = {
|
||||||
red = '#f55e5e', --'#c83200'
|
red = '#f55e5e', --'#c83200'
|
||||||
|
|
|
@ -50,7 +50,7 @@ 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, 970, 971
|
963, 970, 971, 980, 981
|
||||||
}
|
}
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
|
@ -1,9 +1,11 @@
|
||||||
GameServerOpcodes = {
|
GameServerOpcodes = {
|
||||||
GameServerInitGame = 10,
|
GameServerInitGame = 10,
|
||||||
GameServerGMActions = 11,
|
GameServerGMActions = 11,
|
||||||
|
GameServerEnterGame = 15,
|
||||||
GameServerLoginError = 20,
|
GameServerLoginError = 20,
|
||||||
GameServerLoginAdvice = 21,
|
GameServerLoginAdvice = 21,
|
||||||
GameServerLoginWait = 22,
|
GameServerLoginWait = 22,
|
||||||
|
GameServerAddCreature = 23,
|
||||||
GameServerPingBack = 29,
|
GameServerPingBack = 29,
|
||||||
GameServerPing = 30,
|
GameServerPing = 30,
|
||||||
GameServerChallange = 31,
|
GameServerChallange = 31,
|
||||||
|
@ -94,7 +96,8 @@ GameServerOpcodes = {
|
||||||
GameServerMarketEnter = 246, -- 944
|
GameServerMarketEnter = 246, -- 944
|
||||||
GameServerMarketLeave = 247, -- 944
|
GameServerMarketLeave = 247, -- 944
|
||||||
GameServerMarketDetail = 248, -- 944
|
GameServerMarketDetail = 248, -- 944
|
||||||
GameServerMarketBrowse = 249 -- 944
|
GameServerMarketBrowse = 249, -- 944
|
||||||
|
GameServerShowModalDialog = 250 -- 960
|
||||||
}
|
}
|
||||||
|
|
||||||
ClientOpcodes = {
|
ClientOpcodes = {
|
||||||
|
@ -184,5 +187,6 @@ ClientOpcodes = {
|
||||||
ClientMarketBrowse = 245, -- 944
|
ClientMarketBrowse = 245, -- 944
|
||||||
ClientMarketCreate = 246, -- 944
|
ClientMarketCreate = 246, -- 944
|
||||||
ClientMarketCancel = 247, -- 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);
|
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)
|
bool InputMessage::decryptRsa(int size)
|
||||||
{
|
{
|
||||||
checkRead(size);
|
checkRead(size);
|
||||||
|
|
|
@ -46,6 +46,7 @@ public:
|
||||||
uint32 getU32();
|
uint32 getU32();
|
||||||
uint64 getU64();
|
uint64 getU64();
|
||||||
std::string getString();
|
std::string getString();
|
||||||
|
double getDouble();
|
||||||
|
|
||||||
uint8 peekU8() { uint8 v = getU8(); m_readPos-=1; return v; }
|
uint8 peekU8() { uint8 v = getU8(); m_readPos-=1; return v; }
|
||||||
uint16 peekU16() { uint16 v = getU16(); m_readPos-=2; return v; }
|
uint16 peekU16() { uint16 v = getU16(); m_readPos-=2; return v; }
|
||||||
|
|
|
@ -340,6 +340,8 @@ namespace Otc
|
||||||
GameFormatCreatureName = 22,
|
GameFormatCreatureName = 22,
|
||||||
GameSpellList = 23,
|
GameSpellList = 23,
|
||||||
GameClientPing = 24,
|
GameClientPing = 24,
|
||||||
|
GameLoginPending = 25,
|
||||||
|
GameNewSpeedLaw = 26,
|
||||||
// 23-50 unused yet
|
// 23-50 unused yet
|
||||||
// 51-100 reserved to be defined in lua
|
// 51-100 reserved to be defined in lua
|
||||||
LastGameFeature = 101
|
LastGameFeature = 101
|
||||||
|
@ -383,6 +385,13 @@ namespace Otc
|
||||||
MAPMARK_GREENNORTH,
|
MAPMARK_GREENNORTH,
|
||||||
MAPMARK_GREENSOUTH
|
MAPMARK_GREENSOUTH
|
||||||
};
|
};
|
||||||
|
|
||||||
|
enum VipState
|
||||||
|
{
|
||||||
|
VIPSTATE_OFFLINE = 0,
|
||||||
|
VIPSTATE_ONLINE = 1,
|
||||||
|
VIPSTATE_PENDING = 2
|
||||||
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -83,7 +83,7 @@ void Creature::draw(const Point& dest, float scaleFactor, bool animate, LightVie
|
||||||
|
|
||||||
if(lightView) {
|
if(lightView) {
|
||||||
Light light = rawGetThingType()->getLight();
|
Light light = rawGetThingType()->getLight();
|
||||||
if(m_light.intensity > light.intensity)
|
if(m_light.intensity != light.intensity && m_light.color != light.color)
|
||||||
light = m_light;
|
light = m_light;
|
||||||
|
|
||||||
// local player always have a minimum light in complete darkness
|
// local player always have a minimum light in complete darkness
|
||||||
|
|
|
@ -305,16 +305,16 @@ void Game::processRuleViolationLock()
|
||||||
g_lua.callGlobalField("g_game", "onRuleViolationLock");
|
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);
|
m_vips[id] = Vip(name, status);
|
||||||
g_lua.callGlobalField("g_game", "onAddVip", id, name, online);
|
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;
|
std::get<1>(m_vips[id]) = status;
|
||||||
g_lua.callGlobalField("g_game", "onVipStateChange", id, online);
|
g_lua.callGlobalField("g_game", "onVipStateChange", id, status);
|
||||||
}
|
}
|
||||||
|
|
||||||
void Game::processTutorialHint(int id)
|
void Game::processTutorialHint(int id)
|
||||||
|
@ -1181,7 +1181,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 > 970))
|
if(version != 0 && (version < 810 || version > 981))
|
||||||
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();
|
||||||
|
@ -1233,6 +1233,11 @@ void Game::setClientVersion(int version)
|
||||||
enableFeature(Otc::GameOfflineTrainingTime);
|
enableFeature(Otc::GameOfflineTrainingTime);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if(version >= 980) {
|
||||||
|
enableFeature(Otc::GameLoginPending);
|
||||||
|
enableFeature(Otc::GameNewSpeedLaw);
|
||||||
|
}
|
||||||
|
|
||||||
m_clientVersion = version;
|
m_clientVersion = version;
|
||||||
|
|
||||||
Proto::buildMessageModesMap(version);
|
Proto::buildMessageModesMap(version);
|
||||||
|
|
|
@ -36,7 +36,7 @@
|
||||||
|
|
||||||
#include <bitset>
|
#include <bitset>
|
||||||
|
|
||||||
typedef std::tuple<std::string, bool> Vip;
|
typedef std::tuple<std::string, uint> Vip;
|
||||||
|
|
||||||
//@bindsingleton g_game
|
//@bindsingleton g_game
|
||||||
class Game
|
class Game
|
||||||
|
@ -93,8 +93,8 @@ protected:
|
||||||
void processRuleViolationLock();
|
void processRuleViolationLock();
|
||||||
|
|
||||||
// vip related
|
// vip related
|
||||||
void processVipAdd(uint id, const std::string& name, bool online);
|
void processVipAdd(uint id, const std::string& name, uint status);
|
||||||
void processVipStateChange(uint id, bool online);
|
void processVipStateChange(uint id, uint status);
|
||||||
|
|
||||||
// tutorial hint
|
// tutorial hint
|
||||||
void processTutorialHint(int id);
|
void processTutorialHint(int id);
|
||||||
|
|
|
@ -43,9 +43,11 @@ namespace Proto {
|
||||||
{
|
{
|
||||||
GameServerInitGame = 10,
|
GameServerInitGame = 10,
|
||||||
GameServerGMActions = 11,
|
GameServerGMActions = 11,
|
||||||
|
GameServerEnterGame = 15,
|
||||||
GameServerLoginError = 20,
|
GameServerLoginError = 20,
|
||||||
GameServerLoginAdvice = 21,
|
GameServerLoginAdvice = 21,
|
||||||
GameServerLoginWait = 22,
|
GameServerLoginWait = 22,
|
||||||
|
GameServerAddCreature = 23,
|
||||||
GameServerPingBack = 29,
|
GameServerPingBack = 29,
|
||||||
GameServerPing = 30,
|
GameServerPing = 30,
|
||||||
GameServerChallange = 31,
|
GameServerChallange = 31,
|
||||||
|
@ -124,7 +126,7 @@ namespace Proto {
|
||||||
GameServerFloorChangeDown = 191,
|
GameServerFloorChangeDown = 191,
|
||||||
GameServerChooseOutfit = 200,
|
GameServerChooseOutfit = 200,
|
||||||
GameServerVipAdd = 210,
|
GameServerVipAdd = 210,
|
||||||
GameServerVipLogin = 211,
|
GameServerVipState = 211,
|
||||||
GameServerVipLogout = 212,
|
GameServerVipLogout = 212,
|
||||||
GameServerTutorialHint = 220,
|
GameServerTutorialHint = 220,
|
||||||
GameServerAutomapFlag = 221,
|
GameServerAutomapFlag = 221,
|
||||||
|
|
|
@ -119,6 +119,8 @@ public:
|
||||||
|
|
||||||
private:
|
private:
|
||||||
void parseMessage(const InputMessagePtr& msg);
|
void parseMessage(const InputMessagePtr& msg);
|
||||||
|
void parsePendingGame(const InputMessagePtr& msg);
|
||||||
|
void parseEnterGame(const InputMessagePtr& msg);
|
||||||
void parseInitGame(const InputMessagePtr& msg);
|
void parseInitGame(const InputMessagePtr& msg);
|
||||||
void parseGMActions(const InputMessagePtr& msg);
|
void parseGMActions(const InputMessagePtr& msg);
|
||||||
void parseLoginError(const InputMessagePtr& msg);
|
void parseLoginError(const InputMessagePtr& msg);
|
||||||
|
@ -191,7 +193,7 @@ private:
|
||||||
void parseFloorChangeDown(const InputMessagePtr& msg);
|
void parseFloorChangeDown(const InputMessagePtr& msg);
|
||||||
void parseOpenOutfitWindow(const InputMessagePtr& msg);
|
void parseOpenOutfitWindow(const InputMessagePtr& msg);
|
||||||
void parseVipAdd(const InputMessagePtr& msg);
|
void parseVipAdd(const InputMessagePtr& msg);
|
||||||
void parseVipLogin(const InputMessagePtr& msg);
|
void parseVipState(const InputMessagePtr& msg);
|
||||||
void parseVipLogout(const InputMessagePtr& msg);
|
void parseVipLogout(const InputMessagePtr& msg);
|
||||||
void parseTutorialHint(const InputMessagePtr& msg);
|
void parseTutorialHint(const InputMessagePtr& msg);
|
||||||
void parseAutomapFlag(const InputMessagePtr& msg);
|
void parseAutomapFlag(const InputMessagePtr& msg);
|
||||||
|
|
|
@ -57,8 +57,16 @@ void ProtocolGame::parseMessage(const InputMessagePtr& msg)
|
||||||
|
|
||||||
switch(opcode) {
|
switch(opcode) {
|
||||||
case Proto::GameServerInitGame:
|
case Proto::GameServerInitGame:
|
||||||
|
case Proto::GameServerAddCreature:
|
||||||
|
if(opcode == Proto::GameServerInitGame && g_game.getFeature(Otc::GameLoginPending))
|
||||||
|
parsePendingGame(msg);
|
||||||
|
else
|
||||||
parseInitGame(msg);
|
parseInitGame(msg);
|
||||||
break;
|
break;
|
||||||
|
case Proto::GameServerEnterGame:
|
||||||
|
if(g_game.getFeature(Otc::GameLoginPending))
|
||||||
|
parseEnterGame(msg);
|
||||||
|
break;
|
||||||
case Proto::GameServerGMActions:
|
case Proto::GameServerGMActions:
|
||||||
parseGMActions(msg);
|
parseGMActions(msg);
|
||||||
break;
|
break;
|
||||||
|
@ -262,8 +270,8 @@ void ProtocolGame::parseMessage(const InputMessagePtr& msg)
|
||||||
case Proto::GameServerVipAdd:
|
case Proto::GameServerVipAdd:
|
||||||
parseVipAdd(msg);
|
parseVipAdd(msg);
|
||||||
break;
|
break;
|
||||||
case Proto::GameServerVipLogin:
|
case Proto::GameServerVipState:
|
||||||
parseVipLogin(msg);
|
parseVipState(msg);
|
||||||
break;
|
break;
|
||||||
case Proto::GameServerVipLogout:
|
case Proto::GameServerVipLogout:
|
||||||
parseVipLogout(msg);
|
parseVipLogout(msg);
|
||||||
|
@ -328,6 +336,13 @@ void ProtocolGame::parseInitGame(const InputMessagePtr& msg)
|
||||||
{
|
{
|
||||||
uint playerId = msg->getU32();
|
uint playerId = msg->getU32();
|
||||||
int serverBeat = msg->getU16();
|
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();
|
bool canReportBugs = msg->getU8();
|
||||||
|
|
||||||
m_localPlayer->setId(playerId);
|
m_localPlayer->setId(playerId);
|
||||||
|
@ -335,6 +350,16 @@ void ProtocolGame::parseInitGame(const InputMessagePtr& msg)
|
||||||
g_game.setCanReportBugs(canReportBugs);
|
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)
|
void ProtocolGame::parseGMActions(const InputMessagePtr& msg)
|
||||||
{
|
{
|
||||||
std::vector<uint8> actions;
|
std::vector<uint8> actions;
|
||||||
|
@ -618,7 +643,12 @@ void ProtocolGame::parsePlayerGoods(const InputMessagePtr& msg)
|
||||||
{
|
{
|
||||||
std::vector<std::tuple<ItemPtr, int>> goods;
|
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();
|
int size = msg->getU8();
|
||||||
for(int i = 0; i < size; i++) {
|
for(int i = 0; i < size; i++) {
|
||||||
int itemId = msg->getU16();
|
int itemId = msg->getU16();
|
||||||
|
@ -1259,9 +1289,9 @@ void ProtocolGame::parseOpenOutfitWindow(const InputMessagePtr& msg)
|
||||||
|
|
||||||
void ProtocolGame::parseVipAdd(const InputMessagePtr& msg)
|
void ProtocolGame::parseVipAdd(const InputMessagePtr& msg)
|
||||||
{
|
{
|
||||||
uint id, markId;
|
uint id, markId, status;
|
||||||
std::string name, desc;
|
std::string name, desc;
|
||||||
bool online, notifyLogin;
|
bool notifyLogin;
|
||||||
|
|
||||||
id = msg->getU32();
|
id = msg->getU32();
|
||||||
name = g_game.formatCreatureName(msg->getString());
|
name = g_game.formatCreatureName(msg->getString());
|
||||||
|
@ -1270,21 +1300,27 @@ void ProtocolGame::parseVipAdd(const InputMessagePtr& msg)
|
||||||
markId = msg->getU32();
|
markId = msg->getU32();
|
||||||
notifyLogin = msg->getU8();
|
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();
|
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)
|
void ProtocolGame::parseVipLogout(const InputMessagePtr& msg)
|
||||||
{
|
{
|
||||||
uint id = msg->getU32();
|
uint id = msg->getU32();
|
||||||
g_game.processVipStateChange(id, false);
|
g_game.processVipStateChange(id, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
void ProtocolGame::parseTutorialHint(const InputMessagePtr& msg)
|
void ProtocolGame::parseTutorialHint(const InputMessagePtr& msg)
|
||||||
|
|
Loading…
Reference in New Issue