mirror of
https://github.com/EQEmu/Server.git
synced 2026-09-04 14:36:37 +00:00
Changed hate counter to uint32 to prevent negative rollback, this most likely can will be an issue but more uncommon
Renamed and refactored most functions and variables in hate_list.h/cpp for readability Refactored how hate works in some local functions mixing the use of hate variable and split it out into different status variables hate_list.cpp/.h style cleanup hate_list.h header function sort, comment erase functions should clearly state their function
This commit is contained in:
+45
-51
@@ -1,5 +1,5 @@
|
||||
/* EQEMu: Everquest Server Emulator
|
||||
Copyright (C) 2001-2002 EQEMu Development Team (http://eqemu.org)
|
||||
/* EQEMu: Everquest Server Emulator
|
||||
Copyright (C) 2001-2015 EQEMu Development Team (http://eqemu.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
|
||||
@@ -25,66 +25,60 @@ class Mob;
|
||||
class Raid;
|
||||
struct ExtraAttackOptions;
|
||||
|
||||
struct tHateEntry
|
||||
{
|
||||
Mob *ent;
|
||||
int32 damage, hate;
|
||||
bool bFrenzy;
|
||||
struct struct_HateList {
|
||||
Mob *entity_on_hatelist;
|
||||
uint32 hatelist_damage;
|
||||
uint32 stored_hate_amount;
|
||||
bool is_entity_frenzy;
|
||||
};
|
||||
|
||||
class HateList
|
||||
{
|
||||
public:
|
||||
HateList();
|
||||
~HateList();
|
||||
public:
|
||||
HateList();
|
||||
~HateList();
|
||||
|
||||
// adds a mob to the hatelist
|
||||
void Add(Mob *ent, int32 in_hate=0, int32 in_dam=0, bool bFrenzy = false, bool iAddIfNotExist = true);
|
||||
// sets existing hate
|
||||
void Set(Mob *other, uint32 in_hate, uint32 in_dam);
|
||||
// removes mobs from hatelist
|
||||
bool RemoveEnt(Mob *ent);
|
||||
// Remove all
|
||||
void Wipe();
|
||||
// ???
|
||||
void DoFactionHits(int32 nfl_id);
|
||||
// Gets Hate amount for mob
|
||||
int32 GetEntHate(Mob *ent, bool damage = false);
|
||||
// gets top hated mob
|
||||
Mob *GetTop(Mob *center);
|
||||
// gets any on the list
|
||||
Mob *GetRandom();
|
||||
// get closest mob or nullptr if list empty
|
||||
Mob *GetClosest(Mob *hater);
|
||||
// gets top mob or nullptr if hate list empty
|
||||
Mob *GetDamageTop(Mob *hater);
|
||||
// used to check if mob is on hatelist
|
||||
bool IsOnHateList(Mob *);
|
||||
// used to remove or add frenzy hate
|
||||
void CheckFrenzyHate();
|
||||
//Gets the target with the most hate regardless of things like frenzy etc.
|
||||
Mob* GetMostHate();
|
||||
// Count 'Summoned' pets on hatelist
|
||||
int SummonedPetCount(Mob *hater);
|
||||
Mob *GetClosestEntOnHateList(Mob *hater);
|
||||
Mob *GetDamageTopOnHateList(Mob *hater);
|
||||
Mob *GetRandomEntOnHateList();
|
||||
Mob *GetEntWithMostHateInRange(Mob *center);
|
||||
Mob* GetEntWithMostHateOnList();
|
||||
|
||||
int AreaRampage(Mob *caster, Mob *target, int count, ExtraAttackOptions *opts);
|
||||
bool IsEntOnHateList(Mob *);
|
||||
bool IsHateListEmpty();
|
||||
bool RemoveEntFromHateList(Mob *ent);
|
||||
|
||||
void SpellCast(Mob *caster, uint32 spell_id, float range, Mob *ae_center = nullptr);
|
||||
int AreaRampage(Mob *caster, Mob *target, int count, ExtraAttackOptions *opts);
|
||||
int GetSummonedPetCountOnHateList(Mob *hater);
|
||||
|
||||
bool IsEmpty();
|
||||
void PrintToClient(Client *c);
|
||||
uint32 GetEntHateAmount(Mob *in_entity, bool damage = false);
|
||||
|
||||
//For accessing the hate list via perl; don't use for anything else
|
||||
std::list<tHateEntry*>& GetHateList() { return list; }
|
||||
void AddEntToHateList(Mob *in_entity, int32 in_hate = 0, int32 in_damage = 0, bool in_is_frenzied = false, bool add_to_hate_list_if_not_exist = true);
|
||||
void DoFactionHits(int32 npc_faction_level_id);
|
||||
void IsEntityInFrenzyMode();
|
||||
void PrintHateListToClient(Client *c);
|
||||
void SetHateAmountOnEnt(Mob *other, uint32 in_hate, uint32 in_dam);
|
||||
void SpellCast(Mob *caster, uint32 spell_id, float range, Mob *ae_center = nullptr);
|
||||
void WipeHateList();
|
||||
|
||||
//setting owner
|
||||
void SetOwner(Mob *newOwner) { owner = newOwner; }
|
||||
|
||||
protected:
|
||||
tHateEntry* Find(Mob *ent);
|
||||
private:
|
||||
std::list<tHateEntry*> list;
|
||||
Mob *owner;
|
||||
/* For accessing the hate list via perl; don't use for anything else */
|
||||
std::list<struct_HateList*>& GetHateList()
|
||||
{
|
||||
return list;
|
||||
}
|
||||
|
||||
/* Setting owner*/
|
||||
void SetOwner(Mob *new_owner)
|
||||
{
|
||||
owner = new_owner;
|
||||
}
|
||||
|
||||
protected:
|
||||
struct_HateList* Find(Mob *ent);
|
||||
private:
|
||||
std::list<struct_HateList*> list;
|
||||
Mob *owner;
|
||||
};
|
||||
|
||||
#endif
|
||||
|
||||
Reference in New Issue
Block a user