Example #1
0
 public Item(string itemName, string itemDesc, int itemID, ItemType itemType)
 {
     this.itemName = itemName;
     this.itemDesc = itemDesc;
     this.itemID = itemID;
     this.itemType = itemType;
 }
 public CalendarItem(ItemType type, DateTime date, string header, string subject)
 {
     Type = type;
     Header = header;
     Date = date;
     Subject = subject;
 }
Example #3
0
 public Item(ItemType type, IDictionary<FieldType, string> fields)
 {
     Type = type;
     FieldKeys = fields.Keys.ToList();
     FieldValues = new List<StoredString>();
     fields.Values.ForEach(s => FieldValues.Add(new StoredString {Value = s}));
 }
Example #4
0
 private static string ReadUIDItem(DICOMBinaryReader dr, string itemName, ItemType iType)
 {
     AssertItemType(dr, itemName, iType);
     dr.Skip(2); // PDU ID and Reserved Null Byte
     int length = LengthReader.ReadBigEndian(dr, 2);
     return dr.ReadString(length).Trim();
 }
Example #5
0
		public PhotoStub(
			string guid,
			ItemType type,
			string dateTime,
			string roomGuid,
			int width,
			int height,
			string url,
			string web,
			string icon,
			string thumb,
			int thumbWidth,
			int thumbHeight,
			bool buddyAlert)
			: base(guid, type, dateTime, roomGuid)
		{
			this.width = width;
			this.height = height;
			this.url = url;
			this.web = web;
			this.icon = icon;
			this.thumb = thumb;
			this.thumbWidth = thumbWidth;
			this.thumbHeight = thumbHeight;
			this.buddyAlert = buddyAlert;
		}
Example #6
0
 public Item(Vector2 miejsce, float czasPierwszy, float czasZatrzymania, ItemType coTo, int inf1, int inf2)
 {
     pozycja = miejsce;
     timeOfExistence = czasPierwszy;
     lockTime = czasZatrzymania;
     typItemu = coTo;
     info1 = inf1; info2 = inf2;
     nrWarstwy = 2;
     if (coTo == ItemType.grenades)
         nazwa = "Grenades";
     if (coTo == ItemType.health)
         nazwa = "Health";
     if (coTo == ItemType.laser)
         nazwa = "Laser Gun";
     if (coTo == ItemType.machineGun)
         nazwa = "Machine Gun";
     if (coTo == ItemType.pistol)
         nazwa = "Pistol";
     if (coTo == ItemType.rocketLauncher)
         nazwa = "Rocket Launcher";
     if (coTo == ItemType.shield)
         nazwa = "Shield";
     if (coTo == ItemType.shotgun)
         nazwa = "Shotgun";
     typ = Type.item;
     wielkoscObiektu = new Vector2(1, 1);
 }
Example #7
0
 public void CreateItemsFromAFolder(
     string storageConnectionString,
     string storeName,
     string applicationName,
     string folderPath,
     string searchPattern,
     ItemType itemType)
 {
     using (IAzManStorage storage = new SqlAzManStorage(storageConnectionString))
     {
         storage.OpenConnection();
         storage.BeginTransaction();
         try
         {
             IAzManApplication app = storage.GetStore(storeName).GetApplication(applicationName);
             DirectoryInfo di = new DirectoryInfo(folderPath);
             foreach (FileInfo fi in di.GetFiles(searchPattern))
             {
                 //Use some recursive function to get subfolder files
                 app.CreateItem(fi.Name, String.Empty, itemType);
             }
             storage.CommitTransaction();
         }
         catch
         {
             storage.RollBackTransaction();
         }
         finally
         {
             storage.Dispose();
         }
     }
 }
Example #8
0
    public void PreInit()
    {
		currentItemType = ItemType.A;
		
        titleText.maxWidth = background.width - titleTextSidePadding;
        titleText.Text = "Store";
		
		//RESIZE THE SCROLL LIST. IT WILL ALBWAYS BE IN SAME SIZE AND POSITION BASED ON BACKGROUND
		itemScrollList.viewableArea = new Vector2(background.width * 0.8f, background.height * 0.5f); //80% X 50%
		Vector2 newItemScrollListPosition = EZGUIExtensions.GetPositionFromParentSprite(background, new Vector2(50, 70));
		itemScrollList.transform.localPosition = new Vector3(newItemScrollListPosition.x, newItemScrollListPosition.y, itemScrollList.transform.localPosition.z);
        itemScrollList.ResizeBCToViewableArea();
        itemScrollList.SetupCameraAndSizes();

        itemScrollList.itemSpacing = background.width * 0.02f;
		
		topBarScrollList.viewableArea = new Vector2(background.width, background.height * 0.2f);
		topBarScrollList.transform.localPosition = new Vector3(itemScrollList.transform.localPosition.x, itemScrollList.transform.localPosition.y + ( (itemScrollList.viewableArea.y / 2) + topBarScrollList.viewableArea.y), topBarScrollList.transform.localPosition.z);
		topBarScrollList.ResizeBCToViewableArea();
		topBarScrollList.SetupCameraAndSizes();
		
		SetUpTopBarButtons();
		
		PopulateItemScrollList(ItemType.Eqpmnt); //default to equipment
    }
Example #9
0
	void Start()
	{
		TextBox = new TextBox();

		if (Randomize == true)
		{
			int randomIndex = UnityEngine.Random.Range(0, RandomItems.Length);
			Type = RandomItems[randomIndex];
			Quantity = 1;
		}

		temp = new Item(Type);
		temp.Quantity = Quantity;

		if (Quantity == 1)
		{
			TextBox.addText("You received " + temp.Quantity + " " + temp.Name);
		}
		else if (Quantity > 1)
		{
			TextBox.addText("You received " + temp.Quantity + " " + temp.Name + "s");
		}

		sRenderer = GetComponent<SpriteRenderer>();
		BoxColl = GetComponent<BoxCollider2D>();
		Player = GameObject.FindWithTag("Player").GetComponent<PlayerControls>();
	}
Example #10
0
 public Item(ItemType itemType)
 {
     ObjectType = DrawableObjectType.Item;
     this.type = itemType;
     Collidable = false;
     LoadContent();
 }
Example #11
0
 private void SetDefault(ItemType choice)
 {
     if (choice != ItemType.Customized)
     {
         if (choice == ItemType.Normal)
         {
             this.Parts.Add(Job.Function.LaserCutter);
             this.Parts.Add(Job.Function.Bending);
             this.Parts.Add(Job.Function.Assembling);
         }
         else if (choice == ItemType.Bread)
         {
             this.Parts.Add(Job.Function.Milling);
             this.Parts.Add(Job.Function.LaserCutter);
             this.Parts.Add(Job.Function.Bending);
             this.Parts.Add(Job.Function.Assembling);
         }
         else if (choice == ItemType.Toast)
         {
             this.Parts.Add(Job.Function.Milling);
             this.Parts.Add(Job.Function.Punching);
             this.Parts.Add(Job.Function.LaserCutter);
             this.Parts.Add(Job.Function.Shears);
             this.Parts.Add(Job.Function.Bending);
             this.Parts.Add(Job.Function.Assembling);
         }
         else if (choice == ItemType.Press)
         {
             this.Parts.Add(Job.Function.Milling);
             this.Parts.Add(Job.Function.Bending);
             this.Parts.Add(Job.Function.Assembling);
         }
     }
 }
Example #12
0
        private int width = 0; // Level width in items

        #endregion Fields

        #region Constructors

        /// <summary>
        /// Constructor.
        /// </summary>
        /// <param name="aName">Level name</param>
        /// <param name="aLevelMap">Level map</param>
        /// <param name="aWidth">Level width</param>
        /// <param name="aHeight">Level height</param>
        /// <param name="aNrOfGoals">Number of goals</param>
        /// <param name="aLevelNr">Level number</param>
        /// <param name="aLevelSetName">Set name that level belongs to</param>
        public Scenario(string aName, ItemType[,] aLevelMap, int aWidth, int aHeight)
        {
            name = aName;
            width = aWidth;
            height = aHeight;
            levelMap = aLevelMap;
        }
Example #13
0
        public IEnumerable<Item> GetLatest(ItemType? type, DateTime? fromDate, DateTime? toDate, int? limit)
        {
            var query = this.Items.AsQueryable();

            if (type.HasValue)
            {
                query = query.Where(i => i.ItemType == type.Value);
            }

            if (fromDate.HasValue)
            {
                query = query.Where(i => i.Published > fromDate.Value);
            }

            if (toDate.HasValue)
            {
                query = query.Where(i => i.Published < toDate.Value);
            }

            query = query.OrderByDescending(i => i.Published);

            if (limit.HasValue)
            {
                query = query.Take(limit.Value);
            }

            return query.ToList();
        }
Example #14
0
 private ColorScheme GetColor(ItemType item)
 {
     if (craft.Stores[item] > 0)
         return ColorScheme.White;
     var isAmmo = item.Metadata().AmmoForWeapon != null;
     return isAmmo ? ColorScheme.Purple : ColorScheme.Blue;
 }
Example #15
0
 public ChangeRequest(string path, string target, RequestType requestType, ItemType itemType)
 {
     this.item = new ItemSpec(path, RecursionType.None);
     this.target = target;
     this.requestType = requestType;
     this.itemType = itemType;
 }
 public BaseItem(string id, ItemType type, int price)
 {
     Id = id;
     Type = type;
     Name = "TEMP NAME";
     Price = price;
 }
Example #17
0
 internal MapItem(ItemType type, uint count, uint offset)
 {
     Type = type;
     Count = count;
     Offset = offset;
     return;
 }
Example #18
0
 public CalendarItem(ItemType type, DateTime date, string header, string subject)
 {
     this.Type = type;
     this.Header = header;
     this.Date = date;
     this.Subject = subject;
 }
 /// <summary>
 /// Constructs a new item entitiy.
 /// </summary>
 /// <param name="location">Position of the item (point).</param>
 /// <param name="itemType">Type of item (itemtype).</param>
 public ItemEntity(Point location, ItemType itemType)
     : base("Item" + itemType.ToString(), InitBounding(location, itemType), 1)
 {
     _itemType = itemType;
     _flag = itemType == ItemType.Star;
     _movement = new Gravity(new Vector(0, -3), new Vector(0, 0.1), 1.8);
 }
Example #20
0
 public Item(ItemType typeGet, Player playerGet, Sadako sadakoGet, Rectangle hitBoxGet)
 {
     type = typeGet;
     player = playerGet;
     sadako = sadakoGet;
     hitBox = hitBoxGet;
 }
Example #21
0
 public static Icon GetIcon(string path, ItemType type, IconSize size, ItemState state)
 {
     var flags = (uint)(Interop.SHGFI_ICON | Interop.SHGFI_USEFILEATTRIBUTES);
     var attribute = (uint)(object.Equals(type, ItemType.Folder) ? Interop.FILE_ATTRIBUTE_DIRECTORY : Interop.FILE_ATTRIBUTE_FILE);
     if (object.Equals(type, ItemType.Folder) && object.Equals(state, ItemState.Open))
     {
         flags += Interop.SHGFI_OPENICON;
     }
     if (object.Equals(size, IconSize.Small))
     {
         flags += Interop.SHGFI_SMALLICON;
     }
     else
     {
         flags += Interop.SHGFI_LARGEICON;
     }
     var shfi = new SHFileInfo();
     var res = Interop.SHGetFileInfo(path, attribute, out shfi, (uint)Marshal.SizeOf(shfi), flags);
     if (object.Equals(res, IntPtr.Zero)) throw Marshal.GetExceptionForHR(Marshal.GetHRForLastWin32Error());
     try
     {
         Icon.FromHandle(shfi.hIcon);
         return (Icon)Icon.FromHandle(shfi.hIcon).Clone();
     }
     catch
     {
         throw;
     }
     finally
     {
         Interop.DestroyIcon(shfi.hIcon);
     }
 }
Example #22
0
    /// <summary>
    /// Init the specified type, amt, rangeminx, rangemaxx, rangeminy, rangemaxy and emit.
    /// </summary>
    /// <param name="type">Type.</param>
    /// <param name="amt">Amount.</param>
    /// <param name="rangeminx">Minimum Range of X value.</param>
    /// <param name="rangemaxx">Maximum Range of X value.</param>
    /// <param name="rangeminy">Minimum Range of Y value.</param>
    /// <param name="rangemaxy">Minimum Range of Y value.</param>
    /// <param name="emit">Type of Emission.</param>
    public void Init(ItemType[] type, int[] amt, float rangeminx, float rangemaxx, float rangeminy, float rangemaxy, 
						EmitType emit = EmitType.Impulse)
    {
        if(type.Length != amt.Length)
        {
            Debug.LogError("Total number of types and total number of amounts are different");
            return;
        }

        for(int i = 0; i < type.Length; ++i)
        {
            map.Add(type[i], amt[i]);
        }

        m_rangeMinX = rangeminx;
        m_rangeMaxX = rangemaxx;
        m_rangeMinY = rangeminy;
        m_rangeMaxY = rangemaxy;

        List<ItemType> keys = new List<ItemType>(map.Keys);

        m_type = emit;

        foreach(ItemType tp in keys)
        {
            if(m_type == EmitType.Impulse)
                ImpulseFire(tp, map[tp]);
            else
                StartCoroutine(CreateItemsWithInterval(tp, map[tp]));
        }
    }
Example #23
0
        /// <summary>
        /// Get item for type and identifier.
        /// </summary>
        /// <param name="type">Type of item.</param>
        /// <param name="ident">Identifier of item.</param>
        /// <returns>Unspecified common item.</returns>
        public IItem get(ItemType type, Ident ident)
        {
            bool isFull = (ident.guid != null && ident.item != null);
            switch(type)
            {
                case ItemType.EW:
                {
                    // check with part from identifier
                    IItem item = itemEW.FirstOrDefault(i => (isFull && ident.guid.CompareGuids(i.Key.guid) && ident.item == i.Key.item)
                                                                || (!isFull && ident.guid != null && ident.guid.CompareGuids(i.Key.guid))
                                                                || (!isFull && ident.item != null && ident.item == i.Key.item)
                                                      ).Value;

                    if(item == null && isFull) {
                        itemEW[ident] = new ItemEW();
                        return itemEW[ident];
                    }
                    else if(item == null && ident.item == Settings._.DefaultOWPItem) { //TODO:
                        return new ItemEW();
                    }
                    else if(item == null) {
                        throw new NotFoundException("OWP Items-EW: The '{0}:{1}' is not found.", ident.guid, ident.item);
                    }
                    return item;
                }
            }
            throw new NotFoundException("OWP Items: Type '{0}' is not supported.", type);
        }
 public System.Collections.Generic.IEnumerable<Int32> LoadYears(ItemType itemType)
 {
     System.Collections.Generic.List<DateTime> source = (from p in
                                                             (from p in ViewModelLocator.AccountItemViewModel.AccountBookDataContext.AccountItems
                                                              where ((int)p.Type) == ((int)itemType)
                                                              select p.CreateTime.Date).Distinct<System.DateTime>()
                                                         orderby p.Year descending
                                                         select p).ToList<System.DateTime>();
     System.Collections.Generic.List<Int32> list2 = (from p in source select p.Year).Distinct<int>().ToList<int>();
     System.Collections.Generic.List<Int32> list3 = null;
     using (System.Collections.Generic.List<int>.Enumerator enumerator = list2.GetEnumerator())
     {
         System.Func<DateTime, Boolean> predicate = null;
         int year;
         while (enumerator.MoveNext())
         {
             year = enumerator.Current;
             if (predicate == null)
             {
                 predicate = p => p.Year == year;
             }
             list3 = (from p in
                          (from p in source.Where<System.DateTime>(predicate) select p.Month).Distinct<int>()
                      orderby p descending
                      select p).ToList<int>();
             if (list3.Count != 0)
             {
                 this.yearWithMonths[year] = list3;
             }
         }
     }
     return list2;
 }
Example #25
0
 public Stat(string name, Range<float> range, ItemType itemType, ItemModTier parentTier)
 {
     Name = name;
     Range = range;
     ParentTier = parentTier;
     ItemType = itemType;
 }
Example #26
0
        public void RemoveDemand(ItemType supply, decimal amountToRemove)
        {
            var totalRemoved = 0.0m;

            var amountRemainingToRemove = amountToRemove;

            while (totalRemoved < amountToRemove
                && HasDemand(supply)) {
                var demandsFound = (from d in Demands
                    where d.Supply == supply
                    && d.Amount > 0
                    select d).ToArray();

                if (demandsFound.Length > 0) {
                    var demandFound = demandsFound [0];

                    if (demandFound.Amount > amountToRemove) {
                        demandFound.Amount -= amountRemainingToRemove;

                        totalRemoved += amountToRemove;
                    }
                    else {
                        Demands.Remove (demandFound);
                        amountRemainingToRemove -= demandFound.Amount;

                        totalRemoved += demandFound.Amount;
                    }
                }
            }
        }
Example #27
0
 public ItemDemand(Person person, ItemType needType, decimal amount)
 {
     throw new NotImplementedException ();
     /*Person = person;
     Supply = needType;
     Amount = amount;*/
 }
Example #28
0
    public List<t_ObjectProto> GetTypeItems(ItemType type)
    {
        if (type == ItemType.None)
            return mItemList;

        List<t_ObjectProto> typeitems = new List<t_ObjectProto>();
        foreach (t_ObjectProto dbdata in mItemList)
        {
            if (dbdata.itemDefine)
            {
                switch (type)
                {
                    case ItemType.Other:
                        {
                            if (dbdata.itemDefine.type > ItemType.Other)
                                typeitems.Add(dbdata);
                        }
                        break;
                    default:
                        {
                            if (dbdata.itemDefine.type == type)
                                typeitems.Add(dbdata);
                        }
                        break;
                }
            }
        }
        return typeitems;
    }
Example #29
0
 public Item(ItemType type, Vector2 pos)
 {
     Type = type;
     Position = pos;
     Active = true;
     Rotation = (float)Helper.Random.NextDouble() * MathHelper.Pi;
 }
Example #30
0
 public FileItem(string fullPath, ItemType type, FilesystemItemProvider provider)
 {
     FullPath = fullPath;
     ItemType = type;
     _itemProvider = provider;
     SetNameFromFullPath();
 }
Example #31
0
 public static bool IsAmmo(this ItemType itemType)
 {
     return(itemType == ItemType.Ammo556 || itemType == ItemType.Ammo762 || itemType == ItemType.Ammo9mm);
 }
 public UserDetailsCellViewModel(ItemType type)
 {
     this.type = type;
 }
 public UI_ItemSlot this [ItemType type] => GetSlotByItemType(type);
    public static UI_ItemSlot GetSlotByItemType(ItemType type)
    {
        string eventName = "storage02";

        switch (type)
        {
        case ItemType.Back:
            eventName = "back";
            break;

        case ItemType.Belt:
            eventName = "belt";
            break;

        case ItemType.Ear:
            eventName = "ear";
            break;

        case ItemType.Glasses:
            eventName = "glasses";
            break;

        case ItemType.Gloves:
            eventName = "hands";
            break;

        case ItemType.Hat:
            eventName = "head";
            break;

        case ItemType.ID:
            eventName = "id";
            break;

        case ItemType.PDA:
            eventName = "id";
            break;

        case ItemType.Mask:
            eventName = "mask";
            break;

        case ItemType.Neck:
            eventName = "neck";
            break;

        case ItemType.Shoes:
            eventName = "feet";
            break;

        case ItemType.Suit:
            eventName = "suit";
            break;

        case ItemType.Uniform:
            eventName = "uniform";
            break;

        case ItemType.Gun:
            eventName = "suitStorage";
            break;
        }

        return(GetSlotByEvent(eventName));
    }
        private bool CheckTilePermission(TSPlayer player, DPoint location, BlockType blockType, int objectStyle, PaintColor paint, bool dropItem = false)
        {
            switch (blockType)
            {
            case BlockType.Statue: {
                DPoint originTileLocation = new DPoint(location.X, location.Y - 2);
                if (!TerrariaUtils.Tiles.IsObjectWired(originTileLocation, new DPoint(2, 3)))
                {
                    break;
                }
                StatueStyle  statueStyle = TerrariaUtils.Tiles.GetStatueStyle(objectStyle);
                StatueConfig statueConfig;
                if (!this.Config.StatueConfigs.TryGetValue(statueStyle, out statueConfig) || statueConfig == null)
                {
                    break;
                }

                if (!player.Group.HasPermission(statueConfig.WirePermission))
                {
                    player.SendTileSquareEx(location, 10);

                    if (dropItem)
                    {
                        ItemType itemTypeToDrop;
                        itemTypeToDrop = TerrariaUtils.Tiles.GetItemTypeFromStatueStyle(statueStyle);

                        Item.NewItem(location.X * TerrariaUtils.TileSize, location.Y * TerrariaUtils.TileSize, 0, 0, (int)itemTypeToDrop);
                    }

                    this.TellNoStatueWiringPermission(player, statueStyle);
                    return(false);
                }

                break;
            }

            case BlockType.DartTrap: {
                Tile destTile = TerrariaUtils.Tiles[location];
                if (!destTile.HasWire())
                {
                    break;
                }
                TrapConfig    trapConfig;
                TrapStyle     trapStyle = TerrariaUtils.Tiles.GetTrapStyle(destTile.frameY / 18);
                TrapConfigKey configKey = new TrapConfigKey(trapStyle, paint);
                if (!this.Config.TrapConfigs.TryGetValue(configKey, out trapConfig))
                {
                    break;
                }

                if (!player.Group.HasPermission(trapConfig.WirePermission))
                {
                    player.SendTileSquareEx(location, 10);

                    if (dropItem)
                    {
                        ItemType itemTypeToDrop = TerrariaUtils.Tiles.GetItemTypeFromTrapStyle(trapStyle);
                        Item.NewItem(location.X * TerrariaUtils.TileSize, location.Y * TerrariaUtils.TileSize, 0, 0, (int)itemTypeToDrop);
                    }

                    this.TellMissingComponentWiringPermission(player, blockType);
                    return(false);
                }

                break;
            }

            case BlockType.Boulder: {
                DPoint originTileLocation = new DPoint(location.X - 1, location.Y - 1);
                if (!TerrariaUtils.Tiles.IsObjectWired(originTileLocation, new DPoint(2, 2)))
                {
                    break;
                }

                if (!player.Group.HasPermission(AdvancedCircuitsPlugin.WireBoulder_Permission))
                {
                    player.SendTileSquareEx(location, 10);

                    if (dropItem)
                    {
                        Item.NewItem(location.X * TerrariaUtils.TileSize, location.Y * TerrariaUtils.TileSize, 0, 0, (int)ItemType.Boulder);
                    }

                    this.TellMissingComponentWiringPermission(player, blockType);
                    return(false);
                }

                break;
            }

            case BlockType.Sign: {
                if (!TerrariaUtils.Tiles.IsObjectWired(location, new DPoint(2, 2)))
                {
                    break;
                }

                if (!player.Group.HasPermission(AdvancedCircuitsPlugin.WireSign_Permission))
                {
                    player.SendTileSquareEx(location, 10);

                    if (dropItem)
                    {
                        Item.NewItem(location.X * TerrariaUtils.TileSize, location.Y * TerrariaUtils.TileSize, 0, 0, (int)ItemType.Sign);
                    }

                    this.TellMissingComponentWiringPermission(player, blockType);
                    return(false);
                }

                break;
            }

            case BlockType.InletPump:
            case BlockType.OutletPump: {
                DPoint originTileLocation = new DPoint(location.X - 1, location.Y - 1);
                if (!TerrariaUtils.Tiles.IsObjectWired(originTileLocation, new DPoint(2, 2)))
                {
                    break;
                }
                PumpConfig pumpConfig;
                if (!this.Config.PumpConfigs.TryGetValue(paint, out pumpConfig))
                {
                    break;
                }
                if (string.IsNullOrEmpty(pumpConfig.WirePermission))
                {
                    break;
                }

                if (!player.Group.HasPermission(pumpConfig.WirePermission))
                {
                    player.SendTileSquareEx(location, 10);

                    if (dropItem)
                    {
                        ItemType itemTypeToDrop = ItemType.OutletPump;
                        if (blockType == BlockType.InletPump)
                        {
                            itemTypeToDrop = ItemType.InletPump;
                        }

                        Item.NewItem(location.X * TerrariaUtils.TileSize, location.Y * TerrariaUtils.TileSize, 0, 0, (int)itemTypeToDrop);
                    }

                    this.TellMissingComponentWiringPermission(player, blockType);
                    return(false);
                }

                break;
            }

            case AdvancedCircuits.BlockType_WirelessTransmitter: {
                if (!AdvancedCircuits.IsComponentWiredByPort(location, new DPoint(1, 1)))
                {
                    break;
                }
                WirelessTransmitterConfig transmitterConfig;
                if (!this.Config.WirelessTransmitterConfigs.TryGetValue(paint, out transmitterConfig))
                {
                    break;
                }

                if (!player.Group.HasPermission(transmitterConfig.WirePermission))
                {
                    player.SendTileSquareEx(location, 1);

                    if (dropItem)
                    {
                        Item.NewItem(location.X * TerrariaUtils.TileSize, location.Y * TerrariaUtils.TileSize, 0, 0, (int)ItemType.AdamantiteOre);
                    }

                    this.TellMissingComponentWiringPermission(player, blockType);
                    return(false);
                }

                break;
            }

            case BlockType.Teleporter: {
                DPoint originTileLocation = new DPoint(location.X - 1, location.Y - 1);
                if (!TerrariaUtils.Tiles.IsObjectWired(originTileLocation, new DPoint(3, 1)))
                {
                    break;
                }

                if (!player.Group.HasPermission(AdvancedCircuitsPlugin.WireTeleporter_Permission))
                {
                    player.SendTileSquareEx(location, 10);

                    if (dropItem)
                    {
                        Item.NewItem(location.X * TerrariaUtils.TileSize, location.Y * TerrariaUtils.TileSize, 0, 0, (int)ItemType.Teleporter);
                    }

                    this.TellMissingComponentWiringPermission(player, blockType);
                    return(false);
                }

                break;
            }
            }

            return(true);
        }
Example #36
0
 public void setType(ItemType itemType)
 {
     this._itemType = itemType;
 }
Example #37
0
    void DisplayAddMainArea()
    {
        _rightScrollPos = EditorGUILayout.BeginScrollView(_rightScrollPos, "box", GUILayout.ExpandHeight(true));
        nextID          = itemDatabase.GetNextID();
        GUILayout.Label(new GUIContent("ID: " + nextID.ToString()), EditorStyles.boldLabel);
        itemType = (ItemType)EditorGUILayout.EnumPopup(new GUIContent("Item Type: "), itemType, GUILayout.Width(300));

        itemSprite    = (Sprite)EditorGUILayout.ObjectField(new GUIContent("Sprite: "), itemSprite, typeof(Sprite), true);
        itemName      = EditorGUILayout.TextField(new GUIContent("Name: "), itemName);
        itemMaxStack  = Convert.ToInt32(EditorGUILayout.TextField(new GUIContent("Max Stack: "), itemMaxStack.ToString()));
        goldValue     = Convert.ToInt32(EditorGUILayout.TextField(new GUIContent("Gold Value: "), goldValue.ToString()));
        isDefaultItem = Convert.ToBoolean(EditorGUILayout.Toggle(new GUIContent("Default: "), isDefaultItem));

        switch (itemType)
        {
        case ItemType.BASIC:
            isUseable = Convert.ToBoolean(EditorGUILayout.Toggle(new GUIContent("Usable: "), isUseable));
            break;

        case ItemType.CONSUMABLE:
            isUseable = Convert.ToBoolean(EditorGUILayout.Toggle(new GUIContent("Usable: "), true));
            hp        = Convert.ToInt32(EditorGUILayout.TextField(new GUIContent("Total HP Regenerate: "), hp.ToString()));
            mp        = Convert.ToInt32(EditorGUILayout.TextField(new GUIContent("Total MP Regenerate: "), mp.ToString()));
            sp        = Convert.ToInt32(EditorGUILayout.TextField(new GUIContent("Total SP Regenerate: "), sp.ToString()));
            dur       = Convert.ToInt32(EditorGUILayout.TextField(new GUIContent("Effect Duration: "), dur.ToString()));
            break;

        case ItemType.EQUIPMENT:
            equipType = (EquipSlot)EditorGUILayout.EnumPopup(new GUIContent("Equip Type: "), equipType, GUILayout.Width(300));
            if (equipType == EquipSlot.Weapon)
            {
                weaponType = (WeaponType)EditorGUILayout.EnumPopup(new GUIContent("Weapon Type: "), weaponType, GUILayout.Width(300));
            }
            isUseable = Convert.ToBoolean(EditorGUILayout.Toggle(new GUIContent("Usable: "), true));
            str       = Convert.ToInt32(EditorGUILayout.TextField(new GUIContent("Strength: "), str.ToString()));
            dex       = Convert.ToInt32(EditorGUILayout.TextField(new GUIContent("Dexterity: "), dex.ToString()));
            inte      = Convert.ToInt32(EditorGUILayout.TextField(new GUIContent("Intelligence: "), inte.ToString()));
            will      = Convert.ToInt32(EditorGUILayout.TextField(new GUIContent("Will: "), will.ToString()));
            luck      = Convert.ToInt32(EditorGUILayout.TextField(new GUIContent("Luck: "), luck.ToString()));
            minDam    = Convert.ToInt32(EditorGUILayout.TextField(new GUIContent("Min.Damage: "), minDam.ToString()));
            maxDam    = Convert.ToInt32(EditorGUILayout.TextField(new GUIContent("Max.Damage: "), maxDam.ToString()));
            bal       = Convert.ToInt32(EditorGUILayout.TextField(new GUIContent("Balance: "), bal.ToString()));
            crit      = Convert.ToInt32(EditorGUILayout.TextField(new GUIContent("Critical: "), crit.ToString()));
            pDef      = Convert.ToInt32(EditorGUILayout.TextField(new GUIContent("P.Defense: "), pDef.ToString()));
            pPro      = Convert.ToInt32(EditorGUILayout.TextField(new GUIContent("P.Protection: "), pPro.ToString()));
            mDef      = Convert.ToInt32(EditorGUILayout.TextField(new GUIContent("M.Defense: "), mDef.ToString()));
            mPro      = Convert.ToInt32(EditorGUILayout.TextField(new GUIContent("M.Protection: "), mPro.ToString()));
            break;

        default:
            Debug.LogError("Unrecognized ItemType");
            break;
        }
        itemTooltip = EditorGUILayout.TextField(new GUIContent("Tooltip: "), itemTooltip, GUILayout.Height(100));

        EditorGUILayout.Space();

        if (GUILayout.Button("Add", GUILayout.Width(100)))
        {
            itemDatabase.ClearNextID();
            switch (itemType)
            {
            case ItemType.BASIC:
            {
                Item newItem = (Item)CreateInstance(typeof(Item));
                newItem.ItemInit(nextID, itemName, itemSprite, isDefaultItem, isUseable, itemMaxStack, itemTooltip, goldValue);
                AssetDatabase.CreateAsset(newItem, DATABASE_PATH_ITEMS + String.Format("{0}.asset", nextID.ToString("000")));
                itemDatabase.Add(newItem);
                EditorUtility.SetDirty(newItem);
            }
            break;

            case ItemType.CONSUMABLE:
            {
                Consumable newItem = (Consumable)CreateInstance(typeof(Consumable));
                newItem.ItemInit(nextID, itemName, itemSprite, isDefaultItem, isUseable, itemMaxStack, itemTooltip, goldValue, hp, mp, sp, dur);
                AssetDatabase.CreateAsset(newItem, DATABASE_PATH_ITEMS + String.Format("{0}.asset", nextID.ToString("000")));
                itemDatabase.Add(newItem);
                EditorUtility.SetDirty(newItem);
            }
            break;

            case ItemType.EQUIPMENT:
            {
                Equipment newItem = (Equipment)CreateInstance(typeof(Equipment));
                newItem.ItemInit(nextID, itemName, itemSprite, isDefaultItem, equipType, weaponType, isUseable, itemMaxStack, itemTooltip, goldValue, str, dex, inte, will, luck, minDam, maxDam, bal, crit, pDef, pPro, mDef, mPro);
                AssetDatabase.CreateAsset(newItem, DATABASE_PATH_ITEMS + String.Format("{0}.asset", nextID.ToString("000")));
                itemDatabase.Add(newItem);
                EditorUtility.SetDirty(newItem);
            }
            break;

            default:
                Debug.LogError("Unrecognized ItemType");
                break;
            }

            itemName      = String.Format("NewItem({0})", itemDatabase.GetNextID().ToString("000"));
            itemMaxStack  = 0;
            str           = 0; dex = 0; inte = 0; will = 0; luck = 0;
            minDam        = 0; maxDam = 0; bal = 0; crit = 0; pDef = 0; pPro = 0; mDef = 0; mPro = 0;
            hp            = 0; mp = 0; sp = 0; dur = 0; goldValue = 0;
            isDefaultItem = false;
            isUseable     = false;
            itemTooltip   = "Tooltip MISSING!";
            itemSprite    = null;
            state         = State.BLANK;
            itemDatabase.SortAlphabeticallyAtoZ();
            EditorUtility.SetDirty(itemDatabase);
            AssetDatabase.SaveAssets();
            AssetDatabase.Refresh();
        }
        EditorGUILayout.EndScrollView();
    }
Example #38
0
 /// <summary>
 /// 设置数据
 /// </summary>
 /// <param name="id"></param>
 /// <param name="name"></param>
 /// <param name="quality"></param>
 /// <param name="type"></param>
 /// <param name="description"></param>
 /// <param name="amount"></param>
 /// <param name="capacity"></param>
 /// <param name="buyprice"></param>
 /// <param name="sellprice"></param>
 /// <param name="sprite"></param>
 public void SetData(int id, string name, ItemQuality quality, ItemType type, string description, int amount, int capacity, int buyprice, int sellprice)
 {
     base.SetData(id, name, quality, type, description, amount, capacity, buyprice, sellprice);
 }
Example #39
0
    public void init(bool worldItem, int _itemId, string _itemName, string _itemDescr, int _itemValue, Sprite _itemSprite, ItemType _itemType, bool _stackable)
    {
        this._itemId              = _itemId;
        this._itemName            = transform.name = _itemName;
        this._itemDescr           = _itemDescr;
        this._itemValue           = _itemValue;
        this._itemInventorySprite = _itemSprite;
        this._itemType            = _itemType;
        this._itemCount           = 1;
        this._itemStackable       = _stackable;

        if (!worldItem)
        {
            initUI();
        }
    }
        // Metode for å skaffe item navn
        public static string GetName (MarketRole role)
        {
            List<string> stringList = new List<string>();

            // Navn til varer
            if (role == MarketRole.ITEM) {
                Array value = Enum.GetValues(typeof(ItemType));
                ItemType type = (ItemType)value.GetValue(ranNum.Next(value.Length));

                // switch-case for type for å sørge for at navnet passer typen
                switch (type) {
                    case ItemType.CLOTHING:
                        stringList.Add("shoe");
                        stringList.Add("shorts");
                        stringList.Add("shirt");
                        stringList.Add("cap");
                        break;
                    case ItemType.DRINK:
                        stringList.Add("pepsi");
                        stringList.Add("cola");
                        stringList.Add("water");
                        stringList.Add("fanta");
                        break;
                    case ItemType.FOOD:
                        stringList.Add("apple");
                        stringList.Add("lasagne");
                        stringList.Add("taco");
                        stringList.Add("meatballs");
                        break;
                    case ItemType.FURNITURE:
                        stringList.Add("desk");
                        stringList.Add("chair");
                        stringList.Add("sofa");
                        stringList.Add("dinner table");
                        break;
                    case ItemType.TOY:
                        stringList.Add("teddy bear");
                        stringList.Add("toycar");
                        stringList.Add("lego");
                        stringList.Add("action figure");
                        break;
                }
            // Navn til shops
            } else if (role == MarketRole.SHOP) {
                stringList.Add("Cool shop");
                stringList.Add("Super duper emporium");
                stringList.Add("Starbuck");
                stringList.Add("Ebay shop");
                stringList.Add("Amazon shop");
                stringList.Add("Burger King shop");
                stringList.Add("Westerdals shop");
                stringList.Add("Kiwi");
                stringList.Add("Ikea");
            // Navn til customers
            } else if (role == MarketRole.CUSTOMER) {
                stringList.Add("Per");
                stringList.Add("Bob");
                stringList.Add("Jessica");
                stringList.Add("Alex");
                stringList.Add("Alexander");
                stringList.Add("Margrethe");
                stringList.Add("Vincent");
                stringList.Add("Leo");
                stringList.Add("Jay");
                stringList.Add("George");
                stringList.Add("Andrea");
                stringList.Add("Haakon");
                stringList.Add("Bjarne");
            }

            // Setter index til random for å få et random indeks av stringList
            int index = ranNum.Next(stringList.Count);
            string name = stringList[index];

            return name;
        }
Example #41
0
        public Dictionary <CellType, Boolean> GetAvaliableCells(DateTime nDate, List <dtoUserStatExtended> statistics, ItemType type, Boolean isAutoEp, Boolean isTimeBased, dtoExportConfigurationSetting settings, ExporPathData exportData)
        {
            Dictionary <CellType, Boolean> cells = GetAvaliableCells(nDate, type, isAutoEp, isTimeBased, settings, exportData);

            //cells[CellType.Deadline] = statistics.Users.Where(p => p.StDeadline.HasValue).Any();
            //cells[CellType.StartDate] = statistics.Users.Where(u => u.StStartDate.HasValue).Any();
            //cells[CellType.EndDate] =statistics.Users.Where(u => u.StEndDate.HasValue).Any();

            //cells[CellType.PathName] = true;
            //cells[CellType.FirstActivityOn] = true;

            //Boolean advancedInfo = settings.isRequiredField(ExportFieldType.QuestionnaireAdvancedInfo, exportData);
            //Boolean certificationInfo = settings.isRequiredField(ExportFieldType.QuestionnaireCertificationInfo, exportData);


            if (statistics.Any())
            {
                Boolean loadAgencyInfo = settings.isRequiredField(ExportFieldType.AgencyInfo, exportData);
                // cells[CellType.AgencyStart] = loadAgencyInfo && statistics.usersStat.Where(p => p.StStartDate.HasValue).Any() && Manager.UsersHasAgencyAffiliations(statistics.UserId.Select(u => u.UserId).ToList(), statistics.Users.Where(p => p.StStartDate.HasValue).Select(p => p.StStartDate.Value).Min(), statistics.Users.Where(p => p.StStartDate.HasValue).Select(p => p.StStartDate.Value).Max());
                // cells[CellType.AgencyEnd] = loadAgencyInfo && statistics.usersStat.Where(p => p.StEndDate.HasValue).Any() && Manager.UsersHasAgencyAffiliations(statistics.UserId.Select(u => u.UserId).ToList(), statistics.Users.Where(p => p.StEndDate.HasValue).Select(p => p.StStartDate.Value).Min(), statistics.Users.Where(p => p.StEndDate.HasValue).Select(p => p.StStartDate.Value).Max());
                cells[CellType.AgencyCurrent] = loadAgencyInfo && Manager.UsersHasAgencyAffiliations(statistics.Select(u => u.UserId).ToList(), nDate);
            }
            return(cells);
        }
Example #42
0
    public void ChangeWeaponTrigger()
    {
        if (canChange == false || aniInfo.IsName("Attack"))
        {
            return;
        }
        switch (weaponType)
        {
        case ItemType.LongHandle:
            if (fightData.ss != null)
            {
                weaponType        = ItemType.SwordShield;
                roledata.WeaponId = fightData.ss.itemID;
                ChangeWeapon();
            }
            else if (fightData.wand != null)
            {
                weaponType        = ItemType.Wand;
                roledata.WeaponId = fightData.wand.itemID;
                ChangeWeapon();
            }
            else
            {
                return;
            }
            break;

        case ItemType.SwordShield:
            if (fightData.wand != null)
            {
                weaponType        = ItemType.Wand;
                roledata.WeaponId = fightData.wand.itemID;
                ChangeWeapon();
            }
            else if (fightData.sword != null)
            {
                weaponType        = ItemType.LongHandle;
                roledata.WeaponId = fightData.sword.itemID;
                ChangeWeapon();
            }
            else
            {
                return;
            }
            break;

        case ItemType.Wand:
            if (fightData.sword != null)
            {
                weaponType        = ItemType.LongHandle;
                roledata.WeaponId = fightData.sword.itemID;
                ChangeWeapon();
            }
            else if (fightData.ss != null)
            {
                weaponType        = ItemType.SwordShield;
                roledata.WeaponId = fightData.ss.itemID;
                ChangeWeapon();
            }
            else
            {
                return;
            }
            break;
        }
    }
Example #43
0
        internal static bool PickupItemValidation(CacheItem item)
        {
            //if (FunkyTownRunPlugin.ItemRulesEval != null)
            //{
            //	Interpreter.InterpreterAction action = FunkyTownRunPlugin.ItemRulesEval.checkPickUpItem(item.DynamicID.Value, item.BalanceData.thisItemType, item.ref_DiaItem.Name, item.InternalName, item.Itemquality.Value, item.BalanceData.iThisItemLevel, item.BalanceData.bThisOneHand, item.BalanceData.bThisTwoHand, item.BalanceID.Value, ItemEvaluationType.PickUp);
            //	if (action== Interpreter.InterpreterAction.PICKUP)
            //	{
            //		return true;
            //	}
            //}


            // Calculate giles item types and base types etc.
            PluginItemTypes     thisPluginItemType = PluginItemTypes.Unknown;
            PluginBaseItemTypes thisGilesBaseType  = PluginBaseItemTypes.Unknown;

            if (item.BalanceID.HasValue && item.BalanceData != null)
            {
                thisPluginItemType = item.BalanceData.PluginType;
                thisGilesBaseType  = item.BalanceData.PluginBase;
            }
            else
            {
                thisPluginItemType = ItemFunc.DetermineItemType(item.InternalName, ItemType.Unknown, FollowerType.None,
                                                                item.SNOID);
                thisGilesBaseType = ItemFunc.DetermineBaseType(thisPluginItemType);
            }


            if (thisPluginItemType == PluginItemTypes.MiscBook)
            {
                return(FunkyBaseExtension.Settings.Loot.ExpBooks);
            }

            if (thisPluginItemType == PluginItemTypes.RamaladnisGift)
            {
                return(true);
            }

            // Error logging for DemonBuddy item mis-reading
            ItemType gilesDBItemType = ItemFunc.PluginItemTypeToDBItemType(thisPluginItemType);

            if (item.BalanceID.HasValue && item.BalanceData != null && gilesDBItemType != item.BalanceData.Type)
            {
                Logger.DBLog.InfoFormat("GSError: Item type mis-match detected: Item Internal=" + item.InternalName + ". DemonBuddy ItemType thinks item type is=" + item.BalanceData.Type + ". Giles thinks item type is=" +
                                        gilesDBItemType + ". [pickup]", true);
            }

            switch (thisGilesBaseType)
            {
            case PluginBaseItemTypes.WeaponTwoHand:
            case PluginBaseItemTypes.WeaponOneHand:
            case PluginBaseItemTypes.WeaponRange:
            case PluginBaseItemTypes.Armor:
            case PluginBaseItemTypes.Offhand:
            case PluginBaseItemTypes.Jewelry:
            case PluginBaseItemTypes.FollowerItem:

                if (FunkyBaseExtension.Settings.Loot.PickupWhiteItems == 1 &&
                    FunkyBaseExtension.Settings.Loot.PickupMagicItems == 1 &&
                    FunkyBaseExtension.Settings.Loot.PickupRareItems == 1 &&
                    FunkyBaseExtension.Settings.Loot.PickupLegendaryItems == 1)
                {
                    return(true);
                }

                if (item.Itemquality.HasValue && item.BalanceID.HasValue && item.BalanceData != null)
                {
                    switch (item.Itemquality.Value)
                    {
                    case ItemQuality.Inferior:
                    case ItemQuality.Normal:
                    case ItemQuality.Superior:
                        return(FunkyBaseExtension.Settings.Loot.PickupWhiteItems > 0 && (item.BalanceData.ItemLevel >= FunkyBaseExtension.Settings.Loot.PickupWhiteItems));

                    case ItemQuality.Magic1:
                    case ItemQuality.Magic2:
                    case ItemQuality.Magic3:
                        return(FunkyBaseExtension.Settings.Loot.PickupMagicItems > 0 && (item.BalanceData.ItemLevel >= FunkyBaseExtension.Settings.Loot.PickupMagicItems));

                    case ItemQuality.Rare4:
                    case ItemQuality.Rare5:
                    case ItemQuality.Rare6:
                        return(FunkyBaseExtension.Settings.Loot.PickupRareItems > 0 && (item.BalanceData.ItemLevel >= FunkyBaseExtension.Settings.Loot.PickupRareItems));

                    case ItemQuality.Legendary:
                        return(FunkyBaseExtension.Settings.Loot.PickupLegendaryItems > 0 && (item.BalanceData.ItemLevel >= FunkyBaseExtension.Settings.Loot.PickupLegendaryItems));
                    }
                }

                return(false);

            case PluginBaseItemTypes.Gem:
                if (thisPluginItemType == PluginItemTypes.LegendaryGem)
                {
                    return(true);
                }

                GemQualityTypes qualityType  = ItemFunc.ReturnGemQualityType(item.SNOID, item.BalanceData != null?item.BalanceData.ItemLevel:-1);
                int             qualityLevel = (int)qualityType;

                if (qualityLevel < FunkyBaseExtension.Settings.Loot.MinimumGemItemLevel ||
                    (thisPluginItemType == PluginItemTypes.Ruby && !FunkyBaseExtension.Settings.Loot.PickupGems[0]) ||
                    (thisPluginItemType == PluginItemTypes.Emerald && !FunkyBaseExtension.Settings.Loot.PickupGems[1]) ||
                    (thisPluginItemType == PluginItemTypes.Amethyst && !FunkyBaseExtension.Settings.Loot.PickupGems[2]) ||
                    (thisPluginItemType == PluginItemTypes.Topaz && !FunkyBaseExtension.Settings.Loot.PickupGems[3]) ||
                    (thisPluginItemType == PluginItemTypes.Diamond && !FunkyBaseExtension.Settings.Loot.PickupGemDiamond))
                {
                    return(false);
                }
                break;

            case PluginBaseItemTypes.Misc:
                // Note; Infernal keys are misc, so should be picked up here - we aren't filtering them out, so should default to true at the end of this function
                if (thisPluginItemType == PluginItemTypes.CraftingMaterial)
                {
                    return(FunkyBaseExtension.Settings.Loot.PickupCraftMaterials);
                }
                if (thisPluginItemType == PluginItemTypes.LegendaryCraftingMaterial)
                {
                    return(true);
                }

                if (thisPluginItemType == PluginItemTypes.CraftingPlan)
                {
                    if (!FunkyBaseExtension.Settings.Loot.PickupCraftPlans)
                    {
                        return(false);
                    }

                    if (item.BalanceID.HasValue && item.BalanceData != null)
                    {
                        if (item.BalanceData.IsBlacksmithPlanSixProperties && !FunkyBaseExtension.Settings.Loot.PickupBlacksmithPlanSix)
                        {
                            return(false);
                        }
                        if (item.BalanceData.IsBlacksmithPlanFiveProperties && !FunkyBaseExtension.Settings.Loot.PickupBlacksmithPlanFive)
                        {
                            return(false);
                        }
                        if (item.BalanceData.IsBlacksmithPlanFourProperties && !FunkyBaseExtension.Settings.Loot.PickupBlacksmithPlanFour)
                        {
                            return(false);
                        }

                        if (item.BalanceData.IsBlacksmithPlanArchonSpaulders && !FunkyBaseExtension.Settings.Loot.PickupBlacksmithPlanArchonSpaulders)
                        {
                            return(false);
                        }
                        if (item.BalanceData.IsBlacksmithPlanArchonGauntlets && !FunkyBaseExtension.Settings.Loot.PickupBlacksmithPlanArchonGauntlets)
                        {
                            return(false);
                        }
                        if (item.BalanceData.IsBlacksmithPlanRazorspikes && !FunkyBaseExtension.Settings.Loot.PickupBlacksmithPlanRazorspikes)
                        {
                            return(false);
                        }


                        if (item.BalanceData.IsJewelcraftDesignAmulet && !FunkyBaseExtension.Settings.Loot.PickupJewelerDesignAmulet)
                        {
                            return(false);
                        }
                        if (item.BalanceData.IsJewelcraftDesignFlawlessStarGem && !FunkyBaseExtension.Settings.Loot.PickupJewelerDesignFlawlessStar)
                        {
                            return(false);
                        }
                        if (item.BalanceData.IsJewelcraftDesignMarquiseGem && !FunkyBaseExtension.Settings.Loot.PickupJewelerDesignMarquise)
                        {
                            return(false);
                        }
                        if (item.BalanceData.IsJewelcraftDesignPerfectStarGem && !FunkyBaseExtension.Settings.Loot.PickupJewelerDesignPerfectStar)
                        {
                            return(false);
                        }
                        if (item.BalanceData.IsJewelcraftDesignRadiantStarGem && !FunkyBaseExtension.Settings.Loot.PickupJewelerDesignRadiantStar)
                        {
                            return(false);
                        }
                    }
                }

                if (thisPluginItemType == PluginItemTypes.InfernalKey)
                {
                    return(FunkyBaseExtension.Settings.Loot.PickupInfernalKeys);
                }

                if (thisPluginItemType == PluginItemTypes.KeyStone)
                {
                    return(FunkyBaseExtension.Settings.Loot.PickupKeystoneFragments);
                }

                if (thisPluginItemType == PluginItemTypes.BloodShard)
                {
                    return(Backpack.GetBloodShardCount() < 500);
                }

                // Potion filtering
                if (thisPluginItemType == PluginItemTypes.HealthPotion || thisPluginItemType == PluginItemTypes.LegendaryHealthPotion)
                {
                    PotionTypes potionType = ItemFunc.ReturnPotionType(item.SNOID);
                    if (potionType == PotionTypes.Regular)
                    {
                        if (FunkyBaseExtension.Settings.Loot.MaximumHealthPotions <= 0)
                        {
                            return(false);
                        }


                        var BestPotionToUse = Backpack.ReturnBestPotionToUse();
                        if (BestPotionToUse == null)
                        {
                            return(true);
                        }

                        var Potions = Backpack.ReturnRegularPotions();
                        if (Potions.Sum(potions => potions.ThisItemStackQuantity) >= FunkyBaseExtension.Settings.Loot.MaximumHealthPotions)
                        {
                            return(false);
                        }
                    }
                }


                break;

            case PluginBaseItemTypes.HealthGlobe:
                return(false);

            case PluginBaseItemTypes.Unknown:
                return(false);

            default:
                return(false);
            }             // Switch giles base item type
            // Didn't cancel it, so default to true!
            return(true);
        }
Example #44
0
 public async Task <List <Player> > SubDoc(ItemType itemType)
 {
     return(await _repository.SubDoc(itemType));
 }
Example #45
0
        public override IEnumerable <Dependency> ReadDependencies(WorkingGraph readingGraph, int depth, bool ignoreCase)
        {
            Log.WriteInfo("Reading " + FullFileName);
            Regex dipArrow = new Regex($@"\s*{Dependency.DIP_ARROW}\s*");

            var  result          = new List <Dependency>(10000);
            bool thereAreProxies = false;

            using (var sr = new StreamReader(FullFileName)) {
                var itemsDictionary = new Dictionary <Item, Item>();

                for (int lineNo = 1; ; lineNo++)
                {
                    string line = sr.ReadLine();
                    if (line == null)
                    {
                        break;
                    }
                    // Remove comments
                    line = Regex.Replace(line, "//.*$", "").Trim();
                    if (line == "")
                    {
                        continue;
                    }
                    if (line.StartsWith("$"))
                    {
                        ItemType itemType = ItemType.New(line.TrimStart('$').Trim());
                        if (!_registeredItemTypes.ContainsKey(itemType.Name))
                        {
                            _registeredItemTypes.Add(itemType.Name, itemType);
                        }
                    }
                    else
                    {
                        string[] parts = dipArrow.Split(line);

                        if (parts.Length != 3)
                        {
                            WriteError(FullFileName, lineNo, $"Line is not ... {Dependency.DIP_ARROW} #;#;... {Dependency.DIP_ARROW} ..., but " + parts.Length, line);
                        }

                        try {
                            Item foundUsingItem = GetOrCreateItem(parts[0].Trim(), itemsDictionary, readingGraph);
                            Item foundUsedItem  = GetOrCreateItem(parts[2].Trim(), itemsDictionary, readingGraph);

                            bool pointsToProxy = foundUsingItem is ItemProxy || foundUsedItem is ItemProxy;
                            thereAreProxies |= pointsToProxy;

                            string[] properties = parts[1].Split(new[] { ';' }, 6);
                            int      ct, questionableCt, badCt;
                            string   dependencyMarkers = Get(properties, 0).TrimStart('\''); // TODO: Remove the Trim ... this seems like a format uncertainty!

                            if (!int.TryParse(Get(properties, 1, "1"), out ct))
                            {
                                throw new DipReaderException($"Cannot parse count '{Get(properties, 1)}'");
                            }
                            if (!int.TryParse(Get(properties, 2, "0"), out questionableCt))
                            {
                                throw new DipReaderException($"Cannot parse questionableCt '{Get(properties, 2)}'");
                            }
                            if (!int.TryParse(Get(properties, 3, "0"), out badCt))
                            {
                                throw new DipReaderException($"Cannot parse badCt '{Get(properties, 3)}'");
                            }

                            string[]        source   = Get(properties, 4).Split('|');
                            ISourceLocation location = AbstractSourceLocation.Create(source);

                            string exampleInfo = Get(properties, 5);

                            Dependency dependency = readingGraph.CreateDependency(foundUsingItem, foundUsedItem, location,
                                                                                  dependencyMarkers, ct, questionableCt, badCt,
                                                                                  notOkReason: questionableCt > 0 || badCt > 0 ? FullFileName + "/" + lineNo : null, exampleInfo: exampleInfo);

                            result.Add(dependency);
                        } catch (DipReaderException ex) {
                            WriteError(FullFileName, lineNo, ex.Message + " - ignoring input line", line);
                        }
                    }
                }

                Log.WriteInfo($"... read {result.Count} dependencies from {FullFileName}");
                _readingContext.IncCount(result.Count);

                if (thereAreProxies)
                {
                    var    proxies = new HashSet <ItemProxy>(itemsDictionary.Keys.OfType <ItemProxy>());
                    Item[] items   = itemsDictionary.Keys.Where(i => !(i is ItemProxy)).ToArray();
                    foreach (var item in items)
                    {
                        foreach (var matchingProxy in proxies.Where(p => p.ProxyMatches(item)).ToArray())
                        {
                            itemsDictionary[matchingProxy] = item;
                            proxies.Remove(matchingProxy);
                        }
                    }

                    return(result.Select(d => ResolveItemProxies(readingGraph, d, itemsDictionary)).ToArray());
                }
                else
                {
                    return(result);
                }
            }
        }
 public bool SendCreativeInventoryAction(int slot, ItemType item, int count, Dictionary <string, object> nbt)
 {
     return(false); //Currently not implemented
 }
Example #47
0
    public void Init()
    {
        RoleData tempData = HeroManager.Instance.GetCurHeroData();

        roledata = new RoleData(
            tempData.ID,
            tempData.Name,
            tempData.Prefab,
            tempData.HP,
            tempData.BaseExp,
            tempData.LV,
            tempData.Exp,
            tempData.ATK,
            tempData.DEF,
            tempData.Speed,
            tempData.ATKSpeed,
            tempData.Crit,
            tempData.Repel,
            tempData.WeaponId,
            tempData.ArmorId,
            //TODO
            //因为先加载了角色加载器 所以背包管理器是空的 所以拿不到背包里面的东西
            tempData.Weapon,
            tempData.Armor,
            tempData.StrSkillList,
            tempData.SkillList
            );
        //Debug.Log(PackageManager.Instance.GetItem<Equip>(roledata.WeaponId));
        curATK    = (int)(roledata.ATK * (roledata.LV / 2 + 0.5f)) + PackageManager.Instance.GetItem <Equip>(roledata.WeaponId).ATK;
        curRepel  = roledata.Repel + PackageManager.Instance.GetItem <Equip>(roledata.WeaponId).Repel - 3;
        moveSpeed = roledata.Speed;

        takeList  = new List <GameObject>();
        rightHard = transform.Find("Root/Hips/Spine_01/Spine_02/Spine_03/Clavicle_R/Shoulder_R/Elbow_R/Hand_R");
        leftHard  = transform.Find("Root/Hips/Spine_01/Spine_02/Spine_03/Clavicle_L/Shoulder_L/Elbow_L/Hand_L");
        weapon    = rightHard.GetChild(rightHard.childCount - 1);
        curSkill  = null;
        //cc.enabled = true;
        //canMove = true;
        atkNum     = 0;
        isDead     = false;
        rollDir    = Vector3.zero;
        curHp      = roledata.HP * roledata.LV;
        ItemCD     = -1;
        curItemCD  = 0;
        skillList  = HeroSkillManager.Instance.GetSkillList();
        weaponType = ItemType.LongHandle;
        curAniName = new System.Text.StringBuilder();
        BindSkillCD();
        //排序技能顺序
        quickSort(curSkillList);

        fightData = FightTmpManager.Instance.GetData();
        //TODO 要改为 roledata.Prefab
        //List<int> aa = Tool.Instance.GetShortcut("1#3#4|4#0#0");
        List <int> aa = Tool.Instance.GetShortcut(roledata.Prefab);

        fightData.sword       = PackageManager.Instance.GetItem <Equip>(aa[0]);
        fightData.ss          = PackageManager.Instance.GetItem <Equip>(aa[1]);
        fightData.wand        = PackageManager.Instance.GetItem <Equip>(aa[2]);
        fightData.consumable1 = PackageManager.Instance.GetItem <Consumables>(aa[3]);
        fightData.consumable2 = PackageManager.Instance.GetItem <Consumables>(aa[4]);
        fightData.consumable3 = PackageManager.Instance.GetItem <Consumables>(aa[5]);

        consumablesList = new List <Consumables>()
        {
            fightData.consumable1, fightData.consumable2, fightData.consumable3
        };
        BindItemCD();
    }
Example #48
0
 public ContentAttribute(ItemType type, string name)
 {
     _type = type;
     Name  = name;
 }
Example #49
0
 /*********
 ** Public methods
 *********/
 /// <summary>Construct an instance.</summary>
 /// <param name="type">The item type.</param>
 /// <param name="id">The unique ID (if different from the item's parent sheet index).</param>
 /// <param name="item">The item instance.</param>
 public SearchableItem(ItemType type, int id, Item item)
 {
     this.Type = type;
     this.ID   = id;
     this.Item = item;
 }
Example #50
0
 void Setup(ItemType it, int n)
 {
     itemType = it;
     amount   = n;
 }
Example #51
0
        //protected FFHtmlWriter(TextWriter writer):
        //    base(writer, string.Empty)
        //{
        //    //Indent = 0;
        //}

        public FFHtmlWriter(ItemType item)
            : base(new StreamWriter(item.PageHref, false, Encoding.UTF8) { AutoFlush = false })
        {
        }
Example #52
0
 public ItemStack(ItemType it)
 {
     Setup(it, 1);
 }
Example #53
0
    public void InitFromLuaFile()
    {
        SLua.LuaTable _table;
        //Script prefix path: Assets/Scripts/Lua/
        //read file
        SLua.LuaSvr.getInstance().doFile("Items/" + m_LuaScript);

        //functions
        OnUse    += _CastFunc(SLua.LuaSvr.mainState["OnUse"]);
        OnUpdate += _CastFunc(SLua.LuaSvr.mainState["OnUpdate"]);
        OnHit    += _CastFunc(SLua.LuaSvr.mainState["OnHit"]);

        //load all the properties
        _table = (SLua.LuaTable)SLua.LuaSvr.mainState["properties"];

        //load mesh
        m_Prefab = (string)_table["Mesh"];
        GameObject _tmp = Resources.Load <GameObject>("Meshes/" + m_Prefab);

        _tmp = Instantiate(_tmp);
        gameObject.AddComponent <MeshFilter>();
        gameObject.AddComponent <MeshRenderer>();
        gameObject.GetComponent <MeshFilter>().mesh   = _tmp.GetComponent <MeshFilter>().mesh;
        gameObject.GetComponent <Renderer>().material = _tmp.GetComponent <Renderer>().material;
        gameObject.transform.localScale = _tmp.transform.localScale;
        GameObject.Destroy(_tmp);
        if (gameObject.GetComponent <Transceiver>() == null)
        {
            gameObject.AddComponent <Transceiver>();
        }
        gameObject.GetComponent <Transceiver>().AddResolver("Duplicate", OnDuplicate);


        //attributes
        m_ItemName    = (string)_table["Name"];
        m_Description = (string)_table["Description"];

        m_Type = (ItemType)System.Convert.ToInt32(_table["Type"]);
        switch (m_Type)
        {
        case ItemType.ITEM_WEAPON:
            m_WeaponType  = (WeaponType)System.Convert.ToInt32(_table["ShotType"]);
            m_AttackSpeed = System.Convert.ToSingle(_table["AttackSpeed"]);
            m_EnergyCost  = System.Convert.ToSingle(_table["EnergyCost"]);
            m_Damage      = System.Convert.ToSingle(_table["FirePower"]);
            break;

        case ItemType.ITEM_PARTS:
            m_Damage     = System.Convert.ToSingle(_table["Damage"]);
            m_Projectile = (string)_table["Ammo"];
            break;

        case ItemType.ITEM_ARMOR:
            m_Armor = System.Convert.ToSingle(_table["Armor"]);
            break;

        default:
            break;
        }
        m_Weight = System.Convert.ToSingle(_table["Weight"]);

        SLua.LuaTable _bonus = (SLua.LuaTable)_table["Bonus"];
        m_BonusList = new DAttributeBonus[_bonus.length()];
        for (int i = 1; i <= _bonus.length(); i++)
        {
            SLua.LuaTable _oneBonus = (SLua.LuaTable)_bonus[i];
            m_BonusList[i - 1] = new DAttributeBonus(
                (AttrType)System.Convert.ToInt32(_oneBonus[1]),
                System.Convert.ToSingle(_oneBonus[3]),
                System.Convert.ToBoolean(_oneBonus[2])
                );
        }

        m_bIfLoaded = true;
    }
Example #54
0
 public ItemStack(string itemName, int n)
 {
     Setup(ItemType.GetItemTypeWithName(itemName), n);
 }
Example #55
0
 public ItemStack(ItemType it, int n)
 {
     Setup(it, n);
 }