Partial 10.36 support, also fix #499
This commit is contained in:
parent
9d866a3616
commit
8d8f32b081
Binary file not shown.
After Width: | Height: | Size: 17 KiB |
Binary file not shown.
After Width: | Height: | Size: 17 KiB |
Binary file not shown.
After Width: | Height: | Size: 17 KiB |
Binary file not shown.
After Width: | Height: | Size: 795 B |
|
@ -56,7 +56,7 @@ function init()
|
|||
end
|
||||
|
||||
function bindKeys()
|
||||
gameRootPanel:setAutoRepeatDelay(80)
|
||||
gameRootPanel:setAutoRepeatDelay(200)
|
||||
|
||||
bindWalkKey('Up', North)
|
||||
bindWalkKey('Right', East)
|
||||
|
|
|
@ -186,7 +186,7 @@ CIPSOFT_RSA = "1321277432058722840622950990822933849527763264961655079678763618"
|
|||
"88792221429527047321331896351555606801473202394175817"
|
||||
|
||||
-- set to the latest Tibia.pic signature to make otclient compatible with official tibia
|
||||
PIC_SIGNATURE = 0x52131b61
|
||||
PIC_SIGNATURE = 0x52de78da
|
||||
|
||||
OsTypes = {
|
||||
Linux = 1,
|
||||
|
|
|
@ -27,6 +27,12 @@ EmblemGreen = 1
|
|||
EmblemRed = 2
|
||||
EmblemBlue = 3
|
||||
|
||||
NpcIconNone = 0
|
||||
NpcIconChat = 1
|
||||
NpcIconTrade = 2
|
||||
NpcIconQuest = 3
|
||||
NpcIconTradeQuest = 4
|
||||
|
||||
-- @}
|
||||
|
||||
function getSkullImagePath(skullId)
|
||||
|
@ -91,6 +97,20 @@ function getEmblemImagePath(emblemId)
|
|||
return path
|
||||
end
|
||||
|
||||
function getIconImagePath(iconId)
|
||||
local path
|
||||
if iconId == NpcIconChat then
|
||||
path = '/images/game/npcicons/icon_chat'
|
||||
elseif iconId == NpcIconTrade then
|
||||
path = '/images/game/npcicons/icon_trade'
|
||||
elseif iconId == NpcIconQuest then
|
||||
path = '/images/game/npcicons/icon_quest'
|
||||
elseif iconId == NpcIconTradeQuest then
|
||||
path = '/images/game/npcicons/icon_tradequest'
|
||||
end
|
||||
return path
|
||||
end
|
||||
|
||||
function Creature:onSkullChange(skullId)
|
||||
local imagePath = getSkullImagePath(skullId)
|
||||
if imagePath then
|
||||
|
@ -111,3 +131,10 @@ function Creature:onEmblemChange(emblemId)
|
|||
self:setEmblemTexture(imagePath)
|
||||
end
|
||||
end
|
||||
|
||||
function Creature:onIconChange(iconId)
|
||||
local imagePath = getIconImagePath(iconId)
|
||||
if imagePath then
|
||||
self:setIconTexture(imagePath)
|
||||
end
|
||||
end
|
|
@ -54,7 +54,7 @@ function g_game.getSupportedClients()
|
|||
940, 944, 953, 954, 960, 961, 963,
|
||||
970, 980, 981, 982, 983, 984, 985,
|
||||
986, 1001, 1002, 1010, 1020, 1021,
|
||||
1022, 1031, 1034, 1035
|
||||
1022, 1031, 1034, 1035, 1036
|
||||
}
|
||||
end
|
||||
|
||||
|
|
|
@ -247,6 +247,14 @@ namespace Otc
|
|||
EmblemOther
|
||||
};
|
||||
|
||||
enum CreatureIcons {
|
||||
NpcIconNone = 0,
|
||||
NpcIconChat,
|
||||
NpcIconTrade,
|
||||
NpcIconQuest,
|
||||
NpcIconTradeQuest
|
||||
};
|
||||
|
||||
enum PlayerStates {
|
||||
IconNone = 0,
|
||||
IconPoison = 1,
|
||||
|
@ -377,6 +385,8 @@ namespace Otc
|
|||
GameWritableDate = 51,
|
||||
GameAdditionalVipInfo = 52,
|
||||
GameBaseSkillU16 = 53,
|
||||
GameCreatureIcons = 54,
|
||||
GameHideNpcNames = 55,
|
||||
|
||||
LastGameFeature = 101
|
||||
};
|
||||
|
|
|
@ -53,6 +53,7 @@ Creature::Creature() : Thing()
|
|||
m_skull = Otc::SkullNone;
|
||||
m_shield = Otc::ShieldNone;
|
||||
m_emblem = Otc::EmblemNone;
|
||||
m_icon = Otc::NpcIconNone;
|
||||
m_lastStepDirection = Otc::InvalidDirection;
|
||||
m_nameCache.setFont(g_fonts.getFont("verdana-11px-rounded"));
|
||||
m_nameCache.setAlign(Fw::AlignTopCenter);
|
||||
|
@ -258,7 +259,7 @@ void Creature::drawInformation(const Point& point, bool useGray, const Rect& par
|
|||
if(g_game.getFeature(Otc::GameBlueNpcNameColor) && isNpc() && m_healthPercent == 100 && !useGray)
|
||||
fillColor = Color(0x66, 0xcc, 0xff);
|
||||
|
||||
if(drawFlags & Otc::DrawBars) {
|
||||
if(drawFlags & Otc::DrawBars && (!isNpc() || !g_game.getFeature(Otc::GameHideNpcNames))) {
|
||||
g_painter->setColor(Color::black);
|
||||
g_painter->drawFilledRect(backgroundRect);
|
||||
|
||||
|
@ -287,6 +288,11 @@ void Creature::drawInformation(const Point& point, bool useGray, const Rect& par
|
|||
Rect emblemRect = Rect(backgroundRect.x() + 13.5 + 12, backgroundRect.y() + 16, m_emblemTexture->getSize());
|
||||
g_painter->drawTexturedRect(emblemRect, m_emblemTexture);
|
||||
}
|
||||
if(m_icon != Otc::NpcIconNone && m_iconTexture) {
|
||||
g_painter->setColor(Color::white);
|
||||
Rect iconRect = Rect(backgroundRect.x() + 13.5 + 12, backgroundRect.y() + 5, m_iconTexture->getSize());
|
||||
g_painter->drawTexturedRect(iconRect, m_iconTexture);
|
||||
}
|
||||
}
|
||||
|
||||
void Creature::turn(Otc::Direction direction)
|
||||
|
@ -708,6 +714,12 @@ void Creature::setEmblem(uint8 emblem)
|
|||
callLuaField("onEmblemChange", m_emblem);
|
||||
}
|
||||
|
||||
void Creature::setIcon(uint8 icon)
|
||||
{
|
||||
m_icon = icon;
|
||||
callLuaField("onIconChange", m_icon);
|
||||
}
|
||||
|
||||
void Creature::setSkullTexture(const std::string& filename)
|
||||
{
|
||||
m_skullTexture = g_textures.getTexture(filename);
|
||||
|
@ -733,6 +745,12 @@ void Creature::setEmblemTexture(const std::string& filename)
|
|||
m_emblemTexture = g_textures.getTexture(filename);
|
||||
}
|
||||
|
||||
void Creature::setIconTexture(const std::string& filename)
|
||||
{
|
||||
m_iconTexture = g_textures.getTexture(filename);
|
||||
}
|
||||
|
||||
|
||||
void Creature::setSpeedFormula(double speedA, double speedB, double speedC)
|
||||
{
|
||||
m_speedFormula[Otc::SpeedFormulaA] = speedA;
|
||||
|
|
|
@ -61,9 +61,11 @@ public:
|
|||
void setSkull(uint8 skull);
|
||||
void setShield(uint8 shield);
|
||||
void setEmblem(uint8 emblem);
|
||||
void setIcon(uint8 icon);
|
||||
void setSkullTexture(const std::string& filename);
|
||||
void setShieldTexture(const std::string& filename, bool blink);
|
||||
void setEmblemTexture(const std::string& filename);
|
||||
void setIconTexture(const std::string& filename);
|
||||
void setPassable(bool passable) { m_passable = passable; }
|
||||
void setSpeedFormula(double speedA, double speedB, double speedC);
|
||||
|
||||
|
@ -83,6 +85,7 @@ public:
|
|||
uint8 getSkull() { return m_skull; }
|
||||
uint8 getShield() { return m_shield; }
|
||||
uint8 getEmblem() { return m_emblem; }
|
||||
uint8 getIcon() { return m_icon; }
|
||||
bool isPassable() { return m_passable; }
|
||||
Point getDrawOffset();
|
||||
int getStepDuration(bool ignoreDiagonal = false, Otc::Direction dir = Otc::InvalidDirection);
|
||||
|
@ -146,9 +149,11 @@ protected:
|
|||
uint8 m_skull;
|
||||
uint8 m_shield;
|
||||
uint8 m_emblem;
|
||||
uint8 m_icon;
|
||||
TexturePtr m_skullTexture;
|
||||
TexturePtr m_shieldTexture;
|
||||
TexturePtr m_emblemTexture;
|
||||
TexturePtr m_iconTexture;
|
||||
stdext::boolean<true> m_showShieldTexture;
|
||||
stdext::boolean<false> m_shieldBlink;
|
||||
stdext::boolean<false> m_passable;
|
||||
|
|
|
@ -1459,7 +1459,7 @@ void Game::setProtocolVersion(int version)
|
|||
if(isOnline())
|
||||
stdext::throw_exception("Unable to change protocol version while online");
|
||||
|
||||
if(version != 0 && (version < 760 || version > 1035))
|
||||
if(version != 0 && (version < 760 || version > 1036))
|
||||
stdext::throw_exception(stdext::format("Protocol version %d not supported", version));
|
||||
|
||||
m_features.reset();
|
||||
|
@ -1563,9 +1563,15 @@ void Game::setProtocolVersion(int version)
|
|||
}
|
||||
|
||||
if (version >= 1035) {
|
||||
enableFeature(Otc::GameDoubleSkills);
|
||||
enableFeature(Otc::GameBaseSkillU16);
|
||||
enableFeature(Otc::GameDoubleSkills);
|
||||
enableFeature(Otc::GameBaseSkillU16);
|
||||
}
|
||||
|
||||
if(version >= 1036) {
|
||||
enableFeature(Otc::GameCreatureIcons);
|
||||
enableFeature(Otc::GameHideNpcNames);
|
||||
}
|
||||
|
||||
m_protocolVersion = version;
|
||||
|
||||
Proto::buildMessageModesMap(version);
|
||||
|
@ -1581,7 +1587,7 @@ void Game::setClientVersion(int version)
|
|||
if(isOnline())
|
||||
stdext::throw_exception("Unable to change client version while online");
|
||||
|
||||
if(version != 0 && (version < 760 || version > 1035))
|
||||
if(version != 0 && (version < 760 || version > 1036))
|
||||
stdext::throw_exception(stdext::format("Client version %d not supported", version));
|
||||
|
||||
m_clientVersion = version;
|
||||
|
|
|
@ -297,9 +297,11 @@ void LocalPlayer::onAppear()
|
|||
{
|
||||
Creature::onAppear();
|
||||
|
||||
/* Does not seem to be needed anymore
|
||||
// on teleports lock the walk
|
||||
if(!m_oldPosition.isInRange(m_position,1,1))
|
||||
lockWalk();
|
||||
*/
|
||||
}
|
||||
|
||||
void LocalPlayer::onPositionChange(const Position& newPos, const Position& oldPos)
|
||||
|
|
|
@ -436,6 +436,7 @@ void Client::registerLuaFunctions()
|
|||
g_lua.bindClassMemberFunction<Creature>("getSkull", &Creature::getSkull);
|
||||
g_lua.bindClassMemberFunction<Creature>("getShield", &Creature::getShield);
|
||||
g_lua.bindClassMemberFunction<Creature>("getEmblem", &Creature::getEmblem);
|
||||
g_lua.bindClassMemberFunction<Creature>("getIcon", &Creature::getIcon);
|
||||
g_lua.bindClassMemberFunction<Creature>("setOutfit", &Creature::setOutfit);
|
||||
g_lua.bindClassMemberFunction<Creature>("getOutfit", &Creature::getOutfit);
|
||||
g_lua.bindClassMemberFunction<Creature>("setOutfitColor", &Creature::setOutfitColor);
|
||||
|
@ -448,6 +449,7 @@ void Client::registerLuaFunctions()
|
|||
g_lua.bindClassMemberFunction<Creature>("setSkullTexture", &Creature::setSkullTexture);
|
||||
g_lua.bindClassMemberFunction<Creature>("setShieldTexture", &Creature::setShieldTexture);
|
||||
g_lua.bindClassMemberFunction<Creature>("setEmblemTexture", &Creature::setEmblemTexture);
|
||||
g_lua.bindClassMemberFunction<Creature>("setIconTexture", &Creature::setIconTexture);
|
||||
g_lua.bindClassMemberFunction<Creature>("showStaticSquare", &Creature::showStaticSquare);
|
||||
g_lua.bindClassMemberFunction<Creature>("hideStaticSquare", &Creature::hideStaticSquare);
|
||||
g_lua.bindClassMemberFunction<Creature>("isWalking", &Creature::isWalking);
|
||||
|
|
|
@ -28,8 +28,15 @@ std::map<uint8, uint8> messageModesMap;
|
|||
|
||||
void buildMessageModesMap(int version) {
|
||||
messageModesMap.clear();
|
||||
if(version >= 900) {
|
||||
for(int i=Otc::MessageNone;i<=Otc::MessageBeyondLast;++i)
|
||||
if(version >= 1036) {
|
||||
for(int i = Otc::MessageNone; i <= Otc::MessageBeyondLast; ++i) {
|
||||
if(i >= Otc::MessageNpcTo)
|
||||
messageModesMap[i] = i + 1;
|
||||
else
|
||||
messageModesMap[i] = i;
|
||||
}
|
||||
} else if(version >= 900) {
|
||||
for(int i = Otc::MessageNone; i <= Otc::MessageBeyondLast; ++i)
|
||||
messageModesMap[i] = i;
|
||||
} else if(version >= 861) {
|
||||
messageModesMap[Otc::MessageNone] = 0;
|
||||
|
|
|
@ -1879,7 +1879,6 @@ CreaturePtr ProtocolGame::getCreature(const InputMessagePtr& msg, int type)
|
|||
|
||||
CreaturePtr creature;
|
||||
bool known = (type != Proto::UnknownCreature);
|
||||
|
||||
if(type == Proto::OutdatedCreature || type == Proto::UnknownCreature) {
|
||||
if(known) {
|
||||
uint id = msg->getU32();
|
||||
|
@ -1944,6 +1943,7 @@ CreaturePtr ProtocolGame::getCreature(const InputMessagePtr& msg, int type)
|
|||
|
||||
// emblem is sent only when the creature is not known
|
||||
int emblem = -1;
|
||||
int icon = -1;
|
||||
bool unpass = true;
|
||||
uint8 mark;
|
||||
|
||||
|
@ -1952,6 +1952,13 @@ CreaturePtr ProtocolGame::getCreature(const InputMessagePtr& msg, int type)
|
|||
|
||||
if(g_game.getFeature(Otc::GameThingMarks)) {
|
||||
msg->getU8(); // creature type for summons
|
||||
}
|
||||
|
||||
if(g_game.getFeature(Otc::GameCreatureIcons)) {
|
||||
icon = msg->getU8();
|
||||
}
|
||||
|
||||
if(g_game.getFeature(Otc::GameThingMarks)) {
|
||||
mark = msg->getU8(); // mark
|
||||
msg->getU16(); // helpers
|
||||
|
||||
|
@ -1977,6 +1984,8 @@ CreaturePtr ProtocolGame::getCreature(const InputMessagePtr& msg, int type)
|
|||
creature->setLight(light);
|
||||
if(emblem != -1)
|
||||
creature->setEmblem(emblem);
|
||||
if(icon != -1)
|
||||
creature->setIcon(icon);
|
||||
|
||||
if(creature == m_localPlayer && !m_localPlayer->isKnown())
|
||||
m_localPlayer->setKnown(true);
|
||||
|
|
Loading…
Reference in New Issue