Horizon Official Technical Documentation
Horizon::Zone::Traits::JobLevel Class Reference

#include <AttributesImpl.hpp>

+ Inheritance diagram for Horizon::Zone::Traits::JobLevel:
+ Collaboration diagram for Horizon::Zone::Traits::JobLevel:

Public Member Functions

 JobLevel (std::weak_ptr< Unit > unit, int32_t base=0)
 
 ~JobLevel ()
 
void on_observable_changed (JobExperience *wjexp)
 
void set_base (int32_t val, bool notify_client=true) override
 
void add_base (int32_t val, bool notify_client=true) override
 
void sub_base (int32_t val, bool notify_client=true) override
 
void set_equip (int32_t val, bool notify_client=true) override
 
void add_equip (int32_t val, bool notify_client=true) override
 
void sub_equip (int32_t val, bool notify_client=true) override
 
void set_status (int32_t val, bool notify_client=true) override
 
void add_status (int32_t val, bool notify_client=true) override
 
void sub_status (int32_t val, bool notify_client=true) override
 
- Public Member Functions inherited from Horizon::Zone::Traits::Attribute
 Attribute ()=default
 
 Attribute (std::weak_ptr< Unit > unit, status_point_type st_type, int32_t base=0, int32_t equip=0, int32_t status=0)
 
 Attribute (const Attribute &other)
 
 Attribute (Attribute &&other) noexcept
 
std::shared_ptr< Unitunit ()
 
void unit (std::shared_ptr< Unit > e)
 
virtual void set_base (int32_t val, bool notify=true)
 
virtual void add_base (int32_t val, bool notify=true)
 
virtual void sub_base (int32_t val, bool notify=true)
 
virtual int32_t get_base () const
 
virtual void set_equip (int32_t val, bool notify=true)
 
virtual void add_equip (int32_t val, bool notify=true)
 
virtual void sub_equip (int32_t val, bool notify=true)
 
virtual int32_t get_equip () const
 
virtual void set_status (int32_t val, bool notify=true)
 
virtual void add_status (int32_t val, bool notify=true)
 
virtual void sub_status (int32_t val, bool notify=true)
 
virtual int32_t get_status () const
 
virtual int32_t total () const
 
virtual int32_t compute ()
 
template<typename TT , typename std::enable_if< std::is_integral< TT >::value >::type * = nullptr>
TT operator+ (TT right)
 
template<typename TT , typename std::enable_if< std::is_integral< TT >::value >::type * = nullptr>
TT operator/ (TT right)
 
template<typename TT , typename std::enable_if< std::is_integral< TT >::value >::type * = nullptr>
TT operator* (TT right)
 
template<typename TT , typename std::enable_if< std::is_integral< TT >::value >::type * = nullptr>
TT operator- (TT right)
 
int operator+ (Attribute const &right) const
 
double operator/ (Attribute const &right)
 
double operator* (Attribute const &right)
 
int operator- (Attribute const &right)
 
template<typename TT , typename std::enable_if< std::is_integral< TT >::value >::type * = nullptr>
bool operator== (TT right)
 
template<typename TT , typename std::enable_if< std::is_integral< TT >::value >::type * = nullptr>
bool operator!= (TT right)
 
template<typename TT , typename std::enable_if< std::is_integral< TT >::value >::type * = nullptr>
bool operator> (TT right)
 
template<typename TT , typename std::enable_if< std::is_integral< TT >::value >::type * = nullptr>
bool operator>= (TT right)
 
template<typename TT , typename std::enable_if< std::is_integral< TT >::value >::type * = nullptr>
bool operator< (TT right)
 
template<typename TT , typename std::enable_if< std::is_integral< TT >::value >::type * = nullptr>
bool operator<= (TT right)
 
bool operator== (Attribute const &right)
 
bool operator!= (Attribute const &right)
 
bool operator> (Attribute const &right)
 
bool operator>= (Attribute const &right)
 
bool operator< (Attribute const &right)
 
bool operator<= (Attribute const &right)
 
Attribute operator= (Attribute &right)
 
Attribute operator= (Attribute &&right)
 
void add_permanent_change (s_attribute_change_values change, std::string source)
 
void remove_permanent_change (std::string source)
 
void add_temporary_change (s_attribute_change_values change, uint64_t duration, std::string source)
 
void remove_temporary_change (std::string source)
 
void add_periodic_change (s_attribute_change_values change, uint64_t duration, uint64_t interval, std::string source)
 
void remove_periodic_change (std::string source)
 
void update (uint64_t delta)
 
void apply (bool notify=true)
 
void reset ()
 
void notify ()
 
status_point_type get_type () const
 
bool needs_recalculation () const
 
void recalculate (bool flag)
 
bool is_compute_ready () const
 
- Public Member Functions inherited from ObservableStatus< JobLevel *, SkillPoint *, NextJobExperience * >
 ObservableStatus (HAS_OBSERVERS ... args)
 
 ~ObservableStatus ()
 
std::enable_if< I==sizeof...(Tp), void >::type notify (std::tuple< Tp... > &)
 
 notify (t)
 
 std::enable_if (_observers) -> on_observable_changed(_observable)
 
void notify_observers ()
 
void register_observable (JobLevel * obs)
 
void register_observers (HAS_OBSERVERS... obs)
 

Additional Inherited Members

- Public Attributes inherited from ObservableStatus< JobLevel *, SkillPoint *, NextJobExperience * >
JobLevel * _observable
 
std::tuple< HAS_OBSERVERS... > _observers
 
- Protected Attributes inherited from Horizon::Zone::Traits::Attribute
status_point_type _status_point_type {status_point_type::STATUS_POINT_INVALID}
 
int32_t _base_val {0}
 
int32_t _equip_val {0}
 
int32_t _status_val {0}
 
bool _apply_periodic_changes {false}
 
bool _recalculate_flag {false}
 
bool _calculate_ready {false}
 

Constructor & Destructor Documentation

◆ JobLevel()

Horizon::Zone::Traits::JobLevel::JobLevel ( std::weak_ptr< Unit unit,
int32_t  base = 0 
)
inline
164 : Attribute(unit, STATUS_JOBLEVEL, base, 0, 0),
165 ObservableStatus(nullptr, nullptr)
166 { }
@ STATUS_JOBLEVEL
Definition: UnitDefinitions.hpp:144
std::shared_ptr< Unit > unit()
Definition: Attribute.hpp:259
ObservableStatus(HAS_OBSERVERS ... args)
Definition: ObservableStatus.hpp:39

◆ ~JobLevel()

Horizon::Zone::Traits::JobLevel::~JobLevel ( )
inline
167{ };

Member Function Documentation

◆ add_base()

void Horizon::Zone::Traits::JobLevel::add_base ( int32_t  val,
bool  notify_client = true 
)
inlineoverridevirtual

Reimplemented from Horizon::Zone::Traits::Attribute.

178 {
179 Attribute::add_base(val, notify_client);
180 this->notify_observers();
181 }
virtual void add_base(int32_t val, bool notify=true)
Definition: Attribute.cpp:244
void notify_observers()
Definition: ObservableStatus.hpp:59

References Horizon::Zone::Traits::Attribute::add_base(), and ObservableStatus< JobLevel *, SkillPoint *, NextJobExperience * >::notify_observers().

Referenced by Horizon::Zone::UnitComponent::sync_data_types().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ add_equip()

void Horizon::Zone::Traits::JobLevel::add_equip ( int32_t  val,
bool  notify_client = true 
)
inlineoverridevirtual

Reimplemented from Horizon::Zone::Traits::Attribute.

196 {
197 Attribute::add_equip(val, notify_client);
198 this->notify_observers();
199 }
virtual void add_equip(int32_t val, bool notify=true)
Definition: Attribute.cpp:252

References Horizon::Zone::Traits::Attribute::add_equip(), and ObservableStatus< JobLevel *, SkillPoint *, NextJobExperience * >::notify_observers().

+ Here is the call graph for this function:

◆ add_status()

void Horizon::Zone::Traits::JobLevel::add_status ( int32_t  val,
bool  notify_client = true 
)
inlineoverridevirtual

Reimplemented from Horizon::Zone::Traits::Attribute.

214 {
215 Attribute::add_status(val, notify_client);
216 this->notify_observers();
217 }
virtual void add_status(int32_t val, bool notify=true)
Definition: Attribute.cpp:260

References Horizon::Zone::Traits::Attribute::add_status(), and ObservableStatus< JobLevel *, SkillPoint *, NextJobExperience * >::notify_observers().

+ Here is the call graph for this function:

◆ on_observable_changed()

void JobLevel::on_observable_changed ( JobExperience wjexp)
416{
417 if (unit() == nullptr || jexp == nullptr)
418 return;
419
420 std::shared_ptr<const job_config_data> job = JobDB->get_job_by_id(unit()->job_id());
421 std::shared_ptr<const exp_group_data> jexpg = ExpDB->get_exp_group(job->job_exp_group, EXP_GROUP_TYPE_JOB);
422
423 if (get_base() >= jexpg->max_level)
424 return;
425
426 if (jexp->get_base() >= unit()->status()->next_job_experience()->get_base()) {
427 int carried_over = jexp->get_base() - unit()->status()->next_job_experience()->get_base();
428 add_base(1);
429 jexp->set_base(carried_over);
430 }
431}
#define ExpDB
Definition: ExpDB.hpp:93
#define JobDB
Definition: JobDB.hpp:87
virtual int32_t get_base() const
Definition: Attribute.hpp:269
void add_base(int32_t val, bool notify_client=true) override
Definition: AttributesImpl.hpp:177
@ EXP_GROUP_TYPE_JOB
Definition: ExpDB.hpp:52

References Horizon::Zone::EXP_GROUP_TYPE_JOB, ExpDB, Horizon::Zone::Traits::s_attribute_change_values::get_base(), Horizon::Zone::Traits::Attribute::get_base(), JobDB, Horizon::Zone::Traits::JobExperience::set_base(), and Horizon::Zone::Traits::s_attribute_change_values::status.

+ Here is the call graph for this function:

◆ set_base()

void Horizon::Zone::Traits::JobLevel::set_base ( int32_t  val,
bool  notify_client = true 
)
inlineoverridevirtual

Reimplemented from Horizon::Zone::Traits::Attribute.

172 {
173 Attribute::set_base(val, notify_client);
174 this->notify_observers();
175 }
virtual void set_base(int32_t val, bool notify=true)
Definition: Attribute.hpp:262

References ObservableStatus< JobLevel *, SkillPoint *, NextJobExperience * >::notify_observers(), and Horizon::Zone::Traits::Attribute::set_base().

Referenced by Horizon::Zone::UnitComponent::sync_data_types().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ set_equip()

void Horizon::Zone::Traits::JobLevel::set_equip ( int32_t  val,
bool  notify_client = true 
)
inlineoverridevirtual

Reimplemented from Horizon::Zone::Traits::Attribute.

190 {
191 Attribute::set_equip(val, notify_client);
192 this->notify_observers();
193 }
virtual void set_equip(int32_t val, bool notify=true)
Definition: Attribute.hpp:271

References ObservableStatus< JobLevel *, SkillPoint *, NextJobExperience * >::notify_observers(), and Horizon::Zone::Traits::Attribute::set_equip().

+ Here is the call graph for this function:

◆ set_status()

void Horizon::Zone::Traits::JobLevel::set_status ( int32_t  val,
bool  notify_client = true 
)
inlineoverridevirtual

Reimplemented from Horizon::Zone::Traits::Attribute.

208 {
209 Attribute::set_status(val, notify_client);
210 this->notify_observers();
211 }
virtual void set_status(int32_t val, bool notify=true)
Definition: Attribute.hpp:280

References ObservableStatus< JobLevel *, SkillPoint *, NextJobExperience * >::notify_observers(), and Horizon::Zone::Traits::Attribute::set_status().

+ Here is the call graph for this function:

◆ sub_base()

void Horizon::Zone::Traits::JobLevel::sub_base ( int32_t  val,
bool  notify_client = true 
)
inlineoverridevirtual

Reimplemented from Horizon::Zone::Traits::Attribute.

184 {
185 Attribute::sub_base(val, notify_client);
186 this->notify_observers();
187 }
virtual void sub_base(int32_t val, bool notify=true)
Definition: Attribute.cpp:248

References ObservableStatus< JobLevel *, SkillPoint *, NextJobExperience * >::notify_observers(), and Horizon::Zone::Traits::Attribute::sub_base().

Referenced by Horizon::Zone::UnitComponent::sync_data_types().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ sub_equip()

void Horizon::Zone::Traits::JobLevel::sub_equip ( int32_t  val,
bool  notify_client = true 
)
inlineoverridevirtual

Reimplemented from Horizon::Zone::Traits::Attribute.

202 {
203 Attribute::sub_equip(val, notify_client);
204 this->notify_observers();
205 }
virtual void sub_equip(int32_t val, bool notify=true)
Definition: Attribute.cpp:256

References ObservableStatus< JobLevel *, SkillPoint *, NextJobExperience * >::notify_observers(), and Horizon::Zone::Traits::Attribute::sub_equip().

+ Here is the call graph for this function:

◆ sub_status()

void Horizon::Zone::Traits::JobLevel::sub_status ( int32_t  val,
bool  notify_client = true 
)
inlineoverridevirtual

Reimplemented from Horizon::Zone::Traits::Attribute.

220 {
221 Attribute::sub_status(val, notify_client);
222 this->notify_observers();
223 }
virtual void sub_status(int32_t val, bool notify=true)
Definition: Attribute.cpp:264

References ObservableStatus< JobLevel *, SkillPoint *, NextJobExperience * >::notify_observers(), and Horizon::Zone::Traits::Attribute::sub_status().

+ Here is the call graph for this function:

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