Enforce regen refresh after combat, avoid loot method being out of range
This commit is contained in:
parent
3045b15f88
commit
f1c4a91b01
@ -1110,6 +1110,10 @@ void Entity::InCombat(bool val){
|
|||||||
|
|
||||||
in_combat = val;
|
in_combat = val;
|
||||||
|
|
||||||
|
RefreshRegen(changeCombatState);
|
||||||
|
}
|
||||||
|
|
||||||
|
void Entity::RefreshRegen(bool override_) {
|
||||||
bool update_regen = false;
|
bool update_regen = false;
|
||||||
if(GetInfoStruct()->get_engaged_encounter()) {
|
if(GetInfoStruct()->get_engaged_encounter()) {
|
||||||
if(!IsEngagedInEncounter()) {
|
if(!IsEngagedInEncounter()) {
|
||||||
@ -1117,8 +1121,7 @@ void Entity::InCombat(bool val){
|
|||||||
update_regen = true;
|
update_regen = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
if(override_ || update_regen)
|
||||||
if(changeCombatState || update_regen)
|
|
||||||
SetRegenValues((GetInfoStruct()->get_effective_level() > 0) ? GetInfoStruct()->get_effective_level() : GetLevel());
|
SetRegenValues((GetInfoStruct()->get_effective_level() > 0) ? GetInfoStruct()->get_effective_level() : GetLevel());
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -3934,7 +3937,7 @@ bool Entity::IsEngagedInEncounter(Spawn** res) {
|
|||||||
if(IsPlayer()) {
|
if(IsPlayer()) {
|
||||||
for (itr = HatedBy.begin(); itr != HatedBy.end(); itr++) {
|
for (itr = HatedBy.begin(); itr != HatedBy.end(); itr++) {
|
||||||
Spawn* spawn = GetZone()->GetSpawnByID(*itr);
|
Spawn* spawn = GetZone()->GetSpawnByID(*itr);
|
||||||
if (spawn && spawn->IsNPC() && ((NPC*)spawn)->Brain() && (spawn->GetLockedNoLoot() == ENCOUNTER_STATE_LOCKED || spawn->GetLockedNoLoot() == ENCOUNTER_STATE_OVERMATCHED)) {
|
if (spawn && spawn->IsNPC() && ((NPC*)spawn)->Brain() && spawn->Alive() && (spawn->GetLockedNoLoot() == ENCOUNTER_STATE_LOCKED || spawn->GetLockedNoLoot() == ENCOUNTER_STATE_OVERMATCHED)) {
|
||||||
if((ret = ((NPC*)spawn)->Brain()->IsPlayerInEncounter(((Player*)this)->GetCharacterID()))) {
|
if((ret = ((NPC*)spawn)->Brain()->IsPlayerInEncounter(((Player*)this)->GetCharacterID()))) {
|
||||||
if(res)
|
if(res)
|
||||||
*res = spawn;
|
*res = spawn;
|
||||||
@ -3946,7 +3949,7 @@ bool Entity::IsEngagedInEncounter(Spawn** res) {
|
|||||||
else {
|
else {
|
||||||
for (itr = HatedBy.begin(); itr != HatedBy.end(); itr++) {
|
for (itr = HatedBy.begin(); itr != HatedBy.end(); itr++) {
|
||||||
Spawn* spawn = GetZone()->GetSpawnByID(*itr);
|
Spawn* spawn = GetZone()->GetSpawnByID(*itr);
|
||||||
if (spawn && spawn->IsNPC() && ((NPC*)spawn)->Brain() && (spawn->GetLockedNoLoot() == ENCOUNTER_STATE_LOCKED || spawn->GetLockedNoLoot() == ENCOUNTER_STATE_OVERMATCHED)) {
|
if (spawn && spawn->IsNPC() && ((NPC*)spawn)->Brain() && spawn->Alive() && (spawn->GetLockedNoLoot() == ENCOUNTER_STATE_LOCKED || spawn->GetLockedNoLoot() == ENCOUNTER_STATE_OVERMATCHED)) {
|
||||||
if((ret = ((NPC*)spawn)->Brain()->IsEntityInEncounter(GetID()))) {
|
if((ret = ((NPC*)spawn)->Brain()->IsEntityInEncounter(GetID()))) {
|
||||||
if(res)
|
if(res)
|
||||||
*res = spawn;
|
*res = spawn;
|
||||||
|
@ -1069,7 +1069,7 @@ struct InfoStruct{
|
|||||||
|
|
||||||
void set_reload_player_spells(int8 value) { std::lock_guard<std::mutex> lk(classMutex); reload_player_spells_ = value; }
|
void set_reload_player_spells(int8 value) { std::lock_guard<std::mutex> lk(classMutex); reload_player_spells_ = value; }
|
||||||
|
|
||||||
void set_group_loot_method(int8 value) { std::lock_guard<std::mutex> lk(classMutex); group_loot_method_ = value; }
|
void set_group_loot_method(int8 value) { std::lock_guard<std::mutex> lk(classMutex); if(value <= GroupLootMethod::METHOD_MAX_COUNT) group_loot_method_ = value; }
|
||||||
void set_group_loot_items_rarity(int8 value) { std::lock_guard<std::mutex> lk(classMutex); group_loot_items_rarity_ = value; }
|
void set_group_loot_items_rarity(int8 value) { std::lock_guard<std::mutex> lk(classMutex); group_loot_items_rarity_ = value; }
|
||||||
void set_group_auto_split(int8 value) { std::lock_guard<std::mutex> lk(classMutex); group_auto_split_ = value; }
|
void set_group_auto_split(int8 value) { std::lock_guard<std::mutex> lk(classMutex); group_auto_split_ = value; }
|
||||||
void set_group_default_yell(int8 value) { std::lock_guard<std::mutex> lk(classMutex); group_default_yell_ = value; }
|
void set_group_default_yell(int8 value) { std::lock_guard<std::mutex> lk(classMutex); group_default_yell_ = value; }
|
||||||
@ -1584,6 +1584,7 @@ public:
|
|||||||
|
|
||||||
bool EngagedInCombat();
|
bool EngagedInCombat();
|
||||||
virtual void InCombat(bool val);
|
virtual void InCombat(bool val);
|
||||||
|
void RefreshRegen(bool override_ = false);
|
||||||
|
|
||||||
bool IsCasting();
|
bool IsCasting();
|
||||||
void IsCasting(bool val);
|
void IsCasting(bool val);
|
||||||
|
@ -301,7 +301,8 @@ enum GroupLootMethod {
|
|||||||
METHOD_FFA=1,
|
METHOD_FFA=1,
|
||||||
METHOD_LOTTO=2,
|
METHOD_LOTTO=2,
|
||||||
METHOD_NEED_BEFORE_GREED=3,
|
METHOD_NEED_BEFORE_GREED=3,
|
||||||
METHOD_ROUND_ROBIN=4
|
METHOD_ROUND_ROBIN=4,
|
||||||
|
METHOD_MAX_COUNT=5
|
||||||
};
|
};
|
||||||
|
|
||||||
enum AutoLootMode {
|
enum AutoLootMode {
|
||||||
|
@ -5224,6 +5224,7 @@ void ZoneServer::KillSpawn(bool spawnListLocked, Spawn* dead, Spawn* killer, boo
|
|||||||
killer_in_encounter = true;
|
killer_in_encounter = true;
|
||||||
|
|
||||||
if (spawn && spawn->IsPlayer()) {
|
if (spawn && spawn->IsPlayer()) {
|
||||||
|
((Player*)spawn)->RefreshRegen();
|
||||||
// Update players total kill count
|
// Update players total kill count
|
||||||
((Player*)spawn)->UpdatePlayerStatistic(STAT_PLAYER_TOTAL_NPC_KILLS, 1);
|
((Player*)spawn)->UpdatePlayerStatistic(STAT_PLAYER_TOTAL_NPC_KILLS, 1);
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user