AlchemyStoneResponse() public static méthode

public static AlchemyStoneResponse ( bool isSuccess, System.Global sItem ) : byte[]
isSuccess bool
sItem System.Global
Résultat byte[]
Exemple #1
0
        public void AlchemyStoneResponse()
        {
            try
            {
                Random rnd     = new Random();
                int    random  = rnd.Next(1, 100);
                bool   success = true;
                LoadBluesid(this.Character.Alchemy.ItemList[0].dbID);
                if (random <= 70)
                {
                    success = true;
                }
                else
                {
                    success = false;
                }

                if (success)
                {
                    if (Data.ItemBlue[this.Character.Alchemy.ItemList[0].dbID].totalblue <= Data.ItemBase[this.Character.Alchemy.ItemList[0].ID].MaxBlueAmount)
                    {
                        Random blue  = new Random();
                        int    min   = Data.MagicOptions.Find(aa => (aa.Name == Data.ItemBase[this.Character.Alchemy.ItemList[1].ID].ObjectName) && aa.Level == GetItemDegree(this.Character.Alchemy.ItemList[0]) + 1).MinValue;
                        int    max   = Data.MagicOptions.Find(aa => (aa.Name == Data.ItemBase[this.Character.Alchemy.ItemList[1].ID].ObjectName) && aa.Level == GetItemDegree(this.Character.Alchemy.ItemList[0]) + 1).MaxValue;
                        int    value = blue.Next(min, max);
                        if (Data.ItemBlue[this.Character.Alchemy.ItemList[0].dbID].blue.Contains(Data.ItemBase[this.Character.Alchemy.ItemList[1].ID].ObjectName))
                        {
                            int index = Data.ItemBlue[this.Character.Alchemy.ItemList[0].dbID].blue.IndexOf(Data.ItemBase[this.Character.Alchemy.ItemList[1].ID].ObjectName);
                            index++;
                            MsSQL.UpdateData("UPDATE char_items SET blue" + index + "amount='" + value + "' WHERE id='" + this.Character.Alchemy.ItemList[0].dbID + "'");
                        }
                        else
                        {
                            Data.ItemBlue[this.Character.Alchemy.ItemList[0].dbID].totalblue++;
                            MsSQL.UpdateData("UPDATE char_items SET BlueAmount='" + Data.ItemBlue[this.Character.Alchemy.ItemList[0].dbID].totalblue + "',blue" + Data.ItemBlue[this.Character.Alchemy.ItemList[0].dbID].totalblue + "='" + Data.ItemBase[this.Character.Alchemy.ItemList[1].ID].ObjectName + "',blue" + Data.ItemBlue[this.Character.Alchemy.ItemList[0].dbID].totalblue + "amount='" + value + "' WHERE id='" + this.Character.Alchemy.ItemList[0].dbID + "'");
                        }
                    }
                    else
                    {
                        return;
                    }
                }

                LoadBluesid(this.Character.Alchemy.ItemList[0].dbID);
                if (Data.ItemBlue[this.Character.Alchemy.ItemList[0].dbID].blue.Contains("MATTR_DUR"))
                {
                    this.Character.Alchemy.ItemList[0].Durability += this.Character.Alchemy.ItemList[0].Durability * (Convert.ToInt32(Data.ItemBlue[this.Character.Alchemy.ItemList[0].dbID].blue[Data.ItemBlue[this.Character.Alchemy.ItemList[0].dbID].blue.IndexOf("MATTR_DUR")]) / 100);
                }
                if (Data.ItemBlue[this.Character.Alchemy.ItemList[0].dbID].blue.Contains("MATTR_REINFORCE_ITEM"))
                {
                    this.Character.Alchemy.ItemList[0].PlusValue += Convert.ToByte(Data.ItemBlue[this.Character.Alchemy.ItemList[0].dbID].blue[Data.ItemBlue[this.Character.Alchemy.ItemList[0].dbID].blue.IndexOf("MATTR_REINFORCE_ITEM")]);
                }
                MsSQL.InsertData("UPDATE char_items SET durability='" + this.Character.Alchemy.ItemList[0].Durability + "',plusvalue='" + this.Character.Alchemy.ItemList[0].PlusValue + "' WHERE id='" + this.Character.Alchemy.ItemList[0].dbID + "'");
                this.client.Send(Packet.AlchemyStoneResponse(success, this.Character.Alchemy.ItemList[0]));
                MsSQL.InsertData("DELETE FROM char_items WHERE slot='" + this.Character.Alchemy.ItemList[1].Slot + "' AND owner='" + this.Character.Information.CharacterID + "'");
                this.client.Send(Packet.MoveItem(0x0F, this.Character.Alchemy.ItemList[1].Slot, 0, 0, 0, "DELETE_ITEM"));
            }
            catch (Exception ex)
            {
                Console.WriteLine("Alchemy Terminated...");
                Systems.Debugger.Write(ex);
            }
        }