2018-04-02 09:55:55 -05:00
|
|
|
using System;
|
2017-02-07 00:34:00 -05:00
|
|
|
using System.Collections.Generic;
|
Object overhaul (#384)
* Object overhaul - clean up enums (#337)
* Give property enums a static value to aviod positional fubar later on. Cleaned up using.
* Cleaning up enums
* Fixed Line ending update change log.
* Review & Comment only || Object overhaul - POC (#339)
* Give property enums a static value to aviod positional fubar later on. Cleaned up using.
* Cleaning up enums
* Fixed Line ending update change log.
* Added new positionType
* Started work on implementing object overhaul - want to make sure I am heading in the right direction.
* Minor clean up, responded to feedback and fixed a few bugs. Thanks for the second and third set of eyes.
* Object Overhaul - ready for review and merge. Still Work in Progress but a good spot. (#341)
* Give property enums a static value to aviod positional fubar later on. Cleaned up using.
* Cleaning up enums
* Fixed Line ending update change log.
* Added new positionType
* Started work on implementing object overhaul - want to make sure I am heading in the right direction.
* Minor clean up, responded to feedback and fixed a few bugs. Thanks for the second and third set of eyes.
* Continued work. Please review as these are a LOT of manual changes. Compiles and you can log in.
* Continued work. I have all of the items pulling from properties now. Still work to make baseAceObject and AceObject on thing / finish work around workmanship and actually kick the tires and start pulling data. Sorry this is taking so long.
* Had time for a few more and cleaned up whitespace.
* Good point to check in. All of the property tables are hooked up and loading data. I created the workmanship hackery we discussed. As always comments and suggestions much appreciated.
* One quick shot to fix appveyor before bed.
* * Continued work on Overhaul
* Created mapping cross reference file to faciltate docuatation and cleaning up names - work in progress https://goo.gl/eaaNQb
* Created new database schema for world_object - modified mysqlinstall.bat to refect new baseline
* created script to ETL old schema to new schema. I have not included it as we will be refactoring the initial data load to use the new
* schema according to Ripley. I have the script tested and posted on my dropbox if anyone wants it. I also have a complete data dump that
* zips down to a manageable size.
* BaseAceObject is now using the new schema
* I re-hooked up telepoi to use the new schema. Still to do, convert to constructed statement
* Next steps - refactor AceObject and make sure world objects load again.
* Once that is complete - start same process using clone of this schema for character as discussed.
* renabled more data loading.
* Continued work on hooking data back up. Working on moveto debug command - this creates a world object. Not quite there yet.
* WIP
* Making progress. Test object able to be spwaned from new schema. Still to do, renable constructed statements, clean up and re-enable the other constructed statements.
* updated worldbase
* * Intital work done for new schema. Rebased and removed update sql files. (#353)
* Tested and the auto setting of Physics and Weenie Header Flags looks really solid. Side note, the values we have
* in the database for weenieHeaderFlags and PhysicsDescriptionFlag should probably be dropped we don't read them or use them now.
* Doors, portals NPC's and signs are all back in the world now.
* I would suggest we remearge with the main branch sooner rather than later - we can create another branch to introduce these
* changes into the character side.
* TODO items:
* Creature spawns need to be refactored - I left them commented out. We need to ditch seperate tables that we have now, I think all
* creature can use what we have now, plus maybe two additional world tables. Everything else fits into the current schema.
* Test Ripley data and update ACE_World.
* Refactor portals - I just left the old way in and faked it out with a view.
* Once this looks good and stable and we fix any found bugs - we need to clone this over to the character database and start refactoring
* That will get us to persisted inventory.
* Objects - Game data refactored - issue with character login (#355)
* wip
* WIP - character login is trying to persist a world object
* Still throwing an exception on player login.
* Working Code - finished GameData - need to complete PhysicsData and ModelData. Thanks to @Lidefeath for finding my issue.
* WIP compiles but has error on run. Data changes have broken something. Will fix tomorrow.
* Wip - nothing really working yet. I can log in but item creation is not working.
* Objects (#357)
* wip
* WIP - character login is trying to persist a world object
* Still throwing an exception on player login.
* Working Code - finished GameData - need to complete PhysicsData and ModelData. Thanks to @Lidefeath for finding my issue.
* WIP compiles but has error on run. Data changes have broken something. Will fix tomorrow.
* Wip - nothing really working yet. I can log in but item creation is not working.
* Best attempt stabbed (#358)
* wip 1
* wip 2
* wip 3
* wip 3
* i think thats it for now. good luck!
* Read cached characters and launch to char list (#360)
* First corrections and commenting out so the start to command line works
* The basics for launching to character list is working.
* Edit config.json for AppVeyor
* Rework Base SQL scripts. (#361)
Expect broken execution until views are corrected for ace_shard
* Cleaning up error list (#362)
Clearing stylecop issues and warnings in Error List
* ACE Enum adjustments (#363)
* More Enum Adjustments (#364)
* More Enum Adjustments
* Further Enum Refinement
* Changed Enum Value
* More Enum and Object Realignment (#365)
* Adding Enums to better align with AC standards. GroupTypeChat and AccessLevel will be converted to these.
* Object level changes to go with enum resorting
* Extend ORM to allow aggregate functions i.e. MAX(column) and (#366)
* Extend ORM to allow aggregate functions i.e. MAX(column) and implement GetNextCharacterId
* For AppVeyor, thanks @ogmage78 for the sql
* Implements IsCharacterNameAvailable and fixes some errors in the chargen code. (#367)
* Character Loading (#368)
* Cleaned up some whitespace issues. Still understanding the direction.
* WIP added enums for PropertyAttribute
* Wip got a lot of aceCharacter done - working on position - about 1/2 done.
* WIP - Ace Character Loading.
* Intital work done for loading character from ace_shard. Rebased and removed update sql files.
* Tested up to position loading. Made changes to position, but have not loaded the dictionary yet.
* Fixed a few bugs - attribute loading had a few.
* TODO items:
* Finish up loading positions then see what is left.
* Work on saving as OptimShi - has character creation ready to go.
* Fixed for rebase and apveyor
* Hand wrote view per request and removed unneeded position.
* Read character creation values from client_portal.dat (#369)
* Read character creation values from client_portal.dat and assign to appropriate Character Properties
* Added AceCharacter properties for the character appearance data
* More fun in Zombieland - character loading. (#370)
* [Og II]
* Continued work loading character from ace_shard. Rebased
* Added cascade delete to all child tables in ace_shard.
* Completed and tested up to skillz loading. Made a few changes on the db side for key consistancy.
* TODO items:
* Finish up loading - spells, friends, allegiance info, spell comps, spell bars etc. etc....
* Fixed bug in setXXXProperty methods with the add new. Was not setting the AceObjectId
* Fixed auto inc and unsealed position class and made aceObjectId virtual again.
* SaveObject implemented in ShardDatabase.cs (#371)
* First steps of SaveObject
* Hopefully I didn't bork anything too hard.
* Character creation -- data present on save appears to make its way to the DB. Thanks to Lidefeath for the starter here.
* Removed all references to SaveCharacterOptions -- replace with SaveObject().
* Removed all references to SaveCharacterOptions -- replace with SaveObject().
* Cleanup of DbGetListAttribute (#372)
* First steps of SaveObject
* Hopefully I didn't bork anything too hard.
* Character creation -- data present on save appears to make its way to the DB. Thanks to Lidefeath for the starter here.
* Removed all references to SaveCharacterOptions -- replace with SaveObject().
* Removed all references to SaveCharacterOptions -- replace with SaveObject().
* Reworked DbGetListAttribute, got rid of hacky code.
* Forgot to remove sloppy comments from refactoring.
* Create Database.cs
* Fix the "You do not own this character" error. (#373)
* Refactoring, save/restore progress on object overhaul (#375)
* First steps of SaveObject
* added todo
* Hopefully I didn't bork anything too hard.
* Character creation -- data present on save appears to make its way to the DB. Thanks to Lidefeath for the starter here.
* Removed all references to SaveCharacterOptions -- replace with SaveObject().
* Removed all references to SaveCharacterOptions -- replace with SaveObject().
* Working on player login. Getting closer. At SendSelf in player.cs
* Reworked DbGetListAttribute, got rid of hacky code.
* Forgot to remove sloppy comments from refactoring.
* Create Database.cs
* Continued work on character login. A little closer - we can get into the world now. Please see change log for list of outstanding items.
* Can log in, and walk around. Some properties still wrong. Still need to submit several DB level fixes.
* Many fixups/bugfixes.
Positions now save.
Character logs in.
Game doesn't crash.
Can open multiple sessions.
(some) ORM issues fixed
Issues:
World Objects still don't appear in game.
Race found in ShardDatabase (commented)
* Minor cleanups.
* Object overhaul (#376)
* First steps of SaveObject
* added todo
* Hopefully I didn't bork anything too hard.
* Character creation -- data present on save appears to make its way to the DB. Thanks to Lidefeath for the starter here.
* Removed all references to SaveCharacterOptions -- replace with SaveObject().
* Removed all references to SaveCharacterOptions -- replace with SaveObject().
* Working on player login. Getting closer. At SendSelf in player.cs
* Reworked DbGetListAttribute, got rid of hacky code.
* Forgot to remove sloppy comments from refactoring.
* Create Database.cs
* Continued work on character login. A little closer - we can get into the world now. Please see change log for list of outstanding items.
* Can log in, and walk around. Some properties still wrong. Still need to submit several DB level fixes.
* Many fixups/bugfixes.
Positions now save.
Character logs in.
Game doesn't crash.
Can open multiple sessions.
(some) ORM issues fixed
Issues:
World Objects still don't appear in game.
Race found in ShardDatabase (commented)
* Properly load Data Id instances. Objects now "spawn" in-world, but don't interact properly.
* Fixes to worldbase vw_teleport_location, player description, character handler. Player now gets proper stats and can teleportpoi. Vital inital values are off.
* Sets options on load. May be bad/broken. Need to seriously think how AceObject/AceCharacter and WorldObject/Player should interact. We don't do that well now.
* Fix to attribute2nd, using uint24 instead of uint16 for value (because monster's health can get huuuge).
* Position refactor into backend object AceObjectPropertiesPosition and front-end object Position.
* * fixed issues with the weenieHeaderFlags setting method, fixed PhysicsDescriptionFlag setting issue as well.
* cleaned up and rebased data scripts for WorldBase and ShardBase
* Found issue in my data that was ETL to our new schema - had two flag fields Reversed - that is fixed but would be no issue
* once we have Ripley's new data export. I have shared out a link to the cleaned up data for use while we finish the new export.
* https://www.dropbox.com/s/pohcruvalt9s38h/WorldandShardData.zip?dl=0
* I put in a nasty hack - hard coded weenieClassId on character save - it was being set to 0 and I could not find it. I marked with with a todo.
* player.cs line 490
* Create Landblock.cs
* Updated changelog
* Fear the Walking Dead - More work on our object overhaul - bug fixes and continued work (#377)
* Testing - fixed a few null reference check errors. Added in OptimShi player apperance code.
* added back code needed for ci
* Sending DataId and InstanceId data to character description.
* Forgot to update change log
* Added Ripley's changes to scheam
* Create ShardBase.sql
* Create WorldBase.sql
* Made requested changes
* Lord BucketHead - temp fix. Added start of equipping items and POC code (#378)
* * Added getting and setting ContainerID and Wielder into AceObject and surfaced in worldObject
* Put in a hack to show how equiped weapons and shields work. We will need to establish a place to store this data.
* I put in big TODO to indentify the hack - it is benign and will not impact anything else other than to demo the placement
* of the spear in Rand the Game Hunters hand in Holtburg.
* Modified SetPhysicsDescriptionFlags so it can be container and weilder aware.
* Worked with OptimShi and we put in a fix for Lord BucketHead.
* Found and fixed one more bug with hair styles
* Update Player.cs
removed comment that was out of date.
* SQL Scripts Re-based (#379)
* SQL Scripts Rebased
* More alignment of base DB script.
* Final SQL script rebase
* Code cleanup and a few bug fixes. (#380)
* Code cleanup and a few bug fixes. Working to trello card. Board updated.
* Added first part of wield item.
* Update to remove class diagram
* Update GameActionGetAndWieldItem.cs
* Update GameEventWieldItem.cs
* Fixed Position Saving. (#381)
* Fixed Position Saving.
* Fixed other minor character initialization bugs
* Cleanup backing AceObject (#382)
* Reworked AceObject/Player/WorldObject to better repsect AceObject as a unit backing.
* Enough cleanup to commit. Fixed vitals (Attribute2nd) in the process.
* Fixed bad rebase errors. Appears to work now. Can confirm vitals (Attribute2nds) initialize well, and can be raised.
* Fixed bug with player creation and made a bunch of comments and notes about things I discovered so they would not get lost. (#383)
2017-06-16 09:54:39 -04:00
|
|
|
using System.Linq;
|
2018-02-14 12:06:26 -06:00
|
|
|
using System.Threading;
|
2018-02-10 06:05:13 -06:00
|
|
|
|
2018-02-14 12:06:26 -06:00
|
|
|
using Microsoft.EntityFrameworkCore;
|
|
|
|
|
using Microsoft.EntityFrameworkCore.Infrastructure;
|
|
|
|
|
using Microsoft.EntityFrameworkCore.Storage;
|
2018-02-10 06:05:13 -06:00
|
|
|
|
2018-02-14 12:06:26 -06:00
|
|
|
using log4net;
|
|
|
|
|
|
2019-01-26 15:14:32 -05:00
|
|
|
using ACE.Database.Entity;
|
2018-02-14 12:06:26 -06:00
|
|
|
using ACE.Database.Models.World;
|
2018-04-18 08:40:33 -05:00
|
|
|
using ACE.Entity.Enum;
|
2018-11-27 20:51:47 -06:00
|
|
|
using ACE.Entity.Enum.Properties;
|
2020-02-12 19:49:34 -06:00
|
|
|
|
2017-02-07 00:34:00 -05:00
|
|
|
namespace ACE.Database
|
|
|
|
|
{
|
2020-04-02 22:40:27 -05:00
|
|
|
public class WorldDatabase
|
2017-02-07 00:34:00 -05:00
|
|
|
{
|
2018-02-14 12:06:26 -06:00
|
|
|
private static readonly ILog log = LogManager.GetLogger(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType);
|
2017-07-10 14:11:29 -04:00
|
|
|
|
2018-02-14 12:06:26 -06:00
|
|
|
public bool Exists(bool retryUntilFound)
|
2017-02-07 00:34:00 -05:00
|
|
|
{
|
2018-02-14 12:06:26 -06:00
|
|
|
var config = Common.ConfigManager.Config.MySql.World;
|
2018-01-05 12:03:26 -05:00
|
|
|
|
2018-02-14 12:06:26 -06:00
|
|
|
for (; ; )
|
|
|
|
|
{
|
|
|
|
|
using (var context = new WorldDbContext())
|
|
|
|
|
{
|
|
|
|
|
if (((RelationalDatabaseCreator)context.Database.GetService<IDatabaseCreator>()).Exists())
|
|
|
|
|
{
|
2025-08-11 22:38:12 -04:00
|
|
|
log.InfoFormat("[DATABASE] Successfully connected to {0} database on {1}:{2}.", config.Database, config.Host, config.Port);
|
2018-02-14 12:06:26 -06:00
|
|
|
return true;
|
|
|
|
|
}
|
|
|
|
|
}
|
2017-02-07 00:34:00 -05:00
|
|
|
|
2020-01-06 06:57:45 -06:00
|
|
|
log.Error($"[DATABASE] Attempting to reconnect to {config.Database} database on {config.Host}:{config.Port} in 5 seconds...");
|
2017-11-01 23:53:08 -04:00
|
|
|
|
2018-02-14 12:06:26 -06:00
|
|
|
if (retryUntilFound)
|
|
|
|
|
Thread.Sleep(5000);
|
|
|
|
|
else
|
|
|
|
|
return false;
|
2017-06-20 12:17:22 -05:00
|
|
|
}
|
2017-10-21 13:32:06 -04:00
|
|
|
}
|
2017-04-18 10:11:23 -07:00
|
|
|
|
Object overhaul (#384)
* Object overhaul - clean up enums (#337)
* Give property enums a static value to aviod positional fubar later on. Cleaned up using.
* Cleaning up enums
* Fixed Line ending update change log.
* Review & Comment only || Object overhaul - POC (#339)
* Give property enums a static value to aviod positional fubar later on. Cleaned up using.
* Cleaning up enums
* Fixed Line ending update change log.
* Added new positionType
* Started work on implementing object overhaul - want to make sure I am heading in the right direction.
* Minor clean up, responded to feedback and fixed a few bugs. Thanks for the second and third set of eyes.
* Object Overhaul - ready for review and merge. Still Work in Progress but a good spot. (#341)
* Give property enums a static value to aviod positional fubar later on. Cleaned up using.
* Cleaning up enums
* Fixed Line ending update change log.
* Added new positionType
* Started work on implementing object overhaul - want to make sure I am heading in the right direction.
* Minor clean up, responded to feedback and fixed a few bugs. Thanks for the second and third set of eyes.
* Continued work. Please review as these are a LOT of manual changes. Compiles and you can log in.
* Continued work. I have all of the items pulling from properties now. Still work to make baseAceObject and AceObject on thing / finish work around workmanship and actually kick the tires and start pulling data. Sorry this is taking so long.
* Had time for a few more and cleaned up whitespace.
* Good point to check in. All of the property tables are hooked up and loading data. I created the workmanship hackery we discussed. As always comments and suggestions much appreciated.
* One quick shot to fix appveyor before bed.
* * Continued work on Overhaul
* Created mapping cross reference file to faciltate docuatation and cleaning up names - work in progress https://goo.gl/eaaNQb
* Created new database schema for world_object - modified mysqlinstall.bat to refect new baseline
* created script to ETL old schema to new schema. I have not included it as we will be refactoring the initial data load to use the new
* schema according to Ripley. I have the script tested and posted on my dropbox if anyone wants it. I also have a complete data dump that
* zips down to a manageable size.
* BaseAceObject is now using the new schema
* I re-hooked up telepoi to use the new schema. Still to do, convert to constructed statement
* Next steps - refactor AceObject and make sure world objects load again.
* Once that is complete - start same process using clone of this schema for character as discussed.
* renabled more data loading.
* Continued work on hooking data back up. Working on moveto debug command - this creates a world object. Not quite there yet.
* WIP
* Making progress. Test object able to be spwaned from new schema. Still to do, renable constructed statements, clean up and re-enable the other constructed statements.
* updated worldbase
* * Intital work done for new schema. Rebased and removed update sql files. (#353)
* Tested and the auto setting of Physics and Weenie Header Flags looks really solid. Side note, the values we have
* in the database for weenieHeaderFlags and PhysicsDescriptionFlag should probably be dropped we don't read them or use them now.
* Doors, portals NPC's and signs are all back in the world now.
* I would suggest we remearge with the main branch sooner rather than later - we can create another branch to introduce these
* changes into the character side.
* TODO items:
* Creature spawns need to be refactored - I left them commented out. We need to ditch seperate tables that we have now, I think all
* creature can use what we have now, plus maybe two additional world tables. Everything else fits into the current schema.
* Test Ripley data and update ACE_World.
* Refactor portals - I just left the old way in and faked it out with a view.
* Once this looks good and stable and we fix any found bugs - we need to clone this over to the character database and start refactoring
* That will get us to persisted inventory.
* Objects - Game data refactored - issue with character login (#355)
* wip
* WIP - character login is trying to persist a world object
* Still throwing an exception on player login.
* Working Code - finished GameData - need to complete PhysicsData and ModelData. Thanks to @Lidefeath for finding my issue.
* WIP compiles but has error on run. Data changes have broken something. Will fix tomorrow.
* Wip - nothing really working yet. I can log in but item creation is not working.
* Objects (#357)
* wip
* WIP - character login is trying to persist a world object
* Still throwing an exception on player login.
* Working Code - finished GameData - need to complete PhysicsData and ModelData. Thanks to @Lidefeath for finding my issue.
* WIP compiles but has error on run. Data changes have broken something. Will fix tomorrow.
* Wip - nothing really working yet. I can log in but item creation is not working.
* Best attempt stabbed (#358)
* wip 1
* wip 2
* wip 3
* wip 3
* i think thats it for now. good luck!
* Read cached characters and launch to char list (#360)
* First corrections and commenting out so the start to command line works
* The basics for launching to character list is working.
* Edit config.json for AppVeyor
* Rework Base SQL scripts. (#361)
Expect broken execution until views are corrected for ace_shard
* Cleaning up error list (#362)
Clearing stylecop issues and warnings in Error List
* ACE Enum adjustments (#363)
* More Enum Adjustments (#364)
* More Enum Adjustments
* Further Enum Refinement
* Changed Enum Value
* More Enum and Object Realignment (#365)
* Adding Enums to better align with AC standards. GroupTypeChat and AccessLevel will be converted to these.
* Object level changes to go with enum resorting
* Extend ORM to allow aggregate functions i.e. MAX(column) and (#366)
* Extend ORM to allow aggregate functions i.e. MAX(column) and implement GetNextCharacterId
* For AppVeyor, thanks @ogmage78 for the sql
* Implements IsCharacterNameAvailable and fixes some errors in the chargen code. (#367)
* Character Loading (#368)
* Cleaned up some whitespace issues. Still understanding the direction.
* WIP added enums for PropertyAttribute
* Wip got a lot of aceCharacter done - working on position - about 1/2 done.
* WIP - Ace Character Loading.
* Intital work done for loading character from ace_shard. Rebased and removed update sql files.
* Tested up to position loading. Made changes to position, but have not loaded the dictionary yet.
* Fixed a few bugs - attribute loading had a few.
* TODO items:
* Finish up loading positions then see what is left.
* Work on saving as OptimShi - has character creation ready to go.
* Fixed for rebase and apveyor
* Hand wrote view per request and removed unneeded position.
* Read character creation values from client_portal.dat (#369)
* Read character creation values from client_portal.dat and assign to appropriate Character Properties
* Added AceCharacter properties for the character appearance data
* More fun in Zombieland - character loading. (#370)
* [Og II]
* Continued work loading character from ace_shard. Rebased
* Added cascade delete to all child tables in ace_shard.
* Completed and tested up to skillz loading. Made a few changes on the db side for key consistancy.
* TODO items:
* Finish up loading - spells, friends, allegiance info, spell comps, spell bars etc. etc....
* Fixed bug in setXXXProperty methods with the add new. Was not setting the AceObjectId
* Fixed auto inc and unsealed position class and made aceObjectId virtual again.
* SaveObject implemented in ShardDatabase.cs (#371)
* First steps of SaveObject
* Hopefully I didn't bork anything too hard.
* Character creation -- data present on save appears to make its way to the DB. Thanks to Lidefeath for the starter here.
* Removed all references to SaveCharacterOptions -- replace with SaveObject().
* Removed all references to SaveCharacterOptions -- replace with SaveObject().
* Cleanup of DbGetListAttribute (#372)
* First steps of SaveObject
* Hopefully I didn't bork anything too hard.
* Character creation -- data present on save appears to make its way to the DB. Thanks to Lidefeath for the starter here.
* Removed all references to SaveCharacterOptions -- replace with SaveObject().
* Removed all references to SaveCharacterOptions -- replace with SaveObject().
* Reworked DbGetListAttribute, got rid of hacky code.
* Forgot to remove sloppy comments from refactoring.
* Create Database.cs
* Fix the "You do not own this character" error. (#373)
* Refactoring, save/restore progress on object overhaul (#375)
* First steps of SaveObject
* added todo
* Hopefully I didn't bork anything too hard.
* Character creation -- data present on save appears to make its way to the DB. Thanks to Lidefeath for the starter here.
* Removed all references to SaveCharacterOptions -- replace with SaveObject().
* Removed all references to SaveCharacterOptions -- replace with SaveObject().
* Working on player login. Getting closer. At SendSelf in player.cs
* Reworked DbGetListAttribute, got rid of hacky code.
* Forgot to remove sloppy comments from refactoring.
* Create Database.cs
* Continued work on character login. A little closer - we can get into the world now. Please see change log for list of outstanding items.
* Can log in, and walk around. Some properties still wrong. Still need to submit several DB level fixes.
* Many fixups/bugfixes.
Positions now save.
Character logs in.
Game doesn't crash.
Can open multiple sessions.
(some) ORM issues fixed
Issues:
World Objects still don't appear in game.
Race found in ShardDatabase (commented)
* Minor cleanups.
* Object overhaul (#376)
* First steps of SaveObject
* added todo
* Hopefully I didn't bork anything too hard.
* Character creation -- data present on save appears to make its way to the DB. Thanks to Lidefeath for the starter here.
* Removed all references to SaveCharacterOptions -- replace with SaveObject().
* Removed all references to SaveCharacterOptions -- replace with SaveObject().
* Working on player login. Getting closer. At SendSelf in player.cs
* Reworked DbGetListAttribute, got rid of hacky code.
* Forgot to remove sloppy comments from refactoring.
* Create Database.cs
* Continued work on character login. A little closer - we can get into the world now. Please see change log for list of outstanding items.
* Can log in, and walk around. Some properties still wrong. Still need to submit several DB level fixes.
* Many fixups/bugfixes.
Positions now save.
Character logs in.
Game doesn't crash.
Can open multiple sessions.
(some) ORM issues fixed
Issues:
World Objects still don't appear in game.
Race found in ShardDatabase (commented)
* Properly load Data Id instances. Objects now "spawn" in-world, but don't interact properly.
* Fixes to worldbase vw_teleport_location, player description, character handler. Player now gets proper stats and can teleportpoi. Vital inital values are off.
* Sets options on load. May be bad/broken. Need to seriously think how AceObject/AceCharacter and WorldObject/Player should interact. We don't do that well now.
* Fix to attribute2nd, using uint24 instead of uint16 for value (because monster's health can get huuuge).
* Position refactor into backend object AceObjectPropertiesPosition and front-end object Position.
* * fixed issues with the weenieHeaderFlags setting method, fixed PhysicsDescriptionFlag setting issue as well.
* cleaned up and rebased data scripts for WorldBase and ShardBase
* Found issue in my data that was ETL to our new schema - had two flag fields Reversed - that is fixed but would be no issue
* once we have Ripley's new data export. I have shared out a link to the cleaned up data for use while we finish the new export.
* https://www.dropbox.com/s/pohcruvalt9s38h/WorldandShardData.zip?dl=0
* I put in a nasty hack - hard coded weenieClassId on character save - it was being set to 0 and I could not find it. I marked with with a todo.
* player.cs line 490
* Create Landblock.cs
* Updated changelog
* Fear the Walking Dead - More work on our object overhaul - bug fixes and continued work (#377)
* Testing - fixed a few null reference check errors. Added in OptimShi player apperance code.
* added back code needed for ci
* Sending DataId and InstanceId data to character description.
* Forgot to update change log
* Added Ripley's changes to scheam
* Create ShardBase.sql
* Create WorldBase.sql
* Made requested changes
* Lord BucketHead - temp fix. Added start of equipping items and POC code (#378)
* * Added getting and setting ContainerID and Wielder into AceObject and surfaced in worldObject
* Put in a hack to show how equiped weapons and shields work. We will need to establish a place to store this data.
* I put in big TODO to indentify the hack - it is benign and will not impact anything else other than to demo the placement
* of the spear in Rand the Game Hunters hand in Holtburg.
* Modified SetPhysicsDescriptionFlags so it can be container and weilder aware.
* Worked with OptimShi and we put in a fix for Lord BucketHead.
* Found and fixed one more bug with hair styles
* Update Player.cs
removed comment that was out of date.
* SQL Scripts Re-based (#379)
* SQL Scripts Rebased
* More alignment of base DB script.
* Final SQL script rebase
* Code cleanup and a few bug fixes. (#380)
* Code cleanup and a few bug fixes. Working to trello card. Board updated.
* Added first part of wield item.
* Update to remove class diagram
* Update GameActionGetAndWieldItem.cs
* Update GameEventWieldItem.cs
* Fixed Position Saving. (#381)
* Fixed Position Saving.
* Fixed other minor character initialization bugs
* Cleanup backing AceObject (#382)
* Reworked AceObject/Player/WorldObject to better repsect AceObject as a unit backing.
* Enough cleanup to commit. Fixed vitals (Attribute2nd) in the process.
* Fixed bad rebase errors. Appears to work now. Can confirm vitals (Attribute2nds) initialize well, and can be raised.
* Fixed bug with player creation and made a bunch of comments and notes about things I discovered so they would not get lost. (#383)
2017-06-16 09:54:39 -04:00
|
|
|
|
2020-03-02 08:03:50 -06:00
|
|
|
// =====================================
|
|
|
|
|
// Weenie
|
|
|
|
|
// =====================================
|
2019-08-11 21:51:56 -05:00
|
|
|
|
2018-04-18 08:40:33 -05:00
|
|
|
/// <summary>
|
2020-03-02 08:03:50 -06:00
|
|
|
/// This will populate all sub collections except the following: LandblockInstances, PointsOfInterest
|
2018-04-18 08:40:33 -05:00
|
|
|
/// </summary>
|
2020-03-02 08:03:50 -06:00
|
|
|
public virtual Weenie GetWeenie(WorldDbContext context, uint weenieClassId)
|
2018-04-18 08:40:33 -05:00
|
|
|
{
|
2020-12-07 20:59:40 -06:00
|
|
|
var weenie = context.Weenie.FirstOrDefault(r => r.ClassId == weenieClassId);
|
2018-04-18 08:40:33 -05:00
|
|
|
|
|
|
|
|
if (weenie == null)
|
|
|
|
|
return null;
|
|
|
|
|
|
2020-12-07 20:59:40 -06:00
|
|
|
// Base properties for every weenie (ACBaseQualities)
|
|
|
|
|
weenie.WeeniePropertiesBool = context.WeeniePropertiesBool.Where(r => r.ObjectId == weenie.ClassId).ToList();
|
|
|
|
|
weenie.WeeniePropertiesDID = context.WeeniePropertiesDID.Where(r => r.ObjectId == weenie.ClassId).ToList();
|
|
|
|
|
weenie.WeeniePropertiesFloat = context.WeeniePropertiesFloat.Where(r => r.ObjectId == weenie.ClassId).ToList();
|
|
|
|
|
weenie.WeeniePropertiesIID = context.WeeniePropertiesIID.Where(r => r.ObjectId == weenie.ClassId).ToList();
|
|
|
|
|
weenie.WeeniePropertiesInt = context.WeeniePropertiesInt.Where(r => r.ObjectId == weenie.ClassId).ToList();
|
|
|
|
|
weenie.WeeniePropertiesInt64 = context.WeeniePropertiesInt64.Where(r => r.ObjectId == weenie.ClassId).ToList();
|
|
|
|
|
weenie.WeeniePropertiesPosition = context.WeeniePropertiesPosition.Where(r => r.ObjectId == weenie.ClassId).ToList();
|
|
|
|
|
weenie.WeeniePropertiesString = context.WeeniePropertiesString.Where(r => r.ObjectId == weenie.ClassId).ToList();
|
|
|
|
|
|
2018-04-18 08:40:33 -05:00
|
|
|
var weenieType = (WeenieType)weenie.Type;
|
|
|
|
|
|
|
|
|
|
bool isCreature = weenieType == WeenieType.Creature || weenieType == WeenieType.Cow ||
|
|
|
|
|
weenieType == WeenieType.Sentinel || weenieType == WeenieType.Admin ||
|
2019-05-02 23:47:22 -05:00
|
|
|
weenieType == WeenieType.Vendor ||
|
|
|
|
|
weenieType == WeenieType.CombatPet || weenieType == WeenieType.Pet;
|
2018-04-18 08:40:33 -05:00
|
|
|
|
|
|
|
|
//.Include(r => r.LandblockInstances) // When we grab a weenie, we don't need to also know everywhere it exists in the world
|
|
|
|
|
//.Include(r => r.PointsOfInterest) // I think these are just foreign keys for the POI table
|
|
|
|
|
|
|
|
|
|
weenie.WeeniePropertiesAnimPart = context.WeeniePropertiesAnimPart.Where(r => r.ObjectId == weenie.ClassId).ToList();
|
|
|
|
|
|
|
|
|
|
if (isCreature)
|
|
|
|
|
{
|
|
|
|
|
weenie.WeeniePropertiesAttribute = context.WeeniePropertiesAttribute.Where(r => r.ObjectId == weenie.ClassId).ToList();
|
|
|
|
|
weenie.WeeniePropertiesAttribute2nd = context.WeeniePropertiesAttribute2nd.Where(r => r.ObjectId == weenie.ClassId).ToList();
|
|
|
|
|
|
|
|
|
|
weenie.WeeniePropertiesBodyPart = context.WeeniePropertiesBodyPart.Where(r => r.ObjectId == weenie.ClassId).ToList();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (weenieType == WeenieType.Book)
|
|
|
|
|
{
|
|
|
|
|
weenie.WeeniePropertiesBook = context.WeeniePropertiesBook.FirstOrDefault(r => r.ObjectId == weenie.ClassId);
|
|
|
|
|
weenie.WeeniePropertiesBookPageData = context.WeeniePropertiesBookPageData.Where(r => r.ObjectId == weenie.ClassId).ToList();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
weenie.WeeniePropertiesCreateList = context.WeeniePropertiesCreateList.Where(r => r.ObjectId == weenie.ClassId).ToList();
|
2018-08-04 09:02:41 -05:00
|
|
|
weenie.WeeniePropertiesEmote = context.WeeniePropertiesEmote.Include(r => r.WeeniePropertiesEmoteAction).Where(r => r.ObjectId == weenie.ClassId).ToList();
|
2018-04-18 08:40:33 -05:00
|
|
|
weenie.WeeniePropertiesEventFilter = context.WeeniePropertiesEventFilter.Where(r => r.ObjectId == weenie.ClassId).ToList();
|
|
|
|
|
|
|
|
|
|
weenie.WeeniePropertiesGenerator = context.WeeniePropertiesGenerator.Where(r => r.ObjectId == weenie.ClassId).ToList();
|
|
|
|
|
weenie.WeeniePropertiesPalette = context.WeeniePropertiesPalette.Where(r => r.ObjectId == weenie.ClassId).ToList();
|
|
|
|
|
|
|
|
|
|
if (isCreature)
|
|
|
|
|
{
|
|
|
|
|
weenie.WeeniePropertiesSkill = context.WeeniePropertiesSkill.Where(r => r.ObjectId == weenie.ClassId).ToList();
|
|
|
|
|
}
|
|
|
|
|
|
2020-11-22 03:27:16 -05:00
|
|
|
weenie.WeeniePropertiesSpellBook = context.WeeniePropertiesSpellBook.Where(r => r.ObjectId == weenie.ClassId).OrderBy(i => i.Id).ToList();
|
2018-04-18 08:40:33 -05:00
|
|
|
|
|
|
|
|
weenie.WeeniePropertiesTextureMap = context.WeeniePropertiesTextureMap.Where(r => r.ObjectId == weenie.ClassId).ToList();
|
|
|
|
|
|
|
|
|
|
return weenie;
|
|
|
|
|
}
|
|
|
|
|
|
2021-06-12 14:15:42 -05:00
|
|
|
/// <summary>
|
|
|
|
|
/// This will populate all sub collections except the following: LandblockInstances, PointsOfInterest
|
|
|
|
|
/// </summary>
|
|
|
|
|
public virtual List<Weenie> GetAllWeenies()
|
|
|
|
|
{
|
|
|
|
|
using (var context = new WorldDbContext())
|
|
|
|
|
{
|
|
|
|
|
context.Weenie.Load();
|
|
|
|
|
|
|
|
|
|
// Base properties for every weenie (ACBaseQualities)
|
|
|
|
|
context.WeeniePropertiesBool.Load();
|
|
|
|
|
context.WeeniePropertiesDID.Load();
|
|
|
|
|
context.WeeniePropertiesFloat.Load();
|
|
|
|
|
context.WeeniePropertiesIID.Load();
|
|
|
|
|
context.WeeniePropertiesInt.Load();
|
|
|
|
|
context.WeeniePropertiesInt64.Load();
|
|
|
|
|
context.WeeniePropertiesPosition.Load();
|
|
|
|
|
context.WeeniePropertiesString.Load();
|
|
|
|
|
|
|
|
|
|
context.WeeniePropertiesAnimPart.Load();
|
|
|
|
|
|
|
|
|
|
//if (isCreature)
|
|
|
|
|
{
|
|
|
|
|
context.WeeniePropertiesAttribute.Load();
|
|
|
|
|
context.WeeniePropertiesAttribute2nd.Load();
|
|
|
|
|
|
|
|
|
|
context.WeeniePropertiesBodyPart.Load();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//if (weenieType == WeenieType.Book)
|
|
|
|
|
{
|
|
|
|
|
context.WeeniePropertiesBook.Load();
|
|
|
|
|
context.WeeniePropertiesBookPageData.Load();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
context.WeeniePropertiesCreateList.Load();
|
|
|
|
|
context.WeeniePropertiesEmote.Load();
|
|
|
|
|
context.WeeniePropertiesEmoteAction.Load();
|
|
|
|
|
context.WeeniePropertiesEventFilter.Load();
|
|
|
|
|
|
|
|
|
|
context.WeeniePropertiesGenerator.Load();
|
|
|
|
|
context.WeeniePropertiesPalette.Load();
|
|
|
|
|
|
|
|
|
|
//if (isCreature)
|
|
|
|
|
{
|
|
|
|
|
context.WeeniePropertiesSkill.Load();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
context.WeeniePropertiesSpellBook.Load();
|
|
|
|
|
|
|
|
|
|
context.WeeniePropertiesTextureMap.Load();
|
|
|
|
|
|
|
|
|
|
return context.Weenie.ToList();
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2018-02-14 12:06:26 -06:00
|
|
|
/// <summary>
|
2020-03-02 08:03:50 -06:00
|
|
|
/// This will populate all sub collections except the following: LandblockInstances, PointsOfInterest
|
2018-02-14 12:06:26 -06:00
|
|
|
/// </summary>
|
|
|
|
|
public Weenie GetWeenie(uint weenieClassId)
|
2017-11-30 13:26:44 -05:00
|
|
|
{
|
2018-02-14 12:06:26 -06:00
|
|
|
using (var context = new WorldDbContext())
|
2020-01-06 06:00:00 -06:00
|
|
|
{
|
|
|
|
|
context.ChangeTracker.QueryTrackingBehavior = QueryTrackingBehavior.NoTracking;
|
|
|
|
|
|
2018-04-18 08:40:33 -05:00
|
|
|
return GetWeenie(context, weenieClassId);
|
2020-01-06 06:00:00 -06:00
|
|
|
}
|
2017-11-30 13:26:44 -05:00
|
|
|
}
|
|
|
|
|
|
2019-08-11 21:51:56 -05:00
|
|
|
/// <summary>
|
2020-03-02 08:03:50 -06:00
|
|
|
/// This will populate all sub collections except the following: LandblockInstances, PointsOfInterest
|
2019-08-11 21:51:56 -05:00
|
|
|
/// </summary>
|
2020-03-02 08:03:50 -06:00
|
|
|
public Weenie GetWeenie(WorldDbContext context, string weenieClassName)
|
2018-01-05 12:03:26 -05:00
|
|
|
{
|
2020-03-02 08:03:50 -06:00
|
|
|
var result = context.Weenie
|
|
|
|
|
.FirstOrDefault(r => r.ClassName == weenieClassName);
|
2018-01-05 12:03:26 -05:00
|
|
|
|
2020-03-02 08:03:50 -06:00
|
|
|
if (result != null)
|
|
|
|
|
return GetWeenie(context, result.ClassId);
|
2019-08-11 21:51:56 -05:00
|
|
|
|
2020-03-02 08:03:50 -06:00
|
|
|
return null;
|
2018-02-17 14:35:41 -05:00
|
|
|
}
|
2018-02-05 12:31:32 -05:00
|
|
|
|
2018-08-08 23:36:26 -05:00
|
|
|
/// <summary>
|
2020-03-02 08:03:50 -06:00
|
|
|
/// This will populate all sub collections except the following: LandblockInstances, PointsOfInterest
|
2018-08-08 23:36:26 -05:00
|
|
|
/// </summary>
|
2018-02-17 15:01:41 -05:00
|
|
|
public Weenie GetWeenie(string weenieClassName)
|
2018-10-09 10:52:00 -05:00
|
|
|
{
|
|
|
|
|
using (var context = new WorldDbContext())
|
|
|
|
|
{
|
2020-03-02 08:03:50 -06:00
|
|
|
context.ChangeTracker.QueryTrackingBehavior = QueryTrackingBehavior.NoTracking;
|
2018-10-09 10:52:00 -05:00
|
|
|
|
2020-03-02 08:03:50 -06:00
|
|
|
return GetWeenie(context, weenieClassName);
|
2018-10-09 10:52:00 -05:00
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2018-11-27 20:51:47 -06:00
|
|
|
|
2020-03-02 08:03:50 -06:00
|
|
|
public Dictionary<uint, string> GetAllWeenieNames(WorldDbContext context)
|
2018-04-02 09:55:55 -05:00
|
|
|
{
|
2020-03-02 08:03:50 -06:00
|
|
|
return context.Weenie
|
|
|
|
|
.Include(r => r.WeeniePropertiesString)
|
|
|
|
|
.ToDictionary(r => r.ClassId, r => r.WeeniePropertiesString.FirstOrDefault(p => p.Type == (int)PropertyString.Name)?.Value ?? "");
|
2018-04-02 09:55:55 -05:00
|
|
|
}
|
|
|
|
|
|
2020-03-02 08:03:50 -06:00
|
|
|
public Dictionary<uint, string> GetAllWeenieNames()
|
Object overhaul (#384)
* Object overhaul - clean up enums (#337)
* Give property enums a static value to aviod positional fubar later on. Cleaned up using.
* Cleaning up enums
* Fixed Line ending update change log.
* Review & Comment only || Object overhaul - POC (#339)
* Give property enums a static value to aviod positional fubar later on. Cleaned up using.
* Cleaning up enums
* Fixed Line ending update change log.
* Added new positionType
* Started work on implementing object overhaul - want to make sure I am heading in the right direction.
* Minor clean up, responded to feedback and fixed a few bugs. Thanks for the second and third set of eyes.
* Object Overhaul - ready for review and merge. Still Work in Progress but a good spot. (#341)
* Give property enums a static value to aviod positional fubar later on. Cleaned up using.
* Cleaning up enums
* Fixed Line ending update change log.
* Added new positionType
* Started work on implementing object overhaul - want to make sure I am heading in the right direction.
* Minor clean up, responded to feedback and fixed a few bugs. Thanks for the second and third set of eyes.
* Continued work. Please review as these are a LOT of manual changes. Compiles and you can log in.
* Continued work. I have all of the items pulling from properties now. Still work to make baseAceObject and AceObject on thing / finish work around workmanship and actually kick the tires and start pulling data. Sorry this is taking so long.
* Had time for a few more and cleaned up whitespace.
* Good point to check in. All of the property tables are hooked up and loading data. I created the workmanship hackery we discussed. As always comments and suggestions much appreciated.
* One quick shot to fix appveyor before bed.
* * Continued work on Overhaul
* Created mapping cross reference file to faciltate docuatation and cleaning up names - work in progress https://goo.gl/eaaNQb
* Created new database schema for world_object - modified mysqlinstall.bat to refect new baseline
* created script to ETL old schema to new schema. I have not included it as we will be refactoring the initial data load to use the new
* schema according to Ripley. I have the script tested and posted on my dropbox if anyone wants it. I also have a complete data dump that
* zips down to a manageable size.
* BaseAceObject is now using the new schema
* I re-hooked up telepoi to use the new schema. Still to do, convert to constructed statement
* Next steps - refactor AceObject and make sure world objects load again.
* Once that is complete - start same process using clone of this schema for character as discussed.
* renabled more data loading.
* Continued work on hooking data back up. Working on moveto debug command - this creates a world object. Not quite there yet.
* WIP
* Making progress. Test object able to be spwaned from new schema. Still to do, renable constructed statements, clean up and re-enable the other constructed statements.
* updated worldbase
* * Intital work done for new schema. Rebased and removed update sql files. (#353)
* Tested and the auto setting of Physics and Weenie Header Flags looks really solid. Side note, the values we have
* in the database for weenieHeaderFlags and PhysicsDescriptionFlag should probably be dropped we don't read them or use them now.
* Doors, portals NPC's and signs are all back in the world now.
* I would suggest we remearge with the main branch sooner rather than later - we can create another branch to introduce these
* changes into the character side.
* TODO items:
* Creature spawns need to be refactored - I left them commented out. We need to ditch seperate tables that we have now, I think all
* creature can use what we have now, plus maybe two additional world tables. Everything else fits into the current schema.
* Test Ripley data and update ACE_World.
* Refactor portals - I just left the old way in and faked it out with a view.
* Once this looks good and stable and we fix any found bugs - we need to clone this over to the character database and start refactoring
* That will get us to persisted inventory.
* Objects - Game data refactored - issue with character login (#355)
* wip
* WIP - character login is trying to persist a world object
* Still throwing an exception on player login.
* Working Code - finished GameData - need to complete PhysicsData and ModelData. Thanks to @Lidefeath for finding my issue.
* WIP compiles but has error on run. Data changes have broken something. Will fix tomorrow.
* Wip - nothing really working yet. I can log in but item creation is not working.
* Objects (#357)
* wip
* WIP - character login is trying to persist a world object
* Still throwing an exception on player login.
* Working Code - finished GameData - need to complete PhysicsData and ModelData. Thanks to @Lidefeath for finding my issue.
* WIP compiles but has error on run. Data changes have broken something. Will fix tomorrow.
* Wip - nothing really working yet. I can log in but item creation is not working.
* Best attempt stabbed (#358)
* wip 1
* wip 2
* wip 3
* wip 3
* i think thats it for now. good luck!
* Read cached characters and launch to char list (#360)
* First corrections and commenting out so the start to command line works
* The basics for launching to character list is working.
* Edit config.json for AppVeyor
* Rework Base SQL scripts. (#361)
Expect broken execution until views are corrected for ace_shard
* Cleaning up error list (#362)
Clearing stylecop issues and warnings in Error List
* ACE Enum adjustments (#363)
* More Enum Adjustments (#364)
* More Enum Adjustments
* Further Enum Refinement
* Changed Enum Value
* More Enum and Object Realignment (#365)
* Adding Enums to better align with AC standards. GroupTypeChat and AccessLevel will be converted to these.
* Object level changes to go with enum resorting
* Extend ORM to allow aggregate functions i.e. MAX(column) and (#366)
* Extend ORM to allow aggregate functions i.e. MAX(column) and implement GetNextCharacterId
* For AppVeyor, thanks @ogmage78 for the sql
* Implements IsCharacterNameAvailable and fixes some errors in the chargen code. (#367)
* Character Loading (#368)
* Cleaned up some whitespace issues. Still understanding the direction.
* WIP added enums for PropertyAttribute
* Wip got a lot of aceCharacter done - working on position - about 1/2 done.
* WIP - Ace Character Loading.
* Intital work done for loading character from ace_shard. Rebased and removed update sql files.
* Tested up to position loading. Made changes to position, but have not loaded the dictionary yet.
* Fixed a few bugs - attribute loading had a few.
* TODO items:
* Finish up loading positions then see what is left.
* Work on saving as OptimShi - has character creation ready to go.
* Fixed for rebase and apveyor
* Hand wrote view per request and removed unneeded position.
* Read character creation values from client_portal.dat (#369)
* Read character creation values from client_portal.dat and assign to appropriate Character Properties
* Added AceCharacter properties for the character appearance data
* More fun in Zombieland - character loading. (#370)
* [Og II]
* Continued work loading character from ace_shard. Rebased
* Added cascade delete to all child tables in ace_shard.
* Completed and tested up to skillz loading. Made a few changes on the db side for key consistancy.
* TODO items:
* Finish up loading - spells, friends, allegiance info, spell comps, spell bars etc. etc....
* Fixed bug in setXXXProperty methods with the add new. Was not setting the AceObjectId
* Fixed auto inc and unsealed position class and made aceObjectId virtual again.
* SaveObject implemented in ShardDatabase.cs (#371)
* First steps of SaveObject
* Hopefully I didn't bork anything too hard.
* Character creation -- data present on save appears to make its way to the DB. Thanks to Lidefeath for the starter here.
* Removed all references to SaveCharacterOptions -- replace with SaveObject().
* Removed all references to SaveCharacterOptions -- replace with SaveObject().
* Cleanup of DbGetListAttribute (#372)
* First steps of SaveObject
* Hopefully I didn't bork anything too hard.
* Character creation -- data present on save appears to make its way to the DB. Thanks to Lidefeath for the starter here.
* Removed all references to SaveCharacterOptions -- replace with SaveObject().
* Removed all references to SaveCharacterOptions -- replace with SaveObject().
* Reworked DbGetListAttribute, got rid of hacky code.
* Forgot to remove sloppy comments from refactoring.
* Create Database.cs
* Fix the "You do not own this character" error. (#373)
* Refactoring, save/restore progress on object overhaul (#375)
* First steps of SaveObject
* added todo
* Hopefully I didn't bork anything too hard.
* Character creation -- data present on save appears to make its way to the DB. Thanks to Lidefeath for the starter here.
* Removed all references to SaveCharacterOptions -- replace with SaveObject().
* Removed all references to SaveCharacterOptions -- replace with SaveObject().
* Working on player login. Getting closer. At SendSelf in player.cs
* Reworked DbGetListAttribute, got rid of hacky code.
* Forgot to remove sloppy comments from refactoring.
* Create Database.cs
* Continued work on character login. A little closer - we can get into the world now. Please see change log for list of outstanding items.
* Can log in, and walk around. Some properties still wrong. Still need to submit several DB level fixes.
* Many fixups/bugfixes.
Positions now save.
Character logs in.
Game doesn't crash.
Can open multiple sessions.
(some) ORM issues fixed
Issues:
World Objects still don't appear in game.
Race found in ShardDatabase (commented)
* Minor cleanups.
* Object overhaul (#376)
* First steps of SaveObject
* added todo
* Hopefully I didn't bork anything too hard.
* Character creation -- data present on save appears to make its way to the DB. Thanks to Lidefeath for the starter here.
* Removed all references to SaveCharacterOptions -- replace with SaveObject().
* Removed all references to SaveCharacterOptions -- replace with SaveObject().
* Working on player login. Getting closer. At SendSelf in player.cs
* Reworked DbGetListAttribute, got rid of hacky code.
* Forgot to remove sloppy comments from refactoring.
* Create Database.cs
* Continued work on character login. A little closer - we can get into the world now. Please see change log for list of outstanding items.
* Can log in, and walk around. Some properties still wrong. Still need to submit several DB level fixes.
* Many fixups/bugfixes.
Positions now save.
Character logs in.
Game doesn't crash.
Can open multiple sessions.
(some) ORM issues fixed
Issues:
World Objects still don't appear in game.
Race found in ShardDatabase (commented)
* Properly load Data Id instances. Objects now "spawn" in-world, but don't interact properly.
* Fixes to worldbase vw_teleport_location, player description, character handler. Player now gets proper stats and can teleportpoi. Vital inital values are off.
* Sets options on load. May be bad/broken. Need to seriously think how AceObject/AceCharacter and WorldObject/Player should interact. We don't do that well now.
* Fix to attribute2nd, using uint24 instead of uint16 for value (because monster's health can get huuuge).
* Position refactor into backend object AceObjectPropertiesPosition and front-end object Position.
* * fixed issues with the weenieHeaderFlags setting method, fixed PhysicsDescriptionFlag setting issue as well.
* cleaned up and rebased data scripts for WorldBase and ShardBase
* Found issue in my data that was ETL to our new schema - had two flag fields Reversed - that is fixed but would be no issue
* once we have Ripley's new data export. I have shared out a link to the cleaned up data for use while we finish the new export.
* https://www.dropbox.com/s/pohcruvalt9s38h/WorldandShardData.zip?dl=0
* I put in a nasty hack - hard coded weenieClassId on character save - it was being set to 0 and I could not find it. I marked with with a todo.
* player.cs line 490
* Create Landblock.cs
* Updated changelog
* Fear the Walking Dead - More work on our object overhaul - bug fixes and continued work (#377)
* Testing - fixed a few null reference check errors. Added in OptimShi player apperance code.
* added back code needed for ci
* Sending DataId and InstanceId data to character description.
* Forgot to update change log
* Added Ripley's changes to scheam
* Create ShardBase.sql
* Create WorldBase.sql
* Made requested changes
* Lord BucketHead - temp fix. Added start of equipping items and POC code (#378)
* * Added getting and setting ContainerID and Wielder into AceObject and surfaced in worldObject
* Put in a hack to show how equiped weapons and shields work. We will need to establish a place to store this data.
* I put in big TODO to indentify the hack - it is benign and will not impact anything else other than to demo the placement
* of the spear in Rand the Game Hunters hand in Holtburg.
* Modified SetPhysicsDescriptionFlags so it can be container and weilder aware.
* Worked with OptimShi and we put in a fix for Lord BucketHead.
* Found and fixed one more bug with hair styles
* Update Player.cs
removed comment that was out of date.
* SQL Scripts Re-based (#379)
* SQL Scripts Rebased
* More alignment of base DB script.
* Final SQL script rebase
* Code cleanup and a few bug fixes. (#380)
* Code cleanup and a few bug fixes. Working to trello card. Board updated.
* Added first part of wield item.
* Update to remove class diagram
* Update GameActionGetAndWieldItem.cs
* Update GameEventWieldItem.cs
* Fixed Position Saving. (#381)
* Fixed Position Saving.
* Fixed other minor character initialization bugs
* Cleanup backing AceObject (#382)
* Reworked AceObject/Player/WorldObject to better repsect AceObject as a unit backing.
* Enough cleanup to commit. Fixed vitals (Attribute2nd) in the process.
* Fixed bad rebase errors. Appears to work now. Can confirm vitals (Attribute2nds) initialize well, and can be raised.
* Fixed bug with player creation and made a bunch of comments and notes about things I discovered so they would not get lost. (#383)
2017-06-16 09:54:39 -04:00
|
|
|
{
|
2018-02-14 12:06:26 -06:00
|
|
|
using (var context = new WorldDbContext())
|
|
|
|
|
{
|
2020-03-02 08:03:50 -06:00
|
|
|
context.ChangeTracker.QueryTrackingBehavior = QueryTrackingBehavior.NoTracking;
|
2017-07-10 14:11:29 -04:00
|
|
|
|
2020-03-02 08:03:50 -06:00
|
|
|
return GetAllWeenieNames(context);
|
2018-02-14 12:06:26 -06:00
|
|
|
}
|
2019-06-24 00:55:51 -05:00
|
|
|
}
|
|
|
|
|
|
2020-03-02 08:03:50 -06:00
|
|
|
public Dictionary<uint, string> GetAllWeenieClassNames(WorldDbContext context)
|
2018-02-25 00:52:55 -05:00
|
|
|
{
|
2020-03-02 08:03:50 -06:00
|
|
|
return context.Weenie
|
|
|
|
|
.ToDictionary(r => r.ClassId, r => r.ClassName);
|
2018-02-25 00:52:55 -05:00
|
|
|
}
|
|
|
|
|
|
2020-03-02 08:03:50 -06:00
|
|
|
public Dictionary<uint, string> GetAllWeenieClassNames()
|
2018-09-09 12:11:25 -04:00
|
|
|
{
|
|
|
|
|
using (var context = new WorldDbContext())
|
|
|
|
|
{
|
2020-03-02 08:03:50 -06:00
|
|
|
context.ChangeTracker.QueryTrackingBehavior = QueryTrackingBehavior.NoTracking;
|
2018-09-09 12:11:25 -04:00
|
|
|
|
2020-03-02 08:03:50 -06:00
|
|
|
return GetAllWeenieClassNames(context);
|
2018-12-29 10:15:51 -05:00
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2019-02-11 13:35:21 -06:00
|
|
|
|
2019-01-26 15:14:32 -05:00
|
|
|
public List<HouseListResults> GetHousesAll()
|
|
|
|
|
{
|
|
|
|
|
using (var context = new WorldDbContext())
|
|
|
|
|
{
|
|
|
|
|
var query = from weenie in context.Weenie
|
2020-04-02 22:40:27 -05:00
|
|
|
join winst in context.LandblockInstance on weenie.ClassId equals winst.WeenieClassId
|
|
|
|
|
where weenie.Type == (int)WeenieType.SlumLord
|
|
|
|
|
select new HouseListResults(weenie, winst);
|
2019-01-26 15:14:32 -05:00
|
|
|
|
|
|
|
|
return query.ToList();
|
|
|
|
|
}
|
|
|
|
|
}
|
2019-01-26 10:09:13 -06:00
|
|
|
|
2019-09-14 22:46:32 -05:00
|
|
|
|
|
|
|
|
|
2020-03-02 08:03:50 -06:00
|
|
|
// =====================================
|
|
|
|
|
// CookBook
|
|
|
|
|
// =====================================
|
2019-09-14 22:46:32 -05:00
|
|
|
|
2020-03-02 08:03:50 -06:00
|
|
|
public virtual CookBook GetCookbook(WorldDbContext context, uint sourceWeenieClassId, uint targetWeenieClassId)
|
2018-12-29 10:15:51 -05:00
|
|
|
{
|
2020-03-02 08:03:50 -06:00
|
|
|
var result = context.CookBook
|
|
|
|
|
.Include(r => r.Recipe)
|
|
|
|
|
.Include(r => r.Recipe.RecipeMod)
|
|
|
|
|
.ThenInclude(r => r.RecipeModsBool)
|
|
|
|
|
.Include(r => r.Recipe.RecipeMod)
|
|
|
|
|
.ThenInclude(r => r.RecipeModsDID)
|
|
|
|
|
.Include(r => r.Recipe.RecipeMod)
|
|
|
|
|
.ThenInclude(r => r.RecipeModsFloat)
|
|
|
|
|
.Include(r => r.Recipe.RecipeMod)
|
|
|
|
|
.ThenInclude(r => r.RecipeModsIID)
|
|
|
|
|
.Include(r => r.Recipe.RecipeMod)
|
|
|
|
|
.ThenInclude(r => r.RecipeModsInt)
|
|
|
|
|
.Include(r => r.Recipe.RecipeMod)
|
|
|
|
|
.ThenInclude(r => r.RecipeModsString)
|
|
|
|
|
.Include(r => r.Recipe.RecipeRequirementsBool)
|
|
|
|
|
.Include(r => r.Recipe.RecipeRequirementsDID)
|
|
|
|
|
.Include(r => r.Recipe.RecipeRequirementsFloat)
|
|
|
|
|
.Include(r => r.Recipe.RecipeRequirementsIID)
|
|
|
|
|
.Include(r => r.Recipe.RecipeRequirementsInt)
|
|
|
|
|
.Include(r => r.Recipe.RecipeRequirementsString)
|
|
|
|
|
.FirstOrDefault(r => r.SourceWCID == sourceWeenieClassId && r.TargetWCID == targetWeenieClassId);
|
2018-12-29 10:15:51 -05:00
|
|
|
|
2020-03-02 08:03:50 -06:00
|
|
|
return result;
|
2018-12-29 10:15:51 -05:00
|
|
|
}
|
|
|
|
|
|
2021-06-12 14:15:42 -05:00
|
|
|
public virtual List<CookBook> GetAllCookbooks()
|
|
|
|
|
{
|
|
|
|
|
using (var context = new WorldDbContext())
|
|
|
|
|
{
|
|
|
|
|
context.CookBook.Load();
|
|
|
|
|
|
|
|
|
|
context.Recipe.Load();
|
|
|
|
|
|
|
|
|
|
context.RecipeMod.Load();
|
|
|
|
|
context.RecipeModsBool.Load();
|
|
|
|
|
context.RecipeModsDID.Load();
|
|
|
|
|
context.RecipeModsFloat.Load();
|
|
|
|
|
context.RecipeModsIID.Load();
|
|
|
|
|
context.RecipeModsInt.Load();
|
|
|
|
|
context.RecipeModsString.Load();
|
|
|
|
|
|
|
|
|
|
context.RecipeRequirementsBool.Load();
|
|
|
|
|
context.RecipeRequirementsDID.Load();
|
|
|
|
|
context.RecipeRequirementsFloat.Load();
|
|
|
|
|
context.RecipeRequirementsIID.Load();
|
|
|
|
|
context.RecipeRequirementsInt.Load();
|
|
|
|
|
context.RecipeRequirementsString.Load();
|
|
|
|
|
|
|
|
|
|
return context.CookBook.ToList();
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2020-03-02 08:03:50 -06:00
|
|
|
public CookBook GetCookbook(uint sourceWeenieClassId, uint targetWeenieClassId)
|
2018-12-29 10:15:51 -05:00
|
|
|
{
|
|
|
|
|
using (var context = new WorldDbContext())
|
|
|
|
|
{
|
2020-03-02 08:03:50 -06:00
|
|
|
context.ChangeTracker.QueryTrackingBehavior = QueryTrackingBehavior.NoTracking;
|
2018-02-19 16:38:22 -06:00
|
|
|
|
2020-03-02 08:03:50 -06:00
|
|
|
return GetCookbook(context, sourceWeenieClassId, targetWeenieClassId);
|
2018-10-09 10:52:00 -05:00
|
|
|
}
|
2017-10-21 13:32:06 -04:00
|
|
|
}
|
|
|
|
|
|
2020-03-02 08:03:50 -06:00
|
|
|
public List<CookBook> GetCookbooksByRecipeId(uint recipeId)
|
2020-02-12 03:31:38 -05:00
|
|
|
{
|
|
|
|
|
var results = new List<CookBook>();
|
|
|
|
|
|
2019-04-14 13:49:42 -04:00
|
|
|
using (var context = new WorldDbContext())
|
|
|
|
|
{
|
2020-03-02 08:03:50 -06:00
|
|
|
context.ChangeTracker.QueryTrackingBehavior = QueryTrackingBehavior.NoTracking;
|
2019-04-14 13:49:42 -04:00
|
|
|
|
2020-03-02 08:03:50 -06:00
|
|
|
var baseRecords = context.CookBook.Where(i => i.RecipeId == recipeId).ToList();
|
2018-10-09 10:52:00 -05:00
|
|
|
|
2020-03-02 08:03:50 -06:00
|
|
|
foreach (var baseRecord in baseRecords)
|
2018-10-09 10:52:00 -05:00
|
|
|
{
|
2020-03-02 08:03:50 -06:00
|
|
|
var cookbook = GetCookbook(context, baseRecord.SourceWCID, baseRecord.TargetWCID);
|
2018-10-09 10:52:00 -05:00
|
|
|
|
2020-03-02 08:03:50 -06:00
|
|
|
results.Add(cookbook);
|
|
|
|
|
}
|
2018-11-27 20:51:47 -06:00
|
|
|
}
|
2018-04-02 07:33:59 -05:00
|
|
|
|
2020-03-02 08:03:50 -06:00
|
|
|
return results;
|
2019-12-31 01:56:07 -05:00
|
|
|
}
|
|
|
|
|
|
2021-07-11 20:14:21 -04:00
|
|
|
// =====================================
|
|
|
|
|
// Recipe
|
|
|
|
|
// =====================================
|
|
|
|
|
|
|
|
|
|
public Recipe GetRecipe(uint recipeId)
|
|
|
|
|
{
|
|
|
|
|
using (var context = new WorldDbContext())
|
|
|
|
|
{
|
|
|
|
|
context.ChangeTracker.QueryTrackingBehavior = QueryTrackingBehavior.NoTracking;
|
|
|
|
|
|
|
|
|
|
return GetRecipe(context, recipeId);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public virtual Recipe GetRecipe(WorldDbContext context, uint recipeId)
|
|
|
|
|
{
|
|
|
|
|
var result = context.Recipe
|
|
|
|
|
.Include(r => r.RecipeMod)
|
|
|
|
|
.ThenInclude(r => r.RecipeModsBool)
|
|
|
|
|
.Include(r => r.RecipeMod)
|
|
|
|
|
.ThenInclude(r => r.RecipeModsDID)
|
|
|
|
|
.Include(r => r.RecipeMod)
|
|
|
|
|
.ThenInclude(r => r.RecipeModsFloat)
|
|
|
|
|
.Include(r => r.RecipeMod)
|
|
|
|
|
.ThenInclude(r => r.RecipeModsIID)
|
|
|
|
|
.Include(r => r.RecipeMod)
|
|
|
|
|
.ThenInclude(r => r.RecipeModsInt)
|
|
|
|
|
.Include(r => r.RecipeMod)
|
|
|
|
|
.ThenInclude(r => r.RecipeModsString)
|
|
|
|
|
.Include(r => r.RecipeRequirementsBool)
|
|
|
|
|
.Include(r => r.RecipeRequirementsDID)
|
|
|
|
|
.Include(r => r.RecipeRequirementsFloat)
|
|
|
|
|
.Include(r => r.RecipeRequirementsIID)
|
|
|
|
|
.Include(r => r.RecipeRequirementsInt)
|
|
|
|
|
.Include(r => r.RecipeRequirementsString)
|
|
|
|
|
.FirstOrDefault(r => r.Id == recipeId);
|
|
|
|
|
|
|
|
|
|
return result;
|
|
|
|
|
}
|
|
|
|
|
|
2018-04-17 08:56:21 -05:00
|
|
|
|
2020-03-02 08:03:50 -06:00
|
|
|
// =====================================
|
|
|
|
|
// Encounter
|
|
|
|
|
// =====================================
|
2018-04-02 07:33:59 -05:00
|
|
|
|
|
|
|
|
|
2020-03-02 08:03:50 -06:00
|
|
|
// =====================================
|
|
|
|
|
// Event
|
|
|
|
|
// =====================================
|
2018-04-02 09:55:55 -05:00
|
|
|
|
2018-10-09 10:52:00 -05:00
|
|
|
/// <summary>
|
|
|
|
|
/// This takes under 1 second to complete.
|
|
|
|
|
/// </summary>
|
2020-03-02 08:03:50 -06:00
|
|
|
public virtual List<Event> GetAllEvents(WorldDbContext context)
|
2018-04-23 13:28:27 -04:00
|
|
|
{
|
2020-03-02 08:03:50 -06:00
|
|
|
return context.Event
|
|
|
|
|
.ToList();
|
2018-04-23 13:28:27 -04:00
|
|
|
}
|
|
|
|
|
|
2018-10-09 10:52:00 -05:00
|
|
|
/// <summary>
|
|
|
|
|
/// This takes under 1 second to complete.
|
|
|
|
|
/// </summary>
|
2018-04-23 13:28:27 -04:00
|
|
|
public List<Event> GetAllEvents()
|
|
|
|
|
{
|
|
|
|
|
using (var context = new WorldDbContext())
|
|
|
|
|
{
|
2020-03-02 08:03:50 -06:00
|
|
|
context.ChangeTracker.QueryTrackingBehavior = QueryTrackingBehavior.NoTracking;
|
2018-04-23 13:28:27 -04:00
|
|
|
|
2020-03-02 08:03:50 -06:00
|
|
|
return GetAllEvents(context);
|
2018-04-23 13:28:27 -04:00
|
|
|
}
|
|
|
|
|
}
|
2018-05-30 12:30:07 -04:00
|
|
|
|
|
|
|
|
|
2020-03-02 08:03:50 -06:00
|
|
|
// =====================================
|
|
|
|
|
// HousePortal
|
|
|
|
|
// =====================================
|
2018-05-30 12:30:07 -04:00
|
|
|
|
|
|
|
|
|
2020-03-02 08:03:50 -06:00
|
|
|
// =====================================
|
|
|
|
|
// LandblockInstance
|
|
|
|
|
// =====================================
|
2018-05-30 12:30:07 -04:00
|
|
|
|
2020-03-02 08:03:50 -06:00
|
|
|
public LandblockInstance GetLandblockInstanceByGuid(WorldDbContext context, uint guid)
|
|
|
|
|
{
|
|
|
|
|
return context.LandblockInstance
|
|
|
|
|
.Include(r => r.LandblockInstanceLink)
|
|
|
|
|
.FirstOrDefault(r => r.Guid == guid);
|
2018-10-09 10:52:00 -05:00
|
|
|
}
|
|
|
|
|
|
2020-03-02 08:03:50 -06:00
|
|
|
public LandblockInstance GetLandblockInstanceByGuid(uint guid)
|
2018-10-09 10:52:00 -05:00
|
|
|
{
|
|
|
|
|
using (var context = new WorldDbContext())
|
|
|
|
|
{
|
2020-03-02 08:03:50 -06:00
|
|
|
context.ChangeTracker.QueryTrackingBehavior = QueryTrackingBehavior.NoTracking;
|
2018-05-30 12:30:07 -04:00
|
|
|
|
2020-03-02 08:03:50 -06:00
|
|
|
return GetLandblockInstanceByGuid(context, guid);
|
2018-10-09 10:52:00 -05:00
|
|
|
}
|
2018-05-30 12:30:07 -04:00
|
|
|
}
|
|
|
|
|
|
2020-03-02 08:03:50 -06:00
|
|
|
public List<LandblockInstance> GetLandblockInstancesByWcid(WorldDbContext context, uint wcid)
|
2018-05-30 12:30:07 -04:00
|
|
|
{
|
2020-03-02 08:03:50 -06:00
|
|
|
return context.LandblockInstance
|
|
|
|
|
.Include(r => r.LandblockInstanceLink)
|
|
|
|
|
.Where(i => i.WeenieClassId == wcid)
|
|
|
|
|
.ToList();
|
2018-05-30 12:30:07 -04:00
|
|
|
}
|
2018-10-09 10:52:00 -05:00
|
|
|
|
2020-03-02 08:03:50 -06:00
|
|
|
public List<LandblockInstance> GetLandblockInstancesByWcid(uint wcid)
|
2018-10-09 10:52:00 -05:00
|
|
|
{
|
|
|
|
|
using (var context = new WorldDbContext())
|
|
|
|
|
{
|
2020-03-02 08:03:50 -06:00
|
|
|
context.ChangeTracker.QueryTrackingBehavior = QueryTrackingBehavior.NoTracking;
|
2018-10-09 10:52:00 -05:00
|
|
|
|
2020-03-02 08:03:50 -06:00
|
|
|
return GetLandblockInstancesByWcid(context, wcid);
|
2018-10-09 10:52:00 -05:00
|
|
|
}
|
|
|
|
|
}
|
2018-10-13 03:57:04 -04:00
|
|
|
|
2019-04-21 00:01:12 -07:00
|
|
|
|
2020-03-02 08:03:50 -06:00
|
|
|
// =====================================
|
|
|
|
|
// PointsOfInterest
|
|
|
|
|
// =====================================
|
2019-04-21 00:01:12 -07:00
|
|
|
|
|
|
|
|
|
2020-03-02 08:03:50 -06:00
|
|
|
// =====================================
|
|
|
|
|
// Quest
|
|
|
|
|
// =====================================
|
2019-04-21 00:01:12 -07:00
|
|
|
|
|
|
|
|
|
2020-03-02 08:03:50 -06:00
|
|
|
// =====================================
|
|
|
|
|
// Spell
|
|
|
|
|
// =====================================
|
2019-04-21 00:01:12 -07:00
|
|
|
|
2020-03-02 08:03:50 -06:00
|
|
|
public Dictionary<uint, string> GetAllSpellNames(WorldDbContext context)
|
2019-04-21 00:01:12 -07:00
|
|
|
{
|
2020-03-02 08:03:50 -06:00
|
|
|
return context.Spell
|
|
|
|
|
.ToDictionary(r => r.Id, r => r.Name);
|
2019-04-21 00:01:12 -07:00
|
|
|
}
|
|
|
|
|
|
2020-03-02 08:03:50 -06:00
|
|
|
public Dictionary<uint, string> GetAllSpellNames()
|
2019-04-21 00:01:12 -07:00
|
|
|
{
|
|
|
|
|
using (var context = new WorldDbContext())
|
|
|
|
|
{
|
2020-03-02 08:03:50 -06:00
|
|
|
context.ChangeTracker.QueryTrackingBehavior = QueryTrackingBehavior.NoTracking;
|
2019-04-21 00:01:12 -07:00
|
|
|
|
2020-03-02 08:03:50 -06:00
|
|
|
return GetAllSpellNames(context);
|
2019-04-21 00:01:12 -07:00
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
2020-03-02 08:03:50 -06:00
|
|
|
// =====================================
|
|
|
|
|
// TreasureDeath
|
|
|
|
|
// =====================================
|
2018-10-13 03:57:04 -04:00
|
|
|
|
2020-03-02 08:03:50 -06:00
|
|
|
public Dictionary<uint, TreasureDeath> GetAllTreasureDeath(WorldDbContext context)
|
2020-02-12 12:45:27 -05:00
|
|
|
{
|
2020-03-02 08:03:50 -06:00
|
|
|
return context.TreasureDeath
|
|
|
|
|
.ToDictionary(r => r.TreasureType, r => r);
|
2020-02-12 12:45:27 -05:00
|
|
|
}
|
|
|
|
|
|
2020-03-02 08:03:50 -06:00
|
|
|
public Dictionary<uint, TreasureDeath> GetAllTreasureDeath()
|
2018-10-13 03:57:04 -04:00
|
|
|
{
|
|
|
|
|
using (var context = new WorldDbContext())
|
|
|
|
|
{
|
2020-03-02 08:03:50 -06:00
|
|
|
context.ChangeTracker.QueryTrackingBehavior = QueryTrackingBehavior.NoTracking;
|
2018-10-13 03:57:04 -04:00
|
|
|
|
2020-03-02 08:03:50 -06:00
|
|
|
return GetAllTreasureDeath(context);
|
2018-10-13 03:57:04 -04:00
|
|
|
}
|
|
|
|
|
}
|
2019-07-01 03:36:56 -04:00
|
|
|
|
2020-02-27 15:04:08 -05:00
|
|
|
|
2020-03-02 08:03:50 -06:00
|
|
|
// =====================================
|
|
|
|
|
// TreasureMaterial
|
|
|
|
|
// =====================================
|
2020-02-27 15:04:08 -05:00
|
|
|
|
2019-07-01 03:36:56 -04:00
|
|
|
|
2020-03-02 08:03:50 -06:00
|
|
|
// =====================================
|
|
|
|
|
// TreasureWielded
|
|
|
|
|
// =====================================
|
2019-07-01 03:36:56 -04:00
|
|
|
|
|
|
|
|
public Dictionary<uint, List<TreasureWielded>> GetAllTreasureWielded(WorldDbContext context)
|
|
|
|
|
{
|
2020-03-02 08:03:50 -06:00
|
|
|
var results = context.TreasureWielded;
|
2019-07-01 03:36:56 -04:00
|
|
|
|
|
|
|
|
var treasure = new Dictionary<uint, List<TreasureWielded>>();
|
|
|
|
|
|
|
|
|
|
foreach (var record in results)
|
|
|
|
|
{
|
|
|
|
|
if (!treasure.ContainsKey(record.TreasureType))
|
|
|
|
|
treasure.Add(record.TreasureType, new List<TreasureWielded>());
|
|
|
|
|
|
|
|
|
|
treasure[record.TreasureType].Add(record);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return treasure;
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public Dictionary<uint, List<TreasureWielded>> GetAllTreasureWielded()
|
|
|
|
|
{
|
|
|
|
|
using (var context = new WorldDbContext())
|
2020-03-02 08:03:50 -06:00
|
|
|
{
|
|
|
|
|
context.ChangeTracker.QueryTrackingBehavior = QueryTrackingBehavior.NoTracking;
|
|
|
|
|
|
2019-07-01 03:36:56 -04:00
|
|
|
return GetAllTreasureWielded(context);
|
2020-03-02 08:03:50 -06:00
|
|
|
}
|
2019-07-01 03:36:56 -04:00
|
|
|
}
|
2019-07-08 11:49:08 -05:00
|
|
|
|
2020-03-02 08:03:50 -06:00
|
|
|
|
|
|
|
|
// =====================================
|
|
|
|
|
// Version
|
|
|
|
|
// =====================================
|
|
|
|
|
|
2019-07-08 11:49:08 -05:00
|
|
|
/// <summary>
|
|
|
|
|
/// Get the version information stored in database
|
|
|
|
|
/// </summary>
|
2020-03-02 08:03:50 -06:00
|
|
|
public ACE.Database.Models.World.Version GetVersion(WorldDbContext context)
|
2019-07-08 11:49:08 -05:00
|
|
|
{
|
|
|
|
|
var version = context.Version
|
|
|
|
|
.FirstOrDefault(r => r.Id == 1);
|
|
|
|
|
|
|
|
|
|
return version;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// Get the version information stored in database
|
|
|
|
|
/// </summary>
|
2020-03-02 08:03:50 -06:00
|
|
|
public ACE.Database.Models.World.Version GetVersion()
|
2019-07-08 11:49:08 -05:00
|
|
|
{
|
|
|
|
|
using (var context = new WorldDbContext())
|
2020-03-02 08:03:50 -06:00
|
|
|
{
|
|
|
|
|
context.ChangeTracker.QueryTrackingBehavior = QueryTrackingBehavior.NoTracking;
|
|
|
|
|
|
2019-07-08 11:49:08 -05:00
|
|
|
return GetVersion(context);
|
2020-03-02 08:03:50 -06:00
|
|
|
}
|
2019-07-08 11:49:08 -05:00
|
|
|
}
|
2021-01-16 16:24:42 -05:00
|
|
|
|
|
|
|
|
// =====================================
|
|
|
|
|
// IsWorldDatabaseGuidRangeValid
|
|
|
|
|
// =====================================
|
|
|
|
|
|
|
|
|
|
public bool IsWorldDatabaseGuidRangeValid(WorldDbContext context)
|
|
|
|
|
{
|
|
|
|
|
return context.LandblockInstance.FirstOrDefault(i => i.Guid >= 0x80000000) == null;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public bool IsWorldDatabaseGuidRangeValid()
|
|
|
|
|
{
|
|
|
|
|
using (var context = new WorldDbContext())
|
|
|
|
|
{
|
|
|
|
|
context.ChangeTracker.QueryTrackingBehavior = QueryTrackingBehavior.NoTracking;
|
|
|
|
|
|
|
|
|
|
return IsWorldDatabaseGuidRangeValid(context);
|
|
|
|
|
}
|
|
|
|
|
}
|
2017-02-07 00:34:00 -05:00
|
|
|
}
|
|
|
|
|
}
|