コード例 #1
0
ファイル: ClasseArtisan.cs プロジェクト: bsenyuva/terranubia3
        public override DonEnum[] getCustomDon(NubiaPlayer p, int niveau)
        {
            List <DonEnum> list = new List <DonEnum>();

            for (int d = (int)DonEnum.AffiniteMagique; d < (int)DonEnum.Maximum; d++)
            {
                if (BaseDon.DonBank.ContainsKey(((DonEnum)d).ToString().ToLower()))
                {
                    BaseDon don = BaseDon.DonBank[((DonEnum)d).ToString().ToLower()];
                    if (don.hasConditions(p))
                    {
                        list.Add(don.DType);
                    }
                }
            }
            return(list.ToArray());
        }
コード例 #2
0
        public virtual DonEnum[] getCustomDon(NubiaPlayer p, int niveau)
        {
            List <DonEnum> list = new List <DonEnum>();

            for (int d = (int)DonEnum.AffiniteMagique; d < (int)DonEnum.Maximum; d++)
            {
                //     Console.WriteLine("Don de custom: " + (DonEnum)d);
                if (BaseDon.DonBank.ContainsKey(((DonEnum)d).ToString().ToLower()))
                {
                    BaseDon don = BaseDon.DonBank[((DonEnum)d).ToString().ToLower()];
                    //     Console.WriteLine("Don de la bank: " + don.ToString());
                    if (don.hasConditions(p))
                    {
                        list.Add(don.DType);
                    }
                }
            }
            return(list.ToArray());
        }
コード例 #3
0
        public override DonEnum[] getCustomDon(NubiaPlayer p, int niveau)
        {
            List <DonEnum> list = new List <DonEnum>();

            if (niveau == 1)
            {
                return(new DonEnum[] { DonEnum.MageIntel, DonEnum.MageSagesse, DonEnum.MageCharisme });
            }
            else
            {
                for (int d = (int)DonEnum.AffiniteMagique; d < (int)DonEnum.Maximum; d++)
                {
                    if (BaseDon.DonBank.ContainsKey(((DonEnum)d).ToString()))
                    {
                        BaseDon don = BaseDon.DonBank[((DonEnum)d).ToString()];
                        if (don.hasConditions(p))
                        {
                            list.Add(don.DType);
                        }
                    }
                }
            }
            return(list.ToArray());
        }
コード例 #4
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++;
                    }
                }
            }
        }