public void Load(string characterName, CharacterRegion region, string realm) { NameText.Text = characterName; RealmText.Text = realm; RegionCombo.SelectedItem = region.ToString(); OKButton_Click(null, null); }
/// <inheritdoc/> public override SpriteFont ImportPreprocessed(ContentManager manager, IContentProcessorMetadata metadata, BinaryReader reader) { var fileVersion = 0; var characterRegionCount = reader.ReadInt32(); if (characterRegionCount == Int32.MaxValue) { fileVersion = reader.ReadInt32(); characterRegionCount = reader.ReadInt32(); } var characterRegions = characterRegionCount > 0 ? new CharacterRegion[characterRegionCount] : null; for (int i = 0; i < characterRegionCount; i++) { characterRegions[i] = new CharacterRegion( reader.ReadChar(), reader.ReadChar()); } var faceRegular = ImportPreprocessedFace(manager, metadata, reader, characterRegions, fileVersion); var faceBold = ImportPreprocessedFace(manager, metadata, reader, characterRegions, fileVersion); var faceItalic = ImportPreprocessedFace(manager, metadata, reader, characterRegions, fileVersion); var faceBoldItalic = ImportPreprocessedFace(manager, metadata, reader, characterRegions, fileVersion); return(new SpriteFont(manager.Ultraviolet, faceRegular, faceBold, faceItalic, faceBoldItalic)); }
public void GetCharacterAsync(CharacterRegion region, string realm, string name, bool forceRefresh) { string url = string.Format(URL_CHAR_REQ, region.ToString().ToLower(), realm, name, forceRefresh ? "!" : ""); _webClient.DownloadStringAsync(new Uri(url)); this.Progress = "Downloading Character Data..."; }
/*void WindowsComboBox_SelectionChanged(object sender, SelectionChangedEventArgs e) * { * if (_mainPage.WindowsComboBox != null) * { * int newIndex = _mainPage.WindowsComboBox.SelectedIndex; * if (newIndex > 0) * { * Control window = (Control)((ComboBoxItem)_mainPage.WindowsComboBox.SelectedItem).Tag; * _mainPage.WindowsComboBox.IsDropDownOpen = false; * _mainPage.WindowsComboBox.SelectedIndex = 0; * ShowWindow(window); * } * } * }*/ private void ProcessBookmark() { if (HtmlPage.IsEnabled) { string bookmark = HtmlPage.Window.CurrentBookmark; if (!string.IsNullOrEmpty(bookmark)) { if (bookmark.StartsWith("~")) { string identifier = bookmark.Substring(1); _mainPage.LoadCharacterFromRawr4Repository(identifier); } else if (bookmark.Contains("@") && bookmark.Contains("-")) { string characterName = bookmark.Substring(0, bookmark.IndexOf("@")); string realm = bookmark.Substring(bookmark.IndexOf("@") + 1); CharacterRegion region = (CharacterRegion)Enum.Parse(typeof(CharacterRegion), realm.Substring(0, 2), true); realm = realm.Substring(3); _mainPage.LoadCharacterFromBNet(characterName, region, realm); } else if (Calculations.Models.ContainsKey(bookmark)) { Calculations.LoadModel(Calculations.Models[bookmark]); } } } }
public static List <char> GetCharactersToImport(SpriteFontAsset asset) { var characters = new List <char>(); var fontTypeStatic = asset.FontType as OfflineRasterizedSpriteFontType; if (fontTypeStatic == null) { throw new ArgumentException("Tried to compile a dynamic sprite font with compiler for signed distance field fonts"); } // extract the list from the provided file if it exits if (File.Exists(fontTypeStatic.CharacterSet)) { string text; using (var streamReader = new StreamReader(fontTypeStatic.CharacterSet, Encoding.UTF8)) text = streamReader.ReadToEnd(); characters.AddRange(text); } // add character coming from character ranges characters.AddRange(CharacterRegion.Flatten(fontTypeStatic.CharacterRegions)); // remove duplicated characters characters = characters.Distinct().ToList(); return(characters); }
public void LoadCharacterFromArmory(string characterName, CharacterRegion region, string realm) { ArmoryLoadDialog armoryLoad = new ArmoryLoadDialog(); armoryLoad.Closed += new EventHandler(armoryLoad_Closed); armoryLoad.Show(); armoryLoad.Load(characterName, region, realm); }
public XmlDocument DownloadUpgrades(string characterName, CharacterRegion region, string realm, int itemId) { //http://{0}.wowarmory.com/search.xml?searchType=items&pr={1}&pn={2}&pi={3} string domain = _domains[region]; XmlDocument doc = null; if (!String.IsNullOrEmpty(characterName)) { doc = DownloadXml(string.Format(NetworkSettingsProvider.ItemUpgradeURI, domain, realm, characterName, itemId.ToString())); } return(doc); }
public XmlDocument DownloadCharacterTalentTree(string characterName, CharacterRegion region, string realm) { //http://{0}.wowarmory.com/character-talents.xml?r={1}&cn={2} //string domain = _domains[region]; XmlDocument doc = null; /*if (!String.IsNullOrEmpty(characterName)) * { * doc = DownloadXml(string.Format(NetworkSettingsProvider.CharacterTalentURI, * domain, realm, characterName)); * }*/ return(doc); }
public XmlDocument DownloadCharacterSheet(string characterName, CharacterRegion region, string realm) { //http://{0}.wowarmory.com/character-sheet.xml?r={1}&cn={2} string domain = _domains[region]; XmlDocument doc = null; if (!String.IsNullOrEmpty(characterName)) { doc = DownloadXml(string.Format(NetworkSettingsProvider.CharacterSheetURI, domain, realm, characterName)); } return(doc); }
private static IEnumerable <CharacterRegion> CreateCharacterRegionsFromSourceFile(FontGenerationParameters parameters) { var culture = parameters.SourceCulture ?? CultureInfo.CurrentCulture.ToString(); var files = parameters.SourceFile.Split(','); var filesText = new StringBuilder(); foreach (var file in files) { try { var ext = Path.GetExtension(file)?.ToLowerInvariant(); if (ext == ".xml" || ext == ".json") { var db = new LocalizationDatabase(); db.LoadFromFile(file); Console.Write("Reading source file '{0}'... ", Path.GetFileName(file)); var count = 0; foreach (var lstring in db.EnumerateCultureStrings(culture)) { foreach (var variant in lstring.Value) { filesText.Append(variant.Value); count++; } } Console.WriteLine("(found {0} string variants)", count); } else { Console.WriteLine("Reading source file '{0}'...", Path.GetFileName(file)); filesText.Append(File.ReadAllText(file)); } } catch (FileNotFoundException) { Console.WriteLine("Unable to read file '{0}'.", file); } catch (DirectoryNotFoundException) { Console.WriteLine("Unable to read file '{0}'.", file); } } filesText.Append(parameters.SubstitutionCharacter); return(CharacterRegion.CreateFromSourceText(filesText.ToString())); }
public void OnRegionRequest(MessageEventArgs args, RegionRequest request) { _selected = _characters[request.CharacterSlot]; if (_selected == null) { // TODO send RegionList throw new System.NotImplementedException(); } else { // TODO make region addresses part of server configuration // a server behind a NAT firewall does not know what a client thinks its address is var ep = args.Session.LocalEndPoint; var region = new Region(_selected.Region, ep.Address, ep.Port); var response = new CharacterRegion(region); args.Session.Send(response); } }
public static List <char> GetCharactersToImport(SpriteFontAsset asset) { var characters = new List <char>(); // extract the list from the provided file if it exits if (File.Exists(asset.CharacterSet)) { string text; using (var streamReader = new StreamReader(asset.CharacterSet, Encoding.UTF8)) text = streamReader.ReadToEnd(); characters.AddRange(text); } // add character coming from character ranges characters.AddRange(CharacterRegion.Flatten(asset.CharacterRegions)); // remove duplicated characters characters = characters.Distinct().ToList(); return(characters); }
public void loadFromInfo() { CharacterRace race = (CharacterRace)(m_characterInfo["RaceId"] as long?); CharacterClass charClass = (CharacterClass)(m_characterInfo["ClassId"] as long?); // it might be possible to get this from the Locale field, but I'd need data from the other regions CharacterRegion charRegion = CharacterRegion.US; m_character = new Character(m_sName, m_sRealm, charRegion, race, new BossOptions(), getGearStringBySlot(m_characterInfo, "Head", false), getGearStringBySlot(m_characterInfo, "Neck", false), getGearStringBySlot(m_characterInfo, "Shoulder", false), getGearStringBySlot(m_characterInfo, "Back", false), getGearStringBySlot(m_characterInfo, "Chest", false), getGearStringBySlot(m_characterInfo, "Shirt", false), getGearStringBySlot(m_characterInfo, "Tabard", false), getGearStringBySlot(m_characterInfo, "Wrist", false), getGearStringBySlot(m_characterInfo, "Hands", false), getGearStringBySlot(m_characterInfo, "Waist", false), getGearStringBySlot(m_characterInfo, "Legs", false), getGearStringBySlot(m_characterInfo, "Feet", false), getGearStringBySlot(m_characterInfo, "Finger0", false), getGearStringBySlot(m_characterInfo, "Finger1", false), getGearStringBySlot(m_characterInfo, "Trinket0", false), getGearStringBySlot(m_characterInfo, "Trinket1", false), getGearStringBySlot(m_characterInfo, "MainHand", false), getGearStringBySlot(m_characterInfo, "SecondaryHand", false), getGearStringBySlot(m_characterInfo, "Ranged", false), getGearStringBySlot(m_characterInfo, "Ammo", false), null // Not sure what projectile bag is called /*null, //TODO: Find ExtraWristSocket * null, //TODO: Find ExtraHandsSocket * null, //TODO: Find ExtraWaistSocket * getEnchantBySlot(characterInfo, "Head"), * getEnchantBySlot(characterInfo, "Shoulder"), * getEnchantBySlot(characterInfo, "Back"), * getEnchantBySlot(characterInfo, "Chest"), * getEnchantBySlot(characterInfo, "Wrist"), * getEnchantBySlot(characterInfo, "Hands"), * getEnchantBySlot(characterInfo, "Legs"), * getEnchantBySlot(characterInfo, "Feet"), * getEnchantBySlot(characterInfo, "Finger0"), * getEnchantBySlot(characterInfo, "Finger1"), * getEnchantBySlot(characterInfo, "MainHand"), * getEnchantBySlot(characterInfo, "SecondaryHand"), * getEnchantBySlot(characterInfo, "Ranged")*/ ); // set the character class Character.Class = charClass; // only try and load the talents if they actually have them if (m_iLevel >= 10) { // create an empty talent tree switch (charClass) { case CharacterClass.Warrior: m_character.WarriorTalents = new WarriorTalents(); break; case CharacterClass.Paladin: m_character.PaladinTalents = new PaladinTalents(); break; case CharacterClass.Hunter: m_character.HunterTalents = new HunterTalents(); break; case CharacterClass.Rogue: m_character.RogueTalents = new RogueTalents(); break; case CharacterClass.Priest: m_character.PriestTalents = new PriestTalents(); break; case CharacterClass.Shaman: m_character.ShamanTalents = new ShamanTalents(); break; case CharacterClass.Mage: m_character.MageTalents = new MageTalents(); break; case CharacterClass.Warlock: m_character.WarlockTalents = new WarlockTalents(); break; case CharacterClass.Druid: m_character.DruidTalents = new DruidTalents(); break; case CharacterClass.DeathKnight: m_character.DeathKnightTalents = new DeathKnightTalents(); break; default: break; } // load up the talents setTalentsFromTree(m_characterInfo); } // Populate available items // Note that some of these items cannot be enchanted // But they should correctly return ".0" for their enchants. List <string> asOptimizableItems = new List <string>(); addEquippedItemForOptimization(asOptimizableItems, m_characterInfo, "Head"); addEquippedItemForOptimization(asOptimizableItems, m_characterInfo, "Neck"); addEquippedItemForOptimization(asOptimizableItems, m_characterInfo, "Shoulder"); addEquippedItemForOptimization(asOptimizableItems, m_characterInfo, "Back"); addEquippedItemForOptimization(asOptimizableItems, m_characterInfo, "Chest"); addEquippedItemForOptimization(asOptimizableItems, m_characterInfo, "Shirt"); addEquippedItemForOptimization(asOptimizableItems, m_characterInfo, "Tabard"); addEquippedItemForOptimization(asOptimizableItems, m_characterInfo, "Wrist"); addEquippedItemForOptimization(asOptimizableItems, m_characterInfo, "Hands"); addEquippedItemForOptimization(asOptimizableItems, m_characterInfo, "Waist"); addEquippedItemForOptimization(asOptimizableItems, m_characterInfo, "Legs"); addEquippedItemForOptimization(asOptimizableItems, m_characterInfo, "Feet"); addEquippedItemForOptimization(asOptimizableItems, m_characterInfo, "Finger0"); addEquippedItemForOptimization(asOptimizableItems, m_characterInfo, "Finger1"); addEquippedItemForOptimization(asOptimizableItems, m_characterInfo, "Trinket0"); addEquippedItemForOptimization(asOptimizableItems, m_characterInfo, "Trinket1"); addEquippedItemForOptimization(asOptimizableItems, m_characterInfo, "MainHand"); addEquippedItemForOptimization(asOptimizableItems, m_characterInfo, "SecondaryHand"); addEquippedItemForOptimization(asOptimizableItems, m_characterInfo, "Ranged"); addEquippedItemForOptimization(asOptimizableItems, m_characterInfo, "Ammo"); addPossessionsForOptimization(asOptimizableItems, m_characterInfo); m_character.AvailableItems = asOptimizableItems; }
public XmlDocument DownloadUpgrades(string characterName, CharacterRegion region, string realm, int itemId) { //http://{0}.wowarmory.com/search.xml?searchType=items&pr={1}&pn={2}&pi={3} string domain = _domains[region]; XmlDocument doc = null; if (!String.IsNullOrEmpty(characterName)) { doc = DownloadXml(string.Format(NetworkSettingsProvider.ItemUpgradeURI, domain, realm, characterName, itemId.ToString())); } return doc; }
public XmlDocument DownloadCharacterSheet(string characterName, CharacterRegion region, string realm) { //http://{0}.wowarmory.com/character-sheet.xml?r={1}&cn={2} string domain = _domains[region]; XmlDocument doc = null; if (!String.IsNullOrEmpty(characterName)) { doc = DownloadXml(string.Format(NetworkSettingsProvider.CharacterSheetURI, domain, realm, characterName)); } return doc; }
// Armory (Retired) public void LoadCharacterFromArmory(string characterName, CharacterRegion region, string realm) { ArmoryLoadDialog armoryLoad = new ArmoryLoadDialog(); armoryLoad.Closed += new EventHandler(armoryLoad_Closed); armoryLoad.Show(); armoryLoad.Load(characterName, region, realm); }
// The following are special contructors used by optimizer, they assume the cached items/enchant are always used, and the underlying gemmedid/enchantid are never used public Character(string name, string realm, CharacterRegion region, CharacterRace race, BossOptions boss, ItemInstance head, ItemInstance neck, ItemInstance shoulders, ItemInstance back, ItemInstance chest, ItemInstance shirt, ItemInstance tabard, ItemInstance wrist, ItemInstance hands, ItemInstance waist, ItemInstance legs, ItemInstance feet, ItemInstance finger1, ItemInstance finger2, ItemInstance trinket1, ItemInstance trinket2, ItemInstance mainHand, ItemInstance offHand, ItemInstance ranged, ItemInstance projectile, ItemInstance projectileBag, List<Buff> activeBuffs, string model) { Initialize(); IsLoading = true; _name = name; _realm = realm; _region = region; _race = race; _item[(int)CharacterSlot.Head] = head; _item[(int)CharacterSlot.Neck] = neck; _item[(int)CharacterSlot.Shoulders] = shoulders; _item[(int)CharacterSlot.Back] = back; _item[(int)CharacterSlot.Chest] = chest; _item[(int)CharacterSlot.Shirt] = shirt; _item[(int)CharacterSlot.Tabard] = tabard; _item[(int)CharacterSlot.Wrist] = wrist; _item[(int)CharacterSlot.Hands] = hands; _item[(int)CharacterSlot.Waist] = waist; _item[(int)CharacterSlot.Legs] = legs; _item[(int)CharacterSlot.Feet] = feet; _item[(int)CharacterSlot.Finger1] = finger1; _item[(int)CharacterSlot.Finger2] = finger2; _item[(int)CharacterSlot.Trinket1] = trinket1; _item[(int)CharacterSlot.Trinket2] = trinket2; _item[(int)CharacterSlot.MainHand] = mainHand; _item[(int)CharacterSlot.OffHand] = offHand; _item[(int)CharacterSlot.Ranged] = ranged; _item[(int)CharacterSlot.Projectile] = projectile; _item[(int)CharacterSlot.ProjectileBag] = projectileBag; IsLoading = false; ActiveBuffs = new List<Buff>(activeBuffs); SetFaction(); CurrentModel = model; RecalculateSetBonuses(); BossOptions = boss.Clone(); }
public Character(string name, string realm, CharacterRegion region, CharacterRace race, BossOptions boss, ItemInstance head, ItemInstance neck, ItemInstance shoulders, ItemInstance back, ItemInstance chest, ItemInstance shirt, ItemInstance tabard, ItemInstance wrist, ItemInstance hands, ItemInstance waist, ItemInstance legs, ItemInstance feet, ItemInstance finger1, ItemInstance finger2, ItemInstance trinket1, ItemInstance trinket2, ItemInstance mainHand, ItemInstance offHand, ItemInstance ranged, ItemInstance projectile, ItemInstance projectileBag) { Initialize(); //_trackEquippedItemChanges = trackEquippedItemChanges; IsLoading = true; _name = name; _realm = realm; _region = region; _race = race; Head = head; Neck = neck; Shoulders = shoulders; Back = back; Chest = chest; Shirt = shirt; Tabard = tabard; Wrist = wrist; Hands = hands; Waist = waist; Legs = legs; Feet = feet; Finger1 = finger1; Finger2 = finger2; Trinket1 = trinket1; Trinket2 = trinket2; MainHand = mainHand; OffHand = offHand; Ranged = ranged; Projectile = projectile; ProjectileBag = projectileBag; _activeBuffs = new List<Buff>(); SetFaction(); IsLoading = false; RecalculateSetBonuses(); BossOptions = boss.Clone(); }
public Character(string name, string realm, CharacterRegion region, CharacterRace race, BossOptions boss, string head, string neck, string shoulders, string back, string chest, string shirt, string tabard, string wrist, string hands, string waist, string legs, string feet, string finger1, string finger2, string trinket1, string trinket2, string mainHand, string offHand, string ranged, string projectile, string projectileBag) { Initialize(); IsLoading = true; _name = name; _realm = realm; _region = region; _race = race; _head = head; _neck = neck; _shoulders = shoulders; _back = back; _chest = chest; _shirt = shirt; _tabard = tabard; _wrist = wrist; _hands = hands; _waist = waist; _legs = legs; _feet = feet; _finger1 = finger1; _finger2 = finger2; _trinket1 = trinket1; _trinket2 = trinket2; _mainHand = mainHand; _offHand = offHand; _ranged = ranged; _projectile = projectile; _projectileBag = projectileBag; WaistBlacksmithingSocketEnabled = true; _activeBuffs = new List<Buff>(); SetFaction(); IsLoading = false; RecalculateSetBonuses(); BossOptions = boss.Clone(); }
public void GetCharacterAsync(CharacterRegion region, string realm, string name, bool forceRefresh) { _lastRegion = region; _lastRealm = realm; _lastName = name; _canceled = false; _lastRequestWasItem = false; _webClient.DownloadStringAsync(new Uri(string.Format(URL_CHAR_REQ, region.ToString().ToLower(), UrlEncode(realm), UrlEncode(name), forceRefresh ? "1" : "0"))); this.Progress = "Downloading Character Data..."; }
public void GetCharacterAsync(CharacterRegion region, string realm, string name, bool forceRefresh) { _lastRegion = region; _lastRealm = realm; _lastName = name; //_canceled = false; //_lastRequestWasItem = false; string url = string.Format(URL_CHAR_REQ, name, region.ToString().ToLower(), realm, forceRefresh ? "!" : ""); _webClient.DownloadStringAsync(new Uri(url)); this.Progress = "Downloading Character Data..."; }
/// <summary>This overload is used from optimizer and is optimized for performance, do not modify</summary> public Character(Character baseCharacter, object[] items, int count) { IsLoading = true; _name = baseCharacter._name; _realm = baseCharacter._realm; _region = baseCharacter._region; _race = baseCharacter._race; _currentModel = baseCharacter._currentModel; _calculationOptions = baseCharacter._calculationOptions; _primaryProfession = baseCharacter._primaryProfession; _secondaryProfession = baseCharacter._secondaryProfession; _class = baseCharacter._class; AssignAllTalentsFromCharacter(baseCharacter, false); CalculationToOptimize = baseCharacter.CalculationToOptimize; OptimizationRequirements = baseCharacter.OptimizationRequirements; _bossOptions = baseCharacter._bossOptions; _faction = baseCharacter._faction; _item = new ItemInstance[SlotCount]; Array.Copy(items, _item, count); IsLoading = false; ActiveBuffs = new List<Buff>(baseCharacter.ActiveBuffs); RecalculateSetBonuses(); }
public void GetTalentTreeDocument(string characterName, string realm, CharacterRegion region) { DownloadDocument(new Uri(string.Format(Properties.NetworkSettings.Default.CharacterTalentURI, _domains[region], realm, characterName), UriKind.Relative)); }
private static IEnumerable <CharacterRegion> CreateCharacterRegionsFromSourceText(FontGenerationParameters parameters) { return(CharacterRegion.CreateFromSourceText(parameters.SourceText + parameters.SubstitutionCharacter.ToString())); }
public Character(string name, string realm, CharacterRegion region, CharacterRace race, BossOptions boss, ItemInstance[] items, List<Buff> activeBuffs, string model) { Initialize(); IsLoading = true; _name = name; _realm = realm; _region = region; _race = race; Array.Copy(items, _item, items.Length); IsLoading = false; ActiveBuffs = new List<Buff>(activeBuffs); SetFaction(); CurrentModel = model; RecalculateSetBonuses(); BossOptions = boss.Clone(); }
/// <summary> /// This override is used for Bookmark Processing. It will automatically /// call the character from Battle.Net and load it into the form. /// </summary> /// <param name="characterName">The Name of the Character. E.g.- Astrylian</param> /// <param name="region">The Region the Character is in. E.g.- US</param> /// <param name="realm">The Realm the Character is on. E.g.- Stormrage</param> public void LoadCharacterFromBNet(string characterName, CharacterRegion region, string realm) { // There shouldn't be any unsaved changes to a character // in the form as this is direct from a Bookmark BNetLoadDialog armoryLoad = new BNetLoadDialog(); armoryLoad.Closed += new EventHandler(bnetLoad_Closed); armoryLoad.Show(); armoryLoad.Load(characterName, region, realm); }