示例#1
0
 public GameAccount(DBGameAccount dbGameAccount)
     : base(dbGameAccount.Id)
 {
     DBGameAccount            = dbGameAccount;
     DBGameAccount.LastOnline = (long)DateTime.Now.ToExtendedEpoch();
     SetField();
 }
示例#2
0
 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));
 }
示例#3
0
        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));
        }
示例#4
0
        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));
        }
示例#5
0
        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);
        }
示例#6
0
        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);
        }