Esempio n. 1
0
        public Order(Village village, string name, int quantity = 1)
        {
            id           = GetId();
            headquarters = new Headquarters();
            timberCamp   = new TimberCamp();
            clayPit      = new ClayPit();
            ironMine     = new IronMine();
            farm         = new Farm();
            warehouse    = new Warehouse();
            rallyPoint   = new RallyPoint();
            barracks     = new Barracks();
            statue       = new Statue();
            wall         = new Wall();
            hospital     = new Hospital();
            market       = new Market();
            tavern       = new Tavern();
            academy      = new Academy();
            hallOfOrders = new HallOfOrders();

            spearman      = new Spearman();
            swordsman     = new Swordsman();
            archer        = new Archer();
            heavyCavalry  = new HeavyCavalry();
            axeFighter    = new AxeFighter();
            lightCavalry  = new LightCavalry();
            mountedArcher = new MountedArcher();
            ram           = new Ram();
            catapult      = new Catapult();


            barracksInfos      = new List <PartialBarracksInfo>();
            farmInfos          = new List <PartialFarmInfo>();
            waitInfos          = new List <PartialWaitInfo>();
            barracksToDateTime = new Dictionary <int, DateTime>();
            stringToEntity     = new Dictionary <string, Entity>()
            {
                { "Headquarters", headquarters },
                { "TimberCamp", timberCamp },
                { "ClayPit", clayPit },
                { "IronMine", ironMine },
                { "Farm", farm },
                { "Warehouse", warehouse },
                { "RallyPoint", rallyPoint },
                { "Barracks", barracks },
                { "Statue", statue },
                { "Wall", wall },
                { "Hospital", hospital },
                { "Market", market },
                { "Tavern", tavern },
                { "Academy", academy },
                { "HallOfOrders", hallOfOrders },

                { "Spearman", spearman },
                { "Swordsman", swordsman },
                { "Archer", archer },
                { "HeavyCavalry", heavyCavalry },
                { "AxeFighter", axeFighter },
                { "LightCavalry", lightCavalry },
                { "MountedArcher", mountedArcher },
                { "Ram", ram },
                { "Catapult", catapult },

                { "init", null }
            };
            barracksToLimit = new Dictionary <int, int>()
            {
                { 1, 5 },
                { 2, 10 },
                { 3, 15 }
            };
            for (int i = 4; i <= 25; i++)
            {
                barracksToLimit.Add(i, int.MaxValue);
            }
            this.name     = name;
            this.quantity = quantity;
            entity        = stringToEntity[name];
            bar           = new OrderBar(this.village = village);
        }
Esempio n. 2
0
 public Order(Order toUpdate, Village village, string name, int quantity = 1) : this(village, name, quantity)
 {
     Update(toUpdate);
 }
Esempio n. 3
0
        public void Update(Village toUpdate)
        {
            tab.buttonTakeSmallReward.IsEnabled = account.smallRewardQuantity > 0;



            Order order = new Order(this, "init");

            order.timerBuild     = DateTime.UtcNow.AddMilliseconds(100);
            order.timerRecruit   = DateTime.UtcNow.AddMilliseconds(100);
            order.timerResources = DateTime.UtcNow.AddMilliseconds(100);
            order.provisions     = provisions = Farm.GetSignificance(toUpdate.farm) - toUpdate.provisions;
            order.resources      = resources = toUpdate.resources;

            tab.labelWood.Content       = Bar.labelWood.Content = resources.Wood.ToString();
            tab.labelClay.Content       = Bar.labelClay.Content = resources.Clay.ToString();
            tab.labelIron.Content       = Bar.labelIron.Content = resources.Iron.ToString();
            tab.labelProvisions.Content = Bar.labelProvisions.Content = provisions.ToString() + '/' + Farm.GetSignificance(toUpdate.farm);


            tab.labelHeadquarters.Content = Bar.labelHeadquarters.Content = (order.headquarters.Level = headquarters = toUpdate.headquarters).ToString();
            tab.labelTimberCamp.Content   = Bar.labelTimberCamp.Content = (order.timberCamp.Level = timberCamp = toUpdate.timberCamp).ToString();
            tab.labelClayPit.Content      = Bar.labelClayPit.Content = (order.clayPit.Level = clayPit = toUpdate.clayPit).ToString();
            tab.labelIronMine.Content     = Bar.labelIronMine.Content = (order.ironMine.Level = ironMine = toUpdate.ironMine).ToString();
            tab.labelFarm.Content         = Bar.labelFarm.Content = (order.farm.Level = farm = toUpdate.farm).ToString();
            tab.labelWarehouse.Content    = Bar.labelWarehouse.Content = (order.warehouse.Level = warehouse = toUpdate.warehouse).ToString();
            tab.labelRallyPoint.Content   = (order.rallyPoint.Level = rallyPoint = toUpdate.rallyPoint).ToString();
            tab.labelBarracks.Content     = Bar.labelBarracks.Content = (order.barracks.Level = barracks = toUpdate.barracks).ToString();
            tab.labelStatue.Content       = (order.statue.Level = statue = toUpdate.statue).ToString();
            tab.labelWall.Content         = Bar.labelWall.Content = (order.wall.Level = wall = toUpdate.wall).ToString();
            tab.labelHospital.Content     = (order.hospital.Level = hospital = toUpdate.hospital).ToString();
            tab.labelMarket.Content       = (order.market.Level = market = toUpdate.market).ToString();
            tab.labelTavern.Content       = (order.tavern.Level = tavern = toUpdate.tavern).ToString();
            tab.labelAcademy.Content      = (order.academy.Level = academy = toUpdate.tavern).ToString();
            tab.labelHallOfOrders.Content = (order.hallOfOrders.Level = hallOfOrders = toUpdate.hallOfOrders).ToString();

            tab.labelSpearman.Content      = Bar.labelSpearman.Content = (order.spearman.Quantity = spearman = toUpdate.spearman).ToString();
            tab.labelSwordsman.Content     = Bar.labelSwordsman.Content = (order.swordsman.Quantity = swordsman = toUpdate.swordsman).ToString();
            tab.labelArcher.Content        = Bar.labelArcher.Content = (order.archer.Quantity = archer = toUpdate.archer).ToString();
            tab.labelHeavyCavalry.Content  = Bar.labelHeavyCavalry.Content = (order.heavyCavalry.Quantity = heavyCavalry = toUpdate.heavyCavalry).ToString();
            tab.labelAxeFighter.Content    = Bar.labelAxeFighter.Content = (order.axeFighter.Quantity = axeFighter = toUpdate.axeFighter).ToString();
            tab.labelLightCavalry.Content  = Bar.labelLightCavalry.Content = (order.lightCavalry.Quantity = lightCavalry = toUpdate.lightCavalry).ToString();
            tab.labelMountedArcher.Content = Bar.labelMountedArcher.Content = (order.mountedArcher.Quantity = mountedArcher = toUpdate.mountedArcher).ToString();
            tab.labelRam.Content           = Bar.labelRam.Content = (order.ram.Quantity = ram = toUpdate.ram).ToString();
            tab.labelCatapult.Content      = Bar.labelCatapult.Content = (order.catapult.Quantity = catapult = toUpdate.catapult).ToString();

            order.barracksInfos.Add(new PartialBarracksInfo(DateTime.UtcNow, order.barracks.GetSignificance()));
            order.farmInfos.Add(new PartialFarmInfo(DateTime.UtcNow, order.farm.GetSignificance()));
            order.waitInfos.Add(new PartialWaitInfo(DateTime.UtcNow, order.warehouse.GetSignificance(), order.Production));

            order.barracksToDateTime = new Dictionary <int, DateTime>();
            int i;

            for (i = 0; i <= 25; ++i)
            {
                order.barracksToDateTime[i] = DateTime.MinValue;
            }
            orders = new List <Order>();
            orders.Add(order);
            for (i = 1; i < (toUpdate.orders == null ? 0 : toUpdate.orders.Count + 1); i++)
            {
                toUpdate.orders[i - 1].FixTime();
                if (toUpdate.orders[i - 1].End < DateTime.UtcNow)
                {
                    continue;
                }
                else
                {
                    orders.Add(new Order(orders[i - 1], this, toUpdate.orders[i - 1].Name, toUpdate.orders[i - 1].Quantity));
                    orders[i].SetShit(toUpdate.orders[i - 1]);
                    if (orders[i].Begin >= DateTime.UtcNow)
                    {
                        orders[i].Wait();
                    }
                    orders[i].Up();
                }
            }
            if (position >= orders.Count)
            {
                position = orders.Count - 1;
            }
            DisplayOrders();
            DisplayQuestRewards();
        }
Esempio n. 4
0
 public QuestRewardBar(int index, Village village)
 {
     this.index   = index;
     this.village = village;
     InitializeComponent();
 }
 public OrderBar(Village village)
 {
     InitializeComponent();
     this.village       = village;
     labelName.Content += DateTime.UtcNow.ToLongTimeString();
 }