Protocol 10.76, fixed death window & death packet

This commit is contained in:
TheSumm
2015-03-07 06:09:00 +01:00
parent ca60efd786
commit 83dc129f03
8 changed files with 61 additions and 13 deletions

View File

@@ -402,6 +402,7 @@ namespace Otc
GameAuthenticator = 67,
GameUnjustifiedPoints = 68,
GameSessionKey = 69,
GameDeathType = 70,
LastGameFeature = 101
};
@@ -466,6 +467,11 @@ namespace Otc
BlessingWisdomOfSolitude = 1 << 4,
BlessingSparkOfPhoenix = 1 << 5
};
enum DeathType {
DeathRegular = 0,
DeathBlessed = 1
};
}
#endif

View File

@@ -228,12 +228,12 @@ void Game::processGameEnd()
g_map.cleanDynamicThings();
}
void Game::processDeath(int penality)
void Game::processDeath(int deathType, int penality)
{
m_dead = true;
m_localPlayer->stopWalk();
g_lua.callGlobalField("g_game", "onDeath", penality);
g_lua.callGlobalField("g_game", "onDeath", deathType, penality);
}
void Game::processGMActions(const std::vector<uint8>& actions)
@@ -1450,7 +1450,7 @@ void Game::setProtocolVersion(int version)
if(isOnline())
stdext::throw_exception("Unable to change protocol version while online");
if(version != 0 && (version < 740 || version > 1075))
if(version != 0 && (version < 740 || version > 1076))
stdext::throw_exception(stdext::format("Protocol version %d not supported", version));
m_protocolVersion = version;
@@ -1468,7 +1468,7 @@ void Game::setClientVersion(int version)
if(isOnline())
stdext::throw_exception("Unable to change client version while online");
if(version != 0 && (version < 740 || version > 1075))
if(version != 0 && (version < 740 || version > 1076))
stdext::throw_exception(stdext::format("Client version %d not supported", version));
m_features.reset();
@@ -1596,6 +1596,10 @@ void Game::setClientVersion(int version)
enableFeature(Otc::GameExperienceBonus);
}
if(version >= 1055) {
enableFeature(Otc::GameDeathType);
}
if(version >= 1061) {
enableFeature(Otc::GameOGLInformation);
}

View File

@@ -86,7 +86,7 @@ protected:
void processGameStart();
void processGameEnd();
void processDeath(int penality);
void processDeath(int deathType, int penality);
void processGMActions(const std::vector<uint8>& actions);
void processInventoryChange(int slot, const ItemPtr& item);

View File

@@ -537,9 +537,15 @@ void ProtocolGame::parseChallenge(const InputMessagePtr& msg)
void ProtocolGame::parseDeath(const InputMessagePtr& msg)
{
int penality = 100;
if(g_game.getFeature(Otc::GamePenalityOnDeath))
int deathType = Otc::DeathRegular;
if(g_game.getFeature(Otc::GameDeathType))
deathType = msg->getU8();
if(g_game.getFeature(Otc::GamePenalityOnDeath) && deathType == Otc::DeathRegular)
penality = msg->getU8();
g_game.processDeath(penality);
g_game.processDeath(deathType, penality);
}
void ProtocolGame::parseMapDescription(const InputMessagePtr& msg)