Beispiel #1
0
    public void OnBeginDrag(PointerEventData eventData)
    {
        itemBeingDraggedType = gameObject.GetComponent<ItemType>().itemType;
        itemBeingDragged = gameObject;

        Socket socket = itemBeingDragged.GetComponentInParent<Socket>();

        Item i = itemBeingDragged.GetComponent<Item>();
        if ( i != null ){
            i.turnOffPower();
            i.equipped = false;
        }

        startPosition = gameObject.transform.position;
        startParent = gameObject.transform.parent;
        gameObject.GetComponent<CanvasGroup>().blocksRaycasts = false;
        gameObject.transform.SetParent(_Hover.transform);

        // on picking up the item, trigger a circuit change
        if ( socket != null && socket.parentCircuit != null ){
            //Debug.Log (DateTime.Now.ToString("ssffff") + " IBeginDragHandler");
            if ( itemBeingDragged.GetComponent<ItemType>().itemType != ItemTypes.PowerUnit ){
                socket.parentCircuit.circuitChange();
            }
        }
    }
Beispiel #2
0
 /// <summary>
 /// Overloaded Constructor, defines item based on ItemType
 /// </summary>
 /// <param name="itemType"></param>
 public Item(ItemTypes itemType)
 {
     switch (itemType)
     {
         case ItemTypes.KEYCARD001:
             _type = itemType;
             _name = "Key Card";
             _description = "This card belongs to Staff member John White";
             _size = 1;
             _isStackable = false;
             _quantity = 1;
             _isVisibleOutsideInventory = false;
             break;
         case ItemTypes.SODACAN:
             _type = itemType;
             _name = "Soda Can";
             _description = "An empty Pipsi can.";
             _size = 3;
             _isStackable = false;
             _quantity = 1;
             _isVisibleOutsideInventory = true;
             break;
         default:
             _type = ItemTypes.GENERIC;
             _name = "A very Generic, thing...";
             _description = "It's so Generic I can't describe it.";
             _size = 0;
             _isStackable = true;
             _quantity = 1;
             _isVisibleOutsideInventory = true;
             break;
     }
 }
Beispiel #3
0
 public SelectionInfo(int selectedLayer, int selectedPlatform, ItemTypes visibleTypes, ItemTypes editedTypes)
 {
     this.selectedLayer = selectedLayer;
     this.selectedPlatform = selectedPlatform;
     this.visibleTypes = visibleTypes;
     this.editedTypes = editedTypes;
 }
        public static StackPanel CreateHeader(string title, ItemTypes type)
        {
            StackPanel panel = new StackPanel();
            panel.Orientation = Orientation.Horizontal;

            Label lbl = new Label();
            lbl.Content = title;

            Image img = new Image();

            switch (type)
            {
                case ItemTypes.TestCase:
                    img.Source = ImageHelpers.GetImageSource(Properties.Resources.TestCase);
                    break;
                case ItemTypes.TestSuite:
                    img.Source = ImageHelpers.GetImageSource(Properties.Resources.Suite);
                    break;
                case ItemTypes.TestPlan:
                    img.Source = ImageHelpers.GetImageSource(Properties.Resources.Plan);
                    break;
                case ItemTypes.TeamProject:
                    img.Source = ImageHelpers.GetImageSource(Properties.Resources.TeamProject);
                    break;
            }
            panel.Children.Add(img);
            panel.Children.Add(lbl);
            return panel;
        }
        public AdvancedSendSingleToWindow(int gameIndex, int max, string title, object sendType, bool withdrawMode, GameTypeFlags exclusives)
        {
            InitializeComponent();
            this.loaded = false;
            this.realMax = max;
            this.Title = title;
            this.max = 1;
            this.sendAll = false;
            this.itemType = (sendType is ItemTypes ? (ItemTypes)sendType : ItemTypes.Unknown);
            this.isDecoration = false;
            this.pocket = this.itemType;
            this.withdrawMode = withdrawMode;

            if (sendType is DecorationTypes) {
                this.comboBoxPockets.Items.Add(ItemDatabase.GetDecorationContainerName((DecorationTypes)sendType));
                this.comboBoxPockets.SelectedIndex = 0;
                this.comboBoxPockets.IsEnabled = false;
                this.isDecoration = true;
            }
            this.numericMax.Maximum = max;

            for (int i = -1; i < PokeManager.NumGameSaves; i++) {
                if (withdrawMode) {
                    if (i != gameIndex) {
                        comboBoxGames.SetGameSaveVisible(i, false);
                        continue;
                    }
                }
                else {
                    if (i == gameIndex) {
                        comboBoxGames.SetGameSaveVisible(i, false);
                        continue;
                    }
                    IGameSave gameSave = PokeManager.GetGameSaveAt(i);
                    if (!this.isDecoration && gameSave.GameType != GameTypes.Any && !exclusives.HasFlag((GameTypeFlags)(1 << ((int)gameSave.GameType - 1))))
                        comboBoxGames.SetGameSaveVisible(i, false);
                    else if (gameSave.GameType == GameTypes.PokemonBox || (this.isDecoration && gameSave.Inventory.Decorations == null))
                        comboBoxGames.SetGameSaveVisible(i, false);
                }
            }

            if (withdrawMode) {
                this.gameIndex = gameIndex;
                comboBoxGames.SelectedGameIndex = gameIndex;
                comboBoxGames.IsEnabled = false;
                comboBoxPockets.IsEnabled = false;
            }
            else {
                this.gameIndex = PokeManager.LastGameInDialogIndex;
                if (this.gameIndex == -2 || !comboBoxGames.IsGameSaveVisible(this.gameIndex))
                    this.gameIndex = comboBoxGames.SelectedGameIndex;
                else
                    comboBoxGames.SelectedGameIndex = this.gameIndex;
            }

            this.loaded = true;

            OnGameChanged(null, null);
        }
Beispiel #6
0
 public static string ItemDescription(ItemTypes type)
 {
     switch(type){
     case ItemTypes.Pokeball:	return "A device for catching wild Pokemon. It's thrown like a ball at a Pokemon, comfortably encapsulating its target.";
     case ItemTypes.Potion:		return "A spray-type medicine for treating wounds. It can be used to restore a small amount of HP to an injured Pokemon.";
     }
     return "";
 }
Beispiel #7
0
 ///<summary>
 ///constructor for composite goal GetItem
 ///</summary>
 ///<param name="bot">bot entity that owns this goal</param>
 ///<param name="itemToGet">item to get</param>
 public GetItem(BotEntity bot, ItemTypes itemToGet)
     : base(bot, ItemTypeToGoalType(itemToGet))
 {
     _itemToGet = itemToGet;
     _giverTrigger = null;
     _logItemToGetText =
         String.Format(" Item: [{0,-12}]",
                       EnumUtil.GetDescription(_itemToGet));
 }
		protected void Page_Load(object sender, EventArgs e)
		{
			sessionObject = (SessionObject)Session["SessionObject"];

			if (Request.QueryString["xID"] == null)
			{
				SessionObject.RedirectMessage = "No item type provided in URL.";
				Response.Redirect("~/PortalSelection.aspx", true);
			}
			else
			{
                itemType = (ItemTypes)Enum.Parse(typeof(ItemTypes), (String)Request.QueryString["xID"], true);
                switch (itemType)
				{
                    case ItemTypes.Addendum:
                        inpItemType.Value = itemType.ToString();
                        break;
                    case ItemTypes.Image:
                        inpItemType.Value = itemType.ToString();
                        break;
                    case ItemTypes.Item:
                        inpItemType.Value = itemType.ToString();
                        break;
                    case ItemTypes.Rubric:
                        inpItemType.Value = itemType.ToString();
                        break;
					case ItemTypes.RubricAnalytical:
                        inpItemType.Value = itemType.ToString();
						this.Title = "Analytical Rubric Identification";
						break;

					case ItemTypes.RubricHolistic:
                        inpItemType.Value = itemType.ToString();
						this.Title = "Custom Holistic Rubric Identification";
						break;

					default:
                        this.Title = itemType.ToString() + " Identification";
						break;
				}

				if (!IsPostBack)
				{
					SetControlVisibility();
					LoadGrades();
					LoadCourses();
					LoadItemBanks();
					LoadQuestionTypes();
					LoadAddendumTypes();
					LoadPassThruParms();
				}

				ScriptManager.RegisterStartupScript(this, typeof(string), "appClient", "var appClient = '" + AppClient() + "';", true);

			}
		}
Beispiel #9
0
 /// <summary>
 /// Default Item Constructor, assumes GENERIC ItemType
 /// </summary>
 public Item()
 {
     _type = ItemTypes.GENERIC;
     _name = "A very Generic, thing...";
     _description = "It's so Generic I can't describe it.";
     _size = 0;
     _isStackable = true;
     _quantity = 1;
     _isVisibleOutsideInventory = true;
 }
Beispiel #10
0
 public Item(string name, World world, Vector2 worldIndex, IUseStrategy useStrategy, IGetStrategy getStrategy, IGiveStrategy giveStrategy, ItemCategories itemCategory, ItemTypes itemType)
 {
     Name = name;
     _world = world;
     WorldIndex = worldIndex;
     _useStrategy = useStrategy;
     _getStrategy = getStrategy;
     _giveStrategy = giveStrategy;
     ItemCategory = itemCategory;
     ItemType = itemType;
 }
Beispiel #11
0
 public Item(ItemTypes itemType, Vector2 position, float scale)
 {
     switch (itemType)
     {
         case ItemTypes.Yellow:
             texture = Content.Load<Texture2D>("banana");
             break;
     }
     this.position = position;
     this.scale = scale;
 }
        public int findRandom(ItemTypes typeToFind)
        {
            int[] possibles = findAll (typeToFind, 0);

            int listSize = possibles.Length;
            if (listSize < 1)
                return -1;
            else {
                return UnityEngine.Random.Range (0, listSize);
            }
        }
        public int findItem(ItemTypes typeToFind, int startingIndex)
        {
            if (startingIndex < 0)
                startingIndex = 0;

            for (int i = startingIndex; i < library.Length; i+=1) {
                if (library [i].type == typeToFind)
                    return i;
            }
            return -1;
        }
Beispiel #14
0
 private Item()
 {
     Item.draw = false;
     Item.screenHeight = 0f;
     Item.screenWidth = 0f;
     Item.stopWatch = null;
     Item.timeCounter = 0;
     Item.timer = 0;
     Item.timeInterval = 0;
     Item.itemType = 0;
     Item.position = new Vector2();
 }
 public int GetItemFee(ItemTypes itemtype)
 {
     switch (itemtype)
     {
         case ItemTypes.Auction:
             return (int)ItemTypes.Auction;
         case ItemTypes.BuyItNow:
             return (int)ItemTypes.BuyItNow;
         default:
             throw new KeyNotFoundException(ErrorMessage(typeof(ItemTypes).Name));
     }
 }
Beispiel #16
0
        public Item(ItemTypes itemType)
        {
            _itemType = itemType;

            if (ItemTypes.SmallKey == itemType)
            {
                Name = "Kleiner~Schluessel";
            }

            if (ItemTypes.MasterKey == itemType)
            {
                Name = "Riesenschluessel";
            }
        }
Beispiel #17
0
    public Item CreateItem(int x, int y, ItemTypes type)
    {
        Transform parent = this.container.Find("Entities/Items");

        GameObject obj = GameObject.Instantiate(prefabs.items[type]);
        obj.transform.SetParent(parent, false);
        obj.name = type.ToString(); //"Item";
        Item item = obj.GetComponent<Item>();
        item.Init(this, x, y, Color.white);

        item.type = type;

        return item;
    }
 static void ListJobItems(TranslationJobStatus jobStatus, ItemTypes type)
 {
     Console.WriteLine("List items of types " + type.ToString());
     IEnumerable<TranslationItemInfo> items = jobStatus.GetItems(type);
     cc.ExecuteQuery();
     foreach (TranslationItemInfo item in items)
     {
         Console.WriteLine("TranslationId: " + item.TranslationId + "; Succeeded: " + item.Succeeded + "\n" +
                           "InputFile: " + item.InputFile + "; OutputFile: " + item.OutputFile + "\n" +
                           "Canceled: " + item.Canceled + "; Failed: " + item.Failed + "\n" +
                           "InProgress: " + item.InProgress + "; NotStarted: " + item.NotStarted + "\n" +
                           "; ErrorMessage " + item.ErrorMessage);
     }
 }
Beispiel #19
0
        public Board(Point mapSize, Point centerPoint, MultiBoard parent, ContextMenuStrip menu, ItemTypes visibleTypes, ItemTypes editedTypes)
        {
            this.uid = Interlocked.Increment(ref uidCounter);
            this.MapSize = mapSize;
            this.centerPoint = centerPoint;
            this.parent = parent;
            this.visibleTypes = visibleTypes;
            this.editedTypes = editedTypes;
            this.menu = menu;

            boardItems = new BoardItemsManager(this);
            undoRedoMan = new UndoRedoManager(this);
            mouse = new Mouse(this);
            serMan = new SerializationManager(this);
        }
        public int[] findAll(ItemTypes typeToFind, int startingIndex)
        {
            List<int> itemList = new List<int>();
            int foundItem = -1;
            int nextIndex = startingIndex;

            while(nextIndex < library.Length) {
                foundItem = findItem(typeToFind, nextIndex);
                if(foundItem > -1) {
                    itemList.Add(foundItem);
                    nextIndex = foundItem+1;
                }
                else nextIndex += 1;
            }

            return itemList.ToArray ();
        }
Beispiel #21
0
        /// <summary>
        /// Default constructor, sets values based on type of item
        /// </summary>
        /// <param name="type">Type of item</param>
        /// <param name="quanity"></param>
        public Item(ItemTypes type, int quanity)
        {
            switch (type)
            {
                case ItemTypes.Flashlight:
                    _name = "Flashlight";
                    _description = "It shines a light on things";
                    _itemType = type;
                    _visibleInsideInventory = true;
                    _quantity = quanity;
                    break;

                case ItemTypes.Handgun:
                    _name = "Handgun";
                    _description = "Classic Handgun, very reliable";
                    _itemType = type;
                    _visibleInsideInventory = true;
                    _quantity = quanity;
                    break;

                case ItemTypes.Bandage:
                    _name = "Bandage";
                    _description = "Helps Patch you up";
                    _itemType = type;
                    _visibleInsideInventory = false;
                    _quantity = quanity;
                    break;

                case ItemTypes.Bullet:
                    _name = "Bullet";
                    _description = "Guns shoot these";
                    _itemType = type;
                    _visibleInsideInventory = false;
                    _quantity = quanity;
                    break;

                default:
                    _name = "Generic Cube";
                    _description = "Its generic, almost too generic. How did you get this?";
                    _itemType = type;
                    _visibleInsideInventory = true;
                    _quantity = quanity;
                    break;

            }
        }
Beispiel #22
0
        public void createFromItem(InventoryItem keyItem, ItemLibrary items)
        {
            //this fills the "item" variable in this part
            item = new InventoryItem ();
            item.setInvItem (keyItem.id, keyItem.quantity);

            nodes = items.getItemAttachments (keyItem.id);
            baseStats = items.getItemStats (keyItem.id);

            currentPower = 0.0f;
            currentHealth = baseStats.stability;
            powerIn = 0.0f; //we will take this if needed
            powerOut = 0.0f; //we will put power here if we have extra
            type = items.getItemType (keyItem.id);

            Debug.Log ("LLLAAAMMAAASS");
        }
Beispiel #23
0
 public ItemData(DataRow row, Generations gen)
 {
     this.id				= (ushort)(long)row["ID"];
     this.name			= row["Name"] as string;
     this.description	= row["Description"] as string;
     this.pocketType		= ItemData.GetPocketTypeFromString(row["Pocket"] as string);
     this.subPocketType	= (row["SubPocket"] is DBNull ? this.pocketType : ItemData.GetPocketTypeFromString(row["SubPocket"] as string));
     this.transferUpID	= 0; //(ushort)(long)row["TransferUpID"];
     this.order			= (row["Order"] is DBNull ? 0 : (int)(long)row["Order"]);
     this.price			= (uint)(long)row["Price"];
     this.sell			= (uint)(long)row["Sell"];
     this.coinsPrice		= (uint)(long)row["Coins"];
     this.bpPrice		= (uint)(long)row["BP"];
     this.pcPrice		= (uint)(long)row["PC"];
     this.sootPrice		= (uint)(long)row["Soot"];
     this.obtainable		= (bool)row["Obtainable"];
     this.important		= (bool)row["Important"];
     this.exclusives		= ItemData.GetExclusivesFromString(row["Exclusive"] as string, gen);
 }
Beispiel #24
0
        ///<summary>
        ///returns a value between 0 and 1 based on the bot's closeness to the 
        ///given item. the further the item, the higher the rating. If there is no
        ///item of the given type present in the game world at the time this method
        ///is called the value returned is 1
        ///</summary>
        public static float DistanceToItem(BotEntity bot, ItemTypes itemType)
        {
            //determine the distance to the closest instance of the item type
            float distanceToItem = bot.PathPlanner.GetCostToClosestItem(itemType);

            //if the previous method returns a negative value then there is no item of
            //the specified type present in the game world at this time.
            if (distanceToItem < 0)
                return 1;

            //these values represent cutoffs. Any distance over maxDistance results in
            //a value of 0, and value below minDistance results in a value of 1
            const float maxDistance = 500.0f;
            const float minDistance = 50.0f;

            distanceToItem = MathHelper.Clamp(distanceToItem, minDistance, maxDistance);

            return distanceToItem/maxDistance;
        }
 public int GetFee(UserTypes usertype, ItemTypes itemtype, int itemprice, DateTime itemenddate,
     IGetDiscountValue iGetDiscountValue)
 {
     if (itemprice <= 0)
     {
         throw new Exception("Itemprice can not be negetive");
     }
     try
     {
         var itemTypeDiscount = iGetDiscountValue.GetItemFee(itemtype);
         var userdiscount = iGetDiscountValue.GetUsertypeDiscount(usertype);
         var enddatediscount = iGetDiscountValue.GetEndDateDiscount(itemtype, itemenddate);
         return itemprice + itemTypeDiscount - (userdiscount + enddatediscount);
     }
     catch
     {
         throw new Exception("Invalid input");
     }
 }
Beispiel #26
0
 public static IItem CreateItem(ItemTypes itemType, Vector2 worldIndex, World world)
 {
     if (itemType == ItemTypes.Diamond)
         return CreateDiamond(worldIndex, world);
     else if (itemType == ItemTypes.BatWing)
         return CreateBatWing(worldIndex, world);
     else if (itemType == ItemTypes.PotionOfMinorHealth)
         return CreatePotionOfMinorHealth(worldIndex, world);
     else if (itemType == ItemTypes.PotionOfMinorEnergy)
         return CreatePotionOfMinorEnergy(worldIndex, world);
     else if (itemType == ItemTypes.PotionOfLevitation)
         return CreatePotionOfLevitation(worldIndex, world);
     else if (itemType == ItemTypes.PotionOfBlindness)
         return CreatePotionOfBlindness(worldIndex, world);
     else if (itemType == ItemTypes.CursedDoll)
         return CreateCursedDoll(worldIndex, world);
     else if (itemType == ItemTypes.OldKey)
         return CreateOldKey(worldIndex, world);
     else
         throw new NotImplementedException("Unable to create item.");
 }
 public override IAreaJob CreateAreaJob(Colony owner, Vector3Int min, Vector3Int max, bool isLoaded, int npcID = 0)
 {
     return(new ForesterJob(this, owner, min, max, ItemTypes.GetType("Khanx.AdvancedForester.saplinggreendark"), npcID));
 }
 public override IAreaJob CreateAreaJob(Colony owner, Vector3Int min, Vector3Int max, bool isLoaded, int npcID = 0)
 {
     return(new ForesterJob(this, owner, min, max, ItemTypes.GetType("cherrysaplingsmall"), npcID));
 }
Beispiel #29
0
        public CustomItem(NormalInventoryItem item)
        {
            if (item != null && item.Address != 0)
            {
                Item = item;
            }
            Path = item.Item.Path;
            var baseItemType = Core.GameController.Files.BaseItemTypes.Translate(item.Item.Path);

            ClassName = baseItemType.ClassName;
            BaseName  = baseItemType.BaseName;
            Width     = baseItemType.Width;
            Height    = baseItemType.Height;
            var weaponClass = new List <string>
            {
                "One Hand Mace",
                "Two Hand Mace",
                "One Hand Axe",
                "Two Hand Axe",
                "One Hand Sword",
                "Two Hand Sword",
                "Thrusting One Hand Sword",
                "Bow",
                "Claw",
                "Dagger",
                "Sceptre",
                "Staff",
                "Wand"
            };

            if (item.Item.HasComponent <Quality>())
            {
                var quality = item.Item.GetComponent <Quality>();
                Quality = quality.ItemQuality;
            }

            if (item.Item.HasComponent <Base>())
            {
                var @base = item.Item.GetComponent <Base>();
                IsElder  = @base.isElder;
                IsShaper = @base.isShaper;

                if (@base.Name == "Prophecy")
                {
                    var prophParse = item.Item.GetComponent <Prophecy>();
                    ProphecyName = prophParse.DatProphecy.Name.ToLower();
                    ProphecyName = ProphecyName.Replace(" ", "");
                    ProphecyName = ProphecyName.Replace(",", "");
                    ProphecyName = ProphecyName.Replace("'", "");
                }
            }

            if (item.Item.HasComponent <Mods>())
            {
                var mods = item.Item.GetComponent <Mods>();
                Rarity       = mods.ItemRarity;
                IsIdentified = mods.Identified;
                ItemLevel    = mods.ItemLevel;
                UniqueName   = mods.UniqueName;
            }

            if (item.Item.HasComponent <Sockets>())
            {
                try
                {
                    var sockets = item.Item.GetComponent <Sockets>();
                    IsRgb       = sockets.IsRGB;
                    Sockets     = sockets.NumberOfSockets;
                    LargestLink = sockets.LargestLinkSize;
                }
                catch
                {
                }
            }

            if (weaponClass.Any(ClassName.Equals))
            {
                IsWeapon = true;
            }

            MapInfo.MapTier = item.Item.HasComponent <Map>() ? item.Item.GetComponent <Map>().Tier : 0;
            MapInfo.IsMap   = MapInfo.MapTier > 0;

            if (Rarity != ItemRarity.Unique && MapInfo.IsMap)
            {
                foreach (var itemList in item.Item.GetComponent <Mods>().ItemMods)
                {
                    if (itemList.RawName.Contains("MapShaped"))
                    {
                        MapInfo.IsShapedMap = true;
                        break;
                    }
                }
            }

            if (item.Item.HasComponent <Stack>())
            {
                CurrencyInfo.StackSize = item.Item.GetComponent <Stack>().Size;
                if (BaseName.EndsWith(" Shard") || BaseName.EndsWith(" Fragment"))
                {
                    CurrencyInfo.IsShard = true;
                }
            }


            IsHovered = Core.GameController.Game.IngameState.UIHover.AsObject <NormalInventoryItem>().Address == item.Address;

            // sort items into types to use correct json data later from poe.ninja
            // This might need tweaking since if this catches anything other than currency.
            if (ClassName == "StackableCurrency" && !BaseName.Contains("Essence") && !BaseName.EndsWith(" Oil") && !BaseName.Contains("Remnant of") && !BaseName.Contains("Timeless ") && BaseName != "Prophecy" && ClassName != "MapFragment" && !BaseName.EndsWith(" Fossil") && ClassName != "Incubator" && !BaseName.EndsWith(" Catalyst") /*&& !BaseName.Contains("Shard") && BaseName != "Chaos Orb" && !BaseName.Contains("Wisdom")*/)
            {
                ItemType = ItemTypes.Currency;
            }
            else if (BaseName.EndsWith(" Catalyst"))
            {
                ItemType = ItemTypes.Catalyst;
            }
            else if (BaseName.EndsWith(" Oil"))
            {
                ItemType = ItemTypes.Oil;
            }
            else if (Path.Contains("Metadata/Items/DivinationCards"))
            {
                ItemType = ItemTypes.DivinationCard;
            }
            else if (BaseName.Contains("Essence") || BaseName.Contains("Remnant of"))
            {
                ItemType = ItemTypes.Essence;
            }
            else if ((ClassName == "MapFragment" || BaseName.Contains("Timeless ")) && !BaseName.EndsWith(" Scarab"))
            {
                ItemType = ItemTypes.Fragment;
            }
            else if (ClassName == "MapFragment" && BaseName.EndsWith(" Scarab"))
            {
                ItemType = ItemTypes.Scarab;
            }
            else if (BaseName == "Prophecy")
            {
                ItemType = ItemTypes.Prophecy;
            }
            else if (MapInfo.IsMap && Rarity != ItemRarity.Unique)
            {
                ItemType = ItemTypes.NormalMap;
            }
            else if (BaseName.EndsWith(" Fossil"))
            {
                ItemType = ItemTypes.Fossil;
            }
            else if (ClassName == "DelveStackableSocketableCurrency")
            {
                ItemType = ItemTypes.Resonator;
            }
            else if (ClassName == "Incubator")
            {
                ItemType = ItemTypes.Incubator;
            }
            else
            {
                switch (Rarity)  // Unique information
                {
                case ItemRarity.Unique when IsIdentified && IsIdentified && ClassName == "Amulet" || ClassName == "Ring" || ClassName == "Belt":
                    ItemType = ItemTypes.UniqueAccessory;
                    break;

                case ItemRarity.Unique when IsIdentified && item.Item.HasComponent <Armour>() || ClassName == "Quiver":
                    ItemType = ItemTypes.UniqueArmour;
                    break;

                case ItemRarity.Unique when IsIdentified && item.Item.HasComponent <Flask>():
                    ItemType = ItemTypes.UniqueFlask;
                    break;

                case ItemRarity.Unique when IsIdentified && ClassName.Equals("Jewel"):
                    ItemType = ItemTypes.UniqueJewel;
                    break;

                case ItemRarity.Unique when MapInfo.IsMap:
                    ItemType = ItemTypes.UniqueMap;
                    break;

                case ItemRarity.Unique when IsIdentified && item.Item.HasComponent <Weapon>():
                    ItemType = ItemTypes.UniqueWeapon;
                    break;
                }
            }
        }
Beispiel #30
0
        public Board(Point mapSize, Point centerPoint, MultiBoard parent, System.Windows.Controls.ContextMenu menu, ItemTypes visibleTypes, ItemTypes editedTypes)
        {
            this.uid          = Interlocked.Increment(ref uidCounter);
            this.MapSize      = mapSize;
            this.centerPoint  = centerPoint;
            this.parent       = parent;
            this.visibleTypes = visibleTypes;
            this.editedTypes  = editedTypes;
            this.menu         = menu;

            boardItems  = new BoardItemsManager(this);
            undoRedoMan = new UndoRedoManager(this);
            mouse       = new Mouse(this);
            serMan      = new SerializationManager(this);
        }
Beispiel #31
0
        //Checks
        private void itemSelectClickedOn(object sender, EventArgs e)
        {
            //Console.WriteLine("Item Selected");
            //Get reference to item or tool being selected
            Utils.nonAntialiasingPictureBox itemSelected = (Utils.nonAntialiasingPictureBox)sender;
            //Add new 'items required' if tool is clicked on
            if (itemSelected.Name.Contains("Select"))
            {
                toolToCraft = itemSelected;
                List <ItemTypes> required = extractRequiredItems(itemSelected.Name);
                int multiplier            = 0;

                itemInSlots = 0;
                //Remove previous 'items required'
                for (int i = this.Controls.Count - 1; i >= 0; i--)
                {
                    Control control = this.Controls[i];
                    if (control.Name.Contains("Collect") || control.Name.Contains("Craft"))
                    {
                        this.Controls.Remove(control);
                    }
                }

                //Add new items required
                foreach (ItemTypes itemType in required)
                {
                    Item item = ItemOperators.extractControlFromType(itemType);
                    Utils.nonAntialiasingPictureBox itemReq = new Utils.nonAntialiasingPictureBox();
                    setItemSelectInfo(itemReq, new Point(40 + (itemSelectSize + 32) * multiplier /*algebra - YEAH!*/, lblRequiredItemsTitle.Bottom + 10), itemType.ToString() + "ToCollect", item);
                    multiplier++;
                    this.Controls.Add(itemReq);
                }
            }
            //Moves item to crafting 'equation' if player has it
            else if (itemSelected.Name.Contains("ToCollect"))
            {
                ItemTypes itemType = extractRequiredItemType(itemSelected.Name);
                int       spot     = (itemSelected.Location.X - 40) / (itemSelectSize + 32);
                if (levelHandler.player.HasItem(itemType))
                {
                    itemSelected.Hide();
                    itemSelected.Location = new Point(60 + (140 * spot), 220);
                    itemSelected.Size     = new Size(75, 75);
                    itemSelected.Show();
                    itemInSlots++;
                    itemSelected.Name = itemType.ToString() + "Collected";
                    //Show output tool if 'equation' is complete
                    if (itemInSlots >= 2)
                    {
                        lblClickHere.Show();
                        ItemTypes selectedToolType = extractItemToCraft(toolToCraft.Name);
                        Item      tool             = ItemOperators.extractControlFromType(selectedToolType);
                        Utils.nonAntialiasingPictureBox itemCrafted = new Utils.nonAntialiasingPictureBox();
                        setItemSelectInfo(itemCrafted, new Point(375, 220), selectedToolType.ToString() + "ToCraft", tool);
                        itemCrafted.Size   = new Size(75, 75);
                        itemCrafted.Click += collectItem;
                        this.Controls.Add(itemCrafted);
                    }
                }
            }
            //Move tool out of equation
            else if (itemSelected.Name.Contains("Collected"))
            {
                lblClickHere.Hide();
                ItemTypes itemType = extractRequiredItemType(itemSelected.Name);
                int       spot     = (itemSelected.Location.X - 60) / 140;
                itemSelected.Hide();
                itemSelected.Location = new Point(40 + (itemSelectSize + 32) * spot, lblRequiredItemsTitle.Bottom + 10);
                itemSelected.Size     = new Size(itemSelectSize, itemSelectSize);
                itemSelected.Show();
                itemInSlots--;
                itemSelected.Name = itemType.ToString() + "ToCollect";

                //Remove equation output if there
                for (int i = this.Controls.Count - 1; i >= 0; i--)
                {
                    Control control = this.Controls[i];
                    if (control.Name.Contains("Craft"))
                    {
                        control.Click -= collectItem;
                        this.Controls.Remove(control);
                    }
                }
            }
        }
Beispiel #32
0
 public void AddSingleItem(ItemTypes ItemToAdd)
 {
     AddItemOfQuantity(ItemToAdd, 1);
 }
Beispiel #33
0
 public void UpdateDictionary(ItemTypes player, int score)
 {
     uIManager.UpdatePlayerScore(player, score);
 }
Beispiel #34
0
        public void LoadInventory(Inventory inventory)
        {
            int previousGameIndex = (this.inventory != null ? this.inventory.GameIndex : -1);

            foreach (KeyValuePair <ItemTypes, ItemViewerTab> pair in tabs)
            {
                pair.Value.UnloadPocket();
            }
            if (pokeblockTab != null)
            {
                pokeblockTab.UnloadPokeblockCase();
                pokeblockTab = null;
            }

            this.previousPocketIndex = -1;
            this.tabs.Clear();
            this.tabControlPockets.Items.Clear();
            this.inventory      = inventory;
            this.previousPocket = (currentPocket == ItemTypes.Items && previousGameIndex == -1 ? ItemTypes.PC : currentPocket);
            this.currentPocket  = ItemTypes.PC;
            TryAddPocket(ItemTypes.PC);
            if (!inventory.Items.ContainsPocket(ItemTypes.InBattle))
            {
                TryAddPocket(ItemTypes.Items);
            }
            TryAddPocket(ItemTypes.InBattle);
            TryAddPocket(ItemTypes.Valuables);
            TryAddPocket(ItemTypes.Hold);
            TryAddPocket(ItemTypes.Misc);
            TryAddPocket(ItemTypes.PokeBalls);
            TryAddPocket(ItemTypes.Berries);
            TryAddPocket(ItemTypes.TMCase);
            TryAddPocket(ItemTypes.KeyItems);
            TryAddPocket(ItemTypes.CologneCase);
            TryAddPocket(ItemTypes.DiscCase);

            if (inventory.Pokeblocks != null)
            {
                TabItem tabItem = new TabItem();
                tabItem.Tag = ItemTypes.Unknown;
                if (previousPocket == ItemTypes.Unknown)
                {
                    previousPocketIndex = tabControlPockets.Items.Count;
                }
                StackPanel stackPanel = new StackPanel();
                stackPanel.SnapsToDevicePixels = true;
                stackPanel.Orientation         = Orientation.Horizontal;
                Image headerImage = new Image();
                headerImage.SnapsToDevicePixels = true;
                headerImage.UseLayoutRounding   = true;
                headerImage.Stretch             = Stretch.None;
                headerImage.Source = ResourceDatabase.GetImageFromName("PokeblockCaseTab");
                TextBlock headerName = new TextBlock();
                headerName.Text = "Pokéblock Case";
                headerName.VerticalAlignment = VerticalAlignment.Center;
                headerName.Margin            = new Thickness(2, 0, 0, 0);
                //stackPanel.Children.Add(headerImage);
                //stackPanel.Children.Add(headerName);
                tabItem.Header      = headerImage;           // stackPanel;// "Pokéblock Case";
                pokeblockTab        = new PokeblockViewerTab();
                pokeblockTab.Width  = Double.NaN;
                pokeblockTab.Height = Double.NaN;
                tabItem.Content     = pokeblockTab;
                tabControlPockets.Items.Add(tabItem);
                pokeblockTab.LoadPokeblockCase(inventory.Pokeblocks);
            }
            this.currentPocket = (ItemTypes)(tabControlPockets.Items[0] as TabItem).Tag;
            if (previousPocketIndex != -1)
            {
                Dispatcher.BeginInvoke((Action)(() => tabControlPockets.SelectedIndex = previousPocketIndex));
                this.currentPocket = previousPocket;
            }
        }
Beispiel #35
0
 public ItemPocketGameTag(int gameIndex, ItemTypes itemType)
 {
     this.GameIndex      = gameIndex;
     this.ItemType       = itemType;
     this.DecorationType = DecorationTypes.Unknown;
 }
Beispiel #36
0
 public Item(ItemTypes type)
 {
     this.type   = type;
     this.number = 1;
     icon        = (Texture2D)Resources.Load("Icons/" + type.ToString());
 }
Beispiel #37
0
 private bool IsSupportedType(ItemTypes type)
 {
     return(this.SupportedItemTypes.Contains(type));
 }
Beispiel #38
0
 public Item(ItemTypes itemtyp, string name)
 {
     _itemType = itemtyp;
     Name = name;
 }
Beispiel #39
0
    void DisplayInv(string sortType)
    {
        if (!(sortType == "All" || sortType == ""))
        {
            ItemTypes type = (ItemTypes)System.Enum.Parse(typeof(ItemTypes), sortType);
            int       a    = 0;                 //amount of that type
            int       s    = 0;                 //slot position of ui item
            for (int i = 0; i < inv.Count; i++) // loop throw all items
            {
                if (inv[i].Type == type)        // find our type
                {
                    a++;                        //increase the amount of this type
                }
            }

            if (a <= 35)                            // if the amount of this type is less than 35
            {
                for (int i = 0; i < inv.Count; i++) //we filter through all items
                {
                    if (inv[i].Type == type)        //if it is of type
                    {
                        //we display a button that is of this type and slot it under the last using s as our height
                        if (GUI.Button(new Rect(0.5f * scr.x, 0.25f * scr.y + s * (0.25f * scr.y), 3 * scr.x, 0.25f * scr.y), inv[i].Name))
                        {
                            selectedItem = inv[i];        //this button is our selected item from our inventory
                            Debug.Log(selectedItem.Name); //tell us its name
                        }
                        s++;                              //once added increase our s
                        //each new thing goes under the last
                    }
                }
            }
            else //we have more than 35 in this type
            {
                // we need a scroll view
                //remove the previous 35 from our type amount a
                scrollpos = GUI.BeginScrollView(new Rect(0, 0.25f * scr.y, 3.75f * scr.x, 8.75f * scr.y), scrollpos, new Rect(0, 0, 0, 8.75f * scr.y + ((a - 35) * (0.25f * scr.y))), false, true);
                #region Items in Viewing Area
                for (int i = 0; i < inv.Count; i++) //loop throw all items
                {
                    if (inv[i].Type == type)        //if it is of type
                    {
                        //we display a button that is of this type and slot it under the last using s as our height
                        if (GUI.Button(new Rect(0.5f * scr.x, 0 * scr.y + s * (0.25f * scr.y), 3 * scr.x, 0.25f * scr.y), inv[i].Name))
                        {
                            selectedItem = inv[i];        //this button is our selected item from our inventory
                            Debug.Log(selectedItem.Name); //tell us its name
                        }
                        s++;
                        //once added increase our s
                        //each new thing goes under the last
                    }
                }

                #endregion
                GUI.EndScrollView();
            }
        }

        else
        {
            #region Non Scroll Inventory

            if (inv.Count <= 35)
            {
                for (int i = 0; i < inv.Count; i++)
                {
                    if (GUI.Button(new Rect(0.5f * scr.x, 0.5f * scr.y + i * (0.25f * scr.y), 3 * scr.x, 0.25f * scr.y), inv[i].Name))
                    {
                        selectedItem = inv[i];
                        Debug.Log(selectedItem.Name);
                    }
                }
            }


            #endregion
            #region Scroll Inventory

            else // we are greater than 35
            {
                // our moved position in scolling            // our view window
                scrollpos = GUI.BeginScrollView(new Rect(0, 0.25f * scr.y, 6 * scr.x, 8.75f * scr.y),
                                                // our current position in the scrolling
                                                scrollpos,
                                                // the viewable area
                                                new Rect(0, 0, 0, 8.75f * scr.y + ((inv.Count - 35) * (0.25f * scr.y))),
                                                // can we see the horizontal bar?
                                                false,
                                                // can we see the vertical bar?
                                                true);
                #region Item in Viewing area
                for (int i = 0; i < inv.Count; i++)
                {
                    if (GUI.Button(new Rect(0.5f * scr.x, 0 * scr.y + i * (0.25f * scr.y), 3 * scr.x, 0.25f * scr.y), inv[i].Name))
                    {
                        selectedItem = inv[i];
                        Debug.Log(selectedItem.Name);
                    }
                }
                #endregion


                GUI.EndScrollView();
            }

            #endregion
        }
    }
 void setTypes(ref ItemTypes newVisibleTypes, ref ItemTypes newEditedTypes, bool?x, ItemTypes type)
 {
     if (x.HasValue)
     {
         if (x.Value)
         {
             newVisibleTypes ^= type;
             newEditedTypes  ^= type;
         }
     }
     else
     {
         newVisibleTypes ^= type;
     }
 }
 public void EnterEditMode(ItemTypes type)
 {
     multiBoard.SelectedBoard.EditedTypes   = type;
     multiBoard.SelectedBoard.VisibleTypes |= type;
     ribbon.SetEnabled(false);
 }
Beispiel #42
0
        private void AddItemsToItemsSource <C>(Collection <C> items, List <ListBoxObject> items_source, ItemTypes type) //Добавление предметов в ItemsSource
        {
            BaseItem    baseItem = new BaseItem();
            BitmapImage image    = new BitmapImage(new Uri(baseItem.GetIcon(type)));

            for (int i = 0; i <= items.Count - 1; i++)
            {
                items_source.Add(new ListBoxObject(items[i], image));
            }
        }
Beispiel #43
0
 public Item(string name, World world, Vector2 worldIndex, IUseStrategy useStrategy, IGetStrategy getStrategy, IGiveStrategy giveStrategy, ItemCategories itemCategory, ItemTypes itemType)
 {
     Name          = name;
     _world        = world;
     WorldIndex    = worldIndex;
     _useStrategy  = useStrategy;
     _getStrategy  = getStrategy;
     _giveStrategy = giveStrategy;
     ItemCategory  = itemCategory;
     ItemType      = itemType;
 }
Beispiel #44
0
 public Item(ItemTypes type, int number)
 {
     this.type = type;
     this.number = number;
     icon = (Texture2D)Resources.Load("Icons/"+type.ToString());
 }
 public Punctuation(string value, IEnumerable <int> positions, ItemTypes type) : base(value, positions, type)
 {
 }
Beispiel #46
0
 public LItem GetitemTypeRule(TrinityItemType itemType)
 {
     return(ItemTypes.FirstOrDefault(sr => sr.TrinityItemType == itemType));
 }
 public NewLineSymbol(IEnumerable <int> positions, ItemTypes type) : base(positions, type)
 {
     Symbols = Value.Select(ch => new Symbol(ch));
 }
Beispiel #48
0
    public static Item CreateItem(int ItemID)
    {
        // This is what we need
        string    name        = "";
        string    description = "";
        int       value       = 0; // How much the item costs
        int       damage      = 0;
        int       armour      = 0;
        int       amount      = 0;
        int       heal        = 0;
        string    icon        = "";
        string    mesh        = "";
        ItemTypes type        = ItemTypes.Armour; // Default value. We're overriding it below.

        // This is where we set the item data (based on the 'Item' script')
        switch (ItemID)
        {
            #region Consumables 0-99
        case 0:
            name        = "Apple";
            description = "Munchies and crunchies.";
            value       = 5;
            damage      = 0;
            armour      = 0;
            amount      = 1;
            heal        = 10;
            icon        = "Apple_Icon";
            mesh        = "Apple_Mesh";
            type        = ItemTypes.Consumables;
            break;

        case 1:
            name        = "Cheese";
            description = "Yellow gold.";
            value       = 25;
            damage      = 0;
            armour      = 0;
            amount      = 1;
            heal        = 50;
            icon        = "Cheese_Icon";
            mesh        = "Cheese_Mesh";
            type        = ItemTypes.Consumables;
            break;

        case 2:
            name        = "Health Potion";
            description = "A soothing, restorative substance.";
            value       = 50;
            damage      = 0;
            armour      = 0;
            amount      = 1;
            heal        = 100;
            icon        = "HealthPotion_Icon";
            mesh        = "HealthPotion_Mesh";
            type        = ItemTypes.Consumables;
            break;

            #endregion
            #region Armour 100-199
        case 100:
            name        = "Wooden Helmet";
            description = "More of a bucket, really.";
            value       = 1;
            damage      = 0;
            armour      = 1;
            amount      = 1;
            heal        = 0;
            icon        = "WoodenHelmet_Icon";
            mesh        = "WoodenHelmet_Mesh";
            type        = ItemTypes.Armour;
            break;

        case 101:
            name        = "Leather Helmet";
            description = "Helmet made from hide.";
            value       = 25;
            damage      = 0;
            armour      = 10;
            amount      = 1;
            heal        = 0;
            icon        = "LeatherHelmet_Icon";
            mesh        = "LeatherHelmet_Mesh";
            type        = ItemTypes.Armour;
            break;

        case 102:
            name        = "Iron Helmet";
            description = "A humble hat made of iron.";
            value       = 50;
            damage      = 0;
            armour      = 25;
            amount      = 1;
            heal        = 0;
            icon        = "IronHelmet_Icon";
            mesh        = "IronHelmet_Mesh";
            type        = ItemTypes.Armour;
            break;

            #endregion
            #region Weapon 200 - 299
        case 200:
            name        = "Wooden Sword";
            description = "Practice sword.";
            value       = 1;
            damage      = 5;
            armour      = 0;
            amount      = 1;
            heal        = 0;
            icon        = "WoodenSword_Icon";
            mesh        = "WoodenSword_Mesh";
            type        = ItemTypes.Weapon;
            break;

        case 201:
            name        = "Iron Axe";
            description = "For chopping wood or enemies.";
            value       = 25;
            damage      = 25;
            armour      = 0;
            amount      = 1;
            heal        = 0;
            icon        = "IronAxe_Icon";
            mesh        = "IronAxe_Mesh";
            type        = ItemTypes.Weapon;
            break;

        case 202:
            name        = "Iron Sword";
            description = "Which end do I hold?";
            value       = 50;
            damage      = 50;
            armour      = 0;
            amount      = 1;
            heal        = 0;
            icon        = "IronSword_Icon";
            mesh        = "IronSword_Mesh";
            type        = ItemTypes.Weapon;
            break;

            #endregion
            #region Crafting 300 - 399
        case 300:
            name        = "Oak Branch";
            description = "Thick branch of oak.";
            value       = 1;
            damage      = 0;
            armour      = 0;
            amount      = 1;
            heal        = 0;
            icon        = "OakBranch_Icon";
            mesh        = "OakBranch_Mesh";
            type        = ItemTypes.Craftable;
            break;

        case 301:
            name        = "Iron Ore";
            description = "Iron...kinda.";
            value       = 2;
            damage      = 0;
            armour      = 0;
            amount      = 1;
            heal        = 0;
            icon        = "IronOre_Icon";
            mesh        = "IronOre_Mesh";
            type        = ItemTypes.Craftable;
            break;

        case 302:
            name        = "Iron Ingot";
            description = "Bar of iron.";
            value       = 10;
            damage      = 0;
            armour      = 0;
            amount      = 1;
            heal        = 0;
            icon        = "IronIngot_Icon";
            mesh        = "IronIngot_Mesh";
            type        = ItemTypes.Craftable;
            break;

            #endregion
            #region Misc 400 -499
        case 400:
            name        = "Jug";
            description = "Holds water.";
            value       = 1;
            damage      = 0;
            armour      = 0;
            amount      = 1;
            heal        = 0;
            icon        = "Jug_Icon";
            mesh        = "Jug_Mesh";
            type        = ItemTypes.Misc;
            break;

        case 401:
            name        = "Sword Fragment";
            description = "Broken sword.";
            value       = 0;
            damage      = 0;
            armour      = 0;
            amount      = 1;
            heal        = 0;
            icon        = "SwordFragment_Icon";
            mesh        = "SwordFragment_Mesh";
            type        = ItemTypes.Quest;
            break;

        case 402:
            name        = "Vape";
            description = "Cloud Maker";
            value       = 0;
            damage      = 0;
            armour      = 0;
            amount      = 1;
            heal        = 0;
            icon        = "Vape_Icon";
            mesh        = "Vape_Mesh";
            type        = ItemTypes.Quest;
            break;

            #endregion
        default:
            name        = "Apple";
            description = "Munchies and crunchies.";
            value       = 5;
            damage      = 0;
            armour      = 0;
            amount      = 1;
            heal        = 10;
            icon        = "Apple_Icon";
            mesh        = "Apple_Mesh";
            type        = ItemTypes.Consumables;
            break;
        }

        // This is where we create the item
        Item temp = new Item
        {
            Name        = name,
            Description = description,
            Id          = ItemID,
            Value       = value,
            Damage      = damage,
            Armour      = armour,
            Amount      = amount,
            Heal        = heal,
            Type        = type,
            Icon        = Resources.Load("Icons/" + icon) as Texture2D, // Whenever you're dealing with Resource.Load, you need to make sure paths are clear. So "Icons" needs to be the name of the folder.
            MeshName    = mesh
        };
        return(temp);
    }
        private void OnContextMenuOpening(object sender, ContextMenuEventArgs e)
        {
            if (selectedItem != null && selectedItem.ItemData.ID != 0)
            {
                if (HasSelection)
                {
                    selectionIsImportant = -1;
                    selectionMax         = 0;
                    bool      roomInCollection = false;
                    bool      unknownItem      = false;
                    ItemTypes itemType         = SelectedItems[0].ItemData.PocketType;
                    selectionExclusives = GameTypeFlags.AllGen3;
                    foreach (Item item in SelectedItems)
                    {
                        selectionExclusives &= item.ItemData.Exclusives;
                        selectionMax         = Math.Max(selectionMax, (int)item.Count);
                        if (item.ItemData.ID == 0)
                        {
                            unknownItem = true;
                        }
                        else if (item.ItemData.IsImportant)
                        {
                            if (selectionIsImportant == -1)
                            {
                                selectionIsImportant = 1;
                            }
                            else if (selectionIsImportant == 0)
                            {
                                selectionIsImportant = 2;
                            }
                            if (PokeManager.ManagerGameSave.Inventory.Items[item.ItemData.PocketType].GetCountOfID(item.ID) == 0)
                            {
                                roomInCollection = true;
                            }
                        }
                        else
                        {
                            if (selectionIsImportant == -1)
                            {
                                selectionIsImportant = 0;
                            }
                            else if (selectionIsImportant == 1)
                            {
                                selectionIsImportant = 2;
                            }
                        }
                        if (item.ItemData.PocketType != itemType)
                        {
                            itemType = ItemTypes.Unknown;
                        }
                    }

                    ((MenuItem)contextMenu.Items[0]).Header = (pocket.PocketType == ItemTypes.PC ? "Withdraw" : "Deposit");
                    ((MenuItem)contextMenu.Items[1]).Header = (pocket.PocketType == ItemTypes.PC ? "Withdraw All" : "Deposit All");
                    ((MenuItem)contextMenu.Items[2]).Header = (selectionIsImportant == 1 ? "Add to Collection" : "Send To");

                    ((MenuItem)contextMenu.Items[0]).IsEnabled = !unknownItem && selectionIsImportant == 0 && pocket.Inventory.ContainsPocket(ItemTypes.PC);
                    ((MenuItem)contextMenu.Items[1]).IsEnabled = !unknownItem && selectionIsImportant == 0 && pocket.Inventory.ContainsPocket(ItemTypes.PC);
                    ((MenuItem)contextMenu.Items[2]).IsEnabled = !unknownItem && itemType != ItemTypes.Unknown && (selectionIsImportant == 0 || (roomInCollection && selectionIsImportant == 1));
                    ((MenuItem)contextMenu.Items[3]).IsEnabled = false;
                    ((MenuItem)contextMenu.Items[5]).IsEnabled = !unknownItem && (selectionIsImportant == 0 || pocket.GameSave.GameIndex == -1);
                    ((MenuItem)contextMenu.Items[6]).IsEnabled = !unknownItem && (selectionIsImportant == 0 || pocket.GameSave.GameIndex == -1);
                }
                else
                {
                    ((MenuItem)contextMenu.Items[0]).Header = (pocket.PocketType == ItemTypes.PC ? "Withdraw" : "Deposit");
                    ((MenuItem)contextMenu.Items[1]).Header = (pocket.PocketType == ItemTypes.PC ? "Withdraw All" : "Deposit All");
                    ((MenuItem)contextMenu.Items[2]).Header = (selectedItem.ItemData.IsImportant ? "Add to Collection" : "Send To");

                    ((MenuItem)contextMenu.Items[0]).IsEnabled = !selectedItem.ItemData.IsImportant && pocket.Inventory.ContainsPocket(ItemTypes.PC);
                    ((MenuItem)contextMenu.Items[1]).IsEnabled = !selectedItem.ItemData.IsImportant && pocket.Inventory.ContainsPocket(ItemTypes.PC);
                    ((MenuItem)contextMenu.Items[2]).IsEnabled = (!selectedItem.ItemData.IsImportant || PokeManager.ManagerGameSave.Inventory.Items[selectedItem.ItemData.PocketType].GetCountOfID(selectedItem.ID) == 0);
                    ((MenuItem)contextMenu.Items[3]).IsEnabled = !selectedItem.ItemData.IsImportant && (selectedItem.ID < 121 || (selectedItem.ID > 132 && selectedItem.ID < 500));
                    ((MenuItem)contextMenu.Items[5]).IsEnabled = (!selectedItem.ItemData.IsImportant || pocket.GameSave.GameIndex == -1);
                    ((MenuItem)contextMenu.Items[6]).IsEnabled = (!selectedItem.ItemData.IsImportant || pocket.GameSave.GameIndex == -1);
                }
            }
            else
            {
                ((MenuItem)contextMenu.Items[0]).IsEnabled = false;
                ((MenuItem)contextMenu.Items[1]).IsEnabled = false;
                ((MenuItem)contextMenu.Items[2]).IsEnabled = false;
                ((MenuItem)contextMenu.Items[3]).IsEnabled = false;
                ((MenuItem)contextMenu.Items[5]).IsEnabled = false;
                ((MenuItem)contextMenu.Items[6]).IsEnabled = false;
            }
        }
Beispiel #50
0
        public void DoJob(
            IIterationType iterationType,
            IAreaJob areaJob,
            ConstructionJobInstance job,
            ref NPCBase.NPCState state)
        {
            if (iterationType == null)
            {
                AreaJobTracker.RemoveJob(areaJob);
            }
            else
            {
                Stockpile stockpile = areaJob.Owner.Stockpile;
                int       num       = 4096;
                while (num-- > 0)
                {
                    Vector3Int currentPosition = iterationType.CurrentPosition;
                    if (!currentPosition.IsValid)
                    {
                        state.SetIndicator(new IndicatorState(5f, BuiltinBlocks.Indices.erroridle, false, true), true);
                        AreaJobTracker.RemoveJob(areaJob);
                        return;
                    }
                    ushort val;
                    if (World.TryGetTypeAt(currentPosition, out val))
                    {
                        if (val == (ushort)0)
                        {
                            iterationType.MoveNext();
                            continue;
                        }

                        ItemTypes.ItemType type = ItemTypes.GetType(val);
                        if (!type.IsDestructible)
                        {
                            iterationType.MoveNext();
                            continue;
                        }
                        if (type != this.digType)
                        {
                            bool flag = false;
                            for (ItemTypes.ItemType parentItemType = type.ParentItemType; parentItemType != (ItemTypes.ItemType)null; parentItemType = parentItemType.ParentItemType)
                            {
                                if (parentItemType == this.digType)
                                {
                                    flag = true;
                                    break;
                                }
                            }
                            if (!flag)
                            {
                                iterationType.MoveNext();
                                continue;
                            }
                        }
                        if (!stockpile.Contains(this.buildType.ItemIndex, 1))
                        {
                            float num2 = Random.NextFloat(5f, 8f);
                            job.Owner.Stats.RecordNPCIdleSeconds(job.NPCType, num2);
                            state.SetIndicator(new IndicatorState(num2, this.buildType.ItemIndex, true, false), true);
                            return;
                        }

                        if (ServerManager.TryChangeBlock(currentPosition, this.buildType, (BlockChangeRequestOrigin)areaJob.Owner, ESetBlockFlags.DefaultAudio) == EServerChangeBlockResult.Success)
                        {
                            stockpile.TryRemove(this.buildType.ItemIndex, 1, true);
                            float cooldown = ReplacerSpecial.GetCooldown((float)type.DestructionTime * (1f / 1000f));
                            ReplacerSpecial.GatherResults.Clear();
                            List <ItemTypes.ItemTypeDrops> onRemoveItems = type.OnRemoveItems;
                            for (int index = 0; index < onRemoveItems.Count; ++index)
                            {
                                ReplacerSpecial.GatherResults.Add(onRemoveItems[index]);
                            }
                            ModLoader.Callbacks.OnNPCGathered.Invoke((IJob)job, currentPosition, ReplacerSpecial.GatherResults);
                            InventoryItem weightedRandom = ItemTypes.ItemTypeDrops.GetWeightedRandom(ReplacerSpecial.GatherResults);
                            if (weightedRandom.Amount > 0)
                            {
                                state.SetIndicator(new IndicatorState(cooldown, weightedRandom.Type, false, true), true);
                            }
                            else
                            {
                                state.SetCooldown((double)cooldown);
                            }
                            state.Inventory.Add((IList <ItemTypes.ItemTypeDrops>)ReplacerSpecial.GatherResults);
                            ++job.StoredItemCount;
                            iterationType.MoveNext();
                            if (job.StoredItemCount < this.MaxGatheredPerRun)
                            {
                                return;
                            }
                            job.ShouldTakeItems = true;
                            state.JobIsDone     = true;
                            return;
                        }
                        state.SetIndicator(new IndicatorState(5f, BuiltinBlocks.Indices.missingerror, true, false), true);
                        return;
                    }
                    else
                    {
                        state.SetIndicator(new IndicatorState(5f, BuiltinBlocks.Indices.missingerror, true, false), true);
                        return;
                    }
                }
                state.SetCooldown(0.8, 1.2);
            }
        }
Beispiel #51
0
 public void SetItemPosition(int x, int z, ItemTypes itemType)
 {
     itemGrid[x, z] = itemType.GetHashCode();
 }
 public EveItem(String itemName, uint itemID, ItemTypes itemType, String itemNodeCategory)
     : this(itemName, itemID, itemType)
 {
     ItemNodeCategory = itemNodeCategory;
 }
Beispiel #53
0
    private void CreateSlotBar(ItemTypes itemType)
    {
        GameObject go = Instantiate(ItemSlotBar, transform);

        go.GetComponent <ItemSlotBar>().CreateItemsInBar(itemType);
    }
Beispiel #54
0
 public override void OnNPCAtJob(ref NPCBase.NPCState state)
 {
     state.JobIsDone = true;
     usedNPC.LookAt(position.Vector);
     if (!state.Inventory.IsEmpty)
     {
         state.Inventory.Dump(BlockInventory);
     }
     if (Todoblocks.Count < 1)
     {
         BlockInventory.Dump(usedNPC.Inventory);
         ShouldTakeItems = true;
     }
     else
     {
         bool placed = false;
         if (!ItemTypes.IndexLookup.TryGetIndex(Fullname, out ushort bluetype))
         {
             string msg = $"Bob here from site at {position}, the blueprint '{Fullname}' does not exist, stopped work here";
             Log.WriteError(msg);
             Chat.Send(usedNPC.Colony.Owner, msg);
             Todoblocks.Clear();
             return;
         }
         ushort scaffoldType = ItemTypes.IndexLookup.GetIndex(ScaffoldsModEntries.SCAFFOLD_ITEM_TYPE);
         string jobname      = TypeHelper.RotatableToBasetype(Fullname);
         for (int i = Todoblocks.Count - 1; i >= 0; i--)
         {
             BlueprintTodoBlock todoblock    = Todoblocks [i];
             Vector3Int         realPosition = todoblock.GetWorldPosition(jobname, position, bluetype);
             if (realPosition.y <= 0)
             {
                 Todoblocks.RemoveAt(i);
                 continue;
             }
             string todoblockBaseTypename    = TypeHelper.RotatableToBasetype(todoblock.Typename);
             string todoblockRotatedTypename = todoblock.Typename;
             if (!todoblockBaseTypename.Equals(todoblock.Typename))
             {
                 Vector3Int jobVec      = TypeHelper.RotatableToVector(Fullname);
                 Vector3Int blockVec    = TypeHelper.RotatableToVector(todoblock.Typename);
                 Vector3Int combinedVec = new Vector3Int(-jobVec.z * blockVec.x + jobVec.x * blockVec.z, 0, jobVec.x * blockVec.x + jobVec.z * blockVec.z);
                 todoblockRotatedTypename = todoblockBaseTypename + TypeHelper.VectorToXZ(combinedVec);
             }
             if (!LookupAndWarnItemIndex(todoblockRotatedTypename, out ushort todoblockRotatedType))
             {
                 Todoblocks.RemoveAt(i);
             }
             else if (!World.TryGetTypeAt(realPosition, out ushort actualType) || actualType == todoblockRotatedType)
             {
                 Todoblocks.RemoveAt(i);
             }
             else
             {
                 if (!LookupAndWarnItemIndex(todoblockBaseTypename, out ushort todoblockBaseType))
                 {
                     Todoblocks.RemoveAt(i);
                 }
                 else if (todoblockRotatedType == BuiltinBlocks.Air || BlockInventory.TryGetOneItem(todoblockBaseType))
                 {
                     Todoblocks.RemoveAt(i);
                     if (ServerManager.TryChangeBlock(realPosition, todoblockRotatedType, owner))
                     {
                         state.JobIsDone = true;
                         if (todoblockRotatedType == BuiltinBlocks.Air)
                         {
                             state.SetCooldown(ConstructionModEntries.EXCAVATION_DELAY);
                             state.SetIndicator(new Shared.IndicatorState(ConstructionModEntries.EXCAVATION_DELAY, actualType));
                         }
                         else if (!BlockInventory.IsEmpty && i > 0)
                         {
                             state.SetIndicator(new Shared.IndicatorState(0.5f, todoblockRotatedType));
                         }
                         if (actualType != BuiltinBlocks.Air && actualType != BuiltinBlocks.Water && actualType != scaffoldType)
                         {
                             usedNPC.Inventory.Add(ItemTypes.GetType(actualType).OnRemoveItems);
                         }
                         placed = true;
                         break;
                     }
                 }
             }
         }
         if (!placed)
         {
             BlockInventory.Dump(usedNPC.Inventory);
             ShouldTakeItems = true;
         }
     }
 }
Beispiel #55
0
        private void AddItemsToItemsSource(Collection <OpticalDisc> items, List <ListBoxObject> items_source, ItemTypes type) //Добавление предметов в ItemsSource
        {
            BaseItem baseItem = new BaseItem();

            for (int i = 0; i <= items.Count - 1; i++)
            {
                string path = "Resources/discs/" + items[i].Properties.CoverName + ".png";
                Uri    uri  = new Uri("pack://application:,,,/" + path);

                if (System.IO.File.Exists(System.IO.Path.GetFullPath(path)) == false)
                {
                    uri = new Uri("pack://application:,,,/Resources/discs/disc-cover_empty.png");
                }
                BitmapImage image = new BitmapImage(uri);

                items_source.Add(new ListBoxObject(items[i], image));
            }
        }
        private void OnDeposit(object sender, EventArgs e)
        {
            if (HasSelection)
            {
                string deposit = (pocket.PocketType == ItemTypes.PC ? "Withdraw" : "Deposit");
                var    results = AdvancedSendSelectionToWindow.ShowDialog(Window.GetWindow(this), pocket.GameSave.GameIndex, selectionMax, deposit + " Item Selection", pocket.PocketType == ItemTypes.PC ? ItemTypes.Any : ItemTypes.PC, true, selectionExclusives);
                if (results != null)
                {
                    bool noRoom = false;
                    foreach (Item item in SelectedItems)
                    {
                        ItemTypes pocketType = (pocket.PocketType == ItemTypes.PC ? item.ItemData.PocketType : ItemTypes.PC);
                        int       finalCount = results.GetFinalCount(item.Count);
                        if (finalCount > 0)
                        {
                            if (pocket.Inventory[pocketType].HasRoomForItem(item.ID, (uint)finalCount))
                            {
                                pocket.Inventory[pocketType].AddItem(item.ID, (uint)finalCount);
                                pocket.TossItemAt(pocket.IndexOf(item), (uint)finalCount);
                            }
                            else
                            {
                                noRoom = true;
                            }
                        }
                    }
                    if (noRoom)
                    {
                        TriggerMessageBox.Show(Window.GetWindow(this), "The pocket filled up before all of the selection could be sent", "No Room");
                    }
                }
            }
            else
            {
                if (selectedItem.Count == 1)
                {
                    OnDepositAll(null, null);
                }
                else
                {
                    string deposit = (pocket.PocketType == ItemTypes.PC ? "Withdraw" : "Deposit");
                    var    results = AdvancedSendSingleToWindow.ShowDialog(Window.GetWindow(this), pocket.GameSave.GameIndex, (int)selectedItem.Count, deposit + " Item", pocket.PocketType == ItemTypes.PC ? selectedItem.ItemData.PocketType : ItemTypes.PC, true, selectedItem.ItemData.Exclusives);

                    //int? count = ItemCountWindow.ShowDialog(Window.GetWindow(this), pocket.PocketType == ItemTypes.PC ? "Withdraw" : "Deposit", 1, (int)selectedItem.Count);
                    if (results != null)
                    {
                        ItemTypes pocketType = (pocket.PocketType == ItemTypes.PC ? selectedItem.ItemData.PocketType : ItemTypes.PC);
                        if (pocket.Inventory[pocketType].HasRoomForItem(selectedItem.ID, (uint)results.Count))
                        {
                            pocket.Inventory[pocketType].AddItem(selectedItem.ID, (uint)results.Count);
                            pocket.TossItemAt(selectedIndex, (uint)results.Count);
                        }
                        else
                        {
                            // No room for item
                            TriggerMessageBox.Show(Window.GetWindow(this), "No room for that item", "No Room");
                        }
                    }
                }
            }
        }
Beispiel #57
0
 public virtual Color GetColor(ItemTypes editedTypes, int selectedLayer, bool selected)
 {
     if (((ApplicationSettings.editedTypes & Type) == Type && (selectedLayer == -1 || CheckIfLayerSelected(selectedLayer))))
         return selected ? UserSettings.SelectedColor : Color.White;
     else return MultiBoard.InactiveColor;
 }
Beispiel #58
0
        public bool TryDoCommand(Players.Player player, string chat, List <string> splits)
        {
            if (!chat.Trim().ToLower().StartsWith("//info"))
            {
                return(false);
            }

            if (!CommandHelper.CheckCommand(player))
            {
                return(true);
            }

            AdvancedWand wand = AdvancedWand.GetAdvancedWand(player);

            Vector3Int start = wand.area.corner1;
            Vector3Int end   = wand.area.corner2;

            Dictionary <ushort, int> info = new Dictionary <ushort, int>();


            for (int x = start.x; x <= end.x; x++)
            {
                for (int y = start.y; y <= end.y; y++)
                {
                    for (int z = start.z; z <= end.z; z++)
                    {
                        Vector3Int newPos = new Vector3Int(x, y, z);
                        if (World.TryGetTypeAt(newPos, out ushort actualType))
                        {
                            ItemTypes.ItemType type = ItemTypes.GetType(actualType);
                            if (!ItemTypes.NotableTypes.Contains(type))
                            {
                                while (type.ParentItemType != null)
                                {
                                    type = type.ParentItemType;
                                }
                                actualType = type.ItemIndex;
                            }

                            if (info.TryGetValue(actualType, out int value))
                            {
                                info[actualType] = value + 1;
                            }
                            else
                            {
                                info[actualType] = 1;
                            }
                        }
                    }
                }
            }

            //Las camas son de dos bloques
            if (info.ContainsKey(ItemTypes.IndexLookup.GetIndex("bed")))
            {
                info[ItemTypes.IndexLookup.GetIndex("bed")] /= 2;
            }

            Chat.Send(player, "<color=olive>Area info:</color>");

            foreach (ushort key in info.Keys)
            {
                if (key == 0)
                {
                    continue;
                }
                string name = ItemTypes.IndexLookup.GetName(key);
                Chat.Send(player, string.Format("<color=lime>{0}({1}): {2}</color>", name, key, info[key]));
            }

            return(true);
        }
Beispiel #59
0
 public Furniture(ItemTypes Item)
 {ItemType = Item;}
Beispiel #60
0
 protected override bool MeetsCondition(Player player, object value) => (value == null ? false : ItemTypes.Contains((value as Item).itemType));