Exemple #1
0
        public static bool regrowWeeds(Patch patch)
        {
            bool shouldRemoveFromList = false;

            if (!patch.patchOccupied())
            {
                if (Misc.random(4) != 0 || patch.isWeeding())
                {
                    return(false);
                }
                Player owner = Server.getPlayerForName(patch.getOwnerName());
                patch.setHasWeeds(true);
                patch.setStatus(patch.getStatus() - 1);
                if (patch.getStatus() <= -1)
                {
                    patch.setStatus(0);
                    shouldRemoveFromList = true;
                }
                if (owner != null)
                {
                    setConfig(owner, patch);
                }
            }
            return(shouldRemoveFromList);
        }
Exemple #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);
        }
Exemple #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);
 }
Exemple #4
0
 public static bool regrowWeeds(Patch patch)
 {
     bool shouldRemoveFromList = false;
     if (!patch.patchOccupied())
     {
         if (Misc.random(4) != 0 || patch.isWeeding())
         {
             return false;
         }
         Player owner = Server.getPlayerForName(patch.getOwnerName());
         patch.setHasWeeds(true);
         patch.setStatus(patch.getStatus() - 1);
         if (patch.getStatus() <= -1)
         {
             patch.setStatus(0);
             shouldRemoveFromList = true;
         }
         if (owner != null)
         {
             setConfig(owner, patch);
         }
     }
     return shouldRemoveFromList;
 }