Beispiel #1
0
        private void RefreshSocketStats(UserItem equipItem)
        {
            if (equipItem == null)
            {
                return;
            }

            if (equipItem.Info.Type == ItemType.Weapon && equipItem.Info.IsFishingRod)
            {
                return;
            }

            if (equipItem.Info.Type == ItemType.Mount && !RidingMount)
            {
                return;
            }

            for (int i = 0; i < equipItem.Slots.Length; i++)
            {
                UserItem temp = equipItem.Slots[i];

                if (temp == null)
                {
                    continue;
                }
                ItemInfo RealItem = Functions.GetRealItem(temp.Info, Level, Class, GameScene.ItemInfoList);

                if (RealItem.Type == ItemType.Weapon || RealItem.Type == ItemType.Torch)
                {
                    CurrentHandWeight = (int)Math.Min(int.MaxValue, CurrentHandWeight + temp.Weight);
                }
                else
                {
                    CurrentWearWeight = (int)Math.Min(int.MaxValue, CurrentWearWeight + temp.Weight);
                }

                if (temp.CurrentDura == 0 && RealItem.Durability > 0)
                {
                    continue;
                }

                Stats.Add(RealItem.Stats);
                Stats.Add(temp.AddedStats);

                if (RealItem.Light > Light)
                {
                    Light = RealItem.Light;
                }
                if (RealItem.Unique != SpecialItemMode.None)
                {
                    ItemMode |= RealItem.Unique;
                }
            }
        }
Beispiel #2
0
    public ItemInfo(BinaryReader reader, int version = int.MaxValue, int Customversion = int.MaxValue)
    {
        Index = reader.ReadInt32();
        Name = reader.ReadString();
        Type = (ItemType) reader.ReadByte();
        if (version >= 40) Grade = (ItemGrade)reader.ReadByte();
        RequiredType = (RequiredType) reader.ReadByte();
        RequiredClass = (RequiredClass) reader.ReadByte();
        RequiredGender = (RequiredGender) reader.ReadByte();
        if(version >= 17) Set = (ItemSet)reader.ReadByte();

        Shape = version >= 30 ? reader.ReadInt16() : reader.ReadSByte();
        Weight = reader.ReadByte();
        Light = reader.ReadByte();
        RequiredAmount = reader.ReadByte();

        Image = reader.ReadUInt16();
        Durability = reader.ReadUInt16();

        StackSize = reader.ReadUInt32();
        Price = reader.ReadUInt32();

        MinAC = reader.ReadByte();
        MaxAC = reader.ReadByte();
        MinMAC = reader.ReadByte();
        MaxMAC = reader.ReadByte();
        MinDC = reader.ReadByte();
        MaxDC = reader.ReadByte();
        MinMC = reader.ReadByte();
        MaxMC = reader.ReadByte();
        MinSC = reader.ReadByte();
        MaxSC = reader.ReadByte();
        if (version < 25)
        {
            HP = reader.ReadByte();
            MP = reader.ReadByte();
        }
        else
        {
            HP = reader.ReadUInt16();
            MP = reader.ReadUInt16();
        }
        Accuracy = reader.ReadByte();
        Agility = reader.ReadByte();

        Luck = reader.ReadSByte();
        AttackSpeed = reader.ReadSByte();

        StartItem = reader.ReadBoolean();

        BagWeight = reader.ReadByte();
        HandWeight = reader.ReadByte();
        WearWeight = reader.ReadByte();

        if (version >= 9) Effect = reader.ReadByte();
        if (version >= 20)
        {
            Strong = reader.ReadByte();
            MagicResist = reader.ReadByte();
            PoisonResist = reader.ReadByte();
            HealthRecovery = reader.ReadByte();
            SpellRecovery = reader.ReadByte();
            PoisonRecovery = reader.ReadByte();
            HPrate = reader.ReadByte();
            MPrate = reader.ReadByte();
            CriticalRate = reader.ReadByte();
            CriticalDamage = reader.ReadByte();
            byte bools = reader.ReadByte();
            NeedIdentify = (bools & 0x01) == 0x01;
            ShowGroupPickup = (bools & 0x02) == 0x02;
            ClassBased = (bools & 0x04) == 0x04;
            LevelBased = (bools & 0x08) == 0x08;
            CanMine = (bools & 0x10) == 0x10;
            MaxAcRate = reader.ReadByte();
            MaxMacRate = reader.ReadByte();
            Holy = reader.ReadByte();
            Freezing = reader.ReadByte();
            PoisonAttack = reader.ReadByte();
            if (version < 55)
            {
                Bind = (BindMode)reader.ReadByte();
            }
            else
            {
                Bind = (BindMode)reader.ReadInt16();
            }
            
        }
        if (version >= 21)
        {
            Reflect = reader.ReadByte();
            HpDrainRate = reader.ReadByte();
            Unique = (SpecialItemMode)reader.ReadInt16();
        }
        if (version >= 24)
        {
            RandomStatsId = reader.ReadByte();
        }
        else
        {
            RandomStatsId = 255;
            if ((Type == ItemType.Weapon) || (Type == ItemType.Armour) || (Type == ItemType.Helmet) || (Type == ItemType.Necklace) || (Type == ItemType.Bracelet) || (Type == ItemType.Ring) || (Type == ItemType.Mount))
                RandomStatsId = (byte)Type;
            if ((Type == ItemType.Belt) || (Type == ItemType.Boots))
                RandomStatsId = 7;
        }

        if (version >= 40) CanFastRun = reader.ReadBoolean();

        if (version >= 41)
        {
            CanAwakening = reader.ReadBoolean();
            bool isTooltip = reader.ReadBoolean();
            if (isTooltip)
                ToolTip = reader.ReadString();
        }
    }
Beispiel #3
0
    public ItemInfo(BinaryReader reader, int version = int.MaxValue, int Customversion = int.MaxValue)
    {
        Index          = reader.ReadInt32();
        Name           = reader.ReadString();
        Type           = (ItemType)reader.ReadByte();
        Grade          = (ItemGrade)reader.ReadByte();
        RequiredType   = (RequiredType)reader.ReadByte();
        RequiredClass  = (RequiredClass)reader.ReadByte();
        RequiredGender = (RequiredGender)reader.ReadByte();
        Set            = (ItemSet)reader.ReadByte();

        Shape          = reader.ReadInt16();
        Weight         = reader.ReadByte();
        Light          = reader.ReadByte();
        RequiredAmount = reader.ReadByte();

        Image      = reader.ReadUInt16();
        Durability = reader.ReadUInt16();

        StackSize = reader.ReadUInt32();
        Price     = reader.ReadUInt32();

        MinAC    = reader.ReadByte();
        MaxAC    = reader.ReadByte();
        MinMAC   = reader.ReadByte();
        MaxMAC   = reader.ReadByte();
        MinDC    = reader.ReadByte();
        MaxDC    = reader.ReadByte();
        MinMC    = reader.ReadByte();
        MaxMC    = reader.ReadByte();
        MinSC    = reader.ReadByte();
        MaxSC    = reader.ReadByte();
        HP       = reader.ReadUInt16();
        MP       = reader.ReadUInt16();
        Accuracy = reader.ReadByte();
        Agility  = reader.ReadByte();

        Luck        = reader.ReadSByte();
        AttackSpeed = reader.ReadSByte();

        StartItem = reader.ReadBoolean();

        BagWeight  = reader.ReadByte();
        HandWeight = reader.ReadByte();
        WearWeight = reader.ReadByte();

        Effect         = reader.ReadByte();
        Strong         = reader.ReadByte();
        MagicResist    = reader.ReadByte();
        PoisonResist   = reader.ReadByte();
        HealthRecovery = reader.ReadByte();
        SpellRecovery  = reader.ReadByte();
        PoisonRecovery = reader.ReadByte();
        HPrate         = reader.ReadByte();
        MPrate         = reader.ReadByte();
        CriticalRate   = reader.ReadByte();
        CriticalDamage = reader.ReadByte();
        byte bools = reader.ReadByte();

        NeedIdentify    = (bools & 0x01) == 0x01;
        ShowGroupPickup = (bools & 0x02) == 0x02;
        ClassBased      = (bools & 0x04) == 0x04;
        LevelBased      = (bools & 0x08) == 0x08;
        CanMine         = (bools & 0x10) == 0x10;

        if (version >= 77)
        {
            GlobalDropNotify = (bools & 0x20) == 0x20;
        }

        MaxAcRate     = reader.ReadByte();
        MaxMacRate    = reader.ReadByte();
        Holy          = reader.ReadByte();
        Freezing      = reader.ReadByte();
        PoisonAttack  = reader.ReadByte();
        Bind          = (BindMode)reader.ReadInt16();
        Reflect       = reader.ReadByte();
        HpDrainRate   = reader.ReadByte();
        Unique        = (SpecialItemMode)reader.ReadInt16();
        RandomStatsId = reader.ReadByte();

        CanFastRun = reader.ReadBoolean();

        CanAwakening = reader.ReadBoolean();
        bool isTooltip = reader.ReadBoolean();

        if (isTooltip)
        {
            ToolTip = reader.ReadString();
        }

        if (version < 70) //before db version 70 all specialitems had wedding rings disabled, after that it became a server option
        {
            if ((Type == ItemType.Ring) && (Unique != SpecialItemMode.None))
            {
                Bind |= BindMode.NoWeddingRing;
            }
        }
    }
Beispiel #4
0
        private void SaveForm()
        {
            int lastIndex = 0;

            if (Envir.MonsterInfoList.Count > 0)
            {
                lastIndex = Envir.ItemInfoList.Max(x => x.Index);
            }

            foreach (DataGridViewRow row in itemInfoGridView.Rows)
            {
                if (string.IsNullOrEmpty((string)row.Cells["ItemName"].Value))
                {
                    continue;
                }

                ItemInfo item;

                if (string.IsNullOrEmpty((string)row.Cells["ItemIndex"].FormattedValue))
                {
                    Envir.ItemInfoList.Add(item = new ItemInfo());

                    item.Index = ++lastIndex;
                }
                else
                {
                    int index = (int)row.Cells["ItemIndex"].Value;

                    item = Envir.ItemInfoList.FirstOrDefault(x => x.Index == index);

                    if (row.Cells["Modified"].Value != null && (bool)row.Cells["Modified"].Value == false)
                    {
                        continue;
                    }
                }

                item.Name           = (string)row.Cells["ItemName"].Value;
                item.Type           = (ItemType)row.Cells["ItemType"].Value;
                item.Grade          = (ItemGrade)row.Cells["ItemGrade"].Value;
                item.RequiredType   = (RequiredType)row.Cells["ItemRequiredType"].Value;
                item.RequiredGender = (RequiredGender)row.Cells["ItemRequiredGender"].Value;
                item.RequiredClass  = (RequiredClass)row.Cells["ItemRequiredClass"].Value;
                item.Set            = (ItemSet)row.Cells["ItemSet"].Value;
                item.RandomStatsId  = (byte)row.Cells["ItemRandomStatsId"].Value;
                item.RequiredAmount = (byte)row.Cells["ItemRequiredAmount"].Value;
                item.Image          = (ushort)row.Cells["ItemImage"].Value;
                item.Shape          = (short)row.Cells["ItemShape"].Value;
                item.Effect         = (byte)row.Cells["ItemEffect"].Value;
                item.StackSize      = (ushort)row.Cells["ItemStackSize"].Value;
                item.Slots          = (byte)row.Cells["ItemSlots"].Value;
                item.Weight         = (byte)row.Cells["ItemWeight"].Value;

                var light = ((byte)row.Cells["ItemLightRange"].Value % 15) + ((byte)row.Cells["ItemLightIntensity"].Value * 15);
                item.Light      = (byte)Math.Min(byte.MaxValue, light);
                item.Durability = (ushort)row.Cells["ItemDurability"].Value;
                item.Price      = (uint)row.Cells["ItemPrice"].Value;
                item.ToolTip    = (string)row.Cells["ItemToolTip"].Value;

                item.Stats.Clear();
                item.Bind   = BindMode.None;
                item.Unique = SpecialItemMode.None;

                foreach (DataGridViewColumn col in itemInfoGridView.Columns)
                {
                    if (col.Name.StartsWith("Stat"))
                    {
                        var stat = col.Name.Substring(4);

                        Stat enumStat = (Stat)Enum.Parse(typeof(Stat), stat);

                        item.Stats[enumStat] = (int)row.Cells[col.Name].Value;
                    }
                    else if (col.Name.StartsWith("Bind"))
                    {
                        var bind = col.Name.Substring(4);

                        BindMode enumBind = (BindMode)Enum.Parse(typeof(BindMode), bind);

                        if ((bool)row.Cells[col.Name].Value)
                        {
                            item.Bind |= enumBind;
                        }
                    }
                    else if (col.Name.StartsWith("Special"))
                    {
                        var special = col.Name.Substring(7);

                        SpecialItemMode enumSpecial = (SpecialItemMode)Enum.Parse(typeof(SpecialItemMode), special);

                        if ((bool)row.Cells[col.Name].Value)
                        {
                            item.Unique |= enumSpecial;
                        }
                    }
                }
            }
        }
Beispiel #5
0
        private void RefreshEquipmentStats()
        {
            Weapon       = -1;
            WeaponEffect = 0;
            Armour       = 0;
            WingEffect   = 0;
            MountType    = -1;

            CurrentWearWeight = 0;
            CurrentHandWeight = 0;

            ItemMode = SpecialItemMode.None;
            FastRun  = false;

            ItemSets.Clear();
            MirSet.Clear();

            for (int i = 0; i < Equipment.Length; i++)
            {
                UserItem temp = Equipment[i];
                if (temp == null)
                {
                    continue;
                }

                ItemInfo RealItem = Functions.GetRealItem(temp.Info, Level, Class, GameScene.ItemInfoList);

                if (RealItem.Type == ItemType.Weapon || RealItem.Type == ItemType.Torch)
                {
                    CurrentHandWeight = (int)Math.Min(int.MaxValue, CurrentHandWeight + temp.Weight);
                }
                else
                {
                    CurrentWearWeight = (int)Math.Min(int.MaxValue, CurrentWearWeight + temp.Weight);
                }

                if (temp.CurrentDura == 0 && RealItem.Durability > 0)
                {
                    continue;
                }

                Stats.Add(RealItem.Stats);
                Stats.Add(temp.AddedStats);

                Stats[Stat.MinAC]  += temp.Awake.GetAC();
                Stats[Stat.MaxAC]  += temp.Awake.GetAC();
                Stats[Stat.MinMAC] += temp.Awake.GetMAC();
                Stats[Stat.MaxMAC] += temp.Awake.GetMAC();

                Stats[Stat.MinDC] += temp.Awake.GetDC();
                Stats[Stat.MaxDC] += temp.Awake.GetDC();
                Stats[Stat.MinMC] += temp.Awake.GetMC();
                Stats[Stat.MaxMC] += temp.Awake.GetMC();
                Stats[Stat.MinSC] += temp.Awake.GetSC();
                Stats[Stat.MaxSC] += temp.Awake.GetSC();

                Stats[Stat.HP] += temp.Awake.GetHPMP();
                Stats[Stat.MP] += temp.Awake.GetHPMP();

                if (RealItem.Light > Light)
                {
                    Light = RealItem.Light;
                }
                if (RealItem.Unique != SpecialItemMode.None)
                {
                    ItemMode |= RealItem.Unique;
                }

                if (RealItem.CanFastRun)
                {
                    FastRun = true;
                }

                RefreshSocketStats(temp);

                if (RealItem.Type == ItemType.Armour)
                {
                    Armour     = RealItem.Shape;
                    WingEffect = RealItem.Effect;
                }
                if (RealItem.Type == ItemType.Weapon)
                {
                    Weapon       = RealItem.Shape;
                    WeaponEffect = RealItem.Effect;
                }

                if (RealItem.Type == ItemType.Mount)
                {
                    MountType = RealItem.Shape;
                }

                if (RealItem.Set == ItemSet.None)
                {
                    continue;
                }

                ItemSets itemSet = ItemSets.Where(set => set.Set == RealItem.Set && !set.Type.Contains(RealItem.Type) && !set.SetComplete).FirstOrDefault();

                if (itemSet != null)
                {
                    itemSet.Type.Add(RealItem.Type);
                    itemSet.Count++;
                }
                else
                {
                    ItemSets.Add(new ItemSets {
                        Count = 1, Set = RealItem.Set, Type = new List <ItemType> {
                            RealItem.Type
                        }
                    });
                }

                //Mir Set
                if (RealItem.Set == ItemSet.Mir)
                {
                    if (!MirSet.Contains((EquipmentSlot)i))
                    {
                        MirSet.Add((EquipmentSlot)i);
                    }
                }
            }

            if (ItemMode.HasFlag(SpecialItemMode.Muscle))
            {
                Stats[Stat.BagWeight]  = Stats[Stat.BagWeight] * 2;
                Stats[Stat.WearWeight] = Stats[Stat.WearWeight] * 2;
                Stats[Stat.HandWeight] = Stats[Stat.HandWeight] * 2;
            }
        }
Beispiel #6
0
    public ItemInfo(BinaryReader reader, int version = int.MaxValue, int customVersion = int.MaxValue)
    {
        Index          = reader.ReadInt32();
        Name           = reader.ReadString();
        Type           = (ItemType)reader.ReadByte();
        Grade          = (ItemGrade)reader.ReadByte();
        RequiredType   = (RequiredType)reader.ReadByte();
        RequiredClass  = (RequiredClass)reader.ReadByte();
        RequiredGender = (RequiredGender)reader.ReadByte();
        Set            = (ItemSet)reader.ReadByte();

        Shape          = reader.ReadInt16();
        Weight         = reader.ReadByte();
        Light          = reader.ReadByte();
        RequiredAmount = reader.ReadByte();

        Image      = reader.ReadUInt16();
        Durability = reader.ReadUInt16();

        if (version <= 84)
        {
            StackSize = (ushort)reader.ReadUInt32();
        }
        else
        {
            StackSize = reader.ReadUInt16();
        }

        Price = reader.ReadUInt32();

        if (version <= 84)
        {
            Stats                = new Stats();
            Stats[Stat.MinAC]    = reader.ReadByte();
            Stats[Stat.MaxAC]    = reader.ReadByte();
            Stats[Stat.MinMAC]   = reader.ReadByte();
            Stats[Stat.MaxMAC]   = reader.ReadByte();
            Stats[Stat.MinDC]    = reader.ReadByte();
            Stats[Stat.MaxDC]    = reader.ReadByte();
            Stats[Stat.MinMC]    = reader.ReadByte();
            Stats[Stat.MaxMC]    = reader.ReadByte();
            Stats[Stat.MinSC]    = reader.ReadByte();
            Stats[Stat.MaxSC]    = reader.ReadByte();
            Stats[Stat.HP]       = reader.ReadUInt16();
            Stats[Stat.MP]       = reader.ReadUInt16();
            Stats[Stat.Accuracy] = reader.ReadByte();
            Stats[Stat.Agility]  = reader.ReadByte();

            Stats[Stat.Luck]        = reader.ReadSByte();
            Stats[Stat.AttackSpeed] = reader.ReadSByte();
        }

        StartItem = reader.ReadBoolean();

        if (version <= 84)
        {
            Stats[Stat.BagWeight]  = reader.ReadByte();
            Stats[Stat.HandWeight] = reader.ReadByte();
            Stats[Stat.WearWeight] = reader.ReadByte();
        }

        Effect = reader.ReadByte();

        if (version <= 84)
        {
            Stats[Stat.Strong]         = reader.ReadByte();
            Stats[Stat.MagicResist]    = reader.ReadByte();
            Stats[Stat.PoisonResist]   = reader.ReadByte();
            Stats[Stat.HealthRecovery] = reader.ReadByte();
            Stats[Stat.SpellRecovery]  = reader.ReadByte();
            Stats[Stat.PoisonRecovery] = reader.ReadByte();
            Stats[Stat.HPRatePercent]  = reader.ReadByte();
            Stats[Stat.MPRatePercent]  = reader.ReadByte();
            Stats[Stat.CriticalRate]   = reader.ReadByte();
            Stats[Stat.CriticalDamage] = reader.ReadByte();
        }


        byte bools = reader.ReadByte();

        NeedIdentify    = (bools & 0x01) == 0x01;
        ShowGroupPickup = (bools & 0x02) == 0x02;
        ClassBased      = (bools & 0x04) == 0x04;
        LevelBased      = (bools & 0x08) == 0x08;
        CanMine         = (bools & 0x10) == 0x10;

        if (version >= 77)
        {
            GlobalDropNotify = (bools & 0x20) == 0x20;
        }

        if (version <= 84)
        {
            Stats[Stat.MaxACRatePercent]  = reader.ReadByte();
            Stats[Stat.MaxMACRatePercent] = reader.ReadByte();
            Stats[Stat.Holy]         = reader.ReadByte();
            Stats[Stat.Freezing]     = reader.ReadByte();
            Stats[Stat.PoisonAttack] = reader.ReadByte();
        }

        Bind = (BindMode)reader.ReadInt16();

        if (version <= 84)
        {
            Stats[Stat.Reflect]            = reader.ReadByte();
            Stats[Stat.HPDrainRatePercent] = reader.ReadByte();
        }

        Unique        = (SpecialItemMode)reader.ReadInt16();
        RandomStatsId = reader.ReadByte();

        CanFastRun = reader.ReadBoolean();

        CanAwakening = reader.ReadBoolean();

        if (version > 83)
        {
            Slots = reader.ReadByte();
        }

        if (version > 84)
        {
            Stats = new Stats(reader);
        }

        bool isTooltip = reader.ReadBoolean();

        if (isTooltip)
        {
            ToolTip = reader.ReadString();
        }

        if (version < 70) //before db version 70 all specialitems had wedding rings disabled, after that it became a server option
        {
            if ((Type == ItemType.Ring) && (Unique != SpecialItemMode.None))
            {
                Bind |= BindMode.NoWeddingRing;
            }
        }
    }