Planeshift
pawsskillwindow.h
Go to the documentation of this file.
1 /*
2  * pawsskillwindow.h
3  *
4  * Copyright (C) 2003 Atomic Blue (info@planeshift.it, http://www.atomicblue.org)
5  *
6  *
7  * This program is free software; you can redistribute it and/or
8  * modify it under the terms of the GNU General Public License
9  * as published by the Free Software Foundation (version 2 of the License)
10  * This program is distributed in the hope that it will be useful,
11  * but WITHOUT ANY WARRANTY; without even the implied warranty of
12  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13  * GNU General Public License for more details.
14  * You should have received a copy of the GNU General Public License
15  * along with this program; if not, write to the Free Software
16  * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
17  *
18  */
19 
20 #ifndef PAWS_SKILL_WINDOW_HEADER
21 #define PAWS_SKILL_WINDOW_HEADER
22 
23 #include "paws/pawswidget.h"
24 #include "net/cmdbase.h"
25 #include "util/skillcache.h"
26 #include "gui/pawscontrolwindow.h"
28 
29 class pawsTextBox;
30 class pawsListBox;
31 class pawsListBoxRow;
33 class pawsProgressBar;
34 class pawsObjectView;
35 
39 {
40 public:
42  {
43  category = 0;
44  description.Clear();
45  }
46 
47  psSkillDescription(int cat, const char *str)
48  {
49  category = cat;
50  description = str;
51  }
52 
53  void Update(int cat, const char *str)
54  {
55  category = cat;
56  description = str;
57  }
58 
59  int GetCategory() const
60  {
61  return category;
62  }
63 
64  const char *GetDescription() const
65  {
66  return (const char *)description;
67  }
68 
69 private:
70  int category;
71  csString description;
72 };
73 
74 //-----------------------------------------------------------------------------
75 
79 {
80 public:
83  pawsSkillWindow(const pawsSkillWindow& origin);
84  virtual ~pawsSkillWindow();
85 
86  bool PostSetup();
87  virtual void HandleMessage(MsgEntry *msg);
88  bool OnButtonPressed( int mouseButton, int keyModifier, pawsWidget* widget );
89  void OnListAction( pawsListBox* listbox, int status );
90 
91  virtual void Draw();
92  virtual void Show();
93  virtual void Hide();
94  virtual void Close();
95 
96  virtual void OnNumberEntered(const char *name,int param,int number);
97 
101  bool LoadUserSharedPrefs();
102 
103  void SetHPWarnLevel( float val );
104  float GetHPWarnLevel();
105 
106  void SetHPDangerLevel( float val );
107  float GetHPDangerLevel();
108 
109  void SetHPFlashLevel( float val );
110  float GetHPFlashLevel();
111 
112  void SetManaWarnLevel( float val );
113  float GetManaWarnLevel();
114 
115  void SetManaDangerLevel( float val );
116  float GetManaDangerLevel();
117 
118  void SetManaFlashLevel( float val );
119  float GetManaFlashLevel();
120 
121  void SetHPOn( bool val );
122  void SetManaOn( bool val );
123 protected:
124 
125  enum {
131  CAT_FACTION
132  };
133 
134  struct pawsSkill {
137  const char* indWidget;
138  const char* tabName;
139  csArray<pawsListBoxRow*> unsortedSkills;
140  };
141 
142  bool SetupDoll();
143 
144  void BuySkill();
145  void BuyMaxSkill();
146 
147  void HandleSkillList(int selectedNameId, bool flush);
148  void HandleSkillDescription( csString& description );
149 
156  void FlashTabButton(const char* buttonName, bool flash);
157 
159  void HandleSkillCategory(psSkillCacheItem* skillInfo, unsigned &idx, bool flush);
160 
161  pawsSkill skills[5];
164  pawsProgressBar *hpBar, *manaBar, *pysStaminaBar, *menStaminaBar, *experienceBar;
165  pawsTextBox *hpFrac, *manaFrac, *pysStaminaFrac, *menStaminaFrac, *experiencePerc;
166 
167  bool filter, train;
168  unsigned int x;
169 
170  csString skillString;
171  csString selectedSkill;
172 
173  int hitpointsMax, manaMax, physStaminaMax, menStaminaMax;
174 
175  int currentTab, previousTab;
176 
177  csRef<iDocumentSystem> xml;
178 
180  csHash<psSkillDescription *> skillDescriptions;
181 
182  void HandleFactionMsg(MsgEntry* me);
183 
185  {
186  csString name;
187  int rating;
189  };
190 
191  csPDelArray<FactionRating> factions;
192 
197 
198 };
199 
201 
202 //-----------------------------------------------------------------------------
203 
207 {
208 public:
210 
211  void Draw();
212  void Set(unsigned int x, int rank, int y, int yCost, int z, int zCost);
213 protected:
215  unsigned int GetRelCoord(unsigned int pt);
216 
217  void DrawSkillProgressBar(int x, int y, int width, int height,
218  int start_r, int start_g, int start_b);
219 
220  unsigned int x;
221  int rank, y, yCost, z, zCost;
222 
223  iGraphics2D * g2d;
224 };
225 
227 
228 #endif
This is a window that is controlled by a button on the control bar.
The main base widget that all other widgets should inherit from.
Definition: pawswidget.h:116
psSkillCacheItem item is one stat or skill in the skill cache.
Definition: skillcache.h:37
Window displaying the player&#39;s stats, vitals and skills.
This widget is used to view a mesh in it&#39;s own seperate world.
csString selectedSkill
psSkillDescription(int cat, const char *str)
bool factRequest
Flag if we have sent our initial request for faction information. Only sent once and everything else ...
The structure of 1 queue entry (pointer to a message)
Definition: message.h:143
Describes a skill description inside the GUI system.
const char * GetDescription() const
int zCost
Skill status.
unsigned int x
Stores topnode "X" information (progression points)
csRef< iDocumentSystem > xml
A manager class that handles all the details of a characters appearance.
Definition: charapp.h:65
The psSkillCache class implements the skill cache both on the server and on the client.
Definition: skillcache.h:158
psSkillCache skillCache
Local copy of skills and stats.
csArray< pawsListBoxRow * > unsortedSkills
csHash< psSkillDescription * > skillDescriptions
Local copy of skill and stat descriptions.
A simple list box widget.
Definition: pawslistbox.h:202
int previousTab
Used for storing which is the current tab and the previous one.
pawsProgressBar * pysStaminaBar
pawsSkillIndicator is a widget that graphically displays skill status
pawsTextBox * pysStaminaFrac
CREATE_PAWS_FACTORY(pawsSkillWindow)
psCharAppearance * charApp
pawsMultiLineTextBox * description
A List Box Row.
Definition: pawslistbox.h:85
void Update(int cat, const char *str)
csPDelArray< FactionRating > factions
The factions by name.
unsigned int x
progression points
int GetCategory() const
A basic text box widget.
Definition: pawstextbox.h:42
pawsListBox * factionList
pawsMultiLineTextBox * factionsDescription