Пример #1
0
        public static shop_data GetShopIndex(string name)
        {
            shop_data result = Data.ShopData.Find(delegate(shop_data bk)
            {
                return(bk.tab == name);
            }
                                                  );

            return(result);
            //if (result == id) return true;

            /*for (int i = 0; i < Data.ShopData.Count; i++)
             * {
             *  if (Data.ShopData[i].tab == name) return Data.ShopData[i];
             * }
             * return null;*/
        }
Пример #2
0
        /////////////////////////////////////////////////////////////////////////////////
        // Shop tabs
        /////////////////////////////////////////////////////////////////////////////////
        public static void LoadShopTabData()
        {
            TxtFile.ReadFromFile(@"\data\shopdata.txt", '\t');
            string s = null;
            int count = TxtFile.amountLine;
            byte[] co = new byte[28000];
            Shop_Alexandria();
            for (int l = 0; l <= TxtFile.amountLine - 1; l++)
            {
                s = TxtFile.lines[l].ToString();
                TxtFile.commands = s.Split('\t');
                int ID = Convert.ToInt32(TxtFile.commands[5]);

                if (ID > 0)
                    if (Data.ObjectBase[ID] != null)
                    {
                        string name = TxtFile.commands[2];
                        Data.ObjectBase[ID].StoreName = name;
                    }
            }
            Console.WriteLine("[INFO] Loaded " + TxtFile.amountLine + " Npc shop data");

            TxtFile.ReadFromFile(@"\data\refmappingshopwithtab.txt", '\t');
            count += TxtFile.amountLine;
            for (int l = 0; l <= TxtFile.amountLine - 1; l++)
            {
                s = TxtFile.lines[l].ToString();
                TxtFile.commands = s.Split('\t');
                string name = TxtFile.commands[2];
                int ID = GetNpcID(name);
                if (Data.ObjectBase[ID] != null)
                {
                    Data.ObjectBase[ID].Shop[co[ID]] = TxtFile.commands[3];
                    co[ID]++;
                }
            }
            Console.WriteLine("[INFO] Loaded " + TxtFile.amountLine + " Shop tabs");
            co = null;
            co = new byte[25000];

            TxtFile.ReadFromFile(@"\data\refshoptab.txt", '\t');
            count += TxtFile.amountLine;
            for (int l = 0; l <= TxtFile.amountLine - 1; l++)
            {
                s = TxtFile.lines[l].ToString();
                TxtFile.commands = s.Split('\t');
                string name = TxtFile.commands[4];
                int ID = GetNpcID_(name);
                if (Data.ObjectBase[ID] != null)
                {
                    shop_data sh = new shop_data();
                    sh.tab = TxtFile.commands[3];
                    Data.ShopData.Add(sh);
                    Data.ObjectBase[ID].Tab[co[ID]] = TxtFile.commands[3];
                    co[ID]++;
                }
            }
            co = null;

            TxtFile.ReadFromFile(@"\data\refshopgoods.txt", '\t');
            count += TxtFile.amountLine;
            for (int l = 0; l <= TxtFile.amountLine - 1; l++)
            {
                s = TxtFile.lines[l].ToString();
                TxtFile.commands = s.Split('\t');
                string name = TxtFile.commands[2];
                shop_data ID = shop_data.GetShopIndex(name);
                if (ID != null)
                {
                    TxtFile.commands[3] = TxtFile.commands[3].Remove(0, 8);
                    ID.Item[Convert.ToInt16(TxtFile.commands[4])] = TxtFile.commands[3];

                }
            }
            Console.WriteLine("[INFO] Loaded " + TxtFile.amountLine + " Shop items");
            SetShopData();
        }