public void TestMigration() { //var LiteDatabase = new LiteDB.LiteDatabase("main2v.db"); DataBase.Drop(); var tm = new TownManager(); var bdm = new BuildingDataManager(tm); var loader = new XmlLoader(bdm, tm, tm, tm); loader.LoadModel(); var max = loader.Items.OrderByDescending(x => x.Key.Length).First(); var md = new MarketDataManager(); md.Save(max.Key, 1, false, new ItemFromMarketData()); var ord = md.GetOrders(); Assert.AreEqual(1, ord.Count()); //DataBase.Instance.GetCollection<> }
public void TestUpdatePrice() { { DataBase.Drop(); var tm = new TownManager(); var bdm = new BuildingDataManager(tm); var loader = new XmlLoader(bdm, tm, tm, tm); loader.LoadModel(); var buildings = loader.CraftBuildings; var all = loader.Items; Assert.AreEqual(10, buildings["T8_FORGE"].Tax); buildings["T8_FORGE"].Tax = 0; _exp = 80000; var fired = 0; all["T4_OFF_SHIELD"].CostUpdate += () => { Assert.AreEqual(_exp, all["T4_OFF_SHIELD"].Cost); fired++; }; Assert.AreEqual(0, all["T4_OFF_SHIELD"].Cost); Assert.AreEqual(1, fired); Assert.AreEqual(80000, all["T4_OFF_SHIELD"].Cost); _exp = 3580000; buildings["T8_FORGE"].Tax = 10; // all["T4_OFF_SHIELD"].Building.Tax= 10; Assert.AreEqual(2, fired); Assert.AreEqual(3580000, all["T4_OFF_SHIELD"].Cost); } { var tm = new TownManager(); var mdm = new MarketDataManager(); var bdm = new BuildingDataManager(tm); var loader = new XmlLoader(bdm, tm, tm, tm); var model = loader.LoadModel(); var all = loader.Items; Assert.AreEqual(3580000, all["T4_OFF_SHIELD"].Cost); } }
public ProxyBuildingData(string id, BuildingDataManager manager, ITownManager crafTownManager) { _manager = manager; _crafTownManager = crafTownManager; _buildingData = new BuildingData(id); var data = manager.Rep.FindById(id); if (data != null) { var i = 0; foreach (var dataTaxData in data.TaxDatas) { _buildingData.TaxDatas[i++] = dataTaxData; if (i >= _buildingData.TaxDatas.Length) { break; } } } _crafTownManager.TownChanged += ManagerOnTownChanged; UpdateTax += OnUpdateTax; ManagerOnTownChanged(crafTownManager); }
public MainViewModel() { RefreshCommand = new RelayCommand(() => RaisePropertyChanged(nameof(CommonItems))); ClearBmCommand = new RelayCommand(ClearBm); ClearItemBmCommand = new RelayCommand <CommonItem>(ClearItemBm); ClearItemCommand = new RelayCommand <CommonItem>(ClearItem); OpenItemCommand = new RelayCommand <CommonItem>(OpenItem); Tirs = Enumerable.Repeat(new Tuple <string, int?>("-", null), 1) .Concat(Enumerable.Range(1, 8).Select(x => Tuple.Create(x.ToString(), (int?)x))); Enchants = Enumerable.Repeat(new Tuple <string, int?>("-", null), 1) .Concat(Enumerable.Range(0, 4).Select(x => Tuple.Create(x.ToString(), (int?)x))); Qualities = Enumerable.Repeat(new Tuple <string, int?>("-", null), 1) .Concat(Enumerable.Range(1, 5).Select(x => Tuple.Create(x.ToString(), (int?)x))); ShopCategories = Enumerable.Repeat(new Tuple <string, ShopCategory?>("-", null), 1).Concat(Enum .GetValues(typeof(ShopCategory)).Cast <ShopCategory?>() .Select(x => Tuple.Create(x.Value.ToString(), x))); ShopSubCategories = Enumerable.Repeat(new Tuple <string, ShopSubCategory?>("-", null), 1) .Concat(Enum.GetValues(typeof(ShopSubCategory)).Cast <ShopSubCategory?>() .Select(x => Tuple.Create(x.Value.ToString(), x))); BuyTownManager = new TownManager(); SellTownManager = new TownManager(); CraftTownManager = new TownManager(); AuctionTownManager = new TownManager(); _mdm = new MarketDataManager(); _bdm = new BuildingDataManager(CraftTownManager); var loader = new XmlLoader(_bdm, CraftTownManager, BuyTownManager, SellTownManager); loader.LoadModel(); Items = loader.Items.Values.Where(x => x.ShopSubCategory != Model.Items.Categories.ShopSubCategory.Event) .ToDictionary(k => k.Id + (k.QualityLevel > 1 ? $"_{k.QualityLevel}" : "")); LoadData(); Artefacts = loader.Artefacts; _debounceDispatcher = new DebounceDispatcher(); // foreach (var item in Items.Values) // { // item.PropertyChanged += (sender, args) => // { // //if (args.PropertyName == "Pos") // RefreshTree(); // }; // } BuildingsViewModel = new BuildingsViewModel(loader.CraftBuildings, CraftTownManager); _albionParser = new AlbionParser(); BuyTownManager.Town = Location.None; SellTownManager.Town = Location.None; CraftTownManager.Town = Location.None; AuctionTownManager.Town = Location.None; AuctionTownManager.TownChanged += p => { if (BuyTownManager.Town == Location.None) { BuyTownManager.Town = p.Town; } if (SellTownManager.Town == Location.None) { SellTownManager.Town = p.Town; } if (CraftTownManager.Town == Location.None) { CraftTownManager.Town = p.Town; } }; InitAlbionParser(); CostCalcOptions.Instance.ProfitsChanged += RefreshTree; CostCalcOptions.Instance.Changed += RefreshTree; }
public EmptyingMonitor() { _buildingManager = Singleton <BuildingManager> .instance; _confidurationManager = ConfigurationDataManager.Data; _buildingDataManager = BuildingDataManager.Data; }