DayZ 1.24
Loading...
Searching...
No Matches
SoftSkillsManager Class Reference
Collaboration diagram for SoftSkillsManager:
[legend]

Protected Member Functions

void SoftSkillsManager (PlayerBase player)
 
void InitSpecialty (float specialty_level)
 
void ~SoftSkillsManager ()
 
float AddLinearPrecise (float specialty_weight)
 
float AddLinearRough (float specialty_weight)
 
float AddExponentialPrecise (float specialty_weight)
 
float AddExponentialRough (float specialty_weight)
 
void AddSpecialty (float specialty_weight)
 
float AddSpecialtyBonus (float base_value, float specialty_weight, bool is_cacomponent=false, float limit_efficiency=2)
 
float SubtractSpecialtyBonus (float base_value, float specialty_weight, bool is_cacomponent=false, float limit_efficiency=2)
 
float AdjustCraftingTime (float base_time, float specialty_weight, float limit_efficiency=2)
 
PlayerBase GetSoftSkillsPlayer ()
 
void SetSpecialtyLevel (float specialty_level)
 
float GetSpecialtyLevel ()
 
void SynchSpecialtyLevel ()
 
void SetSoftSkillsState (bool state)
 
bool GetSoftSkillsState ()
 
void SetLinearState (bool model)
 
bool IsLinear ()
 
void GetPreciseRoughLevels ()
 
void StartCoolDownTimer (float cooldown_value)
 
bool IsCoolDown ()
 
void SetCoolDown (bool cool_down)
 
void CreateDebugWindow (bool create)
 
void SynchDebugStats ()
 
void SetIsDebug (bool is_debug)
 
bool IsDebug ()
 
void SetCoolDownValue (float cooldown_value)
 
float GetCoolDownValue ()
 
float GetLastUAValue ()
 
void SetLastUAValue (float last_ua_value)
 
void SetBonusBefore (bool is_cacomponent, float base_value)
 
void SetBonusAfter (bool is_cacomponent, float adjusted_value)
 
float GetComponentBonusBefore ()
 
void SetComponentBonusBefore (float component_bonus_before)
 
float GetComponentBonusAfter ()
 
void SetComponentBonusAfter (float component_bonus_after)
 
float GetGeneralBonusBefore ()
 
void SetGeneralBonusBefore (float general_bonus_before)
 
float GetGeneralBonusAfter ()
 
void SetGeneralBonusAfter (float general_bonus_after)
 
void StartSynchTimer ()
 
void StopSynchTimer ()
 
void ResetDebugWindow ()
 

Protected Attributes

PlayerBase m_Player
 
float m_SpecialtyLevel
 
float m_RoughLevel
 
float m_PreciseLevel
 
bool m_IsLinear
 
bool m_IsActive
 
bool m_IsCoolDown
 
int m_UserActionsCounter
 
ref Timer m_CoolDownTimer = new Timer()
 
bool m_IsDebugMode
 
float m_CoolDownValue
 
float m_LastUAValue
 
float m_ComponentBonusBefore
 
float m_ComponentBonusAfter
 
float m_GeneralBonusBefore
 
float m_GeneralBonusAfter
 
ref SoftSkillManagerDebug m_DebugWindow
 
ref Timer m_SynchTimer
 

Static Protected Attributes

const int DEFAULT_EFFICIENCY = 0
 
const float PRECISE_WEIGHT_LIMIT = -1
 
const float ROUGH_WEIGHT_LIMIT = 1
 
const float COOLDOWN_TIMER = 5
 

Detailed Description

Definition at line 1 of file SoftSkillsManager.c.

Constructor & Destructor Documentation

◆ SoftSkillsManager()

void SoftSkillsManager::SoftSkillsManager ( PlayerBase player)
inlineprotected

Definition at line 33 of file SoftSkillsManager.c.

34 {
36 m_IsCoolDown = false;
37 m_IsLinear = false;
38 m_IsActive = true;
39 m_IsDebugMode = false;
40 }

References m_IsActive, m_IsCoolDown, m_IsDebugMode, m_IsLinear, and m_Player.

◆ ~SoftSkillsManager()

void SoftSkillsManager::~SoftSkillsManager ( )
inlineprotected

Definition at line 48 of file SoftSkillsManager.c.

49 {
50 delete m_CoolDownTimer;
51 }

References m_CoolDownTimer.

Member Function Documentation

◆ AddExponentialPrecise()

float SoftSkillsManager::AddExponentialPrecise ( float specialty_weight)
inlineprotected

Definition at line 74 of file SoftSkillsManager.c.

75 {
77
78 if (m_UserActionsCounter == 0)
79 {
82 }
83
85
87
90
91 return m_SpecialtyLevel;
92 }
Definition EnMath.c:7
void SetLastUAValue(float last_ua_value)
const float PRECISE_WEIGHT_LIMIT
const float ROUGH_WEIGHT_LIMIT
static proto float Sqrt(float val)
Returns square root.
static proto int AbsInt(int i)
Returns absolute value.
static proto float Clamp(float value, float min, float max)
Clamps 'value' to 'min' if it is lower than 'min', or to 'max' if it is higher than 'max'.

References Math::AbsInt(), Math::Clamp(), m_SpecialtyLevel, m_UserActionsCounter, PRECISE_WEIGHT_LIMIT, ROUGH_WEIGHT_LIMIT, SetLastUAValue(), and Math::Sqrt().

Referenced by AddSpecialty().

◆ AddExponentialRough()

◆ AddLinearPrecise()

float SoftSkillsManager::AddLinearPrecise ( float specialty_weight)
inlineprotected

◆ AddLinearRough()

float SoftSkillsManager::AddLinearRough ( float specialty_weight)
inlineprotected

◆ AddSpecialty()

void SoftSkillsManager::AddSpecialty ( float specialty_weight)
inlineprotected

Definition at line 116 of file SoftSkillsManager.c.

117 {
118 if (GetSoftSkillsState())
119 {
120 if (!IsCoolDown())
121 {
122 if (specialty_weight < 0)
123 {
124 if (IsLinear())
126 else
128
129 m_Player.GetStatSpecialty().Set(m_SpecialtyLevel);
132 }
133 else if (specialty_weight > 0)
134 {
135 if (IsLinear())
137 else
139
140 m_Player.GetStatSpecialty().Set(m_SpecialtyLevel);
143 }
144 else
145 {
146 //if the specialty weight for a recipe or UA is set to 0, it will increase neither specialty, nor UA counter
147 return;
148 }
149 }
150 else
152 }
153 }
const float COOLDOWN_TIMER
float AddLinearRough(float specialty_weight)
float AddExponentialPrecise(float specialty_weight)
float AddLinearPrecise(float specialty_weight)
float AddExponentialRough(float specialty_weight)
void StartCoolDownTimer(float cooldown_value)
void SetSpecialtyLevel(float specialty_level)
static proto float AbsFloat(float f)
Returns absolute value.

References Math::AbsFloat(), AddExponentialPrecise(), AddExponentialRough(), AddLinearPrecise(), AddLinearRough(), COOLDOWN_TIMER, GetSoftSkillsState(), IsCoolDown(), IsLinear(), m_Player, m_SpecialtyLevel, SetSpecialtyLevel(), StartCoolDownTimer(), and SynchSpecialtyLevel().

◆ AddSpecialtyBonus()

float SoftSkillsManager::AddSpecialtyBonus ( float base_value,
float specialty_weight,
bool is_cacomponent = false,
float limit_efficiency = 2 )
inlineprotected

Definition at line 158 of file SoftSkillsManager.c.

159 {
160 if (specialty_weight == 0)
161 return base_value;
162
164
165 float adjusted_value;
166
168
169 if (limit_efficiency != 0)
170 {
171 if (specialty_weight < 0)
173 else
175 }
176 else
177 {
178 if (specialty_weight < 0)
180 else
182 }
183
185
186 return adjusted_value;
187 }
void SetBonusAfter(bool is_cacomponent, float adjusted_value)
void SetBonusBefore(bool is_cacomponent, float base_value)

References GetPreciseRoughLevels(), m_PreciseLevel, m_RoughLevel, SetBonusAfter(), and SetBonusBefore().

◆ AdjustCraftingTime()

float SoftSkillsManager::AdjustCraftingTime ( float base_time,
float specialty_weight,
float limit_efficiency = 2 )
inlineprotected

Definition at line 226 of file SoftSkillsManager.c.

227 {
228 if (specialty_weight == 0)
229 return base_time;
230
232
233 float adjusted_time;
234
236
237 if (specialty_weight < 0)
239 else
241
243
244 return adjusted_time;
245 }

References GetPreciseRoughLevels(), m_PreciseLevel, m_RoughLevel, SetBonusAfter(), and SetBonusBefore().

◆ CreateDebugWindow()

void SoftSkillsManager::CreateDebugWindow ( bool create)
inlineprotected

Definition at line 341 of file SoftSkillsManager.c.

342 {
343 if (create)
344 {
347 }
348 else
349 {
352 delete m_DebugWindow;
353 }
354 }
void SoftSkillManagerDebug(SoftSkillsManager softskill_manager)
ref SoftSkillManagerDebug m_DebugWindow
void SetIsDebug(bool is_debug)

References m_DebugWindow, ResetDebugWindow(), SetIsDebug(), and SoftSkillManagerDebug().

◆ GetComponentBonusAfter()

float SoftSkillsManager::GetComponentBonusAfter ( )
inlineprotected

Definition at line 439 of file SoftSkillsManager.c.

440 {
442 }

References m_ComponentBonusAfter.

◆ GetComponentBonusBefore()

float SoftSkillsManager::GetComponentBonusBefore ( )
inlineprotected

Definition at line 427 of file SoftSkillsManager.c.

428 {
430 }

References m_ComponentBonusBefore.

◆ GetCoolDownValue()

float SoftSkillsManager::GetCoolDownValue ( )
inlineprotected

Definition at line 385 of file SoftSkillsManager.c.

386 {
387 return m_CoolDownValue;
388 }

References m_CoolDownValue.

◆ GetGeneralBonusAfter()

float SoftSkillsManager::GetGeneralBonusAfter ( )
inlineprotected

Definition at line 463 of file SoftSkillsManager.c.

464 {
465 return m_GeneralBonusAfter;
466 }

References m_GeneralBonusAfter.

◆ GetGeneralBonusBefore()

float SoftSkillsManager::GetGeneralBonusBefore ( )
inlineprotected

Definition at line 451 of file SoftSkillsManager.c.

452 {
454 }

References m_GeneralBonusBefore.

◆ GetLastUAValue()

float SoftSkillsManager::GetLastUAValue ( )
inlineprotected

Definition at line 391 of file SoftSkillsManager.c.

392 {
393 return m_LastUAValue;
394 }

References m_LastUAValue.

◆ GetPreciseRoughLevels()

void SoftSkillsManager::GetPreciseRoughLevels ( )
inlineprotected

◆ GetSoftSkillsPlayer()

PlayerBase SoftSkillsManager::GetSoftSkillsPlayer ( )
inlineprotected

Definition at line 248 of file SoftSkillsManager.c.

249 {
250 return m_Player;
251 }

References m_Player.

◆ GetSoftSkillsState()

bool SoftSkillsManager::GetSoftSkillsState ( )
inlineprotected

Definition at line 281 of file SoftSkillsManager.c.

282 {
283 return m_IsActive;
284 }

References m_IsActive.

Referenced by AddSpecialty().

◆ GetSpecialtyLevel()

float SoftSkillsManager::GetSpecialtyLevel ( )
inlineprotected

Definition at line 260 of file SoftSkillsManager.c.

261 {
262 return m_SpecialtyLevel;
263 }

References m_SpecialtyLevel.

Referenced by OnUpdate().

◆ InitSpecialty()

void SoftSkillsManager::InitSpecialty ( float specialty_level)
inlineprotected

◆ IsCoolDown()

bool SoftSkillsManager::IsCoolDown ( )
inlineprotected

Definition at line 327 of file SoftSkillsManager.c.

328 {
329 return m_IsCoolDown;
330 }

References m_IsCoolDown.

Referenced by AddSpecialty().

◆ IsDebug()

bool SoftSkillsManager::IsDebug ( )
inlineprotected

Definition at line 373 of file SoftSkillsManager.c.

374 {
375 return m_IsDebugMode;
376 }

References m_IsDebugMode.

Referenced by SetBonusAfter(), and SetBonusBefore().

◆ IsLinear()

bool SoftSkillsManager::IsLinear ( )
inlineprotected

Definition at line 293 of file SoftSkillsManager.c.

294 {
295 return m_IsLinear;
296 }

References m_IsLinear.

Referenced by AddSpecialty().

◆ ResetDebugWindow()

void SoftSkillsManager::ResetDebugWindow ( )
inlineprotected

Definition at line 495 of file SoftSkillsManager.c.

496 {
504
506 }
void SetComponentBonusAfter(float component_bonus_after)
void SetGeneralBonusBefore(float general_bonus_before)
void SetCoolDownValue(float cooldown_value)
void SetGeneralBonusAfter(float general_bonus_after)
void SetComponentBonusBefore(float component_bonus_before)

References SetComponentBonusAfter(), SetComponentBonusBefore(), SetCoolDownValue(), SetGeneralBonusAfter(), SetGeneralBonusBefore(), SetLastUAValue(), SetSpecialtyLevel(), and SynchSpecialtyLevel().

Referenced by CreateDebugWindow().

◆ SetBonusAfter()

void SoftSkillsManager::SetBonusAfter ( bool is_cacomponent,
float adjusted_value )
inlineprotected

◆ SetBonusBefore()

void SoftSkillsManager::SetBonusBefore ( bool is_cacomponent,
float base_value )
inlineprotected

◆ SetComponentBonusAfter()

void SoftSkillsManager::SetComponentBonusAfter ( float component_bonus_after)
inlineprotected

Definition at line 445 of file SoftSkillsManager.c.

References m_ComponentBonusAfter.

Referenced by ResetDebugWindow(), and SetBonusAfter().

◆ SetComponentBonusBefore()

void SoftSkillsManager::SetComponentBonusBefore ( float component_bonus_before)
inlineprotected

Definition at line 433 of file SoftSkillsManager.c.

References m_ComponentBonusBefore.

Referenced by ResetDebugWindow(), and SetBonusBefore().

◆ SetCoolDown()

void SoftSkillsManager::SetCoolDown ( bool cool_down)
inlineprotected

Definition at line 333 of file SoftSkillsManager.c.

334 {
336 }

References m_IsCoolDown.

Referenced by StartCoolDownTimer().

◆ SetCoolDownValue()

void SoftSkillsManager::SetCoolDownValue ( float cooldown_value)
inlineprotected

Definition at line 379 of file SoftSkillsManager.c.

380 {
382 }

References m_CoolDownValue.

Referenced by ResetDebugWindow(), and StartCoolDownTimer().

◆ SetGeneralBonusAfter()

void SoftSkillsManager::SetGeneralBonusAfter ( float general_bonus_after)
inlineprotected

Definition at line 469 of file SoftSkillsManager.c.

References m_GeneralBonusAfter.

Referenced by ResetDebugWindow(), and SetBonusAfter().

◆ SetGeneralBonusBefore()

void SoftSkillsManager::SetGeneralBonusBefore ( float general_bonus_before)
inlineprotected

Definition at line 457 of file SoftSkillsManager.c.

References m_GeneralBonusBefore.

Referenced by ResetDebugWindow(), and SetBonusBefore().

◆ SetIsDebug()

void SoftSkillsManager::SetIsDebug ( bool is_debug)
inlineprotected

Definition at line 367 of file SoftSkillsManager.c.

368 {
370 }

References m_IsDebugMode.

Referenced by CreateDebugWindow(), StartSynchTimer(), and StopSynchTimer().

◆ SetLastUAValue()

void SoftSkillsManager::SetLastUAValue ( float last_ua_value)
inlineprotected

◆ SetLinearState()

void SoftSkillsManager::SetLinearState ( bool model)
inlineprotected

Definition at line 287 of file SoftSkillsManager.c.

288 {
290 }

References m_IsLinear.

◆ SetSoftSkillsState()

void SoftSkillsManager::SetSoftSkillsState ( bool state)
inlineprotected

Definition at line 275 of file SoftSkillsManager.c.

276 {
278 }

References m_IsActive.

◆ SetSpecialtyLevel()

void SoftSkillsManager::SetSpecialtyLevel ( float specialty_level)
inlineprotected

Definition at line 254 of file SoftSkillsManager.c.

255 {
257 }

References m_SpecialtyLevel.

Referenced by AddSpecialty(), InitSpecialty(), and ResetDebugWindow().

◆ StartCoolDownTimer()

void SoftSkillsManager::StartCoolDownTimer ( float cooldown_value)
inlineprotected

Definition at line 319 of file SoftSkillsManager.c.

320 {
321 SetCoolDown(true);
323 m_CoolDownTimer.Run(cooldown_value, this, "SetCoolDown", new Param1<bool>(false));
324 }
void SetCoolDown(bool cool_down)

References m_CoolDownTimer, SetCoolDown(), and SetCoolDownValue().

Referenced by AddSpecialty().

◆ StartSynchTimer()

void SoftSkillsManager::StartSynchTimer ( )
inlineprotected

Definition at line 475 of file SoftSkillsManager.c.

476 {
477 SetIsDebug(true);
478 m_SynchTimer = new Timer;
479 m_SynchTimer.Run(2, this, "SynchDebugStats", NULL, true);
480 }

References m_SynchTimer, and SetIsDebug().

◆ StopSynchTimer()

void SoftSkillsManager::StopSynchTimer ( )
inlineprotected

Definition at line 483 of file SoftSkillsManager.c.

484 {
485 SetIsDebug(false);
486
487 if (m_SynchTimer)
488 {
489 m_SynchTimer.Stop();
490 delete m_SynchTimer;
491 }
492 }

References m_SynchTimer, and SetIsDebug().

◆ SubtractSpecialtyBonus()

float SoftSkillsManager::SubtractSpecialtyBonus ( float base_value,
float specialty_weight,
bool is_cacomponent = false,
float limit_efficiency = 2 )
inlineprotected

◆ SynchDebugStats()

void SoftSkillsManager::SynchDebugStats ( )
inlineprotected

Definition at line 357 of file SoftSkillsManager.c.

358 {
359 if (GetGame().IsServer() && GetGame().IsMultiplayer())
360 {
362 GetGame().RPCSingleParam(m_Player, ERPCs.RPC_SOFT_SKILLS_STATS_SYNC, debug_stats, true, m_Player.GetIdentity());
363 }
364 }
ERPCs
Definition ERPCs.c:2
proto native CGame GetGame()

References GetGame(), m_CoolDownValue, m_GeneralBonusAfter, m_GeneralBonusBefore, m_IsCoolDown, m_LastUAValue, and m_Player.

◆ SynchSpecialtyLevel()

void SoftSkillsManager::SynchSpecialtyLevel ( )
inlineprotected

Definition at line 266 of file SoftSkillsManager.c.

267 {
268#ifdef SERVER
270 GetGame().RPCSingleParam(m_Player, ERPCs.RPC_SOFT_SKILLS_SPECIALTY_SYNC, specialty_level, true, m_Player.GetIdentity());
271#endif
272 }

References GetGame(), m_Player, and m_SpecialtyLevel.

Referenced by AddSpecialty(), InitSpecialty(), and ResetDebugWindow().

Member Data Documentation

◆ COOLDOWN_TIMER

const float SoftSkillsManager::COOLDOWN_TIMER = 5
staticprotected

Definition at line 17 of file SoftSkillsManager.c.

Referenced by AddSpecialty().

◆ DEFAULT_EFFICIENCY

const int SoftSkillsManager::DEFAULT_EFFICIENCY = 0
staticprotected

Definition at line 14 of file SoftSkillsManager.c.

Referenced by GetPreciseRoughLevels().

◆ m_ComponentBonusAfter

float SoftSkillsManager::m_ComponentBonusAfter
protected

Definition at line 25 of file SoftSkillsManager.c.

Referenced by GetComponentBonusAfter(), and SetComponentBonusAfter().

◆ m_ComponentBonusBefore

float SoftSkillsManager::m_ComponentBonusBefore
protected

Definition at line 24 of file SoftSkillsManager.c.

Referenced by GetComponentBonusBefore(), and SetComponentBonusBefore().

◆ m_CoolDownTimer

ref Timer SoftSkillsManager::m_CoolDownTimer = new Timer()
protected

Definition at line 19 of file SoftSkillsManager.c.

Referenced by StartCoolDownTimer(), and ~SoftSkillsManager().

◆ m_CoolDownValue

float SoftSkillsManager::m_CoolDownValue
protected

Definition at line 22 of file SoftSkillsManager.c.

Referenced by GetCoolDownValue(), SetCoolDownValue(), and SynchDebugStats().

◆ m_DebugWindow

ref SoftSkillManagerDebug SoftSkillsManager::m_DebugWindow
protected

Definition at line 29 of file SoftSkillsManager.c.

Referenced by CreateDebugWindow().

◆ m_GeneralBonusAfter

float SoftSkillsManager::m_GeneralBonusAfter
protected

Definition at line 27 of file SoftSkillsManager.c.

Referenced by GetGeneralBonusAfter(), SetGeneralBonusAfter(), and SynchDebugStats().

◆ m_GeneralBonusBefore

float SoftSkillsManager::m_GeneralBonusBefore
protected

◆ m_IsActive

bool SoftSkillsManager::m_IsActive
protected

Definition at line 9 of file SoftSkillsManager.c.

Referenced by GetSoftSkillsState(), SetSoftSkillsState(), and SoftSkillsManager().

◆ m_IsCoolDown

bool SoftSkillsManager::m_IsCoolDown
protected

Definition at line 10 of file SoftSkillsManager.c.

Referenced by IsCoolDown(), SetCoolDown(), SoftSkillsManager(), and SynchDebugStats().

◆ m_IsDebugMode

bool SoftSkillsManager::m_IsDebugMode
protected

Definition at line 21 of file SoftSkillsManager.c.

Referenced by IsDebug(), SetIsDebug(), and SoftSkillsManager().

◆ m_IsLinear

bool SoftSkillsManager::m_IsLinear
protected

Definition at line 8 of file SoftSkillsManager.c.

Referenced by IsLinear(), SetLinearState(), and SoftSkillsManager().

◆ m_LastUAValue

float SoftSkillsManager::m_LastUAValue
protected

Definition at line 23 of file SoftSkillsManager.c.

Referenced by GetLastUAValue(), SetLastUAValue(), and SynchDebugStats().

◆ m_Player

PlayerBase SoftSkillsManager::m_Player
protected

◆ m_PreciseLevel

float SoftSkillsManager::m_PreciseLevel
protected

◆ m_RoughLevel

float SoftSkillsManager::m_RoughLevel
protected

◆ m_SpecialtyLevel

◆ m_SynchTimer

ref Timer SoftSkillsManager::m_SynchTimer
protected

Definition at line 31 of file SoftSkillsManager.c.

Referenced by StartSynchTimer(), and StopSynchTimer().

◆ m_UserActionsCounter

int SoftSkillsManager::m_UserActionsCounter
protected

Definition at line 12 of file SoftSkillsManager.c.

Referenced by AddExponentialPrecise(), and AddExponentialRough().

◆ PRECISE_WEIGHT_LIMIT

const float SoftSkillsManager::PRECISE_WEIGHT_LIMIT = -1
staticprotected

◆ ROUGH_WEIGHT_LIMIT

const float SoftSkillsManager::ROUGH_WEIGHT_LIMIT = 1
staticprotected

The documentation for this class was generated from the following file: