public ActionResult ViewItems()
        {
            ActionResult oResponse = null;

            if (Session["Username"] == null) //Guest
            {
                oResponse = RedirectToAction("Index", "Home");
            }
            else //Everyone else
            {
                //Creating a new instance of VM
                ItemVM newVM = new ItemVM();
                try
                {
                    //Call for method from DAL and set to variable
                    List <IItemDO> itemInfo = ItemAccess.ViewAllItems();
                    //Call mapping and assign in variable
                    newVM.ItemList = ItemMap.MapDOtoPO(itemInfo);
                    //return view
                    oResponse = View(newVM);
                }
                catch (Exception e)
                {
                    newVM.ErrorMessage = "Sorry, We couldn't obtain the list of items avaliable";
                    ErrorLog.LogError(e);
                    oResponse = View(newVM);
                }
                finally
                {
                    //Onshore standards
                }
            }

            return(oResponse);
        }
Beispiel #2
0
        private static void _GenerateDeps(VersionControlServer vcs, ItemMap deps, IntList intTreap)
        {
            /* walk through the changeset list. */
            for (IntList.iterator it = intTreap.begin();
                 it != intTreap.end();
                 ++it)
            {
                /* grab the changeset. */
                Changeset cs = vcs.GetChangeset(it.item());

                foreach (Change cng in cs.Changes)
                {
                    /* now dump each item in the changeset into the dependency list. */
                    ItemMap.iterator imit = deps.find(cng.Item);
                    if (imit == deps.end())
                    {
                        /* new one. */
                        IntList changesetlist = new IntList();
                        changesetlist.insert(cs.ChangesetId);
                        deps.insert(cng.Item, changesetlist);
                    }
                    else
                    {
                        /* hey, it already exists, so find it and dump the changeset in there. */
                        IntList.iterator csit = imit.value().find(cs.ChangesetId);
                        if (csit == imit.value().end())
                        {
                            imit.value().insert(cs.ChangesetId);
                        }
                    }
                }
            }
        }
 void OnDestroy()
 {
     if (actor && inventory)
     {
         ItemMap.UnregisterInventory(inventory, actor.Position);
     }
 }
Beispiel #4
0
        public ActionResult GetItemById(string ItemCode)
        {
            var      item     = _ItemInfoService.All().ToList().FirstOrDefault(x => x.ItemCode == ItemCode);
            ItemInfo _objitem = new ItemInfo();

            _objitem = item;
            //_objitem.ItemCode = item.ItemCode;
            //_objitem.ItemName = item.ItemName;
            //_objitem.ItemType = item.ItemType;
            //_objitem.UnitCode = item.UnitCode;
            //_objitem.RetailPrice = item.RetailPrice;
            //_objitem.DetUnitCode = item.UnitCode;
            //_objitem.PartNo = item.PartNo;
            //_objitem.Price = item.Price;
            //_objitem.Ratio = item.Ratio;
            //_objitem.PackSize = item.PackSize;
            //_objitem.PackItemCode = item.PackItemCode;
            //_objitem.AltItemCode = item.AltItemCode;
            //_objitem.Prod_Ser = item.Prod_Ser;
            //_objitem.HSCode = item.HSCode;
            //_objitem.ROLevel = item.ROLevel;

            HttpResponseMessage response = GlobalVariabls.WebApiClient.GetAsync("ItemMaps?ItemCode=" + item.ItemCode.ToString()).Result;
            ItemMap             itemM    = response.Content.ReadAsAsync <ItemMap>().Result;

            _objitem.Id        = itemM.Id;
            _objitem.GroupID   = itemM.GroupID;
            _objitem.SGroupID  = itemM.SGroupID;
            _objitem.SSGroupID = itemM.SSGroupID;

            return(Json(_objitem, JsonRequestBehavior.AllowGet));
        }
Beispiel #5
0
        /// <summary>
        /// print dependencies.
        /// </summary>
        /// <param name="wr">place to pretty-print them to</param>
        /// <param name="deps">the map of item->changeset list</param>
        /// <param name="keyChangesets">the changeset->item map for the changesets we are interested in</param>
        private static void _PrintDeps(System.IO.TextWriter wr, ItemMap deps, CSItemMap keyChangesets)
        {
            /* print out only our changesets,
             * details:
             *  the dependices they have on other changesets,
             *  what file is the dependency.
             */

            for (CSItemMap.iterator it = keyChangesets.begin();
                 it != keyChangesets.end();
                 ++it)
            {
                wr.WriteLine("changeset {0}", it.item());

                foreach (Item item in it.value())
                {
                    ItemMap.iterator imit = deps.find(item);
                    if (imit != deps.end())
                    {
                        if (imit.value().size() > 1)
                        {
                            wr.WriteLine(imit.item().ServerItem);
                            foreach (int csID in imit.value())
                            {
                                wr.WriteLine(csID);
                            }
                            wr.WriteLine();
                        }
                    }
                }

                wr.WriteLine();
            }
        }
        void Start()
        {
            myRenderer = GetComponent <MeshRenderer>();
            actor      = GetComponent <GridActor>();
            inventory  = GetComponent <InventoryComponent>();
            if (actor && inventory)
            {
                inventoryObserver = new SimpleObserver <InventoryUpdateEvent>(inventory, (update) =>
                {
                    if (update.Type == InventoryUpdateEvent.UpdateType.Added)
                    {
                        OnItemAdded();
                    }
                    else if (update.Type == InventoryUpdateEvent.UpdateType.Removed)
                    {
                        OnItemRemoved();
                    }
                });
                ItemMap.RegisterInventory(inventory, actor.Position);
                transform.position = actor.Position + new Vector3(.25f, -.25f, .25f);


                Item mainItem = inventory.GetMostCommonItem();
                visualizer = GetComponent <BlockVisualizer>();
                visualizer.RenderBlock(mainItem.GetTexturePosition());
            }
            cameraObserver = new SimpleObserver <CameraController>(Camera.main.GetComponent <CameraController>(), (c) =>
            {
                if (this.myRenderer && actor)
                {
                    this.myRenderer.enabled = c.PositionShouldBeVisible(actor.Position);
                }
            });
        }
Beispiel #7
0
        private void PopulateItems(IEnumerable oldSource, IEnumerable newSource)
        {
            if (oldSource != null)
            {
                ItemMap.Clear();
                ItemMap = null;

                if (oldSource is INotifyCollectionChanged)
                {
                    var incc = oldSource as INotifyCollectionChanged;
                    incc.CollectionChanged -= OnItemsCollectionChanged;
                }
            }

            if (newSource != null)
            {
                if (newSource is INotifyCollectionChanged)
                {
                    var incc = newSource as INotifyCollectionChanged;
                    incc.CollectionChanged += OnItemsCollectionChanged;
                }
                ItemMap = new Dictionary <object, ViewItem>();
                foreach (var modelItem in newSource)
                {
                    PrepareContainer(modelItem);
                }
            }
        }
        public ActionResult ViewItemsByUserID(long UserID)
        {
            ActionResult oResponse = null;

            if (Session["Username"] == null) //Guest
            {
                oResponse = RedirectToAction("Index", "Home");
            }
            else //EVeryone else
            {
                ItemVM newVM = new ItemVM(); //creating new instance
                try
                {
                    //Uses method from DAL assigned to a variable
                    List <IItemDO> userItemInfo = UserAccess.ViewItemsbyUserID(UserID);
                    //Mapping assigned to a variable
                    newVM.ItemList = ItemMap.MapDOtoPO(userItemInfo);
                    //Return View
                    oResponse = View(newVM);
                }
                catch (Exception e)
                {
                    newVM.ErrorMessage = "Sorry we cannot process your request at this time";
                    ErrorLog.LogError(e);
                    oResponse = View(newVM);
                }
                finally
                {
                    //Onshore standards
                }
            }
            return(oResponse);
        }
Beispiel #9
0
        private void Tick(object state)
        {
            if (!Monitor.TryEnter(_tickSync))
            {
                return;
            }

            try
            {
                if (_frames.Count == 0)
                {
                    return;
                }

                var currentFrame = _frameTicker.GetCurrentFrame(this);
                if (currentFrame >= _frames.Count)
                {
                    return;
                }

                ItemMap map = new ItemMap(_frames[currentFrame].EntityId);

                ItemFrameBlockEntity blockEntity = _itemFrameBlockEntity;
                if (blockEntity != null)
                {
                    blockEntity.SetItem(map, 0);
                    _level.SetBlockEntity(blockEntity);
                }
            }
            finally
            {
                Monitor.Exit(_tickSync);
            }
        }
Beispiel #10
0
 protected virtual void OnLaserCooldown(PendingAttack pendingAttack)
 {
     if (ItemMap.IsSecondaryAmmunition(pendingAttack.LootId))
     {
         if (!CooldownManager.Instance.Exists(Character, CooldownTypes.SECONDARY_LASER_SHOT_COOLDOWN))
         {
             CombatManager.Instance.CreateAttackCombat(pendingAttack);
         }
         else
         {
             var cooldown = CooldownManager.Instance.Get(Character, CooldownTypes.SECONDARY_LASER_SHOT_COOLDOWN);
             cooldown.SetOnCompleteAction(() => CombatManager.Instance.CreateAttackCombat(pendingAttack));
         }
     }
     else
     {
         if (!CooldownManager.Instance.Exists(Character, CooldownTypes.LASER_SHOT_COOLDOWN))
         {
             CombatManager.Instance.CreateAttackCombat(pendingAttack);
         }
         else
         {
             var cooldown = CooldownManager.Instance.Get(Character, CooldownTypes.LASER_SHOT_COOLDOWN);
             cooldown.SetOnCompleteAction(() => CombatManager.Instance.CreateAttackCombat(pendingAttack));
         }
     }
 }
        private Task <Vector3Int> FindItem(Vector3Int origin, Type itemToFind)
        {
            // breadth first search for the itemtype
            HashSet <Vector3Int> failedPositions = new HashSet <Vector3Int>();
            Queue <Vector3Int>   testPositions   = new Queue <Vector3Int>();

            testPositions.Enqueue(origin);
            while (testPositions.Count > 0)
            {
                Vector3Int current = testPositions.Dequeue();
                failedPositions.Add(current);
                InventoryComponent[] inventories = ItemMap.GetInventories(current);
                foreach (InventoryComponent inventory in inventories)
                {
                    if (inventory.HasItem(itemToFind))
                    {
                        return(Task.FromResult(current));
                    }
                }

                foreach (Vector3Int delta in DeltaPositions.DeltaPositions3D)
                {
                    Vector3Int nextPos = current + delta;
                    if (Astar.IsStepValid(nextPos, current, delta) && !failedPositions.Contains(nextPos))
                    {
                        testPositions.Enqueue(nextPos);
                    }
                }
            }
            return(null);
        }
Beispiel #12
0
    public ItemMap GetItemMap()
    {
        ItemMap newMap = new ItemMap();

        registeredItems.CopyTo(newMap);
        return(newMap);
    }
 private void OnEnable()
 {
     database        = (ItemDatabase)target;
     registeredItems = database.GetItemMap();
     nameMap         = database.GetNameMap();
     missingItems    = database.GetMissingMap();
 }
Beispiel #14
0
        internal override void Reload(RecyclerViewObservableAdapterBase adapter)
        {
            ItemsMap.Clear();
            ItemsMap.Add(ItemMap.CreateForHeader());

            var sectionsCount = adapter.GetSectionsCount();

            for (var section = 0; section < sectionsCount; section++)
            {
                ItemsMap.Add(ItemMap.CreateForSectionHeader(null));

                var sectionItemsCount = adapter.GetSectionItemsCount(section);

                for (var row = 0; row < sectionItemsCount; row++)
                {
                    ItemsMap.Add(ItemMap.CreateForItem(adapter.GetItem(section, row)));
                }

                ItemsMap.Add(ItemMap.CreateForSectionFooter(null));
            }

            ItemsMap.Add(ItemMap.CreateForFooter());

            adapter.NotifyDataSetChanged();
        }
Beispiel #15
0
 public void AddToGameData(Item i)
 {
     if (Application.isEditor && !ItemExists(i.itemName))
     {
         itemData.Add(i);
         ItemMap.Add(i.itemName, i);
     }
 }
        public virtual void EjectAllOfType(Type type)
        {
            ItemMap.Remove(type);

            _workTracker.EjectAllOfType(type);

            ChangeTrackers.RemoveAll(x => x.Document.GetType().CanBeCastTo(type));
        }
Beispiel #17
0
        public override void UseItem(Level world, Player player, BlockCoordinates blockCoordinates)
        {
            MapEntity mapEntity = new MapEntity(world);
            mapEntity.SpawnEntity();

            // Initialize a new map and add it.
            ItemMap itemMap = new ItemMap(mapEntity.EntityId);
            player.Inventory.SetFirstEmptySlot(itemMap, true, false);
        }
Beispiel #18
0
    public void instantiateItem(Const.GameItemID id, Vector3 position)
    {
        Material   m1 = (Material)Resources.Load(ItemMap.getTextureName(id));
        GameObject g  = Instantiate(dirt);

        g.transform.parent   = transform;
        g.transform.position = position;
        g.name = id.ToString();
        g.GetComponent <Renderer>().material = m1;
    }
Beispiel #19
0
        public override void UseItem(Level world, Player player, BlockCoordinates blockCoordinates)
        {
            MapEntity mapEntity = new MapEntity(world);

            mapEntity.SpawnEntity();

            // Initialize a new map and add it.
            ItemMap itemMap = new ItemMap(mapEntity.EntityId);

            player.Inventory.SetFirstEmptySlot(itemMap, true);
        }
Beispiel #20
0
    public void Setup(ItemMap currentItem, MapListScrollview scroll)
    {
        Translator translator = Camera.main.GetComponent <Translator>();

        item                     = currentItem;
        nameLabel.text           = translator.translateMapName(item.itemName);
        originalName             = item.itemName;
        iconImage.sprite         = item.iconImage;
        scrollList               = scroll;
        iconImage.preserveAspect = true;
    }
Beispiel #21
0
    // Use this for initialization
    void Start()
    {
        Debug.Log("Script has been started");
        plane = GameObject.FindWithTag("WebcamDisplay");

        mCamera = new WebCamTexture();
        plane.GetComponent <Renderer>().material.mainTexture = mCamera;
        mCamera.Play();
        itemMap = new ItemMap();
        player  = GameObject.FindObjectOfType <Player>().gameObject;
    }
Beispiel #22
0
        public ActionResult SaveItem(ItemInfo item)
        {
            //if (ModelState.IsValid)
            //{
            using (var transaction = new TransactionScope())
            {
                try
                {
                    RBACUser rUser = new RBACUser(Session["UserName"].ToString());
                    if (!rUser.HasPermission("Item_Insert"))
                    {
                        return(Json("X", JsonRequestBehavior.AllowGet));
                    }
                    var items = _ItemInfoService.All().ToList().FirstOrDefault(x => x.ItemCode == item.ItemCode && x.ItemName == item.ItemName);
                    if (items == null)
                    {
                        _ItemInfoService.Add(item);
                        ItemMap iM = new ItemMap();
                        iM.ItemTypeCode = (int)item.ItemType;
                        iM.GroupID      = item.GroupID;
                        iM.SGroupID     = item.SGroupID;
                        iM.SSGroupID    = item.SSGroupID;
                        iM.ItemCode     = item.ItemCode;

                        var serializerSettings = new JsonSerializerSettings {
                            PreserveReferencesHandling = PreserveReferencesHandling.Objects
                        };
                        string json = JsonConvert.SerializeObject(iM, Formatting.Indented, serializerSettings);

                        HttpResponseMessage response = GlobalVariabls.WebApiClient.PostAsJsonAsync("ItemMaps/PostItemMap", iM).Result;
                        _ItemInfoService.Save();
                        TransactionLogService.SaveTransactionLog(_transactionLogService, "Item", "Save", item.ItemCode, Session["UserName"].ToString());

                        transaction.Complete();
                        return(Json("1", JsonRequestBehavior.AllowGet));
                    }
                    else
                    {
                        return(Json("Item already exists!!!", JsonRequestBehavior.AllowGet));
                    }
                }
                catch (Exception ex)
                {
                    transaction.Dispose();
                    return(Json("0", JsonRequestBehavior.AllowGet));
                }

                //}
                //else
                //{
                //    return Json("0", JsonRequestBehavior.AllowGet);
                //}
            }
        }
Beispiel #23
0
        public FullyLuminousItemFrame(MapEntity frame, ItemFrameBlockEntity itemFrameBlockEntity, Level level) : this()
        {
            ItemMap map = new ItemMap(frame.EntityId);

            ItemFrameBlockEntity blockEntity = itemFrameBlockEntity;

            if (blockEntity != null)
            {
                blockEntity.SetItem(map);
                level.SetBlockEntity(blockEntity);
            }
        }
Beispiel #24
0
 public override void Awake()
 {
     if (s_instance != null)
     {
         Destroy(this);
         return;
     }
     else
     {
         s_instance = this;
     }
     base.Awake();
 }
Beispiel #25
0
        void ReleaseDesignerOutlets()
        {
            if (ItemMap != null)
            {
                ItemMap.Dispose();
                ItemMap = null;
            }

            if (MapViewMyPlaces != null)
            {
                MapViewMyPlaces.Dispose();
                MapViewMyPlaces = null;
            }
        }
Beispiel #26
0
        /// <summary>
        /// 註冊功能
        /// </summary>
        public static void Register()
        {
            ItemMap itemMap = new ItemMap();

            itemMap
            .RegisterItem <TestItem1>("Item1", "測試")
            .RegisterItem <ImageFolder>("ImageItem", "看圖片")
            .RegisterItem <Download>("DownloadBtn", "下載頁")
            .RegisterItem <ImageFolder>("WatchComicBtn", "看漫畫")


            .RegisterItem <Setting>("SettingBtn", "設定")
            ;
        }
    public override void OnInspectorGUI()
    {
        if (GUILayout.Button("Update Database"))
        {
            database.UpdateDatabase();
            registeredItems = database.GetItemMap();
            nameMap         = database.GetNameMap();
            missingItems    = database.GetMissingMap();
        }

        base.OnInspectorGUI();

        DrawItems();
        DrawMissingItems();
    }
Beispiel #28
0
        public ActionResult GetAllByItemCode(string itemCode)
        {
            ItemInfo item = new ItemInfo();

            item = _ItemInfoService.All().ToList().FirstOrDefault(x => x.ItemCode == itemCode.Trim());
            HttpResponseMessage response = GlobalVariabls.WebApiClient.GetAsync("ItemMaps?ItemCode=" + item.ItemCode.ToString()).Result;
            ItemMap             itemM    = response.Content.ReadAsAsync <ItemMap>().Result;

            item.Id        = itemM.Id;
            item.GroupID   = itemM.GroupID;
            item.SGroupID  = itemM.SGroupID;
            item.SSGroupID = itemM.SSGroupID;

            return(Json(item, JsonRequestBehavior.AllowGet));
        }
 private void AddButtonList()
 {
     for (int i = 0; i < itemList.Count; i++)
     {
         GameObject newobj;
         newobj = (GameObject)Instantiate(buttonPrefab);
         newobj.transform.SetParent(contentPanel);
         newobj.transform.localScale = new Vector3(1f, 1f, 1f);
         newobj.name = "mapItem";
         //newobj.GetComponent<RectTransform>().sizeDelta = new Vector2(400,50);
         //Debug.Log(newobj.GetComponent<RectTransform>().sizeDelta);
         ItemMap item = itemList [i];
         MapItem map  = newobj.GetComponent <MapItem>();
         map.Setup(item, this);
     }
 }
Beispiel #30
0
 public int isAlive(Const.GameItemID newId, int newInstanceId, float attack = 1)
 {
     //Debug.Log(itemId.ToString() + " = " + live.ToString());
     if (newInstanceId != instanceId)
     {
         instanceId = newInstanceId;
         itemId     = newId;
         relive();
         //return -1;
     }
     else
     {
         live -= attack;
     }
     return(Mathf.CeilToInt(10f * live / ItemMap.getLive(newId)));
 }
Beispiel #31
0
        public void UpdateViewOfCoords(ScrollingConsole console, IEnumerable <Coord> coords)
        {
            //  Show the BG color of the terrain, then whatever comes first:
            //  The FG of any visible being at the location, or
            //  the FG of the topmost item at the loc'n, or
            //  the FG of the terrain type.
            //  Then (later, 0.5?) modified by lighting, et c.
            foreach (var position in coords.Where(c => console.ViewPort.Contains(c)))
            {
                var targetCell = new Cell();
                var rawCell    = SpaceMap.GetItem(position).Terrain.Cell;
                targetCell.Background = rawCell.Background;

                var beings = BeingMap.GetItems(position).ToList();
                var items  = ItemMap.GetItems(position).ToList();
                if (beings.Any())
                {
                    var being = beings.Last();
                    targetCell.Foreground = being.Foreground;
                    targetCell.Glyph      = being.Glyph;
                }
                else if (items.Any())
                {
                    var item = items.Last();
                    targetCell.Foreground = item.Foreground;
                    targetCell.Glyph      = item.Glyph;
                }
                else
                {
                    targetCell.Foreground = rawCell.Foreground;
                    targetCell.Glyph      = rawCell.Glyph;
                }

                console.SetCellAppearance(position.X, position.Y, targetCell);

                var  rot  = RotMap.GetItem(position);
                Fade fade = null;
                if (rot?.Health > 0)
                {
                    fade = GetFadeForRotExtent(rot.Health, rawCell.Background);
                }
                EffectsManager.SetEffect(console.Cells[position.Y * Width + position.X], fade);
            }
        }
    // Use this for initialization
    void Start()
    {
        Console.Instance.CommandSent += OnCommand;
        GameObject sceneMaster = GameObject.Find( "SceneMaster" );

        if( null == sceneMaster )
        {
            Debug.LogError( "Failed to find SceneMaster object" );
            return;
        }

        m_ItemMap = (ItemMap) sceneMaster.GetComponent<ItemMap>();

        if( null == m_ItemMap )
        {
            Debug.LogError( "Failed to find 'ItemMap' component on SceneMaster object" );
            return;
        }

        m_ToolsCategory = m_ItemMap.m_Categories.FindCategory( "Tools" );

        if( null == m_ToolsCategory )
        {
            Debug.LogError( "Failed to find 'Tools' category in ItemMap" );
            return;
        }

        ChangeTool( m_ItemMap.CreateItem( m_ToolsCategory, "Hand" ) );

        m_InternalIZ = this.gameObject.AddComponent<CapsuleCollider>();
        UpdateInternalIZ();
    }
Beispiel #33
0
        public static Item GetItem(short id, short metadata = 0, byte count = 1)
        {
            Item item = null;

            if (CustomItemFactory != null)
            {
                item = CustomItemFactory.GetItem(id, metadata, count);
            }

            if (item != null) return item;

            if (id == 0) item = new ItemAir();
            else if (id == 54) item = new ItemChest();
            else if (id == 44) item = new ItemSlab(id, metadata);
            else if (id == 61) item = new ItemFurnace();
            else if (id == 63) item = new ItemSign();
            else if (id == 68) item = new ItemSign();
            else if (id == 116) item = new ItemEnchantingTable();
            else if (id == 158) item = new ItemSlab(id, metadata);
            else if (id == 199) item = new ItemItemFrame();
            else if (id == 256) item = new ItemIronShovel();
            else if (id == 257) item = new ItemIronPickaxe();
            else if (id == 258) item = new ItemIronAxe();
            else if (id == 259) item = new ItemFlintAndSteel();
            else if (id == 260) item = new ItemApple();
            else if (id == 261) item = new ItemBow();
            else if (id == 262) item = new ItemArrow();
            else if (id == 263) item = new ItemCoal();
            else if (id == 267) item = new ItemIronSword();
            else if (id == 268) item = new ItemWoodenSword();
            else if (id == 269) item = new ItemWoodenShovel();
            else if (id == 270) item = new ItemWoodenPickaxe();
            else if (id == 271) item = new ItemWoodenAxe();
            else if (id == 272) item = new ItemStoneSword();
            else if (id == 273) item = new ItemStoneShovel();
            else if (id == 274) item = new ItemStonePickaxe();
            else if (id == 275) item = new ItemStoneAxe();
            else if (id == 276) item = new ItemDiamondSword();
            else if (id == 277) item = new ItemDiamondShovel();
            else if (id == 278) item = new ItemDiamondPickaxe();
            else if (id == 279) item = new ItemDiamondAxe();
            else if (id == 280) item = new ItemStick();
            else if (id == 283) item = new ItemGoldSword();
            else if (id == 284) item = new ItemGoldShovel();
            else if (id == 285) item = new ItemGoldPickaxe();
            else if (id == 286) item = new ItemGoldAxe();
            else if (id == 290) item = new ItemWoodenHoe();
            else if (id == 291) item = new ItemStoneHoe();
            else if (id == 292) item = new ItemIronHoe();
            else if (id == 293) item = new ItemDiamondHoe();
            else if (id == 294) item = new ItemGoldHoe();
            else if (id == 297) item = new ItemBread();
            else if (id == 298) item = new ItemLeatherHelmet();
            else if (id == 299) item = new ItemLeatherChestplate();
            else if (id == 300) item = new ItemLeatherLeggings();
            else if (id == 301) item = new ItemLeatherBoots();
            else if (id == 302) item = new ItemChainmailHelmet();
            else if (id == 303) item = new ItemChainmailChestplate();
            else if (id == 304) item = new ItemChainmailLeggings();
            else if (id == 305) item = new ItemChainmailBoots();
            else if (id == 309) item = new ItemIronBoots();
            else if (id == 308) item = new ItemIronLeggings();
            else if (id == 307) item = new ItemIronChestplate();
            else if (id == 306) item = new ItemIronHelmet();
            else if (id == 310) item = new ItemDiamondHelmet();
            else if (id == 311) item = new ItemDiamondChestplate();
            else if (id == 312) item = new ItemDiamondLeggings();
            else if (id == 313) item = new ItemDiamondBoots();
            else if (id == 314) item = new ItemGoldHelmet();
            else if (id == 315) item = new ItemGoldChestplate();
            else if (id == 316) item = new ItemGoldLeggings();
            else if (id == 317) item = new ItemGoldBoots();
            else if (id == 319) item = new ItemRawPorkchop();
            else if (id == 320) item = new ItemCookedPorkshop();
            else if (id == 322) item = new ItemGoldenApple();
            else if (id == 323) item = new ItemSign();
            else if (id == 324) item = new ItemDoor();
            else if (id == 325) item = new ItemBucket(metadata);
            else if (id == 332) item = new ItemSnowball();
            else if (id == 344) item = new ItemEgg();
            else if (id == 345) item = new ItemCompass();
            else if (id == 355) item = new ItemBed();
            else if (id == 357) item = new ItemCookie();
            else if (id == 358) item = new ItemMap();
            else if (id == 360) item = new ItemMelonSlice();
            else if (id == 363) item = new ItemRawBeef();
            else if (id == 364) item = new ItemSteak();
            else if (id == 365) item = new ItemRawChicken();
            else if (id == 366) item = new ItemCoockedChicken();
            else if (id == 373) item = new ItemPotion(metadata);
            else if (id == 383) item = new ItemSpawnEgg(metadata);
            else if (id == 391) item = new ItemCarrot();
            else if (id == 392) item = new ItemPotato();
            else if (id == 393) item = new ItemBakedPotato();
            else if (id == 395) item = new ItemEmptyMap();
            else if (id == 397) item = new ItemMobHead(metadata);
            else if (id == 400) item = new ItemPumpkinPie();
            else if (id <= 255)
            {
                Block block = BlockFactory.GetBlockById((byte) id);
                if (CustomBlockItemFactory == null)
                {
                    item = new ItemBlock(block, metadata);
                }
                else
                {
                    item = CustomBlockItemFactory.GetBlockItem(block, metadata, count);
                }
            }
            else item = new Item(id, metadata, count);

            // This might now be a good idea if the constructor changes these
            // properties for custom items.
            item.Metadata = metadata;
            item.Count = count;

            return item;
        }
Beispiel #34
0
        private void Tick(object state)
        {
            if (!Monitor.TryEnter(_tickSync)) return;

            try
            {
                if (_frames.Count == 0) return;

                var currentFrame = _frameTicker.GetCurrentFrame(this);
                if (currentFrame >= _frames.Count) return;

                ItemMap map = new ItemMap(_frames[currentFrame].EntityId);

                ItemFrameBlockEntity blockEntity = _itemFrameBlockEntity;
                if (blockEntity != null)
                {
                    blockEntity.SetItem(map);
                    _level.SetBlockEntity(blockEntity);
                }
            }
            finally
            {
                Monitor.Exit(_tickSync);
            }
        }