Exemplo n.º 1
0
        private void itemsToolStripMenuItem_Click(object sender, EventArgs e)
        {
            int u = 0;


            foreach (var NewItem in EditEnvir.ItemInfoList)
            {
                ItemInfo OldItem = Envir.ItemInfoList.Find(x => x.Index == NewItem.Index);
                if (OldItem != null)
                {
                    OldItem.UpdateItem(NewItem);
                }
                else
                {
                    ItemInfo CloneItem = ItemInfo.CloneItem(NewItem);
                    Envir.ItemInfoList.Add(CloneItem);
                    u++;
                }
            }

            SMain.Enqueue("[Item DataBase] total items :" + Envir.ItemInfoList.Count.ToString());
            SMain.Enqueue("[Item DataBase] " + (Envir.ItemInfoList.Count - u).ToString() + " has been updated");
            SMain.Enqueue("[Item DataBase] " + u.ToString() + " has been added");

            /*
             * foreach (var c in Envir.Connections)// update all info on players items
             * {
             *  if (!c.Connected) continue;
             *
             *  foreach (var i in c.SentItemInfo)
             *  {
             *      var ni = new S.UpdateItemInfo { Info = i };
             *      //get name for updatetoname
             *      if (ni.Info.UpdateTo > 0)
             *          ni.updateto = Envir.GetItemInfo(ni.Info.UpdateTo).FriendlyName;
             *
             *      c.Enqueue(ni);
             *
             *  }
             * }
             */

            foreach (var p in Envir.Players) // refresh all existing players stats
            {
                if (p.Info == null)
                {
                    continue;
                }

                p.RefreshStats();
                p.Enqueue(new S.RefreshStats());
            }
        }