Esempio n. 1
0
        public static void LoadRefShopGroup()
        {
            try
            {
                using (System.IO.TextReader streamReader = new System.IO.StringReader(reader.GetFileText("refshopgroup.txt")))
                {
                    string line = streamReader.ReadLine();
                    while (line != null)
                    {
                        if (line == "" || line.Contains('\t') == false)
                        {
                            line = streamReader.ReadLine();
                            continue;
                        }

                        string[] vars = line.Split('\t');

                        if (vars.Length >= 5)
                        {
                            string StoreName = "";
                            string GroupName = "";
                            try
                            {
                                bool Used = (vars[0] == "1") ? true : false;
                                if (Used)
                                {
                                    GroupName = vars[3];
                                    string NPCName = vars[4];
                                    StoreName = Data.refmappingshopgroup[GroupName];
                                    var shop = new DataInfo.Shops.Shop(StoreName);
                                    shop.StoreGroupName = GroupName;
                                    shop.NPCName        = NPCName;
                                    shop.ShopGroups.AddRange(Data.refmappingshopwithtab[StoreName]);
                                    Data.MediaShops.Add(shop);
                                    //Data.refshopgroup.Add(NPCName, GroupName);
                                }
                            }
                            catch (Exception ex)
                            {
                                //Console.WriteLine("#########");
                                //Console.WriteLine(StoreName);
                                //Console.WriteLine(GroupName);
                                //Console.WriteLine("#########");
                            }
                        }

                        line = streamReader.ReadLine();
                    }
                }
            }
            catch (Exception ex)

            {
                throw new Exception("Error mapping package items to items." + ex.Message);
            }
        }
Esempio n. 2
0
        public static void LoadRefShop()
        {
            try
            {
                using (System.IO.TextReader streamReader = new System.IO.StringReader(reader.GetFileText("refshop.txt")))
                {
                    string line = streamReader.ReadLine();

                    while (line != null)
                    {
                        if (line == "" || line.Contains('\t') == false)
                        {
                            line = streamReader.ReadLine();
                            continue;
                        }

                        string[] vars = line.Split('\t');
                        if (vars.Length >= 5)
                        {
                            try
                            {
                                bool Used = (vars[0] == "1") ? true : false;
                                if (Used)
                                {
                                    int    ID        = Int32.Parse(vars[2]);
                                    string StoreName = vars[3];
                                    var    shop      = new DataInfo.Shops.Shop(StoreName);


                                    shop.StoreGroupName = Data.refmappingshopgroup[StoreName];
                                    shop.NPCName        = Data.refshopgroup[shop.StoreGroupName];
                                }
                            }
                            catch (Exception ex)
                            {
                                //Console.WriteLine(ex.Message + ex.StackTrace);
                            }
                        }

                        line = streamReader.ReadLine();
                    }
                }
            }
            catch (Exception ex)
            {
                throw new Exception("Error loading NPC Shops." + ex.Message);
            }
        }