Esempio n. 1
0
        public async Task <IActionResult> PutTavern([FromRoute] int id, [FromBody] Tavern tavern)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

            if (id != tavern.ID)
            {
                return(BadRequest());
            }

            _context.Entry(tavern).State = EntityState.Modified;

            try
            {
                await _context.SaveChangesAsync();
            }
            catch (DbUpdateConcurrencyException)
            {
                if (!TavernExists(id))
                {
                    return(NotFound());
                }
                else
                {
                    throw;
                }
            }

            return(NoContent());
        }
Esempio n. 2
0
        /// <summary>
        /// bandyci napadaja i zabieraja zloto oraz piwo
        /// </summary>
        /// <param name="tavern"></param>
        public override void DoDamage(Tavern tavern)
        {
            Random r = new Random();

            tavern.gold -= r.Next(30);
            tavern.beer -= r.Next(20);
        }
Esempio n. 3
0
 public static Tavern Instance()
 {
     if (instance == null)
     {
         instance = GameObject.Find("Tavern").GetComponent <Tavern>();
     }
     return(instance);
 }
Esempio n. 4
0
    private void sendDebugIfNotShown(Tavern tavern)
    {
        var d = "Tavern not shown.\nCoordinates:\n" + tavern.latitude + "\n" + tavern.longitude;

        d += "\nUser coordinates are:";
        d += "\n" + Input.location.lastData.latitude;
        d += "\n" + Input.location.lastData.longitude;
        RestClient.sendDebug(d);
    }
Esempio n. 5
0
    public void Awake()
    {
        gameplay      = Gameplay.Instance();
        tavern        = Tavern.Instance();
        mousePosition = MousePosition.Instance();
        infoPopup     = InfoPopup.Instance();

        selected = false;
    }
Esempio n. 6
0
        public Tavern GetTavernById(int id)
        {
            Tavern tavern = null;

            if (!this.id_tavernMap.TryGetValue(id, out tavern))
            {
                return(null);
            }
            return(tavern);
        }
Esempio n. 7
0
    public void ExecuteProgress()
    {
        NomadWagon.RestockTrinkets();
        StageCoach.RestockHeroes(RosterIds, this);

        Abbey.ProvideActivity();
        Tavern.ProvideActivity();
        Sanitarium.ProvideActivity();

        RedeployCaretaker();
    }
Esempio n. 8
0
        public async Task <IActionResult> PostTavern([FromBody] Tavern tavern)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

            _context.Tavern.Add(tavern);
            await _context.SaveChangesAsync();

            return(CreatedAtAction("GetTavern", new { id = tavern.ID }, tavern));
        }
Esempio n. 9
0
    public void LoadTavernInformation()
    {
        ClearInformation();

        EnablePopup();

        txtName.text      = "Tavern";
        txtLevel.text     = "LV " + Tavern.Instance().level.ToString();
        txtDamage.text    = "Cost to Level";
        txtSpeed.text     = "Up the tavern";
        txtAbilities.text = Tavern.Instance().levelUpCost.ToString() + " Gold";
    }
Esempio n. 10
0
    public Estate(SaveCampaignData saveData)
    {
        RosterIds = new List <int>();
        for (int i = 1; i < 100; i++)
        {
            RosterIds.Add(i);
        }

        EstateTitle = saveData.HamletTitle;

        Currencies = new Dictionary <string, int>();
        Currencies.Add("gold", saveData.GoldAmount);
        Currencies.Add("bust", saveData.BustsAmount);
        Currencies.Add("deed", saveData.DeedsAmount);
        Currencies.Add("portrait", saveData.PortraitsAmount);
        Currencies.Add("crest", saveData.CrestsAmount);

        HeroPurchases = saveData.InstancedPurchases;
        TownPurchases = saveData.BuildingUpgrades;

        Buildings = new Dictionary <BuildingType, Building>();
        Abbey     = DarkestDungeonManager.Data.Buildings["abbey"] as Abbey;
        Buildings.Add(BuildingType.Abbey, Abbey);
        Tavern = DarkestDungeonManager.Data.Buildings["tavern"] as Tavern;
        Buildings.Add(BuildingType.Tavern, Tavern);
        Sanitarium = DarkestDungeonManager.Data.Buildings["sanitarium"] as Sanitarium;
        Buildings.Add(BuildingType.Sanitarium, Sanitarium);
        Blacksmith = DarkestDungeonManager.Data.Buildings["blacksmith"] as Blacksmith;
        Buildings.Add(BuildingType.Blacksmith, Blacksmith);
        Guild = DarkestDungeonManager.Data.Buildings["guild"] as Guild;
        Buildings.Add(BuildingType.Guild, Guild);
        NomadWagon = DarkestDungeonManager.Data.Buildings["nomad_wagon"] as NomadWagon;
        Buildings.Add(BuildingType.NomadWagon, NomadWagon);
        StageCoach = DarkestDungeonManager.Data.Buildings["stage_coach"] as StageCoach;
        Buildings.Add(BuildingType.StageCoach, StageCoach);
        CampingTrainer = DarkestDungeonManager.Data.Buildings["camping_trainer"] as CampingTrainer;
        Buildings.Add(BuildingType.CampingTrainer, CampingTrainer);
        Graveyard = new Graveyard();
        Buildings.Add(BuildingType.Graveyard, Graveyard);
        Statue = new Statue();
        Buildings.Add(BuildingType.Statue, Statue);

        Abbey.InitializeBuilding(TownPurchases);
        Tavern.InitializeBuilding(TownPurchases);
        Sanitarium.InitializeBuilding(TownPurchases);
        Blacksmith.InitializeBuilding(TownPurchases);
        Guild.InitializeBuilding(TownPurchases);
        CampingTrainer.InitializeBuilding(TownPurchases);
        NomadWagon.InitializeBuilding(TownPurchases);
        StageCoach.InitializeBuilding(TownPurchases);
        Graveyard.Records.AddRange(saveData.DeathRecords);
    }
Esempio n. 11
0
    public override void Initialize()
    {
        base.Initialize();

        Tavern = DarkestDungeonManager.Campaign.Estate.Tavern;

        for (int i = 0; i < 3; i++)
        {
            barSlots[i].Initialize(Tavern.Activities[0].ActivitySlots[i]);
            barSlots[i].EventTreatmentButtonClicked += TownHeroSlotTreatmentButtonClicked;
            gamblingSlots[i].Initialize(Tavern.Activities[1].ActivitySlots[i]);
            gamblingSlots[i].EventTreatmentButtonClicked += TownHeroSlotTreatmentButtonClicked;
            brothelSlots[i].Initialize(Tavern.Activities[2].ActivitySlots[i]);
            brothelSlots[i].EventTreatmentButtonClicked += TownHeroSlotTreatmentButtonClicked;
        }
    }
    protected override void UnitUpdate()
    {
        //Search out for the enemy!
        Tile        tile    = GetComponentInParent <Tile>();
        GridManager grid    = this.transform.root.GetComponent <GridManager>();
        Knight      knight  = tile.GetComponentInChildren <Knight>();
        Vector2Int  moveDir = new Vector2Int(0, 0);

        if (knight != null)
        {
            //Oh hai there
            if (tile is Tavern)
            {
                //Oh hello boys OwO
                knight.LoseHealth(damage);
                //They forget what they were doing
                knight.enemyLocation = new Vector2Int(-1, -1);
                this.UnitDie();
            }
            else if (!grid.IsValidTile(tavernLocation))
            {
                Tavern foundTavern = LocateClosestGridEntity <Tavern>();
                if (foundTavern == null)
                {
                    Debug.LogError("Cannot find a tavern");
                    return;
                }
                tavernLocation = foundTavern.coord;
            }
            moveDir = tavernLocation - tile.coord;
            Debug.Log("Succubus move dir: " + moveDir);
        }
        else if (satiated)
        {
            //Did our job!
            this.UnitDie();
        }

        if (moveDir.magnitude == 0)
        {
            //Just wait around!
        }
        else
        {
            MoveUnit(moveDir);
        }
    }
Esempio n. 13
0
    public void showTavern(Tavern tavern, GameObject tavernGO)
    {
        bool shown = false;

        if (tavernGO.activeSelf)
        {
            if (tavernGO.GetComponent <TavernBehaviour>().tavern.name != tavern.name)
            {
                tavernGO.SetActive(false);
            }
            else
            {
                RestClient.sendDebug("Tavern " + tavern.name + " not shown due to activeSelf");
                return;
            }
        }

        Tile tile;
        var  meters = GM.LatLonToMeters(tavern.latitude, tavern.longitude);

        if (GameObject.Find("Tiles") != null)
        {
            foreach (Transform child in GameObject.Find("Tiles").transform)
            {
                tile = child.GetComponent <Tile>();
                if (tile.Rect.Contains(meters))
                {
                    tavernGO.SetActive(true);
                    tavernGO.transform.SetParent(null);
                    tavernGO.transform.position = (meters - tile.Rect.Center).ToVector3();
                    tavernGO.transform.SetParent(tile.transform, false);
                    tavernGO.GetComponent <TavernBehaviour>().tavern = tavern;
                    RestClient.sendDebug("Tavern " + tavern.name + " created\n");
                    shown = true;
                    break;
                }
            }
        }

        if (!shown)
        {
            sendDebugIfNotShown(tavern);
        }
    }
Esempio n. 14
0
    public override bool CheckForNeighbouringBuildings()
    {
        if (nextInChain == null)
        {
            List <Tavern> chainBuildings = GetNeighbouringBuildings <Tavern>();
            if (nextInChain == null && chainBuildings.Count >= 1)
            {
                nextInChain = chainBuildings[0];
                return(true);
            }
        }
        prevInChain = GetNeighbouringBuildings <Field>();

        foreach (Field prev in prevInChain)
        {
            Debug.Log($"Checking for fields {prevInChain.Count}");
            prev.CheckForNeighbouringBuildings();
        }

        return(false);
    }
Esempio n. 15
0
    public Estate(SaveCampaignData saveData)
    {
        rosterIds = new List <int>();
        for (int i = 1; i < 100; i++)
        {
            rosterIds.Add(i);
        }

        EstateTitle = saveData.hamletTitle;

        Currencies = new Dictionary <string, EstateCurrency>();
        Currencies.Add("gold", new EstateCurrency(saveData.goldAmount, false));
        Currencies.Add("bust", new EstateCurrency(saveData.bustsAmount, true));
        Currencies.Add("deed", new EstateCurrency(saveData.deedsAmount, true));
        Currencies.Add("portrait", new EstateCurrency(saveData.portraitsAmount, true));
        Currencies.Add("crest", new EstateCurrency(saveData.crestsAmount, true));

        HeroPurchases = saveData.instancedPurchases;
        TownPurchases = saveData.buildingUpgrades;

        Abbey          = DarkestDungeonManager.Data.Buildings["abbey"] as Abbey;
        Tavern         = DarkestDungeonManager.Data.Buildings["tavern"] as Tavern;
        Sanitarium     = DarkestDungeonManager.Data.Buildings["sanitarium"] as Sanitarium;
        Blacksmith     = DarkestDungeonManager.Data.Buildings["blacksmith"] as Blacksmith;
        Guild          = DarkestDungeonManager.Data.Buildings["guild"] as Guild;
        NomadWagon     = DarkestDungeonManager.Data.Buildings["nomad_wagon"] as NomadWagon;
        StageCoach     = DarkestDungeonManager.Data.Buildings["stage_coach"] as StageCoach;
        CampingTrainer = DarkestDungeonManager.Data.Buildings["camping_trainer"] as CampingTrainer;
        Graveyard      = new Graveyard();
        Statue         = new Statue();
        Abbey.InitializeBuilding(TownPurchases);
        Tavern.InitializeBuilding(TownPurchases);
        Sanitarium.InitializeBuilding(TownPurchases);
        Blacksmith.InitializeBuilding(TownPurchases);
        Guild.InitializeBuilding(TownPurchases);
        CampingTrainer.InitializeBuilding(TownPurchases);
        NomadWagon.InitializeBuilding(TownPurchases);
        StageCoach.InitializeBuilding(TownPurchases);
        Graveyard.Records.AddRange(saveData.deathRecords);
    }
Esempio n. 16
0
        public async Task <IActionResult> Tavern(TavernViewModel model)
        {
            if (ModelState.IsValid)
            {
                var user = await _userManager.GetUserAsync(User);

                model.TimeToMaxPoints = (float)(user.MaxActionPoints - user.ActionPoints) / 2;

                if (user.Status != UserStatus.Stays)
                {
                    ModelState.AddModelError(string.Empty, "Aktualnie nie możesz wybrać się do tawerny.");
                }
                else if (user.ActionPoints >= user.MaxActionPoints)
                {
                    ModelState.AddModelError(string.Empty, "Twoja postać jest w pełni sił.");
                }
                else
                {
                    var hours = model.Tavern.Hours ?? model.TimeToMaxPoints;

                    var tavern = new Tavern()
                    {
                        UserId = user.Id,
                        Start  = DateTime.UtcNow,
                        End    = DateTime.UtcNow.AddHours(hours),
                        Hours  = hours
                    };

                    user.Status = UserStatus.Tavern;
                    await _userManager.UpdateAsync(user);

                    _tavernRepository.Add(tavern);

                    model.Tavern         = tavern;
                    model.TavernProgress = true;
                }
            }

            return(View(model));
        }
Esempio n. 17
0
    public static void PlayBlackJack(Creature p, int wager)
    {
        Console.Clear();
        for (int i = 0; i < playerHand.Count; i++)
        {
            Console.WriteLine($"You have a{playerHand[i].svalue} of {playerHand[i].suit}");
        }
        if (playerHand.Count < 2 && Count(playerHand) == 21)
        {
            Console.WriteLine("\nBlackjack! That pays 3 to 1!\n");
            Win(p, wager, 3);
            Utilities.Keypress();
            Tavern.Inn(p);
        }
        Console.WriteLine($"\nThat makes {Count(playerHand)}");
        if (Count(playerHand) > 21)
        {
            Console.WriteLine("You Bust!");
            Lose();
            Utilities.Keypress();
            Tavern.Inn(p);
        }
        Console.WriteLine($"\nThe dealer is showing a{dealerHand[0].svalue} of {dealerHand[0].suit}\n");
        Console.WriteLine("Would you like to [H]it or [S]tay?");
        string choice = Console.ReadKey(true).KeyChar.ToString().ToLower();

        if (choice == "h")
        {
            Deal(playerHand);
            PlayBlackJack(p, wager);
        }
        else if (choice == "s")
        {
            Resolve(p, playerHand, dealerHand, wager);
        }
        else
        {
            PlayBlackJack(p, wager);
        }
    }
Esempio n. 18
0
    public override void Initialize()
    {
        Tavern = DarkestDungeonManager.Campaign.Estate.Tavern;
        float ratio = DarkestDungeonManager.Campaign.Estate.GetBuildingUpgradeRatio(BuildingType.Tavern);

        upgradeWindow.upgradedValue.text = Mathf.RoundToInt(ratio * 100).ToString() + "%";

        foreach (var tree in upgradeWindow.upgradeTrees)
        {
            var currentUpgrades   = DarkestDungeonManager.Data.UpgradeTrees[tree.treeId].Upgrades;
            int lastPurchaseIndex = -1;
            for (int i = 0; i < tree.upgrades.Count; i++)
            {
                tree.upgrades[i].Tree         = DarkestDungeonManager.Data.UpgradeTrees[tree.treeId];
                tree.upgrades[i].UpgradeInfo  = currentUpgrades[i];
                tree.upgrades[i].TownUpgrades = new List <ITownUpgrade>(new ITownUpgrade[] {
                    Tavern.Activities.Find(activity => activity.TreeId == tree.treeId).GetUpgradeByCode(currentUpgrades[i].Code)
                });
                tree.upgrades[i].onClick += TavernWindow_onUpgradeClick;
                var status = DarkestDungeonManager.Campaign.Estate.GetUpgradeStatus(tree.treeId, currentUpgrades[i]);
                TownManager.UpdateUpgradeSlot(status, tree.upgrades[i]);
                if (status == UpgradeStatus.Purchased)
                {
                    lastPurchaseIndex = i;
                }
            }
            tree.UpdateConnector(lastPurchaseIndex);
        }

        for (int i = 0; i < 3; i++)
        {
            barSlots[i].Initialize(Tavern.Activities[0].ActivitySlots[i]);
            barSlots[i].onTreatmentButtonClick += TavernWindow_onTreatmentButtonClick;
            gamblingSlots[i].Initialize(Tavern.Activities[1].ActivitySlots[i]);
            gamblingSlots[i].onTreatmentButtonClick += TavernWindow_onTreatmentButtonClick;
            brothelSlots[i].Initialize(Tavern.Activities[2].ActivitySlots[i]);
            brothelSlots[i].onTreatmentButtonClick += TavernWindow_onTreatmentButtonClick;
        }
    }
Esempio n. 19
0
    public void LoadHeroInformation(int argument)
    {
        ClearInformation();

        EnablePopup();

        tavernLevel = Tavern.Instance().level;

        XMLNode heroXML = heroesXML[argument] as XMLNode;

        string className = heroXML.GetValue("@class");

        XMLNode levelXML = heroXML.GetNodeList("levels>0>level")[tavernLevel] as XMLNode;

        Debug.Log(className);

        txtRange.text  = "Range: " + levelXML.GetValue("@range");
        txtDamage.text = "Damage: " + levelXML.GetValue("@damage");
        txtSpeed.text  = "Speed: " + levelXML.GetValue("@speed");
        txtHealth.text = "Health: " + levelXML.GetValue("@health");
        txtLevel.text  = "LV " + tavernLevel.ToString();
        txtName.text   = className;
    }
Esempio n. 20
0
    public static Tavern GenerateTavern(GenerationRandom genRan, Tavern tavern, out BuildingVoxels vox, BuildingGenerationPlan plan)
    {
        vox = new BuildingVoxels(tavern.Width, World.ChunkHeight, tavern.Height);
        BuildingGenerator.BuildBoundingWallRect(vox, tavern.Width, tavern.Height, 6, Voxel.wood);
        BuildingGenerator.ChooseEntrancePoint(genRan, vox, tavern, plan);

        Tile[,] tileMap = new Tile[tavern.Width, tavern.Height];

        BuildingGenerator.SetTiles(tileMap, 0, 0, tavern.Width, tavern.Height, Tile.WOOD_FLOOR);
        tavern.SetBuilding(tileMap);
        BuildingGenerator.AddWindow(genRan, vox, tavern, autoReattempt: true);
        BuildingGenerator.AddWindow(genRan, vox, tavern, autoReattempt: true);
        BuildingGenerator.AddWindow(genRan, vox, tavern, autoReattempt: true);
        BuildingGenerator.AddWindow(genRan, vox, tavern, autoReattempt: false);
        BuildingGenerator.AddWindow(genRan, vox, tavern, autoReattempt: false);
        FirePlace fp = new FirePlace();

        BuildingGenerator.PlaceObjectAgainstWall(genRan, fp, 0, vox, tavern, 0, true, 4, true, 20);
        BuildingGenerator.PlaceObjectAgainstWall(genRan, new WallTorch(), 1.5f, vox, tavern, 0, true, 2);
        NPCJob[] jobs = new NPCJob[] { new NPCJobMerchant(tavern, "Tavern Keep"), new NPCJobMerchant(tavern, "Tavern Keep") };
        tavern.SetWorkBuildingData(new WorkBuildingData(jobs));
        BuildingGenerator.AddRoof(genRan, vox, tavern, Voxel.thatch);
        return(tavern);
    }
Esempio n. 21
0
    public void Birth(string target)
    {
        activated = false;
        canPoison = false;

        gameplay = Gameplay.Instance();

        tavern = Tavern.Instance();

        strJob = target;

        AssignClass();

        transform.Find("Collider").GetComponent <BoxCollider>().enabled = false;

        XMLNodeList heroesXML = gameplay.xml.GetNodeList("doc>0>units>0>heroes>0>hero");

        heroXML = heroesXML[intJob] as XMLNode;

        levelsXML = heroXML.GetNodeList("levels>0>level");

        transform.parent = GameObject.Find("Heroes").transform;

        safe = false;

        status = "Fine";

        maxNumberOfTargets = 1;
        focusIndex         = 0;

        clericHealCooldown = 90;
        battlecryCooldown  = 360;
        stealthCooldown    = 360;

        transform.position = new Vector3(mousePosition.x, mousePosition.y + 60f, -20f);

        lv = Tavern.Instance().level - 1;
        LevelUp();

        firstName = firstNames[intJob, Random.Range(0, firstNames.GetLength(1))];
        lastName  = lastNames[intJob, Random.Range(0, lastNames.GetLength(1))];

        GameObject obj;

        obj = Instantiate(Resources.Load("CI", typeof(GameObject)) as GameObject) as GameObject;
        obj.transform.parent        = transform;
        obj.transform.localPosition = Vector3.zero;

        TextMesh textMesh;

        textMesh      = obj.transform.Find("Name").GetComponent <TextMesh>();
        textMesh.text = firstName + " " + lastName;

        healthBar      = obj.transform.Find("Health/Bar").gameObject;
        healthBarWidth = healthBar.transform.localScale.x;

        gameplay.heroes.Add(this);
        index = gameplay.heroes.IndexOf(this);

        name = name.Split("("[0])[0];
    }
Esempio n. 22
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. 23
0
 /// <summary>
 /// szczury wyjadaja zywnosc z tawerny
 /// </summary>
 /// <param name="tavern"></param>
 public override void DoDamage(Tavern tavern)
 {
     tavern.food -= howMuchFoodDamagePerOneRat * howManyRats;
 }
Esempio n. 24
0
        public static void GameTown()
        {
            for (int i = 0; i < Time.Events.Count; i++)
            {
                if (Time.Events[i].name == "Bank Construction" && Time.Events[i].trigger && Time.Events[i].active)
                {
                    bank = true;
                }
            }
            Console.Clear();
            Utilities.ColourText(Colour.SPEAK, "You are in the town of Marburgh. It is a small town, but is clearly growing. Who knows what will be here in a month?\n\n");
            if (tutorial)
            {
                Console.WriteLine("[W]eapon shop            [A]rmor shop            [I]tem shop          [D]ungeon");
            }
            else
            {
                Console.WriteLine("[I]tem shop              [D]ungeon");
            }
            if (tutorial && bank)
            {
                Console.WriteLine("[T]avern                 [Y]our house            [B]ank               [?]Help          ");
            }
            else
            {
                Console.WriteLine("[T]avern                 [Y]our house            [?]Help    ");
            }
            Console.WriteLine("[C]haracter              [L]evel Master          [O]ther Places       [Q]uit                 ");
            Utilities.ColourText(Colour.SPEAK, "\n\nWhat would you like to do?\n\n");
            Utilities.EmbedColourText(Colour.TIME, Colour.TIME, Colour.TIME, Colour.TIME, "It is day ", $"{Time.day}", ", the ", $"{Time.weeks[Time.week]}", " week of ", $"{Time.months[Time.month]}", ", ", $"{Time.year}", "\n\n");
            string choice = Console.ReadKey(true).KeyChar.ToString().ToLower();

            if (choice == "w" && tutorial)
            {
                Shop.GameShop(Shop.WeaponShop, Create.p);
            }
            else if (choice == "a" && tutorial)
            {
                Shop.GameShop(Shop.ArmorShop, Create.p);
            }
            else if (choice == "d")
            {
                Explore.DungeonCheck(d, Create.p);
            }
            else if (choice == "i")
            {
                Shop.ItemShop(Create.p);
            }
            else if (choice == "?")
            {
                Utilities.Help();
            }
            else if (choice == "c")
            {
                Utilities.CharacterSheet(Create.p);
            }
            else if (choice == "l")
            {
                LevelMaster.VisitLevelMaster(Create.p);
            }
            else if (choice == "t")
            {
                Tavern.Inn(Create.p);
            }
            else if (choice == "y")
            {
                House.YourHouse(Create.p);
            }
            else if (choice == "b" && tutorial && bank)
            {
                Bank.GameBank(Create.p);
            }
            else if (choice == "q")
            {
                Utilities.Quit();
            }
            else if (choice == "x")
            {
                Create.p.xp   += 50;
                Create.p.gold += 900;
                BlackJack.PlayBlackJack();
            }
            else if (choice == "o")
            {
                OtherPlaces.Other(Create.p);
            }
            GameTown();
        }
Esempio n. 25
0
    public List <Instruction> GetInstructions(CharacterSheet sheet)
    {
        List <Instruction> instructions = new List <Instruction>();

        Instruction getBeer = new Instruction();

        if (sheet.baseCity.Brewhouses.Count > 0)
        {
            getBeer.destination = sheet.baseCity.Brewhouses[0].gameObject.GetComponent <NavigationWaypoint>();
            getBeer.building    = sheet.baseCity.Brewhouses[0];
            getBeer.gather      = new ItemType[] { ItemType.BEER };
            getBeer.give        = new ItemType[] { };
            getBeer.fun1        = new instructionFunction((getBeer.building).GetItem);

            instructions.Add(getBeer);
        }
        else
        {
            getBeer.destination = sheet.baseCity.TradeHouses[0].gameObject.GetComponent <NavigationWaypoint>();
            getBeer.building    = sheet.baseCity.TradeHouses[0];
            getBeer.gather      = new ItemType[] { ItemType.BEER };
            getBeer.give        = new ItemType[] { };
            getBeer.fun1        = new instructionFunction((getBeer.building).GetItem);

            instructions.Add(getBeer);
        }


        Instruction getFish = new Instruction();

        if (sheet.baseCity.Ponds.Count > 0)
        {
            getFish.destination = sheet.baseCity.Barns[0].gameObject.GetComponent <NavigationWaypoint>();
            getFish.building    = sheet.baseCity.Barns[0];
            getFish.gather      = new ItemType[] { ItemType.FISH };
            getFish.give        = new ItemType[] { };
            getFish.fun1        = new instructionFunction((getFish.building).GetItem);

            instructions.Add(getFish);
        }
        else
        {
            getFish.destination = sheet.baseCity.TradeHouses[0].gameObject.GetComponent <NavigationWaypoint>();
            getFish.building    = sheet.baseCity.TradeHouses[0];
            getFish.gather      = new ItemType[] { ItemType.FISH };
            getFish.give        = new ItemType[] { };
            getFish.fun1        = new instructionFunction((getFish.building).GetItem);

            instructions.Add(getFish);
        }



        Instruction getBread = new Instruction();

        if (sheet.baseCity.Bakeries.Count > 0)
        {
            getBread.destination = sheet.baseCity.Bakeries[0].gameObject.GetComponent <NavigationWaypoint>();
            getBread.building    = sheet.baseCity.Bakeries[0];
            getBread.gather      = new ItemType[] { ItemType.BREAD };
            getBread.give        = new ItemType[] { };
            getBread.fun1        = new instructionFunction((getBread.building).GetItem);

            instructions.Add(getBread);
        }
        else
        {
            getBread.destination = sheet.baseCity.TradeHouses[0].gameObject.GetComponent <NavigationWaypoint>();
            getBread.building    = sheet.baseCity.TradeHouses[0];
            getBread.gather      = new ItemType[] { ItemType.BREAD };
            getBread.give        = new ItemType[] { };
            getBread.fun1        = new instructionFunction((getBread.building).GetItem);

            instructions.Add(getBread);
        }


        Instruction makeMeal    = new Instruction();
        Tavern      destination = null;

        foreach (Tavern tavern in sheet.baseCity.Taverns)
        {
            if (tavern.workers.Contains(sheet))
            {
                destination = tavern;
                break;
            }
        }

        if (destination == null)
        {
            foreach (Tavern tavern in sheet.baseCity.Taverns)
            {
                if (tavern.CurrentPositions[Jobs.INNKEEPER] > 0)
                {
                    destination = tavern;
                    tavern.workers.Add(sheet);
                    tavern.CurrentPositions[Jobs.INNKEEPER]--;
                    break;
                }
            }
        }
        makeMeal.destination = destination.gameObject.GetComponent <NavigationWaypoint>();
        makeMeal.building    = destination;
        makeMeal.gather      = new ItemType[] { ItemType.MEAL };
        makeMeal.give        = new ItemType[] { ItemType.BEER, ItemType.BREAD, ItemType.FISH };
        makeMeal.recipe      = MasterRecipe.Instance.Meal;
        makeMeal.fun1        = new instructionFunction((makeMeal.building).MakeRecipe);

        instructions.Add(makeMeal);

        Instruction storeMeal = new Instruction();

        storeMeal.destination = destination.gameObject.GetComponent <NavigationWaypoint>();
        storeMeal.building    = destination;
        storeMeal.gather      = new ItemType[] { };
        storeMeal.give        = new ItemType[] { ItemType.MEAL };
        storeMeal.fun1        = new instructionFunction((storeMeal.building).StoreItem);
        storeMeal.fun2        = new instructionFunction2((destination).ReleaseJob);
        instructions.Add(storeMeal);

        return(instructions);
    }
Esempio n. 26
0
        public static void GameTown()
        {
            for (int i = 0; i < Time.Events.Count; i++)
            {
                if (Time.Events[i].name == "Bank Construction" && Time.Events[i].trigger && Time.Events[i].active)
                {
                    bank = true;
                }
            }
            Console.Clear();
            UI.Town(new string[] { "You are in the town of Marburgh", "It is a small town, but is clearly growing", "Who knows what will be here in a month?" }, adventureList, shopList, serviceList, otherList, adventureButton, shopButton, serviceButton, otherButton);
            string choice = Console.ReadKey(true).KeyChar.ToString().ToLower();

            if (choice == "w" && tutorial)
            {
                Shop.GameShop(Shop.WeaponShop, Create.p);
            }
            else if (choice == "a" && tutorial)
            {
                Shop.GameShop(Shop.ArmorShop, Create.p);
            }
            else if (choice == "d")
            {
                Explore.DungeonCheck(d, Create.p);
            }
            else if (choice == "i")
            {
                Shop.ItemShop(Create.p);
            }
            else if (choice == "?")
            {
                Help.General();
            }
            else if (choice == "c")
            {
                Utilities.CharacterSheet(Create.p);
            }
            else if (choice == "l")
            {
                LevelMaster.VisitLevelMaster(Create.p);
            }
            else if (choice == "t")
            {
                Tavern.Inn(Create.p);
            }
            else if (choice == "y")
            {
                House.YourHouse(Create.p);
            }
            else if (choice == "b" && tutorial && bank)
            {
                Bank.GameBank(Create.p);
            }
            else if (choice == "q")
            {
                Utilities.Quit();
            }
            else if (choice == "x")
            {
                Create.p.xp   += 30;
                Create.p.gold += 500;
                tutorial       = true;
                Shop.itemShopOptionButton1.Add(Colour.ENHANCEMENT + "E" + Colour.RESET);
                Shop.itemShopOptionList1.Add("nhancement Machine");
            }
            else if (choice == "o")
            {
                OtherPlaces.Other(Create.p);
            }
            GameTown();
        }
Esempio n. 27
0
        private Tavern LoadTavernFromXml(SecurityElement element)
        {
            Tavern tavern = new Tavern {
                Id                   = StrParser.ParseHexInt(element.Attribute("Id"), 0),
                RecruitStage         = _TavernRecruitStage.ParseStage(element.Attribute("RecruitStage"), 0),
                RecruitDesc          = StrParser.ParseStr(element.Attribute("RecruitDesc"), ""),
                RewardDesc           = StrParser.ParseStr(element.Attribute("RewardDesc"), ""),
                Priority             = StrParser.ParseDecInt(element.Attribute("Priority"), 0),
                Level                = StrParser.ParseDecInt(element.Attribute("Level"), 0),
                VipLevel             = StrParser.ParseDecInt(element.Attribute("VipLevel"), 0),
                CoolDownTime         = StrParser.ParseDecInt(element.Attribute("CoolDownTime"), 0),
                QualityIconId        = StrParser.ParseHexInt(element.Attribute("QualityIconId"), 0),
                CountyIconId         = StrParser.ParseHexInt(element.Attribute("CountyIconId"), 0),
                BackGroundId         = StrParser.ParseHexInt(element.Attribute("BackGroundId"), 0),
                IsOpen               = StrParser.ParseBool(element.Attribute("IsOpen"), false),
                CanTenTavern         = StrParser.ParseBool(element.Attribute("CanTenTavern"), false),
                NormalFirstDesc      = StrParser.ParseStr(element.Attribute("NormalFirstDesc"), ""),
                TenTavernFristDesc   = StrParser.ParseStr(element.Attribute("TenTavernFristDesc"), ""),
                SepicalRewardContext = StrParser.ParseStr(element.Attribute("SepicalRewardContext"), "")
            };

            if (element.Children != null)
            {
                foreach (SecurityElement element2 in element.Children)
                {
                    switch (element2.Tag)
                    {
                    case "Cost":
                        tavern.Cost = Cost.LoadFromXml(element2);
                        break;

                    case "TenTavernCost":
                        tavern.TenTavernCost = Cost.LoadFromXml(element2);
                        break;

                    case "TenTavernOriginalCost":
                        tavern.TenTavernOriginalCost = Cost.LoadFromXml(element2);
                        break;

                    case "Reward":
                        tavern.Reward = Reward.LoadFromXml(element2);
                        break;

                    case "Reward1":
                        tavern.Reward1 = Reward.LoadFromXml(element2);
                        break;

                    case "TenTavernReward":
                        tavern.TenTavernReward = Reward.LoadFromXml(element2);
                        break;

                    case "TenTavernReward1":
                        tavern.TenTavernReward1 = Reward.LoadFromXml(element2);
                        break;

                    case "ShowResourceId":
                        tavern.ShowResourceIds.Add(StrParser.ParseHexInt(element2.Attribute("Id"), 0));
                        break;

                    case "SepicalRewardId":
                        tavern.SepicalRewardId.Add(StrParser.ParseHexInt(element2.Attribute("Id"), 0));
                        break;
                    }
                }
            }
            return(tavern);
        }
Esempio n. 28
0
        public static void GameTown()
        {
            Dungeon d = Dungeon.DungeonList[0];

            Console.Clear();
            Utilities.ColourText(Colour.SPEAK, "You are in the town of Marburgh. It is a small town, but is clearly growing. Who knows what will be here in a month?\n\n");
            Console.WriteLine("[W]eapon shop            [A]rmor shop            [I]tem shop          [D]ungeon");
            Console.WriteLine("[T]avern                 [Y]our house            [B]ank                         ");
            Console.WriteLine("[C]haracter              [H]eal                  [L]evel Master       [O]ther Places");
            Console.WriteLine("[S]ave                   [?]Help                                      [Q]uit             ");
            Utilities.ColourText(Colour.SPEAK, "\n\nWhat would you like to do?\n\n");
            Utilities.EmbedColourText(Colour.ENERGY, Colour.ENERGY, Colour.ENERGY, Colour.ENERGY, "It is day ", $"{Time.day}", ", the ", $"{Time.weeks[Time.week]}", " week of ", $"{Time.months[Time.month]}", ", ", $"{Time.year}", "\n\n");
            string choice = Console.ReadKey(true).KeyChar.ToString().ToLower();

            if (choice == "w")
            {
                Shop.GameShop(Shop.WeaponShop, Create.p);
            }
            else if (choice == "a")
            {
                Shop.GameShop(Shop.ArmorShop, Create.p);
            }
            //else if (choice == "s") Data.Save(p);
            else if (choice == "d")
            {
                Explore.DungeonCheck(d, Create.p);
            }
            else if (choice == "h")
            {
                Utilities.Heal(Create.p);
            }
            else if (choice == "i")
            {
                Shop.ItemShop(Create.p);
            }
            else if (choice == "?")
            {
                Utilities.Help();
            }
            else if (choice == "c")
            {
                Utilities.CharacterSheet(Create.p);
            }
            else if (choice == "l")
            {
                LevelMaster.VisitLevelMaster(Create.p);
            }
            else if (choice == "t")
            {
                Tavern.Inn(Create.p);
            }
            else if (choice == "y")
            {
                House.YourHouse(Create.p);
            }
            else if (choice == "b")
            {
                Bank.GameBank(Create.p);
            }
            else if (choice == "q")
            {
                Utilities.Quit();
            }
            else if (choice == "x")
            {
                Utilities.Death();
            }
            else if (choice == "o")
            {
                OtherPlaces.Other(Create.p);
            }
            GameTown();
        }
Esempio n. 29
0
    private void Update()
    {
        float vertical   = Input.GetAxis("Vertical");
        float horizontal = Input.GetAxis("Horizontal");
        bool  enter      = Input.GetButtonDown("Submit");
        bool  back       = Input.GetButtonDown("Back");

        //Start of game unit placing controls
        if (gameController.tavern.GetComponent <Tavern>().placingUnits)
        {
            Tavern tavern = gameController.tavern.GetComponent <Tavern>();
            if (!(Time.time < nextCursorMoveAllowed))
            {
                GridPosition cursorPosition = cursor.GetComponent <CursorController>().position;
                if (vertical > 0)
                {
                    cursorPosition.x++;
                }
                if (vertical < 0)
                {
                    cursorPosition.x--;
                }
                if (horizontal > 0)
                {
                    cursorPosition.y--;
                }
                if (horizontal < 0)
                {
                    cursorPosition.y++;
                }

                if (cursorPosition.y < 0)
                {
                    cursorPosition.y = 0;
                }
                if (cursorPosition.x < 0)
                {
                    cursorPosition.x = 0;
                }
                if (cursorPosition.y > maxCursorYPos)
                {
                    cursorPosition.y = maxCursorYPos;
                }
                if (cursorPosition.x > maxCursorXPos)
                {
                    cursorPosition.x = maxCursorXPos;
                }
                cursor.GetComponent <CursorController>().position = cursorPosition;

                nextCursorMoveAllowed = Time.time + cursorDelay;
            }
            if (tavern.spawnPoints.Contains(cursor.GetComponent <CursorController>().position) && !unitBeingPlaced.GetComponent <UnitController>().inGame)
            {
                unitBeingPlaced.GetComponent <UnitController>().position = cursor.GetComponent <CursorController>().position;
                unitBeingPlaced.SetActive(true);
            }
            else
            {
                if (!unitBeingPlaced.GetComponent <UnitController>().inGame)
                {
                    unitBeingPlaced.SetActive(false);
                }
            }
            if (enter)
            {
                if (tavern.spawnPoints.Contains(cursor.GetComponent <CursorController>().position))
                {
                    unitBeingPlaced.GetComponent <UnitController>().position = cursor.GetComponent <CursorController>().position;
                    unitBeingPlaced.GetComponent <UnitController>().inGame   = true;
                }
            }
            if (Input.GetButtonDown("Next Unit"))
            {
                int index = gameController.playerUnits.IndexOf(unitBeingPlaced);
                if (index < gameController.playerUnits.Count - 1)
                {
                    index++;
                }
                else
                {
                    index = 0;
                }
                if (!unitBeingPlaced.GetComponent <UnitController>().inGame)
                {
                    unitBeingPlaced.SetActive(false);
                }
                unitBeingPlaced = gameController.playerUnits[index];
                unitBeingPlaced.SetActive(true);
            }
            if (Input.GetButtonDown("Previous Unit"))
            {
                int index = gameController.playerUnits.IndexOf(unitBeingPlaced);
                if (index > 0)
                {
                    index--;
                }
                else
                {
                    index = gameController.playerUnits.Count - 1;
                }
                if (!unitBeingPlaced.GetComponent <UnitController>().inGame)
                {
                    unitBeingPlaced.SetActive(false);
                }
                unitBeingPlaced = gameController.playerUnits[index];
                unitBeingPlaced.SetActive(true);
            }
            if (Input.GetButtonDown("Start"))
            {
                gameController.tavern.GetComponent <Tavern>().placingUnits = false;
                gameController.removeUnactiveUnitsFromTurnOrder();
                gameController.activeUnit = gameController.turnOrder[0];
            }
        }
        //Ingame movement controls
        else
        {
            if (gameController.activeUnit.GetComponent <UnitController>().isPlayerUnit)
            {
                cursor.GetComponent <SpriteRenderer>().enabled = true;
                if (!gameController.activeUnit.GetComponent <UnitController>().canAct)
                {
                    disableActionButtons();
                }
                if (!gameController.activeUnit.GetComponent <UnitController>().canMove)
                {
                    disableMoveButton();
                }
            }
            else
            {
                cursor.GetComponent <SpriteRenderer>().enabled = false;
            }
            if (inspectingUnit)
            {
                if (back)
                {
                    inspectingUnit = false;
                    playerUnitUIPanel.SetActive(false);
                    enemyUnitUIPanel.SetActive(false);
                    panelUIActive  = false;
                    selectedObject = null;
                }
            }
            else
            {
                if (panelUIActive)
                {
                    if (back)
                    {
                        playerUnitUIPanel.SetActive(false);
                        enemyUnitUIPanel.SetActive(false);
                        panelUIActive  = false;
                        selectedObject = null;
                    }
                }
                else
                {
                    //resonsible for moving cursor when nothing is selected
                    if (!(Time.time < nextCursorMoveAllowed) && !(gameController.activeAction is Wait))
                    {
                        GridPosition cursorPosition = cursor.GetComponent <CursorController>().position;
                        if (vertical > 0)
                        {
                            cursorPosition.x++;
                        }
                        if (vertical < 0)
                        {
                            cursorPosition.x--;
                        }
                        if (horizontal > 0)
                        {
                            cursorPosition.y--;
                        }
                        if (horizontal < 0)
                        {
                            cursorPosition.y++;
                        }

                        if (cursorPosition.y < 0)
                        {
                            cursorPosition.y = 0;
                        }
                        if (cursorPosition.x < 0)
                        {
                            cursorPosition.x = 0;
                        }
                        if (cursorPosition.y > maxCursorYPos)
                        {
                            cursorPosition.y = maxCursorYPos;
                        }
                        if (cursorPosition.x > maxCursorXPos)
                        {
                            cursorPosition.x = maxCursorXPos;
                        }
                        cursor.GetComponent <CursorController>().position = cursorPosition;

                        nextCursorMoveAllowed = Time.time + cursorDelay;
                    }

                    if (selectedObject == null)
                    {
                        if (enter)
                        {
                            Debug.Log("enter");
                            GameObject obj = gameController.getObjectAtPosition(cursor.GetComponent <CursorController>().position);
                            if (obj != null)
                            {
                                selectObject(obj);
                            }
                        }
                        else if (back)
                        {
                            cursor.GetComponent <CursorController>().position = gameController.activeUnit.GetComponent <UnitController>().position;
                        }
                    }
                    else if (unitTakingAction && back)
                    {
                        back             = false;
                        unitTakingAction = false;
                        gameController.destroyMovesDisplay();
                        gameController.selectedObject = null;
                        cursor.GetComponent <CursorController>().position = selectedObject.GetComponent <UnitController>().position;
                        playerUnitUIPanel.SetActive(true);
                        panelUIActive = true;
                    }
                    else if (unitTakingAction && enter)
                    {
                        processActiveAction();
                    }
                    else if (gameController.activeAction is Wait)
                    {
                        if (vertical > 0)
                        {
                            selectedObject.GetComponent <UnitController>().facing = Facing.Left;
                        }
                        if (vertical < 0)
                        {
                            selectedObject.GetComponent <UnitController>().facing = Facing.Right;
                        }
                        if (horizontal > 0)
                        {
                            selectedObject.GetComponent <UnitController>().facing = Facing.Back;
                        }
                        if (horizontal < 0)
                        {
                            selectedObject.GetComponent <UnitController>().facing = Facing.Forward;
                        }

                        /*if(enter)
                         * {
                         *  gameController.activeAction.act();
                         *  selectedObject = null;
                         *  gameController.selectedObject = null;
                         *  gameController.endCurrentTurn();
                         * }*/
                    }
                }
            }
        }
    }
Esempio n. 30
0
        public async Task Run(GameContext context, BaseWorkerWindow vm, Action <string> statusUpdater, CancellationToken cancellationToken)
        {
            await Task.CompletedTask;
            var tavern = new Tavern(context);
            //var rewards = new RewardsDialog(context);
            var claimed = false;

            do
            {
                claimed = false;
                cancellationToken.ThrowIfCancellationRequested();
                if (!tavern.IsScreenActive())
                {
                    throw new InvalidOperationException("You're not at the tavern screen");
                }
                statusUpdater($"{tavern.StandardCards} standard cards, {tavern.HeroicCards} heroic cards, {tavern.EventPoints} event points.");

                if (tavern.StandardCards > 0 && ClaimStandard)
                {
                    if (tavern.StandardCards >= 10)
                    {
                        await tavern.PressClaimStandard10Button(cancellationToken);
                    }
                    else
                    {
                        await tavern.PressClaimStandard1Button(cancellationToken);
                    }
                    while (!tavern.IsScreenActive())
                    {
                        await tavern.PressCloseButton(cancellationToken);
                    }
                    claimed = true;
                }

                if (tavern.HeroicCards > 0 && ClaimHeroic)
                {
                    if (tavern.HeroicCards >= 10)
                    {
                        await tavern.PressClaimHeroic10Button(cancellationToken);
                    }
                    else
                    {
                        await tavern.PressClaimHeroic1Button(cancellationToken);
                    }
                    while (!tavern.IsScreenActive())
                    {
                        await tavern.PressCloseButton(cancellationToken);
                    }
                    claimed = true;
                }

                if (tavern.EventPoints > 10 && ClaimEvent)
                {
                    if (tavern.EventPoints >= 100)
                    {
                        await tavern.PressClaimEvent10Button(cancellationToken);
                    }
                    else
                    {
                        await tavern.PressClaimEvent1Button(cancellationToken);
                    }
                    while (!tavern.IsScreenActive())
                    {
                        await tavern.PressCloseButton(cancellationToken);
                    }
                    claimed = true;
                }
            } while (claimed);
        }