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
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
@ -23,12 +24,15 @@ function Game.createThingMenu(menuPosition, lookThing, useThing, creatureThing)
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()

View File

@ -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
};
}

View File

@ -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];
};

View File

@ -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;

View File

@ -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)