Ejemplo n.º 1
0
        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);
            }
        }
Ejemplo n.º 2
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));
            }
        }
Ejemplo n.º 3
0
        public override void OnResponse(NetState sender, RelayInfo info)
        {
            Mobile from = sender.Mobile;

            //has 0, 101, and profile cases.
            //0: cancel, right-click.
            //101: Finish.
            //profile: gives 1-base index of profile to load in master profile.
            SkillSettings.DoTell("Button ID: " + info.ButtonID);

            if (info.ButtonID == 0 && sender.Mobile.AccessLevel >= SkillSettings.GumpControlLevel)
            {
                this.Session.Close(); return;
            }
            else if (sender.Mobile.AccessLevel <= SkillSettings.GumpControlLevel && info.ButtonID == 0)
            {
                Page.Clone(); return;
            }

            if (info.ButtonID == 101)
            {
                if (Session.VerifyFinal())
                {
                    ClearGumps(sender); sender.Mobile.SendGump(new TMAlertGump("Congratulations, you are now ready to play the shard."));
                }
                else
                {
                    sender.Mobile.SendGump(Page.Clone()); sender.Mobile.SendGump(new TMAlertGump(Session.CurrentErrorMessage));
                }
                return;
            }

            int has = hasControlGump(sender);

            if (has != -1)
            {
                if (has == 1)
                {
                    sender.Mobile.CloseGump(typeof(TMSkill));
                }
                else if (has == 2)
                {
                    sender.Mobile.CloseGump(typeof(TMStat));
                }
            }

            if (info.ButtonID == 1 && Session.Profile.StatEnable)
            {
                TMQueryPage p = new TMQueryPage("TMSS Stat Gump", Session);
                Page.Clone();
            }
            else
            {
                /*if (hasControlGump(sender))
                 * {
                 *      sender.Mobile.SendGump(Page.Clone());
                 *      sender.Mobile.SendGump(new TMAlertGump("You cannot open more than one selection page at a time."));
                 *      return;
                 * }*/
                int pro = info.ButtonID - 1;
                Dictionary <string, object> arg = new Dictionary <string, object>();
                arg.Add("Profile", prof.getProfile(pro));
                arg.Add("Session", Session);
                arg.Add("Skin", Session.Skin);
                arg.Add("Mobile", sender.Mobile);
                SkillSettings.DoTell("Master Gump skill gump send: Profile:" + prof.getProfile(pro) + " Session: " + Session + " Skin: " + Session.Skin + " Mobile: " + sender.Mobile);
                SkillSettings.DoTell("MG Session: TSP: " + Session.totalSelectedPoints + " TAP: " + Session.totalAllowedPoints);
                TMQueryPage p = new TMQueryPage("TMSS Skill Gump", arg);
                Page.Clone();
            }
        }