Пример #1
0
        public void CheckPlantation(NubiaPlayer from)
        {
            NubiaCompetence comp = from.Competences[CompType.Agriculture];

            if (comp.getPureMaitrise() <= DD / 4)
            {
                from.SendMessage("Cette plante nessecite minimum {0} de connaissance en agriculture", DD);
                return;
            }
            int diff = 40 + (DD / 2);

            if (diff > 90)
            {
                diff = 90;
            }

            int roll = comp.intRoll();

            bool terrainOk = false;

            if (Terrain == EnumPlanteTerrain.Ferme)
            {
                if (ValidateFarmLand(from.Map, from.X, from.Y))
                {
                    terrainOk = true;
                }
                else
                {
                    from.SendMessage("Vous devez planter cette graine dans une ferme");
                }
            }
            else if (Terrain == EnumPlanteTerrain.Marais)
            {
                if (ValidateSpawnLand(from.Map, from.X, from.Y))
                {
                    terrainOk = true;
                }
                else
                {
                    from.SendMessage("Vous devez planter cette graine dans un marais");
                }
            }
            else if (Terrain == EnumPlanteTerrain.Sable)
            {
                if (ValidateSandLand(from.Map, from.X, from.Y))
                {
                    terrainOk = true;
                }
                else
                {
                    from.SendMessage("Vous devez planter cette graine dans un désert");
                }
            }
            else if (Terrain == EnumPlanteTerrain.Cadavre)
            {
                if (ValidateCorpseLand(from.Map, from.X, from.Y))
                {
                    terrainOk = true;
                }
                else
                {
                    from.SendMessage("Vous devez planter cette graine dans un cadavre");
                }
            }

            if (terrainOk)
            {
                PlanteGraine(roll, from);
            }
        }
Пример #2
0
        private GumpCompetences(NubiaPlayer _owner, NubiaPlayer _viewer, bool _showcap)
            : base("Competences de " + _owner.Name, 540, 400, 260)
        {
            Closable = true;
            mOwner   = _owner;
            mViewer  = _viewer;
            showCap  = _showcap;
            int y     = YBase;
            int x     = XBase;
            int line  = 0;
            int scale = 22;
            int decal = 5;

            AddLabel(x, line * scale + y, ColorTextLight, "Pts d'achats: " + mOwner.getAchats() + "/" + mOwner.getAchatCap());
            line++;
            if (showCap)
            {
                AddButton(x, line * scale + y, 211, 210, 5, GumpButtonType.Reply, 0);
            }
            else
            {
                AddButton(x, line * scale + y, 210, 211, 5, GumpButtonType.Reply, 0);
            }
            AddLabel(x + 20, line * scale + y, ColorText, "Voir les maximales");
            line++;

            for (int i = 0; i < (int)CompType.Maximum; i++)
            {
                NubiaCompetence com = mOwner.Competences[(CompType)i];
                if (!(com is NullCompetence))
                {
                    int colComp = ColorTextGray;
                    if (com.Achat > 0)
                    {
                        colComp = ColorText;
                    }
                    if (com.isCompetenceClasse)
                    {
                        colComp = ColorTextYellow;
                    }

                    if (mOwner.getAchats() < mOwner.getAchatCap() && mViewer == mOwner && com.canRaise())
                    {
                        AddSimpleButton(x, y + line * scale, 50 + i, com.Name, colComp);
                    }
                    else
                    {
                        AddLabel(x, y + line * scale, colComp, com.Name);
                    }

                    AddImage(x + 150, line * scale + y - 3, 2445);

                    int colval = ColorText;
                    if (com.Achat > 0)
                    {
                        colval = ColorTextLight;
                    }

                    if (showCap)
                    {
                        AddLabel(x + 190, y + line * scale, colval, com.getMaitrise().ToString());
                        AddLabel(x + 220, y + line * scale, colval, "/ " + com.getCap().ToString());
                    }
                    else
                    {
                        if (com.Achat > 0)
                        {
                            AddLabel(x + 165, y + line * scale, ColorTextGray, com.Achat.ToString());
                        }


                        string symbol   = "";
                        double maitrise = com.getMaitrise();
                        if (maitrise > 0)
                        {
                            symbol = "+";
                        }
                        int synergie = (int)(maitrise - com.getPureMaitrise());
                        AddLabel(x + 190, y + line * scale, colval, symbol + maitrise.ToString());
                        if (synergie > 0)
                        {
                            AddLabel(x + 220, y + line * scale, ColorTextGreen, "(+" + synergie + ")");
                        }
                    }
                    line++;
                }
                if (Hauteur < scale * line + scale && x == XBase)
                {
                    x    = XCol;
                    line = 0;
                }
            }
        }