Пример #1
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);
 }
Пример #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);
        }