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

@ -78,6 +78,11 @@ function resetSkillColor(id)
widget:setColor('#bbbbbb') widget:setColor('#bbbbbb')
end end
function toggleSkill(id, state)
local skill = skillsWindow:recursiveGetChildById(id)
skill:setVisible(state)
end
function setSkillBase(id, value, baseValue) function setSkillBase(id, value, baseValue)
if baseValue <= 0 or value < 0 then if baseValue <= 0 or value < 0 then
return return
@ -118,10 +123,12 @@ end
function setSkillPercent(id, percent, tooltip) function setSkillPercent(id, percent, tooltip)
local skill = skillsWindow:recursiveGetChildById(id) local skill = skillsWindow:recursiveGetChildById(id)
local widget = skill:getChildById('percent') local widget = skill:getChildById('percent')
widget:setPercent(math.floor(percent)) if widget then
widget:setPercent(math.floor(percent))
if tooltip then if tooltip then
widget:setTooltip(tooltip) widget:setTooltip(tooltip)
end
end end
end end
@ -204,16 +211,25 @@ function refresh()
onRegenerationChange(player, player:getRegenerationTime()) onRegenerationChange(player, player:getRegenerationTime())
onSpeedChange(player, player:getSpeed()) onSpeedChange(player, player:getSpeed())
for i=0,6 do local hasAdditionalSkills = g_game.getFeature(GameAdditionalSkills)
for i = Skill.Fist, Skill.ManaLeechAmount do
onSkillChange(player, i, player:getSkillLevel(i), player:getSkillLevelPercent(i)) onSkillChange(player, i, player:getSkillLevel(i), player:getSkillLevelPercent(i))
onBaseSkillChange(player, i, player:getSkillBaseLevel(i)) onBaseSkillChange(player, i, player:getSkillBaseLevel(i))
if i > Skill.Fishing then
toggleSkill('skillId'..i, hasAdditionalSkills)
end
end end
update() update()
local contentsPanel = skillsWindow:getChildById('contentsPanel') local contentsPanel = skillsWindow:getChildById('contentsPanel')
skillsWindow:setContentMinimumHeight(44) skillsWindow:setContentMinimumHeight(44)
skillsWindow:setContentMaximumHeight(390) if hasAdditionalSkills then
skillsWindow:setContentMaximumHeight(480)
else
skillsWindow:setContentMaximumHeight(390)
end
end end
function offline() function offline()

View File

@ -5,6 +5,9 @@ SkillButton < UIButton
margin-bottom: 2 margin-bottom: 2
&onClick: onSkillButtonClick &onClick: onSkillButtonClick
SmallSkillButton < SkillButton
height: 14
SkillNameLabel < GameLabel SkillNameLabel < GameLabel
font: verdana-11px-monochrome font: verdana-11px-monochrome
anchors.left: parent.left anchors.left: parent.left
@ -170,3 +173,39 @@ MiniWindow
!text: tr('Fishing') !text: tr('Fishing')
SkillValueLabel SkillValueLabel
SkillPercentPanel SkillPercentPanel
SmallSkillButton
id: skillId7
SkillNameLabel
!text: tr('Critical Hit Chance')
SkillValueLabel
SmallSkillButton
id: skillId8
SkillNameLabel
!text: tr('Critical Hit Damage')
SkillValueLabel
SmallSkillButton
id: skillId9
SkillNameLabel
!text: tr('Life Leech Chance')
SkillValueLabel
SmallSkillButton
id: skillId10
SkillNameLabel
!text: tr('Life Leech Amount')
SkillValueLabel
SmallSkillButton
id: skillId11
SkillNameLabel
!text: tr('Life Leech Chance')
SkillValueLabel
SmallSkillButton
id: skillId12
SkillNameLabel
!text: tr('Life Leech Amount')
SkillValueLabel

View File

@ -45,6 +45,22 @@ Directions = {
NorthWest = 7 NorthWest = 7
} }
Skill = {
Fist = 0,
Club = 1,
Sword = 2,
Axe = 3,
Distance = 4,
Shielding = 5,
Fishing = 6,
CriticalChance = 7,
CriticalDamage = 8,
LifeLeechChance = 9,
LifeLeechAmount = 10,
ManaLeechChance = 11,
ManaLeechAmount = 12
}
North = Directions.North North = Directions.North
East = Directions.East East = Directions.East
South = Directions.South South = Directions.South
@ -134,6 +150,9 @@ GameDeathType = 70
GameIdleAnimations = 71 GameIdleAnimations = 71
GameKeepUnawareTiles = 72 GameKeepUnawareTiles = 72
GameIngameStore = 73 GameIngameStore = 73
GameIngameStoreHighlights = 74
GameIngameStoreServiceType = 75
GameAdditionalSkills = 76
TextColors = { TextColors = {
red = '#f55e5e', --'#c83200' red = '#f55e5e', --'#c83200'

View File

@ -75,7 +75,7 @@ function g_game.getSupportedClients()
1063, 1064, 1070, 1071, 1072, 1063, 1064, 1070, 1071, 1072,
1073, 1074, 1075, 1076, 1080, 1073, 1074, 1075, 1076, 1080,
1081, 1082, 1090, 1091, 1092, 1081, 1082, 1090, 1091, 1092,
1093 1093, 1094, 1095
} }
end end

View File

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

View File

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

View File

@ -387,9 +387,13 @@ void Client::registerLuaFunctions()
g_lua.bindClassMemberFunction<Thing>("isTranslucent", &Thing::isTranslucent); g_lua.bindClassMemberFunction<Thing>("isTranslucent", &Thing::isTranslucent);
g_lua.bindClassMemberFunction<Thing>("isFullGround", &Thing::isFullGround); g_lua.bindClassMemberFunction<Thing>("isFullGround", &Thing::isFullGround);
g_lua.bindClassMemberFunction<Thing>("isMarketable", &Thing::isMarketable); 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>("isLyingCorpse", &Thing::isLyingCorpse);
g_lua.bindClassMemberFunction<Thing>("getParentContainer", &Thing::getParentContainer); g_lua.bindClassMemberFunction<Thing>("getParentContainer", &Thing::getParentContainer);
g_lua.bindClassMemberFunction<Thing>("getMarketData", &Thing::getMarketData);
g_lua.registerClass<House>(); g_lua.registerClass<House>();
g_lua.bindClassStaticFunction<House>("create", []{ return HousePtr(new 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>("isCloth", &ThingType::isCloth);
g_lua.bindClassMemberFunction<ThingType>("isMarketable", &ThingType::isMarketable); g_lua.bindClassMemberFunction<ThingType>("isMarketable", &ThingType::isMarketable);
g_lua.bindClassMemberFunction<ThingType>("getMarketData", &ThingType::getMarketData); 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>("getSprites", &ThingType::getSprites);
g_lua.bindClassMemberFunction<ThingType>("hasAttribute", &ThingType::hasAttr); g_lua.bindClassMemberFunction<ThingType>("hasAttribute", &ThingType::hasAttr);
g_lua.bindClassMemberFunction<ThingType>("exportImage", &ThingType::exportImage); g_lua.bindClassMemberFunction<ThingType>("exportImage", &ThingType::exportImage);

View File

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

View File

@ -1376,7 +1376,11 @@ void ProtocolGame::parsePlayerStats(const InputMessagePtr& msg)
void ProtocolGame::parsePlayerSkills(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; int level;
if(g_game.getFeature(Otc::GameDoubleSkills)) if(g_game.getFeature(Otc::GameDoubleSkills))
@ -1393,7 +1397,10 @@ void ProtocolGame::parsePlayerSkills(const InputMessagePtr& msg)
else else
baseLevel = level; 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->setSkill((Otc::Skill)skill, level, levelPercent);
m_localPlayer->setBaseSkill((Otc::Skill)skill, baseLevel); m_localPlayer->setBaseSkill((Otc::Skill)skill, baseLevel);
@ -1635,6 +1642,7 @@ void ProtocolGame::parseTextMessage(const InputMessagePtr& msg)
break; break;
} }
case Otc::MessageHeal: case Otc::MessageHeal:
case Otc::MessageMana:
case Otc::MessageExp: case Otc::MessageExp:
case Otc::MessageHealOthers: case Otc::MessageHealOthers:
case Otc::MessageExpOthers: { case Otc::MessageExpOthers: {

View File

@ -117,6 +117,10 @@ public:
bool isIgnoreLook() { return rawGetThingType()->isIgnoreLook(); } bool isIgnoreLook() { return rawGetThingType()->isIgnoreLook(); }
bool isCloth() { return rawGetThingType()->isCloth(); } bool isCloth() { return rawGetThingType()->isCloth(); }
bool isMarketable() { return rawGetThingType()->isMarketable(); } 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(); } MarketData getMarketData() { return rawGetThingType()->getMarketData(); }
virtual void onPositionChange(const Position& newPos, const Position& oldPos) { } virtual void onPositionChange(const Position& newPos, const Position& oldPos) { }

View File

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

View File

@ -195,7 +195,10 @@ void Tile::addThing(const ThingPtr& thing, int stackPos)
return; return;
if(thing->isEffect()) { 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 { } else {
// priority 854 // priority 854
// 0 - ground, --> --> // 0 - ground, --> -->