Example #1
0
        public override void OnResponse(Network.NetState sender, RelayInfo info)
        {
            Mobile from = sender.Mobile;

            if (from.AccessLevel < AccessLevel.Administrator)
            {
                return;
            }

            TextRelay d = info.GetTextEntry(0);
            TextRelay h = info.GetTextEntry(1);
            TextRelay m = info.GetTextEntry(2);
            TextRelay s = info.GetTextEntry(3);

            TextRelay c = info.GetTextEntry(10);

            TimeSpan duration;
            bool     shouldSet;

            switch (info.ButtonID)
            {
            case 0:
            {
                for (int i = 0; i < m_List.Count; ++i)
                {
                    Account a = (Account)m_List[i];

                    a.SetUnspecifiedBan(from);
                }

                from.SendMessage("Duration unspecified.");
                return;
            }

            case 1:     // infinite
            {
                duration  = TimeSpan.MaxValue;
                shouldSet = true;
                break;
            }

            case 2:     // From D:H:M:S
            {
                if (d != null && h != null && m != null && s != null)
                {
                    try
                    {
                        duration  = new TimeSpan(Utility.ToInt32(d.Text), Utility.ToInt32(h.Text), Utility.ToInt32(m.Text), Utility.ToInt32(s.Text));
                        shouldSet = true;

                        break;
                    }
                    catch (Exception e)
                    {
                        Diagnostics.ExceptionLogging.LogException(e);
                    }
                }

                duration  = TimeSpan.Zero;
                shouldSet = false;

                break;
            }

            case 3:     // From D
            {
                if (d != null)
                {
                    try
                    {
                        duration  = TimeSpan.FromDays(Utility.ToDouble(d.Text));
                        shouldSet = true;

                        break;
                    }
                    catch (Exception e)
                    {
                        Diagnostics.ExceptionLogging.LogException(e);
                    }
                }

                duration  = TimeSpan.Zero;
                shouldSet = false;

                break;
            }

            case 4:     // From H
            {
                if (h != null)
                {
                    try
                    {
                        duration  = TimeSpan.FromHours(Utility.ToDouble(h.Text));
                        shouldSet = true;

                        break;
                    }
                    catch (Exception e)
                    {
                        Diagnostics.ExceptionLogging.LogException(e);
                    }
                }

                duration  = TimeSpan.Zero;
                shouldSet = false;

                break;
            }

            case 5:     // From M
            {
                if (m != null)
                {
                    try
                    {
                        duration  = TimeSpan.FromMinutes(Utility.ToDouble(m.Text));
                        shouldSet = true;

                        break;
                    }
                    catch (Exception e)
                    {
                        Diagnostics.ExceptionLogging.LogException(e);
                    }
                }

                duration  = TimeSpan.Zero;
                shouldSet = false;

                break;
            }

            case 6:     // From S
            {
                if (s != null)
                {
                    try
                    {
                        duration  = TimeSpan.FromSeconds(Utility.ToDouble(s.Text));
                        shouldSet = true;

                        break;
                    }
                    catch (Exception e)
                    {
                        Diagnostics.ExceptionLogging.LogException(e);
                    }
                }

                duration  = TimeSpan.Zero;
                shouldSet = false;

                break;
            }

            default:
                return;
            }

            if (shouldSet)
            {
                string comment = null;

                if (c != null)
                {
                    comment = c.Text.Trim();

                    if (comment.Length == 0)
                    {
                        comment = null;
                    }
                }

                for (int i = 0; i < m_List.Count; ++i)
                {
                    Account a = (Account)m_List[i];

                    a.SetBanTags(from, DateTime.UtcNow, duration);

                    if (comment != null)
                    {
                        a.Comments.Add(new AccountComment(from.RawName, string.Format("Duration: {0}, Comment: {1}", ((duration == TimeSpan.MaxValue) ? "Infinite" : duration.ToString()), comment)));
                    }
                }

                if (duration == TimeSpan.MaxValue)
                {
                    from.SendMessage("Ban Duration: Infinite");
                }
                else
                {
                    from.SendMessage("Ban Duration: {0}", duration);
                }
            }
            else
            {
                from.SendMessage("Time values were improperly formatted.");
                from.SendGump(new BanDurationGump(m_List));
            }
        }
Example #2
0
        public override void OnResponse(NetState sender, RelayInfo info)
        {
            if (m_Box.Deleted)
            {
                return;
            }

            if (info.ButtonID == 1)
            {
                m_From.SendGump(new TokenBoxGump(m_From, m_Box));
                m_Box.BeginCombine(m_From);
            }

            if (info.ButtonID == 2)
            {
                TextRelay tr_TokenAmount = info.GetTextEntry(1);
                if (tr_TokenAmount != null)
                {
                    int i_MaxAmount = 0;
                    try
                    {
                        i_MaxAmount = Convert.ToInt32(tr_TokenAmount.Text, 10);
                    }
                    catch
                    {
                        m_From.SendMessage(1161, "Please make sure you write only numbers.");
                    }
                    if (i_MaxAmount > 0)
                    {
                        if (i_MaxAmount <= ((TokenBox)m_Box).Token)
                        {
                            if (i_MaxAmount <= 60000)
                            {
                                m_From.AddToBackpack(new Tokens(i_MaxAmount));
                                m_From.SendMessage(1161, "You extracted {0} tokens from your box.", i_MaxAmount);
                                ((TokenBox)m_Box).Token = (((TokenBox)m_Box).Token - i_MaxAmount);
                            }
                            else
                            {
                                m_From.SendMessage(1161, "You can't extract more then 60,000 tokens at one time.");
                            }
                        }
                        else
                        {
                            m_From.SendMessage(1173, "You don't have that many tokens in your box.");
                        }
                    }
                    m_From.SendGump(new TokenBoxGump(m_From, m_Box));
                }
            }

            if (info.ButtonID == 3)
            {
                TextRelay tr_TokenAmount = info.GetTextEntry(1);
                if (tr_TokenAmount != null)
                {
                    int i_MaxAmount = 0;
                    try
                    {
                        i_MaxAmount = Convert.ToInt32(tr_TokenAmount.Text, 10);
                    }
                    catch
                    {
                        m_From.SendMessage(1161, "Please make sure you write only numbers.");
                    }
                    if (i_MaxAmount > 0)
                    {
                        if (i_MaxAmount <= ((TokenBox)m_Box).Token)
                        {
                            if (i_MaxAmount <= 1000000)
                            {
                                m_From.AddToBackpack(new TokenCheck(i_MaxAmount));
                                m_From.SendMessage(1161, "A check for {0} tokens has been placed in your pack.", i_MaxAmount);
                                ((TokenBox)m_Box).Token = (((TokenBox)m_Box).Token - i_MaxAmount);
                            }
                            else
                            {
                                m_From.SendMessage(1161, "You can't write a check for more then 1,000,000 tokens at one time.");
                            }
                        }
                        else
                        {
                            m_From.SendMessage(1173, "You don't have that many tokens in your box.");
                        }
                    }
                    m_From.SendGump(new TokenBoxGump(m_From, m_Box));
                }
            }
        }
Example #3
0
        public override void OnResponse(GameClient sender, RelayInfo info)
        {
            TimeSpan toSet;
            bool     shouldSet, shouldSend;

            TextRelay h = info.GetTextEntry(0);
            TextRelay m = info.GetTextEntry(1);
            TextRelay s = info.GetTextEntry(2);

            switch (info.ButtonID)
            {
            case 1:                     // Zero
            {
                toSet      = TimeSpan.Zero;
                shouldSet  = true;
                shouldSend = true;

                break;
            }

            case 2:                     // From H:M:S
            {
                if (h != null && m != null && s != null)
                {
                    try
                    {
                        toSet      = TimeSpan.Parse(h.Text + ":" + m.Text + ":" + s.Text);
                        shouldSet  = true;
                        shouldSend = true;

                        break;
                    }
                    catch
                    {
                    }
                }

                toSet      = TimeSpan.Zero;
                shouldSet  = false;
                shouldSend = false;

                break;
            }

            case 3:                     // From H
            {
                if (h != null)
                {
                    try
                    {
                        toSet      = TimeSpan.FromHours(Utility.ToDouble(h.Text));
                        shouldSet  = true;
                        shouldSend = true;

                        break;
                    }
                    catch
                    {
                    }
                }

                toSet      = TimeSpan.Zero;
                shouldSet  = false;
                shouldSend = false;

                break;
            }

            case 4:                     // From M
            {
                if (m != null)
                {
                    try
                    {
                        toSet      = TimeSpan.FromMinutes(Utility.ToDouble(m.Text));
                        shouldSet  = true;
                        shouldSend = true;

                        break;
                    }
                    catch
                    {
                    }
                }

                toSet      = TimeSpan.Zero;
                shouldSet  = false;
                shouldSend = false;

                break;
            }

            case 5:                     // From S
            {
                if (s != null)
                {
                    try
                    {
                        toSet      = TimeSpan.FromSeconds(Utility.ToDouble(s.Text));
                        shouldSet  = true;
                        shouldSend = true;

                        break;
                    }
                    catch
                    {
                    }
                }

                toSet      = TimeSpan.Zero;
                shouldSet  = false;
                shouldSend = false;

                break;
            }

            default:
            {
                toSet      = TimeSpan.Zero;
                shouldSet  = false;
                shouldSend = true;

                break;
            }
            }

            if (shouldSet)
            {
                try
                {
                    Server.Scripts.Commands.CommandLogging.LogChangeProperty(m_Mobile, m_Object, m_Property.Name, toSet.ToString());
                    m_Property.SetValue(m_Object, toSet, null);
                    PropertiesGump.OnValueChanged(m_Object, m_Property, m_Stack);
                }
                catch
                {
                    m_Mobile.SendMessage("An exception was caught. The property may not have changed.");
                }
            }

            if (shouldSend)
            {
                if (m_List.Count != 0)
                {
                    m_Mobile.SendGump(new PropertiesGump(m_Mobile, m_Object, m_Stack, m_List, m_Page));
                }
                else
                {
                    var stackEntry = (PropertiesGump.IStackEntry)m_Stack.Pop();
                    stackEntry.SendGump(m_Mobile, m_Stack);
                }
            }
        }
Example #4
0
        public override void OnResponse(NetState state, RelayInfo info)
        {
            if (state == null || info == null || state.Mobile == null || m_gauntlet == null || m_gauntlet.Challenger == null)
            {
                return;
            }

            XmlPoints afrom = (XmlPoints)XmlAttach.FindAttachment(state.Mobile, typeof(XmlPoints));

            switch (info.ButtonID)
            {
            case 1:
                // refresh

                //m_gauntlet.CheckForDisqualification();

                state.Mobile.SendGump(new CTFGump(m_gauntlet, state.Mobile, viewpage));
                break;

            case 10:
                // Entry fee
                int       val = 0;
                TextRelay tr  = info.GetTextEntry(10);
                if (tr != null)
                {
                    try { val = int.Parse(tr.Text); }
                    catch { }
                }
                m_gauntlet.EntryFee = val;

                m_gauntlet.ResetAcceptance();

                // update all the gumps
                RefreshAllGumps(m_gauntlet, true);

                state.Mobile.SendGump(new CTFGump(m_gauntlet, state.Mobile, viewpage));
                break;

            case 11:
                // update teams
                if (m_WorkingList != null)
                {
                    for (int i = 0; i < m_WorkingList.Count; i++)
                    {
                        // is this on the visible page?
                        if ((int)(i / PlayersPerPage) != viewpage)
                        {
                            continue;
                        }

                        CTFGauntlet.ChallengeEntry entry = (CTFGauntlet.ChallengeEntry)m_WorkingList[i];
                        if (entry != null)
                        {
                            int tval = 0;
                            tr = info.GetTextEntry(500 + i);
                            if (tr != null)
                            {
                                try { tval = int.Parse(tr.Text); }
                                catch { }
                            }
                            entry.Team = tval;
                        }
                    }
                }

                m_gauntlet.ResetAcceptance();
                // update all the gumps
                RefreshAllGumps(m_gauntlet, true);

                state.Mobile.SendGump(new CTFGump(m_gauntlet, state.Mobile, viewpage));
                break;

            case 12:
                // page up
                // try doing the default for non-participants
                int nplayers = 0;
                if (m_gauntlet.Participants != null)
                {
                    nplayers = m_gauntlet.Participants.Count;
                }

                int page = viewpage + 1;
                if (page > (int)(nplayers / PlayersPerPage))
                {
                    page = (int)(nplayers / PlayersPerPage);
                }

                if (m_WorkingList != null)
                {
                    for (int i = 0; i < m_WorkingList.Count; i++)
                    {
                        CTFGauntlet.ChallengeEntry entry = (CTFGauntlet.ChallengeEntry)m_WorkingList[i];
                        if (entry != null)
                        {
                            if (entry.Participant == state.Mobile)
                            {
                                entry.PageBeingViewed++;

                                if (entry.PageBeingViewed > (int)(nplayers / PlayersPerPage))
                                {
                                    entry.PageBeingViewed = (int)(nplayers / PlayersPerPage);
                                }

                                page = entry.PageBeingViewed;
                                //break;
                            }
                        }
                    }
                }

                state.Mobile.SendGump(new CTFGump(m_gauntlet, state.Mobile, page));
                break;

            case 13:
                // page down
                // try doing the default for non-participants
                page = viewpage - 1;
                if (page < 0)
                {
                    page = 0;
                }
                if (m_WorkingList != null)
                {
                    for (int i = 0; i < m_WorkingList.Count; i++)
                    {
                        CTFGauntlet.ChallengeEntry entry = (CTFGauntlet.ChallengeEntry)m_WorkingList[i];
                        if (entry != null)
                        {
                            if (entry.Participant == state.Mobile)
                            {
                                entry.PageBeingViewed--;

                                if (entry.PageBeingViewed < 0)
                                {
                                    entry.PageBeingViewed = 0;
                                }

                                page = entry.PageBeingViewed;
                                //break;
                            }
                        }
                    }
                }

                state.Mobile.SendGump(new CTFGump(m_gauntlet, state.Mobile, page));
                break;

            case 20:
                // arena size
                val = 0;
                tr  = info.GetTextEntry(20);
                if (tr != null)
                {
                    try { val = int.Parse(tr.Text); }
                    catch { }
                }
                m_gauntlet.ArenaSize = val;

                m_gauntlet.ResetAcceptance();

                // update all the gumps
                RefreshAllGumps(m_gauntlet, true);

                state.Mobile.SendGump(new CTFGump(m_gauntlet, state.Mobile, viewpage));
                break;

            case 30:
                // target score
                val = 0;
                tr  = info.GetTextEntry(30);
                if (tr != null)
                {
                    try { val = int.Parse(tr.Text); }
                    catch { }
                }
                m_gauntlet.TargetScore = val;

                m_gauntlet.ResetAcceptance();

                // update all the gumps
                RefreshAllGumps(m_gauntlet, true);

                state.Mobile.SendGump(new CTFGump(m_gauntlet, state.Mobile, viewpage));
                break;

            case 40:
                // match length
                double dval = 0;
                tr = info.GetTextEntry(40);
                if (tr != null)
                {
                    try { dval = double.Parse(tr.Text); }
                    catch { }
                }
                m_gauntlet.MatchLength = TimeSpan.FromMinutes(dval);

                m_gauntlet.ResetAcceptance();

                // update all the gumps
                RefreshAllGumps(m_gauntlet, true);

                state.Mobile.SendGump(new CTFGump(m_gauntlet, state.Mobile, viewpage));
                break;

            case 100:

                // add to Participants
                if (m_gauntlet.Participants == null)
                {
                    m_gauntlet.Participants = new ArrayList();
                }

                if (MaxTeamSize > 0 && m_gauntlet.Participants.Count >= MaxTeamSize)
                {
                    XmlPoints.SendText(state.Mobile, 100535);                                 // "Challenge is full!"
                }
                else
                {
                    state.Mobile.Target = new MemberTarget(m_gauntlet, m_gauntlet.Participants);
                }


                state.Mobile.SendGump(new CTFGump(m_gauntlet, state.Mobile, viewpage));
                break;

            case 300:
                // Start game
                if (m_WorkingList == null)
                {
                    return;
                }

                bool complete = true;
                foreach (CTFGauntlet.ChallengeEntry entry in m_WorkingList)
                {
                    if (entry != null)
                    {
                        Mobile m = entry.Participant;

                        if (m == null)
                        {
                            continue;
                        }

                        if (!m_gauntlet.CheckQualify(m))
                        {
                            complete = false;
                            break;
                        }

                        if (!entry.Accepted)
                        {
                            XmlPoints.SendText(m_gauntlet.Challenger, 100539, m.Name);                                      // "{0} has not accepted yet."
                            complete = false;
                            break;
                        }

                        // and they have a team
                        if (entry.Team <= 0)
                        {
                            XmlPoints.SendText(m_gauntlet.Challenger, 100594, m.Name);                                     // "{0} has not been assigned a team."
                            complete = false;
                        }
                    }
                }

                if (m_WorkingList.Count < 2)
                {
                    XmlPoints.SendText(m_gauntlet.Challenger, 100540);                              // "Insufficient number of players."
                    complete = false;
                }

                // make sure all the bases have been defined
                ArrayList Teams = m_gauntlet.GetTeams();

                // make sure that all bases have teams defined
                if (Teams != null)
                {
                    foreach (TeamInfo t in Teams)
                    {
                        bool hasteam = false;
                        foreach (CTFBase b in m_gauntlet.HomeBases)
                        {
                            if (t.ID == b.Team)
                            {
                                hasteam = true;
                                break;
                            }
                        }

                        if (!hasteam)
                        {
                            XmlPoints.SendText(m_gauntlet.Challenger, 100621, t.ID);                                     // "Team {0} base not defined."
                            complete = false;
                        }
                    }
                }
                else
                {
                    complete = false;
                }

                if (complete)
                {
                    m_gauntlet.Participants = new ArrayList();

                    foreach (CTFGauntlet.ChallengeEntry entry in m_WorkingList)
                    {
                        if (entry != null)
                        {
                            Mobile m = entry.Participant;

                            if (m == null)
                            {
                                continue;
                            }

                            // try to collect any entry fee
                            if (!m_gauntlet.CollectEntryFee(m, m_gauntlet.EntryFee))
                            {
                                continue;
                            }

                            // set up the challenge on each player
                            XmlPoints a = (XmlPoints)XmlAttach.FindAttachment(m, typeof(XmlPoints));
                            if (a != null)
                            {
                                a.ChallengeGame = m_gauntlet;
                            }

                            entry.Status = ChallengeStatus.Active;

                            m_gauntlet.Participants.Add(entry);
                        }
                    }

                    // and lock the game
                    m_gauntlet.StartGame();

                    // refresh all gumps
                    RefreshAllGumps(m_gauntlet, true);
                }
                else
                {
                    state.Mobile.SendGump(new CTFGump(m_gauntlet, state.Mobile, viewpage));
                }

                break;

            default:
            {
                // forfeit buttons
                if (info.ButtonID >= 4000)
                {
                    int selection = info.ButtonID - 4000;

                    if (selection < m_WorkingList.Count)
                    {
                        CTFGauntlet.ChallengeEntry entry = (CTFGauntlet.ChallengeEntry)m_WorkingList[selection];

                        // find the master participants list entry with the same participant
                        if (m_gauntlet.Participants != null)
                        {
                            CTFGauntlet.ChallengeEntry forfeitentry = null;

                            foreach (CTFGauntlet.ChallengeEntry masterentry in m_gauntlet.Participants)
                            {
                                if (entry == masterentry)
                                {
                                    forfeitentry = masterentry;
                                    break;
                                }
                            }

                            // and remove it
                            if (forfeitentry != null)
                            {
                                forfeitentry.Status = ChallengeStatus.Forfeit;

                                // inform him that he has been kicked
                                m_gauntlet.Forfeit(forfeitentry.Participant);
                            }
                        }
                    }
                }
                // kick buttons
                if (info.ButtonID >= 2000)
                {
                    int selection = info.ButtonID - 2000;

                    if (selection < m_WorkingList.Count)
                    {
                        CTFGauntlet.ChallengeEntry entry = (CTFGauntlet.ChallengeEntry)m_WorkingList[selection];
                        // find the master participants list entry with the same participant
                        if (m_gauntlet.Participants != null)
                        {
                            CTFGauntlet.ChallengeEntry kickentry = null;

                            foreach (CTFGauntlet.ChallengeEntry masterentry in m_gauntlet.Participants)
                            {
                                if (entry == masterentry)
                                {
                                    kickentry = masterentry;
                                    break;
                                }
                            }

                            // and remove it
                            if (kickentry != null)
                            {
                                m_gauntlet.Participants.Remove(kickentry);

                                // refresh his gump and inform him that he has been kicked
                                if (kickentry.Participant != null)
                                {
                                    XmlPoints.SendText(kickentry.Participant, 100545, m_gauntlet.ChallengeName);                                                     // "You have been kicked from {0}"
                                    kickentry.Participant.SendGump(new CTFGump(m_gauntlet, kickentry.Participant, viewpage));
                                }
                            }
                        }

                        m_gauntlet.ResetAcceptance();
                    }

                    // refresh all gumps
                    RefreshAllGumps(m_gauntlet, true);
                    //state.Mobile.SendGump( new CTFGump( m_gauntlet, state.Mobile));
                }
                else
                // accept buttons
                if (info.ButtonID >= 1000)
                {
                    int selection = info.ButtonID - 1000;
                    // set the acceptance flag of the participant
                    if (selection < m_WorkingList.Count)
                    {
                        CTFGauntlet.ChallengeEntry entry = (CTFGauntlet.ChallengeEntry)m_WorkingList[selection];

                        entry.Accepted = !entry.Accepted;
                    }

                    // refresh all gumps
                    RefreshAllGumps(m_gauntlet, true);

                    //state.Mobile.SendGump( new CTFGump( m_gauntlet, state.Mobile));
                }


                break;
            }
            }
        }
		public static void DisplayGumpResponse( NetState state, PacketReader pvSrc ) {
			int serial = pvSrc.ReadInt32();
			int typeID = pvSrc.ReadInt32();
			int buttonID = pvSrc.ReadInt32();

			foreach ( Gump gump in state.Gumps ) {
				if ( gump.Serial == serial && gump.TypeID == typeID ) {
					int switchCount = pvSrc.ReadInt32();

					if ( switchCount < 0 || switchCount > gump.m_Switches ) {
						state.WriteConsole( "Invalid gump response, disconnecting..." );
						state.Dispose();
						return;
					}

					int[] switches = new int[switchCount];

					for ( int j = 0; j < switches.Length; ++j )
						switches[j] = pvSrc.ReadInt32();

					int textCount = pvSrc.ReadInt32();

					if ( textCount < 0 || textCount > gump.m_TextEntries ) {
						state.WriteConsole( "Invalid gump response, disconnecting..." );
						state.Dispose();
						return;
					}

					TextRelay[] textEntries = new TextRelay[textCount];

					for ( int j = 0; j < textEntries.Length; ++j ) {
						int entryID = pvSrc.ReadUInt16();
						int textLength = pvSrc.ReadUInt16();

						if ( textLength > 239 ) {
							state.WriteConsole( "Invalid gump response, disconnecting..." );
							state.Dispose();
							return;
						}

						string text = pvSrc.ReadUnicodeStringSafe( textLength );
						textEntries[j] = new TextRelay( entryID, text );
					}

					state.RemoveGump( gump );

					GumpProfile prof = GumpProfile.Acquire( gump.GetType() );

					if ( prof != null ) {
						prof.Start();
					}

					gump.OnResponse( state, new RelayInfo( buttonID, switches, textEntries ) );

					if ( prof != null ) {
						prof.Finish();
					}

					return;
				}
			}

			if ( typeID == 461 ) { // Virtue gump
				int switchCount = pvSrc.ReadInt32();

				if ( buttonID == 1 && switchCount > 0 ) {
					Mobile beheld = World.FindMobile( pvSrc.ReadInt32() );

					if ( beheld != null ) {
						EventSink.InvokeVirtueGumpRequest( new VirtueGumpRequestEventArgs( state.Mobile, beheld ) );
					}
				} else {
					Mobile beheld = World.FindMobile( serial );

					if ( beheld != null ) {
						EventSink.InvokeVirtueItemRequest( new VirtueItemRequestEventArgs( state.Mobile, beheld, buttonID ) );
					}
				}
			}
		}
        public override void OnResponse(NetState sender, RelayInfo info)
        {
            Mobile from = sender.Mobile;

            switch (info.ButtonID)
            {
            case 1:
            {
                if (m_Crier.Custom)
                {
                    m_Crier.Custom = false;
                }
                else
                {
                    m_Crier.Custom = true;
                }

                from.SendGump(new TownCrierbGump(null, m_Crier));
                break;
            }

            case 2:
            {
                if (m_Crier.Active)
                {
                    m_Crier.Active = false;
                }
                else
                {
                    m_Crier.Active = true;
                }

                from.SendGump(new TownCrierbGump(null, m_Crier));
                break;
            }

            case 3:
            {
                if (m_Crier.Random)
                {
                    m_Crier.Random = false;
                }
                else
                {
                    m_Crier.Random = true;
                }

                from.SendGump(new TownCrierbGump(null, m_Crier));
                break;
            }

            case 4:
            {
                TextRelay text = info.GetTextEntry(0);

                if (text != null)
                {
                    try
                    {
                        string[] temp = text.Text.Split(':');
                        TimeSpan time = new TimeSpan(Convert.ToInt32(temp[0]), Convert.ToInt32(temp[1]), Convert.ToInt32(temp[2]));
                        m_Crier.Delay = time;

                        if (m_Crier.Active)
                        {
                            m_Crier.Active = false;
                            m_Crier.Active = true;
                        }
                    }
                    catch
                    {
                        from.SendMessage(0x35, "Bad format. ##:##:## expected");
                    }
                }

                from.SendGump(new TownCrierbGump(null, m_Crier));
                break;
            }

            case 5:
            {
                from.SendGump(new EditNewsGump(m_Crier, null));
                break;
            }

            case 6:
            {
                from.SendMessage(0x35, "Target the TownCrier Control Stone.");
                from.Target = new SetStoneTarget(m_Crier);
                break;
            }

            case 7:
            {
                if (m_Stone.Active)
                {
                    m_Stone.Active = false;
                }
                else
                {
                    m_Stone.Active = true;
                }

                from.SendGump(new TownCrierbGump(m_Stone, null));
                break;
            }

            case 8:
            {
                if (m_Stone.Random)
                {
                    m_Stone.Random = false;
                }
                else
                {
                    m_Stone.Random = true;
                }

                from.SendGump(new TownCrierbGump(m_Stone, null));
                break;
            }

            case 9:
            {
                TextRelay text = info.GetTextEntry(0);

                if (text != null)
                {
                    try
                    {
                        string[] temp = text.Text.Split(':');
                        TimeSpan time = new TimeSpan(Convert.ToInt32(temp[0]), Convert.ToInt32(temp[1]), Convert.ToInt32(temp[2]));
                        m_Stone.Delay = time;

                        if (m_Stone.Active)
                        {
                            m_Stone.Active = false;
                            m_Stone.Active = true;
                        }
                    }
                    catch
                    {
                        from.SendMessage(0x35, "Bad format. ##:##:## expected");
                    }
                }

                from.SendGump(new TownCrierbGump(m_Stone, null));
                break;
            }

            case 10:
            {
                from.SendGump(new EditNewsGump(null, m_Stone));
                break;
            }

            case 11:
            {
                ControlGem gem = new ControlGem();
                gem.Stone = m_Stone;
                from.AddToBackpack(gem);
                from.SendGump(new TownCrierbGump(m_Stone, null));
                break;
            }

            case 12:
            {
                from.Target = new MakeCrierTarget(m_Stone, false);
                break;
            }

            case 13:
            {
                from.Target = new MakeCrierTarget(m_Stone, true);
                break;
            }
            }
        }
Example #7
0
        public override void OnResponse(NetState state, RelayInfo info)
        {
            if (m_State == null)
            {
                return;
            }

            Mobile focus = m_State.Mobile;
            Mobile from  = state.Mobile;

            if (focus == null)
            {
                from.SendMessage("That character is no longer online.");
                return;
            }
            else if (focus.Deleted)
            {
                from.SendMessage("That character no longer exists.");
                return;
            }
            else if (from != focus && focus.Hidden && from.AccessLevel < focus.AccessLevel)
            {
                from.SendMessage("That character is no longer visible.");
                return;
            }

            switch (info.ButtonID)
            {
            case 1:                     // Tell
            {
                TextRelay text = info.GetTextEntry(0);

                if (text != null)
                {
                    focus.SendMessage(0x482, "{0} tells you:", from.Name);
                    focus.SendMessage(0x482, text.Text);
                }

                from.SendGump(new ClientGump(from, m_State));

                break;
            }

            case 4:                     // Props
            {
                Resend(from, info);
                from.SendGump(new PropertiesGump(from, focus));

                break;
            }

            case 5:                     // Go to
            {
                if (focus.Map == null || focus.Map == Map.Internal)
                {
                    from.SendMessage("That character is not in the world.");
                }
                else
                {
                    from.MoveToWorld(focus.Location, focus.Map);
                    Resend(from, info);
                }

                break;
            }

            case 6:                     // Get
            {
                if (from.Map == null || from.Map == Map.Internal)
                {
                    from.SendMessage("You cannot bring that person here.");
                }
                else
                {
                    focus.MoveToWorld(from.Location, from.Map);
                    Resend(from, info);
                }

                break;
            }

            case 7:                     // Move
            {
                from.Target = new MoveTarget(focus);
                Resend(from, info);

                break;
            }

            case 8:                     // Kick
            {
                if (from.AccessLevel >= AccessLevel.GameMaster && from.AccessLevel > focus.AccessLevel)
                {
                    focus.Say("I've been kicked!");

                    m_State.Dispose();
                }

                break;
            }

            case 9:                     // Kill
            {
                if (from.AccessLevel >= AccessLevel.GameMaster && from.AccessLevel > focus.AccessLevel)
                {
                    focus.Kill();
                }

                Resend(from, info);

                break;
            }

            case 10:                     //Res
            {
                if (from.AccessLevel >= AccessLevel.GameMaster && from.AccessLevel > focus.AccessLevel)
                {
                    focus.PlaySound(0x214);
                    focus.FixedEffect(0x376A, 10, 16);

                    focus.Resurrect();
                }

                Resend(from, info);

                break;
            }

            case 11:                     // Skills
            {
                Resend(from, info);

                if (from.AccessLevel > focus.AccessLevel)
                {
                    from.SendGump(new SkillsGump(from, (Mobile)focus));
                }

                break;
            }
            }
        }
		/// <summary>
		///     Takes the gump relay entries and converts them from an Array into a List.
		/// </summary>
		public static List<TextRelay> CreateList(TextRelay[] entries)
		{
			return entries.ToList();
		}
Example #9
0
        private string GetString(RelayInfo info, int id)
        {
            TextRelay t = info.GetTextEntry(id);

            return(t == null ? null : t.Text.Trim());
        }
Example #10
0
        public override void OnResponse(NetState sender, RelayInfo info)
        {
            Mobile from = sender.Mobile;

            int m_Offer;

            switch (info.ButtonID)
            {
            case 0:
            {
                // You have decided to tithe no gold to the shrine.
                from.LocalOverheadMessage(MessageType.Regular, 0x3B2, 1060193);
                break;
            }

            case 1:
            {
                if (from.TithingPoints >= MaxTithing)
                {
                    from.SendLocalizedMessage(1060840);         // You have reached the maximum amount of Tithing Points available.
                    break;
                }

                int totalGold = Banker.GetBalance(from);

                if (totalGold <= 0)
                {
                    // You have decided to tithe no gold to the shrine.
                    from.LocalOverheadMessage(MessageType.Regular, 0x3B2, 1060193);
                    break;
                }

                m_Offer = MaxTithing - from.TithingPoints;

                if (m_Offer > totalGold)
                {
                    m_Offer = totalGold;
                }

                from.SendGump(new TithingGump(from, m_Offer));

                break;
            }

            case 2:
            {
                if (from.TithingPoints >= MaxTithing)
                {
                    from.SendLocalizedMessage(1060840);         // You have reached the maximum amount of Tithing Points available.
                    break;
                }

                int totalGold = Banker.GetBalance(from);

                if (totalGold <= 0)
                {
                    // You have decided to tithe no gold to the shrine.
                    from.LocalOverheadMessage(MessageType.Regular, 0x3B2, 1060193);
                    break;
                }

                TextRelay tr = info.GetTextEntry(1);

                if (tr != null)
                {
                    string text = tr.Text;
                    int    num  = Utility.ToInt32(text);

                    if (num > 0)
                    {
                        if (num > totalGold)
                        {
                            m_Offer = totalGold;
                        }
                        else
                        {
                            m_Offer = num;
                        }

                        if ((from.TithingPoints + m_Offer) > MaxTithing)
                        {
                            m_Offer = MaxTithing - from.TithingPoints;
                        }

                        Container pack = from.Backpack;

                        if (Banker.Withdraw(from, m_Offer, true))
                        {
                            // You tithe gold to the shrine as a sign of devotion.
                            from.LocalOverheadMessage(MessageType.Regular, 0x3B2, 1060195);
                            from.TithingPoints += m_Offer;

                            from.PlaySound(0x243);
                            from.PlaySound(0x2E6);
                        }
                        else
                        {
                            // You do not have enough gold to tithe that amount!
                            from.LocalOverheadMessage(MessageType.Regular, 0x3B2, 1060194);
                        }
                    }
                    else
                    {
                        from.SendLocalizedMessage(1159140);         // You have entered an invalid entry. You must enter a number between 1 and 100,000.
                    }
                }

                break;
            }
            }
        }
Example #11
0
        public override void OnResponse(NetState ns, RelayInfo info)
        {
            Mobile mob_m = ns.Mobile;

            PlayerMobile pm = mob_m as PlayerMobile;

            UOETool dd = i_Tool as UOETool;

            if (pm == null || dd == null)
            {
                return;
            }

            int si;

            if (dd.StcT == true)
            {
                TextRelay entry1 = info.GetTextEntry(1);
                string    text1  = (entry1 == null ? "" : entry1.Text.Trim());
                bool      r1     = Int32.TryParse(text1, out si);
                if (r1 != false)
                {
                    dd.StcID = si;
                }

                if (dd.MultiT == false)
                {
                    TextRelay entry2 = info.GetTextEntry(2);
                    string    text2  = (entry2 == null ? "" : entry2.Text.Trim());
                    bool      r2     = Int32.TryParse(text2, out si);
                    if (r2 != false)
                    {
                        dd.StcX = si;
                    }

                    TextRelay entry3 = info.GetTextEntry(3);
                    string    text3  = (entry3 == null ? "" : entry3.Text.Trim());
                    bool      r3     = Int32.TryParse(text3, out si);
                    if (r3 != false)
                    {
                        dd.StcY = si;
                    }

                    TextRelay entry4 = info.GetTextEntry(4);
                    string    text4  = (entry4 == null ? "" : entry4.Text.Trim());
                    bool      r4     = Int32.TryParse(text4, out si);
                    if (r4 != false)
                    {
                        dd.StcZ = si;
                    }
                }
            }

            if (dd.LndT == true)
            {
                TextRelay entry1 = info.GetTextEntry(1);
                string    text1  = (entry1 == null ? "" : entry1.Text.Trim());
                bool      r1     = Int32.TryParse(text1, out si);
                if (r1 != false)
                {
                    dd.LndID = si;
                }

                if (dd.MultiT == false)
                {
                    TextRelay entry2 = info.GetTextEntry(2);
                    string    text2  = (entry2 == null ? "" : entry2.Text.Trim());
                    bool      r2     = Int32.TryParse(text2, out si);
                    if (r2 != false)
                    {
                        dd.LndX = si;
                    }

                    TextRelay entry3 = info.GetTextEntry(3);
                    string    text3  = (entry3 == null ? "" : entry3.Text.Trim());
                    bool      r3     = Int32.TryParse(text3, out si);
                    if (r3 != false)
                    {
                        dd.LndY = si;
                    }

                    TextRelay entry4 = info.GetTextEntry(4);
                    string    text4  = (entry4 == null ? "" : entry4.Text.Trim());
                    bool      r4     = Int32.TryParse(text4, out si);
                    if (r4 != false)
                    {
                        dd.LndZ = si;
                    }
                }
            }

            switch (info.ButtonID)
            {
            case 0:
            {
                pm.SendMessage(pm.Name + ", Thanks for using the UO Editor!");

                dd.SendSYSBCK(pm, dd);

                break;
            }

            case 1:
            {
                bool MapCheck = dd.MapCKUOE(pm, dd);

                if (MapCheck == false)
                {
                    pm.SendMessage(pm.Name + ", You entered improper values in the XYZ fields!");

                    dd.SendSYSBCK(pm, dd);

                    if (dd.SndOn == true)
                    {
                        pm.PlaySound(dd.Snd7);
                    }

                    break;
                }

                bool IDCheck = dd.IDCKUOE(pm, dd);

                if (IDCheck == false)
                {
                    pm.SendMessage(pm.Name + ", You entered improper values in the ID field!");

                    dd.SendSYSBCK(pm, dd);

                    if (dd.SndOn == true)
                    {
                        pm.PlaySound(dd.Snd7);
                    }

                    break;
                }

                bool HueCK = dd.HueCKUOE(pm, dd);

                if (HueCK == false)
                {
                    pm.SendMessage(pm.Name + ", You can only enter 1-3000 for the value!");

                    dd.SendSYSBCK(pm, dd);

                    if (dd.SndOn == true)
                    {
                        pm.PlaySound(dd.Snd7);
                    }

                    break;
                }

                if (dd.StcT == true)
                {
                    if (dd.MultiT == true)
                    {
                        CommandSystem.Handle(pm, String.Format("{0}m addStatic {1}", CommandSystem.Prefix, dd.StcID));
                    }
                    if (dd.StcX == 0 || dd.StcY == 0)
                    {
                        CommandSystem.Handle(pm, String.Format("{0}addStatic {1}", CommandSystem.Prefix, dd.StcID));
                    }
                    else
                    {
                        new UltimaLive.AddStatic(pm.Map.MapID, dd.StcID, dd.StcZ, dd.StcX, dd.StcY, dd.Hue_S).DoOperation();
                    }

                    dd.SendSYSBCK(pm, dd);

                    if (dd.SndOn == true)
                    {
                        pm.PlaySound(dd.Snd5);
                    }

                    break;
                }

                if (dd.LndT == true)
                {
                    if (dd.MultiT == true)
                    {
                        CommandSystem.Handle(pm, String.Format("{0}m setLandId {1}", CommandSystem.Prefix, dd.LndID));
                    }
                    if (dd.StcX == 0 || dd.StcY == 0)
                    {
                        CommandSystem.Handle(pm, String.Format("{0}setLandId {1}", CommandSystem.Prefix, dd.LndID));
                    }
                    if (IDCheck == true)
                    {
                        new UltimaLive.SetLandID(dd.LndX, dd.LndY, pm.Map.MapID, dd.LndID).DoOperation();
                        new UltimaLive.SetLandAltitude(dd.LndX, dd.LndY, pm.Map.MapID, dd.LndZ).DoOperation();
                    }

                    dd.SendSYSBCK(pm, dd);

                    if (dd.SndOn == true)
                    {
                        pm.PlaySound(dd.Snd5);
                    }

                    break;
                }

                dd.SendSYSBCK(pm, dd);

                break;
            }
            }
        }
Example #12
0
        public void Maj(NubiaPlayer from, RelayInfo info)
        {
            TextRelay tName = info.GetTextEntry(0);

            m_SortNubia.Nom = (tName == null) ? "Sort nubien" : tName.Text;

            TextRelay tEmote = info.GetTextEntry(1);

            m_SortNubia.Emote = (tEmote == null) ? "incante" : tEmote.Text;

            if (m_SortNubia is SortNubiaDestruction)
            {
                SortNubiaDestruction newSortNubia = m_SortNubia as SortNubiaDestruction;
                TextRelay            tminDeg      = info.GetTextEntry(50);
                string min = (tminDeg == null) ? "0" : tminDeg.Text;
                try{ newSortNubia.minDegat = Convert.ToInt32(min); }catch {}

                TextRelay tmaxDeg = info.GetTextEntry(51);
                string    max     = (tmaxDeg == null) ? "0" : tmaxDeg.Text;
                try{ newSortNubia.maxDegat = Convert.ToInt32(max); }catch {}

                TextRelay tDistance = info.GetTextEntry(52);
                string    dist      = (tDistance == null) ? "0" : tDistance.Text;
                try{ newSortNubia.distance = Convert.ToInt32(dist); }catch {}

                TextRelay tNumber = info.GetTextEntry(53);
                string    num     = (tNumber == null) ? "0" : tNumber.Text;
                try{ newSortNubia.number = Convert.ToInt32(num); }catch {}
            }
            if (m_SortNubia is SortNubiaSoin)
            {
                SortNubiaSoin newSortNubia = m_SortNubia as SortNubiaSoin;
                TextRelay     tminDeg      = info.GetTextEntry(75);
                string        min          = (tminDeg == null) ? "0" : tminDeg.Text;
                try{ newSortNubia.minDegat = Convert.ToInt32(min); }catch {}

                TextRelay tmaxDeg = info.GetTextEntry(76);
                string    max     = (tmaxDeg == null) ? "0" : tmaxDeg.Text;
                try{ newSortNubia.maxDegat = Convert.ToInt32(max); }catch {}

                TextRelay tDistance = info.GetTextEntry(77);
                string    dist      = (tDistance == null) ? "0" :tDistance.Text;
                try{ newSortNubia.distance = Convert.ToInt32(dist); }catch {}

                TextRelay tNumber = info.GetTextEntry(78);
                string    num     = (tNumber == null) ? "0" : tNumber.Text;
                try{ newSortNubia.number = Convert.ToInt32(num); }catch {}
            }
            if (m_SortNubia is SortNubiaInvocationArme)
            {
                SortNubiaInvocationArme newSortNubia = m_SortNubia as SortNubiaInvocationArme;
                TextRelay tspeed = info.GetTextEntry(90);
                string    speed  = (tspeed == null) ? "0" : tspeed.Text;
                try{ newSortNubia.wSpeed = Convert.ToInt32(speed); }catch {}

                TextRelay twName = info.GetTextEntry(93);
                string    wname  = (twName == null) ? "0" : twName.Text;
                try{ newSortNubia.wNom = wname; }catch {}

                //	newSortNubia.color = KonohaCompHelper.getCompColor(newSortNubia.competence);
            }
            if (m_SortNubia is SortNubiaTao)
            {
                SortNubiaTao newSortNubia = m_SortNubia as SortNubiaTao;
                TextRelay    tdegs        = info.GetTextEntry(100);
                string       degs         = (tdegs == null) ? "0" : tdegs.Text;
                try{ newSortNubia.degats = Convert.ToInt32(degs); }catch {}

                TextRelay tTurn = info.GetTextEntry(101);
                string    tt    = (tTurn == null) ? "0" : tTurn.Text;
                try{ newSortNubia.turn = Convert.ToInt32(tt); }catch {}

                TextRelay tstun = info.GetTextEntry(102);
                string    st    = (tstun == null) ? "0" : tstun.Text;
                try{ newSortNubia.stun = Convert.ToDouble(st); }catch {}

                //newSortNubia.color = KonohaCompHelper.getCompColor(newSortNubia.competence);
            }
            if (m_SortNubia is SortNubiaParalyze)
            {
                SortNubiaParalyze newSortNubia = m_SortNubia as SortNubiaParalyze;
                TextRelay         tminDeg      = info.GetTextEntry(110);
                string            min          = (tminDeg == null) ? "0" : tminDeg.Text;
                try{ newSortNubia.minDegat = Convert.ToInt32(min); }catch {}

                TextRelay tmaxDeg = info.GetTextEntry(111);
                string    max     = (tmaxDeg == null) ? "0" : tmaxDeg.Text;
                try{ newSortNubia.maxDegat = Convert.ToInt32(max); }catch {}

                TextRelay tDistance = info.GetTextEntry(112);
                string    dist      = (tDistance == null) ? "0" : tDistance.Text;
                try{ newSortNubia.distance = Convert.ToInt32(dist); }catch {}

                TextRelay tNumber = info.GetTextEntry(113);
                string    num     = (tNumber == null) ? "0" : tNumber.Text;
                try{ newSortNubia.number = Convert.ToInt32(num); }catch {}
            }
            if (m_SortNubia is SortNubiaPoison)
            {
                SortNubiaPoison newSortNubia = m_SortNubia as SortNubiaPoison;
                TextRelay       tminDeg      = info.GetTextEntry(120);
                string          min          = (tminDeg == null) ? "0" : tminDeg.Text;
                int             plev         = 0;
                try{ plev = Convert.ToInt32(min); }catch {}
                if (plev > 3)
                {
                    plev = 3;
                }
                if (plev < 0)
                {
                    plev = 0;
                }
                newSortNubia.PoisonLevel = plev;

                TextRelay tDistance = info.GetTextEntry(121);
                string    dist      = (tDistance == null) ? "0" : tDistance.Text;
                try{ newSortNubia.distance = Convert.ToInt32(dist); }catch {}

                TextRelay tNumber = info.GetTextEntry(122);
                string    num     = (tNumber == null) ? "0" : tNumber.Text;
                try{ newSortNubia.number = Convert.ToInt32(num); }catch {}
            }

            if (m_SortNubia is SortNubiaMur)
            {
                SortNubiaMur newSortNubia = m_SortNubia as SortNubiaMur;
                TextRelay    tdegWalk     = info.GetTextEntry(135);
                string       dwalk        = (tdegWalk == null) ? "0" : tdegWalk.Text;
                try{ newSortNubia.damageWalk = Convert.ToInt32(dwalk); }catch {}
            }

            from.CloseGump(typeof(SortCreationGump));
            from.SendGump(new SortCreationGump(m_owner, m_SortNubia));
        }
Example #13
0
        public override void OnResponse(NetState state, RelayInfo info)
        {
            if (m_State == null)
            {
                return;
            }

            Mobile focus = m_State.Mobile;
            Mobile from  = state.Mobile;

            if (focus == null)
            {
                from.SendMessage("Le personnage n'est plus connecte.");
                return;
            }
            else if (focus.Deleted)
            {
                from.SendMessage("Le personnage n'existe plus.");
                return;
            }
            else if (focus.AccessLevel > from.AccessLevel && from.AccessLevel == AccessLevel.Player)
            {
                from.SendMessage("Vous ne pouvez envoyer un message à un maitre du jeu. Veuillez utiliser le systèmes de pages.");
                return;
            }
            else if (from != focus && (focus.Hidden && focus.HideAdmin && from.AccessLevel < focus.AccessLevel))
            {
                from.SendMessage("Le personnage n'est plus visible.");
                return;
            }

            switch (info.ButtonID)
            {
            case 1:     // Tell
            {
                TextRelay text = info.GetTextEntry(0);

                if (text != null)
                {
                    focus.SendMessage(0x482, "{0} {1} vous a envoye un message HRP: ", from.GetNameUsedBy(focus));
                    focus.SendMessage(0x482, text.Text);

                    CommandLogging.WriteLine(from, "{0} {1} telling {2} \"{3}\" ", from.AccessLevel, CommandLogging.Format(from), CommandLogging.Format(focus), text.Text);
                }

                from.SendGump(new ClientGump(from, m_State));

                break;
            }

            case 2:     // Tell + Reply Gump
            {
                TextRelay text = info.GetTextEntry(0);

                if (text != null)
                {
                    string name = from.GetNameUsedBy(focus);
                    if (focus is PlayerMobile)
                    {
                        PlayerMobile pm = focus as PlayerMobile;
                        int          q  = (int)pm.QuiOptions;
                        bool         cantBeDelivered = (q & 0x100) != 0 || (name == "Anonyme" && (q & 0x001) != 0) || (name == "Identite Cachee" && (q & 0x010) != 0);
                        Console.WriteLine("q = {0:X}, canBeDelivered = {1}, q & 0x100 = {2}, name == \"Anonyme\" = {3}", q, cantBeDelivered, q & 0x100, name == "Anonyme");
                        if (from.AccessLevel > AccessLevel.Player || !cantBeDelivered)
                        {
                            focus.SendGump(new ClientGump(focus, state, from.GetNameUsedBy(focus), "", text.Text));
                            CommandLogging.WriteLine(from, "{0} {1} telling {2} \"{3}\" ", from.AccessLevel, CommandLogging.Format(from), CommandLogging.Format(focus), text.Text);
                        }
                        else
                        {
                            from.SendMessage("{0} refuse de recevoir votre message", focus.GetNameUsedBy(from));
                        }
                    }
                }

                //from.SendGump(new ClientGump(from, m_State));

                break;
            }

            case 4:     // Props
            {
                Resend(from, info);

                if (!BaseCommand.IsAccessible(from, focus))
                {
                    from.SendMessage("Cela ne vous est pas accessible.");
                }
                else
                {
                    from.SendGump(new PropertiesGump(from, focus));
                    CommandLogging.WriteLine(from, "{0} {1} ouverture des propriétés de {2} ", from.AccessLevel, CommandLogging.Format(from), CommandLogging.Format(focus));
                }

                break;
            }

            case 5:     // Go to
            {
                if (focus.Map == null || focus.Map == Map.Internal)
                {
                    from.SendMessage("Ce personnage n'est pas dans ce monde.");
                }
                else
                {
                    from.MoveToWorld(focus.Location, focus.Map);
                    Resend(from, info);

                    CommandLogging.WriteLine(from, "{0} {1} se dirige sur {2}, Localisation {3}, Map {4}", from.AccessLevel, CommandLogging.Format(from), CommandLogging.Format(focus), focus.Location, focus.Map);
                }

                break;
            }

            case 6:     // Get
            {
                if (from.Map == null || from.Map == Map.Internal)
                {
                    from.SendMessage("Vous ne pouvez pas amener ce personnage en ce lieu.");
                }
                else
                {
                    focus.MoveToWorld(from.Location, from.Map);
                    Resend(from, info);

                    CommandLogging.WriteLine(from, "{0} {1} amène {2} à la Localisation {3}, Map {4}", from.AccessLevel, CommandLogging.Format(from), CommandLogging.Format(focus), from.Location, from.Map);
                }

                break;
            }

            case 7:     // Move
            {
                from.Target = new MoveTarget(focus);
                Resend(from, info);

                break;
            }

            case 8:     // Kick
            {
                if (from.AccessLevel >= AccessLevel.Batisseur && from.AccessLevel > focus.AccessLevel)
                {
                    focus.Say("I've been kicked!");

                    m_State.Dispose();

                    CommandLogging.WriteLine(from, "{0} {1} kicking {2} ", from.AccessLevel, CommandLogging.Format(from), CommandLogging.Format(focus));
                }

                break;
            }

            case 9:     // Kill
            {
                if (from.AccessLevel >= AccessLevel.Batisseur && from.AccessLevel > focus.AccessLevel)
                {
                    focus.Kill();
                    CommandLogging.WriteLine(from, "{0} {1} tue {2} ", from.AccessLevel, CommandLogging.Format(from), CommandLogging.Format(focus));
                }

                Resend(from, info);

                break;
            }

            case 10:     //Res
            {
                if (from.AccessLevel >= AccessLevel.Batisseur && from.AccessLevel > focus.AccessLevel)
                {
                    focus.PlaySound(0x214);
                    Effects.SendTargetEffect(focus, 0x376A, 10, 16);

                    focus.Resurrect();

                    CommandLogging.WriteLine(from, "{0} {1} résurrecte {2} ", from.AccessLevel, CommandLogging.Format(from), CommandLogging.Format(focus));
                }

                Resend(from, info);

                break;
            }

            case 11:     // .Voir
            {
                Resend(from, info);

                /*if (from is PlayerMobile && focus is PlayerMobile && from.AccessLevel > AccessLevel.GameMaster && focus.AccessLevel == AccessLevel.Player)
                 * {
                 *  from.SendGump(new CotationVoirGump((PlayerMobile)from, (PlayerMobile)focus));
                 * }*/

                break;
            }
            }
        }
Example #14
0
        public override void OnResponse(NetState sender, RelayInfo info)
        {
            TimeSpan toSet;
            bool     shouldSet, shouldSend;

            TextRelay h = info.GetTextEntry(0);
            TextRelay m = info.GetTextEntry(1);
            TextRelay s = info.GetTextEntry(2);

            switch (info.ButtonID)
            {
            case 1:     // Zero
            {
                toSet      = TimeSpan.Zero;
                shouldSet  = true;
                shouldSend = true;

                break;
            }

            case 2:     // From H:M:S
            {
                bool successfulParse = false;
                if (h != null && m != null && s != null)
                {
                    successfulParse = TimeSpan.TryParse(h.Text + ":" + m.Text + ":" + s.Text, out toSet);
                }
                else
                {
                    toSet = TimeSpan.Zero;
                }

                shouldSet = shouldSend = successfulParse;

                break;
            }

            case 3:     // From H
            {
                if (h != null)
                {
                    try
                    {
                        toSet      = TimeSpan.FromHours(Utility.ToDouble(h.Text));
                        shouldSet  = true;
                        shouldSend = true;

                        break;
                    }
                    catch
                    {
                    }
                }

                toSet      = TimeSpan.Zero;
                shouldSet  = false;
                shouldSend = false;

                break;
            }

            case 4:     // From M
            {
                if (m != null)
                {
                    try
                    {
                        toSet      = TimeSpan.FromMinutes(Utility.ToDouble(m.Text));
                        shouldSet  = true;
                        shouldSend = true;

                        break;
                    }
                    catch
                    {
                    }
                }

                toSet      = TimeSpan.Zero;
                shouldSet  = false;
                shouldSend = false;

                break;
            }

            case 5:     // From S
            {
                if (s != null)
                {
                    try
                    {
                        toSet      = TimeSpan.FromSeconds(Utility.ToDouble(s.Text));
                        shouldSet  = true;
                        shouldSend = true;

                        break;
                    }
                    catch
                    {
                    }
                }

                toSet      = TimeSpan.Zero;
                shouldSet  = false;
                shouldSend = false;

                break;
            }

            default:
            {
                toSet      = TimeSpan.Zero;
                shouldSet  = false;
                shouldSend = true;

                break;
            }
            }

            if (shouldSet)
            {
                try
                {
                    CommandLogging.LogChangeProperty(this.m_Mobile, this.m_Object, this.m_Property.Name, toSet.ToString());
                    this.m_Property.SetValue(this.m_Object, toSet, null);
                    PropertiesGump.OnValueChanged(this.m_Object, this.m_Property, this.m_Stack);
                }
                catch
                {
                    this.m_Mobile.SendMessage("An exception was caught. The property may not have changed.");
                }
            }

            if (shouldSend)
            {
                this.m_Mobile.SendGump(new PropertiesGump(this.m_Mobile, this.m_Object, this.m_Stack, this.m_List, this.m_Page));
            }
        }
        public override void OnResponse(Server.Network.NetState sender, RelayInfo info)
        {
            if (info == null || sender == null || sender.Mobile == null)
            {
                return;
            }

            // read the text entries for the search criteria
            TextRelay tr = info.GetTextEntry(100);        // quest name

            if (tr != null)
            {
                this.m_QuestItem.Name = tr.Text.Trim();
            }

            tr = info.GetTextEntry(102);        // title
            if (tr != null)
            {
                this.m_QuestItem.TitleString = tr.Text.Trim();
            }

            tr = info.GetTextEntry(103);        // notestring
            if (tr != null)
            {
                this.m_QuestItem.NoteString = tr.Text;
            }

            tr = info.GetTextEntry(200);        // objectives
            if (tr != null)
            {
                this.m_QuestItem.Objective1 = tr.Text.Trim();
            }

            tr = info.GetTextEntry(201);
            if (tr != null)
            {
                this.m_QuestItem.Objective2 = tr.Text.Trim();
            }

            tr = info.GetTextEntry(202);
            if (tr != null)
            {
                this.m_QuestItem.Objective3 = tr.Text.Trim();
            }

            tr = info.GetTextEntry(203);
            if (tr != null)
            {
                this.m_QuestItem.Objective4 = tr.Text.Trim();
            }

            tr = info.GetTextEntry(204);
            if (tr != null)
            {
                this.m_QuestItem.Objective5 = tr.Text.Trim();
            }

            tr = info.GetTextEntry(205);
            if (tr != null && tr.Text != null && tr.Text.Length > 0)       // descriptions
            {
                this.m_QuestItem.Description1 = tr.Text.Trim();
            }
            else
            {
                this.m_QuestItem.Description1 = null;
            }

            tr = info.GetTextEntry(206);
            if (tr != null && tr.Text != null && tr.Text.Length > 0)
            {
                this.m_QuestItem.Description2 = tr.Text.Trim();
            }
            else
            {
                this.m_QuestItem.Description2 = null;
            }

            tr = info.GetTextEntry(207);
            if (tr != null && tr.Text != null && tr.Text.Length > 0)
            {
                this.m_QuestItem.Description3 = tr.Text.Trim();
            }
            else
            {
                this.m_QuestItem.Description3 = null;
            }

            tr = info.GetTextEntry(208);
            if (tr != null && tr.Text != null && tr.Text.Length > 0)
            {
                this.m_QuestItem.Description4 = tr.Text.Trim();
            }
            else
            {
                this.m_QuestItem.Description4 = null;
            }

            tr = info.GetTextEntry(209);
            if (tr != null && tr.Text != null && tr.Text.Length > 0)
            {
                this.m_QuestItem.Description5 = tr.Text.Trim();
            }
            else
            {
                this.m_QuestItem.Description5 = null;
            }

            tr = info.GetTextEntry(210);         // expiration
            if (tr != null && tr.Text != null && tr.Text.Length > 0)
            {
                try
                {
                    this.m_QuestItem.Expiration = double.Parse(tr.Text.Trim());
                }
                catch
                {
                }
            }

            // check all of the check boxes
            this.m_QuestItem.PartyEnabled = info.IsSwitched(300);
            this.m_QuestItem.CanSeeReward = info.IsSwitched(301);

            // refresh the time created
            this.m_QuestItem.TimeCreated = DateTime.UtcNow;

            switch (info.ButtonID)
            {
            case 0:     // Okay
            {
                break;
            }

            case 1:     // Select Reward
            {
                sender.Mobile.Target = new RewardTarget(this.m_QuestItem);
                break;
            }

            case 2:     // Select Reward Return
            {
                sender.Mobile.Target = new ReturnTarget(this.m_QuestItem);
                break;
            }
            }
        }
Example #16
0
		//SMD: my utility functions
		int GetResultValueInt(TextRelay relay, int defaultValue)
		{
			int iReturn = defaultValue;
			string text = ( relay == null ? null : relay.Text.Trim() );
			if( text != null )
			{
				if( text.Length > 0 )
				{
					iReturn = Int32.Parse(text);
				}
			}		
			return iReturn;
		}
Example #17
0
        public override void OnResponse(NetState state, RelayInfo info)
        {
            bool powerball = info.IsSwitched(0);

            if (PowerBall.Game == null || m_Ticket.GameNumber != PowerBall.Game.GameNumber)
            {
                return;
            }

            int white = PowerBall.Game.MaxWhiteBalls;
            int red   = PowerBall.Game.MaxRedBalls;

            switch (info.ButtonID)
            {
            default:
            case 0: m_From.CloseGump(typeof(PowerballTicketGump)); break;

            case 1:
            {
                int pick1 = 0; int pick2 = 0; int pick3 = 0;
                int pick4 = 0; int pick5 = 0; int pick6 = 0;

                TextRelay s1 = info.GetTextEntry(1);
                TextRelay s2 = info.GetTextEntry(2);
                TextRelay s3 = info.GetTextEntry(3);
                TextRelay s4 = info.GetTextEntry(4);
                TextRelay s5 = info.GetTextEntry(5);
                TextRelay s6 = info.GetTextEntry(6);

                try
                {
                    pick1 = Convert.ToInt32(s1.Text);
                    pick2 = Convert.ToInt32(s2.Text);
                    pick3 = Convert.ToInt32(s3.Text);
                    pick4 = Convert.ToInt32(s4.Text);
                    pick5 = Convert.ToInt32(s5.Text);
                    pick6 = Convert.ToInt32(s6.Text);
                }
                catch
                {
                }

                if (PowerBall.Instance != null && PowerBall.Game != null)
                {
                    if (pick1 < 1 || pick2 < 1 || pick3 < 1 || pick4 < 1 || pick5 < 1)
                    {
                        m_From.SendMessage(String.Format("You must choose a number from 1 to {0} on a non-powerball pick.", white.ToString()));
                    }
                    else if (pick1 == pick2 || pick1 == pick3 || pick1 == pick4 || pick1 == pick5 || pick2 == pick3 || pick2 == pick4 || pick2 == pick5 || pick3 == pick4 || pick3 == pick5 || pick4 == pick5)
                    {
                        m_From.SendMessage("You should think twice before picking the same number twice.");
                    }
                    else if (pick1 > white || pick2 > white || pick3 > white || pick4 > white || pick5 > white)
                    {
                        m_From.SendMessage(String.Format("White numbers cannot be any higher than {0}.", white.ToString()));
                    }
                    else if (pick6 > red)
                    {
                        m_From.SendMessage(String.Format("Red numbers cannot be any higher than {0}.", red.ToString()));
                    }
                    else if (powerball)
                    {
                        if (pick6 < 1)
                        {
                            m_From.SendMessage(String.Format("You must choose a number from 1 to {0} on your powerball pick.", red.ToString()));
                        }
                        else
                        {
                            Container pack  = m_From.Backpack;
                            int       price = PowerBall.Game.TicketEntryPrice + PowerBall.Game.PowerBallPrice;

                            if (pack != null && pack.GetAmount(typeof(Gold)) >= price)
                            {
                                pack.ConsumeTotal(typeof(Gold), price);
                                m_From.SendMessage("You purchase a powerball ticket with {0} gold from your backpack.", price);
                                new TicketEntry(m_Ticket, pick1, pick2, pick3, pick4, pick5, pick6, false);
                                PowerBall.Instance.Profit += price;
                            }
                            else if (Banker.Withdraw(m_From, price, true))
                            {
                                new TicketEntry(m_Ticket, pick1, pick2, pick3, pick4, pick5, pick6, false);

                                PowerBall.Instance.Profit += price;
                            }
                            else
                            {
                                m_From.SendLocalizedMessage(500191);         //Begging thy pardon, but thy bank account lacks these funds.
                            }
                        }
                    }
                    else
                    {
                        Container pack  = m_From.Backpack;
                        int       price = PowerBall.Game.TicketEntryPrice;

                        if (pack != null && pack.GetAmount(typeof(Gold)) >= price)
                        {
                            pack.ConsumeTotal(typeof(Gold), price);
                            m_From.SendMessage("You purchase a powerball ticket with {0} gold from your backpack.", price);
                            new TicketEntry(m_Ticket, pick1, pick2, pick3, pick4, pick5, false);
                            PowerBall.Instance.Profit += price;
                        }
                        else if (Banker.Withdraw(m_From, price, true))
                        {
                            new TicketEntry(m_Ticket, pick1, pick2, pick3, pick4, pick5, false);

                            PowerBall.Instance.Profit += price;
                        }
                        else
                        {
                            m_From.SendLocalizedMessage(500191);         //Begging thy pardon, but thy bank account lacks these funds.
                        }
                    }
                }

                m_From.SendGump(new PowerballTicketGump(m_Ticket, m_From, powerball));
                break;
            }

            case 2:     //Quickpick
            {
                Container pack = m_From.Backpack;
                int       price;

                if (powerball)
                {
                    price = PowerBall.Game.TicketEntryPrice + PowerBall.Game.PowerBallPrice;
                }
                else
                {
                    price = PowerBall.Game.TicketEntryPrice;
                }

                if (pack != null && pack.GetAmount(typeof(Gold)) >= price)
                {
                    m_From.SendMessage("You purchase a powerball ticket with {0} gold from your backpack.", price);
                    pack.ConsumeTotal(typeof(Gold), price);
                }
                else if (!Banker.Withdraw(m_From, price, true))
                {
                    m_From.SendLocalizedMessage(1060398, price.ToString()); //~1_AMOUNT~ gold has been withdrawn from your bank box.

                    m_From.SendLocalizedMessage(500191);                    //Begging thy pardon, but thy bank account lacks these funds.
                    m_From.SendGump(new PowerballTicketGump(m_Ticket, m_From, powerball));
                    break;
                }

                int pick1 = 0; int pick2 = 0; int pick3 = 0;
                int pick4 = 0; int pick5 = 0; int pick6 = 0;

                List <int> whiteList = new List <int>();

                for (int i = 1; i < white + 1; ++i)
                {
                    whiteList.Add(i);
                }

                int count = 0;
                while (++count < 6)
                {
                    int ran = Utility.Random(whiteList.Count);

                    if (count == 1)
                    {
                        pick1 = whiteList[ran];
                    }
                    else if (count == 2)
                    {
                        pick2 = whiteList[ran];
                    }
                    else if (count == 3)
                    {
                        pick3 = whiteList[ran];
                    }
                    else if (count == 4)
                    {
                        pick4 = whiteList[ran];
                    }
                    else
                    {
                        pick5 = whiteList[ran];
                    }

                    whiteList.Remove(whiteList[ran]);

                    pick6 = Utility.RandomMinMax(1, red);
                }

                if (powerball)
                {
                    new TicketEntry(m_Ticket, pick1, pick2, pick3, pick4, pick5, pick6, false);
                    PowerBall.Instance.Profit += price;
                }
                else
                {
                    new TicketEntry(m_Ticket, pick1, pick2, pick3, pick4, pick5, false);
                    PowerBall.Instance.Profit += price;
                }
                m_From.SendGump(new PowerballTicketGump(m_Ticket, m_From, powerball));
            }
            break;
            }
        }
		public static void DisplayGumpResponse( NetState state, PacketReader pvSrc )
		{
			int serial = pvSrc.ReadInt32();
			int typeID = pvSrc.ReadInt32();
			int buttonID = pvSrc.ReadInt32();

			foreach ( Gump gump in state.Gumps )
			{
				if ( gump.Serial == serial && gump.TypeID == typeID )
				{
					int switchCount = pvSrc.ReadInt32();

					if ( switchCount < 0 || switchCount > gump.m_Switches )
					{
						log.InfoFormat("Client: {0}: Invalid gump response, disconnecting...", state);
						state.Dispose();
						return;
					}

					int[] switches = new int[switchCount];

					for ( int j = 0; j < switches.Length; ++j )
						switches[j] = pvSrc.ReadInt32();

					int textCount = pvSrc.ReadInt32();

					if ( textCount < 0 || textCount > gump.m_TextEntries )
					{
						log.InfoFormat("Client: {0}: Invalid gump response, disconnecting...", state );
						state.Dispose();
						return;
					}

					TextRelay[] textEntries = new TextRelay[textCount];

					for ( int j = 0; j < textEntries.Length; ++j )
					{
						int entryID = pvSrc.ReadUInt16();
						int textLength = pvSrc.ReadUInt16();

						if ( textLength > 239 )
							return;

						string text = pvSrc.ReadUnicodeStringSafe( textLength );
						textEntries[j] = new TextRelay( entryID, text );
					}

					state.RemoveGump( gump );

					try {
						gump.OnResponse( state, new RelayInfo( buttonID, switches, textEntries ) );
					} catch (Exception e) {
						log.Fatal(String.Format("Exception disarmed in gump response of {0}",
												gump), e);
					}

					return;
				}
			}

			if ( typeID == 461 ) // Virtue gump
			{
				int switchCount = pvSrc.ReadInt32();

				if ( buttonID == 1 && switchCount > 0 )
				{
					Mobile beheld = World.FindMobile( pvSrc.ReadInt32() );

					if ( beheld != null )
						EventSink.InvokeVirtueGumpRequest( new VirtueGumpRequestEventArgs( state.Mobile, beheld ) );
				}
				else
				{
					Mobile beheld = World.FindMobile( serial );

					if ( beheld != null )
						EventSink.InvokeVirtueItemRequest( new VirtueItemRequestEventArgs( state.Mobile, beheld, buttonID ) );
				}
			}
		}
Example #19
0
        public override void OnResponse(NetState sender, RelayInfo info)
        {
            Mobile           from      = sender.Mobile;
            BonusPackControl b_control = null;
            BonusPackOrb     b_orb     = null;
            bool             isInt     = true;

            foreach (Item i in World.Items.Values)
            {
                if (i is BonusPackControl)
                {
                    b_control = i as BonusPackControl;
                }
            }

            foreach (Item i in World.Items.Values)
            {
                if (i is BonusPackOrb)
                {
                    b_orb = i as BonusPackOrb;
                    if (b_orb.BPNumber == b_control.B_Current)
                    {
                        break;
                    }
                }
            }

            for (int i = 0; i < 54; i++)
            {
                if ((i + 1) == info.ButtonID)
                {
                    if (b_orb.AmountSkills != 5)
                    {
                        b_orb.BPSkills[b_orb.AmountSkills] = from.Skills[i].Name;

                        TextRelay m_bo    = info.GetTextEntry(1);
                        string    text_bo = (m_bo == null ? "" : m_bo.Text.Trim());

                        if (text_bo.Length == 0)
                        {
                            m_From.SendMessage(0x35, "You must enter a Value");
                            b_orb.BPSkills[b_orb.AmountSkills] = null;
                            m_From.SendGump(new BonusPickGump(from, b_orb));
                        }
                        else
                        {
                            isInt = true;
                            try
                            {
                                int ibp = Convert.ToInt32(text_bo);
                            }
                            catch
                            {
                                from.SendMessage(0x35, "Value must be a number!");
                                b_orb.BPSkills[b_orb.AmountSkills] = null;
                                m_From.SendGump(new BonusPickGump(from, b_orb));
                                isInt = false;
                            }
                            if (isInt)
                            {
                                int b_pri = Convert.ToInt32(text_bo);
                                if (b_pri > 120)
                                {
                                    m_From.SendMessage(0x35, "Value is above 120");
                                    b_orb.BPSkills[b_orb.AmountSkills] = null;
                                    m_From.SendGump(new BonusPickGump(from, b_orb));
                                }
                                else
                                if (b_pri < 0)
                                {
                                    m_From.SendMessage(0x35, "Value is below 0");
                                    b_orb.BPSkills[b_orb.AmountSkills] = null;
                                    m_From.SendGump(new BonusPickGump(from, b_orb));
                                }
                                else
                                {
                                    b_orb.BPValues[b_orb.AmountSkills] = b_pri;
                                    b_orb.AmountSkills += 1;
                                    m_From.SendGump(new BonusPickGump(from, b_orb));
                                    m_From.SendMessage(6, b_orb.BPSkills[b_orb.AmountSkills - 1] + " added as a Bonus Pack Skill with a cap of " + b_orb.BPValues[b_orb.AmountSkills - 1]);
                                }
                            }
                        }
                    }
                    else
                    {
                        m_From.SendMessage(0x35, "You have reached the Maximum Bonus Pack Skills");
                        m_From.SendGump(new BonusPickGump(from, b_orb));
                    }
                }
            }

            if (info.ButtonID == 0)
            {
                for (int i = 0; i < 5; i++)
                {
                    b_orb.BPSkills[i] = null;
                }
                m_From.SendGump(new BonusPackGump(from, b_orb));
            }

            if (info.ButtonID == 60)
            {
                if (b_orb.AmountSkills == 0)
                {
                    m_From.SendMessage(0x35, "You have not chosen any Skills");
                    m_From.SendGump(new BonusPickGump(from, b_orb));
                }
                else
                {
                    Bag b_bag = new Bag();
                    b_bag.Name = b_orb.BPName + " Bonus Pack";

                    Bag i_bag = new Bag();
                    i_bag.Name = b_orb.BPName + " Items";

                    b_bag.AddItem(i_bag);

                    b_orb.Name      = b_orb.BPName + " Bonus Pack";
                    b_control.A_BP += 1;
                    b_orb.Activated = true;
                    b_bag.AddItem(b_orb);
                    foreach (Item i in World.Items.Values)
                    {
                        if (i is Bag && i.Name == "BONUS PACKS")
                        {
                            i.AddItem(b_bag);
                        }
                    }
                    m_From.SendMessage(6, "Bonus Pack Generated");
                }
            }
        }
		public override void OnResponse( NetState state, RelayInfo info )
		{
			Mobile m = state.Mobile;
			
			Item i = m.Backpack.FindItemByType( typeof( StatBall ) );
			
			switch( info.ButtonID )
			{
				case (int)Buttons.OkBtn:
				{
					StrEnt = info.GetTextEntry(1);
					DexEnt = info.GetTextEntry(2);
					IntEnt = info.GetTextEntry(3);
										
					int StrVal;
					int DexVal;
					int IntVal;
					
					try
					{
						StrVal = Convert.ToInt32(StrEnt.Text);
						DexVal = Convert.ToInt32(DexEnt.Text);
						IntVal = Convert.ToInt32(IntEnt.Text);
					}
					catch
					{
						m.SendMessage( "Numbers only, please try again." );
						break;
					}
					
					if( StrVal > 150 || StrVal < 10 || DexVal > 150 || DexVal < 10 || IntVal > 150 || IntVal < 10 )
					{
						m.SendMessage( "Stats can be between 10-150, or above 300 total, please try again." );
						break;
					}
					else if( StrVal + DexVal + IntVal != m.StatCap )
					{
						m.SendMessage( "The stats you've entered equal {0}, your stats cannot exceed, nor be below {1}, please try again." , StrVal + DexVal + IntVal, m.StatCap );
						break;
					}
					else
					{
						m.RawStr = StrVal;
						m.RawDex = DexVal;
						m.RawInt = IntVal;
						m.Hits	 = m.HitsMax;
						m.Stam	 = m.StamMax;
						m.Mana	 = m.ManaMax;
						
						m.SendMessage( "Your stats have been changed." );
						
						i.Delete();
						
						break;
					}					
										
					//break;
				}
				
				case (int)Buttons.CancelBtn:
				{
					m.CloseGump( typeof( StatBallGump) );
					break;
				}
			}			
		}
Example #21
0
        public override void OnResponse(NetState sender, RelayInfo info)
        {
            Mobile           from      = sender.Mobile;
            BonusPackControl b_control = null;
            BonusPackOrb     b_orb     = null;
            BonusPackOrb     t_orb     = null;
            bool             name_used = false;
            bool             is_void   = false;
            bool             isInt     = true;
            string           c_name    = null;
            string           n_name    = null;

            foreach (Item i in World.Items.Values)
            {
                if (i is BonusPackControl)
                {
                    b_control = i as BonusPackControl;
                }
            }

            foreach (Item i in World.Items.Values)
            {
                if (i is BonusPackOrb)
                {
                    b_orb = i as BonusPackOrb;
                    if (b_orb.BPNumber == b_control.B_Current)
                    {
                        break;
                    }
                }
            }

            if (info.ButtonID == 0)
            {
                b_orb.Delete();
            }

            if (info.ButtonID == 1)
            {
                if (b_orb != null)
                {
                    TextRelay m_name    = info.GetTextEntry(1);
                    string    text_name = (m_name == null ? "" : m_name.Text.Trim());

                    if (text_name.Length == 0)
                    {
                        m_From.SendMessage(0x35, "You must enter a Bonus Pack Name.");
                        m_From.SendGump(new BonusPackGump(from, b_orb));
                        is_void = true;
                    }
                    else
                    {
                        foreach (Item x in World.Items.Values)
                        {
                            if (x is BonusPackOrb)
                            {
                                t_orb = x as BonusPackOrb;
                                if (text_name != null)
                                {
                                    n_name = text_name.ToLower();
                                }
                                if (t_orb.BPName != null)
                                {
                                    c_name = t_orb.BPName.ToLower();
                                }
                                if (c_name == n_name)
                                {
                                    name_used = true;
                                }
                            }
                        }
                        if (name_used)
                        {
                            m_From.SendMessage(0x35, "That Bonus Pack Name is already used.");
                            if (!is_void)
                            {
                                m_From.SendGump(new BonusPackGump(from, b_orb));
                                is_void = true;
                            }
                        }
                        else
                        {
                            b_orb.BPName     = text_name;
                            b_orb.BackUpName = text_name;
                        }
                    }

                    TextRelay m_bp    = info.GetTextEntry(2);
                    string    text_bp = (m_bp == null ? "" : m_bp.Text.Trim());

                    if (text_bp.Length == 0)
                    {
                        m_From.SendMessage(0x35, "You must enter a Secondary Skill Value");
                        if (!is_void)
                        {
                            m_From.SendGump(new BonusPackGump(from, b_orb));
                            is_void = true;
                        }
                    }
                    else
                    {
                        isInt = true;
                        try
                        {
                            int ibp = Convert.ToInt32(text_bp);
                        }
                        catch
                        {
                            from.SendMessage(0x35, "Value must be a number!");
                            if (!is_void)
                            {
                                m_From.SendGump(new BonusPackGump(from, b_orb));
                                is_void = true;
                            }
                            isInt = false;
                        }
                        if (isInt)
                        {
                            int r_bp = Convert.ToInt32(text_bp);
                            if (r_bp > 9)
                            {
                                from.SendMessage(0x35, "Value must be under 10");
                                if (!is_void)
                                {
                                    m_From.SendGump(new BonusPackGump(from, b_orb));
                                    is_void = true;
                                }
                            }
                            else
                            if (r_bp < 1)
                            {
                                from.SendMessage(0x35, "Value must be over 0");
                                if (!is_void)
                                {
                                    m_From.SendGump(new BonusPackGump(from, b_orb));
                                    is_void = true;
                                }
                            }
                            else
                            {
                                b_orb.Sec_Skill_Cost = r_bp;
                            }
                        }
                    }

                    if (!is_void)
                    {
                        m_From.SendGump(new BonusPickGump(from, b_orb));
                    }
                }
            }
        }
Example #22
0
        public override void OnResponse(Server.Network.NetState state, RelayInfo info)
        {
            if (info == null || state == null || state.Mobile == null)
            {
                return;
            }

            Mobile from = state.Mobile;



            if (m_gumpcallback != null)
            {
                if (info.ButtonID == 0)
                {
                    m_gumpcallback(from, m_invoker, String.Empty);
                }
                else
                {
                    switch (m_gumptype)
                    {
                    case 0:                     // simple acknowledgement gump
                        m_gumpcallback(from, m_invoker, "done");
                        break;

                    case 1:                                             // yes/no gump
                        if (info.Switches != null && info.Switches.Length > 0)
                        {
                            if (info.Switches[0] == 1)
                            {
                                m_gumpcallback(from, m_invoker, "yes");
                            }
                            else
                            {
                                m_gumpcallback(from, m_invoker, "no");
                            }
                        }
                        break;

                    case 2:                     // text entry gump
                        TextRelay entry = info.GetTextEntry(99);
                        if (entry != null && entry.Text.Length > 0)
                        {
                            // return the response string
                            m_gumpcallback(from, m_invoker, entry.Text);
                        }
                        break;

                    case 3:                     // accept/decline gump
                        if (info.Switches != null && info.Switches.Length > 0)
                        {
                            if (info.Switches[0] == 1)
                            {
                                from.SendLocalizedMessage(1049019);                                   // You have accepted the Quest.

                                m_gumpcallback(from, m_invoker, "accept");
                            }
                            else
                            {
                                from.SendLocalizedMessage(1049018);                                   // You have declined the Quest.

                                m_gumpcallback(from, m_invoker, "decline");
                            }
                        }
                        break;

                    case 4:                     // multiple option gump
                        if (info.Switches != null && info.Switches.Length > 0)
                        {
                            int select = info.Switches[0];

                            if (select >= 0 && select < gumpSelections.Count)
                            {
                                // return the response string for that selection
                                m_gumpcallback(from, m_invoker, gumpSelections[select].Response);
                            }
                        }
                        break;

                    case 5:

                        string buttonresponse = String.Empty;
                        string radioresponse  = String.Empty;
                        string textresponse   = String.Empty;

                        if (info.ButtonID >= 1000)
                        {
                            int select = info.ButtonID - 1000;
                            // get the gump response associated with the button
                            if (select >= 0 && select < gumpSelections.Count)
                            {
                                // return the response string for that selection
                                buttonresponse = gumpSelections[select].Response;
                            }
                        }

                        if (info.Switches != null && info.Switches.Length > 0)
                        {
                            int radiostate = info.Switches[0];

                            if (radiostate >= 0 && radiostate < gumpSelections.Count)
                            {
                                radioresponse = gumpSelections[radiostate].Response;
                            }
                        }

                        // check for any textentries
                        for (int j = 0; j < gumpSelections.Count; j++)
                        {
                            if (gumpSelections[j].GumpItemType == 1)
                            {
                                try
                                {
                                    TextRelay te = info.GetTextEntry(j);
                                    if (te != null && te.Text.Length > 0)
                                    {
                                        textresponse += te.Text + " ";
                                    }
                                }
                                catch {}
                            }
                        }

                        // build the composite reponse string
                        string responsestring = null;
                        if (buttonresponse != null && buttonresponse.Length > 0)
                        {
                            responsestring = buttonresponse;
                        }
                        if (radioresponse != null && radioresponse.Length > 0)
                        {
                            responsestring += " " + radioresponse;
                        }
                        if (textresponse != null && textresponse.Length > 0)
                        {
                            responsestring += " " + textresponse;
                        }

                        m_gumpcallback(from, m_invoker, responsestring);
                        break;
                    }
                }
            }
            // get rid of any temporary gump keyword tokens
            if (m_invoker is XmlSpawner)
            {
                ((XmlSpawner)m_invoker).DeleteTag(m_keywordtag);
            }
        }
Example #23
0
        public string GetTextField(RelayInfo info, int index)
        {
            TextRelay relay = info.GetTextEntry(index);

            return(relay == null ? null : relay.Text.Trim());
        }
Example #24
0
        public override void OnResponse(NetState state, RelayInfo info)
        {
            if (state == null || info == null || state.Mobile == null || m_gauntlet == null || m_gauntlet.Challenger == null)
            {
                return;
            }

            XmlPoints afrom = (XmlPoints)XmlAttach.FindAttachment(state.Mobile, typeof(XmlPoints));

            switch (info.ButtonID)
            {
            case 1:
                // refresh

                m_gauntlet.CheckForDisqualification();

                state.Mobile.SendGump(new DeathBallGump(m_gauntlet, state.Mobile, viewpage));
                break;

            case 10:
                // Entry fee
                int       val = 0;
                TextRelay tr  = info.GetTextEntry(10);
                if (tr != null)
                {
                    try{ val = int.Parse(tr.Text); } catch {}
                }
                m_gauntlet.EntryFee = val;

                m_gauntlet.ResetAcceptance();

                // update all the gumps
                RefreshAllGumps(m_gauntlet, true);

                state.Mobile.SendGump(new DeathBallGump(m_gauntlet, state.Mobile, viewpage));
                break;

            case 12:
                // page up
                // try doing the default for non-participants
                int nplayers = 0;
                if (m_gauntlet.Participants != null)
                {
                    nplayers = m_gauntlet.Participants.Count;
                }

                int page = viewpage + 1;
                if (page > (int)(nplayers / PlayersPerPage))
                {
                    page = (int)(nplayers / PlayersPerPage);
                }

                foreach (DeathBallGauntlet.ChallengeEntry entry in m_WorkingList)
                {
                    if (entry != null)
                    {
                        if (entry.Participant == state.Mobile)
                        {
                            entry.PageBeingViewed++;

                            if (entry.PageBeingViewed > (int)(nplayers / PlayersPerPage))
                            {
                                entry.PageBeingViewed = (int)(nplayers / PlayersPerPage);
                            }
                            page = entry.PageBeingViewed;
                            break;
                        }
                    }
                }

                state.Mobile.SendGump(new DeathBallGump(m_gauntlet, state.Mobile, page));
                break;

            case 13:
                // page down
                // try doing the default for non-participants

                page = viewpage - 1;
                if (page < 0)
                {
                    page = 0;
                }
                foreach (DeathBallGauntlet.ChallengeEntry entry in m_WorkingList)
                {
                    if (entry != null)
                    {
                        if (entry.Participant == state.Mobile)
                        {
                            entry.PageBeingViewed--;

                            if (entry.PageBeingViewed < 0)
                            {
                                entry.PageBeingViewed = 0;
                            }
                            page = entry.PageBeingViewed;
                            break;
                        }
                    }
                }

                state.Mobile.SendGump(new DeathBallGump(m_gauntlet, state.Mobile, page));
                break;

            case 20:
                // arena size
                val = 0;
                tr  = info.GetTextEntry(20);
                if (tr != null)
                {
                    try{ val = int.Parse(tr.Text); } catch {}
                }
                m_gauntlet.ArenaSize = val;

                m_gauntlet.ResetAcceptance();

                // update all the gumps
                RefreshAllGumps(m_gauntlet, true);

                state.Mobile.SendGump(new DeathBallGump(m_gauntlet, state.Mobile, viewpage));
                break;

            case 30:
                // target score
                val = 0;
                tr  = info.GetTextEntry(30);
                if (tr != null)
                {
                    try{ val = int.Parse(tr.Text); } catch {}
                }
                m_gauntlet.TargetScore = val;

                m_gauntlet.ResetAcceptance();

                // update all the gumps
                RefreshAllGumps(m_gauntlet, true);

                state.Mobile.SendGump(new DeathBallGump(m_gauntlet, state.Mobile, viewpage));
                break;

            case 100:

                // add to Participants
                if (m_gauntlet.Participants == null)
                {
                    m_gauntlet.Participants = new ArrayList();
                }

                if (MaxTeamSize > 0 && m_gauntlet.Participants.Count >= MaxTeamSize)
                {
                    XmlPoints.SendText(state.Mobile, 100535);         // "Challenge is full!"
                }
                else
                {
                    state.Mobile.Target = new MemberTarget(m_gauntlet, m_gauntlet.Participants);
                }


                state.Mobile.SendGump(new DeathBallGump(m_gauntlet, state.Mobile, viewpage));
                break;

            case 300:
                // Start game
                if (m_WorkingList == null)
                {
                    return;
                }

                bool complete = true;
                foreach (DeathBallGauntlet.ChallengeEntry entry in m_WorkingList)
                {
                    if (entry != null)
                    {
                        Mobile m = entry.Participant;

                        if (m == null)
                        {
                            continue;
                        }

                        if (!m_gauntlet.CheckQualify(m))
                        {
                            complete = false;
                            break;
                        }

                        if (!entry.Accepted)
                        {
                            XmlPoints.SendText(m_gauntlet.Challenger, 100539, m.Name);      // "{0} has not accepted yet."
                            complete = false;
                            break;
                        }
                    }
                }

                if (m_WorkingList.Count < 2)
                {
                    XmlPoints.SendText(m_gauntlet.Challenger, 100540);      // "Insufficient number of players."
                    complete = false;
                }

                if (m_gauntlet.TargetScore <= 0)
                {
                    XmlPoints.SendText(m_gauntlet.Challenger, 100568);      // "No valid end condition for match."
                    complete = false;
                }
                // copy all of the accepted entries to the final participants list


                if (complete)
                {
                    m_gauntlet.Participants = new ArrayList();

                    foreach (DeathBallGauntlet.ChallengeEntry entry in m_WorkingList)
                    {
                        if (entry != null)
                        {
                            Mobile m = entry.Participant;

                            if (m == null)
                            {
                                continue;
                            }

                            // try to collect any entry fee
                            if (!m_gauntlet.CollectEntryFee(m, m_gauntlet.EntryFee))
                            {
                                continue;
                            }

                            // set up the challenge on each player
                            XmlPoints a = (XmlPoints)XmlAttach.FindAttachment(m, typeof(XmlPoints));
                            if (a != null)
                            {
                                a.ChallengeGame = m_gauntlet;
                            }

                            entry.Status = ChallengeStatus.Active;

                            m_gauntlet.Participants.Add(entry);
                        }
                    }

                    // and lock the game
                    m_gauntlet.StartGame();

                    // refresh all gumps
                    RefreshAllGumps(m_gauntlet, true);
                }
                else
                {
                    state.Mobile.SendGump(new DeathBallGump(m_gauntlet, state.Mobile, viewpage));
                }

                break;

            default:
            {
                // forfeit buttons
                if (info.ButtonID >= 4000)
                {
                    int selection = info.ButtonID - 4000;

                    if (selection < m_WorkingList.Count)
                    {
                        DeathBallGauntlet.ChallengeEntry entry = (DeathBallGauntlet.ChallengeEntry)m_WorkingList[selection];

                        // find the master participants list entry with the same participant
                        if (m_gauntlet.Participants != null)
                        {
                            DeathBallGauntlet.ChallengeEntry forfeitentry = null;

                            foreach (DeathBallGauntlet.ChallengeEntry masterentry in m_gauntlet.Participants)
                            {
                                if (entry == masterentry)
                                {
                                    forfeitentry = masterentry;
                                    break;
                                }
                            }

                            // and remove it
                            if (forfeitentry != null)
                            {
                                forfeitentry.Status = ChallengeStatus.Forfeit;

                                // inform him that he has been kicked
                                m_gauntlet.Forfeit(forfeitentry.Participant);
                            }
                        }
                    }
                }
                // kick buttons
                if (info.ButtonID >= 2000)
                {
                    int selection = info.ButtonID - 2000;

                    if (selection < m_WorkingList.Count)
                    {
                        DeathBallGauntlet.ChallengeEntry entry = (DeathBallGauntlet.ChallengeEntry)m_WorkingList[selection];
                        // find the master participants list entry with the same participant
                        if (m_gauntlet.Participants != null)
                        {
                            DeathBallGauntlet.ChallengeEntry kickentry = null;

                            foreach (DeathBallGauntlet.ChallengeEntry masterentry in m_gauntlet.Participants)
                            {
                                if (entry == masterentry)
                                {
                                    kickentry = masterentry;
                                    break;
                                }
                            }

                            // and remove it
                            if (kickentry != null)
                            {
                                m_gauntlet.Participants.Remove(kickentry);

                                // refresh his gump and inform him that he has been kicked
                                if (kickentry.Participant != null)
                                {
                                    XmlPoints.SendText(kickentry.Participant, 100545, m_gauntlet.ChallengeName);     // "You have been kicked from {0}"
                                    kickentry.Participant.SendGump(new DeathBallGump(m_gauntlet, kickentry.Participant, viewpage));
                                }
                            }
                        }

                        m_gauntlet.ResetAcceptance();
                    }

                    // refresh all gumps
                    RefreshAllGumps(m_gauntlet, true);
                    //state.Mobile.SendGump( new DeathBallGump( m_gauntlet, state.Mobile));
                }
                else
                // accept buttons
                if (info.ButtonID >= 1000)
                {
                    int selection = info.ButtonID - 1000;
                    // set the acceptance flag of the participant
                    if (selection < m_WorkingList.Count)
                    {
                        DeathBallGauntlet.ChallengeEntry entry = (DeathBallGauntlet.ChallengeEntry)m_WorkingList[selection];

                        entry.Accepted = !entry.Accepted;
                    }

                    // refresh all gumps
                    RefreshAllGumps(m_gauntlet, true);

                    //state.Mobile.SendGump( new DeathBallGump( m_gauntlet, state.Mobile));
                }


                break;
            }
            }
        }
Example #25
0
            public override void OnResponse(NetState state, RelayInfo info)
            {
                if (info == null || state == null || state.Mobile == null)
                {
                    return;
                }

                if (m_questitem == null || m_questitem.Deleted)
                {
                    return;
                }
                bool update_entry = false;

                //bool edit_entry = false;
                switch (info.ButtonID)
                {
                case 0:     // Close
                {
                    update_entry = false;
                    break;
                }

                case 1:     // Okay
                {
                    update_entry = true;
                    break;
                }

                case 2:     // Edit
                {
                    //edit_entry = true;
                    break;
                }

                default:
                    update_entry = true;
                    break;
                }

                if (update_entry)
                {
                    string entrytext = null;
                    string entryid   = null;

                    TextRelay entry = info.GetTextEntry(0);
                    if (entry != null)
                    {
                        entrytext = entry.Text;
                    }

                    entry = info.GetTextEntry(1);
                    if (entry != null)
                    {
                        entryid = entry.Text;
                    }

                    m_questitem.AddJournalEntry = entryid + ":" + entrytext;
                }
                // open a new journal gump
                state.Mobile.CloseGump(typeof(XmlQuestStatusGump));
                state.Mobile.SendGump(new XmlQuestStatusGump(m_questitem, m_gumptitle, m_X, m_Y, m_solid, 1));
            }
Example #26
0
        public override void OnResponse(NetState sender, RelayInfo info)
        {
            Mobile      from      = sender.Mobile;
            RaceControl r_control = null;
            RaceOrb     r_orb     = null;
            RaceOrb     t_orb     = null;
            bool        name_used = false;
            bool        isInt     = true;
            bool        is_void   = false;
            string      c_name    = null;
            string      n_name    = null;

            foreach (Item i in World.Items.Values)
            {
                if (i is RaceControl)
                {
                    r_control = i as RaceControl;
                }
            }

            foreach (Item i in World.Items.Values)
            {
                if (i is RaceOrb)
                {
                    r_orb = i as RaceOrb;
                    if (r_orb.RaceNumber == r_control.A_Current)
                    {
                        break;
                    }
                }
            }

            Map map = null;

            for (int i = 0; i < info.Switches.Length; i++)
            {
                int m = info.Switches[i];
                switch (m)
                {
                case 6:  map = Map.Trammel;  break;

                case 7:  map = Map.Felucca;  break;

                case 8:  map = Map.Malas;    break;

                case 9:  map = Map.Ilshenar; break;

                case 10: map = Map.Tokuno;   break;
                }
            }


            if (info.ButtonID == 0)
            {
                r_orb.Delete();
            }

            if (info.ButtonID == 1)
            {
                if (r_orb != null)
                {
                    TextRelay m_name    = info.GetTextEntry(21);
                    string    text_name = (m_name == null ? "" : m_name.Text.Trim());

                    if (text_name.Length == 0)
                    {
                        m_From.SendMessage(0x35, "You must enter a Race Name.");
                        m_From.SendGump(new AddRaceGump(from, r_orb));
                        is_void = true;
                    }
                    else
                    {
                        foreach (Item x in World.Items.Values)
                        {
                            if (x is RaceOrb)
                            {
                                t_orb = x as RaceOrb;
                                if (text_name != null)
                                {
                                    n_name = text_name.ToLower();
                                }
                                if (t_orb.RaceName != null)
                                {
                                    c_name = t_orb.RaceName.ToLower();
                                }
                                if (c_name == n_name)
                                {
                                    name_used = true;
                                }
                            }
                        }
                        if (name_used)
                        {
                            m_From.SendMessage(0x35, "That Race Name is already used.");
                            if (!is_void)
                            {
                                m_From.SendGump(new AddRaceGump(from, r_orb));
                                is_void = true;
                            }
                        }
                        else
                        {
                            r_orb.RaceName   = text_name;
                            r_orb.BackUpName = text_name;
                        }
                    }

                    TextRelay m_desc    = info.GetTextEntry(22);
                    string    text_desc = (m_desc == null ? "" : m_desc.Text.Trim());

                    if (text_desc.Length == 0)
                    {
                        m_From.SendMessage(0x35, "You must enter a Race Description.");
                        if (!is_void)
                        {
                            m_From.SendGump(new AddRaceGump(from, r_orb));
                            is_void = true;
                        }
                    }
                    else
                    {
                        r_orb.Description = text_desc;
                    }

                    TextRelay m_x    = info.GetTextEntry(23);
                    string    text_x = (m_x == null ? "" : m_x.Text.Trim());

                    if (text_x.Length == 0)
                    {
                        m_From.SendMessage(0x35, "You must enter a X Coordinate");
                        if (!is_void)
                        {
                            m_From.SendGump(new AddRaceGump(from, r_orb));
                            is_void = true;
                        }
                    }
                    else
                    {
                        isInt = true;
                        try
                        {
                            int ix = Convert.ToInt32(text_x);
                        }
                        catch
                        {
                            from.SendMessage(0x35, "Coordinates must be numbers!");
                            if (!is_void)
                            {
                                m_From.SendGump(new AddRaceGump(from, r_orb));
                                is_void = true;
                            }
                            isInt = false;
                        }
                        if (isInt)
                        {
                            int r_x = Convert.ToInt32(text_x);
                            r_orb.Race_X = r_x;
                        }
                    }

                    TextRelay m_y    = info.GetTextEntry(24);
                    string    text_y = (m_y == null ? "" : m_y.Text.Trim());

                    if (text_y.Length == 0)
                    {
                        m_From.SendMessage(0x35, "You must enter a Y Coordinate");
                        if (!is_void)
                        {
                            m_From.SendGump(new AddRaceGump(from, r_orb));
                            is_void = true;
                        }
                    }
                    else
                    {
                        isInt = true;
                        try
                        {
                            int iy = Convert.ToInt32(text_y);
                        }
                        catch
                        {
                            from.SendMessage(0x35, "Coordinates must be numbers!");
                            if (!is_void)
                            {
                                m_From.SendGump(new AddRaceGump(from, r_orb));
                                is_void = true;
                            }
                            isInt = false;
                        }
                        if (isInt)
                        {
                            int r_y = Convert.ToInt32(text_y);
                            r_orb.Race_Y = r_y;
                        }
                    }

                    TextRelay m_z    = info.GetTextEntry(25);
                    string    text_z = (m_z == null ? "" : m_z.Text.Trim());

                    if (text_z.Length == 0)
                    {
                        m_From.SendMessage(0x35, "You must enter a Z Coordinate");
                        if (!is_void)
                        {
                            m_From.SendGump(new AddRaceGump(from, r_orb));
                            is_void = true;
                        }
                    }
                    else
                    {
                        isInt = true;
                        try
                        {
                            int iz = Convert.ToInt32(text_x);
                        }
                        catch
                        {
                            from.SendMessage(0x35, "Coordinates must be numbers!");
                            if (!is_void)
                            {
                                m_From.SendGump(new AddRaceGump(from, r_orb));
                                is_void = true;
                            }
                            isInt = false;
                        }
                        if (isInt)
                        {
                            int r_z = Convert.ToInt32(text_z);
                            r_orb.Race_Z = r_z;
                        }
                    }

                    for (int i = 1; i < 11; i++)
                    {
                        TextRelay m_hue_body    = info.GetTextEntry(i);
                        string    text_hue_body = (m_hue_body == null ? "" : m_hue_body.Text.Trim());

                        if (text_hue_body.Length == 0)
                        {
                            if (r_orb.AmountBodyHues == 0)
                            {
                                from.SendMessage(0x35, "You must enter at least one Body Hue");
                                if (!is_void)
                                {
                                    m_From.SendGump(new AddRaceGump(from, r_orb));
                                    is_void = true;
                                }
                                break;
                            }
                        }
                        else
                        {
                            isInt = true;
                            try
                            {
                                int ihue = Convert.ToInt32(text_hue_body);
                            }
                            catch
                            {
                                from.SendMessage(0x35, "Hues must be numbers!");
                                if (!is_void)
                                {
                                    m_From.SendGump(new AddRaceGump(from, r_orb));
                                    is_void = true;
                                }
                                isInt = false;
                            }
                            if (isInt)
                            {
                                int r_hue = Convert.ToInt32(text_hue_body);
                                r_orb.BodyHues[i - 1] = r_hue;
                                r_orb.AmountBodyHues += 1;
                            }
                        }
                    }

                    for (int i = 11; i < 21; i++)
                    {
                        TextRelay m_hue_hair    = info.GetTextEntry(i);
                        string    text_hue_hair = (m_hue_hair == null ? "" : m_hue_hair.Text.Trim());

                        if (text_hue_hair.Length == 0)
                        {
                            if (r_orb.AmountHairHues == 0)
                            {
                                from.SendMessage(0x35, "You must enter at least one Hair Hue");
                                if (!is_void)
                                {
                                    m_From.SendGump(new AddRaceGump(from, r_orb));
                                    is_void = true;
                                }
                                break;
                            }
                        }
                        else
                        {
                            isInt = true;
                            try
                            {
                                int ihue2 = Convert.ToInt32(text_hue_hair);
                            }
                            catch
                            {
                                from.SendMessage(0x35, "Hues must be numbers!");
                                if (!is_void)
                                {
                                    m_From.SendGump(new AddRaceGump(from, r_orb));
                                    is_void = true;
                                }
                                isInt = false;
                            }
                            if (isInt)
                            {
                                int r_hue2 = Convert.ToInt32(text_hue_hair);
                                r_orb.HairHues[i - 11] = r_hue2;
                                r_orb.AmountHairHues  += 1;
                            }
                        }
                    }

                    if (!is_void)
                    {
                        Bag r_bag = new Bag();
                        Bag i_bag = new Bag();

                        r_bag.Name = r_orb.RaceName + " Race";
                        i_bag.Name = r_orb.RaceName + " Items";

                        r_bag.AddItem(i_bag);
                        r_bag.AddItem(r_orb);

                        foreach (Item i in World.Items.Values)
                        {
                            if (i is Bag && i.Name == "RACES")
                            {
                                i.AddItem(r_bag);
                            }
                        }

                        r_orb.Race_Map     = map;
                        r_orb.Name         = r_orb.RaceName + " Race Orb";
                        r_control.A_Races += 1;
                        r_orb.Activated    = true;
                        from.SendMessage(6, "Race has been Generated!");
                    }
                }
            }
        }
Example #27
0
        public static string GetTextRelayString(RelayInfo info, int id)
        {
            TextRelay t = info.GetTextEntry(id);

            return(t == null ? String.Empty : t.Text.Trim());
        }
        public override void OnResponse(Server.Network.NetState sender, RelayInfo info)
        {
            Mobile from = sender.Mobile;

            if (from.AccessLevel < AccessLevel.Administrator)
            {
                return;
            }

            TextRelay d = info.GetTextEntry(0);
            TextRelay h = info.GetTextEntry(1);
            TextRelay m = info.GetTextEntry(2);
            TextRelay s = info.GetTextEntry(3);

            TimeSpan duration;
            bool     shouldSet;

            switch (info.ButtonID)
            {
            case 0:
            {
                for (int i = 0; i < m_List.Count; ++i)
                {
                    Account a = (Account)m_List[i];

                    a.SetUnspecifiedBan(from);
                }

                from.SendMessage("Duration unspecified.");
                return;
            }

            case 1:                     // infinite
            {
                duration  = TimeSpan.MaxValue;
                shouldSet = true;
                break;
            }

            case 2:                     // From D:H:M:S
            {
                if (d != null && h != null && m != null && s != null)
                {
                    try
                    {
                        duration  = new TimeSpan(Utility.ToInt32(d.Text), Utility.ToInt32(h.Text), Utility.ToInt32(m.Text), Utility.ToInt32(s.Text));
                        shouldSet = true;

                        break;
                    }
                    catch
                    {
                    }
                }

                duration  = TimeSpan.Zero;
                shouldSet = false;

                break;
            }

            case 3:                     // From D
            {
                if (d != null)
                {
                    try
                    {
                        duration  = TimeSpan.FromDays(Utility.ToDouble(d.Text));
                        shouldSet = true;

                        break;
                    }
                    catch
                    {
                    }
                }

                duration  = TimeSpan.Zero;
                shouldSet = false;

                break;
            }

            case 4:                     // From H
            {
                if (h != null)
                {
                    try
                    {
                        duration  = TimeSpan.FromHours(Utility.ToDouble(h.Text));
                        shouldSet = true;

                        break;
                    }
                    catch
                    {
                    }
                }

                duration  = TimeSpan.Zero;
                shouldSet = false;

                break;
            }

            case 5:                     // From M
            {
                if (m != null)
                {
                    try
                    {
                        duration  = TimeSpan.FromMinutes(Utility.ToDouble(m.Text));
                        shouldSet = true;

                        break;
                    }
                    catch
                    {
                    }
                }

                duration  = TimeSpan.Zero;
                shouldSet = false;

                break;
            }

            case 6:                     // From S
            {
                if (s != null)
                {
                    try
                    {
                        duration  = TimeSpan.FromSeconds(Utility.ToDouble(s.Text));
                        shouldSet = true;

                        break;
                    }
                    catch
                    {
                    }
                }

                duration  = TimeSpan.Zero;
                shouldSet = false;

                break;
            }

            default: return;
            }

            if (shouldSet)
            {
                for (int i = 0; i < m_List.Count; ++i)
                {
                    Account a = (Account)m_List[i];

                    a.SetBanTags(from, DateTime.Now, duration);
                }

                if (duration == TimeSpan.MaxValue)
                {
                    from.SendMessage("Duration is infinite.");
                }
                else
                {
                    from.SendMessage("Duration is {0}.", duration);
                }
            }
            else
            {
                from.SendMessage("Values improperly formatted.");
                from.SendGump(new BanDurationGump(m_List));
            }
        }
Example #29
0
        public override void OnResponse(NetState sender, RelayInfo info)
        {
            Mobile from = sender.Mobile;
			
            switch (info.ButtonID)
            {
                case 1:
                    {
                        SoundID = info.GetTextEntry(1);
									
                        try
                        {
                            SoundVal = Convert.ToInt32(SoundID.Text);
                        }
                        catch
                        {
                            from.SendMessage("Numbers only, please try again.");
                            break;
                        }
					
                        SoundVal -= 1;
                        Effects.PlaySound(from, from.Map, SoundVal);
                        from.SendGump(new SoundPickerGump(SoundVal));
                        break;
                    }
				
                case 2:
                    {
                        SoundID = info.GetTextEntry(1);
									
                        try
                        {
                            SoundVal = Convert.ToInt32(SoundID.Text);
                        }
                        catch
                        {
                            from.SendMessage("Numbers only, please try again.");
                            break;
                        }
					
                        SoundVal += 1;
                        Effects.PlaySound(from, from.Map, SoundVal);
                        from.SendGump(new SoundPickerGump(SoundVal));
                        break;
                    }
                case 3:
                    {
                        SoundID = info.GetTextEntry(1);
									
                        try
                        {
                            SoundVal = Convert.ToInt32(SoundID.Text);
                        }
                        catch
                        {
                            from.SendMessage("Numbers only, please try again.");
                            break;
                        }
					
                        Effects.PlaySound(from, from.Map, SoundVal);
                        from.SendGump(new SoundPickerGump(SoundVal));
                        break;
                    }
                case 4:
                    {
                        from.CloseGump(typeof(SoundPickerGump));
                        break;
                    }
            }			
        }
        public override void OnResponse(Server.Network.NetState sender, RelayInfo info)
        {
            Mobile from = sender.Mobile;

            switch (info.ButtonID)
            {
            case 1:                     // Search
            {
                TextRelay te    = info.GetTextEntry(0);
                string    match = (te == null ? "" : te.Text.Trim());

                if (match.Length < 3)
                {
                    from.SendMessage("Invalid search string.");
                    from.SendGump(new XmlPartialCategorizedAddGump(from, match, m_Page, m_SearchResults, false, m_EntryIndex, m_Gump));
                }
                else
                {
                    from.SendGump(new XmlPartialCategorizedAddGump(from, match, 0, Match(match), true, m_EntryIndex, m_Gump));
                }

                break;
            }

            case 2:                     // Previous page
            {
                if (m_Page > 0)
                {
                    from.SendGump(new XmlPartialCategorizedAddGump(from, m_SearchString, m_Page - 1, m_SearchResults, true, m_EntryIndex, m_Gump));
                }

                break;
            }

            case 3:                     // Next page
            {
                if ((m_Page + 1) * 10 < m_SearchResults.Count)
                {
                    from.SendGump(new XmlPartialCategorizedAddGump(from, m_SearchString, m_Page + 1, m_SearchResults, true, m_EntryIndex, m_Gump));
                }

                break;
            }

            default:
            {
                int index = info.ButtonID - 4;

                if (index >= 0 && index < m_SearchResults.Count)
                {
                    Type type = ((SearchEntry)m_SearchResults[index]).EntryType;

                    if (m_Gump is XmlAddGump && type != null)
                    {
                        XmlAddGump m_XmlAddGump = (XmlAddGump)m_Gump;
                        if (type != null && m_XmlAddGump.defs != null && m_XmlAddGump.defs.NameList != null &&
                            m_EntryIndex >= 0 && m_EntryIndex < m_XmlAddGump.defs.NameList.Length)
                        {
                            m_XmlAddGump.defs.NameList[m_EntryIndex] = type.Name;
                            XmlAddGump.Refresh(from, true);
                        }
                    }
                    else
                    if (m_Spawner != null && type != null)
                    {
                        XmlSpawnerGump xg = m_Spawner.SpawnerGump;

                        if (xg != null)
                        {
                            xg.Rentry          = new XmlSpawnerGump.ReplacementEntry();
                            xg.Rentry.Typename = type.Name;
                            xg.Rentry.Index    = m_EntryIndex;
                            xg.Rentry.Color    = 0x1436;

                            Timer.DelayCall(TimeSpan.Zero, new TimerStateCallback(XmlSpawnerGump.Refresh_Callback), new object[] { from });
                            //from.CloseGump(typeof(XmlSpawnerGump));
                            //from.SendGump( new XmlSpawnerGump(xg.m_Spawner, xg.X, xg.Y, xg.m_ShowGump, xg.xoffset, xg.page, xg.Rentry) );
                        }
                    }
                }

                break;
            }
            }
        }
Example #31
0
        public override void OnResponse(NetState sender, RelayInfo info)
        {
            Point3D toSet;
            bool    shouldSet, shouldSend;

            switch (info.ButtonID)
            {
            case 1:                     // Current location
            {
                toSet      = m_Mobile.Location;
                shouldSet  = true;
                shouldSend = true;

                break;
            }

            case 2:                     // Pick location
            {
                m_Mobile.Target = new InternalTarget(m_Property, m_Mobile, m_Object, m_Stack, m_Page, m_List);

                toSet      = Point3D.Zero;
                shouldSet  = false;
                shouldSend = false;

                break;
            }

            case 3:                     // Use values
            {
                TextRelay x = info.GetTextEntry(0);
                TextRelay y = info.GetTextEntry(1);
                TextRelay z = info.GetTextEntry(2);

                toSet      = new Point3D(x == null ? 0 : Utility.ToInt32(x.Text), y == null ? 0 : Utility.ToInt32(y.Text), z == null ? 0 : Utility.ToInt32(z.Text));
                shouldSet  = true;
                shouldSend = true;

                break;
            }

            default:
            {
                toSet      = Point3D.Zero;
                shouldSet  = false;
                shouldSend = true;

                break;
            }
            }

            if (shouldSet)
            {
                try
                {
                    CommandLogging.LogChangeProperty(m_Mobile, m_Object, m_Property.Name, toSet.ToString());
                    m_Property.SetValue(m_Object, toSet, null);
                }
                catch
                {
                    m_Mobile.SendMessage("An exception was caught. The property may not have changed.");
                }
            }

            if (shouldSend)
            {
                m_Mobile.SendGump(new XmlPropertiesGump(m_Mobile, m_Object, m_Stack, m_List, m_Page));
            }
        }
Example #32
0
        public override void OnResponse(NetState sender, RelayInfo info)
        {
            object toSet;
            bool   shouldSet, shouldSend = true;

            switch (info.ButtonID)
            {
            case 1:
            {
                TextRelay text = info.GetTextEntry(0);

                if (text != null)
                {
                    try
                    {
                        toSet     = PropertiesGump.GetObjectFromString(m_Property.PropertyType, text.Text);
                        shouldSet = true;
                    }
                    catch
                    {
                        toSet     = null;
                        shouldSet = false;
                        m_Mobile.SendMessage("Bad format");
                    }
                }
                else
                {
                    toSet     = null;
                    shouldSet = false;
                }

                break;
            }

            case 2: // Null
            {
                toSet     = null;
                shouldSet = true;

                break;
            }

            case 3: // Hue Picker
            {
                toSet      = null;
                shouldSet  = false;
                shouldSend = false;

                m_Mobile.SendHuePicker(new InternalPicker(m_Property, m_Mobile, m_Object, m_Stack, m_Page, m_List));

                break;
            }

            case 4: // Body Picker
            {
                toSet      = null;
                shouldSet  = false;
                shouldSend = false;

                m_Mobile.SendGump(new SetBodyGump(m_Property, m_Mobile, m_Object, m_Stack, m_Page, m_List));

                break;
            }

            default:
            {
                toSet     = null;
                shouldSet = false;

                break;
            }
            }

            if (shouldSet)
            {
                try
                {
                    CommandLogging.LogChangeProperty(m_Mobile, m_Object, m_Property.Name,
                                                     toSet?.ToString() ?? "(null)");
                    m_Property.SetValue(m_Object, toSet, null);
                    PropertiesGump.OnValueChanged(m_Object, m_Property, m_Stack);
                }
                catch
                {
                    m_Mobile.SendMessage("An exception was caught. The property may not have changed.");
                }
            }

            if (shouldSend)
            {
                m_Mobile.SendGump(new PropertiesGump(m_Mobile, m_Object, m_Stack, m_List, m_Page));
            }
        }
Example #33
0
        public override void OnResponse(NetState state, RelayInfo info)
        {
            Mobile    from        = state.Mobile;
            int       buttonNum   = 0;
            ArrayList currentList = new ArrayList(tempList);
            int       page        = m_page;

            if (info.ButtonID > 0 && info.ButtonID < 10000)
            {
                buttonNum = 1;
            }
            else if (info.ButtonID > 20004)
            {
                buttonNum = 30000;
            }
            else
            {
                buttonNum = info.ButtonID;
            }

            switch (buttonNum)
            {
            case 0:
            {
                //Close
                break;
            }

            case 1:
            {
                selSpawner = currentList[info.ButtonID - 1] as Item;
                SpawnEditor_OnCommand(from, page, currentList, 1, selSpawner);
                break;
            }

            case 10000:
            {
                if (m_page * 10 < currentList.Count)
                {
                    page = m_page += 1;
                    SpawnEditor_OnCommand(from, page, currentList);
                }
                break;
            }

            case 10001:
            {
                if (m_page != 0)
                {
                    page = m_page -= 1;
                    SpawnEditor_OnCommand(from, page, currentList);
                }
                break;
            }

            case 10002:
            {
                //Close
                break;
            }

            case 10003:
            {
                FilterByRegion(from, tempList, from.Region, from.Map, page);
                break;
            }

            case 10004:
            {
                TextRelay oDis = info.GetTextEntry(0);
                string    sDis = (oDis == null ? "" : oDis.Text.Trim());
                if (sDis != "")
                {
                    try
                    {
                        int distance = Convert.ToInt32(sDis);
                        FilterByDistance(tempList, from, distance, page);
                    }
                    catch
                    {
                        from.SendMessage("Distance must be a number");
                        SpawnEditor_OnCommand(from, page, currentList);
                    }
                }
                else
                {
                    from.SendMessage("You must specify a distance");
                    SpawnEditor_OnCommand(from, page, currentList);
                }
                break;
            }

            case 10005:
            {
                from.Location = new Point3D(selSpawner.X, selSpawner.Y, selSpawner.Z);
                SpawnEditor_OnCommand(from, page, currentList, 1, selSpawner);
                break;
            }

            case 10006:
            {
                selSpawner.Delete();
                SpawnEditor_OnCommand(from);
                break;
            }

            case 10007:
            {
                SpawnEditor_OnCommand(from, page, currentList, 2, selSpawner);
                break;
            }

            case 10008:
            {
                SpawnEditor_OnCommand(from);
                break;
            }

            case 10009:
            {
                TextRelay oSearch = info.GetTextEntry(1);
                string    sSearch = (oSearch == null ? null : oSearch.Text.Trim());
                SearchByName(tempList, from, sSearch, page);
                break;
            }

            case 10010:
            {
                TextRelay oID = info.GetTextEntry(2);
                string    sID = (oID == null ? "" : oID.Text.Trim());
                if (sID != "")
                {
                    try
                    {
                        int SearchID = Convert.ToInt32(sID);
                        SearchByID(tempList, from, SearchID, page);
                    }
                    catch
                    {
                        from.SendMessage("SpawnID must be a number");
                        SpawnEditor_OnCommand(from, page, currentList);
                    }
                }
                else
                {
                    from.SendMessage("You must specify a SpawnID");
                    SpawnEditor_OnCommand(from, page, currentList);
                }
                break;
            }

            case 20000:
            {
                PremiumSpawner spawner = selSpawner as PremiumSpawner;
                spawner.CreaturesName = CreateArray(info, state.Mobile);
                break;
            }

            case 20001:
            {
                PremiumSpawner spawner = selSpawner as PremiumSpawner;
                SpawnEditor_OnCommand(from, page, currentList, 2, selSpawner);
                spawner.BringToHome();
                break;
            }

            case 20002:
            {
                PremiumSpawner spawner = selSpawner as PremiumSpawner;
                SpawnEditor_OnCommand(from, page, currentList, 2, selSpawner);
                spawner.Respawn();
                break;
            }

            case 20003:
            {
                PremiumSpawner spawner = selSpawner as PremiumSpawner;
                SpawnEditor_OnCommand(from, page, currentList, 2, selSpawner);
                state.Mobile.SendGump(new PropertiesGump(state.Mobile, spawner));
                break;
            }

            case 30000:
            {
                int buttonID = info.ButtonID - 20004;
                int index    = buttonID / 2;
                int type     = buttonID % 2;

                PremiumSpawner spawner = selSpawner as PremiumSpawner;

                TextRelay entry = info.GetTextEntry(index);

                if (entry != null && entry.Text.Length > 0)
                {
                    if (type == 0)                               // Spawn creature
                    {
                        spawner.Spawn(entry.Text);
                    }
                    else                             // Remove creatures
                    {
                        spawner.RemoveCreatures(entry.Text);
                    }

                    spawner.CreaturesName = CreateArray(info, state.Mobile);
                }

                break;
            }
            }
        }
Example #34
0
 public RelayInfo(int buttonID, int[] switches, TextRelay[] textEntries)
 {
     this._ButtonID = buttonID;
     this._Switches = switches;
     this._TextEntries = textEntries;
 }
        public override void OnResponse(NetState sender, RelayInfo info)
        {
            Point2D toSet;
            bool    shouldSet, shouldSend;

            switch (info.ButtonID)
            {
            case 1:                     // Current location
            {
                toSet      = new Point2D(m_Mobile.Location);
                shouldSet  = true;
                shouldSend = true;

                break;
            }

            case 2:                     // Pick location
            {
                m_Mobile.Target = new InternalTarget(m_Property, m_Mobile, m_Object, m_Stack, m_Page, m_List);

                toSet      = Point2D.Zero;
                shouldSet  = false;
                shouldSend = false;

                break;
            }

            case 3:                     // Use values
            {
                TextRelay x = info.GetTextEntry(0);
                TextRelay y = info.GetTextEntry(1);

                toSet      = new Point2D(x == null ? 0 : Utility.ToInt32(x.Text), y == null ? 0 : Utility.ToInt32(y.Text));
                shouldSet  = true;
                shouldSend = true;

                break;
            }

            default:
            {
                toSet      = Point2D.Zero;
                shouldSet  = false;
                shouldSend = true;

                break;
            }
            }

            if (shouldSet)
            {
                try
                {
                    Server.Scripts.Commands.CommandLogging.LogChangeProperty(m_Mobile, m_Object, m_Property.Name, toSet.ToString());
                    m_Property.SetValue(m_Object, toSet, null);
                    PropertiesGump.OnValueChanged(m_Object, m_Property, m_Stack);

                    if (Miscellanious.ValidateLabeling(m_Object))
                    {
                        if (m_Object is Item)
                        {
                            ((Item)m_Object).Cheater_Name = String.Format("This item modified by GM {0}", m_Mobile.Name);
                        }

                        if (m_Object is Mobile)
                        {
                            ((Mobile)m_Object).Cheater_Name = String.Format("This mobile modified by GM {0}", m_Mobile.Name);
                        }
                    }
                }
                catch
                {
                    m_Mobile.SendMessage("An exception was caught. The property may not have changed.");
                }
            }

            if (shouldSend)
            {
                m_Mobile.SendGump(new PropertiesGump(m_Mobile, m_Object, m_Stack, m_List, m_Page));
            }
        }
Example #36
0
 public RelayInfo( int buttonID, int[] switches, TextRelay[] textEntries )
 {
     m_ButtonID = buttonID;
     m_Switches = switches;
     m_TextEntries = textEntries;
 }
Example #37
0
        private void Resend(Mobile to, RelayInfo info)
        {
            TextRelay te = info.GetTextEntry(0);

            to.SendGump(new ClientGump(to, m_State));
        }
Example #38
0
        /// <summary>
        /// Takes the gump relay entries and converts them from an Array into a List.
        /// </summary>
        public static List<TextRelay> CreateList( TextRelay[] entries )
        {
            List<TextRelay> list = new List<TextRelay>();
            for( int i = 0; i < entries.Length; i++ )
                list.Add( entries[i] );

            return list;
        }
Example #39
0
        public override void OnResponse(NetState state, RelayInfo info)
        {
            if (m_State == null)
            {
                return;
            }

            Mobile focus = m_State.Mobile;
            Mobile from  = state.Mobile;

            if (focus == null)
            {
                from.SendMessage("That character is no longer online.");
                return;
            }
            else if (focus.Deleted)
            {
                from.SendMessage("That character no longer exists.");
                return;
            }
            else if (from != focus && focus.Hidden && from.AccessLevel < focus.AccessLevel && (!(focus is PlayerMobile) || !((PlayerMobile)focus).VisibilityList.Contains(from)))
            {
                from.SendMessage("That character is no longer visible.");
                return;
            }

            switch (info.ButtonID)
            {
            case 1:                     // Tell
            {
                TextRelay text = info.GetTextEntry(0);

                if (text != null)
                {
                    focus.SendMessage(0x482, "{0} tells you:", from.Name);
                    focus.SendMessage(0x482, text.Text);

                    CommandLogging.WriteLine(from, "{0} {1} telling {2} \"{3}\" ", from.AccessLevel, CommandLogging.Format(from), CommandLogging.Format(focus), text.Text);
                }

                from.SendGump(new ClientGump(from, m_State));

                break;
            }

            case 4:                     // Props
            {
                Resend(from, info);

                if (!BaseCommand.IsAccessible(from, focus))
                {
                    from.SendMessage("That is not accessible.");
                }
                else
                {
                    from.SendGump(new PropertiesGump(from, focus));
                    CommandLogging.WriteLine(from, "{0} {1} opening properties gump of {2} ", from.AccessLevel, CommandLogging.Format(from), CommandLogging.Format(focus));
                }

                break;
            }

            case 5:                     // Go to
            {
                if (focus.Map == null || focus.Map == Map.Internal)
                {
                    from.SendMessage("That character is not in the world.");
                }
                else
                {
                    from.MoveToWorld(focus.Location, focus.Map);
                    Resend(from, info);

                    CommandLogging.WriteLine(from, "{0} {1} going to {2}, Location {3}, Map {4}", from.AccessLevel, CommandLogging.Format(from), CommandLogging.Format(focus), focus.Location, focus.Map);
                }

                break;
            }

            case 6:                     // Get
            {
                if (from.Map == null || from.Map == Map.Internal)
                {
                    from.SendMessage("You cannot bring that person here.");
                }
                else
                {
                    focus.MoveToWorld(from.Location, from.Map);
                    Resend(from, info);

                    CommandLogging.WriteLine(from, "{0} {1} bringing {2} to Location {3}, Map {4}", from.AccessLevel, CommandLogging.Format(from), CommandLogging.Format(focus), from.Location, from.Map);
                }

                break;
            }

            case 7:                     // Move
            {
                from.Target = new MoveTarget(focus);
                Resend(from, info);

                break;
            }

            case 8:                     // Kick
            {
                if (from.AccessLevel >= AccessLevel.GameMaster && from.AccessLevel > focus.AccessLevel)
                {
                    focus.Say("I've been kicked!");

                    m_State.Dispose();

                    CommandLogging.WriteLine(from, "{0} {1} kicking {2} ", from.AccessLevel, CommandLogging.Format(from), CommandLogging.Format(focus));
                }

                break;
            }

            case 9:                     // Kill
            {
                if (from.AccessLevel >= AccessLevel.GameMaster && from.AccessLevel > focus.AccessLevel)
                {
                    focus.Kill();
                    CommandLogging.WriteLine(from, "{0} {1} killing {2} ", from.AccessLevel, CommandLogging.Format(from), CommandLogging.Format(focus));
                }

                Resend(from, info);

                break;
            }

            case 10:                     //Res
            {
                if (from.AccessLevel >= AccessLevel.GameMaster && from.AccessLevel > focus.AccessLevel)
                {
                    focus.PlaySound(0x214);
                    focus.FixedEffect(0x376A, 10, 16);

                    focus.Resurrect();

                    CommandLogging.WriteLine(from, "{0} {1} resurrecting {2} ", from.AccessLevel, CommandLogging.Format(from), CommandLogging.Format(focus));
                }

                Resend(from, info);

                break;
            }

            case 11:                     // Skills
            {
                Resend(from, info);

                if (from.AccessLevel > focus.AccessLevel)
                {
                    from.SendGump(new SkillsGump(from, (Mobile)focus));
                    CommandLogging.WriteLine(from, "{0} {1} Opening Skills gump of {2} ", from.AccessLevel, CommandLogging.Format(from), CommandLogging.Format(focus));
                }

                break;
            }
            }
        }
        public static void DisplayGumpResponse(NetState state, PacketReader pvSrc)
        {
            int serial = pvSrc.ReadInt32();
            int typeID = pvSrc.ReadInt32();
            int buttonID = pvSrc.ReadInt32();

            List<Gump> gumps = state.Gumps;

            for (int i = 0; i < gumps.Count; ++i)
            {
                Gump gump = gumps[i];

                if (gump.Serial == serial && gump.TypeID == typeID)
                {
                    int switchCount = pvSrc.ReadInt32();

                    if (switchCount < 0)
                    {
                        Console.WriteLine("Client: {0}: Invalid gump response, disconnecting...", state);
                        state.Dispose();
                        return;
                    }

                    int[] switches = new int[switchCount];

                    for (int j = 0; j < switches.Length; ++j)
                        switches[j] = pvSrc.ReadInt32();

                    int textCount = pvSrc.ReadInt32();

                    if (textCount < 0)
                    {
                        Console.WriteLine("Client: {0}: Invalid gump response, disconnecting...", state);
                        state.Dispose();
                        return;
                    }

                    TextRelay[] textEntries = new TextRelay[textCount];

                    for (int j = 0; j < textEntries.Length; ++j)
                    {
                        int entryID = pvSrc.ReadUInt16();
                        int textLength = pvSrc.ReadUInt16();

                        if (textLength > 239)
                            return;

                        string text = pvSrc.ReadUnicodeStringSafe(textLength);
                        textEntries[j] = new TextRelay(entryID, text);
                    }

                    state.RemoveGump(i);

                    if (!CheckResponse(gump, state.Mobile, buttonID))
                        return;

                    gump.OnResponse(state, new RelayInfo(buttonID, switches, textEntries));

                    return;
                }
            }

            if (typeID == 461) // Virtue gump
            {
                int switchCount = pvSrc.ReadInt32();

                if (buttonID == 1 && switchCount > 0)
                {
                    Mobile beheld = World.FindMobile(pvSrc.ReadInt32());

                    if (beheld != null)
                        EventSink.InvokeVirtueGumpRequest(new VirtueGumpRequestEventArgs(state.Mobile, beheld));
                }
                else
                {
                    Mobile beheld = World.FindMobile(serial);

                    if (beheld != null)
                        EventSink.InvokeVirtueItemRequest(new VirtueItemRequestEventArgs(state.Mobile, beheld, buttonID));
                }
            }
        }
Example #41
0
 public void TryCatch( Mobile from, TextRelay entry, int TextEntry, int Variable, string WarningType )
 {
     try { Variable = Convert.ToInt32(entry.Text); }
     catch { from.SendMessage(1161, String.Format("Please make sure you write only numbers for the entry {0}.", WarningType)); }
 }