From 4c539cbbe3e4a758e47b2b3134a0e02d4630da49 Mon Sep 17 00:00:00 2001 From: Henrique Santiago Date: Sun, 8 Jan 2012 22:43:36 -0200 Subject: [PATCH] icons enum, fix animated msg, fix trade with on menu --- modules/game/thing.lua | 14 ++++-- src/otclient/const.h | 63 +++++++++++++++++--------- src/otclient/core/localplayer.h | 6 +-- src/otclient/core/map.cpp | 8 ++-- src/otclient/net/protocolgameparse.cpp | 2 +- 5 files changed, 58 insertions(+), 35 deletions(-) diff --git a/modules/game/thing.lua b/modules/game/thing.lua index 32854d95..76a1e934 100644 --- a/modules/game/thing.lua +++ b/modules/game/thing.lua @@ -10,6 +10,7 @@ function Game.createThingMenu(menuPosition, lookThing, useThing, creatureThing) -- Open or Use, depending if thing is a container if useThing then if useThing:isContainer() then + -- check for open in new window menu:addOption('Open', function() print('open') end) else if useThing:isMultiUse() then @@ -22,12 +23,15 @@ function Game.createThingMenu(menuPosition, lookThing, useThing, creatureThing) if useThing:isRotateable() then menu:addOption('Rotate', function() Game.rotate(useThing) end) end - - if not useThing:isNotMoveable() and useThing:isPickupable() then - menu:addSeparator() - menu:addOption('Trade with ...', function() print('trade with') end) - end + end + + if lookThing and not lookThing:asCreature() and not lookThing:isNotMoveable() and lookThing:isPickupable() then + menu:addSeparator() + menu:addOption('Trade with ...', function() print('trade with') end) + end + + -- check for move up if creatureThing then menu:addSeparator() diff --git a/src/otclient/const.h b/src/otclient/const.h index 1531b5e7..1c178788 100644 --- a/src/otclient/const.h +++ b/src/otclient/const.h @@ -83,7 +83,7 @@ namespace Otc }; enum Statistic { - Health, + Health = 0, MaxHealth, FreeCapacity, Experience, @@ -110,7 +110,7 @@ namespace Otc }; enum SkillType { - SkillLevel, + SkillLevel = 0, SkillPercent, LastSkillType }; @@ -128,7 +128,7 @@ namespace Otc }; enum FluidsColor { - FluidTransparent, + FluidTransparent = 0, FluidBlue, FluidRed, FluidBrown, @@ -164,33 +164,52 @@ namespace Otc enum PlayerSkulls { SkullNone = 0, - SkullYellow = 1, - SkullGreen = 2, - SkullWhite = 3, - SkullRed = 4, - SkullBlack = 5, - SkullOrange = 6 + SkullYellow, + SkullGreen, + SkullWhite, + SkullRed, + SkullBlack, + SkullOrange }; enum PlayerShields { ShieldNone = 0, - ShieldWhiteYellow = 1, - ShieldWhiteBlue = 2, - ShieldBlue = 3, - ShieldYellow = 4, - ShieldBlueSharedExp = 5, - ShieldYellowSharedExp = 6, - ShieldBlueNoSharedExpBlink = 7, - ShieldYellowNoSharedExpBlink = 8, - ShieldBlueNoSharedExp = 9, - ShieldYellowNoSharedExp = 10 + ShieldWhiteYellow, + ShieldWhiteBlue, + ShieldBlue, + ShieldYellow, + ShieldBlueSharedExp, + ShieldYellowSharedExp, + ShieldBlueNoSharedExpBlink, + ShieldYellowNoSharedExpBlink, + ShieldBlueNoSharedExp, + ShieldYellowNoSharedExp }; enum PlayerEmblems { EmblemNone = 0, - EmblemGreen = 1, - EmblemRed = 2, - EmblemBlue = 3 + EmblemGreen, + EmblemRed, + EmblemBlue + }; + + enum PlayerIcons { + IconNone = 0, + IconPoison = 1, + IconBurn = 2, + IconEnergy = 4, + IconDrunk = 8, + IconManaShield = 16, + IconParalyze = 32, + IconHaste = 64, + IconSwords = 128, + IconDrowning = 256, + IconFreezing = 512, + IconDazzled = 1024, + IconCursed = 2048, + IconPartyBuff = 4096, + IconPzBlock = 8192, + IconPz = 16384 }; } diff --git a/src/otclient/core/localplayer.h b/src/otclient/core/localplayer.h index 321aa6e5..dff399fc 100644 --- a/src/otclient/core/localplayer.h +++ b/src/otclient/core/localplayer.h @@ -35,7 +35,7 @@ public: void setStatistic(Otc::Statistic statistic, double value) { m_statistics[statistic] = value; } void setAttackingCreature(const CreaturePtr& creature); void setFollowingCreature(const CreaturePtr& creature); - void setIcons(int icons) { m_icons = icons; } + void setIcons(Otc::PlayerIcons icons) { m_icons = icons; } bool getCanReportBugs() { return m_canReportBugs; } int getSkill(Otc::Skill skill, Otc::SkillType skillType) { return m_skills[skill][skillType]; } @@ -43,7 +43,7 @@ public: CreaturePtr getAttackingCreature() { return m_attackingCreature; } CreaturePtr getFollowingCreature() { return m_followingCreature; } Otc::Direction getNextWalkDirection() { return m_nextWalkDirection; } - int getIcons() { return m_icons; } + Otc::PlayerIcons getIcons() { return m_icons; } bool isAttacking() { return m_attackingCreature != nullptr; } bool isFollowing() { return m_followingCreature != nullptr; } @@ -60,7 +60,7 @@ private: bool m_clientWalking; Otc::Direction m_nextWalkDirection; CreaturePtr m_attackingCreature, m_followingCreature; - int m_icons; + Otc::PlayerIcons m_icons; int m_skills[Otc::LastSkill][Otc::LastSkillType]; double m_statistics[Otc::LastStatistic]; }; diff --git a/src/otclient/core/map.cpp b/src/otclient/core/map.cpp index b3260b25..9586296c 100644 --- a/src/otclient/core/map.cpp +++ b/src/otclient/core/map.cpp @@ -130,16 +130,16 @@ void Map::draw(const Rect& rect) } } - // draw animated text - for(auto it = m_animatedTexts.begin(), end = m_animatedTexts.end(); it != end; ++it) { + // draw static text + for(auto it = m_staticTexts.begin(), end = m_staticTexts.end(); it != end; ++it) { Point pos = positionTo2D((*it)->getPos()) - m_drawOffset; pos.x *= horizontalStretchFactor; pos.y *= verticalStretchFactor; (*it)->draw(rect.topLeft() + pos, rect); } - // draw static text - for(auto it = m_staticTexts.begin(), end = m_staticTexts.end(); it != end; ++it) { + // draw animated text + for(auto it = m_animatedTexts.begin(), end = m_animatedTexts.end(); it != end; ++it) { Point pos = positionTo2D((*it)->getPos()) - m_drawOffset; pos.x *= horizontalStretchFactor; pos.y *= verticalStretchFactor; diff --git a/src/otclient/net/protocolgameparse.cpp b/src/otclient/net/protocolgameparse.cpp index 4c21193e..5debd8a3 100644 --- a/src/otclient/net/protocolgameparse.cpp +++ b/src/otclient/net/protocolgameparse.cpp @@ -725,7 +725,7 @@ void ProtocolGame::parsePlayerSkills(InputMessage& msg) void ProtocolGame::parsePlayerIcons(InputMessage& msg) { uint16 icons = msg.getU16(); - m_localPlayer->setIcons(icons); + m_localPlayer->setIcons((Otc::PlayerIcons)icons); } void ProtocolGame::parsePlayerCancelAttack(InputMessage& msg)