Skip to content

Commit

Permalink
World damage/healing, destructible buildings, multiplier rewrite, log…
Browse files Browse the repository at this point in the history
…ging improvements (#157)

* Only skip critters that are flavor-only (<= level 5)

* Refactor to break out some logic into separate functions.

* Refactor more repeated operations into separate functions
- Add worldHealthMultiplier, intended to be used to scale the health of attackable game objects in the instance

* Continued refinement of non-creature-based damage and healing

* Rework damage handling, improve coverage, debug logging
- tear out and re-implement all the damage handling to ensure more cases are handled
- use the map's damage modifier when damage happens where the source isn't a creature
- better handle when the source of damage no longer exists (logged out or despawned)
- extensive (optional) logging under the `module.AutoBalance.Damage` logging prefix
- WIP implementattion of game object damage handling (destructible buildings)
- fix a long-standing error in the class name for some logging

* World damage scaling is working, WIP
- need to apply statmodifiers still
- improved logging

* - many, many logging improvements
- fix a bug with the enable check case statements (stupid case breaks)
- remove antiquated battleground checks - should never scale in battlegrounds
- better handle "special" creatures (totems, triggers, critters)
- allow combat critters to scale correctly
- allow intentionally-low-level triggers and critters to remain low level
- workaround an issue with summons showing the wrong level client-side (level change ramp up)
- further improve GM and user commands
- erase map AB info from maps when they are created, preventing issues with instance ID re-use
- better handle instances with no non-GM characters (disable scaling temporarily)

* Further work on summoned creatures, still WIP
- removed unnecessary `std::string`s

* WIP

* Rewrite multiplier calculation, reduce required processing
- majory re-wrote the multiplicer calculations to increase accuracy and clarity
- take advantage of new `OnBeforeCreatureSelectLevel` hook to set the initial level of creatures before they are added to the world
- separated level-scaled and non-level-scaled multipliers for tracking and display
- move creature relevancy check to new function `isCreatureRelevant`
- rename many variables to standardize and clarify
- add option to force a map stats update, to be used when a player enters the map
- players leaving the map are no longer included in the map's stats
- sweeping improvements in logging of the multiplier calculation process (`AutoBalance.StatGeneration`)
- update `.ab creaturestat` to show new scaled modifiers in an understandable way

* Optimize map updates to only occur when necessary. WIP.

* Create documentation for Info classes, add player lists

* Reworking config tracking, WIP

* Rewrite player tracking to remove kludges, many improvements
- replace kludgy player count detection with an internal player list (more features coming Soon)
- skip scaling on player-owned summons, totems, etc
- skip scaling on flavor critters but not on combat critters
- separate map and global config times, reducing the work to refresh if only a map config changes
- centralize detection of "non-relevant" creatures, use a `skipMe` tag to speed up processing
- correctly handle a GM leaving the instance who was previously a non-GM when they entered
- temporarily disable in-combat checking
- improve logging format to produce the ID needed for `.go creature <UUID>`
- standardize logging format

* Performance improvements, fix statmodifier selection, logging
- moved enums to top the file, added `Relevance` enum
- improve performance of `isCreatureRelevant` but saving the decision from previous runs
- fix issues with summon detection to (hopefully) cover all edge cases
- consolidate and fix StatModifier case selection, add debugs
- more logging improvements all around

* Recount players on a config reload.

* Improve player enter/leave behavior.

* Improve handling of empty instances, properly scale trigger creatures, improve `.ab mapstat`

* Check that the target for `.ab creaturestat` is in a dungeon.

* Move boss detection to separate function
- boss summons now also count as a "boss"

* Do not modify spells that hurt the player but are intended to - Dark Runes, etc
- logging improvements

* Fix world multipliers not getting reloaded. Logging improvements.

* Additional debug for boss detection

* Fix percent-based damage auras, map multipliers honor level scaling
- percent-based damage auras will now ignore level scaling (per-player scaling only)
- map multipliers (damage/healing and health) will now honor the level scaling setting
- use a custom struct to store and move around world multipliers
- properly remove LevelScalingEndGameBoost until it can be fixed (#156)
- creatures summoned by a boss will now be scaled like bosses
- further refinement of trigger handling logic
- fix active creature not being decremented on creature removal
- fix incorrect announcing of GMs entering/exiting the instance
- improvements for in-game commands
- continued log improvements

* World multipliers now honor stat modifiers
- logging improvements

* Re-enable the processing of map stats when the instance is empty

* Combat locking: WIP

* Combat locking - better implementation. WIP, needs notifications.

* Re-implement combat locking

* Complete migration from skipMe to isCreatureRelevant

* Code and log cleanup

* Handle a combatLockMinPlayers of 0

* Update bug report template to request AB-specific information

* Update README.md with commands, loggers, and min AC version

* Add logging settings to .conf.dist file. Small logging change.

* Replace uint with uint8.

* Rename `GetCurrentTime()` and remove case ranges to make Windows happy

* Code cleanup. Replace case statements. Remove `entry`, which is unneeded.

* (Hopefully) final code cleanup, comment refinement

* Fix enemy totems not level scaling. Update logging statement.

* Resolve issue with heroic dungeons that don't have LFG levels defined

* Fix dungeon difficulty normal, add error logging if no LFG found

* Fix incorrect heroic settings.
- fix display issue with active creatures

* Fix syntax error.
- that'll teach me to commit before I build

* Handle cloned summons, improve creaturestat command
- track summoner as a part of AutoBalanceCreatureInfo
- detect when a summon is a clone and use the correct current health instead of scaling again
- add summon information to `.ab creaturestat`
- as always, logging improvements

* Handle shared damage auras, add never modify spells
- spells with SPELL_AURA_SHARE_DAMAGE_PCT effects will now correctly be unmodified
- added `spellIdsToNeverModify` and correctly skip modification of them
- add "Twin Empathy" (1177) to the `spellIdsToNeverModify` list
- convert `_IsAuraPercentDamage` to `_isAuraWithEffectType` since this probably isn't the last I'll need it
- logging changes, naturally

* Move initial scaling from first OnAllCreatureUpdate to Creature_SelectLevel

* Tell user to move logging settings to `worldserver.conf`, since they don't work well in module config

* Fix combat locking.

* Small update to spellIdsToNeverModify

* Move warning to debug.
  • Loading branch information
kjack9 committed Oct 19, 2023
1 parent 9100569 commit 50a5d5e
Show file tree
Hide file tree
Showing 4 changed files with 4,827 additions and 1,454 deletions.
10 changes: 10 additions & 0 deletions .github/ISSUE_TEMPLATE/bug_report.yml
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,16 @@ body:
None
validations:
required: false
- type: textarea
id: abcommands
attributes:
label: AutoBalance Debug Commands
description: |
Please include text or an image of the `.ab mapstat` command. If your issue is concerning scaling of creatures, please also include the `.ab creaturestat` command while targeting the problematic creature.
placeholder: |
None
validations:
required: false
- type: textarea
id: commit
attributes:
Expand Down
25 changes: 24 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,11 +1,34 @@
# ![logo](https://raw.githubusercontent.com/azerothcore/azerothcore.github.io/master/images/logo-github.png) AzerothCore
## AutoBalanceModule

## AutoBalance

- Latest build status with azerothcore: [![Build Status](https://github.com/azerothcore/mod-autobalance/workflows/core-build/badge.svg?branch=master&event=push)](https://github.com/azerothcore/mod-autobalance)

This module is intended to scale based on number of players, instance mobs and bosses' health, mana, and damage.

**NOTE:** This module requires at least [this commit](https://github.com/azerothcore/azerothcore-wotlk/commit/f127e583aae3cfa51a77d056c1892a7de07ffb52) of AzerothCore in order to work correctly. Older versions are not supported.

All settings are well-described in the configuration file.

**PLEASE** include the output from the `.ab mapstat` and `.ab creaturestat` commands (while targeting a problematic creature) when reporting issues. This will help us to quickly identify the problem and provide a solution.

## In-game Commands
| Command | Permission | Description |
| :------ | :--------- | :---------- |
| `.ab mapstat` | All Players | Displays AB-calcualted settings for the current map, including player count, difficulty, world modifiers, and others. |
| `.ab creaturestat` | All Players | Displays AB-calculated settings for the targeted dungeon creature including level scaling, difficulty, modifiers, and boss status. |
| `.ab setoffset` | Game Masters | Sets the server-wide player difficulty offset. Instances will be scaled as though they had this many more/less players than they really do. |
| `.ab getoffset` | All Players | Gets the current server-wide player difficulty offset. Instances will be scaled as though they had this many more/less players than they really do. |
| `.reload config` | Game Masters | Reloads all your configuration files, including `AutoBalance.conf`. This lets you update AutoBalance settings without restarting your worldserver. This module is designed to contiue to work as expected when this command is issued. |

## Logger Names
| Logger | Description |
| :----- | ----------- |
| `Logger.module.AutoBalance` | Main logger, verbose debug logs. Map detection, list management, creature adjustments, multiplier, modifiers. Catch-all. |
| `Logger.module.AutoBalance_CombatLocking` | Debug logs related to the combat locking/unlocking mechanism for maps. |
| `Logger.module.AutoBalance_DamageHealingCC` | Debug logs for the spell/melee/CC modifications that are made in real-time. |
| `Logger.module.AutoBalance_StatGeneration` | Detailed debug logs that show all the calculation steps in how different multipliers are derived. |

## References
- [Interactive Inflection Point Spreadsheet](https://docs.google.com/spreadsheets/d/100cmKIJIjCZ-ncWd0K9ykO8KUgwFTcwg4h2nfE_UeCc/copy)
- [InflectionPoint Curve Examples](https://i.imgur.com/x42UnUR.png)
Expand Down
27 changes: 25 additions & 2 deletions conf/AutoBalance.conf.dist
Original file line number Diff line number Diff line change
@@ -1,4 +1,18 @@
[worldserver]
##########################
#
# Logging
#
# Add these lines to your worldserver.conf file to enable logging for AutoBalance.
#
# 4 = Info (Default), 5 = Debug
#
##########################
# Logger.module.AutoBalance=4,Console Server
# Logger.module.AutoBalance_CombatLocking=4,Console Server
# Logger.module.AutoBalance_DamageHealingCC=4,Console Server
# Logger.module.AutoBalance_StatGeneration=4,Console Server

##########################
#
# Enable / Disable Settings
Expand Down Expand Up @@ -300,6 +314,8 @@ AutoBalance.playerCountDifficultyOffset=0
# Health | Mana | Armor | Damage
# Adjusts the StatModifier for the appropriate stat. Affected by the Global StatModifier above.
#
# NOTE: "Damage" affects both creature damage and world damage.
#
# Default: 1.0
#
# Boss.Global | Boss.Health | Boss.Mana | Boss.Armor | Boss.Damage
Expand Down Expand Up @@ -807,12 +823,19 @@ AutoBalance.LevelScaling.DynamicLevel.DistanceCheck.PerInstance="189 500"

#
# AutoBalance.LevelScaling.LevelEndGameBoost
#
# NOTICE: This setting is currently not implemented pending a rewrite.
# Enabling it here has NO effect.
#
# See: https://github.com/azerothcore/mod-autobalance/issues/156
#
# Old description:
# End game creatures have an exponential (not linear) regression
# that is not correctly handled by db values. Keep this enabled
# to have stats as near possible to the official ones.
#
# Default: 1 (1 = ON, 0 = OFF)
AutoBalance.LevelScaling.EndGameBoost = 1
# Default: 0 (1 = ON, 0 = OFF)
AutoBalance.LevelScaling.EndGameBoost = 0 # setting to 1 does not do anything

##########################
#
Expand Down
Loading

0 comments on commit 50a5d5e

Please sign in to comment.