示例#1
0
	private void AddCollectionItemButton(CollectionItem item) {
		CollectionItemButton button = Instantiate(collectionItemButtonPrefab);
		button.transform.SetParent(transform);
		button.transform.localPosition = Vector3.zero;
		button.transform.localScale = new Vector3(1, 1, 1);
		button.SetCollectionItem(item);
	}
	public void SetCollectionItem(CollectionItem item) {
		CollectionItemSprite firstSprite = item.GetFirstSprite();
		tk2dSpriteCollectionData spriteCollection = firstSprite.GetSpriteCollectionData();
		if (firstSprite == null || !firstSprite.HasValidSpriteName()) return;
		float spriteScale = firstSprite.GetSpriteScale();
		string spriteName = firstSprite.spriteName;
		sprite.SetSprite(spriteCollection, spriteName);
		sprite.scale = new Vector3(spriteScale, spriteScale, 1);
	}
示例#3
0
        public ConfirmRewardGump(IComunityCollection collection, Point3D location, CollectionItem item, int hue)
            : base()
        {
            this.m_Collection = collection;
            this.m_Location = location;
            this.m_Item = item;
            this.m_Hue = hue;

            if (this.m_Item != null)
                this.AddItem(150, 100, this.m_Item.ItemID, this.m_Item.Hue);
        }
 protected void EBtnSubmit_Click(object sender, EventArgs e)
 {
     if (this.Page.IsValid)
     {
         string str = this.TxtUrl.Text.Trim();
         if (string.IsNullOrEmpty(str))
         {
             AdminPage.WriteErrMsg("采集URL地址不能为空!");
         }
         else if (str.Length < 8)
         {
             AdminPage.WriteErrMsg("采集URL不是有效的URL地址!");
         }
         else if (str.Substring(0, 7) != "http://")
         {
             AdminPage.WriteErrMsg("采集URL不是有效的URL地址!");
         }
         else
         {
             bool flag;
             CollectionItemInfo collectionItemInfo = new CollectionItemInfo();
             collectionItemInfo.ItemName       = this.TxtItemName.Text;
             collectionItemInfo.NodeId         = DataConverter.CLng(this.NodeType1.FieldValue);
             collectionItemInfo.InfoNodeId     = this.NodeType1.InfoNodeId;
             collectionItemInfo.Url            = str;
             collectionItemInfo.UrlName        = this.TxtWebSite.Text;
             collectionItemInfo.CodeType       = this.RadlCodeType.SelectedValue;
             collectionItemInfo.MaxNum         = DataConverter.CLng(this.TxtMaxNum.Text);
             collectionItemInfo.OrderType      = DataConverter.CLng(this.RadlOrder.SelectedValue);
             collectionItemInfo.Intro          = this.TxtIntro.Text;
             collectionItemInfo.SpecialId      = this.SpecialId.FieldValue;
             collectionItemInfo.AutoCreateHtml = DataConverter.CBoolean(this.RadlAutoCreateHtml.SelectedValue);
             bool flag2 = false;
             if (this.HdnAction.Value == "Modify")
             {
                 collectionItemInfo.ItemId    = BasePage.RequestInt32("ItemID");
                 collectionItemInfo.ModelId   = DataConverter.CLng(this.HiddenModel.Value);
                 collectionItemInfo.Detection = DataConverter.CBoolean(this.HdnDetection.Value);
                 if (collectionItemInfo.ItemName == this.HdnItemName.Value)
                 {
                     flag = false;
                 }
                 else
                 {
                     flag = CollectionItem.Exists(collectionItemInfo.ItemName);
                 }
             }
             else
             {
                 collectionItemInfo.Detection = false;
                 collectionItemInfo.ModelId   = DataConverter.CLng(this.DropModelId.SelectedValue);
                 flag = CollectionItem.Exists(collectionItemInfo.ItemName);
             }
             if (flag)
             {
                 AdminPage.WriteErrMsg("<li>数据库中已经存在此采集项目!</li>");
             }
             if (this.HdnAction.Value == "Modify")
             {
                 flag2 = CollectionItem.Update(collectionItemInfo);
             }
             else
             {
                 flag2 = CollectionItem.Add(collectionItemInfo);
             }
             if (flag2)
             {
                 BasePage.ResponseRedirect("ConfigStep2.aspx?Action=" + this.HdnAction.Value + "&ItemId=" + collectionItemInfo.ItemId.ToString());
             }
             else
             {
                 AdminPage.WriteErrMsg("保存采集配置第一步失败!");
             }
         }
     }
 }
 internal void AddItem(CollectionItem collectionItem)
 {
     this.items.Add(collectionItem);
 }
示例#6
0
 /// <summary>
 /// Adds a type to this collection.
 /// </summary>
 /// <param name="collectionItem">CollectionItem representing the type to add.</param>
 public void AddItem(CollectionItem collectionItem)
 {
     this.items.Add(collectionItem);
 }
        public IActionResult Create([FromBody] CollectionItem newentry)
        {
            var result = _repository.Add(newentry);

            return(Helper.CheckResult(result));
        }
        public void DisplayRewardPage()
        {
            int points = m_Owner.GetCollectionPoints(m_Collection.CollectionID);

            AddPage(m_Page);

            // title
            AddHtmlLocalized(50, 65, 150, 20, 1072843, 0x1, false, false); // Your Reward Points:
            AddLabel(230, 65, 0x64, points.ToString());
            AddImageTiled(35, 85, 270, 2, 0x23C5);
            AddHtmlLocalized(35, 90, 270, 20, 1072844, 0x1, false, false); // Please Choose a Reward:

            // rewards
            int offset = 110;
            int next   = 0;

            while (offset + next < 300 && m_Index < m_Collection.Rewards.Count)
            {
                CollectionItem item = m_Collection.Rewards[m_Index];

                if (item.QuestItem && SkipQuestReward(m_Owner, item))
                {
                    m_Index++;
                    continue;
                }

                int height = Math.Max(item.Height, 20);

                if (points >= item.Points && item.CanSelect(m_Owner))
                {
                    AddButton(35, offset + height / 2 - 5, 0x837, 0x838, 200 + m_Index, GumpButtonType.Reply, 0);
                    TextDefinition.AddTooltip(this, item.Tooltip);
                }

                int y = offset - item.Y;

                if (item.Height < 20)
                {
                    y += (20 - item.Height) / 2;
                }

                AddItem(55 - item.X + m_Max / 2 - item.Width / 2, y, item.ItemID, points >= item.Points ? item.Hue : 0x3E9);
                TextDefinition.AddTooltip(this, item.Tooltip);
                AddLabel(65 + m_Max, offset + height / 2 - 10, points >= item.Points ? 0x64 : 0x21, item.Points.ToString());
                TextDefinition.AddTooltip(this, item.Tooltip);

                offset  += 5 + height;
                m_Index += 1;

                if (m_Index < m_Collection.Donations.Count)
                {
                    next = Math.Max(m_Collection.Donations[m_Index].Height, 20);
                }
                else
                {
                    next = 0;
                }
            }

            // buttons
            AddButton(50, 335, 0x15E3, 0x15E7, (int)Buttons.Status, GumpButtonType.Reply, 0);
            AddHtmlLocalized(75, 335, 100, 20, 1072845, 0x1, false, false); // Status

            if (m_Page > 1)
            {
                AddButton(150, 335, 0x15E3, 0x15E7, (int)Buttons.Next, GumpButtonType.Page, m_Page - 1);
                AddHtmlLocalized(170, 335, 60, 20, 1074880, 0x1, false, false); // Previous
            }

            m_Page += 1;

            if (m_Index < m_Collection.Rewards.Count)
            {
                AddButton(300, 335, 0x15E1, 0x15E5, (int)Buttons.Next, GumpButtonType.Page, m_Page);
                AddHtmlLocalized(240, 335, 60, 20, 1072854, 0x1, false, false); // <div align=right>Next</div>
            }
        }
示例#9
0
        public void MergeFrom(AtlasInventoryItem other)
        {
            if (other == null)
            {
                return;
            }
            switch (other.TypeCase)
            {
            case TypeOneofCase.Profile:
                if (Profile == null)
                {
                    Profile = new global::WUProtos.Data.Player.PlayerProfile();
                }
                Profile.MergeFrom(other.Profile);
                break;

            case TypeOneofCase.VaultItem:
                if (VaultItem == null)
                {
                    VaultItem = new global::WUProtos.Inventory.InventoryVaultItem();
                }
                VaultItem.MergeFrom(other.VaultItem);
                break;

            case TypeOneofCase.CollectionItem:
                if (CollectionItem == null)
                {
                    CollectionItem = new global::WUProtos.Inventory.InventoryCollectionItem();
                }
                CollectionItem.MergeFrom(other.CollectionItem);
                break;

            case TypeOneofCase.CollectionFamily:
                if (CollectionFamily == null)
                {
                    CollectionFamily = new global::WUProtos.Inventory.InventoryCollectionFamily();
                }
                CollectionFamily.MergeFrom(other.CollectionFamily);
                break;

            case TypeOneofCase.Walkbox:
                if (Walkbox == null)
                {
                    Walkbox = new global::WUProtos.Inventory.InventoryWalkboxItem();
                }
                Walkbox.MergeFrom(other.Walkbox);
                break;

            case TypeOneofCase.PlayerFlags:
                if (PlayerFlags == null)
                {
                    PlayerFlags = new global::WUProtos.Inventory.InventoryFeatureFlags();
                }
                PlayerFlags.MergeFrom(other.PlayerFlags);
                break;

            case TypeOneofCase.Portkey:
                if (Portkey == null)
                {
                    Portkey = new global::WUProtos.Inventory.InventoryPortkeyItem();
                }
                Portkey.MergeFrom(other.Portkey);
                break;

            case TypeOneofCase.PlayerActiveBuffList:
                if (PlayerActiveBuffList == null)
                {
                    PlayerActiveBuffList = new global::WUProtos.Data.Buff.ActiveBuffList();
                }
                PlayerActiveBuffList.MergeFrom(other.PlayerActiveBuffList);
                break;

            case TypeOneofCase.CollectionPage:
                if (CollectionPage == null)
                {
                    CollectionPage = new global::WUProtos.Inventory.InventoryCollectionPage();
                }
                CollectionPage.MergeFrom(other.CollectionPage);
                break;

            case TypeOneofCase.VaultCapacity:
                if (VaultCapacity == null)
                {
                    VaultCapacity = new global::WUProtos.Inventory.InventoryVaultCapacity();
                }
                VaultCapacity.MergeFrom(other.VaultCapacity);
                break;

            case TypeOneofCase.Cauldron:
                if (Cauldron == null)
                {
                    Cauldron = new global::WUProtos.Inventory.InventoryCauldron();
                }
                Cauldron.MergeFrom(other.Cauldron);
                break;

            case TypeOneofCase.EscrowedRewards:
                if (EscrowedRewards == null)
                {
                    EscrowedRewards = new global::WUProtos.Inventory.InventoryEscrowedRewards();
                }
                EscrowedRewards.MergeFrom(other.EscrowedRewards);
                break;

            case TypeOneofCase.ProfessionsProgressV3:
                if (ProfessionsProgressV3 == null)
                {
                    ProfessionsProgressV3 = new global::WUProtos.Data.Player.PlayerProfessionsProgressV3();
                }
                ProfessionsProgressV3.MergeFrom(other.ProfessionsProgressV3);
                break;

            case TypeOneofCase.QuestLog:
                if (QuestLog == null)
                {
                    QuestLog = new global::WUProtos.Inventory.InventoryQuestLog();
                }
                QuestLog.MergeFrom(other.QuestLog);
                break;

            case TypeOneofCase.Achievement:
                if (Achievement == null)
                {
                    Achievement = new global::WUProtos.Data.Player.PlayerAchievement();
                }
                Achievement.MergeFrom(other.Achievement);
                break;
            }

            _unknownFields = pb::UnknownFieldSet.MergeFrom(_unknownFields, other._unknownFields);
        }
示例#10
0
 public CollectionItem(object value, CollectionItem parent)
 {
     Value  = value;
     Parent = parent;
 }
示例#11
0
 public InternalPrompt(IComunityCollection collection, CollectionItem selected, Point3D location)
 {
     this.m_Collection = collection;
     this.m_Selected = selected;
     this.m_Location = location;
 }
示例#12
0
	public void RemoveItem() {
		this.equippedItem = null;
		Save();
	}
示例#13
0
 public ConfirmRewardGump(IComunityCollection collection, Point3D location, CollectionItem item)
     : this(collection, location, item, 0)
 {
 }
        ///// <summary>
        ///// Update
        ///// </summary>
        ///// <param name="connectionInfo">The connection information.</param>
        ///// <param name="entity">The entity.</param>
        ///// <returns></returns>
        //public IProcessResult Update(IConnectionInfo connectionInfo, CollectionItem entity)
        //{
        //    return UpdateInternal(connectionInfo, entity).Result;
        //}

        /// <summary>
        /// Update Async
        /// </summary>
        /// <param name="connectionInfo">The connection information.</param>
        /// <param name="entity">The entity.</param>
        /// <returns></returns>
        public async Task <IProcessResult> UpdateAsync(IConnectionInfo connectionInfo, CollectionItem entity)
        {
            return(await UpdateInternal(connectionInfo, entity));
        }
        ///// <summary>
        ///// Select
        ///// </summary>
        ///// <param name="connectionInfo">The connection information.</param>
        ///// <param name="filter">The filter.</param>
        ///// <returns></returns>
        //public List<CollectionItem> Select(IConnectionInfo connectionInfo, CollectionItem filter)
        //{
        //    return SelectInternal(connectionInfo, filter).Result;
        //}

        /// <summary>
        /// Select Async
        /// </summary>
        /// <param name="connectionInfo">The connection information.</param>
        /// <param name="filter">The filter.</param>
        /// <returns></returns>
        public async Task <List <CollectionItem> > SelectAsync(IConnectionInfo connectionInfo, CollectionItem filter)
        {
            return(await SelectInternal(connectionInfo, filter));
        }
示例#16
0
        public override DataItem LoadData(XElement element, UndoRedoManager undoRedo)
        {
            var item = new CollectionItem(this, undoRedo);

            if (Collapse && ChildDefinitions.Count == 1 && ChildDefinitions[0].WrappedDefinition is PrimitiveDataDefinition)
            {
                var primDef = ChildDefinitions[0].WrappedDefinition as PrimitiveDataDefinition;
                var split   = element.Value.Split(new string[] { Seperator }, StringSplitOptions.None);
                foreach (var s in split)
                {
                    var child = primDef.LoadFromString(s, undoRedo);
                    var citem = ChildDefinitions[0].CreateData(undoRedo) as CollectionChildItem;
                    citem.WrappedItem = child;

                    item.Children.Add(citem);

                    if (item.Children.Count == MaxCount)
                    {
                        break;
                    }
                }
            }
            else
            {
                var uncreatedAdds = AdditionalDefs.ToList();

                foreach (var el in element.Elements())
                {
                    var prev = el.PreviousNode as XComment;
                    if (prev != null)
                    {
                        var comment = new CommentDefinition().LoadData(prev, undoRedo);
                        item.Children.Add(comment);
                    }

                    var cdef = ChildDefinitions.FirstOrDefault(e => e.Name == el.Name);
                    if (cdef != null)
                    {
                        var child = cdef.LoadData(el, undoRedo);
                        item.Children.Add(child);
                    }
                    else
                    {
                        var def = AdditionalDefs.FirstOrDefault(e => e.Name == el.Name);
                        if (def != null)
                        {
                            var child = def.LoadData(el, undoRedo);
                            item.Children.Insert(0, child);

                            uncreatedAdds.Remove(def);
                        }
                        else if (ChildDefinitions.Count == 1)
                        {
                            var child = ChildDefinitions[0].LoadData(el, undoRedo);
                            item.Children.Add(child);
                        }
                        else
                        {
                            throw new Exception("Unable to find def for '" + el.Name + "' in collection '" + Name + "'!");
                        }
                    }
                }

                foreach (var def in uncreatedAdds)
                {
                    var child = def.CreateData(undoRedo);
                    item.Children.Insert(0, child);
                }

                if (element.LastNode is XComment)
                {
                    var comment = new CommentDefinition().LoadData(element.LastNode as XComment, undoRedo);
                    item.Children.Add(comment);
                }
            }

            foreach (var att in Attributes)
            {
                var      el      = element.Attribute(att.Name);
                DataItem attItem = null;

                if (el != null)
                {
                    attItem = att.LoadData(new XElement(el.Name, el.Value.ToString()), undoRedo);
                }
                else
                {
                    attItem = att.CreateData(undoRedo);
                }
                item.Attributes.Add(attItem);
            }

            return(item);
        }
示例#17
0
 private void OnEnable()
 {
     item = (target as CollectionSelectionWrapper)?.TreeItem;
 }
示例#18
0
	public void SetCollectionItem(CollectionItem item) {
		itemUISprite.SetCollectionItem(item);
	}
 /// <summary>
 /// Adds a type to this collection.
 /// </summary>
 /// <param name="collectionItem">CollectionItem representing the type to add.</param>
 internal void AddItem(CollectionItem collectionItem)
 {
     this.items.Add(collectionItem);
 }
 public void Setup()
 {
     _collectionItem = new CollectionItem();
 }
示例#21
0
        public virtual void Donate(PlayerMobile player, CollectionItem item, int amount)
        {
            int points = (int)(amount * item.Points);

            player.AddCollectionPoints(this.CollectionID, points);

            player.SendLocalizedMessage(1072816); // Thank you for your donation!
            player.SendLocalizedMessage(1072817, points.ToString()); // You have earned ~1_POINTS~ reward points for this donation.
            player.SendLocalizedMessage(1072818, points.ToString()); // The Collection has been awarded ~1_POINTS~ points

            this.Points += points;

            this.InvalidateProperties();
        }
示例#22
0
        public override void OnConfirmed(CollectionItem citem, int index)
        {
            Item item;

            if (citem.Type == typeof(VvVPotionKeg))
            {
                PotionType type;

                switch (index)
                {
                default:
                case 0: type = PotionType.GreaterStamina; break;

                case 1: type = PotionType.Supernova; break;

                case 2: type = PotionType.StatLossRemoval; break;

                case 3: type = PotionType.AntiParalysis; break;
                }

                item = new VvVPotionKeg(type);
            }
            else if (citem.Type == typeof(VvVSteedStatuette))
            {
                SteedType type = index == 5 || index == 6 ? SteedType.WarHorse : SteedType.Ostard;

                item = new VvVSteedStatuette(type, citem.Hue);
            }
            else if (citem.Type == typeof(VvVTrapKit))
            {
                TrapType type;

                switch (index - 11)
                {
                default:
                case 0: type = TrapType.Poison; break;

                case 1: type = TrapType.Cold; break;

                case 2: type = TrapType.Energy; break;

                case 3: type = TrapType.Blade; break;

                case 4: type = TrapType.Explosion; break;
                }

                item = new VvVTrapKit(type);
            }
            else if (citem.Type == typeof(VvVRobe) || citem.Type == typeof(VvVHairDye))
            {
                item = Activator.CreateInstance(citem.Type, citem.Hue) as Item;
            }
            else if (citem.Type == typeof(ScrollofTranscendence))
            {
                item = ScrollofTranscendence.CreateRandom(10, 10);
            }
            else
            {
                item = Activator.CreateInstance(citem.Type) as Item;
            }

            if (item != null)
            {
                if (item is IOwnerRestricted)
                {
                    ((IOwnerRestricted)item).Owner = User;
                }

                if (item is IAccountRestricted && User.Account != null)
                {
                    ((IAccountRestricted)item).Account = User.Account.Username;
                }

                if (item is VesperOrderShield)
                {
                    item.Name = "Order Shield";
                    ((VesperOrderShield)item).Attributes.CastSpeed = 0;
                }

                NegativeAttributes neg = RunicReforging.GetNegativeAttributes(item);

                if (neg != null)
                {
                    neg.Antique = 1;

                    if (item is IDurability && ((IDurability)item).MaxHitPoints == 0)
                    {
                        ((IDurability)item).MaxHitPoints = 255;
                        ((IDurability)item).HitPoints    = 255;
                    }
                }

                ViceVsVirtueSystem.Instance.AddVvVItem(item);

                if (User.Backpack == null || !User.Backpack.TryDropItem(User, item, false))
                {
                    User.SendLocalizedMessage(1074361); // The reward could not be given.  Make sure you have room in your pack.
                    item.Delete();
                }
                else
                {
                    if (User.AccessLevel == AccessLevel.Player)
                    {
                        PointsSystem.ViceVsVirtue.DeductPoints(User, citem.Points);
                    }

                    User.SendLocalizedMessage(1073621); // Your reward has been placed in your backpack.
                    User.PlaySound(0x5A7);
                }
            }
        }
示例#23
0
        public override int GetHashCode()
        {
            int hash = 1;

            if (typeCase_ == TypeOneofCase.Profile)
            {
                hash ^= Profile.GetHashCode();
            }
            if (typeCase_ == TypeOneofCase.VaultItem)
            {
                hash ^= VaultItem.GetHashCode();
            }
            if (typeCase_ == TypeOneofCase.CollectionItem)
            {
                hash ^= CollectionItem.GetHashCode();
            }
            if (typeCase_ == TypeOneofCase.CollectionFamily)
            {
                hash ^= CollectionFamily.GetHashCode();
            }
            if (typeCase_ == TypeOneofCase.Walkbox)
            {
                hash ^= Walkbox.GetHashCode();
            }
            if (typeCase_ == TypeOneofCase.PlayerFlags)
            {
                hash ^= PlayerFlags.GetHashCode();
            }
            if (typeCase_ == TypeOneofCase.Portkey)
            {
                hash ^= Portkey.GetHashCode();
            }
            if (typeCase_ == TypeOneofCase.PlayerActiveBuffList)
            {
                hash ^= PlayerActiveBuffList.GetHashCode();
            }
            if (typeCase_ == TypeOneofCase.CollectionPage)
            {
                hash ^= CollectionPage.GetHashCode();
            }
            if (typeCase_ == TypeOneofCase.VaultCapacity)
            {
                hash ^= VaultCapacity.GetHashCode();
            }
            if (typeCase_ == TypeOneofCase.Cauldron)
            {
                hash ^= Cauldron.GetHashCode();
            }
            if (typeCase_ == TypeOneofCase.EscrowedRewards)
            {
                hash ^= EscrowedRewards.GetHashCode();
            }
            if (typeCase_ == TypeOneofCase.ProfessionsProgressV3)
            {
                hash ^= ProfessionsProgressV3.GetHashCode();
            }
            if (typeCase_ == TypeOneofCase.QuestLog)
            {
                hash ^= QuestLog.GetHashCode();
            }
            if (typeCase_ == TypeOneofCase.Achievement)
            {
                hash ^= Achievement.GetHashCode();
            }
            hash ^= (int)typeCase_;
            if (_unknownFields != null)
            {
                hash ^= _unknownFields.GetHashCode();
            }
            return(hash);
        }
示例#24
0
    public Item GenerateItem(EItemId pId, int pAmount)
    {
        CollectionItem item = GenerateItem((int)pId, pAmount);

        return(Item.Convert(item));
    }
        public void DisplayDonationPage()
        {
            AddPage(m_Page);

            // title
            AddHtmlLocalized(50, 65, 150, 20, 1072836, 0x1, false, false);  // Current Tier:
            AddLabel(230, 65, 0x64, m_Collection.Tier.ToString());
            AddHtmlLocalized(50, 85, 150, 20, 1072837, 0x1, false, false);  // Current Points:
            AddLabel(230, 85, 0x64, m_Collection.Points.ToString());
            AddHtmlLocalized(50, 105, 150, 20, 1072838, 0x1, false, false); // Points Until Next Tier:
            AddLabel(230, 105, 0x64, m_Collection.CurrentTier.ToString());

            AddImageTiled(35, 125, 270, 2, 0x23C5);
            AddHtmlLocalized(35, 130, 270, 20, 1072840, 0x1, false, false); // Donations Accepted:

            // donations
            int offset = 150;
            int next   = 0;

            while (offset + next < 330 && m_Index < m_Collection.Donations.Count)
            {
                CollectionItem item = m_Collection.Donations[m_Index];
                Type           type = item.Type;
                Account        acct = m_Owner.Account as Account;

                int height = Math.Max(item.Height, 20);

                int amount = 0;

                if (item.Type == typeof(Gold) && acct != null)
                {
                    amount = acct.TotalGold + m_Owner.Backpack.GetAmount(item.Type);
                }
                else
                {
                    amount = GetTypes(m_Owner, item);
                }

                if (amount > 0)
                {
                    AddButton(35, offset + height / 2 - 5, 0x837, 0x838, 300 + m_Index, GumpButtonType.Reply, 0);
                    TextDefinition.AddTooltip(this, item.Tooltip);
                }

                int y = offset - item.Y;

                if (item.Height < 20)
                {
                    y += (20 - item.Height) / 2;
                }

                AddItem(55 - item.X + m_Max / 2 - item.Width / 2, y, item.ItemID, item.Hue);
                TextDefinition.AddTooltip(this, item.Tooltip);

                if (item.Points < 1 && item.Points > 0)
                {
                    AddLabel(65 + m_Max, offset + height / 2 - 10, 0x64, "1 per " + ((int)Math.Pow(item.Points, -1)).ToString());
                }
                else
                {
                    AddLabel(65 + m_Max, offset + height / 2 - 10, 0x64, item.Points.ToString());
                }

                TextDefinition.AddTooltip(this, item.Tooltip);

                if (amount > 0)
                {
                    AddLabel(235, offset + height / 2 - 5, 0xB1, amount.ToString("N0", System.Globalization.CultureInfo.GetCultureInfo("en-US")));
                }

                offset  += 5 + height;
                m_Index += 1;

                if (m_Index < m_Collection.Donations.Count)
                {
                    next = Math.Max(m_Collection.Donations[m_Index].Height, 20);
                }
                else
                {
                    next = 0;
                }
            }

            // buttons
            AddButton(50, 335, 0x15E3, 0x15E7, (int)Buttons.Rewards, GumpButtonType.Reply, 0);
            AddHtmlLocalized(75, 335, 100, 20, 1072842, 0x1, false, false); // Rewards

            if (m_Page > 1)
            {
                AddButton(150, 335, 0x15E3, 0x15E7, (int)Buttons.Next, GumpButtonType.Page, m_Page - 1);
                AddHtmlLocalized(170, 335, 60, 20, 1074880, 0x1, false, false); // Previous
            }

            m_Page += 1;

            if (m_Index < m_Collection.Donations.Count)
            {
                AddButton(300, 335, 0x15E1, 0x15E5, (int)Buttons.Next, GumpButtonType.Page, m_Page);
                AddHtmlLocalized(240, 335, 60, 20, 1072854, 0x1, false, false); // <div align=right>Next</div>
            }
        }
 public void AddItem(object item)
 {
     Current = new CollectionItem(item, Current);
 }
 public InternalPrompt(IComunityCollection collection, CollectionItem selected, Point3D location)
 {
     m_Collection = collection;
     m_Selected   = selected;
     m_Location   = location;
 }
示例#28
0
        public override DataItem LoadData(XElement element, UndoRedoManager undoRedo)
        {
            var item = new StructItem(this, undoRedo);

            if (Collapse)
            {
                var split = element.Value.Split(new string[] { Seperator }, StringSplitOptions.None);

                if (split.Length == Children.Count)
                {
                    for (int i = 0; i < split.Length; i++)
                    {
                        var      data      = split[i];
                        var      def       = Children[i] as PrimitiveDataDefinition;
                        DataItem childItem = def.LoadFromString(data, undoRedo);
                        item.Children.Add(childItem);
                    }
                }
                else
                {
                    foreach (var def in Children)
                    {
                        var child = def.CreateData(undoRedo);
                        item.Children.Add(child);
                    }
                }
            }
            else
            {
                var createdChildren = new List <DataItem>();

                var commentTexts = Children.Where(e => e is CommentDefinition).Select(e => (e as CommentDefinition).Text);

                foreach (var def in Children)
                {
                    var name = def.Name;

                    var els = element.Elements(name);

                    if (els.Count() > 0)
                    {
                        var prev = els.First().PreviousNode as XComment;
                        if (prev != null)
                        {
                            var comment = new CommentDefinition().LoadData(prev, undoRedo);
                            if (!commentTexts.Contains(comment.TextValue))
                            {
                                item.Children.Add(comment);
                            }
                        }

                        if (def is CollectionDefinition)
                        {
                            CollectionItem childItem = (CollectionItem)def.LoadData(els.First(), undoRedo);
                            if (childItem.Children.Count == 0)
                            {
                                var dummyEl = new XElement(els.First().Name);
                                foreach (var el in els)
                                {
                                    dummyEl.Add(el);
                                }

                                childItem = (CollectionItem)def.LoadData(dummyEl, undoRedo);
                            }

                            item.Children.Add(childItem);
                        }
                        else
                        {
                            DataItem childItem = def.LoadData(els.First(), undoRedo);
                            item.Children.Add(childItem);
                        }
                    }
                    else
                    {
                        DataItem childItem = def.CreateData(undoRedo);
                        item.Children.Add(childItem);
                    }
                }

                if (element.LastNode is XComment)
                {
                    var comment = new CommentDefinition().LoadData(element.LastNode as XComment, undoRedo);
                    if (!commentTexts.Contains(comment.TextValue))
                    {
                        item.Children.Add(comment);
                    }
                }
            }

            foreach (var att in Attributes)
            {
                var      el      = element.Attribute(att.Name);
                DataItem attItem = null;

                if (el != null)
                {
                    attItem = att.LoadData(new XElement(el.Name, el.Value.ToString()), undoRedo);
                }
                else
                {
                    attItem = att.CreateData(undoRedo);
                }
                item.Attributes.Add(attItem);
            }

            foreach (var child in item.Attributes)
            {
                child.UpdateVisibleIfBinding();
            }
            foreach (var child in item.Children)
            {
                child.UpdateVisibleIfBinding();
            }

            return(item);
        }
        public IActionResult Update([FromBody] CollectionItem editentry)
        {
            var result = _repository.Update(editentry, editentry.CollectionItemID);

            return(Helper.CheckResult(result));
        }
示例#30
0
        public void Move_Ascending()
        {
            var history = new History();
            var model   = new TestModel(history);

            model.Collection = new ObservableCollection <CollectionItem>();

            var item0 = new CollectionItem();
            var item1 = new CollectionItem();
            var item2 = new CollectionItem();
            var item3 = new CollectionItem();

            model.Collection.Add(item0);
            model.Collection.Add(item1);
            model.Collection.Add(item2);
            model.Collection.Add(item3);

            Assert.Equal(1, item0.CollectionChangedAddCount);
            Assert.Equal(1, item1.CollectionChangedAddCount);
            Assert.Equal(1, item2.CollectionChangedAddCount);
            Assert.Equal(1, item3.CollectionChangedAddCount);
            Assert.Equal(0, item0.CollectionChangedRemoveCount);
            Assert.Equal(0, item1.CollectionChangedRemoveCount);
            Assert.Equal(0, item2.CollectionChangedRemoveCount);
            Assert.Equal(0, item3.CollectionChangedRemoveCount);
            Assert.Equal(0, item0.CollectionChangedMoveCount);
            Assert.Equal(0, item1.CollectionChangedMoveCount);
            Assert.Equal(0, item2.CollectionChangedMoveCount);
            Assert.Equal(0, item3.CollectionChangedMoveCount);

            model.Collection.Move(0, 3);

            Assert.Equal(1, item0.CollectionChangedAddCount);
            Assert.Equal(1, item1.CollectionChangedAddCount);
            Assert.Equal(1, item2.CollectionChangedAddCount);
            Assert.Equal(1, item3.CollectionChangedAddCount);
            Assert.Equal(0, item0.CollectionChangedRemoveCount);
            Assert.Equal(0, item1.CollectionChangedRemoveCount);
            Assert.Equal(0, item2.CollectionChangedRemoveCount);
            Assert.Equal(0, item3.CollectionChangedRemoveCount);
            Assert.Equal(1, item0.CollectionChangedMoveCount);
            Assert.Equal(0, item1.CollectionChangedMoveCount);
            Assert.Equal(0, item2.CollectionChangedMoveCount);
            Assert.Equal(0, item3.CollectionChangedMoveCount);

            history.Undo();
            Assert.Equal(1, item0.CollectionChangedAddCount);
            Assert.Equal(1, item1.CollectionChangedAddCount);
            Assert.Equal(1, item2.CollectionChangedAddCount);
            Assert.Equal(1, item3.CollectionChangedAddCount);
            Assert.Equal(0, item0.CollectionChangedRemoveCount);
            Assert.Equal(0, item1.CollectionChangedRemoveCount);
            Assert.Equal(0, item2.CollectionChangedRemoveCount);
            Assert.Equal(0, item3.CollectionChangedRemoveCount);
            Assert.Equal(2, item0.CollectionChangedMoveCount);
            Assert.Equal(0, item1.CollectionChangedMoveCount);
            Assert.Equal(0, item2.CollectionChangedMoveCount);
            Assert.Equal(0, item3.CollectionChangedMoveCount);

            history.Redo();
            Assert.Equal(1, item0.CollectionChangedAddCount);
            Assert.Equal(1, item1.CollectionChangedAddCount);
            Assert.Equal(1, item2.CollectionChangedAddCount);
            Assert.Equal(1, item3.CollectionChangedAddCount);
            Assert.Equal(0, item0.CollectionChangedRemoveCount);
            Assert.Equal(0, item1.CollectionChangedRemoveCount);
            Assert.Equal(0, item2.CollectionChangedRemoveCount);
            Assert.Equal(0, item3.CollectionChangedRemoveCount);
            Assert.Equal(3, item0.CollectionChangedMoveCount);
            Assert.Equal(0, item1.CollectionChangedMoveCount);
            Assert.Equal(0, item2.CollectionChangedMoveCount);
            Assert.Equal(0, item3.CollectionChangedMoveCount);
        }
        public void RemoveElement(ISchemaElement element)
        {
            foreach (object obj in this.items)
            {
                CollectionItem collectionItem = obj as CollectionItem;
                if (collectionItem != null)
                {
                    if (collectionItem.ElementType.IsAssignableFrom(element.GetType()))
                    {
                        if (collectionItem.Elements.Count == 0)
                        {
                            return;
                        }

                        collectionItem.RemoveElement(element);

                        if (collectionItem.Elements.Count == 0)
                        {
                            this.containersUsed--;
                        }

                        this.totalContainedItems--;
                        return;
                    }

                    continue;
                }

                ElementCollection collection = obj as ElementCollection;
                if (collection != null)
                {
                    if (collection.Count == 0)
                    {
                        continue;
                    }

                    try
                    {
                        collection.RemoveElement(element);

                        if (collection.Count == 0)
                        {
                            this.containersUsed--;
                        }

                        this.totalContainedItems--;
                        return;
                    }
                    catch (ArgumentException)
                    {
                        // Eat the exception and keep looking. We'll throw our own if we can't find its home.
                    }

                    continue;
                }
            }

            throw new ArgumentException(String.Format(
                                            CultureInfo.InvariantCulture,
                                            "Element of type {0} is not valid for this collection.",
                                            element.GetType().Name));
        }
示例#32
0
        public void DisplayRewardPage()
        {
            AddPage(Page);

            int offset = 110;
            int next   = 0;
            int max    = GetMax();

            while (offset + next < 320 && Index < Collection.Count)
            {
                CollectionItem item   = Collection[Index];
                int            height = Math.Max(item.Height, 20);

                if (Points >= item.Points)
                {
                    AddButton(35, offset + (int)(height / 2) - 5, 0x837, 0x838, 200 + Index, GumpButtonType.Reply, 0);
                    AddTooltip(item.Tooltip);
                }

                int y = offset - item.Y;

                if (item.Height < 20)
                {
                    y += (20 - item.Height) / 2;
                }

                Item i = null;

                if (Owner.Backpack != null && item.Type != null)
                {
                    i = Owner.Backpack.FindItemByType(item.Type);
                }

                int hue = GetItemHue(i, item);

                AddItem(55 - item.X + max / 2 - item.Width / 2, y, item.ItemID, hue);

                if (i != null)
                {
                    AddItemProperty(i.Serial);
                }
                else if (item.Tooltip > 0)
                {
                    AddTooltip(item.Tooltip);
                }

                AddLabel(80 + max, offset + (int)(height / 2) - 10, Points >= item.Points ? 0x64 : 0x21, item.Points.ToString("N0"));

                offset += GetYOffset(item.ItemID) + height;
                Index++;

                if (Index < Collection.Count)
                {
                    next = Math.Max(Collection[Index].Height, 20);
                }
                else
                {
                    next = 0;
                }
            }

            if (Page > 1)
            {
                AddButton(150, 335, 0x15E3, 0x15E7, 0, GumpButtonType.Page, Page - 1);
                AddHtmlLocalized(170, 335, 60, 20, 1074880, 0x1, false, false); // Previous
            }

            Page++;

            if (Index < Collection.Count)
            {
                AddButton(300, 335, 0x15E1, 0x15E5, 0, GumpButtonType.Page, Page);
                AddHtmlLocalized(240, 335, 60, 20, 1072854, 0x1, false, false); // <div align=right>Next</div>
            }
        }
示例#33
0
 /**
  * @param collectionItem The collectionItem to set.
  */
 public void setCollectionItem(CollectionItem collectionItem)
 {
     removeAllLinks();
     this.collectionItem = collectionItem;
 }
示例#34
0
        public override void OnConfirmed(CollectionItem citem, int index)
        {
            base.OnConfirmed(citem, index);

            PointsSystem.CleanUpBritannia.DeductPoints(User, citem.Points);
        }
示例#35
0
	public void EquipItem(CollectionItem item) {
		this.equippedItem = item;
		Save();
	}
示例#36
0
        public override DataItem LoadData(XElement element, UndoRedoManager undoRedo)
        {
            var item = new GraphStructItem(this, undoRedo);

            item.X       = TryParseFloat(element, MetaNS + "X");
            item.Y       = TryParseFloat(element, MetaNS + "Y");
            item.GUID    = element.Attribute("GUID")?.Value?.ToString();
            item.Comment = element.Attribute(MetaNS + "Comment")?.Value?.ToString();

            var commentTexts = Children.Where(e => e is CommentDefinition).Select(e => (e as CommentDefinition).Text);

            var createdChildren = new List <DataItem>();

            foreach (var def in Children)
            {
                var name = def.Name;

                var els = element.Elements(name);

                if (els.Count() > 0)
                {
                    var prev = els.First().PreviousNode as XComment;
                    if (prev != null)
                    {
                        var comment = new CommentDefinition().LoadData(prev, undoRedo);
                        if (!commentTexts.Contains(comment.TextValue))
                        {
                            item.Children.Add(comment);
                        }
                    }

                    if (def is CollectionDefinition)
                    {
                        CollectionItem childItem = (CollectionItem)def.LoadData(els.First(), undoRedo);
                        if (childItem.Children.Count == 0)
                        {
                            var dummyEl = new XElement(els.First().Name);
                            foreach (var el in els)
                            {
                                dummyEl.Add(el);
                            }

                            childItem = (CollectionItem)def.LoadData(dummyEl, undoRedo);
                        }

                        item.Children.Add(childItem);
                    }
                    else
                    {
                        DataItem childItem = def.LoadData(els.First(), undoRedo);
                        item.Children.Add(childItem);
                    }
                }
                else
                {
                    DataItem childItem = def.CreateData(undoRedo);
                    item.Children.Add(childItem);
                }
            }

            if (element.LastNode is XComment)
            {
                var comment = new CommentDefinition().LoadData(element.LastNode as XComment, undoRedo);
                if (!commentTexts.Contains(comment.TextValue))
                {
                    item.Children.Add(comment);
                }
            }

            foreach (var att in Attributes)
            {
                var      el      = element.Attribute(att.Name);
                DataItem attItem = null;

                if (el != null)
                {
                    attItem = att.LoadData(new XElement(el.Name, el.Value.ToString()), undoRedo);
                }
                else
                {
                    attItem = att.CreateData(undoRedo);
                }
                item.Attributes.Add(attItem);
            }

            item.Children.OrderBy(e => Children.IndexOf(e.Definition));

            foreach (var child in item.Attributes)
            {
                child.UpdateVisibleIfBinding();
            }
            foreach (var child in item.Children)
            {
                child.UpdateVisibleIfBinding();
            }

            return(item);
        }
示例#37
0
	private void OnEnable() {
		collectionItem = (CollectionItem)target;
	}
示例#38
0
        public void DisplayDonationPage()
        {
            this.AddPage(this.m_Page);

            // title
            this.AddHtmlLocalized(50, 65, 150, 20, 1072836, 0x1, false, false);  // Current Tier:
            this.AddLabel(230, 65, 0x64, this.m_Collection.Tier.ToString());
            this.AddHtmlLocalized(50, 85, 150, 20, 1072837, 0x1, false, false);  // Current Points:
            this.AddLabel(230, 85, 0x64, this.m_Collection.Points.ToString());
            this.AddHtmlLocalized(50, 105, 150, 20, 1072838, 0x1, false, false); // Points Until Next Tier:
            this.AddLabel(230, 105, 0x64, this.m_Collection.CurrentTier.ToString());

            this.AddImageTiled(35, 125, 270, 2, 0x23C5);
            this.AddHtmlLocalized(35, 130, 270, 20, 1072840, 0x1, false, false); // Donations Accepted:

            // donations
            int offset = 150;
            int next   = 0;

            while (offset + next < 330 && this.m_Index < this.m_Collection.Donations.Count)
            {
                CollectionItem item = this.m_Collection.Donations[this.m_Index];

                int height = Math.Max(item.Height, 20);

                if (this.m_Owner.Backpack != null && this.m_Owner.Backpack.GetAmount(item.Type, true, true) > 0)
                {
                    this.AddButton(35, offset + (int)(height / 2) - 5, 0x837, 0x838, 300 + this.m_Index, GumpButtonType.Reply, 0);
                    this.AddTooltip(item.Tooltip);
                }

                int y = offset - item.Y;

                if (item.Height < 20)
                {
                    y += (20 - item.Height) / 2;
                }

                this.AddItem(55 - item.X + this.m_Max / 2 - item.Width / 2, y, item.ItemID, item.Hue);
                this.AddTooltip(item.Tooltip);

                if (item.Points < 1 && item.Points > 0)
                {
                    this.AddLabel(65 + this.m_Max, offset + (int)(height / 2) - 10, 0x64, "1 per " + ((int)Math.Pow(item.Points, -1)).ToString());
                }
                else
                {
                    this.AddLabel(65 + this.m_Max, offset + (int)(height / 2) - 10, 0x64, item.Points.ToString());
                }

                this.AddTooltip(item.Tooltip);

                if (m_Owner.Backpack != null)
                {
                    int count = 0;
                    if (item.Type == typeof(BankCheck))
                    {
                        count = m_Owner.Backpack.GetChecksWorth(true);
                    }
                    else
                    {
                        count = m_Owner.Backpack.GetAmount(item.Type, true, true);
                    }
                    if (count > 0)
                    {
                        AddLabel(230, offset + (int)(height / 2) - 10, 0x64, count.ToString());
                    }
                }

                offset       += 5 + height;
                this.m_Index += 1;

                if (this.m_Index < this.m_Collection.Donations.Count)
                {
                    next = Math.Max(this.m_Collection.Donations[this.m_Index].Height, 20);
                }
                else
                {
                    next = 0;
                }
            }

            // buttons
            this.AddButton(50, 335, 0x15E3, 0x15E7, (int)Buttons.Rewards, GumpButtonType.Reply, 0);
            this.AddHtmlLocalized(75, 335, 100, 20, 1072842, 0x1, false, false); // Rewards

            if (this.m_Page > 1)
            {
                this.AddButton(150, 335, 0x15E3, 0x15E7, (int)Buttons.Next, GumpButtonType.Page, this.m_Page - 1);
                this.AddHtmlLocalized(170, 335, 60, 20, 1074880, 0x1, false, false); // Previous
            }

            this.m_Page += 1;

            if (this.m_Index < this.m_Collection.Donations.Count)
            {
                this.AddButton(300, 335, 0x15E1, 0x15E5, (int)Buttons.Next, GumpButtonType.Page, this.m_Page);
                this.AddHtmlLocalized(240, 335, 60, 20, 1072854, 0x1, false, false); // <div align=right>Next</div>
            }
        }
示例#39
0
 /// <summary>
 /// Adds a type to this collection.
 /// </summary>
 /// <param name="collectionItem">CollectionItem representing the type to add.</param>
 public void AddItem(CollectionItem collectionItem)
 {
     this.items.Add(collectionItem);
 }
示例#40
0
        public void DisplayRewardPage()
        {
            int points = this.m_Owner.GetCollectionPoints(this.m_Collection.CollectionID);

            this.AddPage(this.m_Page);

            // title
            this.AddHtmlLocalized(50, 65, 150, 20, 1072843, 0x1, false, false); // Your Reward Points:
            this.AddLabel(230, 65, 0x64, points.ToString());
            this.AddImageTiled(35, 85, 270, 2, 0x23C5);
            this.AddHtmlLocalized(35, 90, 270, 20, 1072844, 0x1, false, false); // Please Choose a Reward:

            // rewards
            int offset = 110;
            int next   = 0;

            while (offset + next < 300 && this.m_Index < this.m_Collection.Rewards.Count)
            {
                CollectionItem item = this.m_Collection.Rewards[this.m_Index];

                int height = Math.Max(item.Height, 20);

                if (points >= item.Points)
                {
                    this.AddButton(35, offset + (int)(height / 2) - 5, 0x837, 0x838, 200 + this.m_Index, GumpButtonType.Reply, 0);
                    this.AddTooltip(item.Tooltip);
                }

                int y = offset - item.Y;

                if (item.Height < 20)
                {
                    y += (20 - item.Height) / 2;
                }

                this.AddItem(55 - item.X + this.m_Max / 2 - item.Width / 2, y, item.ItemID, points >= item.Points ? item.Hue : 0x3E9);
                this.AddTooltip(item.Tooltip);
                this.AddLabel(65 + this.m_Max, offset + (int)(height / 2) - 10, points >= item.Points ? 0x64 : 0x21, item.Points.ToString());
                this.AddTooltip(item.Tooltip);

                offset       += 5 + height;
                this.m_Index += 1;

                if (this.m_Index < this.m_Collection.Donations.Count)
                {
                    next = Math.Max(this.m_Collection.Donations[this.m_Index].Height, 20);
                }
                else
                {
                    next = 0;
                }
            }

            // buttons
            this.AddButton(50, 335, 0x15E3, 0x15E7, (int)Buttons.Status, GumpButtonType.Reply, 0);
            this.AddHtmlLocalized(75, 335, 100, 20, 1072845, 0x1, false, false); // Status

            if (this.m_Page > 1)
            {
                this.AddButton(150, 335, 0x15E3, 0x15E7, (int)Buttons.Next, GumpButtonType.Page, this.m_Page - 1);
                this.AddHtmlLocalized(170, 335, 60, 20, 1074880, 0x1, false, false); // Previous
            }

            this.m_Page += 1;

            if (this.m_Index < this.m_Collection.Rewards.Count)
            {
                this.AddButton(300, 335, 0x15E1, 0x15E5, (int)Buttons.Next, GumpButtonType.Page, this.m_Page);
                this.AddHtmlLocalized(240, 335, 60, 20, 1072854, 0x1, false, false); // <div align=right>Next</div>
            }
        }
示例#41
0
        private bool SkipQuestReward(PlayerMobile pm, CollectionItem item)
        {
            if (pm.Quests != null)
            {
                foreach (BaseQuest q in pm.Quests)
                {
                    if (!q.Completed)
                    {
                        foreach (BaseObjective obj in q.Objectives)
                        {
                            if (obj is CollectionsObtainObjective && item.Type == ((CollectionsObtainObjective)obj).Obtain)
                                return false;
                        }
                    }
                }
            }

            return true;
        }
示例#42
0
 public ConfirmRewardGump(IComunityCollection collection, Point3D location, CollectionItem item)
     : this(collection, location, item, 0)
 {
 }
示例#43
0
        public virtual void Reward(PlayerMobile player, CollectionItem reward, int hue)
        {
            Item item = QuestHelper.Construct(reward.Type) as Item;

            if (item != null && player.AddToBackpack(item))
            {
                if (hue > 0)
                    item.Hue = hue;

                player.AddCollectionPoints(this.CollectionID, (int)reward.Points * -1);
                player.SendLocalizedMessage(1073621); // Your reward has been placed in your backpack.
                player.PlaySound(0x5A7);
            }
            else if (item != null)
            {
                player.SendLocalizedMessage(1074361); // The reward could not be given.  Make sure you have room in your pack.
                item.Delete();
            }

            reward.OnGiveReward(player, this, hue);

            player.SendGump(new ComunityCollectionGump(player, this, this.Location));
        }
        public void Update(CollectionItem collectionItem)
        {
            var entity = _context.tblCollectionItem.Find(collectionItem.Id);

            _translator.FillDataEntity(entity, collectionItem);
        }