Commit graph

52 commits

Author SHA1 Message Date
Mag-nus
9d70b48380
Improve logging overhead by fixing string interpolation (#4107)
* First batch

* Second batch

* another batch

* last batch hopefully

* fix
2024-03-13 02:38:39 +00:00
Ty Conner
ae71c93890
Generator System Revision 4 - Profile Delays (#3650)
* Switch from Slot delay to profile only delay

* Update GeneratorProfile.cs

* Update Chest.cs

* Update WorldObject_Generators.cs

* Update WorldObject_Generators.cs

* Update WorldObject_Generators.cs

* Update WorldObject_Generators.cs

* Update WorldObject_Generators.cs

* Update DeveloperCommands.cs

* Update GeneratorProfile.cs

* Update Chest.cs

* Update WorldObject_Generators.cs

* Update WorldObject_Generators.cs

* Update GeneratorProfile.cs

* Update WorldObject_Generators.cs

* Handle GeneratorType.Relative Rotation offsets

* Update GeneratorProfile.cs

* Adjust RemoveQueue and CurrentCreate

* Update WorldObject_Generators.cs

* more gen adjustments

* apply recommended changed

Co-Authored-By: gmriggs <8909245+gmriggs@users.noreply.github.com>

* Update GeneratorProfile.cs

Co-Authored-By: gmriggs <8909245+gmriggs@users.noreply.github.com>

* Update GeneratorProfile.cs

* Update GeneratorProfile.cs

* Update GeneratorProfile.cs

* Update WorldObject_Generators.cs

* Update GeneratorProfile.cs

* Update WorldObject_Generators.cs

* revamp 2-22-22

* Add GenStopSelectProfileConditions

* some cleanup / notes

* Update GeneratorProfile.cs

* Update WorldObject_Generators.cs

* Update DeveloperCommands.cs

* Update GeneratorProfile.cs

* Update Chest.cs

* Update WorldObject_Generators.cs

* Update GeneratorProfile.cs

* Update WorldObject_Generators.cs

* Update WorldObject_Generators.cs

* Update WorldObject_Tick.cs

* Update WorldObject_Generators.cs

* Update WorldObject_Generators.cs

* Update WorldObject_Generators.cs

* more cleanup

* Update DeveloperCommands.cs

* Update GeneratorProfile.cs

* Update WorldObject_Generators.cs

Co-authored-by: gmriggs <8909245+gmriggs@users.noreply.github.com>
2022-03-26 22:44:13 -04:00
Ty Conner
bdbbb31842
Apply Quest to NoCorpse object pickups (#3647) 2021-08-09 12:32:58 -04:00
gmriggs
5bcb530b37
fix various desyncs and inconsistencies which could possibly be resulting in leaks (#3602)
* fix various desyncs and inconsistencies which could possibly be resulting in leaks

* moving other landblock discard code to deeper in physics spawning to fix some oddities with faction / foetype mob 1-way tracking, and to improve scatter gen retries
2021-07-18 13:48:07 -04:00
Ty Conner
55296b0dc9
Update EventManager for logging and RealTime events (#3498)
* Update EventManager for logging and RealTime events

* Update EventManager.cs

* Update EventManager.cs

* Update EmoteManager.cs
2021-03-11 00:12:30 -05:00
Ty Conner
e34f6af644
Add in support for GeneratorAutomaticDestruction (#3430) 2021-01-22 13:34:05 -05:00
Ty Conner
9db4859859
Allow generators to process remove queue while disabled (#3307) 2020-10-16 03:22:14 -04:00
Ty Conner
029d34828d
Fix issue with event generators 0 RegenerationInterval spawning their init when turning on (#3127) 2020-08-18 12:30:30 -04:00
gmriggs
c954ec4ebb
fixing /removeinst for generator children after reload landblock (#3027) 2020-06-17 19:18:36 -04:00
Ty Conner
6ea7c19ea9
Revise Generator Init/Max spawn conditions (#2991)
* Revise Generator Init/Max spawn conditions

* Update WorldObject_Generators.cs

* Update WorldObject_Generators.cs

* Update AdminCommands.cs

* Update WorldObject.cs

* Update WorldObject_Generators.cs

* Update EmoteManager.cs

* Update WorldObject.cs

* Update GenericObject.cs

* Correct use of GeneratorDestructionType

* Update WorldObject_Generators.cs

* Update EmoteManager.cs

* Update Landblock.cs

* Update Landblock.cs

* Update Landblock.cs

* Update Landblock.cs

* Update Signal Emitting support to all WorldObjects

* Adjust [In/Dec]crement(My)Quest

* Update AdminCommands.cs

* Update DeveloperCommands.cs
2020-06-10 23:47:17 -04:00
Mag-nus
75fc1ce23c
Step 3. Convert ShardDatabase/WorldObjects biota from the ACE.Database model to the new ACE.Entity model (#2731)
* Step 1. Add new adapter classes and models

All classes and objects added are in new namespaces.

This add has 0 interraction on existing ACE code.

This sets the groundwork for Step 2. Moving World DB caching to the new models

* first part of the world entity usage

* almost there

* final part

* update WeenieExtensions

* fix

* merge fixes and improvements

* ACE.Database new code

* it compiles

* InitializePropertyDictionaries

* WOrldDatabaseWithEntityCache cleanup

* ShardDatabaseWithCaching

* ShardDatabase Cleanup

* todo

* cache counts reported in serverstatus

* House InitializePropertyDictionaries

* improve ServerStatus

* BiotaModel change HousePermissions to Dictionary<uint, bool>

* PropertiesAllegiance to dictionary

* BiotaUpdater improvements

* Shard Database Cache Reporting

* More code ported from Step 3

* Remove stub CharacterCache

* Update WorldDatabaseWithEntityCache.cs

* build fixes

* code audit

* Remove non-callback functions from SerializedShardDatabase

* BiotaUpdater progress.. only emote left

* Emotes done... now need to test

* fix

* Burden/Value fix for containers

* fat fingered EncumbranceVal

* add some safety

* Don't cache player biotas for initial PlayerManager load

* fix null spellbook

* Add another null check

This is redundant as the check is also upstream.

This is to prevent an exception in the future if this function is called from another source.
2020-04-02 22:40:27 -05:00
gmriggs
f647f87cd4
reduce unnecessary spam in debug logs (#2810) 2020-03-12 01:42:04 -04:00
gmriggs
9cc50df7fc
generator updates (#2735) 2020-02-23 15:40:32 -05:00
Ty Conner
8a15e0f22a
Fix issue with VerifyUse (#2599)
* Fix issue with VerifyUse

* Update GeneratorProfile.cs

* Update GeneratorProfile.cs

* Update GeneratorProfile.cs

* Update GeneratorProfile.cs

* Add Id to Profile for debugging
2020-01-14 23:47:15 -05:00
Ty Conner
fb3767e53a
Expand scope for generator wipe condition (#2495)
* Expand scope for generator wipe condition

* Update WorldObject_Generators.cs

* Update WorldObject_Generators.cs

* Update WorldObject_Generators.cs
2019-12-14 14:53:47 -06:00
Ty Conner
f5e03ebf9a
Update Killed by misadventure conditions (#2308) 2019-09-20 12:32:47 -05:00
Ty Conner
94cf318143
Add support for Day/Night Generators (#2243)
* Add support for Day/Night Generators

* Update Timers.cs

* Update WorldObject_Generators.cs
2019-08-18 00:59:01 -05:00
Ty Conner
422f6e1905
More Generator Adjustments (#2061)
* Adjust debug output

* Add overrideable properties for region encounter generators

* override_encounter_spawn_rates bool
  - encounter_regen_interval
  - encounter_delay

* Allow camp generators to despawn

When a full "camp" is wiped, destroy it so the parent generator can roll the slot again

* Update WorldObject_Generators.cs

* Update WorldObject_Generators.cs

Data Error protection for crazy profile values
2019-07-01 03:12:21 -05:00
Ty Conner
7ccbd105b1
Log and Abort from SelectProfilesInit after 1000 tries (#2045) 2019-06-25 22:58:04 -05:00
Ty Conner
f5dcc0354c
Generator system tweaks (#2038)
* Carry over Delay from profile template

* Update RemoveQueue info

* Adjust CurrentCreate to be calculated

This prevents out-of-sync issues currently seen in master

* Update changelog.md

* Update GeneratorProfile.cs
2019-06-23 18:54:33 -05:00
Ty Conner
4d804e5055
Generator system revamp (#1964)
* Add Landblock_Tick_GeneratorRegeneration

* Split up Generator Regeneration and Heartbeats

* Stop saving Gateway portals to Shard DB

* Add IsGateway to Portal

* Add default sound to Pressure Plates

* Notify Geneator of Pickup of Landblock Stackable

* Add RegenerationTimestamp and GeneratedTreasureItem properties

* Generators 3.0

* Add InitializeGenerator
* Remove IsLinked
* Change SelectProfilesInit to use GetMaxObjects
* Change SelectProfilesMax to use GetMaxObjects
* Update GetMaxObjects
  - -1 MaxCreate == Fill up all slots
* Renamed HandleStatus to HandleStatusStaged
* Restore previous HandleStatus
* Update StartGenerator
  - GeneratorInitialDelay > 0: offset NextGeneratorRegenerationTime
- else if InitCreate > 0: Regen
* Add GetNextRegenerationTime
  - If generator isn't previously loaded, skip delay
* Update DisableGenerator
  -  Add ProcessGeneratorDestructionDirective
  - Support GeneratorDestructionType and GeneratorEndDestructionType
* Update AddGeneratorLinks
  - Increate InitCreate and MaxCreate per profile template spec, per each link added
* Update Generator_HeartBeat
  - Starts/Stops Generator, checks event status
* Add Generator_Regeneration
  - Queues for Respawn and/or/both Spawns objects
* Add ResetGenerator
* Update GetSpawnTime to always return UtcNow
* Update Spawn
  - If TreasureGenerator is used, set GeneratedTreasureItem
  - If profile PaletteId and/or/both Shade have value, use it
* Wire up `@regen` command
* Add `@generatordump` command

* Change EmoteType.Generate to use Generator_Regeneration

* Update OnDeath to call OnGeneratorDeath for Generators

* Update OnActivate

* Move default action to last action to allow other actions to start before
* Change OnGenerate to use Generator_Regeneration

* Update Chests

* Remove ResetGenerator
* If Locked disable timed regen of contents
* Update Reset
* Override ResetGenerator

* cleanup

* Rename Generator to GeneratorProfile

* Rename Generator.cs to GeneratorProfile.cs

* Update GeneratorProfile.cs

* Update WorldObject_Generators.cs

* Skip PlaceHolder object profiles
* Change ProcessGeneratorDestructionDirective to not affect dead/dying creatures

* more cleanup

* Update WorldObject_Generators.cs

Bad data protection

* Update WorldObject_Generators.cs

* Update GeneratorProfile.cs

Catch for bad profile data

* Update WorldObject_Generators.cs

log error for generators with Max < Init

* Update Corpse Logs

* Attempt to curb generator sprawl

* Update WorldObject_Generators.cs

* Update GetRNGInitToMaxObjects

* Update WorldObject_Generators.cs

* Code fix for linkitemgen2minutes

Bad Init/Max for linkable

* Fix issue with spawning treasureDID profiles

* Add GeneratorUpdateTimestamp

* GeneratorHeartbeat renamed to GeneratorUpdate

This matches property found in enum

* Update debug output

* Update Landblock.cs

* Update WorldObject_Generators.cs

* Update DeveloperCommands.cs

* Update ResetInterval resetting

* Update SortedGeneratorRegenerationList when already spawned generator is re-enabled

* More changes

* Container updates

* More Debug Info Added

* Do not change default icon unless Shade or Palette was defined

* Wire up `trophies` command

* Add corpse_decay_tick_logging option

* Add NpcInteractsSilently handling for EmoteType.Give

* Update EmoteManager.cs

* Master change fixes

* Update DeveloperCommands.cs

* Update ServerPerformanceMonitor.cs

* Update DeveloperCommands.cs

* Update changelog.md
2019-06-21 03:16:05 -05:00
Mag-nus
b827de9e93
Guid.Full:X8 to Guid (#1996) 2019-06-13 05:36:58 -05:00
Mag-nus
0f57bb90b5
Fix RegenOnClose (#1917)
* Fix RegenOnClose

This fixes the issue were chests weren't calling their profiles generator.HeartBeat() because chest.ResetGenerator was false.

The fix is to process maintenance for generator profiles always, but only the spawn heartbeats conditionally.

This was tested using /crack and the pathwarden chest.

* Updated comment
2019-05-20 19:03:46 -05:00
Ty Conner
112b2ca6ff
Add OnGeneration Emote handling (#1881)
* Add OnGeneration emote handling

* Allow RegenerationInterval 0 generators to tick

* Revert 0 tick change
2019-05-12 22:48:40 -05:00
Mag-nus
fc0abbf69e
Generators shouldn't hold strong references to their spawn (#1871)
* Generators should hold weak references to their spawn

* Remove GeneratorRegistryNode
2019-05-10 05:31:36 -05:00
Ty Conner
1fc2fba866
Changes related to Event Generators (#1789)
* Drop loot to ground if NoCorpse is true for creatures

* Broadcast CasterEffect if spell has one

* Change Generators enable/disable to staged, change on 2nd heartbeat.
2019-04-23 22:51:44 -05:00
Mag-nus
6256c747de
Change a few log messages to Debug level (#1697) 2019-04-10 20:49:02 -05:00
Mag-nus
4dab146548
Code cleanup (#1681)
* Flags attribute

* empty statement

* Fix Formatting

* Fix OrderBy -> ThenBy

* use OfType

* Replace with asingle call to Count(...)

* Replace with a single call to FirstOrDefault

* Merge cast with type check

* use String.IsNullOrEmpty

* use collections count property

* use format specifier (results in shorter loc)

* use Any() instead of Count() > 0

* revert ThenBy with comment
2019-04-10 20:48:34 -05:00
Ty Conner
9ba7a982b8
Fix issue with GeneratorTimeType - RealTime and defaulting start or end times. (#1678) 2019-04-09 03:04:07 -05:00
Mag-nus
ab8c630cef
Change StopConditionsInit and StopConditionsMax to log.Warn (#1673)
Also added WCID and guid
2019-04-08 19:15:01 -05:00
gmriggs
57a95c03ee
Adding remaining augs (#1411)
* Adding heritage augs

* appveyor rebuild

* .

* Adding remaining augs

* Adding TwoHandedCombat

* Improved /getproperty and /setproperty

* common GetLastAppraisedObject

* GetLastAppraisedObject cleanup
2019-02-04 13:26:28 -05:00
Mag-nus
6560cea712
GeneratorHeartbeat() is now ticked independantly from Heartbeat() (#1377)
* GeneratorHeartbeat() is now ticked independantly from Heartbeat()

There is no longer a DefaultHeartbeatInterval.

Heartbeats only happen if a HeartbeatInterval exists and is greater than 0.
Heartbeats are still staggered over heartbeatSpreadInterval (5s).

Generators will GeneratorHeartBeat() on the next tick after object construction.

However, if RegenerationInterval is 0, they will not beat again.

* woops
2019-01-26 15:02:22 -06:00
gmriggs
353579eadf Improved chest generators (#1322)
* Improved chest generators

* v2

* .

* Handling regeneration for treasure sets

* Cleanup / comments

* updating comment

* Adjusting /create InFrontOf height

* fine-tuning reset intervals

* .

* unblocking vendor LoadInventory

* backporting dual wield patch

* Fixing lock/key case sensitivity

* Fixing chest closing bug

* Adding wielded treasure tables for generators

* .
2019-01-20 21:02:34 -08:00
Mag-nus
930ae1d963
More profiling tweaks (#1242)
* move the IsGenerator check to the base WorldObject HeartBeat

* Move EmoteManager.HeartBeat from WorldObject to Creature

* Change WO HeartBeatInterval check to a NextHeartBeatTime

Suggestion from gmriggs

* check if HasEnchantments before EnchantmentManager.HeartBeat()

This still encounters a lock but still, the overall performance is very good here.

For extreme performance we could expose a non-thread safe HasEnchantmentsForTick function that checks the colleciton size without using a lock.

* switch Monster_Tick to use currentUnixTime instead of DateTime.UtcNow

* Only instantiate actionQueue when it's actually used

This reduces the overhead of calling actionQueue.RunActions() that queries a ConcurrentQueue for it's count.

* Expand /serverstatus report

* Fix ObjCell.FindObjCollisions InvalidOperationException

* use faster Queue.IsEmpty check in ActionQueue.RunActions

* Only set RegenerationInterval if > 0 (per gmriggs)

* Monster_Tick changes (per gmriggs)

* fix QueueFirstHeartbeat

* Add some UpdateGameWorld RateMonitors to /serverstatus

* Remove nullable from NextHeartBeatTime (was not needed)

Comparing a nullable to a non-nullable takes almost 2x as long as a non-nullable to a non-nullable.

* AgressiveInlining suggestions for the compiler
2019-01-13 12:20:42 -06:00
fartwhif
fe34acc14f Moving class ACE.Server.Physics.Common.Random to ACE.ThreadSafeRandom in project ACE.Common (#1167)
* Moving ACE.Server.Physics.Common.Random to ACE.ThreadSafeRandom
replaced the thread discriminator with a lock
renamed "Random" to "ThreadSafeRandom"
renamed "RollDice" functions to the standard "Next"

* deleted Source/ACE.Server/Physics/Common/Random.cs
replaced conditionally omitted and commented code with new name

* renamed source file
2018-12-21 23:51:57 -05:00
Ty Conner
ca6c8d1fc3
Fixes for Anniversary Event emotes (#1086)
* Fixes for Anniversary Event emotes

* Add Pre+Permaload of Global Event Landblock

* Making requested changes

* Add correct check for GlobalEventLandblockPreloading

* Further requested changes. New config setup for Preloaded and Permaloaded Landblocks

* Minor cleanup

* Add a hardcoded fallback incase config file not updated

* Update example to fix syntax error

* Minor tweak to example and console output
2018-11-01 20:10:54 -04:00
gmriggs
a17d665954 Adding more quest emotes, refactoring EmoteManager (#1065)
* Adding more quest emotes, refactoring EmoteManager

* Adjusting UseRadius
2018-10-15 13:06:55 -04:00
gmriggs
253a6aea5e Some bug fixes (#1064) - Resolves #1061, #1062 & #1063 2018-10-15 03:50:18 -04:00
gmriggs
ecf829d08b Refactored generators, improved RNG selection formula (#1041)
* Refactored generators, improved RNG selection formula

* Removing calls to PerfTimer

* .

* Fixing AL/RL display in character info panel

* Fixing issue with MaxCreate

* Adding check for GeneratorDisabled status, cleaning up EventManager

* Removing int cast for latest version of DB
2018-10-03 15:01:59 -04:00
gmriggs
807c616632
Preventing RegenLocationType.Specific from spawning in another landblock (#1040) 2018-10-01 21:39:33 -04:00
Mag-nus
b5df7bb060
Usage of DateTime/PhysicsTimer cleaned up across the board (#1016)
* Remove duplicate Timer from Physics.Common

* Clean up ACE.Common.Time and its usages

* WorldObject: Fix CreationTimestamp

* Remove PhysicsTimer which was just a class wrapping a double

* WorldManager.UpdateWorld Stopwatch Usage change

Before we were calculating the elapsed seconds manually with this:
(double)worldTickTimer.ElapsedTicks / Stopwatch.Frequency

The stopwatch can already do this for us via this:
worldTickTimer.Elapsed.TotalSeconds

* WorldManager UpdateWorld Summary improvement

* DateTime based tick removed from Tick() arguments

* No need to pass DateTime.UtcNow.Ticks to Session.Tick

* LastMovementBroadcastTicks was obsolete

Probably souldn't be referencing WorldManager.PortalYearTicks as well.

If we need this in the future, it's probably better to reference DateTime.UtcNow or Time.GetUnixTime()

* Fix WorldObject.Tick() overhead

* Revert "WorldObject: Fix CreationTimestamp"

This reverts commit 457bebc48e.

* PhysicsTimer stuff

Move the Timer back to the Physics namespace and rename it PhysicsTimer

Change some references from PhysicsTimer to DateTime.UtcNow

* timeBeginPeriod and timeEndPeriod added for Windows to improve timer resolution

* ServerManager Shutdown was using 100% cpu

* Fix the usage of CreationTimestamp

* CharacterHandler should not be setting default values. Player ctor should.

* EmoteManager switched from PhysicsTimer to DateTime.UtcNow

* Use PropertyInt and not PropertyFloat for LoginTimestamp

* Fix Session GetAll() to also include sessions that are at the character selections creen
2018-09-15 15:26:10 -05:00
gmriggs
f1360a1e14 Adding the ability for players to buy houses (#1003)
* Adding the ability for players to buy houses

* Updating Property IDs

* Fixing links

* Updating purchase time to match AC data, calculating rent time dynamically

* Processing nested links recursively
2018-09-09 09:11:25 -07:00
gmriggs
6a25a0bb19
Adding weapon speed mod (#1001)
* Fixing HandleActionForceObjDescSend error message

* Adding weapon speed mod

* .

* Updating attack animation speed to be accurate to retail.

Huge thanks to Sluashnas for figuring this out!

* Adding missing =

Thanks again to Slushnas!

* Removing previous code
2018-09-06 11:26:06 -04:00
Mag-nus
12c9eea68a
Shard Biota Save & Threading Model Rework (#960)
* SaveBiota major changes

SaveBiota now only updates values in the database that have changed instead of updating every single value.

In addition. SaveBiota detects added and removed linked entities.

* Replace AddBiota(s) with SaveBiota(s)

* This improves the way a few places referenced the biota

* SaveBiota switched to a diff method. Still some work to do

* More notes + fixes

* SaveBiota move GetBiota to before EnterWriteLock

* Added a note about the lock performance

* More summary improvements for BiotaDatabaseLock

* Thread safety added to the SaveBiotas and AddBiotas functions

SavePlayer also switched to use the SaveBiotas bulk action instead of saving each biota individually.

* Biota.Clone() added

* BiotaExtensions cosmetic only

* DbUpdateException fixed

If there were multiple new records in a collection, the first one was attached but with the last new records values.

This would end up resulting in property records with duplicate types id's.

* ReoveBiota check if biota actually exists in db before removal.

* /databasequeueinfo added

* New From-Weenie Containers should not be searching the shard for inventory

* DeveloperDatabaseCommands removed RequiresWorld flag

* Improved DatabasePerfTest results.
2018-08-20 18:30:38 -05:00
gmriggs
1db49dbd09
Refactor generators a bit, fixing some bugs with spawning/respawning items (#951) 2018-08-13 18:07:21 -04:00
gmriggs
1b504ff5f0 Adding landblock unloading system, and player corpses (#831)
* Adding landblock unloading system, and player corpses

* Adding dropped items to player corpse

* Adding landblock unloading system, and player corpses

* Adding dropped items to player corpse

* Adding permaload flag, and updating TimeToRot on landblock unload

* Adding corpse looting permissions

* Adding stack sizes

* Cleanup
2018-06-29 12:35:57 -07:00
gmriggs
a0bf5018d6
Adding projectile physics (#816)
* Projectile physics collisions

* Removing some debug messages, restoring monster RunSpeed

* Copying ACE physics state to PhysicsObj

* Fixing encounter cell IDs

* Re-implementing Player_Tracking the previous way again, to fix Dungeon monsters de-spawning

Note that outdoor landblocks still suffer from oversending, and client possibly crashes due to this

* Fixing indoor arrows, hotspot collisions

* Physics adjustments

* Removing debug messages

* Projectile physics collisions

* Removing some debug messages, restoring monster RunSpeed

* Copying ACE physics state to PhysicsObj

* Fixing encounter cell IDs

* Re-implementing Player_Tracking the previous way again, to fix Dungeon monsters de-spawning

Note that outdoor landblocks still suffer from oversending, and client possibly crashes due to this

* Fixing indoor arrows, hotspot collisions

* Physics adjustments

* Removing debug messages

* Updating SphereTest

* Merging missile combat fixes/additions

* Removing duplicate message from changelog

* Updating changelog

* Merging Hotspot PR
2018-06-08 04:08:53 -04:00
Ty Conner
1f3aff74af Add checks for contained vs remote objects in RecipeManager 2018-04-30 00:09:27 -04:00
Ty Conner
5bddbc4351
Changes to Links and Generators, misc other changes (#755)
* Changes to Links and Generators, misc other changes

* Debug cleanup

* Code Dedup
2018-04-23 13:28:27 -04:00
Ty Conner
43a141a661
Encounters (#741)
* Update WorldDB scaffolding

* Add GetCachedEncountersByLandblock

* Update SQL scripts

* Add Encounters to Landblock ctor

* Add Scatter to Generator spawns
2018-04-15 01:00:34 -04:00