Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- case "ritems":
- {
- List<uint> ITEMS = new List<uint>() { 730006, 194725 };
- string dbLocation = Program.ServerConfig.DbLocation + "\\PlayersItems\\";
- var tasks = new List<Task>();
- foreach (string fname in System.IO.Directory.GetFiles(dbLocation))
- {
- uint clientUID = uint.Parse(System.IO.Path.GetFileName(fname).Replace(".bin", ""));
- tasks.Add(Task.Run(() =>
- {
- Client.GameClient client = new Client.GameClient(null);
- client.Player.UID = clientUID;
- client.Inventory = new Role.Instance.Inventory(client);
- client.Equipment = new Role.Instance.Equip(client);
- client.Warehouse = new Role.Instance.Warehouse(client);
- //client.MyWardrobe = new Role.Instance.Wardrobe(client);
- Database.ServerDatabase.LoadClientItems(client);
- var list = client.Equipment.ClientItems.Values.ToList();
- foreach (var item in list)
- {
- if (ITEMS.Contains(item.ITEM_ID))
- {
- client.Equipment.ClientItems.Remove(item.UID);
- }
- }
- foreach (var a in client.Warehouse.ClientItems)
- {
- foreach (var b in a.Value.Values)
- {
- if (ITEMS.Contains(b.ITEM_ID))
- {
- client.Warehouse.ClientItems[a.Key].Remove(b.UID);
- }
- }
- }
- //for (int i = 0; i < 2; i++)
- //{
- // list = client.MyWardrobe.Items[i].Values.ToList();
- // foreach (var b in list)
- // {
- // if (ITEMS.Contains(b.ITEM_ID))
- // {
- // client.MyWardrobe.Items[i].Remove(b.UID);
- // }
- // }
- //}
- list = client.Inventory.ClientItems.Values.ToList();
- foreach (var item in list)
- {
- if (ITEMS.Contains(item.ITEM_ID))
- {
- client.Inventory.ClientItems.Remove(item.UID);
- }
- }
- Database.ServerDatabase.SaveClientItems(client);
- Console.WriteLine($"Done Restart Items for UID: {clientUID}", ConsoleColor.DarkRed);
- }));
- }
- Task.WaitAll(tasks.ToArray());
- Console.WriteLine("All tasks completed.", ConsoleColor.DarkGreen);
- break;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement