コード例 #1
0
ファイル: ItemStats.cs プロジェクト: wb121818778/MapleServer2
        public ItemStats(int itemId, int grade)
        {
            BasicAttributes = new List <ItemStat>();
            BonusAttributes = new List <ItemStat>();
            Gemstones       = new List <Gemstone>();
            if (grade == 0)
            {
                return;
            }
            if (ItemStatsMetadataStorage.GetConstantStat(itemId, out List <ItemOptions> constantList))
            {
                foreach (ItemOptions item in constantList)
                {
                    if (item.Grade != grade)
                    {
                        continue;
                    }
                    foreach (Stat i in item.Stats)
                    {
                        if (i.Value != 0)
                        {
                            BasicAttributes.Add(ItemStat.Of(i.Type, i.Value)); // TODO: add randomness to value
                        }
                        else
                        {
                            BasicAttributes.Add(ItemStat.Of(i.Type, i.Percentage)); // TODO: add randomness to value
                        }
                    }
                }
            }

            if (ItemStatsMetadataStorage.GetRandomStat(itemId, out List <ItemOptions> randomList))
            {
                foreach (ItemOptions item in randomList)
                {
                    if (item.Grade != grade)
                    {
                        continue;
                    }
                    if (item.OptionNumPick == 0)
                    {
                        continue;
                    }
                    List <int> indexes = GetRandomOptions(item.OptionNumPick, item.Stats.Count);
                    foreach (int i in indexes)
                    {
                        if (item.Stats[i].Value != 0)
                        {
                            BonusAttributes.Add(ItemStat.Of(item.Stats[i].Type, item.Stats[i].Value)); // TODO: add randomness to value
                        }
                        else
                        {
                            BonusAttributes.Add(ItemStat.Of(item.Stats[i].Type, item.Stats[i].Percentage)); // TODO: add randomness to value
                        }
                    }
                }
            }
        }
コード例 #2
0
ファイル: ItemStats.cs プロジェクト: wevvin/MapleServer2
 private static void AddStat(List <ItemStat> listAttributes, List <Stat> listStats)
 {
     foreach (Stat stat in listStats)
     {
         if (stat.Value != 0)
         {
             listAttributes.Add(ItemStat.Of(stat.Type, stat.Value)); // TODO: add randomness to value
         }
         else
         {
             listAttributes.Add(ItemStat.Of(stat.Type, stat.Percentage)); // TODO: add randomness to value
         }
     }
 }
コード例 #3
0
 public static Item TutorialBow(Player owner)
 {
     // bow 15100216
     // [longsword]  Tairen Royal Longsword - 13200309
     // [shield] Tairen Royal Shield - 14100279
     // [greatsword] Tairen Royal Greatsword - 15000313
     // [scepter] Tairen Royal Scepter - 13300308
     // [codex] Tairen Royal Codex - 14000270
     // [staff] Tairen Royal Staff - 15200312
     // [cannon] Tairen Royal Cannon - 15300308
     // [bow] Tairen Royal Bow - 15100305
     // [dagger] Tairen Royal Knife - 13100314
     // [star] Tairen Royal Star - 13400307
     // [blade] Tairen Royal Blade - 15400294
     // [knuckles] Tairen Royal Knuckles - 15500226
     // [orb] Tairen Royal Spirit - 15600228
     return(new Item(15100216)
     {
         Uid = 3430503306390578751, // Make sure its unique! If the UID is equipped, it will say "Equipped" on the item in your inventory
         Rarity = 1,
         CreationTime = DateTimeOffset.UtcNow.ToUnixTimeSeconds(),
         Owner = owner,
         Color = EquipColor.Custom(
             Maple2Storage.Types.Color.Argb(0xFF, 0xBC, 0xBC, 0xB3),
             Maple2Storage.Types.Color.Argb(0xFF, 0xC3, 0xDA, 0x3D),
             Maple2Storage.Types.Color.Argb(0xFF, 0xB0, 0xB4, 0xBA),
             0x13
             ),
         AppearanceFlag = 0x5,
         Stats = new ItemStats
         {
             BasicAttributes =
             {
                 ItemStat.Of(Enums.ItemAttribute.CriticalRate, 12),
                 ItemStat.Of(Enums.ItemAttribute.MinWeaponAtk, 15),
                 ItemStat.Of(Enums.ItemAttribute.MaxWeaponAtk, 17)
             }
         },
         TransferFlag = TransferFlag.Binds | TransferFlag.Splitable,
     });
 }