Inheritance: MonoBehaviour
Exemplo n.º 1
0
        public void Forge(int range)
        {
            IPooledEnumerable eable = m_Mobile.GetItemsInRange(range);

            foreach (Item item in eable)
            {
                if (item is Anvil)
                {
                    Anvil anvil = (Anvil)item;

                    if (MoveTo(item, false, 1))
                    {
                        BaseWeapon weapon = (BaseWeapon)m_Mobile.Weapon;

                        m_Mobile.Direction = m_Mobile.GetDirectionTo(anvil.GetWorldLocation());
                        weapon.SwingAnimation(m_Mobile);

                        Effects.PlaySound(anvil.GetWorldLocation(), anvil.Map, 0x2b);


                        // Repeat the animation
                        m_Schedule.nextAct = DateTime.Now;

                        break;
                    }
                }
            }

            eable.Free();
        }
Exemplo n.º 2
0
        public void SetBlock(int x, int y, int z, byte block, byte data)
        {
            int ax   = (int)((x >> 4) / 32d);
            int az   = (int)((z >> 4) / 32d);
            int indx = x < 0 ? -ax - 1 : ax;
            int indz = z < 0 ? -az - 1 : az;

            ax = x < 0 ? 15 + ax : ax;
            az = z < 0 ? 15 + az /*-az - 1*/ : az;
            Coord Anvil = new Coord {
                X = indx, Z = indz
            };
            Anvil mca;

            if (!Anvils.ContainsKey(Anvil))
            {
                Debug.WriteLine("LoadAnvil r.{0}.{1}.mca", indx, indz);
                string file = Path.Combine(RegionDirectory, "r." + indx + '.' + indz + ".mca");
                Anvils.Add(Anvil, mca = new Anvil(new FileStream(file, FileMode.OpenOrCreate), indx, indz));
            }
            else
            {
                mca = Anvils[Anvil];
            }
            if (x < 0)
            {
                x = 512 + x;
            }
            if (z < 0)
            {
                z = 512 + z;
            }
            mca.SetBlock(x % 512, y, z % 512, block, data);
        }
Exemplo n.º 3
0
    private void SpawnAnvil()
    {
        GameObject anvil = Instantiate(anvilPrefab, anvilSpawn.position, Quaternion.identity);

        anvilScript = anvil.GetComponent <Anvil>();
        anvilScript.spawnDestination = anvilPosition;
        anvilScript.Spawn();
    }
    public override void Enable ()
	{
		lootWindow.SetActive(false);
		uiWindow.SetActive(true);
		UpdateInfo();
		anvil = GameObject.FindGameObjectWithTag("Anvil").GetComponent<Anvil>();
		base.Enable ();
	}
Exemplo n.º 5
0
        public SmallForgeHouse(Mobile owner, int id) : base(owner, id)
        {
            AddAddon(new Forge(), 0, 0, 7);
            Anvil a = new Anvil();

            a.ItemID = 0xFB0;
            AddAddon(a, 1, 0, 7);
        }
Exemplo n.º 6
0
 private void OnChanged_InventoryState()
 {
     if (m_CurrentAnvil && InventoryController.Instance.IsClosed)
     {
         m_CurrentAnvil.RepairProgress.RemoveChangeListener(OnChanged_RepairProgress);
         m_CurrentAnvil.InputItemReadyForRepair.RemoveChangeListener(OnChanged_InputItemIsReadyForRepair);
         m_CurrentAnvil = null;
     }
 }
Exemplo n.º 7
0
    void Awake()
    {
        // set counters
        onClickAnvil  = 1;
        onClickTrain  = 1;
        onClickElders = 1;

        // get scripts
        anvilScript = anvilGO.GetComponent <Anvil>();
        trainScript = trainGO.GetComponent <Train>();
        elderScript = elderGO.GetComponent <ElderLeft>();
    }
Exemplo n.º 8
0
        static void Main(string[] args)
        {
            if (args.Length != 2)
            {
                Console.WriteLine("Usage: MC2UE <world-directory> <output>");
                return;
            }

            Anvil anvil = new Anvil(args[0]);

            Console.WriteLine("Defining new chunk boundaries.");
            //MapPartitioner mapPartitioner = new MapPartitioner(args[1]);
            //foreach (KeyValuePair<CoordinateInt, Block> pair in anvil.blocks)
            //    mapPartitioner.Add(pair.Key, pair.Value);
            //foreach (KeyValuePair<string, Dictionary<CoordinateInt, Block>> pair in mapPartitioner)
            //    ProcessBlocks(pair.Key, pair.Value);
            ProcessBlocks(args[1], anvil.blocks);
        }
Exemplo n.º 9
0
    private void GenerateDetails()
    {
        List <Vec2i> freeAreas = new List <Vec2i>(100);
        int          areaSize  = 2;

        int boundry     = 2 * World.ChunkSize;
        int areaMapSize = (TileSize - 2 * boundry) / areaSize;

        for (int x = boundry; x < TileSize - boundry; x += areaSize)
        {
            for (int z = boundry; z < TileSize - boundry; z += areaSize)
            {
                int areaX = (x - boundry) / areaSize;
                int areaZ = (z - boundry) / areaSize;

                bool isFree = true;
                for (int i = 0; i < areaSize; i++)
                {
                    for (int j = 0; j < areaSize; j++)
                    {
                        if (GetTile(x + i, z + j) != 0)
                        {
                            isFree = false;
                        }
                    }
                }
                if (isFree)
                {
                    freeAreas.Add(new Vec2i(x, z));
                }
            }
        }

        for (int i = 0; i < 20; i++)
        {
            Vec2i pos = GenerationRandom.RandomFromList(freeAreas);
            freeAreas.Remove(pos);
            Anvil anvil = new Anvil();
            anvil.SetPosition(pos);
            AddObject(anvil);
        }
    }
Exemplo n.º 10
0
        public LargeForgeHouse(Mobile owner) : base(owner)
        {
            Item i;

            i        = new Forge();
            i.ItemID = 0x197A;
            AddAddon(i, 3, 3, 7);

            i        = new Forge();
            i.ItemID = 0x197E;
            AddAddon(i, 4, 3, 7);

            i        = new Forge();
            i.ItemID = 0x1982;
            AddAddon(i, 5, 3, 7);

            i        = new Anvil();
            i.ItemID = 0xFB0;
            AddAddon(i, 4, 1, 7);
        }
Exemplo n.º 11
0
    void Start()
    {
        add(Item_Categories.Logs, (int)Logs.PineLogs, 2);
        add(Item_Categories.Ores, (int)Ores.TinOre, 6);
        add(Item_Categories.Ores, (int)Ores.CopperOre, 6);

        Furnace f = gameObject.AddComponent <Furnace>();

        f.SmeltBronze(this, buinput);

        Anvil a = gameObject.AddComponent <Anvil>();

        Debug.Log("!");
        a.SmithSpears(this, uinput, Macallen12.Bronze);

        int i = 1;

        foreach (Slot s in inventory)
        {
            Debug.Log(i + "|" + s.cat + "|" + s.itm + "|" + s.quant);
            i++;
        }
    }
Exemplo n.º 12
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);
    }
Exemplo n.º 13
0
        private bool Try_OpenAnvil(Anvil anvil)
        {
            if (InventoryController.Instance.IsClosed)
            {
                bool hasOpened = InventoryController.Instance.SetState.Try(ET.InventoryState.Anvil);

                if (hasOpened)
                {
                    m_CurrentAnvil = anvil;
                    m_InputContainer.Setup(anvil.InputHolder);
                    m_ResultContainer.Setup(anvil.ResultHolder);

                    m_CurrentAnvil.RepairProgress.AddChangeListener(OnChanged_RepairProgress);
                    m_CurrentAnvil.InputItemReadyForRepair.AddChangeListener(OnChanged_InputItemIsReadyForRepair);

                    m_ProgressBar.fillAmount = m_CurrentAnvil.RepairProgress.Get();

                    return(true);
                }
            }

            return(false);
        }
Exemplo n.º 14
0
 // Start is called before the first frame update
 void Start()
 {
     instance       = this;
     rb             = GetComponent <Rigidbody2D>();
     rb.isKinematic = true;
 }
Exemplo n.º 15
0
    public void ButtonCraft()
    {
        Furnace fn = gameObject.AddComponent <Furnace>();
        Anvil   sm = gameObject.AddComponent <Anvil>();


        switch (craftMe)
        {
        //Bars
        case Bourbon.BronzeBar:
            fn.SmeltBronze(PlayerInventory, 1);
            Debug.Log("!");
            break;

        case Bourbon.IronBar:
            fn.SmeltIron(PlayerInventory, 1);
            break;

        case Bourbon.MithrilBar:
            fn.SmeltMithril(PlayerInventory, 1);
            break;

        //Bronze Items (Spear, Hatch, Hamm, Club)
        case Bourbon.BronzeSpear:
            sm.SmithSpears(PlayerInventory, 1, Macallen12.Bronze);
            break;

        case Bourbon.BronzeHatchet:
            sm.SmithHatchets(PlayerInventory, 1, Macallen12.Bronze);
            break;

        case Bourbon.BronzeHammer:
            sm.SmithHammers(PlayerInventory, 1, Macallen12.Bronze);
            break;

        case Bourbon.BronzeClub:
            sm.SmithHammers(PlayerInventory, 1, Macallen12.Bronze);
            break;

        //Iron Items
        case Bourbon.IronSpear:
            sm.SmithSpears(PlayerInventory, 1, Macallen12.Iron);
            break;

        case Bourbon.IronHatchet:
            sm.SmithHammers(PlayerInventory, 1, Macallen12.Iron);
            break;

        case Bourbon.IronHammer:
            sm.SmithHammers(PlayerInventory, 1, Macallen12.Iron);
            break;

        case Bourbon.IronClub:
            sm.SmithClubs(PlayerInventory, 1, Macallen12.Iron);
            break;

        //Mith Items
        case Bourbon.MithrilSpear:
            sm.SmithSpears(PlayerInventory, 1, Macallen12.Mithril);
            break;

        case Bourbon.MithrilHatchet:
            sm.SmithHammers(PlayerInventory, 1, Macallen12.Mithril);
            break;

        case Bourbon.MithrilHammer:
            sm.SmithHammers(PlayerInventory, 1, Macallen12.Mithril);
            break;

        case Bourbon.MithrilClub:
            sm.SmithHammers(PlayerInventory, 1, Macallen12.Mithril);
            break;



        default:
            Debug.Log("!");
            break;
        }
    }