Beispiel #1
0
 protected override void OnTick()
 {
     if (m_PBGI.Active)
     {
         int teams = m_PBGI.Teams;
         if (teams == 2 && (m_PBGI.m_Team1 == 0 || m_PBGI.m_Team2 == 0))
         {
             m_PBGI.EndGame();
         }
         else if (teams == 3)
         {
             if (m_PBGI.m_Team1 == 0)
             {
                 if (m_PBGI.m_Team2 == 0 || m_PBGI.m_Team3 == 0)
                 {
                     m_PBGI.EndGame();
                 }
                 else if (m_PBGI.m_Team2 == 0)
                 {
                     if (m_PBGI.m_Team3 == 0)
                     {
                         m_PBGI.EndGame();
                     }
                 }
             }
         }
         else if (teams == 4)
         {
             if (m_PBGI.m_Team1 == 0)
             {
                 if (m_PBGI.m_Team2 == 0)
                 {
                     if (m_PBGI.m_Team3 == 0 || m_PBGI.m_Team4 == 0)
                     {
                         m_PBGI.EndGame();
                     }
                     else if (m_PBGI.m_Team3 == 0)
                     {
                         if (m_PBGI.m_Team4 == 0)
                         {
                             m_PBGI.EndGame();
                         }
                     }
                 }
             }
             else if (m_PBGI.m_Team2 == 0)
             {
                 if (m_PBGI.m_Team3 == 0 || m_PBGI.m_Team4 == 0)
                 {
                     m_PBGI.EndGame();
                 }
             }
         }
     }
     else
     {
         this.Stop();
     }
 }
Beispiel #2
0
        public override void OnResponse(NetState sender, RelayInfo info)
        {
            Mobile from = sender.Mobile;

            if (info.ButtonID == (int)Buttons.Button16 || info.ButtonID == (int)Buttons.Button17 || info.ButtonID == (int)Buttons.Button18 || info.ButtonID == (int)Buttons.Button19 || info.ButtonID == (int)Buttons.Button20 ||
                info.ButtonID == (int)Buttons.Button21 || info.ButtonID == (int)Buttons.Button22 || info.ButtonID == (int)Buttons.Button23)
            {
                from.Target = new PBLocTarget(m_PBGI, info.ButtonID);
            }
            else
            {
                switch (info.ButtonID)
                {
                case (int)Buttons.Button1:
                {
                    break;
                }

                case (int)Buttons.Button2:
                {
                    break;
                }

                case (int)Buttons.Button3:
                {
                    break;
                }

                case (int)Buttons.Button4:
                {
                    break;
                }

                case (int)Buttons.Button5:
                {
                    break;
                }

                case (int)Buttons.Button6:
                {
                    m_PBGI.StartGame();

                    from.SendMessage("You have started the game.");
                    from.SendGump(new PBGMGump(m_PBGI));
                    break;
                }

                case (int)Buttons.Button7:
                {
                    m_PBGI.EndGame(true);
                    from.SendMessage("You have ended the game.");
                    foreach (Mobile mob in m_PBGI.Announcers)
                    {
                        mob.PublicOverheadMessage(MessageType.Regular, 0x22, false, "The Game Has Ended!");
                    }
                    from.SendGump(new PBGMGump(m_PBGI));
                    break;
                }

                case (int)Buttons.Button8:
                {
                    m_PBGI.Active = false;
                    foreach (PlayerMobile pm in m_PBGI.Players)
                    {
                        pm.Frozen  = true;
                        pm.Warmode = false;
                        pm.SendMessage("A GM has paused the game");
                    }
                    foreach (Mobile mob in m_PBGI.Announcers)
                    {
                        mob.PublicOverheadMessage(MessageType.Regular, 0x22, false, "The Game Has Been Paused!");
                    }
                    from.SendMessage("You have paused the game.");
                    from.SendGump(new PBGMGump(m_PBGI));
                    break;
                }

                case (int)Buttons.Button9:
                {
                    // Add staff to game
                    if (m_PBGI.CheckAlreadyPlayer(from))
                    {
                        from.SendMessage("You have already joined the game.");
                    }
                    else
                    {
                        m_PBGI.AddPlayer(from);
                    }
                    from.SendGump(new PBGMGump(m_PBGI));
                    break;
                }

                case (int)Buttons.Button10:
                {
                    from.Target = new PBPrizeTarget(m_PBGI);

                    break;
                }

                case (int)Buttons.Button11:
                {
                    m_PBGI.m_WinnersPrizes.Clear();
                    from.SendGump(new PBGMGump(m_PBGI));
                    break;
                }

                case (int)Buttons.Button12:
                {
                    if (m_PBGI.CanJoin == true)
                    {
                        m_PBGI.CanJoin = false;
                    }
                    else
                    {
                        m_PBGI.CanJoin = true;
                    }
                    from.SendGump(new PBGMGump(m_PBGI));
                    break;
                }

                case (int)Buttons.Button13:
                {
                    //Announcer
                    PBAnnouncer pba = new PBAnnouncer(m_PBGI);
                    if (pba != null)
                    {
                        pba.MoveToWorld(m_PBGI.Location, m_PBGI.Map);
                    }
                    from.SendGump(new PBGMGump(m_PBGI));
                    break;
                }

                case (int)Buttons.Button14:
                {
                    //Score south
                    PBScoreBoard pbss = new PBScoreBoard(m_PBGI, 1);
                    if (pbss != null)
                    {
                        pbss.MoveToWorld(m_PBGI.Location, m_PBGI.Map);
                    }
                    from.SendGump(new PBGMGump(m_PBGI));
                    break;
                }

                case (int)Buttons.Button15:
                {
                    //Score East
                    PBScoreBoard pbse = new PBScoreBoard(m_PBGI, 2);
                    if (pbse != null)
                    {
                        pbse.MoveToWorld(m_PBGI.Location, m_PBGI.Map);
                    }
                    from.SendGump(new PBGMGump(m_PBGI));
                    break;
                }

                case (int)Buttons.Button24:
                {
                    PBNpc npc;
                    npc = new PBNpc(m_PBGI);
                    from.SendGump(new PBGMGump(m_PBGI));

                    /*if (npc != null && m_PBGI != null )
                     *
                     *              {
                     *
                     *                                      m_PBGI.AddPlayer(npc);
                     *
                     *              }
                     *              from.SendGump( new PBGMGump( m_PBGI ) ); */
                    break;
                }

                case (int)Buttons.Button25:
                {
                    TextRelay entry0 = info.GetTextEntry(0);
                    string    text0  = (entry0 == null ? "" : entry0.Text.Trim());

                    TextRelay entry1 = info.GetTextEntry(1);
                    try
                    {
                        m_PBGI.Team1Hue = Convert.ToInt32(entry1.Text);
                    }
                    catch
                    {
                        from.SendMessage("Invalid entry for Team 1 Hue.");
                    }


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

                    TextRelay entry3 = info.GetTextEntry(3);
                    try
                    {
                        m_PBGI.Team2Hue = Convert.ToInt32(entry3.Text);
                    }
                    catch
                    {
                        from.SendMessage("Invalid entry for Team 2 Hue.");
                    }


                    TextRelay entry4 = info.GetTextEntry(4);
                    string    text4  = (entry4 == null ? "" : entry4.Text.Trim());

                    TextRelay entry5 = info.GetTextEntry(5);
                    try
                    {
                        m_PBGI.Team3Hue = Convert.ToInt32(entry5.Text);
                    }
                    catch
                    {
                        from.SendMessage("Invalid entry for Team 3 Hue.");
                    }


                    TextRelay entry6 = info.GetTextEntry(6);
                    string    text6  = (entry6 == null ? "" : entry6.Text.Trim());

                    TextRelay entry7 = info.GetTextEntry(7);
                    try
                    {
                        m_PBGI.Team4Hue = Convert.ToInt32(entry7.Text);
                    }
                    catch
                    {
                        from.SendMessage("Invalid entry for Team 4 Hue.");
                    }



                    m_PBGI.m_Team1Name = text0;


                    m_PBGI.m_Team2Name = text2;


                    m_PBGI.m_Team3Name = text4;


                    m_PBGI.m_Team4Name = text6;



                    from.SendGump(new PBGMGump(m_PBGI));
                    break;
                }

                case (int)Buttons.Button26:
                {
                    from.SendMessage("right 1");
                    m_PBGI.Teams += 1;
                    if (m_PBGI.Teams > 4 || m_PBGI.Teams < 2)
                    {
                        m_PBGI.Teams = 2;
                    }

                    from.SendGump(new PBGMGump(m_PBGI));
                    break;
                }
                }
            }
        }