public static string CreateCharacter(Alignment alignment, Background background, int baseCharisma, int baseConstitution, int baseDexterity, int baseIntelligence, int baseStrength, int baseWisdom, List<Spell> cantrips, CharacterClass chClass, List<Skill> classSkills, List<Skill> classTools, int gender, int hairColor, int hairStyle, string name, Race race, List<Skill> raceSkills, int skinColor, List<Spell> spellsKnown, CharacterClass subClass, List<Power> selectedPowers) { CharacterCreation chr = new CharacterCreation() { Alignment = alignment, Background = background, BaseCharisma = baseCharisma, BaseConstitution = baseConstitution, BaseDexterity = baseDexterity, BaseIntelligence = baseIntelligence, BaseStrength = baseStrength, BaseWisdom = baseWisdom, Cantrips = cantrips, Class = chClass, ClassSkills = classSkills, ClassTools = classTools, Gender = gender, HairColor = hairColor, HairStyle = hairStyle, Name = name, Race = race, RaceSkills = raceSkills, SelectedPowers = selectedPowers, SessionId = SessionId, SkinColor = skinColor, SpellsKnown = spellsKnown, SubClass = subClass, UserId = UserId }; try { string wrURI = baseServerTarget + "createcharacter"; string msg = chr.ToString(); WebRequest wreq = WebRequest.Create(wrURI + "?message=" + msg); wreq.Method = "POST"; wreq.ContentLength = 0; WebResponse wresp = wreq.GetResponse(); using (TextReader sr = new StreamReader(wresp.GetResponseStream())) { XmlSerializer xml = new XmlSerializer(typeof(string), StringNamespace); string resp = (string)xml.Deserialize(sr); return resp; } } catch { return String.Empty; } }
public static string CreateCharacter(string name, int authority, int care, int fairness, int hobby, int loyalty, int profession, int race, int sex, int talent, int tradition, int vice, int virtue, int aspiration, int hairStyle, int hairColor, int skinColor) { CharacterCreation chr = new CharacterCreation() { Authority = authority, Care = care, Fairness = fairness, Hobby = hobby, Loyalty = loyalty, Name = name, Profession = profession, Race = race, SessionId = SessionId, Sex = sex, Talent = talent, Tradition = tradition, UserId = UserId, Vice = vice, Virtue = virtue, Aspiration = aspiration, HairColor = hairColor, HairStyle = hairStyle, SkinColor = skinColor, }; try { string wrURI = baseServerTarget + "createcharacter"; string msg = chr.ToString(); WebRequest wreq = WebRequest.Create(wrURI + "?message=" + msg); wreq.Method = "POST"; wreq.ContentLength = 0; WebResponse wresp = wreq.GetResponse(); using (TextReader sr = new StreamReader(wresp.GetResponseStream())) { XmlSerializer xml = new XmlSerializer(typeof(string), StringNamespace); string resp = (string)xml.Deserialize(sr); return resp; } } catch { return String.Empty; } }