10.94, 10.95 support

This commit is contained in:
Sam
2016-07-03 00:50:08 +02:00
parent 8992d40e37
commit 1ec3b65a3a
12 changed files with 143 additions and 23 deletions

View File

@@ -148,6 +148,12 @@ namespace Otc
Distance,
Shielding,
Fishing,
CriticalChance,
CriticalDamage,
LifeLeechChance,
LifeLeechAmount,
ManaLeechChance,
ManaLeechAmount,
LastSkill
};
@@ -318,19 +324,20 @@ namespace Otc
MessageTutorialHint = 38,
MessageThankyou = 39,
MessageMarket = 40,
MessageBeyondLast = 41,
MessageMana = 41,
MessageBeyondLast = 42,
// deprecated
MessageMonsterYell = 42,
MessageMonsterSay = 43,
MessageRed = 44,
MessageBlue = 45,
MessageRVRChannel = 46,
MessageRVRAnswer = 47,
MessageRVRContinue = 48,
MessageGameHighlight = 49,
MessageNpcFromStartBlock = 50,
LastMessage = 51,
MessageMonsterYell = 43,
MessageMonsterSay = 44,
MessageRed = 45,
MessageBlue = 46,
MessageRVRChannel = 47,
MessageRVRAnswer = 48,
MessageRVRContinue = 49,
MessageGameHighlight = 50,
MessageNpcFromStartBlock = 51,
LastMessage = 52,
MessageInvalid = 255
};
@@ -408,6 +415,7 @@ namespace Otc
GameIngameStore = 73,
GameIngameStoreHighlights = 74,
GameIngameStoreServiceType = 75,
GameAdditionalSkills = 76,
LastGameFeature = 101
};

View File

@@ -1492,7 +1492,7 @@ void Game::setProtocolVersion(int version)
if(isOnline())
stdext::throw_exception("Unable to change protocol version while online");
if(version != 0 && (version < 740 || version > 1093))
if(version != 0 && (version < 740 || version > 1095))
stdext::throw_exception(stdext::format("Protocol version %d not supported", version));
m_protocolVersion = version;
@@ -1510,7 +1510,7 @@ void Game::setClientVersion(int version)
if(isOnline())
stdext::throw_exception("Unable to change client version while online");
if(version != 0 && (version < 740 || version > 1093))
if(version != 0 && (version < 740 || version > 1095))
stdext::throw_exception(stdext::format("Client version %d not supported", version));
m_features.reset();
@@ -1674,6 +1674,9 @@ void Game::setClientVersion(int version)
enableFeature(Otc::GameIngameStoreHighlights);
}
if(version >= 1094) {
enableFeature(Otc::GameAdditionalSkills);
}
m_clientVersion = version;

View File

@@ -387,9 +387,13 @@ void Client::registerLuaFunctions()
g_lua.bindClassMemberFunction<Thing>("isTranslucent", &Thing::isTranslucent);
g_lua.bindClassMemberFunction<Thing>("isFullGround", &Thing::isFullGround);
g_lua.bindClassMemberFunction<Thing>("isMarketable", &Thing::isMarketable);
g_lua.bindClassMemberFunction<Thing>("getMarketData", &Thing::getMarketData);
g_lua.bindClassMemberFunction<Thing>("isUsable", &Thing::isUsable);
g_lua.bindClassMemberFunction<Thing>("isWrapable", &Thing::isWrapable);
g_lua.bindClassMemberFunction<Thing>("isUnwrapable", &Thing::isUnwrapable);
g_lua.bindClassMemberFunction<Thing>("isTopEffect", &Thing::isTopEffect);
g_lua.bindClassMemberFunction<Thing>("isLyingCorpse", &Thing::isLyingCorpse);
g_lua.bindClassMemberFunction<Thing>("getParentContainer", &Thing::getParentContainer);
g_lua.bindClassMemberFunction<Thing>("getMarketData", &Thing::getMarketData);
g_lua.registerClass<House>();
g_lua.bindClassStaticFunction<House>("create", []{ return HousePtr(new House); });
@@ -541,6 +545,10 @@ void Client::registerLuaFunctions()
g_lua.bindClassMemberFunction<ThingType>("isCloth", &ThingType::isCloth);
g_lua.bindClassMemberFunction<ThingType>("isMarketable", &ThingType::isMarketable);
g_lua.bindClassMemberFunction<ThingType>("getMarketData", &ThingType::getMarketData);
g_lua.bindClassMemberFunction<ThingType>("isUsable", &ThingType::isUsable);
g_lua.bindClassMemberFunction<ThingType>("isWrapable", &ThingType::isWrapable);
g_lua.bindClassMemberFunction<ThingType>("isUnwrapable", &ThingType::isUnwrapable);
g_lua.bindClassMemberFunction<ThingType>("isTopEffect", &ThingType::isTopEffect);
g_lua.bindClassMemberFunction<ThingType>("getSprites", &ThingType::getSprites);
g_lua.bindClassMemberFunction<ThingType>("hasAttribute", &ThingType::hasAttr);
g_lua.bindClassMemberFunction<ThingType>("exportImage", &ThingType::exportImage);

View File

@@ -29,6 +29,10 @@ std::map<uint8, uint8> messageModesMap;
void buildMessageModesMap(int version) {
messageModesMap.clear();
if(version >= 1094) {
messageModesMap[Otc::MessageMana] = 43;
}
if(version >= 1055) { // might be 1054
messageModesMap[Otc::MessageNone] = 0;
messageModesMap[Otc::MessageSay] = 1;

View File

@@ -1376,7 +1376,11 @@ void ProtocolGame::parsePlayerStats(const InputMessagePtr& msg)
void ProtocolGame::parsePlayerSkills(const InputMessagePtr& msg)
{
for(int skill = 0; skill < Otc::LastSkill; skill++) {
int lastSkill = Otc::Fishing + 1;
if(g_game.getFeature(Otc::GameAdditionalSkills))
lastSkill = Otc::LastSkill;
for(int skill = 0; skill < lastSkill; skill++) {
int level;
if(g_game.getFeature(Otc::GameDoubleSkills))
@@ -1393,7 +1397,10 @@ void ProtocolGame::parsePlayerSkills(const InputMessagePtr& msg)
else
baseLevel = level;
int levelPercent = msg->getU8();
int levelPercent = 0;
// Critical, Life Leech and Mana Leech have no level percent
if(skill <= Otc::Fishing)
levelPercent = msg->getU8();
m_localPlayer->setSkill((Otc::Skill)skill, level, levelPercent);
m_localPlayer->setBaseSkill((Otc::Skill)skill, baseLevel);
@@ -1635,6 +1642,7 @@ void ProtocolGame::parseTextMessage(const InputMessagePtr& msg)
break;
}
case Otc::MessageHeal:
case Otc::MessageMana:
case Otc::MessageExp:
case Otc::MessageHealOthers:
case Otc::MessageExpOthers: {

View File

@@ -117,6 +117,10 @@ public:
bool isIgnoreLook() { return rawGetThingType()->isIgnoreLook(); }
bool isCloth() { return rawGetThingType()->isCloth(); }
bool isMarketable() { return rawGetThingType()->isMarketable(); }
bool isUsable() { return rawGetThingType()->isUsable(); }
bool isWrapable() { return rawGetThingType()->isWrapable(); }
bool isUnwrapable() { return rawGetThingType()->isUnwrapable(); }
bool isTopEffect() { return rawGetThingType()->isTopEffect(); }
MarketData getMarketData() { return rawGetThingType()->getMarketData(); }
virtual void onPositionChange(const Position& newPos, const Position& oldPos) { }

View File

@@ -84,6 +84,9 @@ enum ThingAttr : uint8 {
ThingAttrCloth = 32,
ThingAttrMarket = 33,
ThingAttrUsable = 34,
ThingAttrWrapable = 35,
ThingAttrUnwrapable = 36,
ThingAttrTopEffect = 37,
// additional
ThingAttrOpacity = 100,
@@ -193,6 +196,11 @@ public:
bool isIgnoreLook() { return m_attribs.has(ThingAttrLook); }
bool isCloth() { return m_attribs.has(ThingAttrCloth); }
bool isMarketable() { return m_attribs.has(ThingAttrMarket); }
bool isUsable() { return m_attribs.has(ThingAttrUsable); }
bool isWrapable() { return m_attribs.has(ThingAttrWrapable); }
bool isUnwrapable() { return m_attribs.has(ThingAttrUnwrapable); }
bool isTopEffect() { return m_attribs.has(ThingAttrTopEffect); }
std::vector<int> getSprites() { return m_spritesIndex; }
// additional

View File

@@ -195,7 +195,10 @@ void Tile::addThing(const ThingPtr& thing, int stackPos)
return;
if(thing->isEffect()) {
m_effects.push_back(thing->static_self_cast<Effect>());
if(thing->isTopEffect())
m_effects.insert(m_effects.begin(), thing->static_self_cast<Effect>());
else
m_effects.push_back(thing->static_self_cast<Effect>());
} else {
// priority 854
// 0 - ground, --> -->