コード例 #1
0
ファイル: GameEngine.cs プロジェクト: quop/xiah-gcf-emulator
        public void RedImbue(Equipment Item, ImbueStat stat, ref int value, bool success, ref ImbueError error)
        {
            if (success)
            {
                error = ImbueError.Success;
            }
            else
            {
                error = ImbueError.FailedToRemake;
                if (PercentSuccess(30))
                {
                    value *= -1;
                }
                else
                {
                    value *= 0;
                }
            }

            switch (stat)
            {
            case ImbueStat.RequiredLevel:
                if (Item.RequiredLevel >= -value)
                {
                    Item.RequiredLevel += (short)value;
                }
                else
                {
                    Item.RequiredLevel = 0;
                }
                return;

            case ImbueStat.RequiredStrength:
                if (Item.RequiredStrength >= -value)
                {
                    Item.RequiredStrength += (short)value;
                }
                else
                {
                    Item.RequiredStrength = 0;
                }
                return;

            case ImbueStat.RequiredStamina:
                if (Item.RequiredStamina >= -value)
                {
                    Item.RequiredStamina += (short)value;
                }
                else
                {
                    Item.RequiredStamina = 0;
                }
                return;

            case ImbueStat.RequiredDexterity:
                if (Item.RequiredDexterity >= -value)
                {
                    Item.RequiredDexterity += (short)value;
                }
                else
                {
                    Item.RequiredDexterity = 0;
                }
                return;

            case ImbueStat.RequiredEnergy:
                if (Item.RequiredEnergy >= -value)
                {
                    Item.RequiredEnergy += (short)value;
                }
                else
                {
                    Item.RequiredEnergy = 0;
                }
                return;

            default:
                stat = ImbueStat.None;
                return;
            }
        }
コード例 #2
0
 public static byte[] SendImbueMessage(ImbueError error, ImbueStat stat, int value, Equipment item)
 {
     Packet p = new Packet(5);
     p.WriteByte((byte)error); // Error message
     p.WriteByte((byte)stat); // Stat
     p.WriteInt(value);
     p.WriteHexString("00");
     p.WriteShort(item.ReferenceID);
     p.WriteByte(item.Plus);
     p.WriteByte(item.Slvl);
     return p.GetWrittenBuffer(PacketIds.SendImbueMessage);
 }
コード例 #3
0
ファイル: GameEngine.cs プロジェクト: zarut/xiah-gcf-emulator
        public void RedImbue(Equipment Item, ImbueStat stat, ref int value, bool success, ref ImbueError error)
        {
            if (success)
                error = ImbueError.Success;
            else
            {
                error = ImbueError.FailedToRemake;
                if (PercentSuccess(30))
                {
                    value *= -1;
                }
                else
                {
                    value *= 0;
                }
            }

            switch (stat)
            {
                case ImbueStat.RequiredLevel:
                    if (Item.RequiredLevel >= -value)
                        Item.RequiredLevel += (short)value;
                    else
                        Item.RequiredLevel = 0;
                    return;
                case ImbueStat.RequiredStrength:
                    if (Item.RequiredStrength >= -value)
                        Item.RequiredStrength += (short)value;
                    else
                        Item.RequiredStrength = 0;
                    return;
                case ImbueStat.RequiredStamina:
                    if (Item.RequiredStamina >= -value)
                        Item.RequiredStamina += (short)value;
                    else
                        Item.RequiredStamina = 0;
                    return;
                case ImbueStat.RequiredDexterity:
                    if (Item.RequiredDexterity >= -value)
                        Item.RequiredDexterity += (short)value;
                    else
                        Item.RequiredDexterity = 0;
                    return;
                case ImbueStat.RequiredEnergy:
                    if (Item.RequiredEnergy >= -value)
                        Item.RequiredEnergy += (short)value;
                    else
                        Item.RequiredEnergy = 0;
                    return;
                default:
                    stat = ImbueStat.None;
                    return;
            }
        }