public SkillGroupControl(CharacterOptions objOptions, bool blnCareer = false)
 {
     InitializeComponent();
     LanguageManager.Instance.Load(GlobalOptions.Instance.Language, this);
     _blnCareer  = blnCareer;
     _objOptions = objOptions;
 }
Exemple #2
0
        private static void LoadCharacterOptions()
        {
            s_dicLoadedCharacterOptions.Clear();
            foreach (XPathNavigator xmlBuiltInSetting in XmlManager.LoadXPath("settings.xml").CreateNavigator().Select("/chummer/settings/setting"))
            {
                CharacterOptions objNewCharacterOptions = new CharacterOptions();
                if (objNewCharacterOptions.Load(xmlBuiltInSetting) && (!objNewCharacterOptions.BuildMethodIsLifeModule || GlobalOptions.LifeModuleEnabled))
                {
                    s_dicLoadedCharacterOptions.TryAdd(objNewCharacterOptions.SourceId, objNewCharacterOptions);
                }
            }
            string strSettingsPath = Path.Combine(Utils.GetStartupPath, "settings");

            if (Directory.Exists(strSettingsPath))
            {
                foreach (string strSettingsFilePath in Directory.EnumerateFiles(strSettingsPath, "*.xml"))
                {
                    string           strSettingName         = Path.GetFileName(strSettingsFilePath);
                    CharacterOptions objNewCharacterOptions = new CharacterOptions();
                    if (objNewCharacterOptions.Load(strSettingName, false) &&
                        (!objNewCharacterOptions.BuildMethodIsLifeModule || GlobalOptions.LifeModuleEnabled))
                    {
                        s_dicLoadedCharacterOptions.TryAdd(strSettingName, objNewCharacterOptions);
                    }
                }
            }
        }
Exemple #3
0
        /// <summary>
        /// Creates a list with CharacterRoot for every member in given guild.
        /// To avoid calling the wow api more than 100 times per second, this method limits the list of guild members (integer) to take.
        /// </summary>
        /// <param name="guildMembers">List with guildmembers</param>
        /// <param name="characterOptions">Options for CharacterRoot</param>
        /// <param name="levelThreshold">Take only members above or equal to this integer</param>
        /// <param name="membersToTake">How many members should be returned (mind the 100 calls per second cap)</param>
        /// <returns>List filled with characterRoot</returns>
        public async Task <List <CharacterRoot> > GetCharactersInGuildAsync(
            IEnumerable <GuildMember> guildMembers,
            CharacterOptions characterOptions,
            int levelThreshold,
            int membersToTake)
        {
            ////var guild = GetGuild(guildName, GuildOptions.Members, _Realm);
            var characterList = new List <CharacterRoot>();

            var order = from guildMemberLevel in guildMembers
                        orderby guildMemberLevel.Character.Level descending
                        select guildMemberLevel;

            var downloadTasksQuery = from member in order.Take(membersToTake)
                                     where member.Character.Level >= levelThreshold
                                     select this.GetCharacterAsync(
                member.Character.Name,
                characterOptions,
                Realm);

            var downloadTasks = downloadTasksQuery.ToList();

            while (downloadTasks.Count > 0)
            {
                var finishedTask = await Task.WhenAny(downloadTasks);

                downloadTasks.Remove(finishedTask);
                var character = await finishedTask;
                characterList.Add(character);
            }

            return(characterList);
        }
Exemple #4
0
        public frmExpense(CharacterOptions objCharacterOptions)
        {
            _objCharacterOptions = objCharacterOptions;

            InitializeComponent();
            this.TranslateWinForm();

            // Determine the DateTime format and use that to display the date field (removing seconds since they're not important).

            if (GlobalOptions.CustomDateTimeFormats)
            {
                datDate.CustomFormat = GlobalOptions.DatesIncludeTime
                    ? GlobalOptions.CustomDateFormat + GlobalOptions.CustomTimeFormat
                    : GlobalOptions.CustomDateFormat;
            }
            else
            {
                DateTimeFormatInfo objDateTimeInfo = GlobalOptions.CultureInfo.DateTimeFormat;
                datDate.CustomFormat = GlobalOptions.DatesIncludeTime
                    ? objDateTimeInfo.FullDateTimePattern.FastEscapeOnceFromEnd(":ss")
                    : objDateTimeInfo.LongDatePattern;
            }

            datDate.Value = DateTime.Now;

            txtDescription.Text = LanguageManager.GetString("String_ExpenseDefault");
        }
Exemple #5
0
 public static Character GetCharacter(string realm, string name, CharacterOptions options)
 {
     Character character = Characters.Exists(c => (c.Name == name) && (c.Realm == realm))
                               ? Characters.Find(c => (c.Name == name) && (c.Realm == realm))
                               : ApiClient.GetCharacter(realm, name, options);
     return character;
 }
 public CharacterShared(Character objCharacter)
 {
     _objCharacter = objCharacter;
     _objOptions   = _objCharacter.Options;
     _objCharacter.CharacterNameChanged += objCharacter_CharacterNameChanged;
     _gunneryCached = new Lazy <Skill>(() => _objCharacter.SkillsSection.GetActiveSkill("Gunnery"));
 }
Exemple #7
0
    //grabs all relevent UI components on children
    void SetUI()
    {
        GameObject heightholder = transform.GetChild(0).gameObject;

        _heightText = heightholder.transform.GetChild(0).GetComponent <Text>();

        _timeline = transform.GetChild(1).gameObject;
        _timeRef  = _timeline.GetComponent <BattleTimeLine>();
        _timeRef.Init(this);

        _shortHolder = transform.GetChild(2).gameObject;
        _shortPort   = _shortHolder.transform.GetChild(0).GetComponent <Image>();
        _shortHealth = _shortHolder.transform.GetChild(1).GetComponent <Text>();
        _shortMana   = _shortHolder.transform.GetChild(2).GetComponent <Text>();
        _shortHolder.SetActive(false);

        _optionsRef = transform.GetChild(3).GetComponent <CharacterOptions>();
        _optionsRef.Init();

        _detailHolder = transform.GetChild(4).GetComponent <CharacterDescription>();
        _detailHolder.Init();

        _endingHolder = transform.GetChild(5).GetComponent <BattleEnding>();
        _endingHolder.Init();

        _initialized = true;

        _timeRef.ContinueFight();
    }
Exemple #8
0
        public static System.Text.StringBuilder GetRandomStringBuilder(int count, CharacterOptions options)
        {
            System.Text.StringBuilder sb = new System.Text.StringBuilder(count);
            sb.Append(GetRandomChars(count, options));

            return(sb);
        }
Exemple #9
0
        /// <summary>
        /// Creates a list with CharacterRoot for every member in given guild using an array with the names of those members.
        /// </summary>
        /// <param name="guildMembers">string array with guildmembers</param>
        /// <param name="characterOptions"></param>
        /// <returns>HashSet filled with characterRoot objects</returns>
        public async Task <HashSet <CharacterRoot> > GetCharactersInGuildAsync(
            string[] guildMembers,
            CharacterOptions characterOptions)
        {
            var memberHashSet    = new HashSet <string>(guildMembers);
            var characterHashSet = new HashSet <CharacterRoot>();

            var downloadTasks = new HashSet <Task <CharacterRoot> >();

            for (int i = 0; i < memberHashSet.Count; i++)
            {
                downloadTasks.Add(this.GetCharacterAsync(memberHashSet.ElementAt(i), characterOptions, this.Realm));
            }

            while (downloadTasks.Count > 0)
            {
                var finishedTask = await Task.WhenAny(downloadTasks);

                downloadTasks.Remove(finishedTask);
                var finished = await finishedTask;
                characterHashSet.Add(finished);
            }

            return(characterHashSet);
        }
Exemple #10
0
        public static string buildOptionalQuery(CharacterOptions characterOptions)
        {
            string query = "&fields=";
            List<string> tmp = new List<string>();

            if ((characterOptions & CharacterOptions.GetGuild) == CharacterOptions.GetGuild)
                tmp.Add("guild");

            if ((characterOptions & CharacterOptions.GetStats) == CharacterOptions.GetStats)
                tmp.Add("stats");

            if ((characterOptions & CharacterOptions.GetTalents) == CharacterOptions.GetTalents)
                tmp.Add("talents");

            if ((characterOptions & CharacterOptions.GetItems) == CharacterOptions.GetItems)
                tmp.Add("items");

            if ((characterOptions & CharacterOptions.GetReputation) == CharacterOptions.GetReputation)
                tmp.Add("reputation");

            if ((characterOptions & CharacterOptions.GetTitles) == CharacterOptions.GetTitles)
                tmp.Add("titles");

            if ((characterOptions & CharacterOptions.GetProfessions) == CharacterOptions.GetProfessions)
                tmp.Add("professions");

            if ((characterOptions & CharacterOptions.GetAppearance) == CharacterOptions.GetAppearance)
                tmp.Add("appearance");

            if ((characterOptions & CharacterOptions.GetCompanions) == CharacterOptions.GetCompanions)
                tmp.Add("companions");

            if ((characterOptions & CharacterOptions.GetMounts) == CharacterOptions.GetMounts)
                tmp.Add("mounts");

            if ((characterOptions & CharacterOptions.GetPets) == CharacterOptions.GetPets)
                tmp.Add("pets");

            if ((characterOptions & CharacterOptions.GetAchievements) == CharacterOptions.GetAchievements)
                tmp.Add("achievements");

            if ((characterOptions & CharacterOptions.GetProgression) == CharacterOptions.GetProgression)
                tmp.Add("progression");

            if ((characterOptions & CharacterOptions.GetFeed) == CharacterOptions.GetFeed)
                tmp.Add("feed");

            if ((characterOptions & CharacterOptions.GetPvP) == CharacterOptions.GetPvP)
                tmp.Add("pvp");

            if ((characterOptions & CharacterOptions.GetQuests) == CharacterOptions.GetQuests)
                tmp.Add("quests");

            if (tmp.Count == 0) return string.Empty;

            query += string.Join(",", tmp.ToArray());

            return query;
        }
Exemple #11
0
            public void LoginCharacter(Button button)
            {
                CharacterOptions options = button.transform.parent.GetComponent <CharacterOptions>();

                characterId = options.characterId;
                //Debug.Log("Using character " + characterId);
                CharacterApi.instance.SetCharacter(characterId, this);
            }
Exemple #12
0
 //Initialize Ability Options
 public void Init(BattleUI bat, CharacterOptions opt)
 {
     _battleRef    = bat;
     _optionsRef   = opt;
     _selectedChar = null;
     _hidden       = true;
     SetUI();
 }
Exemple #13
0
        public static Character GetCharacter(string realm, string name, CharacterOptions options)
        {
            Character character = Characters.Exists(c => (c.Name == name) && (c.Realm == realm))
                                      ? Characters.Find(c => (c.Name == name) && (c.Realm == realm))
                                      : ApiClient.GetCharacter(realm, name, options);

            return(character);
        }
Exemple #14
0
        public frmSelectBP(Character objCharacter, bool blnUseCurrentValues = false)
        {
            _objCharacter        = objCharacter;
            _objOptions          = _objCharacter.Options;
            _blnUseCurrentValues = blnUseCurrentValues;
            InitializeComponent();
            LanguageManager.Instance.Load(this);

            // Populate the Build Method list.
            List <ListItem> lstBuildMethod = new List <ListItem>();
            //ListItem objBP = new ListItem();
            //objBP.Value = "BP";
            //objBP.Name = LanguageManager.Instance.GetString("String_BP");

            //ListItem objKarma = new ListItem();
            //objKarma.Value = "Karma";
            //objKarma.Name = LanguageManager.Instance.GetString("String_Karma");

            ListItem objPriority = new ListItem();

            objPriority.Value = "Priority";
            objPriority.Name  = LanguageManager.Instance.GetString("String_Priority");

            //lstBuildMethod.Add(objBP);
            //lstBuildMethod.Add(objKarma);
            lstBuildMethod.Add(objPriority);
            cboBuildMethod.DataSource    = lstBuildMethod;
            cboBuildMethod.ValueMember   = "Value";
            cboBuildMethod.DisplayMember = "Name";

            cboBuildMethod.SelectedValue = _objOptions.BuildMethod;
            nudBP.Value       = _objOptions.BuildPoints;
            nudMaxAvail.Value = _objOptions.Availability;

            toolTip1.SetToolTip(chkIgnoreRules, LanguageManager.Instance.GetString("Tip_SelectBP_IgnoreRules"));

            if (blnUseCurrentValues)
            {
                //if (objCharacter.BuildMethod == CharacterBuildMethod.Karma)
                //{
                //    cboBuildMethod.SelectedValue = "Karma";
                //    nudBP.Value = objCharacter.BuildKarma;
                //}
                //else if (objCharacter.BuildMethod == CharacterBuildMethod.BP)
                //{
                //    cboBuildMethod.SelectedValue = "BP";
                //    nudBP.Value = objCharacter.BuildPoints;
                //}
                cboBuildMethod.SelectedValue = "Priority";
                nudBP.Value = objCharacter.BuildKarma;

                nudMaxAvail.Value = objCharacter.MaximumAvailability;

                cboBuildMethod.Enabled = false;
            }
        }
Exemple #15
0
        public Character GetCharacter(Region region, string realm, string name, CharacterOptions characterOptions)
        {
            Character character;

            TryGetData <Character>(
                string.Format(@"{0}/wow/character/{1}/{2}?locale={3}{4}&apikey={5}", Host, realm, name, Locale, CharacterUtility.buildOptionalQuery(characterOptions), APIKey),
                out character);

            return(character);
        }
Exemple #16
0
        /// <summary>
        /// Returns a random char that is not c
        /// </summary>
        public static char GetRandomOtherChar(char c, CharacterOptions options)
        {
            switch (options)
            {
            case CharacterOptions.ASCII:
                return(GetRandomOtherASCIIChar(c));

            default:
                return(GetRandomOtherUnicodeChar(c));
            }
        }
Exemple #17
0
 public static void GetRandomChars(char[] chars, int index, int count, CharacterOptions options)
 {
     if (0 != (options & CharacterOptions.Surrogates))
     {
         GetRandomCharsWithSurrogates(chars, index, count);
     }
     if (0 != (options & CharacterOptions.ASCII))
     {
         GetRandomASCIIChars(chars, index, count);
     }
     else
     {
         GetRandomCharsWithoutSurrogates(chars, index, count);
     }
 }
Exemple #18
0
        public frmExpense(CharacterOptions objCharacterOptions)
        {
            _objCharacterOptions = objCharacterOptions;

            InitializeComponent();
            LanguageManager.TranslateWinForm(GlobalOptions.Language, this);

            // Determine the DateTime format and use that to display the date field (removing seconds since they're not important).
            DateTimeFormatInfo objDateTimeInfo = GlobalOptions.CultureInfo.DateTimeFormat;

            datDate.CustomFormat = GlobalOptions.DatesIncludeTime ? objDateTimeInfo.FullDateTimePattern.Replace(":ss", string.Empty) : objDateTimeInfo.LongDatePattern;
            datDate.Value        = DateTime.Now;

            txtDescription.Text = LanguageManager.GetString("String_ExpenseDefault", GlobalOptions.Language);
        }
Exemple #19
0
 public static char[] GetRandomChars(int count, CharacterOptions options)
 {
     if (0 != (options & CharacterOptions.Surrogates))
     {
         return(GetRandomCharsWithSurrogates(count));
     }
     if (0 != (options & CharacterOptions.ASCII))
     {
         return(GetRandomASCIIChars(count));
     }
     else
     {
         return(GetRandomCharsWithoutSurrogates(count));
     }
 }
Exemple #20
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="name">The Characters name</param>
        /// <param name="characterOptions">What characteroptions should be set (enum)</param>
        /// <param name="realm"></param>
        /// <returns>CharacterRoot object</returns>
        public CharacterRoot GetCharacter(string name, CharacterOptions characterOptions, string realm)
        {
            var character = new CharacterRoot();

            var url = string.Format(@"{0}/wow/character/{1}/{2}?locale={3}{4}&apikey={5}",
                                    _Host,
                                    realm,
                                    name,
                                    _Locale,
                                    CharacterFields.BuildOptionalFields(characterOptions),
                                    _APIKey);

            character = json.GetDataFromURL <CharacterRoot>(url);

            return(character);
        }
Exemple #21
0
        /// <summary>
        /// Gets data about a character.
        /// </summary>
        /// <param name="name">The Characters name.</param>
        /// <param name="characterOptions">What characteroptions should be set (enum).</param>
        /// <param name="realm">The realm this character exists on.</param>
        /// <returns>CharacterRoot object</returns>
        public async Task <CharacterRoot> GetCharacterAsync(string name, CharacterOptions characterOptions, string realm)
        {
            var character = new CharacterRoot();

            var url =
                string.Format(
                    @"{0}/wow/character/{1}/{2}?locale={3}{4}&apikey={5}",
                    _Host,
                    realm,
                    name,
                    _Locale,
                    CharacterFields.BuildOptionalFields(characterOptions),
                    _APIKey);

            character = await this.jsonUtility.GetDataFromURLAsync <CharacterRoot>(url);

            return(character);
        }
Exemple #22
0
        private static void LoadCharacterOptions()
        {
            s_intDicLoadedCharacterOptionsLoadedStatus = 0;
            try
            {
                s_dicLoadedCharacterOptions.Clear();
                if (Utils.IsDesignerMode || Utils.IsRunningInVisualStudio)
                {
                    s_dicLoadedCharacterOptions.TryAdd(GlobalOptions.DefaultCharacterOption, new CharacterOptions());
                    return;
                }

                IEnumerable <XPathNavigator> xmlSettingsIterator = XmlManager.LoadXPath("settings.xml")
                                                                   .Select("/chummer/settings/setting").Cast <XPathNavigator>();
                Parallel.ForEach(xmlSettingsIterator, xmlBuiltInSetting =>
                {
                    CharacterOptions objNewCharacterOptions = new CharacterOptions();
                    if (objNewCharacterOptions.Load(xmlBuiltInSetting) &&
                        (!objNewCharacterOptions.BuildMethodIsLifeModule || GlobalOptions.LifeModuleEnabled))
                    {
                        s_dicLoadedCharacterOptions.TryAdd(objNewCharacterOptions.SourceId,
                                                           objNewCharacterOptions);
                    }
                });
                string strSettingsPath = Path.Combine(Utils.GetStartupPath, "settings");
                if (Directory.Exists(strSettingsPath))
                {
                    Parallel.ForEach(Directory.EnumerateFiles(strSettingsPath, "*.xml"), strSettingsFilePath =>
                    {
                        string strSettingName = Path.GetFileName(strSettingsFilePath);
                        CharacterOptions objNewCharacterOptions = new CharacterOptions();
                        if (objNewCharacterOptions.Load(strSettingName, false) &&
                            (!objNewCharacterOptions.BuildMethodIsLifeModule || GlobalOptions.LifeModuleEnabled))
                        {
                            s_dicLoadedCharacterOptions.TryAdd(strSettingName, objNewCharacterOptions);
                        }
                    });
                }
            }
            finally
            {
                s_intDicLoadedCharacterOptionsLoadedStatus = 1;
            }
        }
Exemple #23
0
        static Character MakeCharacter(CharacterGenerator characterGenerator, Dice dice,
                                       string selectedArchetype, string selectedRank, string selectedRace)
        {
            var options = new CharacterOptions(characterGenerator);

            //Archetypes
            if (selectedArchetype == null)
            {
                options.SelectedArchetype = null;
            }
            else
            {
                options.SelectedArchetype = characterGenerator.Archetypes.SingleOrDefault(a => a.Name == selectedArchetype);
            }

            //Ranks
            if (selectedRank == null)
            {
                options.SelectedRank = null;
            }
            else
            {
                options.SelectedRank = characterGenerator.Ranks.SingleOrDefault(a => a.Name == selectedRank);
            }

            //Race
            if (selectedRace == null)
            {
                options.SelectedRace = null;
            }
            else
            {
                options.SelectedRace = characterGenerator.Races.SingleOrDefault(a => a.Name == selectedRace);
            }

            return(characterGenerator.GenerateCharacter(options, dice));
        }
Exemple #24
0
        /// <summary>
        /// Fill the list of CyberwareGrades from the XML files.
        /// </summary>
        /// <param name="objSource">Source to load the Grades from, either Bioware or Cyberware.</param>
        public void LoadList(Improvement.ImprovementSource objSource, CharacterOptions objCharacterOptions = null)
        {
            _lstGrades.Clear();
            string strXmlFile = "cyberware.xml";

            if (objSource == Improvement.ImprovementSource.Bioware)
            {
                strXmlFile = "bioware.xml";
            }
            XmlDocument objXMlDocument = XmlManager.Load(strXmlFile);

            string strBookFilter = string.Empty;

            if (objCharacterOptions != null)
            {
                strBookFilter = "[(" + objCharacterOptions.BookXPath() + ")]";
            }
            foreach (XmlNode objNode in objXMlDocument.SelectNodes("/chummer/grades/grade" + strBookFilter))
            {
                Grade objGrade = new Grade();
                objGrade.Load(objNode);
                _lstGrades.Add(objGrade);
            }
        }
Exemple #25
0
 public InitiationGrade(Character objCharacter)
 {
     // Create the GUID for the new InitiationGrade.
     _guiID      = Guid.NewGuid();
     _objOptions = objCharacter.Options;
 }
Exemple #26
0
        //done (could use more testing)
        #region Character

        /// <summary>
        /// Get character. Use this if you have set the realm in ApiClient.
        /// </summary>
        /// <param name="name">The Characters name</param>
        /// <param name="characterOptions">What characteroptions should be set (enum)</param>
        /// <returns>CharacterRoot object</returns>
        public CharacterRoot GetCharacter(string name, CharacterOptions characterOptions)
        {
            return(this.GetCharacter(name, characterOptions, _Realm));
        }
        public frmSelectBuildMethod(Character objCharacter, bool blnUseCurrentValues = false)
        {
            _objCharacter        = objCharacter;
            _objOptions          = _objCharacter.Options;
            _blnUseCurrentValues = blnUseCurrentValues;
            InitializeComponent();
            LanguageManager.Instance.Load(GlobalOptions.Instance.Language, this);

            // Populate the Build Method list.
            List <ListItem> lstBuildMethod = new List <ListItem>();
            ListItem        objKarma       = new ListItem();

            objKarma.Value = "Karma";
            objKarma.Name  = LanguageManager.Instance.GetString("String_Karma");

            ListItem objPriority = new ListItem();

            objPriority.Value = "Priority";
            objPriority.Name  = LanguageManager.Instance.GetString("String_Priority");

            ListItem objSumtoTen = new ListItem();

            objSumtoTen.Value = "SumtoTen";
            objSumtoTen.Name  = LanguageManager.Instance.GetString("String_SumtoTen");

            if (GlobalOptions.Instance.LifeModuleEnabled)
            {
                ListItem objLifeModule = new ListItem();
                objLifeModule.Value = "LifeModule";
                objLifeModule.Name  = LanguageManager.Instance.GetString("String_LifeModule");
                lstBuildMethod.Add(objLifeModule);
            }

            lstBuildMethod.Add(objPriority);
            lstBuildMethod.Add(objKarma);
            lstBuildMethod.Add(objSumtoTen);
            cboBuildMethod.BeginUpdate();
            cboBuildMethod.ValueMember   = "Value";
            cboBuildMethod.DisplayMember = "Name";
            cboBuildMethod.DataSource    = lstBuildMethod;

            cboBuildMethod.SelectedValue = _objOptions.BuildMethod;
            cboBuildMethod.EndUpdate();
            nudKarma.Value    = _objOptions.BuildPoints;
            nudMaxAvail.Value = _objOptions.Availability;


            // Load the Priority information.

            XmlDocument objXmlDocumentGameplayOptions = XmlManager.Instance.Load("gameplayoptions.xml");

            // Populate the Gameplay Options list.
            string      strDefault = string.Empty;
            XmlNodeList objXmlGameplayOptionList = objXmlDocumentGameplayOptions.SelectNodes("/chummer/gameplayoptions/gameplayoption");

            foreach (XmlNode objXmlGameplayOption in objXmlGameplayOptionList)
            {
                string strName = objXmlGameplayOption["name"].InnerText;
                if (objXmlGameplayOption["default"]?.InnerText == "yes")
                {
                    strDefault = strName;
                }
                ListItem lstGameplay = new ListItem();
                cboGamePlay.Items.Add(strName);
            }
            cboGamePlay.Text = strDefault;
            XmlNode objXmlSelectedGameplayOption = objXmlDocumentGameplayOptions.SelectSingleNode("/chummer/gameplayoptions/gameplayoption[name = \"" + cboGamePlay.Text + "\"]");

            intQualityLimits = Convert.ToInt32(objXmlSelectedGameplayOption["karma"].InnerText);
            intNuyenBP       = Convert.ToInt32(objXmlSelectedGameplayOption["maxnuyen"].InnerText);
            toolTip1.SetToolTip(chkIgnoreRules, LanguageManager.Instance.GetString("Tip_SelectKarma_IgnoreRules"));

            if (blnUseCurrentValues)
            {
                cboBuildMethod.SelectedValue = "Karma";
                nudKarma.Value = objCharacter.BuildKarma;

                nudMaxAvail.Value = objCharacter.MaximumAvailability;

                cboBuildMethod.Enabled = false;
            }
        }
Exemple #28
0
        public frmSelectBuildMethod(Character objCharacter, bool blnUseCurrentValues = false)
        {
            _objCharacter        = objCharacter;
            _objOptions          = _objCharacter.Options;
            _blnUseCurrentValues = blnUseCurrentValues;
            InitializeComponent();
            LanguageManager.TranslateWinForm(GlobalOptions.Language, this);

            // Populate the Build Method list.
            List <ListItem> lstBuildMethod = new List <ListItem>
            {
                new ListItem("Karma", LanguageManager.GetString("String_Karma", GlobalOptions.Language)),
                new ListItem("Priority", LanguageManager.GetString("String_Priority", GlobalOptions.Language)),
                new ListItem("SumtoTen", LanguageManager.GetString("String_SumtoTen", GlobalOptions.Language)),
            };

            if (GlobalOptions.LifeModuleEnabled)
            {
                lstBuildMethod.Add(new ListItem("LifeModule", LanguageManager.GetString("String_LifeModule", GlobalOptions.Language)));
            }

            cboBuildMethod.BeginUpdate();
            cboBuildMethod.ValueMember   = "Value";
            cboBuildMethod.DisplayMember = "Name";
            cboBuildMethod.DataSource    = lstBuildMethod;
            cboBuildMethod.SelectedValue = _objOptions.BuildMethod;
            cboBuildMethod.EndUpdate();

            nudKarma.Value    = _objOptions.BuildPoints;
            nudMaxAvail.Value = _objOptions.Availability;

            // Populate the Gameplay Options list.
            XmlDocument objXmlDocumentGameplayOptions = XmlManager.Load("gameplayoptions.xml");
            XmlNodeList objXmlGameplayOptionList      = objXmlDocumentGameplayOptions.SelectNodes("/chummer/gameplayoptions/gameplayoption");

            List <ListItem> lstGameplayOptions = new List <ListItem>();

            foreach (XmlNode objXmlGameplayOption in objXmlGameplayOptionList)
            {
                string strName = objXmlGameplayOption["name"].InnerText;
                if (objXmlGameplayOption["default"]?.InnerText == bool.TrueString)
                {
                    _strDefaultOption = strName;
                }
                lstGameplayOptions.Add(new ListItem(strName, objXmlGameplayOption["translate"]?.InnerText ?? strName));
            }

            cboGamePlay.BeginUpdate();
            cboGamePlay.ValueMember   = "Value";
            cboGamePlay.DisplayMember = "Name";
            cboGamePlay.DataSource    = lstGameplayOptions;
            cboGamePlay.SelectedValue = _strDefaultOption;
            cboGamePlay.EndUpdate();

            toolTip1.SetToolTip(chkIgnoreRules, LanguageManager.GetString("Tip_SelectKarma_IgnoreRules", GlobalOptions.Language));

            if (blnUseCurrentValues)
            {
                cboGamePlay.SelectedValue = _objCharacter.GameplayOption;
                if (cboGamePlay.SelectedIndex == -1)
                {
                    cboGamePlay.SelectedValue = _strDefaultOption;
                }

                cboBuildMethod.Enabled       = false;
                cboBuildMethod.SelectedValue = _objCharacter.BuildMethod.ToString();

                nudKarma.Value    = objCharacter.BuildKarma;
                nudMaxNuyen.Value = decNuyenBP = _objCharacter.NuyenMaximumBP;

                intQualityLimits       = _objCharacter.GameplayOptionQualityLimit;
                chkIgnoreRules.Checked = _objCharacter.IgnoreRules;
                nudMaxAvail.Value      = objCharacter.MaximumAvailability;
                nudSumtoTen.Value      = objCharacter.SumtoTen;
            }
            else
            {
                XmlNode objXmlSelectedGameplayOption = objXmlDocumentGameplayOptions.SelectSingleNode("/chummer/gameplayoptions/gameplayoption[name = \"" + cboGamePlay.SelectedValue.ToString() + "\"]");
                intQualityLimits = Convert.ToInt32(objXmlSelectedGameplayOption["karma"].InnerText);
                decNuyenBP       = Convert.ToDecimal(objXmlSelectedGameplayOption["maxnuyen"].InnerText, GlobalOptions.InvariantCultureInfo);
            }
        }
Exemple #29
0
 public Character GetCharacter(string realm, string name, CharacterOptions characterOptions)
 {
     return(GetCharacter(Region, realm, name, characterOptions));
 }
Exemple #30
0
 public static string GetRandomString(int count, CharacterOptions options)
 {
     return(new string(GetRandomChars(count, options)));
 }
Exemple #31
0
        public frmSelectBP(Character objCharacter, bool blnUseCurrentValues = false)
        {
            _objCharacter        = objCharacter;
            _objOptions          = _objCharacter.Options;
            _blnUseCurrentValues = blnUseCurrentValues;
            InitializeComponent();
            LanguageManager.Instance.Load(GlobalOptions.Instance.Language, this);

            // Populate the Build Method list.
            List <ListItem> lstBuildMethod = new List <ListItem>();
            ListItem        objKarma       = new ListItem();

            objKarma.Value = "Karma";
            objKarma.Name  = LanguageManager.Instance.GetString("String_Karma");

            ListItem objPriority = new ListItem();

            objPriority.Value = "Priority";
            objPriority.Name  = LanguageManager.Instance.GetString("String_Priority");

            ListItem objSumtoTen = new ListItem();

            objSumtoTen.Value = "SumtoTen";
            objSumtoTen.Name  = LanguageManager.Instance.GetString("String_SumtoTen");

            lstBuildMethod.Add(objKarma);
            lstBuildMethod.Add(objPriority);
            lstBuildMethod.Add(objSumtoTen);
            cboBuildMethod.DataSource    = lstBuildMethod;
            cboBuildMethod.ValueMember   = "Value";
            cboBuildMethod.DisplayMember = "Name";

            cboBuildMethod.SelectedValue = _objOptions.BuildMethod;
            nudKarma.Value    = _objOptions.BuildPoints;
            nudMaxAvail.Value = _objOptions.Availability;

            // Load the Priority information.

            XmlDocument objXmlDocumentPriority = XmlManager.Instance.Load("priorities.xml");

            // Populate the Gameplay Options list.
            string      strDefault = "";
            XmlNodeList objXmlGameplayOptionList = objXmlDocumentPriority.SelectNodes("/chummer/gameplayoptions/gameplayoption");

            foreach (XmlNode objXmlGameplayOption in objXmlGameplayOptionList)
            {
                string strName = objXmlGameplayOption["name"].InnerText;
                try
                {
                    if (objXmlGameplayOption["default"].InnerText == "yes")
                    {
                        strDefault = strName;
                    }
                }
                catch { }
                ListItem lstGameplay = new ListItem();
                cboGamePlay.Items.Add(strName);
            }
            cboGamePlay.Text = strDefault;

            toolTip1.SetToolTip(chkIgnoreRules, LanguageManager.Instance.GetString("Tip_SelectKarma_IgnoreRules"));

            if (blnUseCurrentValues)
            {
                cboBuildMethod.SelectedValue = "Karma";
                nudKarma.Value = objCharacter.BuildKarma;

                nudMaxAvail.Value = objCharacter.MaximumAvailability;

                cboBuildMethod.Enabled = false;
            }
        }
Exemple #32
0
        /// <summary>
        /// Gets data about a character.
        /// </summary>
        /// <param name="name">The Characters name.</param>
        /// <param name="characterOptions">What characteroptions should be set (enum).</param>
        /// <param name="realm">The realm this character exists on.</param>
        /// <returns>CharacterRoot object</returns>
        public async Task <CharacterRoot> GetCharacterAsync(string name, CharacterOptions characterOptions, string realm)
        {
            var url = $"{Host}/wow/character/{realm}/{name}?locale={Locale}{CharacterFields.BuildOptionalFields(characterOptions)}&apikey={APIKey}";

            return(await this._jsonUtility.GetDataFromURLAsync <CharacterRoot>(url));
        }