public override void OnResponse(NetState sender, RelayInfo info) { if (info.ButtonID == 0 && sender.Mobile.AccessLevel >= SkillSettings.GumpControlLevel) { return; } Dictionary <string, int> dict = new Dictionary <string, int>(); try { dict.Add("Strength", Int32.Parse(info.GetTextEntry(1000).Text)); dict.Add("Dexterity", Int32.Parse(info.GetTextEntry(2000).Text)); dict.Add("Intelligence", Int32.Parse(info.GetTextEntry(3000).Text)); if (Session != null) { bool resend = Session.addStat(dict); if (resend) { sender.Mobile.SendGump(Page.Clone()); sender.Mobile.SendGump(new TMAlertGump(Session.CurrentErrorMessage)); } } else { SkillSettings.SystemWrite("Invalid Session. Cannot continue."); sender.Mobile.SendGump(new TMAlertGump("You do not appear to be in a Session. Cannot continue.")); return; } } catch (Exception e) { sender.Mobile.SendGump(Page.Clone()); sender.Mobile.SendGump(new TMAlertGump("Could not get Stat values. Please reenter.")); SkillSettings.SystemWrite("Error when acquiring stats data: " + e); } }
public static void Configure() { SkillSettings.SystemWrite("-- // P // -- Configuring Skill Replacement. Custom Skill Gump will " + (UseParallelGump ? "" : "not") + " be used."); if (UseParallelGump) { Server.Network.PacketHandlers.Register(0x34, 10, true, new Server.Network.OnPacketReceive(Server.TMSS.SkillReplacement.MobileQuery2)); } }
public TMUsedInfo(string name, double value, double weight, int cap, int id) { if (name == "") { SkillSettings.SystemWrite("Invalid name."); } SkillName = name; SkillValue = value; if (weight <= 0) { SkillSettings.SystemWrite("Invalid weight."); } SkillWeight = weight; SkillCap = cap; SkillID = id; }
public static void LoadSelf(FileInfo fileName) { string path = fileName.FullName; if (!File.Exists(path)) { Console.WriteLine("ERROR: Super Profile Not Found "); return; } XmlReaderSettings settings = new XmlReaderSettings(); XmlReader read = XmlReader.Create(path, settings); read.ReadStartElement("TMSuperProfile"); read.ReadStartElement("ProfileName"); string name = read.ReadContentAsString(); read.ReadEndElement(); SkillSettings.SystemWrite("Loading SuperProfile " + name); SuperSkillProfile profile = new SuperSkillProfile(name); read.ReadStartElement("Count"); int count = read.ReadContentAsInt(); read.ReadEndElement(); int curr = 0; while (curr < count) { read.ReadStartElement("SubProfile"); profile.addProfile((string)read.ReadContentAsString()); //.ReadContentAsString()); read.ReadEndElement(); curr++; } read.ReadEndElement(); read.Close(); SkillProfileHelper.SkillProfileLoader(profile.ProfileName, false); RegisterSuperProfile(profile); }
public void GetGumpCode(TMQueryPage page) { Page = page; this.Dragable = false; object o = page.GetValueSet(); if (o is TMSkillSession) { Session = (TMSkillSession)o; } else { SkillSettings.SystemWrite("Error. No valid Session."); return; } if (!Session.Profile.StatEnable) { return; } Page.BaseSkinByType(this); Page.AddTitle("Stats: ", "Control", this); if (!Session.Profile.StatForce) { this.AddLabel(50, 70, Session.Skin.HighlightText, "Overall Max: " + Session.Profile.StatSum + " pts"); } else { this.AddLabel(50, 70, Session.Skin.HighlightText, "Overall Requirement: " + Session.Profile.StatSum + " pts"); } ButtonInfo inf2 = Session.Skin.ButtonInfo["StatAddButton"]; Page.AddSuperButton(inf2.X, Page.Y + inf2.Y, inf2.H, inf2.W, inf2.bgID, Session.Skin.ListUnderButtonN, Session.Skin.ListUnderButtonP, Session.Skin.AddLabel, GumpButtonType.Reply, 1, 0, this); Dictionary <string, int> statvals = Session.Stats; GumpList g = new GumpList(this, "details", Session.Skin); g.SetColumnCount(3); g.AddColumn("Stat:"); g.AddColumn("Max Value: "); g.AddColumn("Enter Value: "); GumpListEntry str = new GumpListEntry(0, 0, g, Session.Skin.EntryDefaultWidth, Session.Skin.EntryDefaultHeight); str.AddColumn("Strength"); str.AddColumn("Max: " + Session.Profile.StrVal); str.AddColumn(new GumpTextEntry(0, 0, 25, Session.Skin.EntryDefaultHeight, Session.Skin.NormalText, 1000, statvals.ContainsKey("Strength") ? "" + statvals["Strength"]:"")); GumpListEntry dex = new GumpListEntry(0, 0, g, Session.Skin.EntryDefaultWidth, Session.Skin.EntryDefaultHeight); dex.AddColumn("Dexterity"); dex.AddColumn("Max: " + Session.Profile.DexVal); dex.AddColumn(new GumpTextEntry(0, 0, 25, Session.Skin.EntryDefaultHeight, Session.Skin.NormalText, 2000, statvals.ContainsKey("Dexterity") ? "" + statvals["Dexterity"] : "")); GumpListEntry intel = new GumpListEntry(0, 0, g, Session.Skin.EntryDefaultWidth, Session.Skin.EntryDefaultHeight); intel.AddColumn("Intelligence"); intel.AddColumn("Max: " + Session.Profile.IntVal); intel.AddColumn(new GumpTextEntry(0, 0, 25, Session.Skin.EntryDefaultHeight, Session.Skin.NormalText, 3000, statvals.ContainsKey("Intelligence") ? "" + statvals["Intelligence"] : "")); g.Add(str); g.Add(dex); g.Add(intel); g.ShowDividers = true; g.X = Session.Skin.SelectStartX; g.Y = Session.Skin.SelectStartY; g.CommitList(); Session.Mobile.SendGump(this); }
private static void ReadSkills() { //string path = Environment.CurrentDirectory+"\\TMSS\\Data\\ParallelSkills\\skills.psi"; string path = "C:\\ruo2\\TMSS\\Data\\ParallelSkills\\skills.psi"; if (!File.Exists(path)) { SkillSettings.DoTell("CS Warning - No Custom Skills file exists on path: " + path); } XmlReaderSettings settings = new XmlReaderSettings(); settings.IgnoreWhitespace = true; XmlReader reader; try { reader = XmlReader.Create(path, settings); } catch (Exception e) { if (Core.Debug) { SkillSettings.SystemWrite(" -//P//- Could not create reader: " + e); } else { SkillSettings.SystemWrite(" -//P//- File not found, or invalid."); } return; } try { reader.ReadToFollowing("ParallelSkills"); reader.ReadToFollowing("settings"); int count = Int32.Parse(reader.GetAttribute(0)); for (int i = 0; i < count; i++) { reader.ReadToFollowing("skill"); //int id = Int32.Parse(reader.GetAttribute(0)); string name = reader.GetAttribute(0); string BLARR = reader.GetAttribute(1); double sscale = Double.Parse(BLARR); double dscale = Double.Parse(reader.GetAttribute(2)); double iscale = Double.Parse(reader.GetAttribute(3)); string title = reader.GetAttribute(4); double sgain = Double.Parse(reader.GetAttribute(5)); double dgain = Double.Parse(reader.GetAttribute(6)); double igain = Double.Parse(reader.GetAttribute(7)); double gainf = Double.Parse(reader.GetAttribute(8)); SkillInfo info = new SkillInfo(0, name, sscale, dscale, iscale, title, null, sgain, dgain, igain, gainf); if (infos.Contains(info)) { infos.Remove(info); } infos.Add(info); } reader.Close(); } catch (Exception e) { SkillSettings.DoTell("Gar." + e); } }