EvEmu  0.8.4
11 September 2021
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Modules Pages
Skill.h
Go to the documentation of this file.
1 /*
2  ------------------------------------------------------------------------------------
3  LICENSE:
4  ------------------------------------------------------------------------------------
5  This file is part of EVEmu: EVE Online Server Emulator
6  Copyright 2006 - 2021 The EVEmu Team
7  For the latest information visit https://evemu.dev
8  ------------------------------------------------------------------------------------
9  This program is free software; you can redistribute it and/or modify it under
10  the terms of the GNU Lesser General Public License as published by the Free Software
11  Foundation; either version 2 of the License, or (at your option) any later
12  version.
13 
14  This program is distributed in the hope that it will be useful, but WITHOUT
15  ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
16  FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
17 
18  You should have received a copy of the GNU Lesser General Public License along with
19  this program; if not, write to the Free Software Foundation, Inc., 59 Temple
20  Place - Suite 330, Boston, MA 02111-1307, USA, or go to
21  http://www.gnu.org/copyleft/lesser.txt.
22  ------------------------------------------------------------------------------------
23  Author: Bloody.Rabbit
24  Updates: Allan
25 */
26 
27 #ifndef EVE_SERVER_SKILLS_SKILL_H
28 #define EVE_SERVER_SKILLS_SKILL_H
29 
30 
31 #include "EVEServerConfig.h"
32 #include "StaticDataMgr.h"
33 #include "../../eve-core/utils/misc.h"
35 
36 class Character;
37 
48 class Skill
49 : public InventoryItem
50 {
51  friend class InventoryItem;
52 public:
53  ~Skill() { /* do nothing here */ }
54 
62  static SkillRef Load( uint32 skillID);
70  static SkillRef Spawn( ItemData &data);
71 
72  bool IsTraining();
73 
74  uint8 GetLevelForSP(uint32 currentSP);
75  uint32 GetSPForLevel(uint8 level);
76  uint32 GetCurrentSP(Character* ch, int64 startTime=0); // requires startTime for skill in training
77  // returns remaining sp to next level of this skill
78  uint32 GetRemainingSP(Character* ch, int64 curTime=0); // requires Skill* = m_skillQueue.front()
79  // returns remaining time in seconds to train this skill to next level
80  uint32 GetTrainingTime(Character* ch, int64 startTime=0);
83 
84  void VerifySP();
85  void VerifyAttribs();
86 
87 
88 protected:
89  Skill(uint32 _skillID, const ItemType &_type, const ItemData &_data );
90 
91  /*
92  * Member functions
93  */
95 
96  // Template loader:
97  template<class _Ty>
98  static RefPtr<_Ty> _LoadItem( uint32 skillID, const ItemType &type, const ItemData &data) {
100  _log(ITEM__ERROR, "Trying to load %s as Skill.", sDataMgr.GetCategoryName(type.categoryID()));
101  if (sConfig.debug.StackTrace)
102  EvE::traceStack();
103  return RefPtr<_Ty>();
104  }
105 
106  return SkillRef( new Skill(skillID, type, data ) );
107  }
108 };
109 
110 #endif // EVE_SERVER_SKILLS_SKILL_H
#define sConfig
A macro for easier access to the singleton.
static RefPtr< _Ty > _LoadItem(uint32 skillID, const ItemType &type, const ItemData &data)
Definition: Skill.h:98
unsigned __int8 uint8
Definition: eve-compat.h:46
bool SkillPrereqsComplete(Character &ch)
Definition: Skill.cpp:207
#define _log(type, fmt,...)
Definition: logsys.h:124
bool IsTraining()
Definition: Skill.cpp:68
static bool FitModuleSkillCheck(InventoryItemRef item, CharacterRef ch)
Definition: Skill.cpp:230
Skill(uint32 _skillID, const ItemType &_type, const ItemData &_data)
Definition: Skill.cpp:42
void VerifySP()
Definition: Skill.cpp:168
static SkillRef Spawn(ItemData &data)
Definition: Skill.cpp:52
InventoryItem for skill.
Definition: Skill.h:48
virtual bool _Load()
~Skill()
Definition: Skill.h:53
uint32 GetSPForLevel(uint8 level)
Definition: Skill.cpp:76
itemID[count] Create count or of the specified item(from Insider)" ) COMMAND( goto
uint8 categoryID() const
Definition: ItemType.h:66
const ItemType & type() const
typeID Spawn an NPC with the specified type text Search for items matching the specified query() type()() itemID() copy() materialLevel()()() itemID() itemID Fits selected item to active ship() skillID(level)-gives skillID to specified level." ) COMMAND( online
RefPtr< Skill > SkillRef
Definition: ItemRef.h:57
static SkillRef Load(uint32 skillID)
Definition: Skill.cpp:47
unsigned __int32 uint32
Definition: eve-compat.h:50
uint32 GetCurrentSP(Character *ch, int64 startTime=0)
Definition: Skill.cpp:80
uint8 GetLevelForSP(uint32 currentSP)
Definition: Skill.cpp:72
signed __int64 int64
Definition: eve-compat.h:51
uint32 GetRemainingSP(Character *ch, int64 curTime=0)
Definition: Skill.cpp:112
void traceStack(void)
Definition: misc.cpp:169
void VerifyAttribs()
Definition: Skill.cpp:154
uint32 GetTrainingTime(Character *ch, int64 startTime=0)
Definition: Skill.cpp:132
Reference-counting-based smart pointer.
Definition: RefPtr.h:133
#define sDataMgr