Add infos into target window
[ryzomcore.git] / ryzom / client / src / forage_source_cl.h
blobfbab72d987be24af75bc74a758f3739e52b5e28d
1 // Ryzom - MMORPG Framework <http://dev.ryzom.com/projects/ryzom/>
2 // Copyright (C) 2010 Winch Gate Property Limited
3 //
4 // This program is free software: you can redistribute it and/or modify
5 // it under the terms of the GNU Affero General Public License as
6 // published by the Free Software Foundation, either version 3 of the
7 // License, or (at your option) any later version.
8 //
9 // This program is distributed in the hope that it will be useful,
10 // but WITHOUT ANY WARRANTY; without even the implied warranty of
11 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 // GNU Affero General Public License for more details.
14 // You should have received a copy of the GNU Affero General Public License
15 // along with this program. If not, see <http://www.gnu.org/licenses/>.
19 #ifndef NL_FORAGE_SOURCE_CL_H
20 #define NL_FORAGE_SOURCE_CL_H
22 #include "nel/misc/types_nl.h"
23 #include "fx_cl.h"
26 /**
27 * <Class description>
28 * \author Olivier Cado
29 * \author Nevrax France
30 * \date 2003
32 class CForageSourceCL : public CFxCL
34 public:
36 enum TFSBarIndex { FSBTime, FSBQuantiy, FSBD, FSBE, FSBK, NbFSBarIndices };
38 static NLMISC::CRGBA SafeSourceColor;
40 /// Constructor
41 CForageSourceCL();
43 /// Destructor
44 virtual ~CForageSourceCL();
46 /// Build the entity from a sheet.
47 virtual bool build( const CEntitySheet *sheet );
49 /// Rebuild in scene interfaces
50 virtual void buildInSceneInterface ();
52 /// Called when clipped out
53 virtual void updateClipped (const NLMISC::TTime &currentTimeInMs, CEntityCL *target);
55 /// Method called each frame to manage the entity after the clipping test if the primitive is visible.
56 virtual void updateVisible(const NLMISC::TTime &time, CEntityCL *target);
58 /// Update the entity after all positions done.
59 virtual void updateVisiblePostPos(const NLMISC::TTime &time, CEntityCL *target);
61 /// Return true if at least an extraction is in progress
62 bool isExtractionInProgress() const { return _IsExtractionInProgress; }
64 /// Return the knowledge level [0..2]
65 uint8 getKnowledge() const { return (_KnowledgeLevel & 0x80) != 0 ? 0 : _KnowledgeLevel; }
67 /// Return the icon filename (valid if the knowledge > 0, otherwise returns NULL)
68 const std::string *getKnowledgeIcon() const { return _IconFilename; }
70 /// Return the value of the K (max=127)
71 uint8 getKamiAngerBar() const { return _BarDestValues[4]; }
73 /// Return true if the source is in "extra time"
74 bool isInExtraTime() const { return _BarDestValues[0] < _ExtraTime; }
76 /// Return true if the source is in "prospection extra time" (not bonus extra time or normal extra time)
77 bool isInProspectionExtraTime() const { return _BarDestValues[0] < _ExtraTime - _InclBonusExtraTime; }
79 /// Return the current quantity available in the source
80 uint8 getCurrentQuantity() const { return _CurrentQuantity; }
82 void resetVP();
84 void displayInscenePos();
86 /// Current Display Value for bars
87 uint8 getTimeBar() const {return _TimeBar;}
88 uint8 getQuantityBar() const {return _QuantityBar;}
89 uint8 getDBar() const {return _DBar;}
90 uint8 getEBar() const {return _EBar;}
92 bool isSafe() { return _SafeSource; }
94 protected:
96 /// Initialize properties of the entity (according to the class).
97 virtual void initProperties();
99 // Update Entity Visual Property B
100 //virtual void updateVisualPropertyVpb(const NLMISC::TGameCycle &gameCycle, const sint64 &prop);
102 /// Update Entity Bars
103 virtual void updateVisualPropertyBars(const NLMISC::TGameCycle &gameCycle, const sint64 &prop);
104 /// Visual FX
105 virtual void updateVisualPropertyVisualFX(const NLMISC::TGameCycle &gameCycle, const sint64 &prop);
106 /// Update Entity Name.
107 virtual void updateVisualPropertyName (const NLMISC::TGameCycle &gameCycle, const sint64 &prop);
108 /// Update Entity Target.
109 virtual void updateVisualPropertyTarget (const NLMISC::TGameCycle &gameCycle, const sint64 &prop);
110 /// Update Entity Orientation.
111 virtual void updateVisualPropertyOrient (const NLMISC::TGameCycle &gameCycle, const sint64 &prop);
113 /// Display the modifiers
114 virtual void displayModifiers();
116 /// Destroy inscene interfaces
117 void releaseInSceneInterfaces();
119 /// Inscene interface
120 class CGroupInSceneUserInfo *_InSceneUserInterface;
122 private:
124 /// Knowledge icon (valid only if _KnowledgeLevel > 0, otherwise NULL)
125 const std::string *_IconFilename;
127 /// Destination values for bars
128 uint8 _BarDestValues[NbFSBarIndices];
130 /// Current value for bars (except the K bar)
131 float _BarCurrentValues[NbFSBarIndices-1];
133 /// Current Display Value for bars
134 uint8 _TimeBar;
135 uint8 _QuantityBar;
136 uint8 _DBar;
137 uint8 _EBar;
139 /// When an extraction is in progress, display all bars
140 bool _IsExtractionInProgress;
142 /// If the source is safe display its explosion bar green
143 bool _SafeSource;
145 /// 0=nothing 1=group 2=family. Bit 7 set means "knowledge info not received yet" (by visual fx)
146 uint8 _KnowledgeLevel;
148 /// Memorize the last received explosion bit
149 uint8 _LastExplosionSwitch;
151 /// The prospector slot (received in target)
152 uint8 _ProspectorSlot;
154 /// When the source is in "extra time", change the display of the time bar
155 uint8 _ExtraTime;
157 /// When the source is in "bonus extra time", change the display of the time bar
158 uint8 _InclBonusExtraTime;
160 /// First received value of quantity
161 uint8 _InitialQuantity;
163 /// Current quantity
164 uint8 _CurrentQuantity;
168 #endif // NL_FORAGE_SOURCE_CL_H
170 /* End of forage_source_cl.h */