Пример #1
0
 private static bool canCut(Player p, Tree tree, Tree tree2)
 {
     if (tree == null || p == null || !Server.getGlobalObjects().originalObjectExists(tree.getTreeId(), tree.getTreeLocation()))
     {
         return(false);
     }
     if (!p.getLocation().withinDistance(tree.getTreeLocation(), tree.getDistance()))
     {
         return(false);
     }
     if (tree2 != null)
     {
         if (!tree.Equals(tree2))
         {
             return(false);
         }
     }
     if (p.getSkills().getGreaterLevel(Skills.SKILL.WOODCUTTING) < tree.getLevel())
     {
         p.getPackets().sendMessage("You need a Woodcutting level of " + tree.getLevel() + " to cut that tree.");
         return(false);
     }
     if (!hasAxe(p))
     {
         p.getPackets().sendMessage("You need an axe to cut down a tree!");
         return(false);
     }
     if (p.getInventory().findFreeSlot() == -1)
     {
         p.getPackets().sendChatboxInterface(210);
         p.getPackets().modifyText("Your inventory is too full to carry any logs.", 210, 1);
         return(false);
     }
     return(true);
 }
Пример #2
0
 private static bool canCut(Player p, Tree tree, Tree tree2)
 {
     if (tree == null || p == null || !Server.getGlobalObjects().originalObjectExists(tree.getTreeId(), tree.getTreeLocation()))
     {
         return false;
     }
     if (!p.getLocation().withinDistance(tree.getTreeLocation(), tree.getDistance()))
     {
         return false;
     }
     if (tree2 != null)
     {
         if (!tree.Equals(tree2))
         {
             return false;
         }
     }
     if (p.getSkills().getGreaterLevel(Skills.SKILL.WOODCUTTING) < tree.getLevel())
     {
         p.getPackets().sendMessage("You need a Woodcutting level of " + tree.getLevel() + " to cut that tree.");
         return false;
     }
     if (!hasAxe(p))
     {
         p.getPackets().sendMessage("You need an axe to cut down a tree!");
         return false;
     }
     if (p.getInventory().findFreeSlot() == -1)
     {
         p.getPackets().sendChatboxInterface(210);
         p.getPackets().modifyText("Your inventory is too full to carry any logs.", 210, 1);
         return false;
     }
     return true;
 }