Пример #1
0
        private static void chopFruitTree(Player p, Patch patch)
        {
            if (!Woodcutting.hasAxe(p))
            {
                p.getPackets().sendMessage("You don't have an axe.");
                return;
            }
            patch.setWeeding(true); // prevents it from growing which makes me rage
            p.setLastAnimation(new Animation(Woodcutting.getAxeAnimation(p)));
            p.setTemporaryAttribute("harvesting", true);
            Event chopFruitTreeEvent = new Event(2550);

            chopFruitTreeEvent.setAction(() =>
            {
                if (p.getTemporaryAttribute("harvesting") != null)
                {
                    patch.setStatus(patch.stumpStatus());
                    setConfig(p, patch);
                }
                chopFruitTreeEvent.stop();
                patch.setWeeding(false);
            });
            Server.registerEvent(chopFruitTreeEvent);
        }
Пример #2
0
        public static void growPatch(Patch patch)
        {
            if (patch.isTree())
            {
                if (patch.getStatus() == patch.checkHealthStatus())
                {
                    if (!patch.isHealthChecked())
                    {
                        return;
                    }
                }
                else if (patch.getStatus() == patch.chopStatus())
                {
                    return;
                }
                else if (patch.getStatus() == patch.stumpStatus())
                {
                    patch.setStatus(patch.chopStatus());
                }
                else
                {
                    patch.setStatus(patch.getStatus() + 1);
                }
            }
            else if (patch.isFruitTree())
            {
                if (patch.isWeeding())
                {
                    return;
                }
                if (patch.getStatus() == patch.checkHealthStatus())
                {
                    if (!patch.isHealthChecked())
                    {
                        return;
                    }
                }
                if (patch.isHealthChecked())
                {
                    if (patch.getStatus() == patch.checkHealthStatus() - 1)
                    { // all fruit
                        return;
                    }
                }
                if (patch.getStatus() == patch.stumpStatus())
                {
                    patch.setStatus(patch.chopStatus());
                }
                else if (patch.getStatus() == patch.chopStatus())
                {
                    patch.setStatus(6);
                }
                else
                {
                    patch.setStatus(patch.getStatus() + 1);
                }
            }
            else
            {
                patch.setStatus(patch.getStatus() + 1);
            }
            Player owner = Server.getPlayerForName(patch.getOwnerName());

            if (owner != null)
            {
                setConfig(owner, patch);
            }
            patch.setLastUpdate(Environment.TickCount);
        }
Пример #3
0
 public static void growPatch(Patch patch)
 {
     if (patch.isTree())
     {
         if (patch.getStatus() == patch.checkHealthStatus())
         {
             if (!patch.isHealthChecked())
             {
                 return;
             }
         }
         else if (patch.getStatus() == patch.chopStatus())
         {
             return;
         }
         else if (patch.getStatus() == patch.stumpStatus())
         {
             patch.setStatus(patch.chopStatus());
         }
         else
         {
             patch.setStatus(patch.getStatus() + 1);
         }
     }
     else if (patch.isFruitTree())
     {
         if (patch.isWeeding())
         {
             return;
         }
         if (patch.getStatus() == patch.checkHealthStatus())
         {
             if (!patch.isHealthChecked())
             {
                 return;
             }
         }
         if (patch.isHealthChecked())
         {
             if (patch.getStatus() == patch.checkHealthStatus() - 1)
             { // all fruit
                 return;
             }
         }
         if (patch.getStatus() == patch.stumpStatus())
         {
             patch.setStatus(patch.chopStatus());
         }
         else if (patch.getStatus() == patch.chopStatus())
         {
             patch.setStatus(6);
         }
         else
         {
             patch.setStatus(patch.getStatus() + 1);
         }
     }
     else
     {
         patch.setStatus(patch.getStatus() + 1);
     }
     Player owner = Server.getPlayerForName(patch.getOwnerName());
     if (owner != null)
     {
         setConfig(owner, patch);
     }
     patch.setLastUpdate(Environment.TickCount);
 }
Пример #4
0
 private static void chopFruitTree(Player p, Patch patch)
 {
     if (!Woodcutting.hasAxe(p))
     {
         p.getPackets().sendMessage("You don't have an axe.");
         return;
     }
     patch.setWeeding(true); // prevents it from growing which makes me rage
     p.setLastAnimation(new Animation(Woodcutting.getAxeAnimation(p)));
     p.setTemporaryAttribute("harvesting", true);
     Event chopFruitTreeEvent = new Event(2550);
     chopFruitTreeEvent.setAction(() =>
     {
         if (p.getTemporaryAttribute("harvesting") != null)
         {
             patch.setStatus(patch.stumpStatus());
             setConfig(p, patch);
         }
         chopFruitTreeEvent.stop();
         patch.setWeeding(false);
     });
     Server.registerEvent(chopFruitTreeEvent);
 }