コード例 #1
0
ファイル: MySQLFullDB.cs プロジェクト: Edrenn/Clickers
        public async void InitCustomLocalMySQL(string customFolder)
        {
            if (this.Database.CreateIfNotExists())
            {
                List <RessourceProducer> allGoldProducer = JsonManager.Instance.GetAllGoldProducersFromJSon();
                foreach (RessourceProducer item in allGoldProducer)
                {
                    DbSetRessourceProducer.Add(item);
                }
                List <SoldiersProducer> allSoldierProducer = JsonManager.Instance.GetAllSoldierProducersFromJSon(AllPath.Instance.JsonCustomFolder + customFolder + AllPath.Instance.CustomSoldierProducer);
                foreach (SoldiersProducer item in allSoldierProducer)
                {
                    DbSetSoldiersProducer.Add(item);
                }
                List <Hero> allHeros = JsonManager.Instance.GetAllHerosFromJSon(AllPath.Instance.JsonCustomFolder + customFolder + AllPath.Instance.CustomHero);
                foreach (Hero hero in allHeros)
                {
                    DbSetHeros.Add(hero);
                }

                List <Shield> allShield = JsonManager.Instance.GetShieldsFromJSon();
                foreach (Shield shield in allShield)
                {
                    DbSetShield.Add(shield);
                }
                HealerHouse HealerHouse = JsonManager.Instance.GetHealerHouseFromJSon();
                DbSetHealerHouse.Add(HealerHouse);

                Blacksmith Blacksmith = JsonManager.Instance.GetBlacksmithFromJSon();
                DbSetBlacksmith.Add(Blacksmith);
                this.SaveChangesAsync();
            }
        }
コード例 #2
0
        public override void Paint(Level level, Room room)
        {
            Fill(level, room, Terrain.WALL);
            Fill(level, room, 1, Terrain.FIRE_TRAP);
            Fill(level, room, 2, Terrain.EMPTY_SP);

            for (var i = 0; i < 2; i++)
            {
                int pos;
                do
                {
                    pos = room.Random();
                }while (level.map[pos] != Terrain.EMPTY_SP);
                level.Drop(Generator.Random(Random.OneOf(Generator.Category.ARMOR, Generator.Category.WEAPON)), pos);
            }

            foreach (var door in room.Connected.Values)
            {
                door.Set(Room.Door.DoorType.UNLOCKED);
                DrawInside(level, room, door, 1, Terrain.EMPTY);
            }

            var npc = new Blacksmith();

            do
            {
                npc.pos = room.Random(1);
            }while (level.heaps[npc.pos] != null);

            level.mobs.Add(npc);
            Actor.OccupyCell(npc);
        }
コード例 #3
0
ファイル: JsonManager.cs プロジェクト: Edrenn/Clickers
        public Blacksmith GetBlacksmithFromJSon()
        {
            string     path = "D:\\Workspaces\\Clickers\\Clickers\\JsonConfig\\";
            string     file = "Blacksmith.Json";
            Blacksmith existingBlacksmith = new Blacksmith();

            using (StreamReader fileItem = File.OpenText(path + file))
                using (JsonTextReader reader = new JsonTextReader(fileItem))
                {
                    string jSonContent = fileItem.ReadToEnd();
                    existingBlacksmith = JsonConvert.DeserializeObject <Blacksmith>(jSonContent, new JsonSerializerSettings());
                }
            foreach (Shield equipment in existingBlacksmith.ShieldList)
            {
                equipment.Name        = ConvertToUTF8(equipment.Name);
                equipment.Description = ConvertToUTF8(equipment.Description);
            }
            foreach (Weapon equipment in existingBlacksmith.WeaponList)
            {
                equipment.Name = ConvertToUTF8(equipment.Name);
                string toto = ConvertToUTF8(equipment.Name);
                equipment.Description = ConvertToUTF8(equipment.Description);
            }
            return(existingBlacksmith);
        }
コード例 #4
0
        public void OnSelect(Item item)
        {
            if (item == null)
            {
                return;
            }

            _wndBlacksmith.BtnPressed.item(item);

            if (_wndBlacksmith.BtnItem1.Item == null || _wndBlacksmith.BtnItem2.Item == null)
            {
                return;
            }

            var result = Blacksmith.Verify(_wndBlacksmith.BtnItem1.Item, _wndBlacksmith.BtnItem2.Item);

            if (result != null)
            {
                GameScene.Show(new WndMessage(result));
                _wndBlacksmith.BtnReforge.Enable(false);
            }
            else
            {
                _wndBlacksmith.BtnReforge.Enable(true);
            }
        }
コード例 #5
0
        /// <summary>
        /// Spawnar NPC's på slumpmässiga tiles, förutsatt att tilen är ledig.
        /// </summary>
        private void SpawnNPCS()
        {
            int x = Program.Random.Next(1, 9);
            int y = Program.Random.Next(1, 9);

            while (IsTileFree(x, y))
            {
                Blacksmith smith = new Blacksmith(x, y);
                Tiles[smith.X, smith.Y].Entity = smith;
            }

            for (int i = 0; i < 5; i++)
            {
                x = Program.Random.Next(1, 9);
                y = Program.Random.Next(1, 9);
                while (IsTileFree(x, y) &&
                       IsTileFree(x + 1, y) &&
                       IsTileFree(x - 1, y) &&
                       IsTileFree(x, y + 1) &&
                       IsTileFree(x, y - 1))
                {
                    Villager villager = new Villager(x, y);
                    Tiles[villager.X, villager.Y].Entity = villager;
                }
            }
        }
コード例 #6
0
ファイル: profession.cs プロジェクト: Daniel249/VillageSim
    // cast Profession to a newly initialized Person
    public static Person ToPerson(this Profession prof)
    {
        Person p = null;

        switch (prof)
        {
        case Profession.Farmer:
            p = new Farmer();
            break;

        case Profession.Lumberjack:
            p = new Lumberjack();
            break;

        case Profession.Miner:
            p = new Miner();
            break;

        case Profession.Blacksmith:
            p = new Blacksmith();
            break;

        default:
            throw new NotSupportedException();
        }

        return(p);
    }
コード例 #7
0
    public override void Initialize()
    {
        heroOverview.Initialize(TownManager);

        Blacksmith = DarkestDungeonManager.Campaign.Estate.Blacksmith;
        float ratio = DarkestDungeonManager.Campaign.Estate.GetBuildingUpgradeRatio(BuildingType.Blacksmith);

        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];
                if (tree.treeId == "blacksmith.cost")
                {
                    tree.upgrades[i].TownUpgrades = new List <ITownUpgrade>(new ITownUpgrade[] {
                        Blacksmith.GetUpgradeByCode(currentUpgrades[i].Code)
                    });
                }
                tree.upgrades[i].onClick += BlacksmithWindow_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);
        }
    }
コード例 #8
0
    public static Blacksmith GenerateBlacksmith(GenerationRandom genRan, Blacksmith smith, out BuildingVoxels vox, BuildingGenerationPlan plan)
    {
        vox = new BuildingVoxels(smith.Width, World.ChunkHeight, smith.Height);
        ChooseWallBounds(genRan, smith);
        BuildingGenerator.ConnectBoundingWall(vox, smith.BoundingWall, Voxel.stone);
        Tile[,] tileMap = new Tile[smith.Width, smith.Height];
        //Make the whole floor stone
        BuildingGenerator.SetTiles(tileMap, 0, 0, smith.Width - 1, smith.Height - 1, Tile.STONE_FLOOR);

        Vec2i outSideMin = null;
        Vec2i outSideMax = null;

        //Find the outdoor part and make the floor dirt
        for (int i = 0; i < smith.BoundingWall.Length; i++)
        {
            Vec2i p = smith.BoundingWall[i];
            //If this boundry point does not lie on any of the edges, then it is indented into the
            //building. This means this point defines the outside region of the building.
            if ((p.x != 0 && p.x != smith.Width - 1) && (p.z != 0 && p.z != smith.Height - 1))
            {
                //We get the 2 neigboring wall points, as these define the outside region
                Vec2i nm1 = smith.BoundingWall[(i - 1 + smith.BoundingWall.Length) % smith.BoundingWall.Length];
                Vec2i np1 = smith.BoundingWall[(i + 1) % smith.BoundingWall.Length];

                int minX = Mathf.Min(p.x, nm1.x, np1.x);
                int minZ = Mathf.Min(p.z, nm1.z, np1.z);
                int maxX = Mathf.Max(p.x, nm1.x, np1.x);
                int maxZ = Mathf.Max(p.z, nm1.z, np1.z);
                BuildingGenerator.SetTiles(tileMap, minX, minZ, maxX - minX, maxZ - minZ, Tile.DIRT);
                outSideMin = new Vec2i(minX, minZ);
                outSideMax = new Vec2i(maxX, maxZ);
                break;
            }
        }
        smith.SetBuilding(tileMap);
        PlaceOutsideObjects(genRan, smith, vox, outSideMin, outSideMax);



        BuildingGenerator.ChooseEntrancePoint(genRan, vox, smith, plan);
        BuildingGenerator.AddWindow(genRan, vox, smith);
        BuildingGenerator.AddWindow(genRan, vox, smith);
        BuildingGenerator.AddWindow(genRan, vox, smith, autoReattempt: false);
        BuildingGenerator.AddWindow(genRan, vox, smith, autoReattempt: false);

        BuildingGenerator.PlaceObjectAgainstWall(genRan, new Chest(), 0, vox, smith, .1f, attemptsCount: 20, distToEntr: 4);
        BuildingGenerator.PlaceObjectAgainstWall(genRan, new WeaponStand(), 0, vox, smith, 0.1f, distToEntr: 4);
        BuildingGenerator.PlaceObjectAgainstWall(genRan, new ArmourStand(), 0, vox, smith, .1f, distToEntr: 4);

        WorkBuildingData wbd = new WorkBuildingData(new NPCJob[] { new NPCJobMerchant(smith), new NPCJobBlackSmith(smith), new NPCJobBlackSmith(smith) });

        smith.SetWorkBuildingData(wbd);

        for (int i = 0; i < 10; i++)
        {
            smith.Inventory.AddItem(new Shirt(new ItemMetaData().SetColor(Color.blue)));
        }

        return(smith);
    }
コード例 #9
0
        public BlackSmithViewModel(BlackSmithView view)
        {
            this.Blacksmith = GameViewModel.Instance.MainCastle.Blacksmith;
            this.View       = view;

            this.View.BuyEquipmentListingUC.Controller.Blacksmith = this.Blacksmith;
            this.View.BuyEquipmentListingUC.Controller.initBlacksmithView();
        }
コード例 #10
0
 public NPCJobBlackSmith(IWorkBuilding workLocation) : base("Blacksmith", workLocation)
 {
     BlackSmith     = workLocation as Blacksmith;
     WorkEquiptment = new List <IWorkEquiptmentObject>(5);
     foreach (WorldObjectData obj in workLocation.WorkBuilding.GetBuildingExternalObjects())
     {
         if (obj is IWorkEquiptmentObject workObj)
         {
             WorkEquiptment.Add(workObj);
         }
     }
 }
コード例 #11
0
        static void Main(string[] args)
        {
            var           blacksmith   = new Blacksmith();
            WeaponBuilder swordBuilder = new SwordBuilder();
            Weapon        sword        = blacksmith.Forge(swordBuilder);

            WeaponBuilder bowBuilder = new BowBuilder();
            Weapon        bow        = blacksmith.Forge(bowBuilder);

            Console.WriteLine(sword.ToString());
            Console.WriteLine(bow.ToString());
        }
コード例 #12
0
    public override void _Ready()
    {
        workingBlacksmiths  = new Dictionary <string, Blacksmith>();
        progressBar         = GetNode <ProgressBar>("ProgressBar");
        progressBar.Visible = false;

        // TODO: Remove degub Blacksmith
        Blacksmith tempSmith = new Blacksmith();

        tempSmith.Level = 42;
        AddBlacksmith(tempSmith);
    }
コード例 #13
0
        public FifthQuest()
        {
            Title     = "The Hero!";
            Objective = "You've slained the polar bear as instructed.\n" +
                        "Return to the blacksmith and tell about your victory.";
            MapObjective = new Blacksmith(0, 0);
            RewardXP     = 250;

            Dialogues.Add("You did it!");
            Dialogues.Add("You avenged our fallen.");
            Dialogues.Add("We will forever be grateful for your help!");
        }
コード例 #14
0
ファイル: Estate.cs プロジェクト: ahenrique23/GameEstudo
    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);
    }
コード例 #15
0
        public static void BuilderExample()
        {
            Blacksmith   blacksmith = new Blacksmith();
            SwordBuilder builder    = new GoodIronSwordBuilder();

            // выпекаем
            Builder.Sword IronSword = blacksmith.ForgeSword(builder);
            Console.WriteLine(IronSword.ToString());
            // оздаем билдер для пшеничного хлеба
            builder = new AdamantitSwordBuilder();
            Builder.Sword AdamantitSword = blacksmith.ForgeSword(builder);
            Console.WriteLine(AdamantitSword.ToString());
        }
コード例 #16
0
        public ThirdQuest()
        {
            Title     = "Wood Working!";
            Objective = "You have collected the lumber.\n" +
                        "Now return it to the blacksmith.\n" +
                        "He's displayed with a 'B' on the map.";
            MapObjective = new Blacksmith(0, 0);
            RewardXP     = 50;

            Dialogues.Add("Quest: " + Title + "\n");
            Dialogues.Add("I've finally chopped down the damn tree.");
            Dialogues.Add("I should return to the blacksmith with the lumber I've collected.");
        }
コード例 #17
0
    /// <summary>
    /// Defines the bounds of the building to have an L shape.
    ///
    /// </summary>
    /// <param name="genRan">RNG used to generate building</param>
    /// <param name="smith">Building shell to define wall of</param>
    private static void ChooseLShapedWall(GenerationRandom genRan, Blacksmith smith)
    {
        //Define a base rectangular wall
        List <Vec2i> wallPoints = new List <Vec2i>();

        wallPoints.Add(new Vec2i(0, 0));
        wallPoints.Add(new Vec2i(smith.Width - 1, 0));
        wallPoints.Add(new Vec2i(smith.Width - 1, smith.Height - 1));
        wallPoints.Add(new Vec2i(0, smith.Height - 1));



        //Choose which point index we wish to move
        int deltaPointI = genRan.RandomInt(0, wallPoints.Count);
        //We find which direction and amount the point has to move to not leave the bounds
        int   xDir     = (wallPoints[deltaPointI].x == 0 ? 1 : -1) * genRan.RandomInt(smith.Width / 3, smith.Width - smith.Width / 3);
        int   zDir     = (wallPoints[deltaPointI].z == 0 ? 1 : -1) * genRan.RandomInt(smith.Height / 3, smith.Height - smith.Height / 3);
        Vec2i newPoint = new Vec2i(xDir, zDir) + wallPoints[deltaPointI];

        //wallPoints.Insert(deltaPointI-1, newPoint);
        //We find the direction from the previous corner to this one,
        //we use this to translate the point accordingly
        Vec2i nm1_to_n = wallPoints[deltaPointI] - wallPoints[(deltaPointI - 1 + wallPoints.Count) % wallPoints.Count];
        Vec2i np1_to_n = wallPoints[(deltaPointI + 1) % wallPoints.Count] - wallPoints[deltaPointI];

        if (nm1_to_n.x == 0)
        {
            wallPoints[deltaPointI].z = newPoint.z;
        }
        else
        {
            wallPoints[deltaPointI].x = newPoint.x;
        }

        // Vec2i np1_to_n = wallPoints[(deltaPointI + 1) % wallPoints.Count] - wallPoints[deltaPointI];

        Vec2i newPoint2 = new Vec2i(newPoint.x, newPoint.z);

        if (np1_to_n.x == 0)
        {
            newPoint2.x = wallPoints[(deltaPointI + 1) % wallPoints.Count].x;
        }
        else
        {
            newPoint2.z = wallPoints[(deltaPointI + 1) % wallPoints.Count].z;
        }
        wallPoints.Insert((deltaPointI + 1), newPoint);
        wallPoints.Insert((deltaPointI + 2), newPoint2);

        smith.BoundingWall = wallPoints.ToArray();
    }
コード例 #18
0
        public WndBlacksmith(Blacksmith troll, Hero hero)
        {
            ItemSelector = new BlacksmithItemSelector(this);

            var titlebar = new IconTitle();

            titlebar.Icon(troll.Sprite);
            titlebar.Label(Utils.Capitalize(troll.Name));
            titlebar.SetRect(0, 0, WIDTH, 0);
            Add(titlebar);

            var message = PixelScene.CreateMultiline(TxtPrompt, 6);

            message.MaxWidth = WIDTH;
            message.Measure();
            message.Y = titlebar.Bottom() + Gap;
            Add(message);

            BtnItem1             = new ItemButton();
            BtnItem1.ClickAction = () =>
            {
                BtnPressed = BtnItem1;
                GameScene.SelectItem(ItemSelector, WndBag.Mode.UPGRADEABLE, TxtSelect);
            };
            BtnItem1.SetRect((WIDTH - BtnGap) / 2 - BtnSize, message.Y + message.Height + BtnGap, BtnSize, BtnSize);
            Add(BtnItem1);

            BtnItem2             = new ItemButton();
            BtnItem2.ClickAction = () =>
            {
                BtnPressed = BtnItem2;
                GameScene.SelectItem(ItemSelector, WndBag.Mode.UPGRADEABLE, TxtSelect);
            };
            BtnItem2.SetRect(BtnItem1.Right() + BtnGap, BtnItem1.Top(), BtnSize, BtnSize);
            Add(BtnItem2);

            BtnReforge             = new RedButton(TxtReforge);
            BtnReforge.ClickAction = button =>
            {
                troll.Upgrade(BtnItem1.Item, BtnItem2.Item);
                Hide();
            };
            BtnReforge.Enable(false);
            BtnReforge.SetRect(0, BtnItem1.Bottom() + BtnGap, WIDTH, 20);
            Add(BtnReforge);


            Resize(WIDTH, (int)BtnReforge.Bottom());
        }
コード例 #19
0
ファイル: FirstQuest.cs プロジェクト: Zitaa/Lab1
        public FirstQuest()
        {
            Title     = "Get Started!";
            Objective = "Go talk to the Blacksmith.\n" +
                        "He's displayed with a 'B' on the map.";
            Type         = QuestTypes.GoTo;
            MapObjective = new Blacksmith(0, 0);
            RewardXP     = 100;

            Dialogues.Add("Quest: " + Title + "\n");
            Dialogues.Add("Welcome, " + Environment.player.Name + ".");
            Dialogues.Add("We could use a helping hand.");
            Dialogues.Add("Follow my instructions and you'll do fine.");
            Dialogues.Add("First, talk to the Blacksmith (B on the map).");
            Dialogues.Add("He'll have the right tools to get you started.");
            Dialogues.Add("Go ahead, get going!");
        }
コード例 #20
0
    public void MousePutDownOnBlacksmith(Blacksmith blacksmith)
    {
        if (airItem == null)
        {
            myUI.ClearActiveNpcWindow();
            return;
        }
        if (!(airItem.item is EquippableItem))
        {
            airItem = null;
            myUI.ClearActiveNpcWindow();
            return;
        }
        if (airItem.UpgradeLevel == 9)
        {
            airItem = null;
            myUI.ClearActiveNpcWindow();
            return;
        }
        if (airItem.eqPieceSlot != null)
        {
            airItem = null;
            myUI.ClearActiveNpcWindow();
            return;
        }
        if (airItem.onActionBar)
        {
            airItem = null;
            myUI.ClearActiveNpcWindow();
            return;
        }
        GameObject prefab = GetApropriatePrefab(airItem.item);
        GameObject newGo  = Instantiate(prefab, blacksmith.itemScreenLocation.position, Quaternion.identity, blacksmith.itemScreenLocation);

        newGo.GetComponent <Button>().enabled      = false;
        newGo.GetComponent <ItemUI>().item         = airItem.item;
        newGo.GetComponent <ItemUI>().UpgradeLevel = airItem.UpgradeLevel;
        newGo.GetComponent <ItemUI>().itemX        = -1;
        newGo.GetComponent <ItemUI>().itemY        = -1;
        newGo.GetComponent <Image>().sprite        = airItem.item.inventoryIcon;
        blacksmith.SetupUpgradeWindow(newGo.GetComponent <ItemUI>(), airItem, myUI.playerUI.gameObject.GetComponent <PlayerRpg>());
        airItem = null;
    }
コード例 #21
0
    public void CmdBuildBlacksmith(GameObject tile)
    {
        //RpcBuildBlacksmith(tile);
        GameObject bsObj = Instantiate(Resources.Load <GameObject>("NetworkPrefabs/Blacksmith"), tile.transform.position, Quaternion.identity);
        Blacksmith bS    = bsObj.GetComponent <Blacksmith>();

        NetworkServer.Spawn(bsObj);
        bS.parentId            = tile.GetComponent <NetworkIdentity>().netId;
        bsObj.transform.parent = tile.transform;
        bsObj.transform.Translate(Vector3.back);
        bS.OnBuild();
        Tile t = tile.GetComponent <Tile>();

        foreach (SquadUnit s in t.units)
        {
            s.unit.GetComponent <FollowerMovement>().rooted = true;
        }
        Cmds.i.RpcPrintFloatingText(tile, "Used 5 wood and 5 stone");
        Cmds.i.RpcBuild(tile, bsObj);
    }
コード例 #22
0
    /// <summary>
    /// Defines the building shape to be rectangular, with a rectangular section defining outside,
    /// and another defining inside
    /// </summary>
    /// <param name="genRan"></param>
    /// <param name="smith"></param>
    private static void ChooseHalfCutWall(GenerationRandom genRan, Blacksmith smith)
    {
        //Define a base rectangular wall
        List <Vec2i> wallPoints = new List <Vec2i>();

        wallPoints.Add(new Vec2i(0, 0));
        wallPoints.Add(new Vec2i(smith.Width - 1, 0));
        wallPoints.Add(new Vec2i(smith.Width - 1, smith.Height - 1));
        wallPoints.Add(new Vec2i(0, smith.Height - 1));

        int wallIndex = genRan.RandomInt(0, 4);
        int wp1       = (wallIndex + 1) % 4;

        wallPoints[wallIndex].x = (int)(wallPoints[wallIndex].x * 0.5f);
        wallPoints[wallIndex].z = (int)(wallPoints[wallIndex].z * 0.5f);
        wallPoints[wp1].x       = (int)(wallPoints[wp1].x * 0.5f);
        wallPoints[wp1].z       = (int)(wallPoints[wp1].z * 0.5f);

        smith.BoundingWall = wallPoints.ToArray();
    }
コード例 #23
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);
    }
コード例 #24
0
    private static void PlaceOutsideObjects(GenerationRandom genRan, Blacksmith smith, BuildingVoxels vox, Vec2i outMin, Vec2i outMax)
    {
        List <WorldObjectData> toPlace = new List <WorldObjectData>(new WorldObjectData[] { new Anvil(), new Anvil() });
        bool isFinished = false;

        while (!isFinished)
        {
            WorldObjectData toPlaceCur = toPlace[0];
            toPlace.RemoveAt(0);
            Vector3 pos = genRan.RandomVector3(outMin.x, outMax.x, 0, 0, outMin.z, outMax.z);
            toPlaceCur.SetPosition(pos);
            while (!BuildingGenerator.AddObject(smith, vox, toPlaceCur))
            {
                pos = genRan.RandomVector3(outMin.x, outMax.x, 0, 0, outMin.z, outMax.z);
                toPlaceCur.SetPosition(pos);
            }
            if (toPlace.Count == 0)
            {
                isFinished = true;
            }
        }
    }
コード例 #25
0
    public static Building CreateBuilding(GenerationRandom genRan, out BuildingVoxels vox, BuildingGenerationPlan plan)
    {
        Vec2i zero      = new Vec2i(0, 0);
        int   maxWidth  = (plan.DesiredSize == null || plan.DesiredSize == zero) ?Mathf.Min(plan.BuildingPlan.MaxSize, plan.MaxWidth): plan.DesiredSize.x;
        int   maxHeight = (plan.DesiredSize == null || plan.DesiredSize == zero)? Mathf.Min(plan.BuildingPlan.MaxSize, plan.MaxHeight) : plan.DesiredSize.z;
        int   width     = genRan.RandomInt(plan.BuildingPlan.MinSize, maxWidth);
        int   height    = genRan.RandomInt(plan.BuildingPlan.MinSize, maxHeight);

        if (plan.BuildingPlan == Building.BLACKSMITH)
        {
            Blacksmith smith = BlacksmithGenerator.GenerateBlacksmith(genRan, new Blacksmith(width, height), out vox, plan);
            return(smith);
        }
        if (plan.BuildingPlan == Building.BARACKS)
        {
            Barracks barr = BarracksGenerator.GenerateBarracks(genRan, new Barracks(width, height), out vox, plan);
            return(barr);
        }
        if (plan.BuildingPlan == Building.TAVERN)
        {
            return(TavernGenerator.GenerateTavern(genRan, new Tavern(width, height), out vox, plan));
        }
        if (plan.BuildingPlan == Building.VEGFARM)
        {
            Farm farm = FarmGenerator.GenerateVegFarm(genRan, new Farm(width, height), out vox, plan);
            return(farm);
        }
        if (plan.BuildingPlan == Building.WHEATFARM)
        {
            Farm farm = FarmGenerator.GenerateWheatFarm(genRan, new Farm(width, height), out vox, plan);
            return(farm);
        }

        House house = HouseGenerator.GenerateHouse(genRan, new House(width, height), out vox, plan);

        return(house);
        //return GenerateHouse(out vox, width, height);
    }
コード例 #26
0
    public static Blacksmith GenerateBlacksmith(Blacksmith building, BuildingStyle style = BuildingStyle.stone)
    {
        int   width  = building.Width;
        int   height = building.Height;
        Vec2i entr   = GenerateWallsFloorAndEntrance(width, height, building.BuildingObjects, building.BuildingTiles, 0, style, tileType: Tile.TEST_MAGENTA);

        building.SetEntrancePoint(entr);
        WorkEquiptmentData anvil = new Anvil(new Vec2i(1, 3));
        WorkEquiptmentData forge = new Anvil(new Vec2i(4, 4));

        AddObject(building, anvil, 1, 3);
        AddObject(building, forge, 4, 4);

        NPCJob[] jobs = new NPCJob[] { new NPCJobBlackSmith(building),
                                       new NPCJobBlackSmith(building),
                                       new NPCJobBlackSmith(building) };

        building.SetWorkBuildingData(new WorkBuildingData(jobs));
        AddEntrance(building, 0);
        //building.WorkEquiptment.Add(new WorkEquiptmentPlacement(anvil, new Vec2i(1, 3)));
        //building.WorkEquiptment.Add(new WorkEquiptmentPlacement(forge, new Vec2i(4, 4)));
        return(building);
    }
コード例 #27
0
    public void PerformBuild(int selection, GameObject tile)
    {
        Tile t = tile.GetComponent <Tile>();

        if (t.units.Count == 0)
        {
            return;
        }
        switch (selection)
        {
        case 0:
            if (Blacksmith.CanBuild())
            {
                i.CmdBuildBlacksmith(tile);
            }
            break;

        case 1:
            if (Farm.CanBuild())
            {
                i.CmdBuildFarm(tile);
            }
            break;

        case 2:
            if (Home.CanBuild())
            {
                i.CmdBuildHome(tile);
            }
            break;

        case 3:
            i.CmdDestroy(tile);
            break;
        }
    }
コード例 #28
0
        public override void OnMovement(Mobile m, Point3D oldLocation)
        {
            base.OnMovement(m, oldLocation);


            int hours, minutes, uoDay, totalUoDays, totalMinutes;

            Server.Items.Clock.GetTime(m.Map, m.X, m.Y, out hours, out minutes, out totalMinutes);

            totalUoDays = (int)Math.Ceiling((double)totalMinutes / (60 * 24));

            Math.DivRem(totalUoDays, 30, out uoDay);

            //if (uoDay== 1 || uoDay == 7 || uoDay == 15 || uoDay== 23)
            // {
            if (hours >= 6 && hours <= 20)
            {
                int marketplace    = m_market.Count;
                int marketplacemob = m_marketmob.Count;

                if (marketplace >= marketCount && marketplacemob >= marketCount)
                {
                    return;
                }

                bool validLocation = false;
                Map  map           = this.Map;

                switch (Utility.Random(11))
                {
                    #region fisherman
                case 0:
                {
                    for (int i = marketplace; i < marketCount; ++i)
                    {
                        if (i == 0)
                        {
                            Point3D marketloc = this.Location;        //
                            MarketStandFishEastAddon market = new MarketStandFishEastAddon();

                            for (int k = 0; !validLocation && k < 10; ++k)
                            {
                                int ax = X;
                                int ay = Y;
                                int az = map.GetAverageZ(ax, ay);

                                if (validLocation = map.CanFit(ax, ay, this.Z, 16, false, false))
                                {
                                    marketloc = new Point3D(ax, ay, Z);
                                }
                                else if (validLocation = map.CanFit(ax, ay, az, 16, false, false))
                                {
                                    marketloc = new Point3D(ax, ay, az);
                                }
                            }
                            market.MoveToWorld(marketloc, this.Map);
                            m_market.Add(market);
                        }
                    }
                    for (int i = marketplacemob; i < marketmobCount; ++i)
                    {
                        if (i == 0)
                        {
                            Point3D   marketloc6 = this.Location;
                            Fisherman marketmob1 = new Fisherman();

                            int gx = X + 3;
                            int gy = Y;
                            int gz = map.GetAverageZ(gx, gy);

                            if (validLocation = map.CanFit(gx, gy, this.Z, 16, false, false))
                            {
                                marketloc6 = new Point3D(gx, gy, Z);
                            }
                            else if (validLocation = map.CanFit(gx, gy, gz, 16, false, false))
                            {
                                marketloc6 = new Point3D(gx, gy, gz);
                            }

                            marketmob1.Home      = marketloc6;
                            marketmob1.RangeHome = 0;
                            marketmob1.MoveToWorld(marketloc6, this.Map);
                            m_marketmob.Add(marketmob1);
                        }
                    }
                    break;
                }

                    #endregion

                    #region mercer
                case 1:
                {
                    for (int i = marketplace; i < marketCount; ++i)
                    {
                        if (i == 0)
                        {
                            Point3D marketloc = this.Location;        //
                            MarketStandMercerEastAddon market = new MarketStandMercerEastAddon();

                            for (int k = 0; !validLocation && k < 10; ++k)
                            {
                                int ax = X;
                                int ay = Y;
                                int az = map.GetAverageZ(ax, ay);

                                if (validLocation = map.CanFit(ax, ay, this.Z, 16, false, false))
                                {
                                    marketloc = new Point3D(ax, ay, Z);
                                }
                                else if (validLocation = map.CanFit(ax, ay, az, 16, false, false))
                                {
                                    marketloc = new Point3D(ax, ay, az);
                                }
                            }
                            market.MoveToWorld(marketloc, this.Map);
                            m_market.Add(market);
                        }
                    }
                    for (int i = marketplacemob; i < marketmobCount; ++i)
                    {
                        if (i == 0)
                        {
                            Point3D marketloc6 = this.Location;        //
                            Tailor  marketmob1 = new Tailor();

                            int gx = X + 3;
                            int gy = Y;
                            int gz = map.GetAverageZ(gx, gy);

                            if (validLocation = map.CanFit(gx, gy, this.Z, 16, false, false))
                            {
                                marketloc6 = new Point3D(gx, gy, Z);
                            }
                            else if (validLocation = map.CanFit(gx, gy, gz, 16, false, false))
                            {
                                marketloc6 = new Point3D(gx, gy, gz);
                            }

                            marketmob1.Home      = marketloc6;
                            marketmob1.RangeHome = 0;
                            marketmob1.MoveToWorld(marketloc6, this.Map);
                            m_marketmob.Add(marketmob1);
                        }
                    }
                    break;
                }

                    #endregion

                    #region vegetables
                case 2:
                {
                    for (int i = marketplace; i < marketCount; ++i)
                    {
                        if (i == 0)
                        {
                            Point3D marketloc = this.Location;        //
                            MarketStandVegetablesEastAddon market = new MarketStandVegetablesEastAddon();

                            for (int k = 0; !validLocation && k < 10; ++k)
                            {
                                int ax = X;
                                int ay = Y;
                                int az = map.GetAverageZ(ax, ay);

                                if (validLocation = map.CanFit(ax, ay, this.Z, 16, false, false))
                                {
                                    marketloc = new Point3D(ax, ay, Z);
                                }
                                else if (validLocation = map.CanFit(ax, ay, az, 16, false, false))
                                {
                                    marketloc = new Point3D(ax, ay, az);
                                }
                            }
                            market.MoveToWorld(marketloc, this.Map);
                            m_market.Add(market);
                        }
                    }
                    for (int i = marketplacemob; i < marketmobCount; ++i)
                    {
                        if (i == 0)
                        {
                            Point3D marketloc6 = this.Location;        //
                            Farmer  marketmob1 = new Farmer();

                            int gx = X - 2;
                            int gy = Y;
                            int gz = map.GetAverageZ(gx, gy);

                            if (validLocation = map.CanFit(gx, gy, this.Z, 16, false, false))
                            {
                                marketloc6 = new Point3D(gx, gy, Z);
                            }
                            else if (validLocation = map.CanFit(gx, gy, gz, 16, false, false))
                            {
                                marketloc6 = new Point3D(gx, gy, gz);
                            }

                            marketmob1.Home      = marketloc6;
                            marketmob1.RangeHome = 0;
                            marketmob1.MoveToWorld(marketloc6, this.Map);
                            m_marketmob.Add(marketmob1);
                        }
                    }
                    break;
                }

                    #endregion

                    #region cheese
                case 3:
                {
                    for (int i = marketplace; i < marketCount; ++i)
                    {
                        if (i == 0)
                        {
                            Point3D marketloc = this.Location;        //
                            MarketStandCheeseEastAddon market = new MarketStandCheeseEastAddon();

                            for (int k = 0; !validLocation && k < 10; ++k)
                            {
                                int ax = X;
                                int ay = Y;
                                int az = map.GetAverageZ(ax, ay);

                                if (validLocation = map.CanFit(ax, ay, this.Z, 16, false, false))
                                {
                                    marketloc = new Point3D(ax, ay, Z);
                                }
                                else if (validLocation = map.CanFit(ax, ay, az, 16, false, false))
                                {
                                    marketloc = new Point3D(ax, ay, az);
                                }
                            }
                            market.MoveToWorld(marketloc, this.Map);
                            m_market.Add(market);
                        }
                    }
                    for (int i = marketplacemob; i < marketmobCount; ++i)
                    {
                        if (i == 0)
                        {
                            Point3D marketloc6 = this.Location;        //
                            Farmer  marketmob1 = new Farmer();

                            int gx = X - 1;
                            int gy = Y;
                            int gz = map.GetAverageZ(gx, gy);

                            if (validLocation = map.CanFit(gx, gy, this.Z, 16, false, false))
                            {
                                marketloc6 = new Point3D(gx, gy, Z);
                            }
                            else if (validLocation = map.CanFit(gx, gy, gz, 16, false, false))
                            {
                                marketloc6 = new Point3D(gx, gy, gz);
                            }

                            marketmob1.Home      = marketloc6;
                            marketmob1.RangeHome = 0;
                            marketmob1.MoveToWorld(marketloc6, this.Map);
                            m_marketmob.Add(marketmob1);
                        }
                    }
                    break;
                }

                    #endregion

                    #region wine
                case 4:
                {
                    for (int i = marketplace; i < marketCount; ++i)
                    {
                        if (i == 0)
                        {
                            Point3D marketloc = this.Location;        //
                            MarketStandWineEastAddon market = new MarketStandWineEastAddon();

                            for (int k = 0; !validLocation && k < 10; ++k)
                            {
                                int ax = X;
                                int ay = Y - 1;
                                int az = map.GetAverageZ(ax, ay);

                                if (validLocation = map.CanFit(ax, ay, this.Z, 16, false, false))
                                {
                                    marketloc = new Point3D(ax, ay, Z);
                                }
                                else if (validLocation = map.CanFit(ax, ay, az, 16, false, false))
                                {
                                    marketloc = new Point3D(ax, ay, az);
                                }
                            }
                            market.MoveToWorld(marketloc, this.Map);
                            m_market.Add(market);
                        }
                    }
                    for (int i = marketplacemob; i < marketmobCount; ++i)
                    {
                        if (i == 0)
                        {
                            Point3D   marketloc6 = this.Location;      //
                            Barkeeper marketmob1 = new Barkeeper();

                            int gx = X + 3;
                            int gy = Y;
                            int gz = map.GetAverageZ(gx, gy);

                            if (validLocation = map.CanFit(gx, gy, this.Z, 16, false, false))
                            {
                                marketloc6 = new Point3D(gx, gy, Z);
                            }
                            else if (validLocation = map.CanFit(gx, gy, gz, 16, false, false))
                            {
                                marketloc6 = new Point3D(gx, gy, gz);
                            }

                            marketmob1.Home      = marketloc6;
                            marketmob1.RangeHome = 0;
                            marketmob1.MoveToWorld(marketloc6, this.Map);
                            m_marketmob.Add(marketmob1);
                        }
                    }
                    break;
                }

                    #endregion

                    #region herbs
                case 5:
                {
                    for (int i = marketplace; i < marketCount; ++i)
                    {
                        if (i == 0)
                        {
                            Point3D marketloc = this.Location;        //
                            MarketStandHerbsEastAddon market = new MarketStandHerbsEastAddon();

                            for (int k = 0; !validLocation && k < 10; ++k)
                            {
                                int ax = X;
                                int ay = Y;
                                int az = map.GetAverageZ(ax, ay);

                                if (validLocation = map.CanFit(ax, ay, this.Z, 16, false, false))
                                {
                                    marketloc = new Point3D(ax, ay, Z);
                                }
                                else if (validLocation = map.CanFit(ax, ay, az, 16, false, false))
                                {
                                    marketloc = new Point3D(ax, ay, az);
                                }
                            }
                            market.MoveToWorld(marketloc, this.Map);
                            m_market.Add(market);
                        }
                    }
                    for (int i = marketplacemob; i < marketmobCount; ++i)
                    {
                        if (i == 0)
                        {
                            Point3D   marketloc6 = this.Location;      //
                            Herbalist marketmob1 = new Herbalist();

                            int gx = X + 3;
                            int gy = Y;
                            int gz = map.GetAverageZ(gx, gy);

                            if (validLocation = map.CanFit(gx, gy, this.Z, 16, false, false))
                            {
                                marketloc6 = new Point3D(gx, gy, Z);
                            }
                            else if (validLocation = map.CanFit(gx, gy, gz, 16, false, false))
                            {
                                marketloc6 = new Point3D(gx, gy, gz);
                            }

                            marketmob1.Home      = marketloc6;
                            marketmob1.RangeHome = 0;
                            marketmob1.MoveToWorld(marketloc6, this.Map);
                            m_marketmob.Add(marketmob1);
                        }
                    }
                    break;
                }

                    #endregion

                    #region mushroom
                case 6:
                {
                    for (int i = marketplace; i < marketCount; ++i)
                    {
                        if (i == 0)
                        {
                            Point3D marketloc = this.Location;        //
                            MarketStandMushroomEastAddon market = new MarketStandMushroomEastAddon();

                            for (int k = 0; !validLocation && k < 10; ++k)
                            {
                                int ax = X;
                                int ay = Y;
                                int az = map.GetAverageZ(ax, ay);

                                if (validLocation = map.CanFit(ax, ay, this.Z, 16, false, false))
                                {
                                    marketloc = new Point3D(ax, ay, Z);
                                }
                                else if (validLocation = map.CanFit(ax, ay, az, 16, false, false))
                                {
                                    marketloc = new Point3D(ax, ay, az);
                                }
                            }
                            market.MoveToWorld(marketloc, this.Map);
                            m_market.Add(market);
                        }
                    }
                    for (int i = marketplacemob; i < marketmobCount; ++i)
                    {
                        if (i == 0)
                        {
                            Point3D   marketloc6 = this.Location;      //
                            Herbalist marketmob1 = new Herbalist();

                            int gx = X + 3;
                            int gy = Y;
                            int gz = map.GetAverageZ(gx, gy);

                            if (validLocation = map.CanFit(gx, gy, this.Z, 16, false, false))
                            {
                                marketloc6 = new Point3D(gx, gy, Z);
                            }
                            else if (validLocation = map.CanFit(gx, gy, gz, 16, false, false))
                            {
                                marketloc6 = new Point3D(gx, gy, gz);
                            }

                            marketmob1.Home      = marketloc6;
                            marketmob1.RangeHome = 0;
                            marketmob1.MoveToWorld(marketloc6, this.Map);
                            m_marketmob.Add(marketmob1);
                        }
                    }
                    break;
                }

                    #endregion

                    #region fur
                case 7:
                {
                    for (int i = marketplace; i < marketCount; ++i)
                    {
                        if (i == 0)
                        {
                            Point3D marketloc = this.Location;        //
                            MarketStandFurEastAddon market = new MarketStandFurEastAddon();

                            for (int k = 0; !validLocation && k < 10; ++k)
                            {
                                int ax = X;
                                int ay = Y;
                                int az = map.GetAverageZ(ax, ay);

                                if (validLocation = map.CanFit(ax, ay, this.Z, 16, false, false))
                                {
                                    marketloc = new Point3D(ax, ay, Z);
                                }
                                else if (validLocation = map.CanFit(ax, ay, az, 16, false, false))
                                {
                                    marketloc = new Point3D(ax, ay, az);
                                }
                            }
                            market.MoveToWorld(marketloc, this.Map);
                            m_market.Add(market);
                        }
                    }
                    for (int i = marketplacemob; i < marketmobCount; ++i)
                    {
                        if (i == 0)
                        {
                            Point3D   marketloc6 = this.Location;      //
                            Furtrader marketmob1 = new Furtrader();

                            int gx = X + 3;
                            int gy = Y;
                            int gz = map.GetAverageZ(gx, gy);

                            if (validLocation = map.CanFit(gx, gy, this.Z, 16, false, false))
                            {
                                marketloc6 = new Point3D(gx, gy, Z);
                            }
                            else if (validLocation = map.CanFit(gx, gy, gz, 16, false, false))
                            {
                                marketloc6 = new Point3D(gx, gy, gz);
                            }

                            marketmob1.Home      = marketloc6;
                            marketmob1.RangeHome = 0;
                            marketmob1.MoveToWorld(marketloc6, this.Map);
                            m_marketmob.Add(marketmob1);
                        }
                    }
                    break;
                }

                    #endregion

                    #region bee
                case 8:
                {
                    for (int i = marketplace; i < marketCount; ++i)
                    {
                        if (i == 0)
                        {
                            Point3D marketloc = this.Location;        //
                            MarketStandBeeEastAddon market = new MarketStandBeeEastAddon();

                            for (int k = 0; !validLocation && k < 10; ++k)
                            {
                                int ax = X;
                                int ay = Y;
                                int az = map.GetAverageZ(ax, ay);

                                if (validLocation = map.CanFit(ax, ay, this.Z, 16, false, false))
                                {
                                    marketloc = new Point3D(ax, ay, Z);
                                }
                                else if (validLocation = map.CanFit(ax, ay, az, 16, false, false))
                                {
                                    marketloc = new Point3D(ax, ay, az);
                                }
                            }
                            market.MoveToWorld(marketloc, this.Map);
                            m_market.Add(market);
                        }
                    }
                    for (int i = marketplacemob; i < marketmobCount; ++i)
                    {
                        if (i == 0)
                        {
                            Point3D   marketloc6 = this.Location;      //
                            Beekeeper marketmob1 = new Beekeeper();

                            int gx = X + 3;
                            int gy = Y;
                            int gz = map.GetAverageZ(gx, gy);

                            if (validLocation = map.CanFit(gx, gy, this.Z, 16, false, false))
                            {
                                marketloc6 = new Point3D(gx, gy, Z);
                            }
                            else if (validLocation = map.CanFit(gx, gy, gz, 16, false, false))
                            {
                                marketloc6 = new Point3D(gx, gy, gz);
                            }

                            marketmob1.Home      = marketloc6;
                            marketmob1.RangeHome = 0;
                            marketmob1.MoveToWorld(marketloc6, this.Map);
                            m_marketmob.Add(marketmob1);
                        }
                    }
                    break;
                }

                    #endregion

                    #region copper
                case 9:
                {
                    for (int i = marketplace; i < marketCount; ++i)
                    {
                        if (i == 0)
                        {
                            Point3D marketloc = this.Location;        //
                            MarketStandCopperEastAddon market = new MarketStandCopperEastAddon();

                            for (int k = 0; !validLocation && k < 10; ++k)
                            {
                                int ax = X;
                                int ay = Y;
                                int az = map.GetAverageZ(ax, ay);

                                if (validLocation = map.CanFit(ax, ay, this.Z, 16, false, false))
                                {
                                    marketloc = new Point3D(ax, ay, Z);
                                }
                                else if (validLocation = map.CanFit(ax, ay, az, 16, false, false))
                                {
                                    marketloc = new Point3D(ax, ay, az);
                                }
                            }
                            market.MoveToWorld(marketloc, this.Map);
                            m_market.Add(market);
                        }
                    }
                    for (int i = marketplacemob; i < marketmobCount; ++i)
                    {
                        if (i == 0)
                        {
                            Point3D    marketloc6 = this.Location;     //
                            Blacksmith marketmob1 = new Blacksmith();

                            int gx = X + 3;
                            int gy = Y;
                            int gz = map.GetAverageZ(gx, gy);

                            if (validLocation = map.CanFit(gx, gy, this.Z, 16, false, false))
                            {
                                marketloc6 = new Point3D(gx, gy, Z);
                            }
                            else if (validLocation = map.CanFit(gx, gy, gz, 16, false, false))
                            {
                                marketloc6 = new Point3D(gx, gy, gz);
                            }

                            marketmob1.Home      = marketloc6;
                            marketmob1.RangeHome = 0;
                            marketmob1.MoveToWorld(marketloc6, this.Map);
                            m_marketmob.Add(marketmob1);
                        }
                    }
                    break;
                }

                    #endregion

                    #region tool
                case 10:
                {
                    for (int i = marketplace; i < marketCount; ++i)
                    {
                        if (i == 0)
                        {
                            Point3D marketloc = this.Location;        //
                            MarketStandToolEastAddon market = new MarketStandToolEastAddon();

                            for (int k = 0; !validLocation && k < 10; ++k)
                            {
                                int ax = X;
                                int ay = Y;
                                int az = map.GetAverageZ(ax, ay);

                                if (validLocation = map.CanFit(ax, ay, this.Z, 16, false, false))
                                {
                                    marketloc = new Point3D(ax, ay, Z);
                                }
                                else if (validLocation = map.CanFit(ax, ay, az, 16, false, false))
                                {
                                    marketloc = new Point3D(ax, ay, az);
                                }
                            }
                            market.MoveToWorld(marketloc, this.Map);
                            m_market.Add(market);
                        }
                    }
                    for (int i = marketplacemob; i < marketmobCount; ++i)
                    {
                        if (i == 0)
                        {
                            Point3D marketloc6 = this.Location;        //
                            Tinker  marketmob1 = new Tinker();

                            int gx = X + 3;
                            int gy = Y;
                            int gz = map.GetAverageZ(gx, gy);

                            if (validLocation = map.CanFit(gx, gy, this.Z, 16, false, false))
                            {
                                marketloc6 = new Point3D(gx, gy, Z);
                            }
                            else if (validLocation = map.CanFit(gx, gy, gz, 16, false, false))
                            {
                                marketloc6 = new Point3D(gx, gy, gz);
                            }

                            marketmob1.Home      = marketloc6;
                            marketmob1.RangeHome = 0;
                            marketmob1.MoveToWorld(marketloc6, this.Map);
                            m_marketmob.Add(marketmob1);
                        }
                    }
                    break;
                }

                    #endregion
                }
            }

            else
            {
                foreach (Item that in m_market)
                {
                    that.Delete();
                }

                foreach (Mobile thats in m_marketmob)
                {
                    thats.Delete();
                }
            }
        }
コード例 #29
0
 public void SetBlacksmith(Blacksmith blacksmith)
 {
     this.currentBlacksmith = blacksmith;
 }
コード例 #30
0
ファイル: UiManager.cs プロジェクト: bruno00nunes/PolyCove3
 public void ShowBlacksmith(Blacksmith building)
 {
     blacksmithUi.SetActive(true);
     blacksmithUi.GetComponentInChildren <BlacksmithUnitInfo>().blacksmith = building;
 }