Example #1
0
        public GumpChoixClasse(NubiaPlayer _owner, bool _creation, int _choix)
            : base("Choix de la " + (_creation ? "Première classe" : "classe"), 250, 485)
        {
            //Closable = false;
            Closable = !creation;
            m_owner  = _owner;
            creation = _creation;
            choix    = _choix;

            int y     = YBase;
            int x     = XBase;
            int line  = 0;
            int scale = 25;
            int decal = 5;

            ClasseType possClasse   = ClasseType.Maximum;
            bool       canArtisan   = true;
            int        countArtisan = 0;

            foreach (Classe c in m_owner.GetClasses())
            {
                possClasse = c.CType;
                if (c is ClasseArtisan)
                {
                    countArtisan++;
                }
            }

            canArtisan = countArtisan <= 2;



            for (int i = 0; i < (int)ClasseType.Maximum; ++i)
            {
                if ((ClasseType)i == possClasse && possClasse != ClasseType.Maximum)
                {
                    continue;
                }

                //Bloquage du multiclassage de Magicien/Ensorceleur

                /*     if (((ClasseType)i == ClasseType.Magicien && possClasse == ClasseType.Ensorceleur) ||
                 *       ((ClasseType)i == ClasseType.Ensorceleur && possClasse == ClasseType.Magicien))
                 *       continue;*/

                if ((ClasseType)i < ClasseType.ArtisanSoigneur || canArtisan)
                {
                    AddButtonTrueFalse(x, y + (line * scale), i + 100, (choix == i), Classe.GetNameClasse((ClasseType)i));
                }
                line++;
            }
            AddButton(x, y + (line * scale), 0x850, 0x851, 99, GumpButtonType.Reply, 0);
        }
Example #2
0
        public GumpDons(NubiaPlayer _owner, NubiaPlayer _viewer)
            : base("Dons de " + _owner.Name, 640, 480)
        {
            m_owner  = _owner;
            m_viewer = _viewer;

            int y     = YBase;
            int x     = XBase;
            int line  = 0;
            int scale = 110;
            int decal = 30;

            int col      = 0;
            int coldecal = 310;

            int limit = 8;

            if (m_owner.Dons == null)
            {
                return;
            }

            int page = 1;


            AddPage(page);

            int nbrPage = (int)Math.Truncate((double)m_owner.Dons.DonsEntrys.Count - 1 / 8.0);

            //int dsup = 0;

            /* for (int i = -1; i < (int)ClasseType.Maximum; i++)
             * {
             *
             *   if (m_owner.DonCredits.ContainsKey((ClasseType)i))
             *   {
             *       if (m_owner.DonCredits[(ClasseType)i] > 0)
             *       {
             *           dsup += m_owner.DonCredits[(ClasseType)i];
             *       }
             *   }
             *
             * }*/
            /*  if (dsup > 0)
             * {
             *    AddButtonPageSuivante(x, y, 10);
             *    AddLabel(x + 50, y, ColorTextGreen, "Choisir un nouveau don");
             *    AddLabel(x + 200, y, ColorTextGray, "( " + dsup + " don" + (dsup > 1 ? "" : "s") + " à choisir )");
             * }*/
            if (nbrPage > 0)
            {
                //AddButton(x+500, y, 4014, 4015, 5, GumpButtonType.Page, page - 1);

                AddButton(x + 550, y, 4005, 4006, 6, GumpButtonType.Page, page + 1);
            }
            List <DonEnum> display = new List <DonEnum>();

            Console.WriteLine("Nombre de dons au total: " + m_owner.Dons.DonsEntrys.Count);
            for (int e = 0; e < m_owner.Dons.DonsEntrys.Count; e++)
            {
                DonEntry entry   = m_owner.Dons.DonsEntrys[e];
                DonEnum  donEnum = entry.Don;
                bool     canView = true;
                if (display.Contains(donEnum) && donEnum != DonEnum.DonSupClasse)
                {
                    canView = false;
                }
                if (entry.Don == DonEnum.DonSupClasse && entry.Choosen)
                {
                    canView = false;
                }
                // Console.WriteLine("Don: " + donEnum.ToString());
                if (canView)
                {
                    display.Add(donEnum);
                    BaseDon don = BaseDon.getDon(donEnum);
                    //  Console.WriteLine("Don entry: " + entry);
                    //   Console.WriteLine("Don: " + don);
                    int ly = y + line * scale + 30;
                    int lx = x + col * coldecal;


                    AddBackground(lx, ly, 300, 50, 9400);
                    AddLabel(lx + 5, ly + 2, ColorTextYellow, BaseDon.getDonName(donEnum));


                    int cd = 200;
                    if (entry.Classe > ClasseType.Roublard)
                    {
                        cd -= 55;
                    }
                    AddLabel(lx + 5 + cd, ly + 2, ColorTextLight, (entry.Classe == ClasseType.None ? "Général" : Classe.GetNameClasse(entry.Classe)));
                    AddLabel(lx + 5 + 250, ly + 2, ColorText, "Niv " + entry.GiveAtLevel.ToString());

                    AddBackground(lx, ly + 25, 300, 80, 9200);



                    if (entry.Don == DonEnum.DonSupClasse && !entry.Choosen)
                    {
                        //AddImage(lx + 10, ly + 40, 2277);
                        AddButton(lx + 10, ly + 40, 2277, 2277, (int)e + 100, GumpButtonType.Reply, 0);
                        String desc = "<BASEFONT COLOR=#EE0000>Choississez votre don en cliquant sur l'icone</BASEFONT>";

                        AddHtml(lx + 60, ly + 35, 235, 60, desc, true, true);
                    }
                    else if (don != null)
                    {
                        AddImage(lx + 10, ly + 40, don.Icone);
                        if (m_owner.Dons.getDonNiveau(donEnum) > 1)
                        {
                            AddLabel(lx + 10, ly + 80, ColorTextYellow, "Rang:" + m_owner.Dons.getDonNiveau(donEnum));
                        }
                        String desc = don.Description;
                        if (don.CanUse)
                        {
                            desc += "<br>(Utilisation: .don " + don.ToString() + ")";
                        }
                        AddHtml(lx + 60, ly + 35, 235, 60, desc, true, true);
                    }

                    line++;

                    if (line >= 4)
                    {
                        col++;
                        line = 0;
                    }
                    if (col > 1)
                    {
                        col  = 0;
                        line = 0;
                        page++;
                        AddPage(page);
                        AddButton(x + 500, y, 4014, 4015, 5, GumpButtonType.Page, page - 1);
                        if (nbrPage > page)
                        {
                            AddButton(x + 550, y, 4005, 4006, 6, GumpButtonType.Page, page + 1);
                        }
                    }
                }
            }
        }
Example #3
0
        public GumpNewDonChoix(NubiaPlayer _owner, ClasseType c, int niveauClasse, DonEnum donView, int page)
            : base("Dons de " + _owner.Name, 640, 480)
        {
            m_owner  = _owner;
            mDonView = donView;
            m_classe = c;
            m_niveau = niveauClasse;
            m_page   = page;

            int y     = YBase;
            int x     = XBase;
            int line  = 4;
            int scale = 25;
            int decal = 10;

            int col      = 0;
            int coldecal = 310;

            int limit = 16;

            if (m_owner.Dons == null)
            {
                return;
            }



            List <BaseDon> donDispo = new List <BaseDon> ();

            int nbrPage = BaseDon.DonBank.Values.Count / (limit * 2);

            if (page > 0)
            {
                AddButton(x + 500, y, 4014, 4015, 5, GumpButtonType.Reply, page - 1);
            }
            if (page < nbrPage)
            {
                AddButton(x + 550, y, 4005, 4006, 6, GumpButtonType.Reply, page + 1);
            }

            if (mDonView != DonEnum.DonSupClasse)
            {
                AddBackground(x, y, 300, 50, 9400);
                AddLabel(x + 5, y + 2, ColorTextYellow, BaseDon.getDonName(mDonView));


                int cd = 200;
                if (m_classe > ClasseType.Roublard)
                {
                    cd -= 55;
                }
                AddLabel(x + 5 + cd, y + 2, ColorTextLight, (m_classe == ClasseType.None ? "Général" : Classe.GetNameClasse(m_classe)));
                AddLabel(x + 5 + 250, y + 2, ColorText, "Niv " + m_niveau.ToString());

                AddBackground(x, y + 25, 300, 80, 9200);
                BaseDon don = BaseDon.getDon(mDonView);

                if (don != null)
                {
                    AddImage(x + 10, y + 40, don.Icone);
                    //  AddLabel(x + 10, y + 80, ColorTextYellow, "Rang:" + m_owner.Dons.getDonNiveau(don));
                    String desc = don.Description;
                    if (don.CanUse)
                    {
                        desc += "<br>(Utilisation: .don " + don.ToString() + ")";
                    }
                    AddHtml(x + 60, y + 35, 235, 60, desc, true, true);

                    if (don.hasConditions(m_owner))
                    {
                        AddButtonPageSuivante(x + coldecal, y, 9);
                        AddLabel(x + coldecal + 60, y, ColorTextYellow, "Apprendre ce don");
                    }
                }
            }


            if (c == ClasseType.None)
            {
                BaseDon[] donArray = new BaseDon[BaseDon.DonBank.Values.Count];
                BaseDon.DonBank.Values.CopyTo(donArray, 0);
                int mini  = page * limit * 2;
                int count = 0;
                for (int b = 0; b < donArray.Length; b++)
                {
                    BaseDon don = donArray[b];
                    if ((int)don.DType >= 1000 && !(m_owner.hasDon(don.DType) && don.AchatMax <= 1))
                    {
                        count++;
                        if (count < mini)
                        {
                            continue;
                        }
                        if (donDispo.Count < limit * 2)
                        {
                            donDispo.Add(don);
                        }
                        else
                        {
                            break;
                        }
                    }

                    /*  if (donDispo.Count > limit * 2)
                     *    break;*/
                }

                foreach (BaseDon d in donDispo)
                {
                    if (d != null)
                    {
                        addDonChoix(x + col * coldecal, decal + y + line * scale, d.DType, d.hasConditions(m_owner));
                        if (line > limit)
                        {
                            line = 0;
                            col++;
                            if (col >= 2)
                            {
                                break;
                            }
                        }
                        line++;
                    }
                }
            }
            else
            {
                DonEnum[] enumlist = m_owner.getClasse(m_classe).getCustomDon(m_owner, m_niveau);
                BaseDon[] donArray = new BaseDon[enumlist.Length];


                int mini  = page * limit * 2;
                int count = 0;
                for (int b = 0; b < enumlist.Length; b++)
                {
                    BaseDon don = BaseDon.getDon(enumlist[b]);
                    if (don == null)
                    {
                        continue;
                    }

                    if ((int)don.DType >= 1000 && !(m_owner.hasDon(don.DType) && don.AchatMax <= 1))
                    {
                        count++;
                        if (count < mini)
                        {
                            continue;
                        }
                        if (donDispo.Count < limit * 2)
                        {
                            donDispo.Add(don);
                        }
                        else
                        {
                            break;
                        }


                        count++;
                    }

                    /*  if (donDispo.Count > limit * 2)
                     *    break;*/
                }

                foreach (BaseDon d in donDispo)
                {
                    if (d != null)
                    {
                        addDonChoix(x + col * coldecal, decal + y + line * scale, d.DType, d.hasConditions(m_owner));
                        if (line > limit)
                        {
                            line = 0;
                            col++;
                            if (col >= 2)
                            {
                                break;
                            }
                        }
                        line++;
                    }
                }
            }
        }