コード例 #1
0
ファイル: ServersData.cs プロジェクト: xSnurfsx/OpenNos
        public static void SetRarityPoint(ref Inventory inv)
        {
            if (inv == null)
            {
                return;
            }
            Item iteminfo = ServerManager.GetItem(inv.InventoryItem.ItemVNum);

            if (iteminfo.EquipmentSlot == (byte)EquipmentType.MainWeapon || iteminfo.EquipmentSlot == (byte)EquipmentType.SecondaryWeapon)
            {
                int    point = ServersData.RarityPoint(inv.InventoryItem.Rare, iteminfo.LevelMinimum);
                Random rnd   = new Random();
                inv.InventoryItem.Concentrate   = 0;
                inv.InventoryItem.HitRate       = 0;
                inv.InventoryItem.DamageMinimum = 0;
                inv.InventoryItem.DamageMaximum = 0;
                for (int i = 0; i < point; i++)
                {
                    int rndn = rnd.Next(0, 3);
                    if (rndn == 0)
                    {
                        inv.InventoryItem.Concentrate++;
                        inv.InventoryItem.HitRate++;
                    }
                    else
                    {
                        inv.InventoryItem.DamageMinimum++;
                        inv.InventoryItem.DamageMaximum++;
                    }
                }
            }
            else if (iteminfo.EquipmentSlot == (byte)EquipmentType.Armor)
            {
                int    point = ServersData.RarityPoint(inv.InventoryItem.Rare, iteminfo.LevelMinimum);
                Random rnd   = new Random();
                inv.InventoryItem.DefenceDodge         = 0;
                inv.InventoryItem.DistanceDefenceDodge = 0;
                inv.InventoryItem.DistanceDefence      = 0;
                inv.InventoryItem.MagicDefence         = 0;
                inv.InventoryItem.CloseDefence         = 0;
                for (int i = 0; i < point; i++)
                {
                    int rndn = rnd.Next(0, 3);
                    if (rndn == 0)
                    {
                        inv.InventoryItem.DefenceDodge++;
                        inv.InventoryItem.DistanceDefenceDodge++;
                    }
                    else
                    {
                        inv.InventoryItem.DistanceDefence++;
                        inv.InventoryItem.MagicDefence++;
                        inv.InventoryItem.CloseDefence++;
                    }
                }
            }
        }
コード例 #2
0
ファイル: WearableInstance.cs プロジェクト: syntox/OpenNos
 public void SetRarityPoint()
 {
     if (this.Item.EquipmentSlot == (byte)EquipmentType.MainWeapon || this.Item.EquipmentSlot == (byte)EquipmentType.SecondaryWeapon)
     {
         int    point = ServersData.RarityPoint(this.Rare, this.Item.LevelMinimum);
         Random rnd   = new Random();
         this.Concentrate   = 0;
         this.HitRate       = 0;
         this.DamageMinimum = 0;
         this.DamageMaximum = 0;
         for (int i = 0; i < point; i++)
         {
             int rndn = rnd.Next(0, 3);
             if (rndn == 0)
             {
                 this.Concentrate++;
                 this.HitRate++;
             }
             else
             {
                 this.DamageMinimum++;
                 this.DamageMaximum++;
             }
         }
     }
     else if (this.Item.EquipmentSlot == (byte)EquipmentType.Armor)
     {
         int    point = ServersData.RarityPoint(this.Rare, this.Item.LevelMinimum);
         Random rnd   = new Random();
         this.DefenceDodge         = 0;
         this.DistanceDefenceDodge = 0;
         this.DistanceDefence      = 0;
         this.MagicDefence         = 0;
         this.CloseDefence         = 0;
         for (int i = 0; i < point; i++)
         {
             int rndn = rnd.Next(0, 3);
             if (rndn == 0)
             {
                 this.DefenceDodge++;
                 this.DistanceDefenceDodge++;
             }
             else
             {
                 this.DistanceDefence++;
                 this.MagicDefence++;
                 this.CloseDefence++;
             }
         }
     }
 }