private void ProcessSkillGroups(RdlTagCollection tags) { List <RdlActor> groups = tags.GetTags <RdlActor>(RdlTagName.OBJ.ToString(), RdlObjectTypeName.ACTOR.ToString()); List <RdlProperty> skills = tags.GetTags <RdlProperty>(RdlTagName.OBJ.ToString(), RdlObjectTypeName.PROP.ToString()); if (groups.Count > 0) { Game.SkillGroups.Clear(); foreach (var group in groups) { List <Skill> list = new List <Skill>(); foreach (var skill in skills.Where(s => s.ID == group.ID)) { list.Add(new Skill { Name = skill.Name, Value = Convert.ToInt32(skill.Value) }); } Game.SkillGroups.Add(group.Name, list); } if (_hasRequiredQuota && StorageManager.RequiresFileUpdate(FileNames.SkillGroups)) { RdlTagCollection groupTags = new RdlTagCollection(); groupTags.AddRange(groups.ToTagCollection()); groupTags.AddRange(skills.ToTagCollection()); StorageManager.WriteTags(FileNames.SkillGroups, groupTags); } } }
private void ProcessFileUpdates(RdlTagCollection tags) { var updates = tags.GetTags <RdlTag>("FILEUPDATE", "FILEUPDATE"); if (updates != null && updates.Count > 0) { StorageManager.LoadFileUpdatesFromServer(updates); } }
private static void ProcessSkillGroups(RdlTagCollection tags) { List <RdlActor> groups = tags.GetTags <RdlActor>(RdlTagName.OBJ.ToString(), RdlObjectTypeName.ACTOR.ToString()); List <RdlProperty> skills = tags.GetTags <RdlProperty>(RdlTagName.OBJ.ToString(), RdlObjectTypeName.PROP.ToString()); if (groups.Count > 0) { Game.SkillGroups.Clear(); foreach (var group in groups) { List <Skill> list = new List <Skill>(); foreach (var skill in skills.Where(s => s.ID == group.ID)) { list.Add(new Skill { Name = skill.Name, Value = Convert.ToInt32(skill.Value) }); } Game.SkillGroups.Add(group.Name, list); } } }
private void ProcessTags(RdlTagCollection tags) { var tag = tags.GetTags <RdlTag>("ISONLINE", "ISONLINE"); if (tag.Count > 0) { if (_timer != null) { _timer.Dispose(); } ScreenManager.SetScreen(new HomeScreen()); } }
private static void ProcessSkills(RdlTagCollection tags) { List <RdlSkill> skills = tags.GetTags <RdlSkill>(RdlTagName.OBJ.ToString(), RdlObjectTypeName.SKILL.ToString()); if (skills.Count > 0) { Game.Skills.Clear(); foreach (var item in skills) { Game.Skills.Add(new Skill { Name = item.Name, Description = item.Description, Value = item.Value, GroupName = item.GroupName }); } } }
public static void LoadFileUpdatesFromServer(List <RdlTag> serverTags) { // Load the files updates from disk. RdlTagCollection localTagCollection = ReadTags(FileUpdateFileName); var localTags = localTagCollection.GetTags <RdlTag>("FILEUPDATE", "FILEUPDATE"); FileUpdates.Clear(); foreach (var serverTag in serverTags) { bool requiresUpdate = true; string fileName = serverTag.GetArg <string>(0); // Loop through all of the server tags, attempt to find a matching local tag by file name. var matchingLocalTag = localTags.Where(t => t.GetArg <string>(0) == fileName).FirstOrDefault(); if (matchingLocalTag != null) { // If a matching local tags exists compare the dates, if they don't match this file requires an update. DateTime localDt = new DateTime(matchingLocalTag.GetArg <long>(1)); DateTime serverDt = new DateTime(serverTag.GetArg <long>(1)); if (localDt.CompareTo(serverDt) == 0) { requiresUpdate = false; if (!FileExists(RootDirectory, fileName)) { if (!FileExists(GetPath(MapsDirectory), fileName)) { if (!FileExists(GetPath(UserDirectory), fileName)) { // Could not find any version or form of the file. requiresUpdate = true; } } } } } if (FileUpdates.ContainsKey(fileName)) { FileUpdates[fileName] = requiresUpdate; } else { FileUpdates.Add(fileName, requiresUpdate); } } // Write the values from the server to disk. WriteTags(FileUpdateFileName, serverTags.ToTagCollection()); }
private void ProcessCheckNameResponse(RdlTagCollection tags) { RdlCommandResponse response = tags.GetTags <RdlCommandResponse>(RdlTagName.RESP.ToString(), "CHECKNAME").FirstOrDefault(); if (response != null) { this.IsNameAvailable = response.Result; this.NameCheckComplete(new NameCheckEventArgs { IsAvailable = response.Result, Message = response.Message }); } //else //{ // this.IsNameAvailable = false; // this.NameCheckComplete(new NameCheckEventArgs { IsAvailable = false, Message = "Name check failed, please try again." }); //} this.Cursor = Cursors.Arrow; }
private void ProcessSkills(RdlTagCollection tags) { List <RdlSkill> skills = tags.GetTags <RdlSkill>(RdlTagName.OBJ.ToString(), RdlObjectTypeName.SKILL.ToString()); if (skills.Count > 0) { Game.Skills.Clear(); foreach (var item in skills) { Game.Skills.Add(new Skill { Name = item.Name, Description = item.Description, Value = item.Value, GroupName = item.GroupName }); } if (_hasRequiredQuota && StorageManager.RequiresFileUpdate(FileNames.Skills)) { StorageManager.WriteTags(FileNames.Skills, skills.ToTagCollection()); } } }
private void ProcessCreateCharacterResponse(RdlTagCollection tags) { diagCreateCharacter.Close(); RdlCommandResponse response = tags.GetTags <RdlCommandResponse>(RdlTagName.RESP.ToString(), "CREATECHARACTER").FirstOrDefault(); if (response != null) { if (response.Result) { // Successful character creation, reload the home screen. ScreenManager.SetScreen(new HomeScreen()); } else { MessageBox.Show(String.Format("Character creation failed for the following reason:\n{0}", response.Message), "Character Creation Failed", MessageBoxButton.OK); } } else { MessageBox.Show("Character creation failed do to a network error. Please try again.", "Character Creation Failed", MessageBoxButton.OK); } }
private void ProcessResetCharacterResponse(RdlTagCollection tags) { diagAlert.Close(); RdlCommandResponse response = tags.GetTags <RdlCommandResponse>(RdlTagName.RESP.ToString(), "RESETCHARACTER").FirstOrDefault(); if (response != null) { if (response.Result) { // Successful character reset, reload the home screen. this.Completed(this, EventArgs.Empty); ScreenManager.SetScreen(new Perenthia.Screens.HomeScreen()); } else { MessageBox.Show(String.Format("Character reset failed for the following reason:\n{0}", response.Message), "Character Reset Failed", MessageBoxButton.OK); } } else { MessageBox.Show("Character reset failed do to a network error. Please try again.", "Character Reset Failed", MessageBoxButton.OK); } this.Close(); }
private void ProcessRaces(RdlTagCollection tags) { List <RdlRace> races = tags.GetTags <RdlRace>(RdlTagName.OBJ.ToString(), RdlObjectTypeName.RACE.ToString()); if (races.Count > 0) { Game.Races.Clear(); RdlTagCollection raceTags = new RdlTagCollection(); foreach (var item in races) { raceTags.Add(item); Race race = new Race { Name = item.Name, Description = item.Description, }; RdlProperty prop = tags.GetProperty(item.ID, "Attr_Strength"); if (prop != null) { race.Strength = Convert.ToInt32(prop.Value); raceTags.Add(prop); } prop = tags.GetProperty(item.ID, "Attr_Dexterity"); if (prop != null) { race.Dexterity = Convert.ToInt32(prop.Value); raceTags.Add(prop); } prop = tags.GetProperty(item.ID, "Attr_Stamina"); if (prop != null) { race.Stamina = Convert.ToInt32(prop.Value); raceTags.Add(prop); } prop = tags.GetProperty(item.ID, "Attr_Beauty"); if (prop != null) { race.Beauty = Convert.ToInt32(prop.Value); raceTags.Add(prop); } prop = tags.GetProperty(item.ID, "Attr_Intelligence"); if (prop != null) { race.Intelligence = Convert.ToInt32(prop.Value); raceTags.Add(prop); } prop = tags.GetProperty(item.ID, "Attr_Perception"); if (prop != null) { race.Perception = Convert.ToInt32(prop.Value); raceTags.Add(prop); } prop = tags.GetProperty(item.ID, "Attr_Endurance"); if (prop != null) { race.Endurance = Convert.ToInt32(prop.Value); raceTags.Add(prop); } prop = tags.GetProperty(item.ID, "Attr_Affinity"); if (prop != null) { race.Affinity = Convert.ToInt32(prop.Value); raceTags.Add(prop); } Game.Races.Add(item.Name, race); } if (_hasRequiredQuota && StorageManager.RequiresFileUpdate(FileNames.Races)) { StorageManager.WriteTags(FileNames.Races, raceTags); } } }