mirror of
https://github.com/EQEmu/Server.git
synced 2026-06-24 17:48:20 +00:00
Activation of the new 'Bots' command system
This commit is contained in:
@@ -0,0 +1,148 @@
|
||||
/* EQEMu: Everquest Server Emulator
|
||||
Copyright (C) 2001-2016 EQEMu Development Team (http://eqemulator.org)
|
||||
|
||||
This program is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation; version 2 of the License.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY except by those people which sell it, which
|
||||
are required to give you total support for your newly bought product;
|
||||
without even the implied warranty of MERCHANTABILITY or FITNESS FOR
|
||||
A PARTICULAR PURPOSE. See the GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program; if not, write to the Free Software
|
||||
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
*/
|
||||
|
||||
|
||||
#ifndef HEAL_ROTATION_H
|
||||
#define HEAL_ROTATION_H
|
||||
|
||||
#include "mob.h"
|
||||
|
||||
#define CASTING_CYCLE_MINIMUM_INTERVAL 1000
|
||||
#define CASTING_CYCLE_MINIMUM_INTERVAL_S 1
|
||||
#define CASTING_CYCLE_MAXIMUM_INTERVAL 30000
|
||||
#define CASTING_CYCLE_MAXIMUM_INTERVAL_S 30
|
||||
#define CASTING_CYCLE_DEFAULT_INTERVAL 5000
|
||||
#define CASTING_CYCLE_DEFAULT_INTERVAL_S 5
|
||||
#define POKE_PROPAGATION_DELAY 250
|
||||
#define ADVANCE_ROTATION_MINIMUM_INTERVAL 100
|
||||
#define HEALING_STATS_RESET_INTERVAL 60000
|
||||
#define HEALING_STATS_RESET_INTERVAL_S 60
|
||||
|
||||
#define SAFE_HP_RATIO_BASE 95.0f
|
||||
#define CRITICAL_HP_RATIO_BASE 10.0f
|
||||
|
||||
struct HealingStats
|
||||
{
|
||||
uint32 last_heal_time_ms;
|
||||
uint32 heal_count;
|
||||
};
|
||||
|
||||
// Both members and targets use a shared_ptr to keep track of their HealRotation instance
|
||||
class HealRotation
|
||||
{
|
||||
public:
|
||||
HealRotation(Bot* hr_creator, uint32 interval_ms = CASTING_CYCLE_DEFAULT_INTERVAL, bool fast_heals = false, bool adaptive_targeting = false, bool casting_override = false);
|
||||
|
||||
void SetIntervalMS(uint32 interval_ms);
|
||||
void SetIntervalS(uint32 interval_s);
|
||||
void SetFastHeals(bool flag) { m_fast_heals = flag; }
|
||||
void SetAdaptiveTargeting(bool flag) { m_adaptive_targeting = flag; }
|
||||
void SetCastingOverride(bool flag) { m_casting_override = flag; }
|
||||
bool AddMemberToPool(Bot* hr_member);
|
||||
bool AddTargetToPool(Mob* hr_target);
|
||||
|
||||
uint32 CreationTimeMS() { return m_creation_time_ms; }
|
||||
uint32 LastHealTimeMS() { return m_last_heal_time_ms; }
|
||||
uint32 IntervalMS() { return m_interval_ms; }
|
||||
uint32 IntervalS() { return (m_interval_ms / 1000); }
|
||||
bool FastHeals() { return m_fast_heals; }
|
||||
bool AdaptiveTargeting() { return m_adaptive_targeting; }
|
||||
bool CastingOverride() { return m_casting_override; }
|
||||
bool RemoveMemberFromPool(Bot* hr_member);
|
||||
bool RemoveTargetFromPool(Mob* hr_target);
|
||||
|
||||
bool ClearMemberPool();
|
||||
bool ClearTargetPool();
|
||||
|
||||
bool Start();
|
||||
bool Stop();
|
||||
|
||||
bool IsActive() { return m_is_active; }
|
||||
bool CastingReady() { return (Timer::GetCurrentTime() >= m_next_cast_time_ms); }
|
||||
Bot* CastingMember();
|
||||
bool PokeCastingTarget();
|
||||
Mob* CastingTarget();
|
||||
bool AdvanceRotation(bool use_interval = true);
|
||||
|
||||
std::list<Bot*>* MemberList() { return &m_member_pool; }
|
||||
std::list<Bot*>* CycleList() { return &m_cycle_pool; }
|
||||
std::list<Mob*>* TargetList() { return &m_target_pool; }
|
||||
|
||||
bool IsMemberInPool(Bot* hr_member);
|
||||
bool IsTargetInPool(Mob* hr_target);
|
||||
|
||||
void SetMemberIsCasting(Bot* hr_member, bool flag = true);
|
||||
bool MemberIsCasting(Bot* hr_member);
|
||||
|
||||
void UpdateTargetHealingStats(Mob* hr_target);
|
||||
void StartNewTargetHealingStatsCycle(uint32 current_time);
|
||||
uint32 HealCount(Mob* hr_target);
|
||||
uint32 ExtendedHealCount(Mob* hr_target);
|
||||
float HealFrequency(Mob* hr_target);
|
||||
float ExtendedHealFrequency(Mob* hr_target);
|
||||
HealingStats* TargetHealingStats1(Mob* hr_target);
|
||||
HealingStats* TargetHealingStats2(Mob* hr_target);
|
||||
|
||||
bool SetArmorTypeSafeHPRatio(uint8 armor_type, float hp_ratio);
|
||||
bool SetArmorTypeCriticalHPRatio(uint8 armor_type, float hp_ratio);
|
||||
|
||||
float ArmorTypeSafeHPRatio(uint8 armor_type);
|
||||
float ArmorTypeCriticalHPRatio(uint8 armor_type);
|
||||
|
||||
void ResetArmorTypeHPLimits();
|
||||
|
||||
static bool IsMemberClass(uint8 class_id);
|
||||
static bool IsTargetMobType(Mob* target_mob);
|
||||
|
||||
private:
|
||||
bool valid_state();
|
||||
void cycle_refresh();
|
||||
bool healable_target(bool use_class_at = true, bool critical_only = false);
|
||||
void bias_targets();
|
||||
|
||||
uint32 m_creation_time_ms;
|
||||
uint32 m_last_heal_time_ms;
|
||||
uint32 m_interval_ms;
|
||||
uint32 m_next_cast_time_ms;
|
||||
uint32 m_next_poke_time_ms;
|
||||
uint32 m_healing_stats_begin_ms;
|
||||
bool m_fast_heals;
|
||||
bool m_adaptive_targeting;
|
||||
bool m_casting_override;
|
||||
bool m_casting_target_poke;
|
||||
bool m_active_heal_target;
|
||||
|
||||
bool m_is_active;
|
||||
|
||||
std::list<Bot*> m_member_pool;
|
||||
std::list<Bot*> m_cycle_pool;
|
||||
std::list<Mob*> m_target_pool;
|
||||
|
||||
std::map<Bot*, bool> m_member_is_casting;
|
||||
|
||||
std::map<Mob*, HealingStats> m_target_healing_stats_1;
|
||||
std::map<Mob*, HealingStats> m_target_healing_stats_2;
|
||||
|
||||
float m_safe_hp_ratio[ARMOR_TYPE_COUNT];
|
||||
float m_critical_hp_ratio[ARMOR_TYPE_COUNT];
|
||||
|
||||
friend class std::_Ref_count_obj<HealRotation>;
|
||||
HealRotation(HealRotation* allocator_shunt) {};
|
||||
};
|
||||
|
||||
#endif
|
||||
Reference in New Issue
Block a user