コード例 #1
0
ファイル: Commandes.cs プロジェクト: jicomub/Temrael
        public static void PVPDelete_OnCommand(CommandEventArgs e)
        {
            PVPEvent pvpevent_todelete = null;

            if (PVPEvent.m_InstancesList != null)
            {
                foreach (PVPEvent pvpevent in PVPEvent.m_InstancesList)
                {
                    if (pvpevent.nom == e.Arguments[0])
                    {
                        pvpevent_todelete = pvpevent;
                        break;
                    }
                }
            }

            if (pvpevent_todelete != null)
            {
                pvpevent_todelete.StopEvent();
            }
        }
コード例 #2
0
ファイル: PVPGumpCreation.cs プロジェクト: jicomub/Temrael
        public override void OnResponse(NetState sender, RelayInfo info)
        {
            int buttonID = info.ButtonID - 1;
            int type     = buttonID % NbMapModeMax;
            int index    = buttonID / NbMapModeMax;

            if (buttonID == -1)
            {
                m_Pvpevent.StopEvent();
                return;
            }

            // 0 Nom
            TextRelay relay = info.GetTextEntry(0);

            if (relay != null)
            {
                if (relay.Text != null)
                {
                    m_Pvpevent.nom = relay.Text;
                }
            }

            // 1 Map
            if (type == 1)
            {
                m_Pvpevent.SetMapByID(index);
            }

            // 2 Teams

            if (type == 2)
            {
                m_Pvpevent.SetTeamByID(index);
            }

            // 3 Mode
            if (type == 3)
            {
                m_Pvpevent.SetModeByID(index);
            }

            // 4 Teams
            relay = info.GetTextEntry(4);
            if (relay != null)
            {
                if (relay.Text != null)
                {
                    int value = 0;
                    if (int.TryParse(relay.Text, out value))
                    {
                        if (value > 0 && value <= m_Pvpevent.map.NbTeamSpawnpoints)
                        {
                            m_Pvpevent.teams.SetNbEquipe(value);
                        }
                    }
                }
            }

            // 5 Date
            relay = info.GetTextEntry(5);
            if (relay != null)
            {
                if (relay.Text != null)
                {
                    DateTime time;
                    if (DateTime.TryParse(relay.Text, out time))
                    {
                        m_Pvpevent.debutEvent = time;
                    }
                }
            }

            // 6 Résumé.
            if (type == 6)
            {
                switch (index)
                {
                case 0:     // Confirmation des settings de l'evenement.
                {
                    if (m_Pvpevent.PrepareEvent())
                    {
                        m_From.CloseGump(typeof(PVPGumpCreation));
                        return;
                    }
                    else
                    {
                        m_From.SendMessage("Il y a un bug dans le gump de PVP, merci de le rapporter à l'équipe !");
                    }
                    break;
                }

                case 1:
                {
                    m_Pvpevent.nom = "";
                    break;
                }

                case 2:
                {
                    m_Pvpevent.debutEvent = DateTime.Now;
                    break;
                }

                case 3:
                {
                    m_Pvpevent.map = null;
                    break;
                }

                case 4:
                {
                    m_Pvpevent.teams = null;
                    break;
                }

                case 5:
                {
                    m_Pvpevent.mode = null;
                    break;
                }

                case 6:
                {
                    m_Pvpevent.teams.SetNbEquipe(0);
                    break;
                }
                }
            }

            // Bouton #6 Fait un refresh de la page.

            m_From.SendGump(new PVPGumpCreation(m_From, m_Pvpevent));
        }