Beispiel #1
0
        public static void ObjectAddedMessageTreatment(Message message, byte[] packetDatas, AccountUC account)
        {
            ObjectAddedMessage msg = (ObjectAddedMessage)message;

            using (BigEndianReader reader = new BigEndianReader(packetDatas))
            {
                msg.Deserialize(reader);
            }
            ObjectItem item = msg.Object;

            Core.Inventory.Item i = new Core.Inventory.Item(item.Effects, item.ObjectGID, item.Position, (int)item.Quantity, (int)item.ObjectUID, account);
            account.Inventory.Items.Add(i);
            string[] row1 = { i.GID.ToString(), i.UID.ToString(), i.Name, i.Quantity.ToString(), i.Type.ToString(), i.Price.ToString() };
            System.Windows.Forms.ListViewItem li = new System.Windows.Forms.ListViewItem(row1);
            li.ToolTipText = i.Description;
            account.AddItem(li, account.LVItems);
            if (i.Type == "Sac de ressource")
            {
                foreach (JobUC uc in account.JobsUC)
                {
                    if (uc.OpenBagCb.Checked)
                    {
                        account.Inventory.UseItem(i.UID);
                        account.Log(new ActionTextInformation("Ouverture automatique d'un sac de récolte : " + i.Name), 2);
                    }
                }
            }
            if (account.Running != null)
            {
                foreach (Pet pet in account.petsList)
                {
                    pet.SetFood();
                }
            }
        }