예제 #1
0
        public void PlanteGraine(int roll, NubiaPlayer from)
        {
            bool can = true;

            foreach (Item item in from.GetItemsInRange(0))
            {
                if (item is BasePlante)
                {
                    can = false;
                }
            }
            if (!can)
            {
                from.SendMessage("les racines d'une plante autre plante sont déjà plantées à proximité !");
                return;
            }
            else
            {
                if (Amount <= 1)
                {
                    MoveToWorld(from.Location, from.Map);
                    Movable      = false;
                    m_State      = EnumPlanteState.GrainePlante;
                    m_rollResult = roll;
                    Visible      = false;
                    new InternalTimer(this).Start();
                }
                else
                {
                    Amount--;
                    Type       type   = this.GetType();
                    BasePlante plante = (BasePlante)Activator.CreateInstance(type);
                    plante.Amount = 1;
                    plante.MoveToWorld(from.Location, from.Map);
                    plante.Movable     = false;
                    plante.State       = EnumPlanteState.GrainePlante;
                    plante.PRollResult = roll;
                    plante.Visible     = false;
                    plante.StartTimer();
                }
                UpdateLook();
                from.Emote("*Plante*");
            }
        }
예제 #2
0
            public InternalTimer(BasePlante plante) : base(TimeSpan.FromHours(1))
            {
                Priority = TimerPriority.OneMinute;

                m_BasePlante = plante;
            }
예제 #3
0
        public override void OnDoubleClick(Mobile f)
        {
            NubiaPlayer from = f as NubiaPlayer;

            if (!from.InRange(this.GetWorldLocation(), 1))
            {
                from.SendMessage("C'est trop loin");
                return;
            }

            if (m_State == EnumPlanteState.Graine)
            {
                CheckPlantation(from);
            }
            else if (m_State == EnumPlanteState.GrainePlante)
            {
                from.Emote("*Ecrase la graine*");
                this.Delete();
            }
            else if (m_State == EnumPlanteState.Naissante)
            {
                from.Emote("*Saccage la plante*");
                this.Delete();
            }
            else if (m_State == EnumPlanteState.Jeune)
            {
                int rollGraine = from.Competences[CompType.Agriculture].intRoll();
                if (rollGraine <= DD)
                {
                    from.Emote("*Saccage la plante*");
                    this.Delete();
                }
                else
                {
                    from.Emote("*Cueille et récupère les graines*");
                    Type       type   = this.GetType();
                    BasePlante plante = (BasePlante)Activator.CreateInstance(type);
                    int        amount = (int)rollGraine / 5;
                    if (amount < 1)
                    {
                        amount = 1;
                    }
                    from.SendMessage("Vous récupérez {0} graines", amount);
                    plante.Amount = amount;
                    plante.Hue    = Hue;
                    if (from.Backpack != null)
                    {
                        from.Backpack.DropItem(plante);
                    }
                }
            }
            else if (m_State == EnumPlanteState.Mature)
            {
                int rollRecolte = from.Competences[CompType.Agriculture].intRoll();
                if (rollRecolte <= DD)
                {
                    from.Emote("*Saccage la plante*");
                    this.Delete();
                }
                else
                {
                    from.Emote("*Récolte*");
                    Item item = AgriHelper.GetRecolteItem(m_Plante);
                    if (item == null)
                    {
                        NubiaRecolte plante = new NubiaRecolte(m_Plante, rollRecolte, CanEat);
                        plante.Hue = Hue;
                        if (from.Backpack != null)
                        {
                            from.Backpack.DropItem(plante);
                        }
                    }
                    else
                    {
                        if (item.Stackable && (int)m_rollResult > 1)
                        {
                            item.Amount = (int)m_rollResult;
                        }
                        if (from.Backpack != null)
                        {
                            from.Backpack.DropItem(item);
                        }
                    }
                    this.Delete();
                }
            }
            else if (m_State == EnumPlanteState.Pourri)
            {
                from.Emote("*Déffriche*");
                this.Delete();
            }
        }