public void OnResponse(NetState sender, RelayInfo info) { #region AccessLevel Check Mobile from = sender.Mobile; if (from.AccessLevel < SkillSettings.GumpControlLevel) { from.SendMessage("You don't have sufficient privileges to access that."); return; } #endregion if (info.ButtonID != 0) { SaveSettings.SaveSkillSettings(); Dictionary <string, object> args = new Dictionary <string, object>(); args.Add("Skin", sk); args.Add("Mobile", from); from.SendGump(new TMQueryPage("Main Menu", args)); } else { Dictionary <string, object> args = new Dictionary <string, object>(); args.Add("Skin", sk); args.Add("Mobile", from); from.SendGump(new TMQueryPage("Main Menu", args)); } }
public void OnResponse(NetState sender, RelayInfo info) { #region AccessLevel Check Mobile from = sender.Mobile; if (from.AccessLevel < SkillSettings.GumpControlLevel) { from.SendMessage("You don't have sufficient privileges to access that."); return; } #endregion if (info.ButtonID != 0) { try { TextRelay text81 = info.GetTextEntry(2000); string text81s = text81.Text; int valnum81 = Int32.Parse(text81s); SkillSettings.SkillHue = valnum81; } catch { from.SendMessage("Problem parsing Skill Hue"); } try { TextRelay text83 = info.GetTextEntry(2002); string text83s = text83.Text; int valnum83 = Int32.Parse(text83s); SkillSettings.StatHue = valnum83; } catch { from.SendMessage("Problem parsing Stat Hue"); } SaveSettings.SaveSkillSettings(); Dictionary <string, object> args = new Dictionary <string, object>(); args.Add("Skin", sk); args.Add("Mobile", from); from.SendGump(new TMQueryPage("Main Menu", args)); } else { Dictionary <string, object> args = new Dictionary <string, object>(); args.Add("Skin", sk); args.Add("Mobile", from); from.SendGump(new TMQueryPage("Main Menu", args)); } }
public void OnResponse(NetState sender, RelayInfo info) { #region AccessLevel Check Mobile from = sender.Mobile; if (from.AccessLevel < SkillSettings.GumpControlLevel) { from.SendMessage("You don't have sufficient privileges to access that."); return; } #endregion if (info.ButtonID == 0) { Dictionary <string, object> args2 = new Dictionary <string, object>(); args2.Add("Skin", sk); args2.Add("Mobile", from); from.SendGump(new TMQueryPage("Main Menu", args2)); } if (info.IsSwitched(200)) { SkillSettings.GumpControlLevel = levels[3]; SkillSettings.DoTell("Administrator Access Level set."); } else if (info.IsSwitched(201)) { SkillSettings.GumpControlLevel = levels[2]; } else if (info.IsSwitched(202)) { SkillSettings.GumpControlLevel = levels[1]; } else if (info.IsSwitched(203)) { SkillSettings.GumpControlLevel = levels[0]; } else { SkillSettings.DoTell("Invalid Access Level."); } SkillSettings.DoTell("The following are the output of the Gump Settings control plugin: Gump Control Level: " + SkillSettings.GumpControlLevel); SaveSettings.SaveSkillSettings(); Dictionary <string, object> args = new Dictionary <string, object>(); args.Add("Skin", sk); args.Add("Mobile", from); from.SendGump(new TMQueryPage("Main Menu", args)); }
public void OnResponse(NetState sender, RelayInfo info) { #region AccessLevel Check Mobile from = sender.Mobile; if (from.AccessLevel < SkillSettings.GumpControlLevel) { from.SendMessage("You don't have sufficient privileges to access that."); return; } #endregion if (info.ButtonID != 0) { if (info.IsSwitched(1000)) { SkillSettings.IsSharded = true; } else { SkillSettings.IsSharded = false; } try { SkillSettings.NotYoursMessage = info.GetTextEntry(2001).Text; SkillSettings.HowToUseMessage = info.GetTextEntry(2002).Text; SkillSettings.NoTicketMessage = info.GetTextEntry(2003).Text; } catch { from.SendMessage("Problem parsing shardname"); } SaveSettings.SaveSkillSettings(); Dictionary <string, object> args = new Dictionary <string, object>(); args.Add("Skin", sk); args.Add("Mobile", from); from.SendGump(new TMQueryPage("Main Menu", args)); } else { Dictionary <string, object> args = new Dictionary <string, object>(); args.Add("Skin", sk); args.Add("Mobile", from); from.SendGump(new TMQueryPage("Main Menu", args)); } }
private static void EventSink_WorldLoad( ) { HasRun = false; bool didLoad = SaveSettings.LoadSkillSettings(); if (!HasRun) { RunOnce(); ConsoleColor col = Console.ForegroundColor; Console.ForegroundColor = ConsoleColor.Green; Console.WriteLine(" - //|4|// - TMSS|4 Ran for the first time successfully!"); Console.WriteLine(" - |\\Thank you for choosing TMSTKSBK's Skill/Stat System Version 4.0!/| -"); Console.WriteLine(""); Console.ForegroundColor = col; //SkinHelper.LoadSkin(CCSkinName); //SkillSaver.SaveSkillSettings(); } else if (didLoad) { ConsoleColor col = Console.ForegroundColor; Console.ForegroundColor = ConsoleColor.Green; SkinHelper.LoadSkin(CCSkinName, typeof(TMSS4Skin), true); Console.WriteLine(" - //4// - Skill Settings loaded successfully."); Console.ForegroundColor = col; Console.WriteLine(""); } else if (!didLoad) { ConsoleColor col = Console.ForegroundColor; Console.ForegroundColor = ConsoleColor.Red; Console.WriteLine(" - //4// - Skill Settings load failed. Executing RunOnce Crash Protection."); Console.WriteLine(" - //4// - This is a Level 1 error. Please report it, along with the settings that were in place."); HasRun = false; RunOnce(); Console.WriteLine(""); Console.WriteLine(" - //4// - Emergency Re-Run methods called."); Console.ForegroundColor = col; SaveSettings.SaveSkillSettings(); //SkinHelper.LoadSkin(CCSkinName,typeof(TMSS4Skin), true); } }
//This is a major method that runs *gasp!* once, during the first compile of TMSS 4.0 public static void RunOnce() { Console.WriteLine(" - //4// - Beginning Setup."); if (!HasRun) { #region Gumps GumpControlLevel = AccessLevel.GameMaster; AdminAccessLevel = AccessLevel.Administrator; #endregion #region Hues //************************************* //Hue Settings:------------------------ //************************************* //This sets the color for all basic TM Skill System items. //Default: 0x60 (light blue) SkillHue = 0x60; //This sets the color for all Stat-related special TM SkillSystem items //default: 0x483 (green tailor BOD color) StatHue = 0x483; //This sets the color for the CenterStone item. //Default: 1153 (white) CenterHue = 1153; //END hue settings ******************* #endregion #region CC //****************************************** //Don't change this. This is the "safe" name. CCProfileName = "Default Profile"; CCSkinName = "Unnamed Skin"; ControlSkinName = "Unnamed Skin"; //******End Central Control Settings****************// #endregion #region Messages //*********************************** //Message Settings=================== //*********************************** //This is your shard's name //default: ???? //****************************************************** //IF YOU SET THIS, YOU MUST ALSO SET ITS BOOL TO TRUE!!! //****************************************************** try { ShardName = Server.Misc.ServerList.ServerName; } catch (Exception e) { ShardName = "TMSS //4// Enabled Shard!"; SkillSettings.DoTell(" Problem getting Shard Name: " + e); } //The bool that prints your shard. //default: false IsSharded = false; //This message is sent to a user that attempts to use a skillticket that is not theirs. //default: "This is not your ticket. Shame on you! You have to use your ticket." NotYoursMessage = "This is not your ticket. Shame on you! You have to use your ticket."; //This message is sent to an owner that double-clicks their ticket. //default: "This is a Skill Ticket. Use a Skill Stone to get your skills." HowToUseMessage = "This is a Skill Ticket. Use a Skill Stone to get your skills."; //This message is sent to a user that doesn't have a skillticket on a skillstone use attempt. //default: "You need a Skill Ticket to use that." NoTicketMessage = "You need a Skill or Cap Ticket to use that."; //These are the messages for Shard and NoShard above. Shard = "Welcome to " + ShardName + ". This will help you set your skills."; NoShard = "Welcome. This ticket will help you set your skills."; //END newbie message settings ********* #endregion #region Finalization SkillProfileHelper.GenInitialProfile(); GenerateDefaultSkin(CCSkinName); SkinHelper.LoadSkin(CCSkinName, typeof(TMSS4Skin), true); SkinHelper.LoadSkin("Skill Skin", typeof(SkillSkin), true); HasRun = true; SaveSettings.SaveSkillSettings(); #endregion } else { return; } }
public static void SaveSkillSettings() { if (!Directory.Exists("TMSS")) { Directory.CreateDirectory("TMSS"); } string FileName = "skillsave.tms"; string path = @"TMSS/" + FileName; DateTime start = DateTime.Now; Console.Write(" - //4// - Saving TMSS Settings..."); if (File.Exists(path)) { File.Delete(path); } XmlWriterSettings settings = new XmlWriterSettings(); settings.Indent = true; settings.IndentChars = " "; XmlWriter writer = XmlWriter.Create(path, settings); try { //Must I tell you not to mess with this? #region Variables writer.WriteStartElement("TMSS_Save"); SaveSettings.WriteElement("IsSharded", SkillSettings.IsSharded, 0, writer); SaveSettings.WriteElement("HasRun", SkillSettings.HasRun, 0, writer); SaveSettings.WriteElement("ShardName", SkillSettings.ShardName, 1, writer); SaveSettings.WriteElement("NotYoursMessage", SkillSettings.NotYoursMessage, 1, writer); SaveSettings.WriteElement("HowToUseMessage", SkillSettings.HowToUseMessage, 1, writer); SaveSettings.WriteElement("NoTicketMessage", SkillSettings.NoTicketMessage, 1, writer); SaveSettings.WriteElement("Shard", SkillSettings.Shard, 1, writer); SaveSettings.WriteElement("NoShard", SkillSettings.NoShard, 1, writer); SaveSettings.WriteElement("SkillHue", SkillSettings.SkillHue, 2, writer); SaveSettings.WriteElement("StatHue", SkillSettings.StatHue, 2, writer); SaveSettings.WriteElement("CenterHue", SkillSettings.CenterHue, 2, writer); SaveSettings.WriteElement("CCSkinName", SkillSettings.CCSkinName, 1, writer); SaveSettings.WriteElement("CCProfileName", SkillSettings.CCProfileName, 1, writer); SaveSettings.WriteElement("ControlSkinName", SkillSettings.ControlSkinName, 1, writer); SaveSettings.WriteElement("GumpControlLevel", (int)SkillSettings.GumpControlLevel, 2, writer); SaveSettings.WriteElement("AdminControlLevel", (int)SkillSettings.AdminAccessLevel, 2, writer); writer.WriteEndElement(); #endregion writer.Close(); Console.WriteLine("done."); TimeSpan end = DateTime.Now - start; } catch (Exception err) { Console.WriteLine("failed. Exception: " + err); writer.Close(); } }