Esempio n. 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();
                }
            }
        }
Esempio n. 2
0
 public Pet(Core.Inventory.Item informations, DataClass datas, AccountUC uc)
 {
     FoodList     = new List <Food>();
     Informations = informations;
     Datas        = datas;
     account      = uc;
     Set();
 }
Esempio n. 3
0
 public static void InventoryContentAndPresetMessageTreatment(Message message, byte[] packetDatas, AccountUC account)
 {
     InventoryContentAndPresetMessage msg = (InventoryContentAndPresetMessage)message;
     using (BigEndianReader reader = new BigEndianReader(packetDatas))
     {
         msg.Deserialize(reader);
     }
     foreach (ObjectItem item in msg.objects)
     {
         Core.Inventory.Item i = new Core.Inventory.Item(item.Effects.ToList(), item.ObjectGID, item.Position, item.Quantity, item.ObjectUID, account);
         account.Inventory.Items.Add(i);
     }
     account.ActualizeInventory();
     account.petsList = new List<Pet>();
     foreach (Core.Inventory.Item item in account.Inventory.Items)
     {
         DataClass itemData = GameData.GetDataObject(D2oFileEnum.Items, item.GID);
         if ((int)itemData.Fields["typeId"] == 18)
         {
             Pet pet = new Pet(item, itemData, account);
             account.petsList.Add(pet);
             pet.SetFood();
         }
     }
     account.Log(new BotTextInformation("Vos " +
     account.petsList.Count + " familiers vous font un gros bisou de la part de BlueSheep."), 5);
     if (!account.IsMITM)
     {
         FriendsGetListMessage friendGetListMessage = new FriendsGetListMessage();
         account.SocketManager.Send(friendGetListMessage);
         IgnoredGetListMessage ignoredGetListMessage = new IgnoredGetListMessage();
         account.SocketManager.Send(ignoredGetListMessage);
         SpouseGetInformationsMessage spouseGetInformationsMessage = new SpouseGetInformationsMessage();
         account.SocketManager.Send(spouseGetInformationsMessage);
         Random random = new Random();
         const string hexChars = "0123456789ABCDEF";
         string key = string.Empty;
         for (int index = 0; index < 20; index++)
         {
             int randomValue = random.Next(100);
             if (randomValue <= 40)
                 key += (char)(random.Next(26) + 65);
             else if (randomValue <= 80)
                 key += (char)(random.Next(26) + 97);
             else
                 key += (char)(random.Next(10) + 48);
         }
         int pos = key.Sum(t => t % 16);
         key += hexChars[pos % 16];
         ClientKeyMessage clientKeyMessage = new ClientKeyMessage(key);
         account.SocketManager.Send(clientKeyMessage);
         GameContextCreateRequestMessage gameContextCreateRequestMessage = new GameContextCreateRequestMessage();
         account.SocketManager.Send(gameContextCreateRequestMessage);
         ChannelEnablingMessage channelEnablingMessage = new ChannelEnablingMessage((sbyte)7, false);
         account.SocketManager.Send(channelEnablingMessage);
     }
 }
Esempio n. 4
0
 public Food(Core.Inventory.Item informations, DataClass datas)
 {
     Informations = informations;
     Datas        = datas;
 }
Esempio n. 5
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.ToList(), item.ObjectGID, item.Position, item.Quantity, 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();
     }
 }
Esempio n. 6
0
        public static void InventoryContentAndPresetMessageTreatment(Message message, byte[] packetDatas, AccountUC account)
        {
            InventoryContentAndPresetMessage msg = (InventoryContentAndPresetMessage)message;

            using (BigEndianReader reader = new BigEndianReader(packetDatas))
            {
                msg.Deserialize(reader);
            }
            foreach (ObjectItem item in msg.Objects)
            {
                Core.Inventory.Item i = new Core.Inventory.Item(item.Effects.ToList(), item.ObjectGID, item.Position, (int)item.Quantity, (int)item.ObjectUID, account);
                account.Inventory.Items.Add(i);
            }
            account.ActualizeInventory();
            account.petsList = new List <Pet>();
            foreach (Core.Inventory.Item item in account.Inventory.Items)
            {
                DataClass itemData = GameData.GetDataObject(D2oFileEnum.Items, item.GID);
                if ((int)itemData.Fields["typeId"] == 18)
                {
                    Pet pet = new Pet(item, itemData, account);
                    account.petsList.Add(pet);
                    pet.SetFood();
                }
            }
            account.Log(new BotTextInformation("Vos " +
                                               account.petsList.Count + " familiers vous font un gros bisou de la part de BlueSheep."), 5);
            if (!account.IsMITM)
            {
                FriendsGetListMessage friendGetListMessage = new FriendsGetListMessage();
                account.SocketManager.Send(friendGetListMessage);
                IgnoredGetListMessage ignoredGetListMessage = new IgnoredGetListMessage();
                account.SocketManager.Send(ignoredGetListMessage);
                SpouseGetInformationsMessage spouseGetInformationsMessage = new SpouseGetInformationsMessage();
                account.SocketManager.Send(spouseGetInformationsMessage);
                Random       random   = new Random();
                const string hexChars = "0123456789ABCDEF";
                string       key      = string.Empty;
                for (int index = 0; index < 20; index++)
                {
                    int randomValue = random.Next(100);
                    if (randomValue <= 40)
                    {
                        key += (char)(random.Next(26) + 65);
                    }
                    else if (randomValue <= 80)
                    {
                        key += (char)(random.Next(26) + 97);
                    }
                    else
                    {
                        key += (char)(random.Next(10) + 48);
                    }
                }
                int pos = key.Sum(t => t % 16);
                key += hexChars[pos % 16];
                ClientKeyMessage clientKeyMessage = new ClientKeyMessage(key);
                account.SocketManager.Send(clientKeyMessage);
                GameContextCreateRequestMessage gameContextCreateRequestMessage = new GameContextCreateRequestMessage();
                account.SocketManager.Send(gameContextCreateRequestMessage);
                ChannelEnablingMessage channelEnablingMessage = new ChannelEnablingMessage(7, false);
                account.SocketManager.Send(channelEnablingMessage);
            }
        }
Esempio n. 7
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.ToList(), item.ObjectGID, item.Position, item.Quantity, 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 (account.Running != null)
     {
         foreach (Pet pet in account.petsList)
             pet.SetFood();
     }
 }