コード例 #1
0
        public void GetGumpCode(TMQueryPage page)
        {
            object o = page.GetValueSet();

            Page          = page;
            this.Dragable = false;
            if (o is TMSkillSession)
            {
                Session = (TMSkillSession)o;
                prof    = Session.Profile;
            }
            Page.BaseSkinByType(this);
            if (prof == null)
            {
                SkillSettings.DoTell("Invalid profile to set up Master."); return;
            }
            TMSS4Skin sk = Session.Skin;

            Page.AddSuperButton(sk.FinishButtonX, sk.FinishButtonY, sk.FinishButtonH, sk.FinishButtonW, sk.ButtonOverlay, sk.ButtonUnderID, sk.ButtonUnderID, sk.FinishLabel, GumpButtonType.Reply, 101, 0, this);
            AddLabel(sk.PointsLabelX, sk.PointsLabelY, sk.Red, sk.PointsLabel + " " + Session.totalSelectedPoints + " / " + Session.totalAllowedPoints);
            AddPage(1);

            IEnumerator ie           = prof.getProfileList();
            int         count        = prof.subProfiles.Count;
            int         i            = 0;
            int         pageid       = 1;
            int         pagesubcount = 0;

            //Add button for stats.
            Page.AddSuperButton(sk.ProfileX, sk.ProfileY + ((i % 6) * (sk.ProfileSpacer + sk.ProfileButtonH)), sk.ProfileButtonH, sk.ProfileButtonW, sk.ProfileNormalID, sk.SelectUnderlay, sk.SelectUnderlay, "Stats", GumpButtonType.Reply, i + 1, 0, this);
            i++;
            pagesubcount++;
            while (ie.MoveNext())
            {
                string blah = ((SkillProfile)((KeyValuePair <string, SkillProfile>)ie.Current).Value).ProfileName;
                SkillSettings.DoTell2("Master gump debug: " + blah);
                Page.AddSuperButton(sk.ProfileX, sk.ProfileY + ((i % 6) * (sk.ProfileSpacer + sk.ProfileButtonH)), sk.ProfileButtonH, sk.ProfileButtonW, sk.ProfileNormalID, sk.SelectUnderlay, sk.SelectUnderlay, "" + blah, GumpButtonType.Reply, i + 1, 0, this);
                i++;
                pagesubcount++;
                if (pagesubcount == 5)
                {
                    pagesubcount = 0;
                }
                if (pagesubcount == 1)
                {
                    Page.AddSuperButton(sk.FinishButtonX, sk.FinishButtonY, sk.FinishButtonH, sk.FinishButtonW, sk.ProfileNormalID, sk.SelectUnderlay, sk.SelectUnderlay, "" + sk.FinishLabel, GumpButtonType.Reply, 101, 0, this);
                }
                if (pagesubcount == 0)
                {
                    pageid++;
                    AddPage(pageid);
                    Page.AddSuperButton(sk.NextButtonMX, sk.NextButtonMY, sk.NextButtonMH, sk.NextButtonMW, sk.ProfileNormalID, sk.SelectUnderlay, sk.SelectUnderlay, "" + sk.NextTextM, GumpButtonType.Page, 0, pageid + 1, this);
                    if (pageid != 1)
                    {
                        Page.AddSuperButton(sk.PrevButtonMX, sk.PrevButtonMY, sk.PrevButtonMH, sk.PrevButtonMW, sk.ProfileNormalID, sk.SelectUnderlay, sk.SelectUnderlay, "" + sk.PrevTextM, GumpButtonType.Page, 0, pageid - 1, this);
                    }
                }
            }
            Session.Mobile.SendGump(this);
        }
コード例 #2
0
        public override void Serialize(GenericWriter writer)
        {
            base.Serialize(writer);
            writer.Write((int)5);             // version
            writer.Write((bool)HasProfileSet);
            SkillSettings.DoTell2("" + HasProfileSet);

            if (Profile != null && HasProfileSet)
            {
                writer.Write((string)Profile.ProfileName);
                SkillSettings.DoTell2("" + Profile.ProfileName);
            }
            writer.Write(Skin);
        }
コード例 #3
0
        public static int RegisterSection(string section, string name)
        {
            //SkillSettings.DoTell("Register 1 Called.");
            SkillSettings.DoTell2("Gump Registration - Registering Section: " + name + "...");

            GumpCalls.Add(name, section);
            PluginsEnabled.Add(name, true);
            GumpNames.Add(section, name);
            GumpIDs.Add(name, GumpCalls.Count - 1);
            //GumpCallsByID.Add( GumpCalls.Count-1, name );

            if (SkillSettings.DebugMode2)
            {
                Console.WriteLine(" done.");
            }

            return(GumpCalls.Count - 1);
        }
コード例 #4
0
ファイル: MenuPages.cs プロジェクト: Orion321/unknown-shard
        public void GetGumpCode(TMQueryPage page)
        {
            //page.AddTitle(@"Main Menu:", "Control");
            page.AddIcon(2245, "Control");
            IEnumerator enu = QueryPageHelper.GumpNames.GetEnumerator();            //list.GetEnumerator();
            //IEnumerator enu = enu1.GetEnumerator();
            ArrayList sortList = new ArrayList();

            while (enu.MoveNext())
            {
                string current = (string)((KeyValuePair <string, string>)enu.Current).Value;
                sortList.Add(current);
            }
            sortList.Sort(new AlphaCompare());
            enu = sortList.GetEnumerator();
            int pageNum = 0;
            int i       = 0;

            while (enu.MoveNext())
            {
                SkillSettings.DoTell2("" + enu.Current);
                string current = (string)enu.Current;
                if (current != "Main Menu" && !current.Contains("TMSS")) //Removes the Main Menu and the SkillStat gumps from the list.
                {
                    if (i % 8 == 0)                                      //if it's at 10, stop. Counts 1-10. (Same as 0-9)
                    {
                        pageNum++;
                        page.AddPage(pageNum);
                        page.SetupPage(@"Main Menu: ", (i == 0), (sortList.Count - (pageNum * 10)) <= 8 ? true : false, pageNum);
                    }
                    //string pluginName = (string)QueryPageHelper.GumpCalls[current];
                    int pluginID = -1;
                    try
                    {
                        pluginID = (int)QueryPageHelper.GumpIDs[current] + 1;
                    }
                    catch (Exception e) { SkillSettings.DoTell("BLAH! " + e); }
                    SkillSettings.DoTell2("Current Plugin: " + current);
                    page.AddEntryButton(0, i, sk.genericSelectUp, sk.genericSelectDn, pluginID, GumpButtonType.Reply, 0, current, "", "");
                    i++;
                }
            }
        }
コード例 #5
0
        public override void Deserialize(GenericReader reader)
        {
            try
            {
                base.Deserialize(reader);
                int version = reader.ReadInt();

                if (version == 5)
                {
                    HasProfileSet = reader.ReadBool();
                    SkillSettings.DoTell2("" + HasProfileSet);

                    if (HasProfileSet)
                    {
                        string temp = reader.ReadString();
                        if (temp != null)
                        {
                            SkillSettings.DoTell2(temp);
                            if (SkillProfileHelper.ProfileExists(temp))
                            {
                                Profile = (SuperSkillProfile)SkillProfileHelper.getProfile(temp);
                            }
                        }
                        else
                        {
                            HasProfileSet = false;
                        }
                    }
                    Skin = reader.ReadString();
                }
                else
                {
                    SkillSettings.DoTell2("Version is unknown.");
                }
            }
            catch (Exception e)
            {
                SkillSettings.DoTell("W. T. F. " + e);
            }
        }
コード例 #6
0
        private void addEntry(GumpList l, Skill sk, int i, int j)
        {
            WindowInfo    info         = skin.WindowInfo["SkillWindow"];
            GumpListEntry gle          = new GumpListEntry(0, 0, l, info.W - 12, 18);
            int           lockbuttonup = 0;
            int           lockbuttondn = 0;

            switch (sk.Lock)
            {
            case SkillLock.Down:
                lockbuttonup = skin.ButtonInfo["DownButton"].up;
                lockbuttondn = skin.ButtonInfo["DownButton"].down;
                break;

            case SkillLock.Locked:
                lockbuttonup = skin.ButtonInfo["LockButton"].up;
                lockbuttondn = skin.ButtonInfo["LockButton"].down;
                break;

            case SkillLock.Up:
                lockbuttonup = skin.ButtonInfo["UpButton"].up;
                lockbuttondn = skin.ButtonInfo["UpButton"].down;
                break;
            }
            ButtonInfo select = skin.ButtonInfo["UseButton"];

            SkillSettings.DoTell2("AE i: " + i + " lock button: " + (1000 + (100 * j) + i));
            if (sk.Info.Callback != null)
            {
                gle.AddColumn(new GumpButton(0, 3, select.up, select.down, 1000 + i, GumpButtonType.Reply, 0));
            }
            else
            {
                gle.AddColumn("");
            }
            gle.AddColumn("   " + sk.Name);
            gle.AddColumn(" " + (checkdouble(sk.Value) ? " " + sk.Value + ".0" : " " + sk.Value));
            gle.AddColumn(new GumpButton(0, 3, lockbuttonup, lockbuttondn, 10000 + i, GumpButtonType.Reply, 0));
            l.Add(gle);
        }
コード例 #7
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);
            }
        }
コード例 #8
0
        public override void OnResponse(NetState sender, RelayInfo info)
        {
            Mobile from = sender.Mobile;
            Dictionary <string, TMUsedInfo> selected = new Dictionary <string, TMUsedInfo>();

            if (info.ButtonID == 1)
            {
                bool man   = Profile.Manual;
                int  page  = 1;
                int  count = 0;
                int  csid  = (1000 * page) + (count % (Skin.NumPerPage - 1));
                if (man)
                {
                    while (count != Profile.MasterHash.Count)
                    {
                        string relaytext = "";
                        try
                        {
                            TextRelay relay = info.GetTextEntry(csid);
                            relaytext = relay.Text;
                        }
                        catch (Exception ex)
                        {
                            SkillSettings.DoTell2("Manual gathering problems: " + ex);
                        }
                        if (relaytext != "")
                        {
                            int value = -1;
                            try { value = Int32.Parse(relaytext); }
                            catch (Exception ex) { SkillSettings.DoTell2("Error on parse manual: " + ex); }
                            TMSkillInfo skinf = Profile.getAtRank(count);
                            if (skinf.SkillEnable)
                            {
                                TMUsedInfo inf = new TMUsedInfo(skinf.SkillName, value * skinf.SkillWeight, skinf.SkillWeight, skinf.SkillCap, skinf.SkillID);
                                selected.Add(skinf.SkillName, inf);
                            }
                        }
                        if (count % Skin.NumPerPage == 0 && count != 0)
                        {
                            page++;
                        }
                        count++;
                        csid = 3000 + count;
                    }
                }
                else
                {
                    while (count != Profile.MasterHash.Count)                      //Make sure all text entries have a 0 in them.
                    {
                        if (info.IsSwitched(csid))
                        {
                            TMSkillInfo skinf = Profile.getAtRank(count);
                            TMUsedInfo  inf   = new TMUsedInfo(skinf.SkillName, skinf.SkillWeight * skinf.SkillValue, skinf.SkillWeight, skinf.SkillCap, skinf.SkillID);
                            selected.Add(skinf.SkillName, inf);
                        }
                        if ((count + 1) % Skin.NumPerPage == 0)
                        {
                            page++;
                        }
                        count++;
                        csid = 1000 + count;
                    }
                }
            }
            else
            {
                return;
            }
            bool resend = Session.addSkill("" + Profile.ProfileName, selected);

            if (resend)
            {
                from.SendGump(Page.Clone());
                from.SendGump(new TMAlertGump(Session.CurrentErrorMessage));
            }
        }
コード例 #9
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); }
        }
コード例 #10
0
        public void GetGumpCode(  )
        {
            WindowInfo info = new WindowInfo();

            try
            {
                info = skin.WindowInfo["SkillWindow"];
            }
            catch { return; }

            this.X = info.X;
            this.Y = info.Y;
            this.AddButton(170, 0, 2093, 2093, -100, GumpButtonType.Reply, 0);

            this.AddBackground(0, 15, info.W, info.H, info.bgID);
            this.AddImage(145, 30, 2100);
            this.AddImage(22, 355, 2102);
            this.AddImage(60, 54, 2091);
            this.AddImage(60, 333, 2091);
            Mobile m = Mobile;
            Skills s = m.Skills;

            this.AddLabel(270, 354, skin.BlueTextHue, "" + (checkdouble(s.Total / 10) ? " " + (s.Total / 10) + ".0" : " " + (s.Total / 10)));

            GumpList l = new GumpList(this, "details", skin);

            l.columns         = 5;
            l.ShowDividers    = false;
            l.ShowBackground  = false;
            l.columnWidths[0] = 15;
            l.columnWidths[1] = 200;
            l.numperpage      = 14;

            l.X = 20;
            l.Y = 51;

            ButtonInfo    ecg       = skin.ButtonInfo["ExpandContractGroup"];
            GumpListEntry miscentry = new GumpListEntry(0, 0, l, info.W - 10, 20);

            miscentry.AddColumn(new GumpButton(0, 0, !showing.Contains(1) ? ecg.up : ecg.down, !showing.Contains(1) ? ecg.up : ecg.down, 1, GumpButtonType.Reply, 0));
            miscentry.AddColumn("<basefont size=5 face = 1 color= #330066> Miscellaneous</basefont>");

            GumpListEntry combentry = new GumpListEntry(0, 0, l, info.W - 10, 20);

            combentry.AddColumn(new GumpButton(0, 0, !showing.Contains(2) ? ecg.up : ecg.down, !showing.Contains(2) ? ecg.up : ecg.down, 2, GumpButtonType.Reply, 0));
            combentry.AddColumn("<basefont size=5 face = 1 color= #330066> Combat Ratings</basefont>");

            GumpListEntry actientry = new GumpListEntry(0, 0, l, info.W - 10, 20);

            actientry.AddColumn(new GumpButton(0, 0, !showing.Contains(3) ? ecg.up : ecg.down, !showing.Contains(3) ? ecg.up : ecg.down, 3, GumpButtonType.Reply, 0));
            actientry.AddColumn("<basefont size=5 face = 1 color= #330066> Actions</basefont>");

            GumpListEntry loreentry = new GumpListEntry(0, 0, l, info.W - 10, 20);

            loreentry.AddColumn(new GumpButton(0, 0, !showing.Contains(4) ? ecg.up : ecg.down, !showing.Contains(4) ? ecg.up : ecg.down, 4, GumpButtonType.Reply, 0));
            loreentry.AddColumn("<basefont size=5 face = 1 color= #330066> Lore & Knowledge</basefont>");

            GumpListEntry customentry = new GumpListEntry(0, 0, l, info.W - 10, 20);

            customentry.AddColumn(new GumpButton(0, 0, !showing.Contains(5) ? ecg.up : ecg.down, !showing.Contains(5) ? ecg.up : ecg.down, 5, GumpButtonType.Reply, 0));
            customentry.AddColumn("<basefont size=5 face = 1 color= #330066> Custom Skills</basefont>");

            ButtonInfo  select = skin.ButtonInfo["UseButton"];
            IEnumerator ie     = null;
            int         i      = 1;

            for (int k = 0; k < s.Length; k++)
            {
                if (ParallelSkills.actisearch.Contains(s[k].Name))
                {
                    actiinfos.Add(s[k]);
                }
                else if (ParallelSkills.combsearch.Contains(s[k].Name))
                {
                    combinfos.Add(s[k]);
                }
                else if (ParallelSkills.miscsearch.Contains(s[k].Name))
                {
                    miscinfos.Add(s[k]);
                }
                else if (ParallelSkills.loresearch.Contains(s[k].Name))
                {
                    loreinfos.Add(s[k]);
                }
                else
                {
                    custom.Add(s[k]);
                }
            }
            actiinfos.Sort(CompareSkillNames);
            combinfos.Sort(CompareSkillNames);
            miscinfos.Sort(CompareSkillNames);
            loreinfos.Sort(CompareSkillNames);
            custom.Sort(CompareSkillNames);

            l.Add(miscentry);
            if (showing.Contains(1))
            {
                ie = miscinfos.GetEnumerator();
                while (ie.MoveNext())
                {
                    SkillSettings.DoTell2("Misc i: " + i + " Skill: " + ((Skill)ie.Current).ToString());
                    addEntry(l, (Skill)ie.Current, i, 1);
                    i++;
                }
            }
            else
            {
                i += miscinfos.Count;
            }

            l.Add(combentry);
            if (showing.Contains(2))
            {
                //i = 1;
                ie = combinfos.GetEnumerator();
                while (ie.MoveNext())
                {
                    SkillSettings.DoTell2("Co i: " + i + " Skill: " + ((Skill)ie.Current).ToString());
                    addEntry(l, (Skill)ie.Current, i, 2);
                    i++;
                }
            }
            else
            {
                i += combinfos.Count;
            }

            l.Add(actientry);
            if (showing.Contains(3))
            {
                //i = 1;
                ie = actiinfos.GetEnumerator();
                while (ie.MoveNext())
                {
                    SkillSettings.DoTell2("A i: " + i + " Skill: " + ((Skill)ie.Current).ToString());
                    addEntry(l, (Skill)ie.Current, i, 3);
                    i++;
                }
            }
            else
            {
                i += actiinfos.Count;
            }

            l.Add(loreentry);
            if (showing.Contains(4))
            {
                //i = 1;
                ie = loreinfos.GetEnumerator();
                while (ie.MoveNext())
                {
                    SkillSettings.DoTell2("L i: " + i + " Skill: " + ((Skill)ie.Current).ToString());
                    addEntry(l, (Skill)ie.Current, i, 4);
                    i++;
                }
            }
            else
            {
                i += loreinfos.Count;
            }

            l.Add(customentry);
            if (showing.Contains(5))
            {
                //i = 1;
                ie = custom.GetEnumerator();
                while (ie.MoveNext())
                {
                    SkillSettings.DoTell2("Cu i: " + i + " Skill: " + ((Skill)ie.Current).ToString());
                    addEntry(l, (Skill)ie.Current, i, 5);
                    i++;
                }
            }

            l.CommitList();
        }