Пример #1
0
        public void addProfile(SkillProfile p)
        {
            if (subProfiles.ContainsKey(p.ProfileName))
            {
                subProfiles.Remove(p.ProfileName);
            }

            subProfiles.Add(p.ProfileName, p);
        }
Пример #2
0
        private bool checkSkills()
        {
            Dictionary <string, Dictionary <string, TMUsedInfo> > sk = SelectedSkills;
            IEnumerator ie = Profile.subProfiles.GetEnumerator();

            if (!Profile.SkillEnable)
            {
                return(true);
            }
            int masterSum = 0;

            while (ie.MoveNext())
            {
                double       profSum = 0.0;
                string       name    = ((KeyValuePair <string, SkillProfile>)ie.Current).Key;
                SkillProfile prof    = ((KeyValuePair <string, SkillProfile>)ie.Current).Value;
                Dictionary <string, TMUsedInfo> profInfo = null;
                if (sk.ContainsKey(name))
                {
                    profInfo = sk[name];
                    IEnumerator en = profInfo.GetEnumerator();
                    while (en.MoveNext())
                    {
                        TMUsedInfo inf = ((KeyValuePair <string, TMUsedInfo>)en.Current).Value;
                        profSum += inf.SkillValue;
                    }
                    if (Math.Ceiling(profSum) > prof.SkillPoints)
                    {
                        CurrentErrorMessage = "Skill Points for " + prof.ProfileName + " are higher than allowed, at " + profSum + ". Please revise down to " + prof.SkillPoints + " after weighting.";
                        return(false);
                    }
                }
                masterSum += (int)Math.Ceiling(profSum);
            }
            if (masterSum > totalAllowedPoints)
            {
                CurrentErrorMessage = "Skill Points are higher than maximum allowed value. Please revise downward by " + (masterSum - totalAllowedPoints) + ". The maximum is: " + totalAllowedPoints;
                return(false);
            }
            if (Profile.SkillForce && masterSum < totalAllowedPoints)
            {
                CurrentErrorMessage = "Skill Points are lower than the required value. Please revise upward by " + (totalAllowedPoints - masterSum) + ".";
                return(false);
            }
            return(true);
        }
Пример #3
0
 public static void SkillTest_OnCommand(CommandEventArgs e)
 {
     //ListTestGump g = new ListTestGump();
     if (QueryPageHelper.PluginExists("TMSkill"))
     {
         Dictionary <string, object> t = new Dictionary <string, object>();
         t.Add("Skin", SkinHelper.getSkin(SkillSettings.ControlSkinName));
         t.Add("Mobile", e.Mobile);
         SuperSkillProfile p  = (SuperSkillProfile)SkillProfileHelper.getProfile("Default Profile");
         SkillProfile      sp = p.getProfile(0);
         t.Add("Profile", sp);
         TMQueryPage pg = new TMQueryPage("TMSS Skill Gump", t);
         //e.Mobile.SendGump(pg);
     }
     else
     {
         DoTell("Error when creating Skill Gump. Plugin does not exist.");
         return;
     }
 }
Пример #4
0
        //This method does the actual adding of a profile to the SkillProfiles array.
        //Input is a profile, which is the freshly-loaded profile. Called from the SkillProfileLoader method.
        public static int AddNewProfile(SkillProfile profile, bool super)
        {
            if (super)
            {
                if (Supers != null)
                {
                    if (Supers.ContainsKey(profile.ProfileName))
                    {
                        Supers.Remove(profile.ProfileName);
                    }
                    Supers.Add(profile.ProfileName, (SuperSkillProfile)profile);
                    //SkillSettings.doTell( "New SuperProfile " +profile.ProfileName+" has been added.");
                    return(Supers.Count);
                }
                else
                {
                    SkillSettings.DoTell("Invalid hashtable to add to."); return(-1);
                }
            }
            else if (Profiles != null)
            {
                if (Profiles.ContainsKey(profile.ProfileName))
                {
                    Profiles.Remove(profile.ProfileName);
                }
                Profiles.Add(profile.ProfileName, profile);

                //ProfileNames.Add(m_profiles.Count, profile.NumAllowed );
                SkillSettings.DoTell2("New profile " + profile.ProfileName + " has been added with point value: " + profile.SkillPoints);
                return(Profiles.Count);
            }
            else
            {
                SkillSettings.DoTell("Invalid hashtable");
                return(-1);
            }
        }
Пример #5
0
		public SkillControlEntry(Mobile from, SkillProfile stone)
			: base(5101, 1)
		{
			m_From = from;
			m_profile = stone;
		}
Пример #6
0
 //This method does the actual adding of a profile to the SkillProfiles array.
 //Input is a profile, which is the freshly-loaded profile. Called from the SkillProfileLoader method.
 public static int AddNewProfile(SkillProfile profile)
 {
     return(AddNewProfile(profile, false));
 }
Пример #7
0
 private static void RegisterProfile(SkillProfile profile)
 {
     SkillProfileSaver(profile);
     AddNewProfile(profile);
 }
Пример #8
0
        public static SuperSkillProfile GenInitialProfile()
        {
            Console.WriteLine(" - TMSS|4 Default Profile Generation In Progress...");
            //SkillProfile profile = new SkillProfile("Default Profile");

            SuperSkillProfile defprof = new SuperSkillProfile("Default Profile");

            SkillProfile miscProf = new SkillProfile("Miscellaneous");

            miscProf.addCompleteEntry(true, 100, 1.0, 10, 0);            //0
            miscProf.addCompleteEntry(true, 100, 1.0, 10, 7);            //7
            miscProf.addCompleteEntry(true, 100, 1.0, 10, 8);            //8
            miscProf.addCompleteEntry(true, 100, 1.0, 10, 11);           //11
            miscProf.addCompleteEntry(true, 100, 1.0, 10, 13);           //13
            miscProf.addCompleteEntry(true, 100, 1.0, 10, 17);           //17
            miscProf.addCompleteEntry(true, 100, 1.0, 10, 18);           //18
            miscProf.addCompleteEntry(true, 100, 1.0, 10, 20);           //20
            miscProf.addCompleteEntry(true, 100, 1.0, 10, 24);           //24
            miscProf.addCompleteEntry(true, 100, 1.0, 10, 25);           //25
            miscProf.addCompleteEntry(true, 100, 1.0, 10, 26);           //26
            miscProf.addCompleteEntry(true, 100, 1.0, 10, 28);           //28
            miscProf.addCompleteEntry(true, 100, 1.0, 10, 29);           //29
            miscProf.addCompleteEntry(true, 100, 1.0, 10, 33);           //33
            miscProf.addCompleteEntry(true, 100, 1.0, 10, 34);           //34
            miscProf.addCompleteEntry(true, 100, 1.0, 10, 37);           //37
            miscProf.addCompleteEntry(true, 100, 1.0, 10, 39);           //39
            miscProf.addCompleteEntry(true, 100, 1.0, 10, 45);           //45
            miscProf.addCompleteEntry(true, 100, 1.0, 10, 46);           //46
            miscProf.addCompleteEntry(true, 100, 1.0, 10, 47);           //47
            miscProf.addCompleteEntry(true, 100, 1.0, 10, 48);           //48
            miscProf.addCompleteEntry(true, 100, 1.0, 10, 49);           //49
            miscProf.addCompleteEntry(true, 100, 1.0, 10, 50);           //50
            miscProf.addCompleteEntry(true, 100, 1.0, 10, 51);           //51
            miscProf.addCompleteEntry(true, 100, 1.0, 10, 52);           //52
            miscProf.addCompleteEntry(true, 100, 1.0, 10, 53);           //53
            miscProf.addCompleteEntry(true, 100, 1.0, 10, 54);           //54
            miscProf.IconID = 2287;
            RegisterProfile(miscProf);
            defprof.addProfile(miscProf);

            SkillProfile comRate = new SkillProfile("Combat Ratings");

            comRate.addCompleteEntry(true, 100, 1.0, 10, 31);           //31
            comRate.addCompleteEntry(true, 100, 1.0, 10, 42);           //42
            comRate.addCompleteEntry(true, 100, 1.0, 10, 41);           //41
            comRate.addCompleteEntry(true, 100, 1.0, 10, 5);            //5
            comRate.addCompleteEntry(true, 100, 1.0, 10, 40);           //40
            comRate.addCompleteEntry(true, 100, 1.0, 10, 27);           //27
            comRate.addCompleteEntry(true, 100, 1.0, 10, 43);           //43
            comRate.IconID = 5585;
            RegisterProfile(comRate);
            defprof.addProfile(comRate);

            SkillProfile actions = new SkillProfile("Actions");

            actions.addCompleteEntry(true, 100, 1.0, 10, 35);           //35
            actions.addCompleteEntry(true, 100, 1.0, 10, 6);            //6
            actions.addCompleteEntry(true, 100, 1.0, 10, 10);           //10
            actions.addCompleteEntry(true, 100, 1.0, 10, 12);           //12
            actions.addCompleteEntry(true, 100, 1.0, 10, 14);           //14
            actions.addCompleteEntry(true, 100, 1.0, 10, 15);           //15
            actions.addCompleteEntry(true, 100, 1.0, 10, 21);           //21
            actions.addCompleteEntry(true, 100, 1.0, 10, 23);           //23
            actions.addCompleteEntry(true, 100, 1.0, 10, 9);            //9
            actions.addCompleteEntry(true, 100, 1.0, 10, 30);           //30
            actions.addCompleteEntry(true, 100, 1.0, 10, 22);           //22
            actions.addCompleteEntry(true, 100, 1.0, 10, 32);           //32
            actions.addCompleteEntry(true, 100, 1.0, 10, 38);           //38
            actions.IconID = 20998;
            RegisterProfile(actions);
            defprof.addProfile(actions);

            SkillProfile loreKnow = new SkillProfile("Lore & Knowledge");

            loreKnow.addCompleteEntry(true, 100, 1.0, 10, 1);            //1
            loreKnow.addCompleteEntry(true, 100, 1.0, 10, 2);            //2
            loreKnow.addCompleteEntry(true, 100, 1.0, 10, 4);            //4
            loreKnow.addCompleteEntry(true, 100, 1.0, 10, 16);           //16
            loreKnow.addCompleteEntry(true, 100, 1.0, 10, 19);           //19
            loreKnow.addCompleteEntry(true, 100, 1.0, 10, 3);            //3
            loreKnow.addCompleteEntry(true, 100, 1.0, 10, 36);           //36
            loreKnow.IconID = 23014;
            RegisterProfile(loreKnow);
            defprof.addProfile(loreKnow);

            SuperProfileHelper.RegisterSuperProfile(defprof);
            SuperProfileHelper.SaveSelf(defprof);
            Console.WriteLine("done");
            //writeFile(profile, true);
            return(defprof);
        }
Пример #9
0
        public static void writeFile(SkillProfile profile, bool naming)
        {
            string middle;

            if (naming)
            {
                middle = "" + profile.ProfileName + " [Original]";
            }
            else
            {
                middle = "" + profile.ProfileName;
            }

            if (!Directory.Exists("TMSS/SkillProfiles/Information"))
            {
                Directory.CreateDirectory("TMSS/SkillProfiles/Information/");
            }

            string path = "TMSS/SkillProfiles/Information/" + profile.ProfileName + ".txt";

            try
            {
                using (FileStream stream = new FileStream(path, FileMode.OpenOrCreate, FileAccess.Write))
                {
                    StreamWriter sw = new StreamWriter(stream);

                    sw.WriteLine("This is the output for " + profile.ProfileName + " on " + DateTime.Now);

                    if (naming)
                    {
                        sw.WriteLine("This was generated at the creation of the profile.");
                    }

                    sw.WriteLine("\n\nGeneral: ");
                    sw.WriteLine("\t-Manual: " + profile.Manual);
                    sw.WriteLine("\t-Stat Force: " + profile.StatForce);
                    sw.WriteLine("\t-Stats Enabled: " + profile.StatEnable);
                    sw.WriteLine("\t-Stat Sum: " + profile.StatSum);
                    sw.WriteLine("\t-Strength: " + profile.StrVal);
                    sw.WriteLine("\t-Dexterity: " + profile.DexVal);
                    sw.WriteLine("\t-Intelligence: " + profile.IntVal);
                    sw.WriteLine("\t-Skill Force: " + profile.SkillForce);
                    sw.WriteLine("\t-Name: " + profile.ProfileName);
                    sw.WriteLine("\t-Num Allowed Skills: " + profile.SkillPoints);
                    sw.WriteLine("\t-Skill Sum: " + profile.SkillPoints);
                    sw.WriteLine("\t-Skill Sum: " + profile.IsKeyed);
                    sw.WriteLine("\t-Skill Sum: " + profile.IsGumped);
                    sw.WriteLine("\n\nEnabled Skills & Skill Values: ");
                    sw.WriteLine("\n\n");
                    //sw.WriteLine("Index: " +  " Name: " + SkillInfo.Table[0].Name + " Is: " +   " And its Max Value is: " );
                    IEnumerator ie = profile.MasterHash.GetEnumerator();
                    int         i  = 0;
                    while (ie.MoveNext())
                    {
                        TMSkillInfo info = ((KeyValuePair <string, TMSkillInfo>)ie.Current).Value;
                        sw.WriteLine("\tIndex: " + i + " Name: " + info.SkillName + " is " + info.SkillEnable + ", with Max of: " + info.SkillValue + ", Cap of " + info.SkillCap + ", and Weight of " + info.SkillWeight);
                        i++;
                    }

                    sw.Close();
                    stream.Close();
                }
            }
            catch (Exception e)
            {
                SkillSettings.DoTell("Error while attempting to write out profile information: " + e);
            }
        }
Пример #10
0
		//This saves a new skill profile to disk.
		/* Structure of a SkillProfile .skp:
		A. SkillProfile Name
		B. Number of Skills on server of origin.
		C. Sum of Stats allowed for profile.
		D. Stat max values (Str, Dex, Int)
		E. Array of bools for enabled/disabled values.
		F. Array of ints for max skill values.		
		*/

		//input is a profile. This comes from the edit or creation gump.
		public static void SkillProfileSaver(SkillProfile profile)
		{
			if (!Directory.Exists("TMSS/SkillProfiles"))
				Directory.CreateDirectory("TMSS/SkillProfiles");

			string FileName = profile.ProfileName + ".skx";

			string path = @"TMSS/SkillProfiles/" + FileName;

			DateTime start = DateTime.Now;
			bool G = !File.Exists(path);
			Console.Write(" - //4// - Saving TMSS Skill Profile " + profile.ProfileName + "...");

			SkillSettings.DoTell2("Outside try");
			try
			{
				XmlWriterSettings settings = new XmlWriterSettings();
				settings.Indent = true;
				settings.IndentChars = "	";

				XmlWriter writer = XmlWriter.Create(path, settings);
				//Must I tell you not to mess with this?

				//Name of the Profile
				writer.WriteStartElement("TMSkillProfile");
				writer.WriteAttributeString("Name", profile.ProfileName);
				SkillSettings.DoTell2("" + profile.ProfileName);

				//Stats Element:
				writer.WriteStartElement("Stats");
				writer.WriteAttributeString("Ena", "" + profile.StatEnable);
				writer.WriteAttributeString("Frc", "" + profile.StatForce);
				writer.WriteAttributeString("Sum", "" + profile.StatSum);
				writer.WriteAttributeString("Str", "" + profile.StrVal);
				writer.WriteAttributeString("Dex", "" + profile.DexVal);
				writer.WriteAttributeString("Int", "" + profile.IntVal);
				writer.WriteEndElement();
				writer.WriteStartElement("Gumps");
				writer.WriteAttributeString("Man", "" + profile.Manual);
				writer.WriteAttributeString("Use", "" + profile.IsGumped);
				writer.WriteAttributeString("Icn", "" + profile.IconID);
				writer.WriteEndElement();
				writer.WriteStartElement("Skills");
				writer.WriteAttributeString("Ena", "" + profile.SkillEnable);
				writer.WriteAttributeString("Pts", "" + profile.SkillPoints);
				writer.WriteAttributeString("Frc", "" + profile.SkillForce);
				writer.WriteAttributeString("Key", "" + profile.IsKeyed);
				writer.WriteAttributeString("CEn", "" + profile.CapEnable);
				writer.WriteAttributeString("CSm", "" + profile.CapSum);
				writer.WriteAttributeString("WEn", "" + profile.WeightEnable);
				writer.WriteAttributeString("Cnt", "" + profile.MasterHash.Count);
				writer.WriteEndElement();
				
				IEnumerator ie = profile.MasterHash.GetEnumerator();
				while (ie.MoveNext())
				{
					//writer.Write(((TMSkillInfo)((DictionaryEntry)ie.Current).Value).SkillName);
					((KeyValuePair<string,TMSkillInfo>)ie.Current).Value.Serialize(writer);
				}
				writer.WriteEndElement(); writer.Close(); Console.WriteLine("done."); writeFile(profile, G);
			}
			catch (Exception e)
			{ SkillSettings.DoTell("Exception when writing SkillProfile: " + e); }
		}
Пример #11
0
 private bool verifyEntries(string p)
 {
     //TODO: Add verification info for:
     //Skills - get profile, and compare values to caps, minimums.
     //Stats - take main profile, compare stat vals to caps, minimums.
     //Skillcaps - take main profile, compare caps to caps caps, minimums.
     SkillSettings.DoTell("verify: " + p);
     if (p == "stats")
     {
         return(checkStats());
     }
     if (p == "caps")
     {
         return(false);
     }
     else             //For skill profiles.
     {
         try
         {
             Dictionary <string, TMUsedInfo> vals = (Dictionary <string, TMUsedInfo>)SelectedSkills[p];
             SkillProfile rules = (SkillProfile)Profile.subProfiles[p];
             IEnumerator  ie    = vals.GetEnumerator();
             double       sum   = 0.0;
             while (ie.MoveNext())
             {
                 TMUsedInfo inf = (TMUsedInfo)((KeyValuePair <string, TMUsedInfo>)ie.Current).Value;
                 SkillSettings.DoTell("Skill debug: " + inf.SkillName + " " + inf.SkillValue + " " + (inf.SkillValue * inf.SkillWeight));
                 sum += (inf.SkillValue * inf.SkillWeight);
             }
             if ((double)rules.SkillPoints >= sum && totalSelectedPoints + sum <= totalAllowedPoints)
             {
                 totalSelectedPoints += sum;
                 SkillSettings.DoTell("Points are valid, and will be added. Sum: " + sum + " TSP: " + totalSelectedPoints + " TAP: " + totalAllowedPoints);
                 TMAlertGump g = new TMAlertGump("The points you selected were added successfully.");
                 Mobile.SendGump(g);
                 return(true);
             }
             else
             {
                 if ((double)totalAllowedPoints < (sum + totalSelectedPoints))
                 {
                     CurrentErrorMessage = "The points you entered are too high for the overall setting. Please adjust your points downward by " + (totalAllowedPoints - (sum + totalSelectedPoints));
                 }
                 if ((double)rules.SkillPoints < sum)
                 {
                     CurrentErrorMessage = "The points you entered are too high for this profile. Please adjust this profile down by " + (rules.SkillPoints - sum);
                 }
                 else if (!((double)totalAllowedPoints < (sum + totalSelectedPoints)))
                 {
                     CurrentErrorMessage = "Another error was encountered.";
                     SkillSettings.DoTell("rules.SkillPoints: " + rules.SkillPoints + " sum: " + sum + " totalSelectedPoints: " + totalSelectedPoints + " totalAllowedPoints: " + totalAllowedPoints + " (double)rules.SkillPoints >= sum: " + ((double)rules.SkillPoints >= sum) + " totalSelectedPoints + sum <= totalAllowedPoints: " + ((totalSelectedPoints + sum) <= totalAllowedPoints));
                 }
                 return(false);
             }
         }
         catch (Exception e)
         {
             SkillSettings.DoTell("Invalid name to attempt verification on. Exception: " + e);
         }
     }
     return(false);
 }
Пример #12
0
		//This method does the actual adding of a profile to the SkillProfiles array.
		//Input is a profile, which is the freshly-loaded profile. Called from the SkillProfileLoader method.	
		public static int AddNewProfile(SkillProfile profile, bool super )
		{
			if (super)
			{
				if (Supers != null)
				{
					if( Supers.ContainsKey( profile.ProfileName ) )
						Supers.Remove( profile.ProfileName);
					Supers.Add( profile.ProfileName, (SuperSkillProfile)profile );
					//SkillSettings.doTell( "New SuperProfile " +profile.ProfileName+" has been added.");
					return Supers.Count;
				}
				else
				{ SkillSettings.DoTell("Invalid hashtable to add to."); return -1; }
			}
			else if (Profiles != null)
			{
				if( Profiles.ContainsKey( profile.ProfileName ))
					Profiles.Remove( profile.ProfileName );
				Profiles.Add(profile.ProfileName, profile);
			
				//ProfileNames.Add(m_profiles.Count, profile.NumAllowed );
				SkillSettings.DoTell2("New profile " + profile.ProfileName + " has been added with point value: "+profile.SkillPoints);
				return Profiles.Count;
			}
			else
			{
				SkillSettings.DoTell("Invalid hashtable");
				return -1;
			}
		}
Пример #13
0
		public void GetGumpCode(TMQueryPage page)
		{
			Page = page;
			SkillSettings.DoTell("GetGumpCode, Skill Gump.");
			if (Profile == null)
			{
				try
				{
					Dictionary<string, object> h = (Dictionary<string, object>)Page.GetValueSet();
					Profile = (SkillProfile)h["Profile"];
					Skin = (TMSS4Skin)h["Skin"];
					Session = (TMSkillSession)h["Session"];
				}
				catch (Exception e)
				{
					SkillSettings.DoTell("Error when generating skill gump: " + e);
					return;
				}
			}
			if (Profile == null)
			{ SkillSettings.DoTell("Profile is still null. Cannot continue."); return; }
			if( !Profile.SkillEnable )
			{
				SkillSettings.DoTell("Skills not enabled on this profile.");
				return;
			}
			this.Dragable = false;
			Page.BaseSkinByType(this);
			Page.AddTitle( "Skill Gump for "+Profile.ProfileName+": ", "Control",this);
			if (Profile.IconID > 0)
			{ 
				SkillSettings.DoTell("Adding Icon: "+Profile.IconID);
				Page.AddIcon(Profile.IconID, "Control", this); 
			}
			this.AddLabel(35, Skin.GetCoord("Control", "H") - 40, Skin.HighlightText, "Profile Maximum: " + Profile.SkillPoints + " pts");
			ButtonInfo inf2 = Skin.ButtonInfo["SessionAddButton"];
			SkillSettings.DoTell("Inf2: X: "+inf2.X+" Y: "+inf2.Y+" W: "+inf2.W+" H: " +inf2.H+" BG: "+inf2.bgID+ " TX: "+inf2.text);
			Page.AddSuperButton(inf2.X, Page.Y+inf2.Y, inf2.H, inf2.W, inf2.bgID, Skin.ListUnderButtonN, Skin.ListUnderButtonP, Skin.AddLabel, GumpButtonType.Reply, 1, 0,this);
			IEnumerator ie = Profile.MasterHash.GetEnumerator();
			GumpList l = new GumpList(this, "details", this.Skin);
			l.numperpage=8;
			l.AddColumn("Skill Name");
			l.AddColumn("Skill Value");
			l.AddColumn("Weight");
			l.AddColumn("Select");
			l.SetColumnCount(4);
			l.ChangeColumnWidth(0, 200);
			l.X = Skin.SelectStartX;
			l.Y = Skin.SelectStartY;
			l.ShowDividers = true;
			int colcount = 3; // at least columns for title, value, and checkbox.
			if (Profile.CapEnable)
				colcount++;
			if (Profile.WeightEnable)
				colcount++;
			l.SetColumnCount(colcount);
			int checkID = 0;
			if (!Profile.Manual)
				checkID = 1000;
			else
				checkID = 3000;
			Dictionary<string,TMUsedInfo> selitem = Session.HasSelectedItems( Profile.ProfileName );
			SkillSettings.DoTell(" Selitem debug: "+selitem.Count+" Profile: "+Profile.ProfileName+" TSP: "+Session.totalSelectedPoints);
			IEnumerator selitemie = selitem.GetEnumerator();
			while (selitemie.MoveNext())
			{
				SkillSettings.DoTell(" - " + ((KeyValuePair<string, TMUsedInfo>)selitemie.Current).Value.SkillName + " Value: " + ((KeyValuePair<string, TMUsedInfo>)selitemie.Current).Value.SkillValue);
			}
			while (ie.MoveNext())
			{
				TMSkillInfo inf = (TMSkillInfo)((KeyValuePair<string,TMSkillInfo>)ie.Current).Value;
				/*
				if (y % sk.NumPerPage == 0)
				{Page.SetupPage(thisProfile.ProfileName, y == 0, thisProfile.MasterHash.Count - y < sk.NumPerPage ? true : false, page); page++;}
				Page.AddEntryCheck( 0, y%sk.NumPerPage, sk.SelectUp, sk.SelectDn, false, (1000 * page) + (y % sk.NumPerPage), ""+inf.SkillName, ""+inf.SkillWeight, ""+inf.SkillValue );
				y++;*/
				GumpListEntry e = new GumpListEntry(0, 0, l, Skin.EntryDefaultWidth, Skin.EntryDefaultHeight);

				e.AddColumn(inf.SkillName);
				e.AddColumn("" + inf.SkillValue);
				if (Profile.CapEnable)
					e.AddColumn("" + inf.SkillCap);
				if (Profile.WeightEnable)
					e.AddColumn("" + inf.SkillWeight);
				if (!Profile.Manual)
					e.AddColumn(new GumpCheck(-2, 0, Skin.EntryDefaultCheckUp, Skin.EntryDefaultCheckDn, selitem.ContainsKey(inf.SkillName), checkID));
				else
					e.AddColumn(new GumpTextEntry(0, 0, 30, Skin.EntryDefaultHeight, Skin.NormalText, checkID, ""));

				checkID++;
				l.Add(e);
			}
			l.CommitList();	
			Session.Mobile.SendGump(this);
		}
Пример #14
0
		//This method does the actual adding of a profile to the SkillProfiles array.
		//Input is a profile, which is the freshly-loaded profile. Called from the SkillProfileLoader method.	
		public static int AddNewProfile(SkillProfile profile)
		{
			return AddNewProfile( profile, false );
		}
Пример #15
0
		private static void RegisterProfile(SkillProfile profile)
		{
			SkillProfileSaver(profile);
			AddNewProfile(profile);
		}
Пример #16
0
		public static SuperSkillProfile GenInitialProfile()
		{
			Console.WriteLine(" - TMSS|4 Default Profile Generation In Progress...");
			//SkillProfile profile = new SkillProfile("Default Profile");
			
			SuperSkillProfile defprof = new SuperSkillProfile( "Default Profile" );

			SkillProfile miscProf = new SkillProfile ("Miscellaneous");
						
			miscProf.addCompleteEntry(true, 100, 1.0, 10, 0);//0
			miscProf.addCompleteEntry(true, 100, 1.0, 10, 7);//7
			miscProf.addCompleteEntry(true, 100, 1.0, 10, 8);//8
			miscProf.addCompleteEntry(true, 100, 1.0, 10, 11);//11
			miscProf.addCompleteEntry(true, 100, 1.0, 10, 13);//13
			miscProf.addCompleteEntry(true, 100, 1.0, 10, 17);//17
			miscProf.addCompleteEntry(true, 100, 1.0, 10, 18);//18
			miscProf.addCompleteEntry(true, 100, 1.0, 10, 20);//20
			miscProf.addCompleteEntry(true, 100, 1.0, 10, 24);//24
			miscProf.addCompleteEntry(true, 100, 1.0, 10, 25);//25
			miscProf.addCompleteEntry(true, 100, 1.0, 10, 26);//26
			miscProf.addCompleteEntry(true, 100, 1.0, 10, 28);//28
			miscProf.addCompleteEntry(true, 100, 1.0, 10, 29);//29
			miscProf.addCompleteEntry(true, 100, 1.0, 10, 33);//33
			miscProf.addCompleteEntry(true, 100, 1.0, 10, 34);//34
			miscProf.addCompleteEntry(true, 100, 1.0, 10, 37);//37
			miscProf.addCompleteEntry(true, 100, 1.0, 10, 39);//39
			miscProf.addCompleteEntry(true, 100, 1.0, 10, 45);//45
			miscProf.addCompleteEntry(true, 100, 1.0, 10, 46);//46
			miscProf.addCompleteEntry(true, 100, 1.0, 10, 47);//47
			miscProf.addCompleteEntry(true, 100, 1.0, 10, 48);//48
			miscProf.addCompleteEntry(true, 100, 1.0, 10, 49);//49
			miscProf.addCompleteEntry(true, 100, 1.0, 10, 50);//50
			miscProf.addCompleteEntry(true, 100, 1.0, 10, 51);//51
			miscProf.addCompleteEntry(true, 100, 1.0, 10, 52);//52
			miscProf.addCompleteEntry(true, 100, 1.0, 10, 53);//53
			miscProf.addCompleteEntry(true, 100, 1.0, 10, 54);//54
			miscProf.IconID = 2287;
			RegisterProfile( miscProf );
			defprof.addProfile( miscProf );

			SkillProfile comRate = new SkillProfile( "Combat Ratings" );

			comRate.addCompleteEntry(true, 100, 1.0, 10, 31);//31
			comRate.addCompleteEntry(true, 100, 1.0, 10, 42);//42
			comRate.addCompleteEntry(true, 100, 1.0, 10, 41);//41
			comRate.addCompleteEntry(true, 100, 1.0, 10, 5);//5
			comRate.addCompleteEntry(true, 100, 1.0, 10, 40);//40
			comRate.addCompleteEntry(true, 100, 1.0, 10, 27);//27
			comRate.addCompleteEntry(true, 100, 1.0, 10, 43);//43
			comRate.IconID = 5585;
			RegisterProfile( comRate );
			defprof.addProfile( comRate );

			SkillProfile actions = new SkillProfile( "Actions" );

			actions.addCompleteEntry(true, 100, 1.0, 10, 35);//35
			actions.addCompleteEntry(true, 100, 1.0, 10, 6);//6
			actions.addCompleteEntry(true, 100, 1.0, 10, 10);//10
			actions.addCompleteEntry(true, 100, 1.0, 10, 12);//12
			actions.addCompleteEntry(true, 100, 1.0, 10, 14);//14
			actions.addCompleteEntry(true, 100, 1.0, 10, 15);//15
			actions.addCompleteEntry(true, 100, 1.0, 10, 21);//21
			actions.addCompleteEntry(true, 100, 1.0, 10, 23);//23
			actions.addCompleteEntry(true, 100, 1.0, 10, 9);//9
			actions.addCompleteEntry(true, 100, 1.0, 10, 30);//30
			actions.addCompleteEntry(true, 100, 1.0, 10, 22);//22
			actions.addCompleteEntry(true, 100, 1.0, 10, 32);//32
			actions.addCompleteEntry(true, 100, 1.0, 10, 38);//38
			actions.IconID = 20998;
			RegisterProfile( actions );
			defprof.addProfile( actions );

			SkillProfile loreKnow = new SkillProfile( "Lore & Knowledge" );

			loreKnow.addCompleteEntry(true, 100, 1.0, 10, 1);//1
			loreKnow.addCompleteEntry(true, 100, 1.0, 10, 2);//2
			loreKnow.addCompleteEntry(true, 100, 1.0, 10, 4);//4
			loreKnow.addCompleteEntry(true, 100, 1.0, 10, 16);//16
			loreKnow.addCompleteEntry(true, 100, 1.0, 10, 19);//19
			loreKnow.addCompleteEntry(true, 100, 1.0, 10, 3);//3
			loreKnow.addCompleteEntry(true, 100, 1.0, 10, 36);//36
			loreKnow.IconID = 23014;
			RegisterProfile( loreKnow );
			defprof.addProfile( loreKnow );

			SuperProfileHelper.RegisterSuperProfile(defprof);
			SuperProfileHelper.SaveSelf(defprof);
			Console.WriteLine("done");
			//writeFile(profile, true);
			return defprof;
		}
Пример #17
0
		public static void writeFile(SkillProfile profile, bool naming)
		{

			string middle;
			if (naming)
				middle = "" + profile.ProfileName + " [Original]";
			else
				middle = "" + profile.ProfileName;

			if (!Directory.Exists("TMSS/SkillProfiles/Information"))
				Directory.CreateDirectory("TMSS/SkillProfiles/Information/");

			string path = "TMSS/SkillProfiles/Information/" + profile.ProfileName + ".txt";
			try
			{
				using (FileStream stream = new FileStream(path, FileMode.OpenOrCreate, FileAccess.Write))
				{
					StreamWriter sw = new StreamWriter(stream);

					sw.WriteLine("This is the output for " + profile.ProfileName + " on " + DateTime.Now);

					if (naming)
						sw.WriteLine("This was generated at the creation of the profile.");

					sw.WriteLine("\n\nGeneral: ");
					sw.WriteLine("\t-Manual: " + profile.Manual);
					sw.WriteLine("\t-Stat Force: " + profile.StatForce);
					sw.WriteLine("\t-Stats Enabled: " + profile.StatEnable);
					sw.WriteLine("\t-Stat Sum: " + profile.StatSum);
					sw.WriteLine("\t-Strength: " + profile.StrVal);
					sw.WriteLine("\t-Dexterity: " + profile.DexVal);
					sw.WriteLine("\t-Intelligence: " + profile.IntVal);
					sw.WriteLine("\t-Skill Force: " + profile.SkillForce);
					sw.WriteLine("\t-Name: " + profile.ProfileName);
					sw.WriteLine("\t-Num Allowed Skills: " + profile.SkillPoints);
					sw.WriteLine("\t-Skill Sum: " + profile.SkillPoints);
					sw.WriteLine("\t-Skill Sum: " + profile.IsKeyed);
					sw.WriteLine("\t-Skill Sum: " + profile.IsGumped);
					sw.WriteLine("\n\nEnabled Skills & Skill Values: ");
					sw.WriteLine("\n\n");
					//sw.WriteLine("Index: " +  " Name: " + SkillInfo.Table[0].Name + " Is: " +   " And its Max Value is: " );
					IEnumerator ie = profile.MasterHash.GetEnumerator();
					int i = 0;
					while (ie.MoveNext())
					{
						TMSkillInfo info = ((KeyValuePair<string,TMSkillInfo>)ie.Current).Value;
						sw.WriteLine("\tIndex: "+i+" Name: "+info.SkillName+" is "+info.SkillEnable+", with Max of: "+info.SkillValue+", Cap of "+info.SkillCap+", and Weight of "+info.SkillWeight);
						i++;
					}

					sw.Close();
					stream.Close();
				}

			}
			catch (Exception e)
			{
				SkillSettings.DoTell("Error while attempting to write out profile information: " + e);
			}
		}
Пример #18
0
		//This is used when a new profile is selected for an item, in order to load up the profile.
		//It is only used if the profile is not already loaded into the SkillProfiles array above.
		public static int SkillProfileLoader(string name, bool which)
		{			
			if (Profiles.ContainsKey(name))
				return ((SkillProfile)Profiles[name]).ID;
			try
			{
				SkillProfile profile;
				string path = "";
				if (which == false)
					path = "TMSS/SkillProfiles/" + name + ".skx";
				else
					path = "TMSS/SkillProfiles/" + name;
				if (!File.Exists(path))
				{ SkillSettings.DoTell("File Does Not Exist: " + path);	return 0; }				
				
				XmlReaderSettings settings = new XmlReaderSettings();
				settings.IgnoreWhitespace = true;
				XmlReader reader = XmlReader.Create(path, settings);
				reader.ReadToFollowing("TMSkillProfile");
				int count = 0;
				string realname = reader.GetAttribute(0);
				//reader.ReadStartElement("TMSkillProfile");				
				profile = new SkillProfile(realname);
				
				reader.ReadToFollowing("Stats");
				profile.StatEnable = reader.GetAttribute(0) == "True" ? true : false;
				profile.StatForce = reader.GetAttribute(1) == "True" ? true : false;
				profile.StatSum = Int32.Parse(reader.GetAttribute(2));
				profile.StrVal = Int32.Parse(reader.GetAttribute(3) );
				profile.DexVal = Int32.Parse(reader.GetAttribute(4) );
				profile.DexVal = Int32.Parse(reader.GetAttribute(5) );

				reader.ReadToFollowing("Gumps");				
				profile.Manual = reader.GetAttribute(0) == "True" ? true : false;
				profile.IsGumped = reader.GetAttribute(1) == "True" ? true : false;
				profile.IconID = Int32.Parse(reader.GetAttribute(2) );

				reader.ReadToFollowing("Skills");
				profile.SkillEnable = reader.GetAttribute(0) == "True" ? true : false;
				profile.SkillPoints = Int32.Parse(reader.GetAttribute(1));
				SkillSettings.DoTell("Profile - "+profile.ProfileName+" has points at "+profile.SkillPoints );
				profile.SkillForce = reader.GetAttribute(2) == "True" ? true : false;
				profile.IsKeyed = reader.GetAttribute(3) == "True" ? true : false;
				profile.CapEnable = reader.GetAttribute(4) == "True" ? true : false;
				profile.CapSum = Int32.Parse(reader.GetAttribute(5));
				profile.WeightEnable = reader.GetAttribute(6) == "True" ? true : false;
				count = Int32.Parse(reader.GetAttribute(7) );
				reader.ReadToFollowing("SkillInfo");		
				while (count > 0)
				{
					TMSkillInfo inf = new TMSkillInfo( reader );
					profile.MasterHash.Add( inf.SkillName, inf );
					count--;
				}
				reader.Close();								
				int ret = AddNewProfile(profile);
				writeFile(profile, false);
				return ret;
			}
			catch (Exception e)
			{ SkillSettings.DoTell("Error while loading Skill Profile. This is a Level 1 I/O error. Please report." + e); return -1; }
		}
Пример #19
0
        public void GetGumpCode(TMQueryPage page)
        {
            Page = page;
            SkillSettings.DoTell("GetGumpCode, Skill Gump.");
            if (Profile == null)
            {
                try
                {
                    Dictionary <string, object> h = (Dictionary <string, object>)Page.GetValueSet();
                    Profile = (SkillProfile)h["Profile"];
                    Skin    = (TMSS4Skin)h["Skin"];
                    Session = (TMSkillSession)h["Session"];
                }
                catch (Exception e)
                {
                    SkillSettings.DoTell("Error when generating skill gump: " + e);
                    return;
                }
            }
            if (Profile == null)
            {
                SkillSettings.DoTell("Profile is still null. Cannot continue."); return;
            }
            if (!Profile.SkillEnable)
            {
                SkillSettings.DoTell("Skills not enabled on this profile.");
                return;
            }
            this.Dragable = false;
            Page.BaseSkinByType(this);
            Page.AddTitle("Skill Gump for " + Profile.ProfileName + ": ", "Control", this);
            if (Profile.IconID > 0)
            {
                SkillSettings.DoTell("Adding Icon: " + Profile.IconID);
                Page.AddIcon(Profile.IconID, "Control", this);
            }
            this.AddLabel(35, Skin.GetCoord("Control", "H") - 40, Skin.HighlightText, "Profile Maximum: " + Profile.SkillPoints + " pts");
            ButtonInfo inf2 = Skin.ButtonInfo["SessionAddButton"];

            SkillSettings.DoTell("Inf2: X: " + inf2.X + " Y: " + inf2.Y + " W: " + inf2.W + " H: " + inf2.H + " BG: " + inf2.bgID + " TX: " + inf2.text);
            Page.AddSuperButton(inf2.X, Page.Y + inf2.Y, inf2.H, inf2.W, inf2.bgID, Skin.ListUnderButtonN, Skin.ListUnderButtonP, Skin.AddLabel, GumpButtonType.Reply, 1, 0, this);
            IEnumerator ie = Profile.MasterHash.GetEnumerator();
            GumpList    l  = new GumpList(this, "details", this.Skin);

            l.numperpage = 8;
            l.AddColumn("Skill Name");
            l.AddColumn("Skill Value");
            l.AddColumn("Weight");
            l.AddColumn("Select");
            l.SetColumnCount(4);
            l.ChangeColumnWidth(0, 200);
            l.X            = Skin.SelectStartX;
            l.Y            = Skin.SelectStartY;
            l.ShowDividers = true;
            int colcount = 3;             // at least columns for title, value, and checkbox.

            if (Profile.CapEnable)
            {
                colcount++;
            }
            if (Profile.WeightEnable)
            {
                colcount++;
            }
            l.SetColumnCount(colcount);
            int checkID = 0;

            if (!Profile.Manual)
            {
                checkID = 1000;
            }
            else
            {
                checkID = 3000;
            }
            Dictionary <string, TMUsedInfo> selitem = Session.HasSelectedItems(Profile.ProfileName);

            SkillSettings.DoTell(" Selitem debug: " + selitem.Count + " Profile: " + Profile.ProfileName + " TSP: " + Session.totalSelectedPoints);
            IEnumerator selitemie = selitem.GetEnumerator();

            while (selitemie.MoveNext())
            {
                SkillSettings.DoTell(" - " + ((KeyValuePair <string, TMUsedInfo>)selitemie.Current).Value.SkillName + " Value: " + ((KeyValuePair <string, TMUsedInfo>)selitemie.Current).Value.SkillValue);
            }
            while (ie.MoveNext())
            {
                TMSkillInfo inf = (TMSkillInfo)((KeyValuePair <string, TMSkillInfo>)ie.Current).Value;

                /*
                 * if (y % sk.NumPerPage == 0)
                 * {Page.SetupPage(thisProfile.ProfileName, y == 0, thisProfile.MasterHash.Count - y < sk.NumPerPage ? true : false, page); page++;}
                 * Page.AddEntryCheck( 0, y%sk.NumPerPage, sk.SelectUp, sk.SelectDn, false, (1000 * page) + (y % sk.NumPerPage), ""+inf.SkillName, ""+inf.SkillWeight, ""+inf.SkillValue );
                 * y++;*/
                GumpListEntry e = new GumpListEntry(0, 0, l, Skin.EntryDefaultWidth, Skin.EntryDefaultHeight);

                e.AddColumn(inf.SkillName);
                e.AddColumn("" + inf.SkillValue);
                if (Profile.CapEnable)
                {
                    e.AddColumn("" + inf.SkillCap);
                }
                if (Profile.WeightEnable)
                {
                    e.AddColumn("" + inf.SkillWeight);
                }
                if (!Profile.Manual)
                {
                    e.AddColumn(new GumpCheck(-2, 0, Skin.EntryDefaultCheckUp, Skin.EntryDefaultCheckDn, selitem.ContainsKey(inf.SkillName), checkID));
                }
                else
                {
                    e.AddColumn(new GumpTextEntry(0, 0, 30, Skin.EntryDefaultHeight, Skin.NormalText, checkID, ""));
                }

                checkID++;
                l.Add(e);
            }
            l.CommitList();
            Session.Mobile.SendGump(this);
        }
Пример #20
0
        //This saves a new skill profile to disk.

        /* Structure of a SkillProfile .skp:
         * A. SkillProfile Name
         * B. Number of Skills on server of origin.
         * C. Sum of Stats allowed for profile.
         * D. Stat max values (Str, Dex, Int)
         * E. Array of bools for enabled/disabled values.
         * F. Array of ints for max skill values.
         */

        //input is a profile. This comes from the edit or creation gump.
        public static void SkillProfileSaver(SkillProfile profile)
        {
            if (!Directory.Exists("TMSS/SkillProfiles"))
            {
                Directory.CreateDirectory("TMSS/SkillProfiles");
            }

            string FileName = profile.ProfileName + ".skx";

            string path = @"TMSS/SkillProfiles/" + FileName;

            DateTime start = DateTime.Now;
            bool     G     = !File.Exists(path);

            Console.Write(" - //4// - Saving TMSS Skill Profile " + profile.ProfileName + "...");

            SkillSettings.DoTell2("Outside try");
            try
            {
                XmlWriterSettings settings = new XmlWriterSettings();
                settings.Indent      = true;
                settings.IndentChars = "	";

                XmlWriter writer = XmlWriter.Create(path, settings);
                //Must I tell you not to mess with this?

                //Name of the Profile
                writer.WriteStartElement("TMSkillProfile");
                writer.WriteAttributeString("Name", profile.ProfileName);
                SkillSettings.DoTell2("" + profile.ProfileName);

                //Stats Element:
                writer.WriteStartElement("Stats");
                writer.WriteAttributeString("Ena", "" + profile.StatEnable);
                writer.WriteAttributeString("Frc", "" + profile.StatForce);
                writer.WriteAttributeString("Sum", "" + profile.StatSum);
                writer.WriteAttributeString("Str", "" + profile.StrVal);
                writer.WriteAttributeString("Dex", "" + profile.DexVal);
                writer.WriteAttributeString("Int", "" + profile.IntVal);
                writer.WriteEndElement();
                writer.WriteStartElement("Gumps");
                writer.WriteAttributeString("Man", "" + profile.Manual);
                writer.WriteAttributeString("Use", "" + profile.IsGumped);
                writer.WriteAttributeString("Icn", "" + profile.IconID);
                writer.WriteEndElement();
                writer.WriteStartElement("Skills");
                writer.WriteAttributeString("Ena", "" + profile.SkillEnable);
                writer.WriteAttributeString("Pts", "" + profile.SkillPoints);
                writer.WriteAttributeString("Frc", "" + profile.SkillForce);
                writer.WriteAttributeString("Key", "" + profile.IsKeyed);
                writer.WriteAttributeString("CEn", "" + profile.CapEnable);
                writer.WriteAttributeString("CSm", "" + profile.CapSum);
                writer.WriteAttributeString("WEn", "" + profile.WeightEnable);
                writer.WriteAttributeString("Cnt", "" + profile.MasterHash.Count);
                writer.WriteEndElement();

                IEnumerator ie = profile.MasterHash.GetEnumerator();
                while (ie.MoveNext())
                {
                    //writer.Write(((TMSkillInfo)((DictionaryEntry)ie.Current).Value).SkillName);
                    ((KeyValuePair <string, TMSkillInfo>)ie.Current).Value.Serialize(writer);
                }
                writer.WriteEndElement(); writer.Close(); Console.WriteLine("done."); writeFile(profile, G);
            }
            catch (Exception e)
            { SkillSettings.DoTell("Exception when writing SkillProfile: " + e); }
        }
Пример #21
0
        //This is used when a new profile is selected for an item, in order to load up the profile.
        //It is only used if the profile is not already loaded into the SkillProfiles array above.
        public static int SkillProfileLoader(string name, bool which)
        {
            if (Profiles.ContainsKey(name))
            {
                return(((SkillProfile)Profiles[name]).ID);
            }
            try
            {
                SkillProfile profile;
                string       path = "";
                if (which == false)
                {
                    path = "TMSS/SkillProfiles/" + name + ".skx";
                }
                else
                {
                    path = "TMSS/SkillProfiles/" + name;
                }
                if (!File.Exists(path))
                {
                    SkillSettings.DoTell("File Does Not Exist: " + path); return(0);
                }

                XmlReaderSettings settings = new XmlReaderSettings();
                settings.IgnoreWhitespace = true;
                XmlReader reader = XmlReader.Create(path, settings);
                reader.ReadToFollowing("TMSkillProfile");
                int    count    = 0;
                string realname = reader.GetAttribute(0);
                //reader.ReadStartElement("TMSkillProfile");
                profile = new SkillProfile(realname);

                reader.ReadToFollowing("Stats");
                profile.StatEnable = reader.GetAttribute(0) == "True" ? true : false;
                profile.StatForce  = reader.GetAttribute(1) == "True" ? true : false;
                profile.StatSum    = Int32.Parse(reader.GetAttribute(2));
                profile.StrVal     = Int32.Parse(reader.GetAttribute(3));
                profile.DexVal     = Int32.Parse(reader.GetAttribute(4));
                profile.DexVal     = Int32.Parse(reader.GetAttribute(5));

                reader.ReadToFollowing("Gumps");
                profile.Manual   = reader.GetAttribute(0) == "True" ? true : false;
                profile.IsGumped = reader.GetAttribute(1) == "True" ? true : false;
                profile.IconID   = Int32.Parse(reader.GetAttribute(2));

                reader.ReadToFollowing("Skills");
                profile.SkillEnable = reader.GetAttribute(0) == "True" ? true : false;
                profile.SkillPoints = Int32.Parse(reader.GetAttribute(1));
                SkillSettings.DoTell("Profile - " + profile.ProfileName + " has points at " + profile.SkillPoints);
                profile.SkillForce   = reader.GetAttribute(2) == "True" ? true : false;
                profile.IsKeyed      = reader.GetAttribute(3) == "True" ? true : false;
                profile.CapEnable    = reader.GetAttribute(4) == "True" ? true : false;
                profile.CapSum       = Int32.Parse(reader.GetAttribute(5));
                profile.WeightEnable = reader.GetAttribute(6) == "True" ? true : false;
                count = Int32.Parse(reader.GetAttribute(7));
                reader.ReadToFollowing("SkillInfo");
                while (count > 0)
                {
                    TMSkillInfo inf = new TMSkillInfo(reader);
                    profile.MasterHash.Add(inf.SkillName, inf);
                    count--;
                }
                reader.Close();
                int ret = AddNewProfile(profile);
                writeFile(profile, false);
                return(ret);
            }
            catch (Exception e)
            { SkillSettings.DoTell("Error while loading Skill Profile. This is a Level 1 I/O error. Please report." + e); return(-1); }
        }
Пример #22
0
		public void addProfile(SkillProfile p)
		{
			if( subProfiles.ContainsKey( p.ProfileName ) )
				subProfiles.Remove( p.ProfileName );

			subProfiles.Add(p.ProfileName, p);
		}