AlchemyResponse() публичный статический Метод

public static AlchemyResponse ( bool isSuccess, System.Global sItem, byte type, byte totalblue ) : byte[]
isSuccess bool
sItem System.Global
type byte
totalblue byte
Результат byte[]
Пример #1
0
        public void AlchemyElixirResponse()
        {
            try
            {
                int    chance  = 0;
                bool   success = false;
                Random plus    = new Random();
                int    random  = plus.Next(0, this.Character.Blues.Luck); // Luck's default value = 100
                // successrate table
                switch (this.Character.Alchemy.ItemList[0].PlusValue)
                {
                case 0: chance = this.Character.Blues.Luck - 95;
                    break;

                case 1: chance = this.Character.Blues.Luck - 75;
                    break;

                case 2: chance = this.Character.Blues.Luck - 63;
                    break;

                case 3: chance = this.Character.Blues.Luck - 50;
                    break;

                case 4: chance = this.Character.Blues.Luck - 38;
                    break;

                case 5: chance = this.Character.Blues.Luck - 31;
                    break;

                case 6: chance = this.Character.Blues.Luck - 27;
                    break;

                case 7: chance = this.Character.Blues.Luck - 21;
                    break;

                case 8: chance = this.Character.Blues.Luck - 13;
                    break;

                case 9: chance = this.Character.Blues.Luck - 8;
                    break;

                default: chance = this.Character.Blues.Luck - 5;
                    break;
                }

                // if with lucky
                if (this.Character.Alchemy.ItemList.Count == 3)
                {
                    chance -= 5; // +5% :))
                    // dec lucky powder amount
                    this.Character.Alchemy.ItemList[2].Amount--;
                    ItemUpdateAmount(this.Character.Alchemy.ItemList[2], this.Character.Information.CharacterID);
                }
                // success or not :P
                if (random > chance)
                {
                    success = true;
                }
                // update plus value
                if (success)
                {
                    this.Character.Alchemy.ItemList[0].PlusValue++;
                    MsSQL.InsertData("UPDATE char_items SET plusvalue='" + this.Character.Alchemy.ItemList[0].PlusValue + "' WHERE slot='" + this.Character.Alchemy.ItemList[0].Slot + "' AND owner='" + this.Character.Information.CharacterID + "'");
                }
                else
                {
                    if (this.Character.Alchemy.ItemList[0].PlusValue >= 4)
                    {
                        if (Data.ItemBlue[this.Character.Alchemy.ItemList[0].dbID].blue.Contains("MATTR_ASTRAL"))
                        {
                            this.Character.Alchemy.ItemList[0].PlusValue = 4;
                        }
                        else
                        {
                            this.Character.Alchemy.ItemList[0].PlusValue = 0;
                        }
                    }
                    else
                    {
                        this.Character.Alchemy.ItemList[0].PlusValue = 0;
                    }
                    MsSQL.InsertData("UPDATE char_items SET plusvalue='0' WHERE slot ='" + this.Character.Alchemy.ItemList[0].Slot + "' AND owner='" + this.Character.Information.CharacterID + "'");
                }
                this.client.Send(Packet.AlchemyResponse(success, this.Character.Alchemy.ItemList[0], 1, Convert.ToByte(Data.ItemBlue[this.Character.Alchemy.ItemList[0].dbID].totalblue)));
                //delete elixir
                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 Error: {0}", ex);
                Systems.Debugger.Write(ex);
            }
        }