Exemplo n.º 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);
            }
        }
Exemplo n.º 2
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());
     }
 }
Exemplo n.º 3
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);
        }
Exemplo n.º 4
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());
            }
        }
Exemplo n.º 5
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);
            }
        }