Emergency 20 Dokumentation  4.2.0
GangsterType.h
Go to the documentation of this file.
1 // Copyright (C) 2012-2018 Promotion Software GmbH
2 
3 
4 //[-------------------------------------------------------]
5 //[ Header guard ]
6 //[-------------------------------------------------------]
7 #pragma once
8 
9 
10 //[-------------------------------------------------------]
11 //[ Includes ]
12 //[-------------------------------------------------------]
14 
16 #include <qsf/forward/BoostPTree.h>
18 
19 
20 //[-------------------------------------------------------]
21 //[ Namespace ]
22 //[-------------------------------------------------------]
23 namespace em5
24 {
25 
26 
27  //[-------------------------------------------------------]
28  //[ Classes ]
29  //[-------------------------------------------------------]
35  {
36 
37 
38  //[-------------------------------------------------------]
39  //[ Public definitions ]
40  //[-------------------------------------------------------]
41  public:
45  typedef boost::container::flat_map<qsf::StringHash, uint32> PriorityByEventTagMap;
46 
47 
48  //[-------------------------------------------------------]
49  //[ Public methods ]
50  //[-------------------------------------------------------]
51  public:
56  explicit GangsterType(uint32 key);
57 
62  virtual ~GangsterType();
63 
64  // Get the gangster type ID
65  uint32 getId() const;
66 
67  // Get the name of the gangster type
68  const std::string& getName() const;
69 
70  // Set the name of the gangster type
71  void setName(const std::string& name);
72 
73  // Get the gangster logic class ID
74  uint32 getLogicClassId() const;
75 
76  // Get the gangster logic class name
77  const std::string& getLogicClassName() const;
78 
79  // Set the gangster logic class name
80  void setLogicClassName(const std::string& className);
81 
82  //[-------------------------------------------------------]
83  //[ Weapons ]
84  //[-------------------------------------------------------]
85  // Get equipped weapons
86  const WeaponFlagSet& getWeapons() const;
87 
88  // Get equipped weapons as comma-separated string
89  std::string getWeaponsAsString() const;
90 
91  // Set equipped weapons from a comma-separated string
92  void setWeaponsByString(const std::string& weapons);
93 
94  // Property "AlwaysShowWeapon"
95  bool getAlwaysShowWeapon() const;
96  void setAlwaysShowWeapon(bool showWeapon);
97 
98  // Weapon configuration (firearms only)
99  WeaponConfiguration* getConfigurationForWeapon(weapon::Weapon weapon);
100  const WeaponConfiguration* getConfigurationForWeapon(weapon::Weapon weapon) const;
101 
102  // Firearms shoot range
103  float getShootRangePistol() const;
104  void setShootRangePistol(float range);
105  float getShootRangeRifle() const;
106  void setShootRangeRifle(float range);
107 
108  // Firearms damage to persons
109  float getDamageHealthPistol() const;
110  void setDamageHealthPistol(float damage);
111  float getDamageHealthRifle() const;
112  void setDamageHealthRifle(float damage);
113 
114  // Firearms damage to vehicles
115  float getDamageVehiclePistol() const;
116  void setDamageVehiclePistol(float damage);
117  float getDamageVehicleRifle() const;
118  void setDamageVehicleRifle(float damage);
119 
120  //[-------------------------------------------------------]
121  //[ Behavior ]
122  //[-------------------------------------------------------]
123  // Property "MovementSpeed"
124  float getMovementSpeed() const;
125  void setMovementSpeed(float movementSpeed);
126 
127  // Property "ResistArrest"
128  bool getResistArrest() const;
129  void setResistArrest(bool resistArrest);
130 
131  // Property "CelebrateWinTime"
132  float getCelebrateWinTime() const;
133  void setCelebrateWinTime(float celebrateWinTime);
134 
135  //[-------------------------------------------------------]
136  //[ Auto-aggression ]
137  //[-------------------------------------------------------]
138  // Property "AutoAggroRange"
139  float getAutoAggroRange() const;
140  void setAutoAggroRange(float autoAggroRange);
141 
142  // Property "AutoDeAggroRange"
143  float getAutoDeAggroRange() const;
144  void setAutoDeAggroRange(float autoDeAggroRange);
145 
146  // Property "AutoTargets"
147  const PriorityByEventTagMap& getAutoTargets() const;
148  boost::property_tree::ptree getAutoTargetsAsPTree() const;
149  void setAutoTargetsByPTree(const boost::property_tree::ptree& pTree);
150 
151  // Property "AutoTargetReaction"
152  AutoReaction getAutoTargetReaction() const;
153  void setAutoTargetReaction(AutoReaction autoTargetReaction);
154 
155  // Property "IdleReaction"
156  AutoReaction getIdleReaction() const;
157  void setIdleReaction(AutoReaction idleReaction);
158 
159  // Property "ChainReaction"
160  bool getChainReaction() const;
161  void setChainReaction(bool chainReaction);
162 
163  //[-------------------------------------------------------]
164  //[ Private data ]
165  //[-------------------------------------------------------]
166  private:
167  qsf::NamedIdentifier mName;
168  qsf::NamedIdentifier mLogicClassName;
169 
170  // Weapons
171  WeaponFlagSet mWeapons;
172  bool mAlwaysShowWeapon;
173  WeaponConfiguration mWeaponConfigurationForPistol;
174  WeaponConfiguration mWeaponConfigurationForRifle;
175 
176  // Behavior
177  float mMovementSpeed;
178  bool mResistArrest;
179  qsf::Time mCelebrateWinTime;
180 
181  // Auto-aggression
182  float mAutoAggroRange;
183  float mAutoDeAggroRange;
184  PriorityByEventTagMap mAutoTargets;
185  AutoReaction mAutoTargetReaction;
186  AutoReaction mIdleReaction;
187  bool mChainReaction;
188 
189 
190  //[-------------------------------------------------------]
191  //[ CAMP reflection system ]
192  //[-------------------------------------------------------]
193  QSF_CAMP_RTTI() // Only adds the virtual method "campClassId()", nothing more
194 
195 
196  };
197 
198 
199 //[-------------------------------------------------------]
200 //[ Namespace ]
201 //[-------------------------------------------------------]
202 } // em5
203 
204 
205 //[-------------------------------------------------------]
206 //[ CAMP reflection system ]
207 //[-------------------------------------------------------]
Definition: ActionPriority.h:13
Object base class.
Definition: Object.h:68
unsigned int uint32
Definition: PlatformTypes.h:181
boost::container::flat_map< qsf::StringHash, uint32 > PriorityByEventTagMap
Definition: GangsterType.h:45
#define EM5_API_EXPORT
Definition: Export.h:28
weapon::WeaponConfiguration WeaponConfiguration
Definition: GangsterType.h:44
AutoReaction
Definition: GangsterBaseLogic.h:79
Definition: WeaponConfiguration.h:31
Gangster type definition class.
Definition: GangsterType.h:34
#define QSF_CAMP_RTTI()
Only adds the virtual method "campClassId()", nothing more.
Definition: CampClass.h:75
#define QSF_CAMP_TYPE_NONCOPYABLE(type)
See "CAMP_TYPE_NONCOPYABLE" for details.
Definition: CampClass.h:112
Definition: DensityCalculator.h:29
Weapon
Definition: Weapon.h:22
GangsterBaseLogic::AutoReaction AutoReaction
Definition: GangsterType.h:42
Class combining strings with their hashes.
Definition: NamedIdentifier.h:34
GangsterBaseLogic::WeaponFlagSet WeaponFlagSet
Definition: GangsterType.h:43
Data type for encapsulating time information. It might represents points in time and time spans...
Definition: Time.h:32