public static shop_data GetShopIndex(string name) { shop_data result = Manager.ShopData.Find(delegate(shop_data bk) { return(bk.tab == name); } ); return(result); //if (result == id) return true; /*for (int i = 0; i < ObjData.Manager.ShopData.Count; i++) * { * if (ObjData.Manager.ShopData[i].tab == name) return ObjData.Manager.ShopData[i]; * } * return null;*/ }
///////////////////////////////////////////////////////////////////////////////// // 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 (Manager.ObjectBase[ID] != null) { string name = TxtFile.commands[2]; Manager.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 (Manager.ObjectBase[ID] != null) { Manager.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 (Manager.ObjectBase[ID] != null) { shop_data sh = new shop_data(); sh.tab = TxtFile.commands[3]; Manager.ShopData.Add(sh); Manager.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(); }