Пример #1
0
 public static void LoadRandomItemStats()
 {
     //note: i could have used a flat file system for this which would be faster, 
     //BUT: it's only loaded @ server startup so speed isnt vital.
     //and i think settings should be available outside the exe for ppl to edit it easyer + lets ppl share config without forcing ppl to run it in an exe
     if (!File.Exists(ConfigPath + @".\RandomItemStats.ini"))
     {
         RandomItemStatsList.Add(new RandomItemStat());
         RandomItemStatsList.Add(new RandomItemStat(ItemType.Weapon));
         RandomItemStatsList.Add(new RandomItemStat(ItemType.Armour));
         RandomItemStatsList.Add(new RandomItemStat(ItemType.Helmet));
         RandomItemStatsList.Add(new RandomItemStat(ItemType.Necklace));
         RandomItemStatsList.Add(new RandomItemStat(ItemType.Bracelet));
         RandomItemStatsList.Add(new RandomItemStat(ItemType.Ring));
         RandomItemStatsList.Add(new RandomItemStat(ItemType.Belt));
         SaveRandomItemStats();
         return;
     }
     InIReader reader = new InIReader(ConfigPath + @".\RandomItemStats.ini");
     int i = 0;
     RandomItemStat stat;
     while (reader.ReadByte("Item" + i.ToString(),"MaxDuraChance",255) != 255)
     {
         stat = new RandomItemStat();
         stat.MaxDuraChance = reader.ReadByte("Item" + i.ToString(), "MaxDuraChance", 0);
         stat.MaxDuraStatChance = reader.ReadByte("Item" + i.ToString(), "MaxDuraStatChance", 1);
         stat.MaxDuraMaxStat = reader.ReadByte("Item" + i.ToString(), "MaxDuraMaxStat", 1);
         stat.MaxAcChance = reader.ReadByte("Item" + i.ToString(), "MaxAcChance", 0);
         stat.MaxAcStatChance = reader.ReadByte("Item" + i.ToString(), "MaxAcStatChance", 1);
         stat.MaxAcMaxStat = reader.ReadByte("Item" + i.ToString(), "MaxAcMaxStat", 1);
         stat.MaxMacChance = reader.ReadByte("Item" + i.ToString(), "MaxMacChance", 0);
         stat.MaxMacStatChance = reader.ReadByte("Item" + i.ToString(), "MaxMacStatChance", 1);
         stat.MaxMacMaxStat = reader.ReadByte("Item" + i.ToString(), "MaxMACMaxStat", 1);
         stat.MaxDcChance = reader.ReadByte("Item" + i.ToString(), "MaxDcChance", 0);
         stat.MaxDcStatChance = reader.ReadByte("Item" + i.ToString(), "MaxDcStatChance", 1);
         stat.MaxDcMaxStat = reader.ReadByte("Item" + i.ToString(), "MaxDcMaxStat", 1);
         stat.MaxMcChance = reader.ReadByte("Item" + i.ToString(), "MaxMcChance", 0);
         stat.MaxMcStatChance = reader.ReadByte("Item" + i.ToString(), "MaxMcStatChance", 1);
         stat.MaxMcMaxStat = reader.ReadByte("Item" + i.ToString(), "MaxMcMaxStat", 1);
         stat.MaxScChance = reader.ReadByte("Item" + i.ToString(), "MaxScChance", 0);
         stat.MaxScStatChance = reader.ReadByte("Item" + i.ToString(), "MaxScStatChance", 1);
         stat.MaxScMaxStat = reader.ReadByte("Item" + i.ToString(), "MaxScMaxStat", 1);
         stat.AccuracyChance = reader.ReadByte("Item" + i.ToString(), "AccuracyChance", 0);
         stat.AccuracyStatChance = reader.ReadByte("Item" + i.ToString(), "AccuracyStatChance", 1);
         stat.AccuracyMaxStat = reader.ReadByte("Item" + i.ToString(), "AccuracyMaxStat", 1);
         stat.AgilityChance = reader.ReadByte("Item" + i.ToString(), "AgilityChance", 0);
         stat.AgilityStatChance = reader.ReadByte("Item" + i.ToString(), "AgilityStatChance", 1);
         stat.AgilityMaxStat = reader.ReadByte("Item" + i.ToString(), "AgilityMaxStat", 1);
         stat.HpChance = reader.ReadByte("Item" + i.ToString(), "HpChance", 0);
         stat.HpStatChance = reader.ReadByte("Item" + i.ToString(), "HpStatChance", 1);
         stat.HpMaxStat = reader.ReadByte("Item" + i.ToString(), "HpMaxStat", 1);
         stat.MpChance = reader.ReadByte("Item" + i.ToString(), "MpChance", 0);
         stat.MpStatChance = reader.ReadByte("Item" + i.ToString(), "MpStatChance", 1);
         stat.MpMaxStat = reader.ReadByte("Item" + i.ToString(), "MpMaxStat", 1);
         stat.StrongChance = reader.ReadByte("Item" + i.ToString(), "StrongChance", 0);
         stat.StrongStatChance = reader.ReadByte("Item" + i.ToString(), "StrongStatChance", 1);
         stat.StrongMaxStat = reader.ReadByte("Item" + i.ToString(), "StrongMaxStat", 1);
         stat.MagicResistChance = reader.ReadByte("Item" + i.ToString(), "MagicResistChance", 0);
         stat.MagicResistStatChance = reader.ReadByte("Item" + i.ToString(), "MagicResistStatChance", 1);
         stat.MagicResistMaxStat = reader.ReadByte("Item" + i.ToString(), "MagicResistMaxStat", 1);
         stat.PoisonResistChance = reader.ReadByte("Item" + i.ToString(), "PoisonResistChance", 0);
         stat.PoisonResistStatChance = reader.ReadByte("Item" + i.ToString(), "PoisonResistStatChance", 1);
         stat.PoisonResistMaxStat = reader.ReadByte("Item" + i.ToString(), "PoisonResistMaxStat", 1);
         stat.HpRecovChance = reader.ReadByte("Item" + i.ToString(), "HpRecovChance", 0);
         stat.HpRecovStatChance = reader.ReadByte("Item" + i.ToString(), "HpRecovStatChance", 1);
         stat.HpRecovMaxStat = reader.ReadByte("Item" + i.ToString(), "HpRecovMaxStat", 1);
         stat.MpRecovChance = reader.ReadByte("Item" + i.ToString(), "MpRecovChance", 0);
         stat.MpRecovStatChance = reader.ReadByte("Item" + i.ToString(), "MpRecovStatChance", 1);
         stat.MpRecovMaxStat = reader.ReadByte("Item" + i.ToString(), "MpRecovMaxStat", 1);
         stat.PoisonRecovChance = reader.ReadByte("Item" + i.ToString(), "PoisonRecovChance", 0);
         stat.PoisonRecovStatChance = reader.ReadByte("Item" + i.ToString(), "PoisonRecovStatChance", 1);
         stat.PoisonRecovMaxStat = reader.ReadByte("Item" + i.ToString(), "PoisonRecovMaxStat", 1);
         stat.CriticalRateChance = reader.ReadByte("Item" + i.ToString(), "CriticalRateChance", 0);
         stat.CriticalRateStatChance = reader.ReadByte("Item" + i.ToString(), "CriticalRateStatChance", 1);
         stat.CriticalRateMaxStat = reader.ReadByte("Item" + i.ToString(), "CriticalRateMaxStat", 1);
         stat.CriticalDamageChance = reader.ReadByte("Item" + i.ToString(), "CriticalDamageChance", 0);
         stat.CriticalDamageStatChance = reader.ReadByte("Item" + i.ToString(), "CriticalDamageStatChance", 1);
         stat.CriticalDamageMaxStat = reader.ReadByte("Item" + i.ToString(), "CriticalDamageMaxStat", 1);
         stat.FreezeChance = reader.ReadByte("Item" + i.ToString(), "FreezeChance", 0);
         stat.FreezeStatChance = reader.ReadByte("Item" + i.ToString(), "FreezeStatChance", 1);
         stat.FreezeMaxStat = reader.ReadByte("Item" + i.ToString(), "FreezeMaxStat", 1);
         stat.PoisonAttackChance = reader.ReadByte("Item" + i.ToString(), "PoisonAttackChance", 0);
         stat.PoisonAttackStatChance = reader.ReadByte("Item" + i.ToString(), "PoisonAttackStatChance", 1);
         stat.PoisonAttackMaxStat = reader.ReadByte("Item" + i.ToString(), "PoisonAttackMaxStat", 1);
         stat.AttackSpeedChance = reader.ReadByte("Item" + i.ToString(), "AttackSpeedChance", 0);
         stat.AttackSpeedStatChance = reader.ReadByte("Item" + i.ToString(), "AttackSpeedStatChance", 1);
         stat.AttackSpeedMaxStat = reader.ReadByte("Item" + i.ToString(), "AttackSpeedMaxStat", 1);
         stat.LuckChance = reader.ReadByte("Item" + i.ToString(), "LuckChance", 0);
         stat.LuckStatChance = reader.ReadByte("Item" + i.ToString(), "LuckStatChance", 1);
         stat.LuckMaxStat = reader.ReadByte("Item" + i.ToString(), "LuckMaxStat", 1);
         stat.CurseChance = reader.ReadByte("Item" + i.ToString(), "CurseChance", 0);
         RandomItemStatsList.Add(stat);
         i++;
     }
 }
Пример #2
0
        public static void LoadRandomItemStats()
        {
            if (!File.Exists(@".\RandomItemStats.ini"))
            {
                RandomItemStatsList.Add(new RandomItemStat());
                RandomItemStatsList.Add(new RandomItemStat(ItemType.Weapon));
                RandomItemStatsList.Add(new RandomItemStat(ItemType.Armour));
                RandomItemStatsList.Add(new RandomItemStat(ItemType.Helmet));
                RandomItemStatsList.Add(new RandomItemStat(ItemType.Necklace));
                RandomItemStatsList.Add(new RandomItemStat(ItemType.Bracelet));
                RandomItemStatsList.Add(new RandomItemStat(ItemType.Ring));
                RandomItemStatsList.Add(new RandomItemStat(ItemType.Belt));
                SaveRandomItemStats();
                return;
            }
            InIReader      reader = new InIReader(@".\RandomItemStats.ini");
            int            i      = 0;
            RandomItemStat stat;

            while (reader.ReadByte("Item" + i.ToString(), "MaxDuraChance", 255) != 255)
            {
                stat = new RandomItemStat
                {
                    MaxDuraChance            = reader.ReadByte("Item" + i.ToString(), "MaxDuraChance", 0),
                    MaxDuraStatChance        = reader.ReadByte("Item" + i.ToString(), "MaxDuraStatChance", 1),
                    MaxDuraMaxStat           = reader.ReadByte("Item" + i.ToString(), "MaxDuraMaxStat", 1),
                    MaxAcChance              = reader.ReadByte("Item" + i.ToString(), "MaxAcChance", 0),
                    MaxAcStatChance          = reader.ReadByte("Item" + i.ToString(), "MaxAcStatChance", 1),
                    MaxAcMaxStat             = reader.ReadByte("Item" + i.ToString(), "MaxAcMaxStat", 1),
                    MaxMacChance             = reader.ReadByte("Item" + i.ToString(), "MaxMacChance", 0),
                    MaxMacStatChance         = reader.ReadByte("Item" + i.ToString(), "MaxMacStatChance", 1),
                    MaxMacMaxStat            = reader.ReadByte("Item" + i.ToString(), "MaxMACMaxStat", 1),
                    MaxDcChance              = reader.ReadByte("Item" + i.ToString(), "MaxDcChance", 0),
                    MaxDcStatChance          = reader.ReadByte("Item" + i.ToString(), "MaxDcStatChance", 1),
                    MaxDcMaxStat             = reader.ReadByte("Item" + i.ToString(), "MaxDcMaxStat", 1),
                    MaxMcChance              = reader.ReadByte("Item" + i.ToString(), "MaxMcChance", 0),
                    MaxMcStatChance          = reader.ReadByte("Item" + i.ToString(), "MaxMcStatChance", 1),
                    MaxMcMaxStat             = reader.ReadByte("Item" + i.ToString(), "MaxMcMaxStat", 1),
                    MaxScChance              = reader.ReadByte("Item" + i.ToString(), "MaxScChance", 0),
                    MaxScStatChance          = reader.ReadByte("Item" + i.ToString(), "MaxScStatChance", 1),
                    MaxScMaxStat             = reader.ReadByte("Item" + i.ToString(), "MaxScMaxStat", 1),
                    AccuracyChance           = reader.ReadByte("Item" + i.ToString(), "AccuracyChance", 0),
                    AccuracyStatChance       = reader.ReadByte("Item" + i.ToString(), "AccuracyStatChance", 1),
                    AccuracyMaxStat          = reader.ReadByte("Item" + i.ToString(), "AccuracyMaxStat", 1),
                    AgilityChance            = reader.ReadByte("Item" + i.ToString(), "AgilityChance", 0),
                    AgilityStatChance        = reader.ReadByte("Item" + i.ToString(), "AgilityStatChance", 1),
                    AgilityMaxStat           = reader.ReadByte("Item" + i.ToString(), "AgilityMaxStat", 1),
                    HpChance                 = reader.ReadByte("Item" + i.ToString(), "HpChance", 0),
                    HpStatChance             = reader.ReadByte("Item" + i.ToString(), "HpStatChance", 1),
                    HpMaxStat                = reader.ReadByte("Item" + i.ToString(), "HpMaxStat", 1),
                    MpChance                 = reader.ReadByte("Item" + i.ToString(), "MpChance", 0),
                    MpStatChance             = reader.ReadByte("Item" + i.ToString(), "MpStatChance", 1),
                    MpMaxStat                = reader.ReadByte("Item" + i.ToString(), "MpMaxStat", 1),
                    StrongChance             = reader.ReadByte("Item" + i.ToString(), "StrongChance", 0),
                    StrongStatChance         = reader.ReadByte("Item" + i.ToString(), "StrongStatChance", 1),
                    StrongMaxStat            = reader.ReadByte("Item" + i.ToString(), "StrongMaxStat", 1),
                    MagicResistChance        = reader.ReadByte("Item" + i.ToString(), "MagicResistChance", 0),
                    MagicResistStatChance    = reader.ReadByte("Item" + i.ToString(), "MagicResistStatChance", 1),
                    MagicResistMaxStat       = reader.ReadByte("Item" + i.ToString(), "MagicResistMaxStat", 1),
                    PoisonResistChance       = reader.ReadByte("Item" + i.ToString(), "PoisonResistChance", 0),
                    PoisonResistStatChance   = reader.ReadByte("Item" + i.ToString(), "PoisonResistStatChance", 1),
                    PoisonResistMaxStat      = reader.ReadByte("Item" + i.ToString(), "PoisonResistMaxStat", 1),
                    HpRecovChance            = reader.ReadByte("Item" + i.ToString(), "HpRecovChance", 0),
                    HpRecovStatChance        = reader.ReadByte("Item" + i.ToString(), "HpRecovStatChance", 1),
                    HpRecovMaxStat           = reader.ReadByte("Item" + i.ToString(), "HpRecovMaxStat", 1),
                    MpRecovChance            = reader.ReadByte("Item" + i.ToString(), "MpRecovChance", 0),
                    MpRecovStatChance        = reader.ReadByte("Item" + i.ToString(), "MpRecovStatChance", 1),
                    MpRecovMaxStat           = reader.ReadByte("Item" + i.ToString(), "MpRecovMaxStat", 1),
                    PoisonRecovChance        = reader.ReadByte("Item" + i.ToString(), "PoisonRecovChance", 0),
                    PoisonRecovStatChance    = reader.ReadByte("Item" + i.ToString(), "PoisonRecovStatChance", 1),
                    PoisonRecovMaxStat       = reader.ReadByte("Item" + i.ToString(), "PoisonRecovMaxStat", 1),
                    CriticalRateChance       = reader.ReadByte("Item" + i.ToString(), "CriticalRateChance", 0),
                    CriticalRateStatChance   = reader.ReadByte("Item" + i.ToString(), "CriticalRateStatChance", 1),
                    CriticalRateMaxStat      = reader.ReadByte("Item" + i.ToString(), "CriticalRateMaxStat", 1),
                    CriticalDamageChance     = reader.ReadByte("Item" + i.ToString(), "CriticalDamageChance", 0),
                    CriticalDamageStatChance = reader.ReadByte("Item" + i.ToString(), "CriticalDamageStatChance", 1),
                    CriticalDamageMaxStat    = reader.ReadByte("Item" + i.ToString(), "CriticalDamageMaxStat", 1),
                    FreezeChance             = reader.ReadByte("Item" + i.ToString(), "FreezeChance", 0),
                    FreezeStatChance         = reader.ReadByte("Item" + i.ToString(), "FreezeStatChance", 1),
                    FreezeMaxStat            = reader.ReadByte("Item" + i.ToString(), "FreezeMaxStat", 1),
                    PoisonAttackChance       = reader.ReadByte("Item" + i.ToString(), "PoisonAttackChance", 0),
                    PoisonAttackStatChance   = reader.ReadByte("Item" + i.ToString(), "PoisonAttackStatChance", 1),
                    PoisonAttackMaxStat      = reader.ReadByte("Item" + i.ToString(), "PoisonAttackMaxStat", 1),
                    AttackSpeedChance        = reader.ReadByte("Item" + i.ToString(), "AttackSpeedChance", 0),
                    AttackSpeedStatChance    = reader.ReadByte("Item" + i.ToString(), "AttackSpeedStatChance", 1),
                    AttackSpeedMaxStat       = reader.ReadByte("Item" + i.ToString(), "AttackSpeedMaxStat", 1),
                    LuckChance               = reader.ReadByte("Item" + i.ToString(), "LuckChance", 0),
                    LuckStatChance           = reader.ReadByte("Item" + i.ToString(), "LuckStatChance", 1),
                    LuckMaxStat              = reader.ReadByte("Item" + i.ToString(), "LuckMaxStat", 1),
                    CurseChance              = reader.ReadByte("Item" + i.ToString(), "CurseChance", 0)
                };
                RandomItemStatsList.Add(stat);
                i++;
            }
        }