示例#1
0
 public override void OnThink()
 {
     if (this.Region.IsPartOf(typeof(HouseRegion)))
     {
         m_NextUse = DateTime.UtcNow + TimeSpan.FromSeconds(2.5);
     }
     else if (this.Alive && this.m_Mine && this.m_NextUse <= DateTime.UtcNow && Loyalty > 50)
     {
         Container backpack = this.Backpack;
         if (backpack == null)
         {
             m_NextUse = DateTime.UtcNow + TimeSpan.FromSeconds(2.5); base.OnThink(); return;
         }
         if (backpack.TotalWeight >= backpack.MaxWeight || backpack.TotalItems >= backpack.MaxItems)
         {
             m_NextUse = DateTime.UtcNow + TimeSpan.FromSeconds(2.5); base.OnThink(); return;
         }
         IBShovel ibshovel = (IBShovel)backpack.FindItemByType(typeof(IBShovel));
         //Shovel shovel = (Shovel)backpack.FindItemByType(typeof(Shovel));
         if (ibshovel != null)
         {
             if (this.DoDisposeOre(this.X, this.Y, this.Z, this.Map, this))
             {
                 ibshovel.UsesRemaining -= 1;
                 if (ibshovel != null && !ibshovel.Deleted && ibshovel.UsesRemaining <= 0)
                 {
                     ibshovel.Delete();
                 }
             }
         }
         else if (ibshovel != null)
         {
             if (this.DoDisposeOre(this.X, this.Y, this.Z, this.Map, this))
             {
                 ibshovel.UsesRemaining -= 1;
                 if (ibshovel != null && !ibshovel.Deleted && ibshovel.UsesRemaining <= 0)
                 {
                     ibshovel.Delete();
                 }
             }
         }
         m_NextUse = DateTime.UtcNow + TimeSpan.FromSeconds(2.5);
     }
     base.OnThink();
 }
示例#2
0
        public override void OnThink()
        {
            if (this.Alive && this.m_Mine && this.m_NextUse <= DateTime.Now)
            {
                Container backpack = this.Backpack;

                if (backpack == null)
                {
                    m_NextUse = DateTime.Now + TimeSpan.FromSeconds(2.5); base.OnThink(); return;
                }
                if (backpack.TotalWeight > (backpack.MaxWeight - 100))
                {
                    this.Say("I'm full !! I'm AutoConverting Ore in Ingot !"); m_Mine = true; this.Hue = 0; ControlOrder = OrderType.Stay; ConvertOretoIngot(this);  base.OnThink(); return;
                }

                Shovel   shovel1 = (Shovel)backpack.FindItemByType(typeof(Shovel));
                Pickaxe  shovel2 = (Pickaxe)backpack.FindItemByType(typeof(Pickaxe));
                IBShovel shovel3 = (IBShovel)backpack.FindItemByType(typeof(IBShovel));


                if (shovel1 != null)
                {
                    if (this.DoDisposeOre(this.X, this.Y, this.Z, this.Map, this))
                    {
                        shovel1.UsesRemaining -= 1;
                        if (shovel1 != null && !shovel1.Deleted && shovel1.UsesRemaining <= 0)
                        {
                            shovel1.Delete();
                        }
                    }
                }

                if (shovel2 != null)
                {
                    if (this.DoDisposeOre(this.X, this.Y, this.Z, this.Map, this))
                    {
                        shovel2.UsesRemaining -= 1;
                        if (shovel2 != null && !shovel2.Deleted && shovel2.UsesRemaining <= 0)
                        {
                            shovel2.Delete();
                        }
                    }
                }

                if (shovel3 != null)
                {
                    if (this.DoDisposeOre(this.X, this.Y, this.Z, this.Map, this))
                    {
                        shovel3.UsesRemaining -= 1;
                        if (shovel3 != null && !shovel3.Deleted && shovel3.UsesRemaining <= 0)
                        {
                            shovel3.Delete();
                        }
                    }
                }

                m_NextUse = DateTime.Now + TimeSpan.FromSeconds(2.5);

                if ((shovel1 == null) && (shovel2 == null) && (shovel3 == null))
                {
                    this.Say("I require a tool to dig");
                    m_Mine       = false;
                    this.Hue     = 0;
                    ControlOrder = OrderType.Follow;
                }

                IronIngot iron1 = (IronIngot)backpack.FindItemByType(typeof(IronIngot));
                if (iron1 is BaseIngot)
                {
                    BaseIngot m_Ore1 = iron1 as BaseIngot;

                    if (m_Ore1.Amount > 1000)
                    {
                        SendIronIngot(this);
                    }
                }

                DullcopperIngot dull1 = (DullcopperIngot)backpack.FindItemByType(typeof(DullcopperIngot));
                if (dull1 is BaseIngot)
                {
                    BaseIngot m_Ore2 = dull1 as BaseIngot;

                    if (m_Ore2.Amount > 1000)
                    {
                        SendDullCopperIngot(this);
                    }
                }

                ShadowIngot shad1 = (ShadowIngot)backpack.FindItemByType(typeof(ShadowIngot));
                if (shad1 is BaseIngot)
                {
                    BaseIngot m_Ore3 = shad1 as BaseIngot;

                    if (m_Ore3.Amount > 1000)
                    {
                        SendShadowIronIngot(this);
                    }
                }

                BronzeIngot bron1 = (BronzeIngot)backpack.FindItemByType(typeof(BronzeIngot));
                if (bron1 is BaseIngot)
                {
                    BaseIngot m_Ore4 = bron1 as BaseIngot;

                    if (m_Ore4.Amount > 1000)
                    {
                        SendBronzeIngot(this);
                    }
                }

                GoldIngot gold1 = (GoldIngot)backpack.FindItemByType(typeof(GoldIngot));
                if (gold1 is BaseIngot)
                {
                    BaseIngot m_Ore5 = gold1 as BaseIngot;

                    if (m_Ore5.Amount > 1000)
                    {
                        SendGoldIngot(this);
                    }
                }

                CopperIngot copp1 = (CopperIngot)backpack.FindItemByType(typeof(CopperIngot));
                if (copp1 is BaseIngot)
                {
                    BaseIngot m_Ore6 = copp1 as BaseIngot;

                    if (m_Ore6.Amount > 1000)
                    {
                        SendCopperIngot(this);
                    }
                }

                AgapiteIngot agap1 = (AgapiteIngot)backpack.FindItemByType(typeof(AgapiteIngot));
                if (agap1 is BaseIngot)
                {
                    BaseIngot m_Ore7 = agap1 as BaseIngot;

                    if (m_Ore7.Amount > 1000)
                    {
                        SendAgapiteIngot(this);
                    }
                }

                VeriteIngot veri1 = (VeriteIngot)backpack.FindItemByType(typeof(VeriteIngot));
                if (veri1 is BaseIngot)
                {
                    BaseIngot m_Ore8 = veri1 as BaseIngot;

                    if (m_Ore8.Amount > 1000)
                    {
                        SendVeriteIngot(this);
                    }
                }

                ValoriteIngot valo1 = (ValoriteIngot)backpack.FindItemByType(typeof(ValoriteIngot));
                if (valo1 is BaseIngot)
                {
                    BaseIngot m_Ore9 = valo1 as BaseIngot;

                    if (m_Ore9.Amount > 1000)
                    {
                        SendValoriteIngot(this);
                    }
                }
            }
            base.OnThink();
        }