Example #1
0
        private static void Client_CustomizationAchievement(CustomizationType ctype, string text, int id)
        {
            CustomViewer viewer = new CustomViewer(ctype, text, id);

            viewer.Show();
            Application.Current.Dispatcher.BeginInvoke(System.Windows.Threading.DispatcherPriority.Normal, new Action(() => viewer.Activate()));
        }
Example #2
0
    private void LoadItemsFromFolder(CustomizationType type, string imagesPath, string iconsPath, int maxItemsToLoad)
    {
        var icons  = Resources.LoadAll <Sprite>(iconsPath);
        var images = Resources.LoadAll <Sprite>(imagesPath);


        if (icons.Length != images.Length)
        {
            Debug.LogError("Icons and Imges Folders is not match");
        }


        var listOfItems = new List <GameObject>();

        for (int i = 0; i < images.Length && i < maxItemsToLoad; i++)
        {
            Sprite itemImage = images[i];
            string itemId    = ExtractId(images[i].name);
            Sprite itemIcon  = icons.First(icon => icon.name.Contains(itemId));

            ItemStatus itemStatus = CheckItemStates(itemImage.name);

            GameObject newItem = CreateNewItem(type, itemImage, itemId, itemIcon, itemStatus);

            listOfItems.Add(newItem);
        }


        _customization.Add(type, listOfItems);
    }
        public void AuditCustomizationEntries()
        {
            List <CustomizationType> m_CustomizationsToAdd = new List <CustomizationType>();

            int customizationCount = Enum.GetNames(typeof(CustomizationType)).Length;

            for (int a = 0; a < customizationCount; a++)
            {
                CustomizationType customization = (CustomizationType)a;

                bool foundCustomizationEntry = false;

                foreach (PlayerCustomizationEntry entry in m_CustomizationEntries)
                {
                    if (entry.m_CustomizationType == customization)
                    {
                        foundCustomizationEntry = true;
                        break;
                    }
                }

                if (!foundCustomizationEntry)
                {
                    m_CustomizationsToAdd.Add(customization);
                }
            }

            foreach (CustomizationType customization in m_CustomizationsToAdd)
            {
                m_CustomizationEntries.Add(new PlayerCustomizationEntry(customization, false, false, true));
            }
        }
Example #4
0
 public PlayerCustomizationEntry(CustomizationType customizationType, bool unlocked, bool active, bool selectable)
 {
     m_CustomizationType = customizationType;
     m_Unlocked          = unlocked;
     m_Active            = active;
     m_Selectable        = selectable;
 }
 public Customization(CustomizationType type, int id, bool isHost, string url)
 {
     CustomizationType = type;
     Id     = id;
     IsHost = isHost;
     URL    = url;
 }
        public PlayerCustomizationDeed(CustomizationType customization) : this()
        {
            Name   = "a player customization deed";
            Weight = 0.1;

            m_Customization = customization;
        }
 /// --------------------------------------------------------------------------------
 /// <summary>
 /// Initializes a new instance of the <see cref="PhraseCustomization"/> class.
 /// </summary>
 /// --------------------------------------------------------------------------------
 public PhraseCustomization(TranslatablePhrase tp)
 {
     Reference      = tp.Reference;
     OriginalPhrase = tp.OriginalPhrase;
     ModifiedPhrase = tp.ModifiedPhrase;
     Type           = tp.IsExcluded ? CustomizationType.Deletion : CustomizationType.Modification;
 }
        public PlayerCustomizationConfirmationGump(PlayerMobile player, int pageNumber, CustomizationType customizationType) : base(10, 10)
        {
            if (player == null || customizationType == null)
            {
                return;
            }

            m_Player            = player;
            m_PageNumber        = pageNumber;
            m_CustomizationType = customizationType;

            PlayerCustomizationDetail customizationDetail = PlayerCustomization.GetCustomizationDetail(customizationType);
            PlayerCustomizationEntry  customizationEntry  = PlayerEnhancementPersistance.GetCustomizationEntry(m_Player, customizationType);

            if (customizationEntry == null || customizationDetail == null)
            {
                return;
            }

            Closable   = true;
            Disposable = true;
            Dragable   = true;
            Resizable  = false;

            AddBackground(8, 8, 484, 228, 9200);
            AddBackground(19, 43, 459, 66, 3000);

            int textHue     = 2036;
            int boldTextHue = 149;

            int iStartY = 43;

            AddLabel(167, 17, boldTextHue, "Unlock Player Customization");

            AddItem(25 + customizationDetail.m_IconOffsetX, iStartY + 13 + customizationDetail.m_IconOffsetY, customizationDetail.m_IconItemId, customizationDetail.m_IconHue); //Icon
            AddLabel(260 - (customizationDetail.m_Name.Length * 3), iStartY + 3, 149, customizationDetail.m_Name);

            if (customizationDetail.m_Description != null)
            {
                for (int a = 0; a < customizationDetail.m_Description.Length; a++)
                {
                    AddLabel(260 - (customizationDetail.m_Description[a].Length * 3), iStartY + ((a + 1) * 20), textHue, customizationDetail.m_Description[a]);
                }
            }

            //AddLabel(260 - (customizationDetail.m_Description[0].Length * 3), iStartY + 20, textHue, customizationDetail.m_Description[0]);
            //AddLabel(260 - (customizationDetail.m_Description[1].Length * 3), iStartY + 40, textHue, customizationDetail.m_Description[1]);

            AddLabel(37, 119, textHue, "This will unlock this Player Customization for all characters on this ");
            AddLabel(29, 139, textHue, "account and will withdraw the following amount of gold from your bank");

            AddItem(185, 163, 3823);
            AddLabel(230, 167, textHue, Utility.CreateCurrencyString(customizationDetail.m_Cost));

            AddLabel(112, 199, textHue, "Confirm");
            AddButton(73, 195, 2152, 2154, 1, GumpButtonType.Reply, 0);

            AddLabel(376, 197, textHue, "Cancel");
            AddButton(337, 193, 2474, 2472, 2, GumpButtonType.Reply, 0);
        }
Example #9
0
        private void AdaptImageSize(CustomizationType ctype, int id)
        {
            switch (ctype)
            {
            case CustomizationType.Avatar:
                img_custom.Width  = 256;
                img_custom.Height = 256;
                img_custom.Source = FormExecution.AssetsManager.GetCustom(new Customization(CustomizationType.Avatar, id, false, ""));
                break;

            case CustomizationType.Partner:
                img_custom.Width  = 256;
                img_custom.Height = 256;
                img_custom.Source = FormExecution.AssetsManager.GetCustom(new Customization(CustomizationType.Partner, id, false, ""));
                break;

            case CustomizationType.Sleeve:
                img_custom.Width  = 177;
                img_custom.Height = 254;
                img_custom.Source = FormExecution.AssetsManager.GetCustom(new Customization(CustomizationType.Sleeve, id, false, ""));
                break;

            case CustomizationType.Border:
                img_custom.Width  = 306;
                img_custom.Height = 136;
                img_custom.Source = FormExecution.AssetsManager.GetCustom(new Customization(CustomizationType.Border, id, false, ""));
                break;
            }
        }
Example #10
0
		/// --------------------------------------------------------------------------------
		/// <summary>
		/// Initializes a new instance of the <see cref="XmlTranslation"/> class.
		/// </summary>
		/// --------------------------------------------------------------------------------
		public PhraseCustomization(TranslatablePhrase tp)
		{
			Reference = tp.Reference;
			OriginalPhrase = tp.OriginalPhrase;
			ModifiedPhrase = tp.ModifiedPhrase;
			Type = tp.IsExcluded ? CustomizationType.Deletion : CustomizationType.Modification;
		}
 public void SendCustomCustomization(string url, CustomizationType ctype)
 {
     Client.Send(PacketType.BuyOwnCustom, new StandardClientBuyOwnCustomization
     {
         URL        = url,
         CustomType = ctype
     });
 }
Example #12
0
        public static CustomizationType GetRandomCustomizationType()
        {
            int customizationCount = Enum.GetNames(typeof(CustomizationType)).Length;

            CustomizationType customization = (CustomizationType)Utility.RandomMinMax(0, customizationCount - 1);

            return(customization);
        }
        public PlayerCustomizationDeed() : base(0x14F0)
        {
            Name = "a player customization deed";

            Hue = 2615;

            m_Customization = PlayerCustomization.GetRandomCustomizationType();
        }
        public void AddCustomizationEntries()
        {
            int customizationCount = Enum.GetNames(typeof(CustomizationType)).Length;

            for (int a = 0; a < customizationCount; a++)
            {
                CustomizationType customization = (CustomizationType)a;
                m_CustomizationEntries.Add(new PlayerCustomizationEntry(customization, false, false, true));
            }
        }
        public override void Deserialize(GenericReader reader)
        {
            base.Deserialize(reader);
            int version = reader.ReadInt();

            if (version >= 0)
            {
                m_Customization = (CustomizationType)reader.ReadInt();
            }
        }
Example #16
0
        public CustomViewer(CustomizationType ctype, string text, int id)
        {
            InitializeComponent();
            this.MaxHeight = SystemParameters.MaximizedPrimaryScreenHeight;

            this.MouseDown += Window_MouseDown;

            AdaptImageSize(ctype, id);
            tb_text.Text = text;
        }
Example #17
0
        public void RetrieveViews(ConnectionType connectionType, bool execute, Action <int, string> reportProgress)
        {
            if (!execute)
            {
                return;
            }

            CrmServiceClient  crmServiceClient  = GetCrmServiceClient(connectionType);
            CustomizationRoot customizationRoot = GetCustomizationRoot(connectionType);

            QueryExpression query = new QueryExpression
            {
                EntityName = "savedquery",
                ColumnSet  = new ColumnSet("introducedversion", "description", "iscustomizable", "componentstate", "versionnumber", "canbedeleted", "ismanaged", "solutionid", "isdefault", "isuserdefined", "savedqueryid", "statecode", "conditionalformatting", "name", "querytype", "isquickfindquery", "columnsetxml", "offlinesqlquery", "queryappusage", "advancedgroupby", "fetchxml", "returnedtypecode", "isprivate", "iscustom", "layoutjson", "statuscode", "queryapi", "organizationtaborder", "layoutxml"),
                PageInfo   = new PagingInfo
                {
                    Count        = 5000,
                    PageNumber   = 1,
                    PagingCookie = null
                },
                Orders =
                {
                    new OrderExpression("returnedtypecode", OrderType.Ascending),
                    new OrderExpression("name",             OrderType.Ascending),
                    //new OrderExpression("type", OrderType.Ascending)
                }
            };

            reportProgress(0, $"Retrieving and processing system view data from {connectionType.ToString()}");
            List <Entity> viewsResult = ExecuteQueryWithPaging(query, crmServiceClient);

            foreach (Entity view in viewsResult)
            {
                string entityName = view.GetAttributeValue <string>("returnedtypecode");
                string typeName   = view.FormattedValues["querytype"];

                CustomizationEntity viewEntity = customizationRoot.Views.Find(e => e.Name == entityName);
                if (viewEntity == null)
                {
                    viewEntity = new CustomizationEntity(entityName);
                    customizationRoot.Views.Add(viewEntity);
                }

                CustomizationType viewType = viewEntity.CustomzationTypes.Find(t => t.Name == typeName);
                if (viewType == null)
                {
                    viewType = new CustomizationType(typeName);
                    viewEntity.CustomzationTypes.Add(viewType);
                }

                viewType.Entities.Add(view);
            }
        }
 /// --------------------------------------------------------------------------------
 /// <summary>
 /// Initializes a new instance of the <see cref="PhraseCustomization"/> class for an
 /// insertion or addition.
 /// </summary>
 /// --------------------------------------------------------------------------------
 public PhraseCustomization(string basePhrase, Question addedPhrase,
                            CustomizationType type)
 {
     Reference      = addedPhrase.ScriptureReference;
     OriginalPhrase = basePhrase;
     ModifiedPhrase = addedPhrase.Text;
     if (addedPhrase.Answers != null && addedPhrase.Answers.Length == 1)
     {
         Answer = addedPhrase.Answers[0];
     }
     Type = type;
 }
Example #19
0
        public static CustomizationDetail GetCustomizationDetail(CustomizationType customizationType)
        {
            CustomizationDetail detail = new CustomizationDetail();

            detail.m_CustomizationType = customizationType;

            #region Customization Details

            switch (customizationType)
            {
            case CustomizationType.BenchPlayer:
                detail.m_CustomizationName = "Bench Player";
                detail.m_Description       = "Unlocks a 6th character slot on your account.";
                detail.m_AlwaysActive      = true;
                detail.GumpCollectionId    = "BenchPlayerCustomization";
                break;

            case CustomizationType.Carnage:
                detail.m_CustomizationName = "Carnage";
                detail.m_Description       = "Has a 25% chance upon killing another player that they will explode in a shower of gore.";
                detail.GumpCollectionId    = "CarnageCustomization";
                break;

            case CustomizationType.ShapeShifter:
                detail.m_CustomizationName = "Shape Shifter";
                detail.m_Description       = "Add high-level creature types to the Polymorph spell.";
                detail.GumpCollectionId    = "ShapeShifterCustomization";
                break;

            case CustomizationType.Hoarder:
                detail.m_CustomizationName = "Hoarder";
                detail.m_Description       = "Increases your bank's item limit to 150.";
                detail.m_AlwaysActive      = true;
                detail.GumpCollectionId    = "HoarderCustomization";
                break;

            case CustomizationType.Venomous:
                detail.m_CustomizationName = "Venomous";
                detail.m_Description       = "Applying poison to another target will create additional visual and sound effects.";
                detail.GumpCollectionId    = "VenomousCustomization";
                break;

            case CustomizationType.SomethingFishy:
                detail.m_CustomizationName = "Something Fishy";
                detail.m_Description       = "Adds occasional, random visual and sound effects while making fishing attempts.";
                detail.GumpCollectionId    = "SomethingFishyCustomization";
                break;
            }

            #endregion

            return(detail);
        }
Example #20
0
        public void RetrieveForms(ConnectionType connectionType, bool execute, Action <int, string> reportProgress)
        {
            if (!execute)
            {
                return;
            }

            CrmServiceClient  crmServiceClient  = GetCrmServiceClient(connectionType);
            CustomizationRoot customizationRoot = GetCustomizationRoot(connectionType);

            QueryExpression query = new QueryExpression
            {
                EntityName = "systemform",
                ColumnSet  = new ColumnSet("formid", "introducedversion", "description", "isairmerged", "iscustomizable", "formpresentation", "formxml", "componentstate", "isdesktopenabled", "formjson", "version", "versionnumber", "canbedeleted", "ismanaged", "formactivationstate", "uniquename", "type", "objecttypecode", "isdefault"),
                PageInfo   = new PagingInfo
                {
                    Count        = 5000,
                    PageNumber   = 1,
                    PagingCookie = null
                },
                Orders =
                {
                    new OrderExpression("objecttypecode", OrderType.Ascending),
                    new OrderExpression("name",           OrderType.Ascending),
                    //new OrderExpression("type", OrderType.Ascending)
                }
            };

            reportProgress(0, $"Retrieving and processing system forms data from {connectionType.ToString()}");
            List <Entity> formsResult = ExecuteQueryWithPaging(query, crmServiceClient);

            foreach (Entity form in formsResult)
            {
                string entityName = form.GetAttributeValue <string>("objecttypecode");
                string typeName   = form.FormattedValues["type"];

                CustomizationEntity customizationEntity = customizationRoot.Forms.Find(e => e.Name == entityName);
                if (customizationEntity == null)
                {
                    customizationEntity = new CustomizationEntity(entityName);
                    customizationRoot.Forms.Add(customizationEntity);
                }

                CustomizationType customizationType = customizationEntity.CustomzationTypes.Find(t => t.Name == typeName);
                if (customizationType == null)
                {
                    customizationType = new CustomizationType(typeName);
                    customizationEntity.CustomzationTypes.Add(customizationType);
                }

                customizationType.Entities.Add(form);
            }
        }
 public static string ToSuffix(this CustomizationType value)
 {
     return(value switch
     {
         CustomizationType.Face => "fac",
         CustomizationType.Iris => "iri",
         CustomizationType.Accessory => "acc",
         CustomizationType.Hair => "hir",
         CustomizationType.Tail => "til",
         CustomizationType.Etc => "etc",
         _ => throw new InvalidEnumArgumentException()
     });
        public CustomCustomizationWindow(CustomizationType ctype)
        {
            InitializeComponent();
            this.MaxHeight = SystemParameters.MaximizedPrimaryScreenHeight;
            LoadStyle();
            _ctype = ctype;
            AdaptImageSize();

            this.MouseDown += Window_MouseDown;

            btn_load.MouseLeftButtonDown     += LoadCustomization;
            btn_validate.MouseLeftButtonDown += ValidURL;
        }
Example #23
0
    private GameObject CreateNewItem(CustomizationType type, Sprite itemImage, string itemId, Sprite itemIcon, ItemStatus itemStatus)
    {
        GameObject newItem;

        switch (itemStatus)
        {
        case ItemStatus.Available:
            newItem = Instantiate(ValidItemPrefab, CustomizationGrid.transform);
            break;

        case ItemStatus.PendingPurchase:
            newItem = Instantiate(CoinsLockItemPrefab, CustomizationGrid.transform);
            var price = _itemsData[itemImage.name].Price.ToString();
            newItem.transform.GetComponentInChildren <TextMeshProUGUI>().text = price;
            break;

        case ItemStatus.LockByLevel:
            newItem = Instantiate(LevelLockItemPrefab, CustomizationGrid.transform);
            var minLevel = _itemsData[itemImage.name].MinLevel.ToString();
            newItem.transform.GetComponentInChildren <TextMeshProUGUI>().text = minLevel;
            break;

        default:
            newItem = Instantiate(ValidItemPrefab, CustomizationGrid.transform);
            break;
        }

        newItem.transform.localScale = Vector3.one;

        newItem.GetComponent <Button>().onClick.AddListener(() => SetItemOnCharacter(type, itemImage, itemStatus));

        var itemInfo = newItem.AddComponent <ItemInfo>();

        itemInfo.Type  = type;
        itemInfo.id    = itemId;
        itemInfo.Icon  = itemIcon;
        itemInfo.Image = itemImage;


        // Set icon & update the size base on icon sizes
        var iconSprite    = newItem.transform.GetChild(0).GetComponent <Image>();
        var rectTransform = newItem.transform.GetChild(0).GetComponent <RectTransform>();

        rectTransform.sizeDelta = new Vector2(itemInfo.Icon.rect.width, itemInfo.Icon.rect.height);
        iconSprite.sprite       = itemIcon;


        newItem.SetActive(false);
        return(newItem);
    }
        protected string GetCustomizationId(string scriptId, string customType = "customRecordType")
        {
            CustomizationType ct = new CustomizationType();

            ct.getCustomizationTypeSpecified = true;
            ct.getCustomizationType          = (GetCustomizationType)Enum.Parse(typeof(GetCustomizationType), customType, true);
            GetCustomizationIdResult getCustIdResult = Service(true).getCustomizationId(ct, false);

            foreach (var customizationRef in getCustIdResult.customizationRefList)
            {
                if (customizationRef.scriptId == scriptId)
                {
                    return(customizationRef.internalId);
                }
            }
            return(null);
        }
Example #25
0
    public void OnSectionButtonClick(string selectedSectionStr)
    {
        var newSelectedSection = (CustomizationType)Enum.Parse(typeof(CustomizationType), selectedSectionStr);

        foreach (var item in _customization[_currentSelectedSection])
        {
            item.SetActive(false);
        }

        foreach (var item in _customization[newSelectedSection])
        {
            item.SetActive(true);
        }


        _currentSelectedSection = newSelectedSection;
    }
 public void SendAskPrestigeCustomizations(CustomizationType ctype)
 {
     Client.Send(PacketType.AskPrestigeCustoms, new StandardClientAskPrestigeCustomizations {
         Ctype = ctype
     });
     if (ctype == CustomizationType.Avatar || ctype == CustomizationType.Sleeve || ctype == CustomizationType.Partner)
     {
         FormExecution.OpenPrestigeCustomizationsViewer();
     }
     else if (ctype == CustomizationType.Title)
     {
         FormExecution.OpenPrestigeTitleViewer();
     }
     else if (ctype == CustomizationType.Border)
     {
         FormExecution.OpenPrestigeCustomizationsVerticalViewer();
     }
 }
        public static bool IsCustomizationEntryActive(Mobile mobile, CustomizationType customization)
        {
            if (mobile == null)
            {
                return(false);
            }
            if (!(mobile is PlayerMobile))
            {
                return(false);
            }

            PlayerMobile             player             = mobile as PlayerMobile;
            PlayerCustomizationEntry customizationEntry = null;

            if (player == null)
            {
                return(false);
            }

            if (player.m_PlayerEnhancementAccountEntry == null)
            {
                return(false);
            }

            foreach (PlayerCustomizationEntry entry in player.m_PlayerEnhancementAccountEntry.m_CustomizationEntries)
            {
                if (entry.m_CustomizationType == customization)
                {
                    customizationEntry = entry;
                    break;
                }
            }

            if (customizationEntry != null)
            {
                if (customizationEntry.m_Active)
                {
                    return(true);
                }
            }

            return(false);
        }
        public override void Deserialize(GenericReader reader)
        {
            base.Deserialize(reader);
            int version = reader.ReadInt();

            m_CustomizationEntries = new List <PlayerCustomizationEntry>();
            m_SpellHueEntries      = new List <SpellHueEntry>();

            if (version >= 0)
            {
                m_AccountUsername = reader.ReadString();

                int customizationEntries = reader.ReadInt();
                for (int a = 0; a < customizationEntries; a++)
                {
                    CustomizationType customizationType = (CustomizationType)reader.ReadInt();

                    bool unlocked = reader.ReadBool();
                    bool active   = reader.ReadBool();

                    m_CustomizationEntries.Add(new PlayerCustomizationEntry(customizationType, unlocked, active, true));
                }

                int spellHueEntries = reader.ReadInt();
                for (int a = 0; a < spellHueEntries; a++)
                {
                    HueableSpell spellHueType = (HueableSpell)reader.ReadInt();
                    SpellHueType activeType   = (SpellHueType)reader.ReadInt();

                    SpellHueEntry spellHueEntry = new SpellHueEntry(spellHueType, activeType);

                    int unlockedHueCount = reader.ReadInt();
                    for (int b = 0; b < unlockedHueCount; b++)
                    {
                        SpellHueType unlockedHue = (SpellHueType)reader.ReadInt();
                        spellHueEntry.m_UnlockedHues.Add(unlockedHue);
                    }

                    m_SpellHueEntries.Add(spellHueEntry);
                }
            }
        }
Example #29
0
        public static CustomizationEntry GetCustomizationEntry(PlayerMobile player, CustomizationType customization)
        {
            CustomizationEntry entry = null;

            if (player == null)
            {
                return(entry);
            }

            EnhancementsPersistance.CheckAndCreateEnhancementsAccountEntry(player);

            foreach (CustomizationEntry playerEntry in player.m_EnhancementsAccountEntry.m_Customizations)
            {
                if (playerEntry.m_Customization == customization)
                {
                    return(playerEntry);
                }
            }

            return(entry);
        }
Example #30
0
        public static bool HasCustomizationActive(PlayerMobile player, CustomizationType customization)
        {
            if (player == null)
            {
                return(false);
            }

            CustomizationEntry entry = GetCustomizationEntry(player, customization);

            if (entry == null)
            {
                return(false);
            }

            if (entry.m_Unlocked && entry.m_Active)
            {
                return(true);
            }

            return(false);
        }
Example #31
0
    private void SetItemOnCharacter(CustomizationType type, Sprite itemImage, ItemStatus itemStats)
    {
        if (itemStats != ItemStatus.Available)
        {
            return;
        }

        switch (type)
        {
        case CustomizationType.Outfits:
            OutfitObj.GetComponent <SpriteRenderer>().sprite = itemImage;
            break;

        case CustomizationType.Eyes:
            EyesObj.GetComponent <SpriteRenderer>().sprite = itemImage;
            break;

        case CustomizationType.Mouths:
            MouthObj.GetComponent <SpriteRenderer>().sprite = itemImage;
            break;
        }
    }
Example #32
0
		/// --------------------------------------------------------------------------------
		/// <summary>
		/// Initializes a new instance of the <see cref="XmlTranslation"/> class for an
		/// insertion or addition.
		/// </summary>
		/// --------------------------------------------------------------------------------
		public PhraseCustomization(string basePhrase, Question addedPhrase,
			CustomizationType type)
		{
			Reference = addedPhrase.ScriptureReference;
			OriginalPhrase = basePhrase;
			ModifiedPhrase = addedPhrase.Text;
			if (addedPhrase.Answers != null && addedPhrase.Answers.Length == 1)
				Answer = addedPhrase.Answers[0];
			Type = type;
		}