Example #1
0
        private void LoadRecallCoordinates()
        {
            RecallCoordinates = new Dictionary <string, RecallCoordinate>();
            if (!File.Exists(folder + @"\RecallCoordinates.txt"))
            {
                Log.WriteLine(LogLevel.Warn, "Could not find RecallCoordinates.txt, return scrolls won't work.");
                return;
            }

            using (var data = new ShineReader(folder + @"\RecallCoordinates.txt"))
            {
                var recallData = data["RecallPoint"];

                using (var reader = new DataTableReaderEx(recallData))
                {
                    while (reader.Read())
                    {
                        var rc = RecallCoordinate.Load(reader);
                        RecallCoordinates.Add(rc.ItemIndex, rc);
                    }
                }

                Log.WriteLine(LogLevel.Info, "Loaded {0} recall coordinates.", RecallCoordinates.Count);
            }
        }
Example #2
0
        public static ActiveSkillInfo Load(DataTableReaderEx reader)
        {
            ActiveSkillInfo inf = new ActiveSkillInfo
            {
                ID         = reader.GetUInt16("ID"),
                Name       = reader.GetString("InxName"),
                Step       = reader.GetByte("Step"),
                Required   = reader.GetString("DemandSk"),
                SP         = reader.GetUInt16("SP"),
                HP         = reader.GetUInt16("HP"),
                Range      = reader.GetUInt16("Range"),
                CoolTime   = reader.GetUInt32("DlyTime"),
                CastTime   = reader.GetUInt32("CastTime"),
                DemandType = reader.GetByte("DemandType"),
                MaxTargets = reader.GetByte("TargetNumber"),
            };

            ushort maxdamage = (ushort)reader.GetUInt32("MaxWC");

            if (maxdamage == 0)
            {
                inf.IsMagic   = true;
                inf.MinDamage = (ushort)reader.GetUInt32("MinMA");
                inf.MaxDamage = (ushort)reader.GetUInt32("MaxMA");
            }
            else
            {
                inf.MaxDamage = maxdamage;
                inf.MinDamage = (ushort)reader.GetUInt32("MinWC");
            }
            return(inf);
        }
Example #3
0
        public void LoadItemInfo()
        {
            if (File.Exists(@"ItemInfo.shn"))
            {
                if (!ItemsLoadet)
                {
                    ItemsByID = new Dictionary<ushort, ItemInfo>();
                    ItemsByName = new Dictionary<string, ItemInfo>();
                    using (var file = new SHNFile(@"ItemInfo.shn"))
                    {
                        using (DataTableReaderEx reader = new DataTableReaderEx(file))
                        {

                            while (reader.Read())
                            {
                                ItemInfo info = ItemInfo.Load(reader);
                                if (ItemsByID.ContainsKey(info.ItemID) || ItemsByName.ContainsKey(info.InxName))
                                {

                                    continue;
                                }
                                ItemsByID.Add(info.ItemID, info);
                                ItemsByName.Add(info.InxName, info);
                            }
                        }
                    }
                    ItemsLoadet = true;
                    MessageBox.Show("ItemInfo Load successful");
                }
            }
            else
            {
                MessageBox.Show("ItemInfo not Found in The Directory from the Program");
            }
        }
Example #4
0
        /// <summary>
        /// Needs serious fixing in the reader, as it throws invalid casts (files all use uint, but f**k those)
        /// </summary>
        /// <param name="reader"></param>
        /// <returns></returns>
        public static ItemInfo Load(DataTableReaderEx reader)
        {
            ItemInfo itemInfo = new ItemInfo
            {
                ItemID       = reader.GetUInt16("id"),
                EquipType    = (byte)reader.GetUInt32("equip"),
                InxName      = reader.GetString("inxname"),
                MaxLot       = (byte)reader.GetUInt32("maxlot"),
                AttackSpeed  = (ushort)reader.GetUInt32("atkspeed"),
                Level        = (byte)reader.GetUInt32("demandlv"),
                Type         = (byte)reader.GetUInt32("type"),
                Class        = (byte)reader.GetUInt32("class"),
                UpgradeLimit = reader.GetByte("uplimit"),
                Jobs         = (byte)reader.GetUInt32("whoequip"),
                TwoHand      = reader.GetBoolean("TwoHand"),
                MinMagic     = (ushort)reader.GetUInt32("minma"),
                MaxMagic     = (ushort)reader.GetUInt32("maxma"),
                MinMelee     = (ushort)reader.GetUInt32("minwc"),
                MaxMelee     = (ushort)reader.GetUInt32("maxwc"),
                WeaponDef    = (ushort)reader.GetUInt32("ac"),
                MagicDef     = (ushort)reader.GetUInt32("mr"),
                UpSucRation  = reader.GetUInt16("UpSucRatio"),
                UpResource   = reader.GetByte("UpResource")
            };

            return(itemInfo);
        }
Example #5
0
 public void LoadItemInfo()
 {
     if (File.Exists(@"ItemInfo.shn"))
     {
         if (!ItemsLoadet)
         {
             ItemsByID   = new Dictionary <ushort, ItemInfo>();
             ItemsByName = new Dictionary <string, ItemInfo>();
             using (var file = new SHNFile(@"ItemInfo.shn"))
             {
                 using (DataTableReaderEx reader = new DataTableReaderEx(file))
                 {
                     while (reader.Read())
                     {
                         ItemInfo info = ItemInfo.Load(reader);
                         if (ItemsByID.ContainsKey(info.ItemID) || ItemsByName.ContainsKey(info.InxName))
                         {
                             continue;
                         }
                         ItemsByID.Add(info.ItemID, info);
                         ItemsByName.Add(info.InxName, info);
                     }
                 }
             }
             ItemsLoadet = true;
             MessageBox.Show("ItemInfo Load successful");
         }
     }
     else
     {
         MessageBox.Show("ItemInfo not Found in The Directory from the Program");
     }
 }
Example #6
0
        // public int Slot { get; set; } // No idea, only 5 or 10
        // public string Name { get; set; } // Not needed for now
        // public ushort CastTime { get; set; } // Not needed for now

        public MiniHouseInfo(DataTableReaderEx reader)
        {
            ID            = reader.GetUInt16("Handle");
            KeepTime_Hour = reader.GetUInt16("KeepTime_Hour");
            HPTick        = reader.GetUInt16("HPTick");
            SPTick        = reader.GetUInt16("SPTick");
            HPRecovery    = reader.GetUInt16("HPRecovery");
            SPRecovery    = reader.GetUInt16("SPRecovery");
        }
Example #7
0
        public static MobInfoServer Load(DataTableReaderEx reader)
        {
            MobInfoServer info = new MobInfoServer
            {
                ID              = reader.GetUInt32("ID"),
                InxName         = reader.GetString("InxName"),
                Visible         = reader.GetByte("Visible"),
                AC              = reader.GetUInt16("AC"),
                TB              = reader.GetUInt16("TB"),
                MR              = reader.GetUInt16("MR"),
                MB              = reader.GetUInt16("MB"),
                EnemyDetectType = reader.GetUInt32("EnemyDetectType"),
                MobKillInx      = reader.GetUInt32("MobKillInx"),
                MonEXP          = reader.GetUInt32("MonEXP"),
                EXPRange        = reader.GetUInt16("EXPRange"),
                DetectCha       = reader.GetUInt16("DetectCha"),
                ResetInterval   = reader.GetByte("ResetInterval"),
                CutInterval     = reader.GetUInt16("CutInterval"),
                CutNonAT        = reader.GetUInt32("CutNonAT"),
                FollowCha       = reader.GetUInt32("FollowCha"),
                PceHPRcvDly     = reader.GetUInt16("PceHPRcvDly"),
                PceHPRcv        = reader.GetUInt16("PceHPRcv"),
                AtkHPRcvDly     = reader.GetUInt16("AtkHPRcvDly"),
                AtkHPRcv        = reader.GetUInt16("AtkHPRcv"),
                Str             = reader.GetUInt16("Str"),
                Dex             = reader.GetUInt16("Dex"),
                Con             = reader.GetUInt16("Con"),
                Int             = reader.GetUInt16("Int"),
                Men             = reader.GetUInt16("Men"),
                MobRaceType     = reader.GetUInt32("MobRaceType"),
                Rank            = reader.GetByte("Rank"),
                FamilyArea      = reader.GetUInt32("FamilyArea"),
                FamilyRescArea  = reader.GetUInt32("FamilyRescArea"),
                FamilyRescCount = reader.GetByte("FamilyRescCount"),
                BloodingResi    = reader.GetUInt16("BloodingResi"),
                StunResi        = reader.GetUInt16("StunResi"),
                MoveSpeedResi   = reader.GetUInt16("MoveSpeedResi"),
                FearResi        = reader.GetUInt16("FearResi"),
                ResIndex        = reader.GetString("ResIndex"),
                KQKillPoint     = reader.GetUInt16("KQKillPoint"),
                Return2Regen    = reader.GetByte("Return2Regen"),
                IsRoaming       = reader.GetByte("IsRoaming"),
                RoamingNumber   = reader.GetByte("RoamingNumber"),
                RoamingDistance = reader.GetUInt16("RoamingDistance"),
                MaxSP           = reader.GetUInt16("MaxSP"),
                BroadAtDead     = reader.GetByte("BroadAtDead"),
                TurnSpeed       = reader.GetUInt16("TurnSpeed"),
                WalkChase       = reader.GetUInt16("WalkChase"),
                AllCanLoot      = reader.GetByte("AllCanLoot"),
                DmgByHealMin    = reader.GetUInt16("DmgByHealMin"),
                DmgByHealMax    = reader.GetUInt16("DmgByHealMax"),
            };

            return(info);
        }
Example #8
0
        public static RecallCoordinate Load(DataTableReaderEx reader)
        {
            RecallCoordinate info = new RecallCoordinate
            {
                ItemIndex = reader.GetString("ItemIndex"),
                MapName   = reader.GetString("MapName"),
                LinkX     = reader.GetInt16("LinkX"),
                LinkY     = reader.GetInt16("LinkY"),
            };

            return(info);
        }
Example #9
0
        public void LoadItemInfo()
        {
            Dictionary <string, ItemUseEffectInfo> effectcache = new Dictionary <string, ItemUseEffectInfo>();

            ItemUseEffects = new Dictionary <ushort, ItemUseEffectInfo>();
            using (var file = new SHNFile(folder + @"\ItemUseEffect.shn"))
            {
                using (DataTableReaderEx reader = new DataTableReaderEx(file))
                {
                    while (reader.Read())
                    {
                        string            inxname;
                        ItemUseEffectInfo info = ItemUseEffectInfo.Load(reader, out inxname);
                        effectcache.Add(inxname, info);
                    }
                }
            }


            ItemsByID   = new Dictionary <ushort, ItemInfo>();
            ItemsByName = new Dictionary <string, ItemInfo>();
            using (var file = new SHNFile(folder + @"\ItemInfo.shn"))
            {
                using (DataTableReaderEx reader = new DataTableReaderEx(file))
                {
                    while (reader.Read())
                    {
                        ItemInfo info = ItemInfo.Load(reader);
                        if (ItemsByID.ContainsKey(info.ItemID) || ItemsByName.ContainsKey(info.InxName))
                        {
                            Log.WriteLine(LogLevel.Warn, "Duplicate item found ID: {0} ({1}).", info.ItemID, info.InxName);
                            continue;
                        }
                        ItemsByID.Add(info.ItemID, info);
                        ItemsByName.Add(info.InxName, info);

                        if (effectcache.ContainsKey(info.InxName))
                        {
                            if (info.Type != ItemType.Useable)
                            {
                                Log.WriteLine(LogLevel.Warn, "Invalid useable item: {0} ({1})", info.ItemID, info.InxName);
                                continue;
                            }
                            ItemUseEffectInfo effectinfo = effectcache[info.InxName];
                            effectinfo.ID = info.ItemID;
                            ItemUseEffects.Add(effectinfo.ID, effectinfo);
                        }
                    }
                }
            }
            effectcache.Clear();
            Log.WriteLine(LogLevel.Info, "Loaded {0} items.", ItemsByID.Count);
        }
Example #10
0
        public static DropGroupInfo Load(DataTableReaderEx reader)
        {
            DropGroupInfo info = new DropGroupInfo()
            {
                GroupID  = reader.GetString("ItemID"),
                MinCount = reader.GetByte("MinQtty"),
                MaxCount = reader.GetByte("MaxQtty"),
                Items    = new List <ItemInfo>()
            };

            return(info);
        }
Example #11
0
        public static MapInfo Load(DataTableReaderEx reader)
        {
            MapInfo info = new MapInfo
            {
                ID        = reader.GetUInt16("ID"),
                ShortName = reader.GetString("MapName"),
                FullName  = reader.GetString("Name"),
                RegenX    = (int)reader.GetUInt32("RegenX"),
                RegenY    = (int)reader.GetUInt16("RegenY"),
                Kingdom   = reader.GetByte("KingdomMap"),
                ViewRange = (ushort)reader.GetUInt32("Sight"),
            };

            return(info);
        }
Example #12
0
 private void LoadBadNames()
 {
     BadNames = new List <string>();
     using (var file = new SHNFile(folder + @"\BadNameFilter.shn"))
     {
         using (DataTableReaderEx reader = new DataTableReaderEx(file))
         {
             while (reader.Read())
             {
                 // Columns: BadName Type
                 BadNames.Add(reader.GetString("BadName").ToLower());
             }
         }
     }
     Log.WriteLine(LogLevel.Info, "Loaded {0} bad names.", BadNames.Count);
 }
Example #13
0
        public static ShineNPC Load(DataTableReaderEx reader)
        {
            ShineNPC info = new ShineNPC
            {
                MobName  = reader.GetString("MobName"),
                Map      = reader.GetString("Map"),
                Coord_X  = reader.GetInt32("Coord-X"),
                Coord_Y  = reader.GetInt32("Coord-Y"),
                Direct   = reader.GetInt16("Direct"),
                NPCMenu  = reader.GetByte("NPCMenu"),
                Role     = reader.GetString("Role"),
                RoleArg0 = reader.GetString("RoleArg0"),
            };

            return(info);
        }
Example #14
0
 public void LoadMiniHouseInfo()
 {
     MiniHouses = new Dictionary <ushort, MiniHouseInfo>();
     using (var file = new SHNFile(folder + @"\MiniHouse.shn"))
     {
         using (DataTableReaderEx reader = new DataTableReaderEx(file))
         {
             while (reader.Read())
             {
                 MiniHouseInfo mhi = new MiniHouseInfo(reader);
                 MiniHouses.Add(mhi.ID, mhi);
             }
         }
     }
     Log.WriteLine(LogLevel.Info, "Loaded {0} Mini Houses.", MiniHouses.Count);
 }
Example #15
0
        public static LinkTable Load(DataTableReaderEx reader)
        {
            LinkTable info = new LinkTable
            {
                argument  = reader.GetString("argument"),
                MapServer = reader.GetString("MapServer"),
                MapClient = reader.GetString("MapClient"),
                Coord_X   = reader.GetInt32("Coord-X"),
                Coord_Y   = reader.GetInt32("Coord-Y"),
                Direct    = reader.GetInt16("Direct"),
                LevelFrom = reader.GetInt16("LevelFrom"),
                LevelTo   = reader.GetInt16("LevelTo"),
                Party     = reader.GetByte("Party"),
            };

            return(info);
        }
Example #16
0
 private void LoadMaps()
 {
     Maps = new Dictionary <ushort, MapInfo>();
     using (DataTableReaderEx reader = new DataTableReaderEx(new SHNFile(folder + @"\MapInfo.shn")))
     {
         while (reader.Read())
         {
             MapInfo info = MapInfo.Load(reader);
             if (Maps.ContainsKey(info.ID))
             {
                 Log.WriteLine(LogLevel.Debug, "Duplicate map ID {0} ({1})", info.ID, info.FullName);
                 Maps.Remove(info.ID);
             }
             Maps.Add(info.ID, info);
         }
     }
 }
Example #17
0
        public static MobInfo Load(DataTableReaderEx reader)
        {
            MobInfo inf = new MobInfo
            {
                Name     = reader.GetString("InxName"),
                ID       = reader.GetUInt16("ID"),
                Level    = (byte)reader.GetUInt32("Level"),
                MaxHP    = reader.GetUInt32("MaxHP"),
                RunSpeed = (ushort)reader.GetUInt32("RunSpeed"),
                IsNPC    = Convert.ToBoolean(reader.GetByte("IsNPC")),
                Size     = (ushort)reader.GetUInt32("Size"),
                Type     = (byte)reader.GetUInt32("Type"),
                IsAggro  = Convert.ToBoolean(reader.GetByte("IsPlayerSide")),
                Drops    = new List <DropInfo>()
            };

            return(inf);
        }
Example #18
0
        private void LoadMobs()
        {
            MobsByID   = new Dictionary <ushort, MobInfo>();
            MobsByName = new Dictionary <string, MobInfo>();
            using (var file = new SHNFile(folder + @"\MobInfo.shn"))
            {
                using (DataTableReaderEx reader = new DataTableReaderEx(file))
                {
                    while (reader.Read())
                    {
                        MobInfo info = MobInfo.Load(reader);
                        if (MobsByID.ContainsKey(info.ID) || MobsByName.ContainsKey(info.Name))
                        {
                            Log.WriteLine(LogLevel.Warn, "Duplicate mob ID found in MobInfo.shn: {0}.", info.ID);
                            continue;
                        }
                        MobsByID.Add(info.ID, info);
                        MobsByName.Add(info.Name, info);
                    }
                }
            }
            Log.WriteLine(LogLevel.Info, "Loaded {0} mobs.", MobsByID.Count);

            MobData = new Dictionary <string, MobInfoServer>();
            using (var file = new SHNFile(folder + @"\MobInfoServer.shn"))
            {
                using (DataTableReaderEx reader = new DataTableReaderEx(file))
                {
                    while (reader.Read())
                    {
                        MobInfoServer info = MobInfoServer.Load(reader);
                        if (MobData.ContainsKey(info.InxName))
                        {
                            Log.WriteLine(LogLevel.Warn, "Duplicate mob ID found in MobInfoServer.shn: {0}.", info.InxName);
                            continue;
                        }
                        MobData.Add(info.InxName, info);
                    }
                }
            }
            Log.WriteLine(LogLevel.Info, "Loaded {0} mob infos.", MobsByID.Count);
        }
Example #19
0
        public static FiestaBaseStat Load(DataTableReaderEx reader, Job job)
        {
            FiestaBaseStat info = new FiestaBaseStat
            {
                Job           = job,
                Level         = reader.GetInt32("Level"),
                Strength      = reader.GetInt32("Strength"),
                Endurance     = reader.GetInt32("Constitution"),
                Intelligence  = reader.GetInt32("Intelligence"),
                Dexterity     = reader.GetInt32("Dexterity"),
                Spirit        = reader.GetInt32("MentalPower"),
                SoulHP        = reader.GetInt32("SoulHP"),
                MAXSoulHP     = reader.GetInt32("MAXSoulHP"),
                PriceHPStone  = reader.GetInt32("PriceHPStone"),
                SoulSP        = reader.GetInt32("SoulSP"),
                MAXSoulSP     = reader.GetInt32("MAXSoulSP"),
                PriceSPStone  = reader.GetInt32("PriceSPStone"),
                AtkPerAP      = reader.GetInt32("AtkPerAP"),
                DmgPerAP      = reader.GetInt32("DmgPerAP"),
                MaxPwrStone   = reader.GetInt32("MaxPwrStone"),
                NumPwrStone   = reader.GetInt32("NumPwrStone"),
                PricePwrStone = reader.GetInt32("PricePwrStone"),
                PwrStoneWC    = reader.GetInt32("PwrStoneWC"),
                PwrStoneMA    = reader.GetInt32("PwrStoneMA"),
                MaxGrdStone   = reader.GetInt32("MaxGrdStone"),
                NumGrdStone   = reader.GetInt32("NumGrdStone"),
                PriceGrdStone = reader.GetInt32("PriceGrdStone"),
                GrdStoneAC    = reader.GetInt32("GrdStoneAC"),
                GrdStoneMR    = reader.GetInt32("GrdStoneMR"),
                PainRes       = reader.GetInt32("PainRes"),
                RestraintRes  = reader.GetInt32("RestraintRes"),
                CurseRes      = reader.GetInt32("CurseRes"),
                ShockRes      = reader.GetInt32("ShockRes"),
                MaxHP         = (UInt32)reader.GetInt16("MaxHP"),
                MaxSP         = (UInt32)reader.GetInt16("MaxSP"),
                CharTitlePt   = reader.GetInt32("CharTitlePt"),
                SkillPwrPt    = reader.GetInt32("SkillPwrPt"),
            };

            return(info);
        }
Example #20
0
 private void LoadItemInfoServer()
 {
     try
     {
         using (var reader = new DataTableReaderEx(new SHNFile(folder + @"\ItemInfoServer.shn")))
         {
             while (reader.Read())
             {
                 ushort   itemid = (ushort)reader.GetUInt32("ID");
                 ItemInfo item;
                 if (ItemsByID.TryGetValue(itemid, out item))
                 {
                     for (int i = 0; i < 3; i++)
                     {
                         string groupname = reader.GetString(DropGroupNames[i]);
                         if (groupname.Length > 2)
                         {
                             DropGroupInfo group;
                             if (DropGroups.TryGetValue(groupname, out group))
                             {
                                 group.Items.Add(item);
                             }
                             else
                             {
                                 //Log.WriteLine(LogLevel.Warn, "{0} was assigned to unknown DropGroup {1}.", item.InxName, groupname);
                             }
                         }
                     }
                 }
                 else
                 {
                     Log.WriteLine(LogLevel.Warn, "ItemInfoServer has obsolete item ID: {0}.", itemid);
                 }
             }
         }
     }
     catch (Exception ex)
     {
         Log.WriteLine(LogLevel.Exception, "Error loading ItemInfoServer.shn: {0}", ex);
     }
 }
Example #21
0
 public void LoadExpTable()
 {
     ExpTable = new Dictionary <byte, ulong>();
     try
     {
         using (var tables = new ShineReader(folder + @"\ChrCommon.txt"))
         {
             using (DataTableReaderEx reader = new DataTableReaderEx(tables["StatTable"]))
             {
                 while (reader.Read())
                 {
                     ExpTable.Add(reader.GetByte("level"), reader.GetUInt64("NextExp"));
                 }
             }
         }
     }
     catch (Exception ex)
     {
         Log.WriteLine(LogLevel.Exception, "Couldn't load EXP table: {0}", ex.ToString());
     }
 }
Example #22
0
        public static ItemUseEffectInfo Load(DataTableReaderEx reader, out string InxName)
        {
            ItemUseEffectInfo info = new ItemUseEffectInfo();

            InxName = reader.GetString("ItemIndex");

            ItemUseEffectType typeA = (ItemUseEffectType)reader.GetUInt32("UseEffectA");

            if (typeA != ItemUseEffectType.None)
            {
                ItemEffect effect = new ItemEffect();
                effect.Type  = typeA;
                effect.Value = reader.GetUInt32("UseValueA");
                info.Effects.Add(effect);
            }

            ItemUseEffectType typeB = (ItemUseEffectType)reader.GetUInt32("UseEffectB");

            if (typeB != ItemUseEffectType.None)
            {
                ItemEffect effect = new ItemEffect();
                effect.Type  = typeB;
                effect.Value = reader.GetUInt32("UseValueB");
                info.Effects.Add(effect);
            }

            ItemUseEffectType typeC = (ItemUseEffectType)reader.GetUInt32("UseEffectC");

            if (typeC != ItemUseEffectType.None)
            {
                ItemEffect effect = new ItemEffect();
                effect.Type  = typeC;
                effect.Value = reader.GetUInt32("UseValueC");
                info.Effects.Add(effect);
            }
            info.AbState = reader.GetString("UseAbStateName");
            return(info);
        }
Example #23
0
 private void LoadActiveSkills()
 {
     ActiveSkillsByID   = new Dictionary <ushort, ActiveSkillInfo>();
     ActiveSkillsByName = new Dictionary <string, ActiveSkillInfo>();
     using (var file = new SHNFile(folder + @"\ActiveSkill.shn"))
     {
         using (DataTableReaderEx reader = new DataTableReaderEx(file))
         {
             while (reader.Read())
             {
                 ActiveSkillInfo info = ActiveSkillInfo.Load(reader);
                 if (ActiveSkillsByID.ContainsKey(info.ID) || ActiveSkillsByName.ContainsKey(info.Name))
                 {
                     Log.WriteLine(LogLevel.Warn, "Duplicate ActiveSkill found: {0} ({1})", info.ID, info.Name);
                     continue;
                 }
                 ActiveSkillsByID.Add(info.ID, info);
                 ActiveSkillsByName.Add(info.Name, info);
             }
         }
     }
     Log.WriteLine(LogLevel.Info, "Loaded {0} ActiveSkills.", ActiveSkillsByID.Count);
 }
Example #24
0
        public void LoadMaps(List <ushort> toload = null)
        {
            MapsByID   = new Dictionary <ushort, MapInfo>();
            MapsByName = new Dictionary <string, MapInfo>();
            using (var file = new SHNFile(folder + @"\MapInfo.shn"))
            {
                using (DataTableReaderEx reader = new DataTableReaderEx(file))
                {
                    while (reader.Read())
                    {
                        MapInfo info = MapInfo.Load(reader);
                        info.NPCs = new List <ShineNPC>();
                        if (MapsByID.ContainsKey(info.ID))
                        {
                            Log.WriteLine(LogLevel.Debug, "Duplicate map ID {0} ({1})", info.ID, info.FullName);
                            MapsByID.Remove(info.ID);
                            MapsByName.Remove(info.ShortName);
                        }
                        if (toload == null || toload.Contains(info.ID))
                        {
                            MapsByID.Add(info.ID, info);
                            MapsByName.Add(info.ShortName, info);
                        }
                    }
                }
            }

            Blocks = new Dictionary <ushort, BlockInfo>();
            foreach (var map in MapsByID.Values)
            {
                string renderpath = folder + @"\BlockInfo\" + map.ShortName + ".shbd";
                if (File.Exists(renderpath))
                {
                    BlockInfo info = new BlockInfo(renderpath, map.ID);
                    Blocks.Add(map.ID, info);
                }
            }


            using (var tables = new ShineReader(folder + @"\NPC.txt"))
            {
                NpcLinkTable = new Dictionary <string, LinkTable>();
                using (DataTableReaderEx reader = new DataTableReaderEx(tables["LinkTable"]))
                {
                    while (reader.Read())
                    {
                        LinkTable link = LinkTable.Load(reader);
                        if (Program.IsLoaded(GetMapidFromMapShortName(link.MapClient)))
                        {
                            NpcLinkTable.Add(link.argument, link);
                        }
                    }
                }

                using (DataTableReaderEx reader = new DataTableReaderEx(tables["ShineNPC"]))
                {
                    while (reader.Read())
                    {
                        ShineNPC npc = ShineNPC.Load(reader);
                        MapInfo  mi  = null;
                        if (Program.IsLoaded(GetMapidFromMapShortName(npc.Map)) && MapsByName.TryGetValue(npc.Map, out mi))
                        {
                            mi.NPCs.Add(npc);
                        }
                    }
                }
            }

            Log.WriteLine(LogLevel.Info, "Loaded {0} maps.", MapsByID.Count);
        }
Example #25
0
        public void LoadJobStatsNEW()
        {
            // Temp set a dict for every job/filename
            Dictionary <string, Job> sj = new Dictionary <string, Job>();

            sj.Add("Archer", Job.Archer);
            sj.Add("Assassin", Job.Reaper);
            sj.Add("Chaser", Job.Gambit);
            sj.Add("Cleric", Job.Cleric);
            sj.Add("CleverFighter", Job.CleverFighter);
            sj.Add("Closer", Job.Spectre);
            sj.Add("Cruel", Job.Renegade);
            sj.Add("Enchanter", Job.Enchanter);
            sj.Add("Fighter", Job.Fighter);
            sj.Add("Gladiator", Job.Gladiator);
            sj.Add("Guardian", Job.Guardian);
            sj.Add("HawkArcher", Job.HawkArcher);
            sj.Add("HighCleric", Job.HighCleric);
            sj.Add("HolyKnight", Job.HolyKnight);
            sj.Add("Joker", Job.Trickster); // hah
            sj.Add("Knight", Job.Knight);
            sj.Add("Mage", Job.Mage);
            sj.Add("Paladin", Job.Paladin);
            sj.Add("Ranger", Job.Ranger);
            sj.Add("Scout", Job.Scout);
            sj.Add("SharpShooter", Job.SharpShooter);
            sj.Add("Warrock", Job.Warlock); // ITS A GAME. AND YOU LOST IT
            sj.Add("Warrior", Job.Warrior);
            sj.Add("Wizard", Job.Wizard);
            sj.Add("WizMage", Job.WizMage);

            // DAMN THATS A LONG LIST

            Log.WriteLine(LogLevel.Debug, "Trying to load {0} jobs.", sj.Count);
            JobInfos = new Dictionary <Job, List <FiestaBaseStat> >();

            foreach (var kvp in sj)
            {
                // Make the filename and see if we can find it's stats
                string file = string.Format(folder + @"\Stats\Param{0}Server.txt", kvp.Key);
                if (!File.Exists(file))
                {
                    Log.WriteLine(LogLevel.Error, "Could not find file {0}!", file);
                    continue;
                }
                List <FiestaBaseStat> stats = new List <FiestaBaseStat>();
                using (var tables = new ShineReader(file))
                {
                    if (tables.FileContents.Count == 0)
                    {
                        Log.WriteLine(LogLevel.Warn, "Corrupt ShineTable file.");
                        continue;
                    }

                    using (var reader = new DataTableReaderEx(tables["Param"]))
                    {
                        while (reader.Read())
                        {
                            stats.Add(FiestaBaseStat.Load(reader, kvp.Value));
                        }
                    }
                }

                JobInfos.Add(kvp.Value, stats);
                //   Log.WriteLine(LogLevel.Debug, "Loaded {0} levels for job {1}", stats.Count, kvp.Value.ToString());
            }
        }
Example #26
0
        private void LoadDrops()
        {
            DropGroups = new Dictionary <string, DropGroupInfo>();
            try
            {
                //first we load the dropgroups
                using (var groupfile = new ShineReader(folder + @"\ItemDropGroup.txt"))
                {
                    var table = groupfile["ItemDropGroup"];
                    using (var reader = new DataTableReaderEx(table))
                    {
                        while (reader.Read())
                        {
                            DropGroupInfo info = DropGroupInfo.Load(reader);
                            if (DropGroups.ContainsKey(info.GroupID))
                            {
                                //Log.WriteLine(LogLevel.Warn, "Duplicate DropGroup ID found: {0}.", info.GroupID);
                                continue;
                            }
                            DropGroups.Add(info.GroupID, info);
                        }
                    }
                }

                //now we load the actual drops
                int dropcount = 0;
                using (var tablefile = new ShineReader(folder + @"\ItemDropTable.txt"))
                {
                    var table = tablefile["ItemGroup"];
                    using (var reader = new DataTableReaderEx(table))
                    {
                        while (reader.Read())
                        {
                            string  mobid = reader.GetString("MobId");
                            MobInfo mob;
                            if (MobsByName.TryGetValue(mobid, out mob))
                            {
                                mob.MinDropLevel = (byte)reader.GetInt16("MinLevel");
                                mob.MaxDropLevel = (byte)reader.GetInt16("MaxLevel");
                                for (int i = 1; i <= 45; ++i)
                                {
                                    string dropgroup = reader.GetString("DrItem" + i);
                                    if (dropgroup.Length <= 2)
                                    {
                                        continue;
                                    }
                                    DropGroupInfo group;
                                    if (DropGroups.TryGetValue(dropgroup, out group))
                                    {
                                        float    rate = reader.GetInt32("DrItem" + i + "R") / 100000f;
                                        DropInfo info = new DropInfo(group, rate);
                                        mob.Drops.Add(info);
                                        ++dropcount;
                                    }
                                    else
                                    {
                                        //this seems to happen a lot so disable this for the heck of it.
                                        // Log.WriteLine(LogLevel.Warn, "Could not find DropGroup {0}.", dropgroup);
                                    }
                                }
                            }
                            else
                            {
                                Log.WriteLine(LogLevel.Warn, "Could not find mobname: {0} for drop.", mobid);
                            }
                        }
                    }
                }
                Log.WriteLine(LogLevel.Info, "Loaded {0} DropGroups, with {1} drops in total.", DropGroups.Count, dropcount);
            }
            catch (Exception ex)
            {
                Log.WriteLine(LogLevel.Exception, "Error loading DropTable: {0}", ex);
            }
        }
Example #27
0
 /// <summary>
 /// Needs serious fixing in the reader, as it throws invalid casts (files all use uint, but f**k those)
 /// </summary>
 /// <param name="reader"></param>
 /// <returns></returns>
 public static ItemInfo Load(DataTableReaderEx reader)
 {
     ItemInfo itemInfo = new ItemInfo
     {
         ItemID = reader.GetUInt16("id"),
         EquipType = (byte)reader.GetUInt32("equip"),
         InxName = reader.GetString("inxname"),
         MaxLot = (byte)reader.GetUInt32("maxlot"),
         AttackSpeed = (ushort)reader.GetUInt32("atkspeed"),
         Level = (byte)reader.GetUInt32("demandlv"),
         Type = (byte)reader.GetUInt32("type"),
         Class = (byte)reader.GetUInt32("class"),
         UpgradeLimit = reader.GetByte("uplimit"),
         Jobs = (byte)reader.GetUInt32("whoequip"),
         TwoHand = reader.GetBoolean("TwoHand"),
         MinMagic = (ushort)reader.GetUInt32("minma"),
         MaxMagic = (ushort)reader.GetUInt32("maxma"),
         MinMelee = (ushort)reader.GetUInt32("minwc"),
         MaxMelee = (ushort)reader.GetUInt32("maxwc"),
         WeaponDef = (ushort)reader.GetUInt32("ac"),
         MagicDef = (ushort)reader.GetUInt32("mr"),
         UpSucRation = reader.GetUInt16("UpSucRatio"),
         UpResource = reader.GetByte("UpResource")
     };
     return itemInfo;
 }