icons enum, fix animated msg, fix trade with on menu

This commit is contained in:
Henrique Santiago 2012-01-08 22:43:36 -02:00
parent e06692db96
commit 4c539cbbe3
5 changed files with 58 additions and 35 deletions

View File

@ -10,6 +10,7 @@ function Game.createThingMenu(menuPosition, lookThing, useThing, creatureThing)
-- Open or Use, depending if thing is a container -- Open or Use, depending if thing is a container
if useThing then if useThing then
if useThing:isContainer() then if useThing:isContainer() then
-- check for open in new window
menu:addOption('Open', function() print('open') end) menu:addOption('Open', function() print('open') end)
else else
if useThing:isMultiUse() then if useThing:isMultiUse() then
@ -22,12 +23,15 @@ function Game.createThingMenu(menuPosition, lookThing, useThing, creatureThing)
if useThing:isRotateable() then if useThing:isRotateable() then
menu:addOption('Rotate', function() Game.rotate(useThing) end) menu:addOption('Rotate', function() Game.rotate(useThing) end)
end end
if not useThing:isNotMoveable() and useThing:isPickupable() then
menu:addSeparator()
menu:addOption('Trade with ...', function() print('trade with') end)
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 if creatureThing then
menu:addSeparator() menu:addSeparator()

View File

@ -83,7 +83,7 @@ namespace Otc
}; };
enum Statistic { enum Statistic {
Health, Health = 0,
MaxHealth, MaxHealth,
FreeCapacity, FreeCapacity,
Experience, Experience,
@ -110,7 +110,7 @@ namespace Otc
}; };
enum SkillType { enum SkillType {
SkillLevel, SkillLevel = 0,
SkillPercent, SkillPercent,
LastSkillType LastSkillType
}; };
@ -128,7 +128,7 @@ namespace Otc
}; };
enum FluidsColor { enum FluidsColor {
FluidTransparent, FluidTransparent = 0,
FluidBlue, FluidBlue,
FluidRed, FluidRed,
FluidBrown, FluidBrown,
@ -164,33 +164,52 @@ namespace Otc
enum PlayerSkulls { enum PlayerSkulls {
SkullNone = 0, SkullNone = 0,
SkullYellow = 1, SkullYellow,
SkullGreen = 2, SkullGreen,
SkullWhite = 3, SkullWhite,
SkullRed = 4, SkullRed,
SkullBlack = 5, SkullBlack,
SkullOrange = 6 SkullOrange
}; };
enum PlayerShields { enum PlayerShields {
ShieldNone = 0, ShieldNone = 0,
ShieldWhiteYellow = 1, ShieldWhiteYellow,
ShieldWhiteBlue = 2, ShieldWhiteBlue,
ShieldBlue = 3, ShieldBlue,
ShieldYellow = 4, ShieldYellow,
ShieldBlueSharedExp = 5, ShieldBlueSharedExp,
ShieldYellowSharedExp = 6, ShieldYellowSharedExp,
ShieldBlueNoSharedExpBlink = 7, ShieldBlueNoSharedExpBlink,
ShieldYellowNoSharedExpBlink = 8, ShieldYellowNoSharedExpBlink,
ShieldBlueNoSharedExp = 9, ShieldBlueNoSharedExp,
ShieldYellowNoSharedExp = 10 ShieldYellowNoSharedExp
}; };
enum PlayerEmblems { enum PlayerEmblems {
EmblemNone = 0, EmblemNone = 0,
EmblemGreen = 1, EmblemGreen,
EmblemRed = 2, EmblemRed,
EmblemBlue = 3 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
}; };
} }

View File

@ -35,7 +35,7 @@ public:
void setStatistic(Otc::Statistic statistic, double value) { m_statistics[statistic] = value; } void setStatistic(Otc::Statistic statistic, double value) { m_statistics[statistic] = value; }
void setAttackingCreature(const CreaturePtr& creature); void setAttackingCreature(const CreaturePtr& creature);
void setFollowingCreature(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; } bool getCanReportBugs() { return m_canReportBugs; }
int getSkill(Otc::Skill skill, Otc::SkillType skillType) { return m_skills[skill][skillType]; } int getSkill(Otc::Skill skill, Otc::SkillType skillType) { return m_skills[skill][skillType]; }
@ -43,7 +43,7 @@ public:
CreaturePtr getAttackingCreature() { return m_attackingCreature; } CreaturePtr getAttackingCreature() { return m_attackingCreature; }
CreaturePtr getFollowingCreature() { return m_followingCreature; } CreaturePtr getFollowingCreature() { return m_followingCreature; }
Otc::Direction getNextWalkDirection() { return m_nextWalkDirection; } Otc::Direction getNextWalkDirection() { return m_nextWalkDirection; }
int getIcons() { return m_icons; } Otc::PlayerIcons getIcons() { return m_icons; }
bool isAttacking() { return m_attackingCreature != nullptr; } bool isAttacking() { return m_attackingCreature != nullptr; }
bool isFollowing() { return m_followingCreature != nullptr; } bool isFollowing() { return m_followingCreature != nullptr; }
@ -60,7 +60,7 @@ private:
bool m_clientWalking; bool m_clientWalking;
Otc::Direction m_nextWalkDirection; Otc::Direction m_nextWalkDirection;
CreaturePtr m_attackingCreature, m_followingCreature; CreaturePtr m_attackingCreature, m_followingCreature;
int m_icons; Otc::PlayerIcons m_icons;
int m_skills[Otc::LastSkill][Otc::LastSkillType]; int m_skills[Otc::LastSkill][Otc::LastSkillType];
double m_statistics[Otc::LastStatistic]; double m_statistics[Otc::LastStatistic];
}; };

View File

@ -130,16 +130,16 @@ void Map::draw(const Rect& rect)
} }
} }
// draw animated text // draw static text
for(auto it = m_animatedTexts.begin(), end = m_animatedTexts.end(); it != end; ++it) { for(auto it = m_staticTexts.begin(), end = m_staticTexts.end(); it != end; ++it) {
Point pos = positionTo2D((*it)->getPos()) - m_drawOffset; Point pos = positionTo2D((*it)->getPos()) - m_drawOffset;
pos.x *= horizontalStretchFactor; pos.x *= horizontalStretchFactor;
pos.y *= verticalStretchFactor; pos.y *= verticalStretchFactor;
(*it)->draw(rect.topLeft() + pos, rect); (*it)->draw(rect.topLeft() + pos, rect);
} }
// draw static text // draw animated text
for(auto it = m_staticTexts.begin(), end = m_staticTexts.end(); it != end; ++it) { for(auto it = m_animatedTexts.begin(), end = m_animatedTexts.end(); it != end; ++it) {
Point pos = positionTo2D((*it)->getPos()) - m_drawOffset; Point pos = positionTo2D((*it)->getPos()) - m_drawOffset;
pos.x *= horizontalStretchFactor; pos.x *= horizontalStretchFactor;
pos.y *= verticalStretchFactor; pos.y *= verticalStretchFactor;

View File

@ -725,7 +725,7 @@ void ProtocolGame::parsePlayerSkills(InputMessage& msg)
void ProtocolGame::parsePlayerIcons(InputMessage& msg) void ProtocolGame::parsePlayerIcons(InputMessage& msg)
{ {
uint16 icons = msg.getU16(); uint16 icons = msg.getU16();
m_localPlayer->setIcons(icons); m_localPlayer->setIcons((Otc::PlayerIcons)icons);
} }
void ProtocolGame::parsePlayerCancelAttack(InputMessage& msg) void ProtocolGame::parsePlayerCancelAttack(InputMessage& msg)