Beispiel #1
0
        public override void Tick(RealmTime time)
        {
            base.Tick(time);

            foreach (var i in vaultChests)
            {
                if (i.Key.Item1.UpdateCount > i.Value)
                {
                    int count = 0;
                    try
                    {
                        foreach (var plr in Players.Values)
                        {
                            count++;
                            if (count > 1)
                            {
                                plr.Client.Disconnect();
                            }
                            i.Key.Item2._Items =
                                Utils.GetCommaSepString(
                                    i.Key.Item1.Inventory.Take(8).Select(_ => _ == null ? 65535 : _.ObjectType).ToArray());
                            i.Key.Item2._Datas =
                                ItemDataList.GetJson(
                                    i.Key.Item1.Inventory.Data.Take(8).ToArray());
                            plr.Client.AddDatabaseOpperation(db => db.SaveChest(client.Account, i.Key.Item2));
                            vaultChests[i.Key] = i.Key.Item1.UpdateCount;
                        }
                    } catch { }
                }
            }
        }
Beispiel #2
0
        public override void Tick(RealmTime time)
        {
            base.Tick(time);

            foreach (var i in vaultChests)
            {
                if (i.Key.Item1.UpdateCount > i.Value)
                {
                    i.Key.Item2._Items =
                        Utils.GetCommaSepString(
                            i.Key.Item1.Inventory.Take(8).Select(_ => _?.ObjectType ?? 65535).ToArray());
                    i.Key.Item2._Datas =
                        ItemDataList.GetJson(
                            i.Key.Item1.Inventory.Data.Take(8).ToArray());
                    Manager.Data.AddDatabaseOperation(db =>
                    {
                        db.SaveChest(client.Account, i.Key.Item2);
                    });
                    vaultChests[i.Key] = i.Key.Item1.UpdateCount;
                }
            }
        }