public GameAccount(DBGameAccount dbGameAccount) : base(dbGameAccount.Id) { DBGameAccount = dbGameAccount; DBGameAccount.LastOnline = (long)DateTime.Now.ToExtendedEpoch(); SetField(); }
public static GameAccount GetGameAccountByDBGameAccount(DBGameAccount dbGameAccount) { if (!LoadedGameAccounts.Any(acc => acc.DBGameAccount.Id == dbGameAccount.Id)) { LoadedGameAccounts.Add(new GameAccount(dbGameAccount)); } return(LoadedGameAccounts.Single(acc => acc.DBGameAccount.Id == dbGameAccount.Id)); }
public static GameAccount CreateGameAccount(Account account) { var newDBGameAccount = new DBGameAccount { DBAccount = DBSessions.AccountSession.Get <DBAccount>(account.PersistentID) }; DBSessions.AccountSession.SaveOrUpdate(newDBGameAccount); DBSessions.AccountSession.Flush(); return(GetGameAccountByDBGameAccount(newDBGameAccount)); }
public static GameAccount CreateGameAccount(Account account) { var newDBGameAccount = new DBGameAccount { DBAccount = DBSessions.AccountSession.Get <DBAccount>(account.PersistentID), StashSize = Mooege.Net.GS.Config.Instance.StarterStash, // Stash size when you create a game account. [Necrosummon] Gold = Mooege.Net.GS.Config.Instance.StarterGold // Starter gold when you create a game account. [Necrosummon] }; DBSessions.AccountSession.SaveOrUpdate(newDBGameAccount); DBSessions.AccountSession.Flush(); return(GetGameAccountByDBGameAccount(newDBGameAccount)); }
private void SaveItemToDB(DBGameAccount dbGameAccount, DBToon dbToon, EquipmentSlotId slotId, Item item) { if (item == null) { return; } if (item.DBInventory == null) { item.DBInventory = new DBInventory(); } item.DBInventory.DBGameAccount = dbGameAccount; item.DBInventory.DBToon = dbToon; item.DBInventory.LocationX = item.InventoryLocation.X; item.DBInventory.LocationY = item.InventoryLocation.Y; item.DBInventory.EquipmentSlot = (int)slotId; item.DBInventory.ItemId = item.GBHandle.GBID; DBSessions.AccountSession.SaveOrUpdate(item.DBInventory); }
private void SaveItemToDB(DBGameAccount dbGameAccount, DBToon dbToon, bool hardcore, EquipmentSlotId slotId, Item item) { if (item == null) { return; } if (item.DBInventory == null) { item.DBInventory = new DBInventory(); } item.DBInventory.DBGameAccount = dbGameAccount; item.DBInventory.DBToon = dbToon; item.DBInventory.Hardcore = hardcore; item.DBInventory.LocationX = item.InventoryLocation.X; item.DBInventory.LocationY = item.InventoryLocation.Y; item.DBInventory.EquipmentSlot = (int)slotId; ItemGenerator.SaveToDB(item); item.DBInventory.DBItemInstance = item.DBItemInstance; DBSessions.AccountSession.SaveOrUpdate(item.DBInventory); }