ace/Source/ACE.Database/SerializedShardDatabase.cs

258 lines
8.5 KiB
C#
Raw Permalink Normal View History

using System;
using System.Collections.Generic;
using System.Collections.Concurrent;
using System.Threading;
using System.Threading.Tasks;
using log4net;
using ACE.Database.Entity;
using ACE.Database.Models.Shard;
using ACE.Entity.Enum;
namespace ACE.Database
{
public class SerializedShardDatabase
{
private static readonly ILog log = LogManager.GetLogger(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType);
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
/// <summary>
/// This is the base database that SerializedShardDatabase is a wrapper for.
/// </summary>
public readonly ShardDatabase BaseDatabase;
private readonly BlockingCollection<Task> _queue = new BlockingCollection<Task>();
private Thread _workerThread;
internal SerializedShardDatabase(ShardDatabase shardDatabase)
{
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
BaseDatabase = shardDatabase;
}
public void Start()
{
_workerThread = new Thread(DoWork);
_workerThread.Name = "Serialized Shard Database";
_workerThread.Start();
}
public void Stop()
{
_queue.CompleteAdding();
_workerThread.Join();
}
private void DoWork()
{
while (!_queue.IsCompleted)
{
try
{
Task t = _queue.Take();
try
{
t.Start();
t.Wait();
}
catch (Exception ex)
{
log.Error($"[DATABASE] DoWork task failed with exception: {ex}");
// perhaps add failure callbacks?
// swallow for now. can't block other db work because 1 fails.
}
}
catch (ObjectDisposedException)
{
// the _queue has been disposed, we're good
Landblock item saving + Much more (#1071) * Landblock EnqueueBroadcast cleanup Avoid double cast by using OfType Change excludeList from IEnumerable to ICollection because it was being enumerated more than once. * SerializedShard handle OperationCancledException * SerializedShard break on the exceptions * Landblock save progress * Landblock merge fix * Decayable -> Dynamic * Improved ShutdownServer to include landblock unload and db queue wait * Sleep during shutdown instead of using up all the CPU * Shard GetDynamic was comparing against the wrong id... woops * Fix shard biota caching * Improve shutdown logging and actions * cosmetic code order * Fix crash when trying to add a bad wo to a landblock * This fixes reloading dynamic objects * Don't save item on pickup * Don't save item on pickup from chest * Don't save items on drop * Set Home Position only for creatures (Used for navigation) * Improve the landblock SaveDB code * Don't save player corpse on death. Landblock will do that for us in bulk. * Add the housing objects to statics that persist to the shard * WorldObjectFactory dont overwrite location if object came from database * Improved IsStaticThatShouldPersistToShard * This should fix player dropped missiles * Move PositionType into ACE.Entity.Enum.Properties * Ephemeral support for Positions * Decay code/saving works much better * Filter out contained and wielded items from shard GetDynamicsByLandblock * TimeToRot provision for -1 (No rot) * Corpse decay is now controlled by landblock and uses the same decay code * ShardDatabase: Fix add/remove biota bug * WorldObject.Destroy now destroys contained and equipped items as well * TryRemoveFromInventoryWithNetworking no longer removes the object from the db * Player corpse items now remain when the corpse decays * Cleaned up SetPropertiesForWorld
2018-10-23 15:52:09 -05:00
break;
}
catch (InvalidOperationException)
{
// _queue is empty and CompleteForAdding has been called -- we're done here
Landblock item saving + Much more (#1071) * Landblock EnqueueBroadcast cleanup Avoid double cast by using OfType Change excludeList from IEnumerable to ICollection because it was being enumerated more than once. * SerializedShard handle OperationCancledException * SerializedShard break on the exceptions * Landblock save progress * Landblock merge fix * Decayable -> Dynamic * Improved ShutdownServer to include landblock unload and db queue wait * Sleep during shutdown instead of using up all the CPU * Shard GetDynamic was comparing against the wrong id... woops * Fix shard biota caching * Improve shutdown logging and actions * cosmetic code order * Fix crash when trying to add a bad wo to a landblock * This fixes reloading dynamic objects * Don't save item on pickup * Don't save item on pickup from chest * Don't save items on drop * Set Home Position only for creatures (Used for navigation) * Improve the landblock SaveDB code * Don't save player corpse on death. Landblock will do that for us in bulk. * Add the housing objects to statics that persist to the shard * WorldObjectFactory dont overwrite location if object came from database * Improved IsStaticThatShouldPersistToShard * This should fix player dropped missiles * Move PositionType into ACE.Entity.Enum.Properties * Ephemeral support for Positions * Decay code/saving works much better * Filter out contained and wielded items from shard GetDynamicsByLandblock * TimeToRot provision for -1 (No rot) * Corpse decay is now controlled by landblock and uses the same decay code * ShardDatabase: Fix add/remove biota bug * WorldObject.Destroy now destroys contained and equipped items as well * TryRemoveFromInventoryWithNetworking no longer removes the object from the db * Player corpse items now remain when the corpse decays * Cleaned up SetPropertiesForWorld
2018-10-23 15:52:09 -05:00
break;
}
}
}
public int QueueCount => _queue.Count;
public void GetCurrentQueueWaitTime(Action<TimeSpan> callback)
{
var initialCallTime = DateTime.UtcNow;
_queue.Add(new Task(() =>
{
callback?.Invoke(DateTime.UtcNow - initialCallTime);
}));
}
/// <summary>
/// Will return uint.MaxValue if no records were found within the range provided.
/// </summary>
public void GetMaxGuidFoundInRange(uint min, uint max, Action<uint> callback)
{
_queue.Add(new Task(() =>
{
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
var result = BaseDatabase.GetMaxGuidFoundInRange(min, max);
callback?.Invoke(result);
}));
}
/// <summary>
/// This will return available id's, in the form of sequence gaps starting from min.<para />
/// If a gap is just 1 value wide, then both start and end will be the same number.
/// </summary>
public void GetSequenceGaps(uint min, uint limitAvailableIDsReturned, Action<List<(uint start, uint end)>> callback)
{
_queue.Add(new Task(() =>
{
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
var result = BaseDatabase.GetSequenceGaps(min, limitAvailableIDsReturned);
callback?.Invoke(result);
}));
}
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
public void SaveBiota(ACE.Entity.Models.Biota biota, ReaderWriterLockSlim rwLock, Action<bool> callback)
{
_queue.Add(new Task(() =>
{
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
var result = BaseDatabase.SaveBiota(biota, rwLock);
callback?.Invoke(result);
}));
}
public void SaveBiotasInParallel(IEnumerable<(ACE.Entity.Models.Biota biota, ReaderWriterLockSlim rwLock)> biotas, Action<bool> callback, bool doNotAddToCache = false)
{
_queue.Add(new Task(() =>
{
var result = BaseDatabase.SaveBiotasInParallel(biotas, doNotAddToCache);
callback?.Invoke(result);
}));
}
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
public void RemoveBiota(uint id, Action<bool> callback)
{
_queue.Add(new Task(() =>
{
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
var result = BaseDatabase.RemoveBiota(id);
callback?.Invoke(result);
}));
}
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
public void RemoveBiota(uint id, Action<bool> callback, Action<TimeSpan, TimeSpan> performanceResults)
{
var initialCallTime = DateTime.UtcNow;
_queue.Add(new Task(() =>
{
var taskStartTime = DateTime.UtcNow;
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
var result = BaseDatabase.RemoveBiota(id);
var taskCompletedTime = DateTime.UtcNow;
callback?.Invoke(result);
performanceResults?.Invoke(taskStartTime - initialCallTime, taskCompletedTime - taskStartTime);
}));
}
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
public void RemoveBiotasInParallel(IEnumerable<uint> ids, Action<bool> callback, Action<TimeSpan, TimeSpan> performanceResults)
{
var initialCallTime = DateTime.UtcNow;
_queue.Add(new Task(() =>
{
var taskStartTime = DateTime.UtcNow;
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
var result = BaseDatabase.RemoveBiotasInParallel(ids);
var taskCompletedTime = DateTime.UtcNow;
callback?.Invoke(result);
performanceResults?.Invoke(taskStartTime - initialCallTime, taskCompletedTime - taskStartTime);
}));
}
PlayerManager (#1103) * PlayerManager initial checkin * OfflinePlayer initial checkin * More progress * Comment out Console.WriteLine debug messages * Add property dictionaries to OfflinePlayer * IPlayer initial checkin * Add allegiance vars to IPlayer * Couple comments * More progress * Add more to IPlayer * line endings fix * More progress. Compiles. Friends list works again. * Friend status updates now work (again) * PlayerManager save OfflinePlayers every 1hr * Bye bye legacy AllPlayers * using cleanup * Allegience switch to PlayerManager progress * More Allegiance progress * More progress * More allegiance progress * IPlayer adds * Migrate inversefriends to PlayerManager * Switch WorldManager GetPlayerByGuid over to PlayerManager * WorldManager Find(ObjectGuid characterGuid) removed. Use PlayerManager instead * WorldManager FindByPlayerName(string name) removed. Use PlayerManager instead * PlayerManager thread safety switched to ReaderWriterLockSlim * More progress * ServerStatus added TotalAccountsCreated, TotalCharactersCreated * No more Player access/management stuff in WorldManager. It's all in PlayerManager now * Player.IsOnline is no more. * Friends AppearOnline fix * Handle dead session better to switch player from online to offline * Remove adding the + to names in ChatChannels. Name property should be changed to not include + * serverstatus total accounts and characters on same line * Allegience initial fix, still more bugs though * PlayerManager minor cleanup uint should be faster key than ObjectGuid Changed the dictionaries to private. We don't want anyone outside of this class referencing them. * Thread safety added to LScape.get_landcell
2018-12-02 13:41:16 -06:00
public void GetPossessedBiotasInParallel(uint id, Action<PossessedBiotas> callback)
{
_queue.Add(new Task(() =>
{
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
var c = BaseDatabase.GetPossessedBiotasInParallel(id);
Migrate Character tables over to similar caching/threading model as Biota (#979) * First batch of Character refactor Characters are now cached with their dbContext, exactly like we do for Biotas. This greatly simplifies the way characters are pulled and saved, and is much more efficient. Deleting and restoring characters have been migrated to the new SaveCharacter function. There is no need for separate functions to handle those specific tasks. IsPlussed column added to Character. This removes the need to query the biota to see if we should display the + in front of the name at the character screen. Character.LastLoginTimestamp, TotalLogins, CharacterOptions1, and CharacterOptions2 are now used. These property types were removed from the ACE.Entity.enum. (the 9000+ types) Fixed a few places where ChangesDetected was being set insetad of CharacterChangesDetected. There is still more work to do to improve this pattern. * Player_Client renamed to Player_Character Plus some cleanup on the way CharacterOptions were get * Remove duplicate appearance DID properties from WorldObject_Properties * Removed the duplicate HairTexture DID properties * Migrate HairTexture from biota property to Character property * Forgot a CharacterChangesDetected * Migrate Character specific functions to Player_Character * Some more Biota wrappers added to BiotaExtensions * CharacterPropertiesShortcutBar wrapped * CharacterPropertiesSpellBar migrated to CharacterExtensions * CharacterPropertiesTitleBook migrated to CharacterExtensions * CharacterPropertiesFriendList migrated to CharacterExtensions * drop AccountId from CharacterPropertiesFriendList
2018-08-30 07:11:25 -05:00
callback?.Invoke(c);
}));
}
public void GetInventoryInParallel(uint parentId, bool includedNestedItems, Action<List<Biota>> callback)
{
_queue.Add(new Task(() =>
{
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
var c = BaseDatabase.GetInventoryInParallel(parentId, includedNestedItems);
Migrate Character tables over to similar caching/threading model as Biota (#979) * First batch of Character refactor Characters are now cached with their dbContext, exactly like we do for Biotas. This greatly simplifies the way characters are pulled and saved, and is much more efficient. Deleting and restoring characters have been migrated to the new SaveCharacter function. There is no need for separate functions to handle those specific tasks. IsPlussed column added to Character. This removes the need to query the biota to see if we should display the + in front of the name at the character screen. Character.LastLoginTimestamp, TotalLogins, CharacterOptions1, and CharacterOptions2 are now used. These property types were removed from the ACE.Entity.enum. (the 9000+ types) Fixed a few places where ChangesDetected was being set insetad of CharacterChangesDetected. There is still more work to do to improve this pattern. * Player_Client renamed to Player_Character Plus some cleanup on the way CharacterOptions were get * Remove duplicate appearance DID properties from WorldObject_Properties * Removed the duplicate HairTexture DID properties * Migrate HairTexture from biota property to Character property * Forgot a CharacterChangesDetected * Migrate Character specific functions to Player_Character * Some more Biota wrappers added to BiotaExtensions * CharacterPropertiesShortcutBar wrapped * CharacterPropertiesSpellBar migrated to CharacterExtensions * CharacterPropertiesTitleBook migrated to CharacterExtensions * CharacterPropertiesFriendList migrated to CharacterExtensions * drop AccountId from CharacterPropertiesFriendList
2018-08-30 07:11:25 -05:00
callback?.Invoke(c);
}));
Migrate Character tables over to similar caching/threading model as Biota (#979) * First batch of Character refactor Characters are now cached with their dbContext, exactly like we do for Biotas. This greatly simplifies the way characters are pulled and saved, and is much more efficient. Deleting and restoring characters have been migrated to the new SaveCharacter function. There is no need for separate functions to handle those specific tasks. IsPlussed column added to Character. This removes the need to query the biota to see if we should display the + in front of the name at the character screen. Character.LastLoginTimestamp, TotalLogins, CharacterOptions1, and CharacterOptions2 are now used. These property types were removed from the ACE.Entity.enum. (the 9000+ types) Fixed a few places where ChangesDetected was being set insetad of CharacterChangesDetected. There is still more work to do to improve this pattern. * Player_Client renamed to Player_Character Plus some cleanup on the way CharacterOptions were get * Remove duplicate appearance DID properties from WorldObject_Properties * Removed the duplicate HairTexture DID properties * Migrate HairTexture from biota property to Character property * Forgot a CharacterChangesDetected * Migrate Character specific functions to Player_Character * Some more Biota wrappers added to BiotaExtensions * CharacterPropertiesShortcutBar wrapped * CharacterPropertiesSpellBar migrated to CharacterExtensions * CharacterPropertiesTitleBook migrated to CharacterExtensions * CharacterPropertiesFriendList migrated to CharacterExtensions * drop AccountId from CharacterPropertiesFriendList
2018-08-30 07:11:25 -05:00
}
Migrate Character tables over to similar caching/threading model as Biota (#979) * First batch of Character refactor Characters are now cached with their dbContext, exactly like we do for Biotas. This greatly simplifies the way characters are pulled and saved, and is much more efficient. Deleting and restoring characters have been migrated to the new SaveCharacter function. There is no need for separate functions to handle those specific tasks. IsPlussed column added to Character. This removes the need to query the biota to see if we should display the + in front of the name at the character screen. Character.LastLoginTimestamp, TotalLogins, CharacterOptions1, and CharacterOptions2 are now used. These property types were removed from the ACE.Entity.enum. (the 9000+ types) Fixed a few places where ChangesDetected was being set insetad of CharacterChangesDetected. There is still more work to do to improve this pattern. * Player_Client renamed to Player_Character Plus some cleanup on the way CharacterOptions were get * Remove duplicate appearance DID properties from WorldObject_Properties * Removed the duplicate HairTexture DID properties * Migrate HairTexture from biota property to Character property * Forgot a CharacterChangesDetected * Migrate Character specific functions to Player_Character * Some more Biota wrappers added to BiotaExtensions * CharacterPropertiesShortcutBar wrapped * CharacterPropertiesSpellBar migrated to CharacterExtensions * CharacterPropertiesTitleBook migrated to CharacterExtensions * CharacterPropertiesFriendList migrated to CharacterExtensions * drop AccountId from CharacterPropertiesFriendList
2018-08-30 07:11:25 -05:00
public void IsCharacterNameAvailable(string name, Action<bool> callback)
{
_queue.Add(new Task(() =>
{
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
var result = BaseDatabase.IsCharacterNameAvailable(name);
Migrate Character tables over to similar caching/threading model as Biota (#979) * First batch of Character refactor Characters are now cached with their dbContext, exactly like we do for Biotas. This greatly simplifies the way characters are pulled and saved, and is much more efficient. Deleting and restoring characters have been migrated to the new SaveCharacter function. There is no need for separate functions to handle those specific tasks. IsPlussed column added to Character. This removes the need to query the biota to see if we should display the + in front of the name at the character screen. Character.LastLoginTimestamp, TotalLogins, CharacterOptions1, and CharacterOptions2 are now used. These property types were removed from the ACE.Entity.enum. (the 9000+ types) Fixed a few places where ChangesDetected was being set insetad of CharacterChangesDetected. There is still more work to do to improve this pattern. * Player_Client renamed to Player_Character Plus some cleanup on the way CharacterOptions were get * Remove duplicate appearance DID properties from WorldObject_Properties * Removed the duplicate HairTexture DID properties * Migrate HairTexture from biota property to Character property * Forgot a CharacterChangesDetected * Migrate Character specific functions to Player_Character * Some more Biota wrappers added to BiotaExtensions * CharacterPropertiesShortcutBar wrapped * CharacterPropertiesSpellBar migrated to CharacterExtensions * CharacterPropertiesTitleBook migrated to CharacterExtensions * CharacterPropertiesFriendList migrated to CharacterExtensions * drop AccountId from CharacterPropertiesFriendList
2018-08-30 07:11:25 -05:00
callback?.Invoke(result);
}));
}
Migrate Character tables over to similar caching/threading model as Biota (#979) * First batch of Character refactor Characters are now cached with their dbContext, exactly like we do for Biotas. This greatly simplifies the way characters are pulled and saved, and is much more efficient. Deleting and restoring characters have been migrated to the new SaveCharacter function. There is no need for separate functions to handle those specific tasks. IsPlussed column added to Character. This removes the need to query the biota to see if we should display the + in front of the name at the character screen. Character.LastLoginTimestamp, TotalLogins, CharacterOptions1, and CharacterOptions2 are now used. These property types were removed from the ACE.Entity.enum. (the 9000+ types) Fixed a few places where ChangesDetected was being set insetad of CharacterChangesDetected. There is still more work to do to improve this pattern. * Player_Client renamed to Player_Character Plus some cleanup on the way CharacterOptions were get * Remove duplicate appearance DID properties from WorldObject_Properties * Removed the duplicate HairTexture DID properties * Migrate HairTexture from biota property to Character property * Forgot a CharacterChangesDetected * Migrate Character specific functions to Player_Character * Some more Biota wrappers added to BiotaExtensions * CharacterPropertiesShortcutBar wrapped * CharacterPropertiesSpellBar migrated to CharacterExtensions * CharacterPropertiesTitleBook migrated to CharacterExtensions * CharacterPropertiesFriendList migrated to CharacterExtensions * drop AccountId from CharacterPropertiesFriendList
2018-08-30 07:11:25 -05:00
public void GetCharacters(uint accountId, bool includeDeleted, Action<List<Character>> callback)
{
_queue.Add(new Task(() =>
{
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
var result = BaseDatabase.GetCharacters(accountId, includeDeleted);
Migrate Character tables over to similar caching/threading model as Biota (#979) * First batch of Character refactor Characters are now cached with their dbContext, exactly like we do for Biotas. This greatly simplifies the way characters are pulled and saved, and is much more efficient. Deleting and restoring characters have been migrated to the new SaveCharacter function. There is no need for separate functions to handle those specific tasks. IsPlussed column added to Character. This removes the need to query the biota to see if we should display the + in front of the name at the character screen. Character.LastLoginTimestamp, TotalLogins, CharacterOptions1, and CharacterOptions2 are now used. These property types were removed from the ACE.Entity.enum. (the 9000+ types) Fixed a few places where ChangesDetected was being set insetad of CharacterChangesDetected. There is still more work to do to improve this pattern. * Player_Client renamed to Player_Character Plus some cleanup on the way CharacterOptions were get * Remove duplicate appearance DID properties from WorldObject_Properties * Removed the duplicate HairTexture DID properties * Migrate HairTexture from biota property to Character property * Forgot a CharacterChangesDetected * Migrate Character specific functions to Player_Character * Some more Biota wrappers added to BiotaExtensions * CharacterPropertiesShortcutBar wrapped * CharacterPropertiesSpellBar migrated to CharacterExtensions * CharacterPropertiesTitleBook migrated to CharacterExtensions * CharacterPropertiesFriendList migrated to CharacterExtensions * drop AccountId from CharacterPropertiesFriendList
2018-08-30 07:11:25 -05:00
callback?.Invoke(result);
}));
}
public void GetCharacter(uint characterId, Action<Character> callback)
{
_queue.Add(new Task(() =>
{
var result = BaseDatabase.GetCharacter(characterId);
callback?.Invoke(result);
}));
}
Migrate Character tables over to similar caching/threading model as Biota (#979) * First batch of Character refactor Characters are now cached with their dbContext, exactly like we do for Biotas. This greatly simplifies the way characters are pulled and saved, and is much more efficient. Deleting and restoring characters have been migrated to the new SaveCharacter function. There is no need for separate functions to handle those specific tasks. IsPlussed column added to Character. This removes the need to query the biota to see if we should display the + in front of the name at the character screen. Character.LastLoginTimestamp, TotalLogins, CharacterOptions1, and CharacterOptions2 are now used. These property types were removed from the ACE.Entity.enum. (the 9000+ types) Fixed a few places where ChangesDetected was being set insetad of CharacterChangesDetected. There is still more work to do to improve this pattern. * Player_Client renamed to Player_Character Plus some cleanup on the way CharacterOptions were get * Remove duplicate appearance DID properties from WorldObject_Properties * Removed the duplicate HairTexture DID properties * Migrate HairTexture from biota property to Character property * Forgot a CharacterChangesDetected * Migrate Character specific functions to Player_Character * Some more Biota wrappers added to BiotaExtensions * CharacterPropertiesShortcutBar wrapped * CharacterPropertiesSpellBar migrated to CharacterExtensions * CharacterPropertiesTitleBook migrated to CharacterExtensions * CharacterPropertiesFriendList migrated to CharacterExtensions * drop AccountId from CharacterPropertiesFriendList
2018-08-30 07:11:25 -05:00
public void SaveCharacter(Character character, ReaderWriterLockSlim rwLock, Action<bool> callback)
{
_queue.Add(new Task(() =>
{
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
var result = BaseDatabase.SaveCharacter(character, rwLock);
Migrate Character tables over to similar caching/threading model as Biota (#979) * First batch of Character refactor Characters are now cached with their dbContext, exactly like we do for Biotas. This greatly simplifies the way characters are pulled and saved, and is much more efficient. Deleting and restoring characters have been migrated to the new SaveCharacter function. There is no need for separate functions to handle those specific tasks. IsPlussed column added to Character. This removes the need to query the biota to see if we should display the + in front of the name at the character screen. Character.LastLoginTimestamp, TotalLogins, CharacterOptions1, and CharacterOptions2 are now used. These property types were removed from the ACE.Entity.enum. (the 9000+ types) Fixed a few places where ChangesDetected was being set insetad of CharacterChangesDetected. There is still more work to do to improve this pattern. * Player_Client renamed to Player_Character Plus some cleanup on the way CharacterOptions were get * Remove duplicate appearance DID properties from WorldObject_Properties * Removed the duplicate HairTexture DID properties * Migrate HairTexture from biota property to Character property * Forgot a CharacterChangesDetected * Migrate Character specific functions to Player_Character * Some more Biota wrappers added to BiotaExtensions * CharacterPropertiesShortcutBar wrapped * CharacterPropertiesSpellBar migrated to CharacterExtensions * CharacterPropertiesTitleBook migrated to CharacterExtensions * CharacterPropertiesFriendList migrated to CharacterExtensions * drop AccountId from CharacterPropertiesFriendList
2018-08-30 07:11:25 -05:00
callback?.Invoke(result);
}));
}
public void RenameCharacter(Character character, string newName, ReaderWriterLockSlim rwLock, Action<bool> callback)
{
_queue.Add(new Task(() =>
{
var result = BaseDatabase.RenameCharacter(character, newName, rwLock);
callback?.Invoke(result);
}));
}
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
public void SetCharacterAccessLevelByName(string name, AccessLevel accessLevel, Action<uint> callback)
{
// TODO
throw new NotImplementedException();
}
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
public void AddCharacterInParallel(ACE.Entity.Models.Biota biota, ReaderWriterLockSlim biotaLock, IEnumerable<(ACE.Entity.Models.Biota biota, ReaderWriterLockSlim rwLock)> possessions, Character character, ReaderWriterLockSlim characterLock, Action<bool> callback)
Migrate Character tables over to similar caching/threading model as Biota (#979) * First batch of Character refactor Characters are now cached with their dbContext, exactly like we do for Biotas. This greatly simplifies the way characters are pulled and saved, and is much more efficient. Deleting and restoring characters have been migrated to the new SaveCharacter function. There is no need for separate functions to handle those specific tasks. IsPlussed column added to Character. This removes the need to query the biota to see if we should display the + in front of the name at the character screen. Character.LastLoginTimestamp, TotalLogins, CharacterOptions1, and CharacterOptions2 are now used. These property types were removed from the ACE.Entity.enum. (the 9000+ types) Fixed a few places where ChangesDetected was being set insetad of CharacterChangesDetected. There is still more work to do to improve this pattern. * Player_Client renamed to Player_Character Plus some cleanup on the way CharacterOptions were get * Remove duplicate appearance DID properties from WorldObject_Properties * Removed the duplicate HairTexture DID properties * Migrate HairTexture from biota property to Character property * Forgot a CharacterChangesDetected * Migrate Character specific functions to Player_Character * Some more Biota wrappers added to BiotaExtensions * CharacterPropertiesShortcutBar wrapped * CharacterPropertiesSpellBar migrated to CharacterExtensions * CharacterPropertiesTitleBook migrated to CharacterExtensions * CharacterPropertiesFriendList migrated to CharacterExtensions * drop AccountId from CharacterPropertiesFriendList
2018-08-30 07:11:25 -05:00
{
_queue.Add(new Task(() =>
{
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
var result = BaseDatabase.AddCharacterInParallel(biota, biotaLock, possessions, character, characterLock);
Migrate Character tables over to similar caching/threading model as Biota (#979) * First batch of Character refactor Characters are now cached with their dbContext, exactly like we do for Biotas. This greatly simplifies the way characters are pulled and saved, and is much more efficient. Deleting and restoring characters have been migrated to the new SaveCharacter function. There is no need for separate functions to handle those specific tasks. IsPlussed column added to Character. This removes the need to query the biota to see if we should display the + in front of the name at the character screen. Character.LastLoginTimestamp, TotalLogins, CharacterOptions1, and CharacterOptions2 are now used. These property types were removed from the ACE.Entity.enum. (the 9000+ types) Fixed a few places where ChangesDetected was being set insetad of CharacterChangesDetected. There is still more work to do to improve this pattern. * Player_Client renamed to Player_Character Plus some cleanup on the way CharacterOptions were get * Remove duplicate appearance DID properties from WorldObject_Properties * Removed the duplicate HairTexture DID properties * Migrate HairTexture from biota property to Character property * Forgot a CharacterChangesDetected * Migrate Character specific functions to Player_Character * Some more Biota wrappers added to BiotaExtensions * CharacterPropertiesShortcutBar wrapped * CharacterPropertiesSpellBar migrated to CharacterExtensions * CharacterPropertiesTitleBook migrated to CharacterExtensions * CharacterPropertiesFriendList migrated to CharacterExtensions * drop AccountId from CharacterPropertiesFriendList
2018-08-30 07:11:25 -05:00
callback?.Invoke(result);
}));
}
}
}