コード例 #1
0
ファイル: FichePerso.cs プロジェクト: bsenyuva/terranubia3
        public override void OnResponse(NetState sender, RelayInfo info)
        {
            Mobile      f    = sender.Mobile;
            NubiaPlayer from = f as NubiaPlayer;

            //if( info.ButtonID == 40

            /*  if (info.ButtonID == 90) //Choix de don
             * {
             *    bool can = false;
             *    ClasseType cl = ClasseType.None;
             *    for (int i = -1; i < (int)ClasseType.Maximum; i++)
             *    {
             *        if (mOwner.DonCredits.ContainsKey((ClasseType)i))
             *        {
             *            if (mOwner.DonCredits[(ClasseType)i] > 0)
             *            {
             *                can = true;
             *                cl = (ClasseType)i;
             *            }
             *
             *        }
             *    }
             *    if( can )
             *        from.SendGump(new GumpDonChoix(from, cl ));
             * }
             * else*/if (info.ButtonID == 100) //Nouvelle classe
            {
                from.SendGump(new GumpChoixClasse(from, false));
            }
            else if (info.ButtonID >= 50 && info.ButtonID < 75) //Baisser classe
            {
                Classe c = null;
                try { c = classes[info.ButtonID - 50]; }
                catch (Exception ex) { }
                if (c != null)
                {
                    from.MakeClasse(c.GetType(), c.Niveau - 1);
                }
                from.SendGump(new GumpFichePerso(mOwner, mViewer));
            }
            else if (info.ButtonID >= 75 && info.ButtonID < 100) //Augmenter classe
            {
                Classe c = null;
                try { c = classes[info.ButtonID - 75]; }
                catch (Exception ex) { }
                if (c != null)
                {
                    from.MakeClasse(c.GetType(), c.Niveau + 1);
                }
                from.SendGump(new GumpFichePerso(mOwner, mViewer));
            }
            else if (info.ButtonID >= 200 && info.ButtonID < 250) //Augmenter stat
            {
                DndStat stat = (DndStat)(info.ButtonID - 200);
                switch (stat)
                {
                case DndStat.Force: from.RawStr++; break;

                case DndStat.Dexterite: from.RawDex++; break;

                case DndStat.Constitution: from.RawCons++; break;

                case DndStat.Intelligence: from.RawInt++; break;

                case DndStat.Sagesse: from.RawSag++; break;

                case DndStat.Charisme: from.RawCha++; break;
                }
                from.SendGump(new GumpFichePerso(mOwner, mViewer));
            }
            else if (info.ButtonID >= 250 && info.ButtonID < 300) //maitrises
            {
                ArmeTemplate t = (ArmeTemplate)(info.ButtonID - 250);
                mOwner.increaseMaitrise(t);
                from.SendGump(new GumpFichePerso(mOwner, mViewer));
            }
        }