Exemple #1
0
 private void addDonChoix(int x, int y, DonEnum don, bool dispo)
 {
     if (mDonView == don)
     {
         AddImage(x + 10, y, 2153);
     }
     else if (dispo)
     {
         AddButton(x + 10, y, 2151, 2152, (int)don + 100, GumpButtonType.Reply, 0);
     }
     else
     {
         AddButton(x + 10, y, 2472, 2473, (int)don + 100, GumpButtonType.Reply, 0);
     }
     AddLabel(x + 45, y, ColorText, BaseDon.getDonName(don));
 }
Exemple #2
0
        public override void OnResponse(NetState sender, RelayInfo info)
        {
            Mobile      f    = sender.Mobile;
            NubiaPlayer from = f as NubiaPlayer;

            int id = info.ButtonID;

            if (id == 5)
            {
                from.SendGump(new GumpNewDonChoix(from, m_classe, m_niveau, (DonEnum)(mDonView), --m_page));
            }
            else if (id == 6)
            {
                from.SendGump(new GumpNewDonChoix(from, m_classe, m_niveau, (DonEnum)(mDonView), ++m_page));
            }
            else if (id > 100)
            {
                from.SendGump(new GumpNewDonChoix(from, m_classe, m_niveau, (DonEnum)(id - 100), m_page));
            }
            else if (id == 9)
            {
                from.Dons.DonsEntrys.Add(new DonEntry(mDonView, m_classe, m_niveau, true));
                for (int d = 0; d < from.Dons.DonsEntrys.Count; d++)
                {
                    DonEntry entry = from.Dons.DonsEntrys[d];
                    if (entry.Don == DonEnum.DonSupClasse && entry.GiveAtLevel == m_niveau && entry.Classe == m_classe)
                    {
                        entry.Choosen = true;
                        break;
                    }
                }
                from.Dons.ComputeDons();
                from.SendMessage("Vous avez appri le don {0}", BaseDon.getDonName(mDonView));
                from.SendGump(new GumpDons(m_owner, m_owner));
            }
        }
Exemple #3
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);
                        }
                    }
                }
            }
        }
Exemple #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++;
                    }
                }
            }
        }