예제 #1
0
 private static int getAnimation(Bow item)
 {
     if (item.isStringing())
     {
         return(item.getItemType() == 0 ? 6678 + item.getLogType() : 6684 + item.getLogType());
     }
     return(item.getLogType() == 5 ? 7211 : 1248);
 }
예제 #2
0
        public static void cutLog(Player p, int amount, int logType, int itemType, bool isStringing, bool newFletch)
        {
            Bow item = null;

            if (newFletch)
            {
                item = getBow(itemType, logType, amount, isStringing);
                Fletching.setFletchItem(p, item);
            }
            item = (Bow)Fletching.getFletchItem(p);
            if (item == null || p == null)
            {
                return;
            }
            bool stringing = item.isStringing();

            if (!canFletch(p, item, stringing))
            {
                p.getPackets().closeInterfaces();
                return;
            }
            int animation = getAnimation(item);

            if (!stringing)
            {
                int amt = item.getItemType() == 2 ? ARROW_AMOUNT : 1;
                if (p.getInventory().deleteItem(LOGS[item.getLogType()]))
                {
                    p.getInventory().addItem(item.getFinishedItem(), amt);
                    p.getSkills().addXp(Skills.SKILL.FLETCHING, item.getXp());
                    item.decreaseAmount();
                    p.getPackets().sendMessage("You carefully cut the wood into " + MESSAGE[item.getItemType()] + ".");
                    p.setLastAnimation(new Animation(animation));
                }
            }
            else
            {
                int[] bows = item.getItemType() == 0 ? UNSTRUNG_SHORTBOW : UNSTRUNG_LONGBOW;
                if (p.getInventory().deleteItem(BOWSTRING) && p.getInventory().deleteItem(bows[item.getLogType()]))
                {
                    p.getInventory().addItem(item.getFinishedItem());
                    p.getSkills().addXp(Skills.SKILL.FLETCHING, item.getXp());
                    item.decreaseAmount();
                    p.getPackets().sendMessage("You add a string to the bow.");
                    p.setLastAnimation(new Animation(animation));
                }
            }
            p.getPackets().closeInterfaces();
            if (item.getAmount() >= 1)
            {
                Event cutMoreLogsEvent = new Event(1500);
                cutMoreLogsEvent.setAction(() => {
                    cutLog(p, -1, -1, -1, false, false);
                    cutMoreLogsEvent.stop();
                });
                Server.registerEvent(cutMoreLogsEvent);
            }
        }
예제 #3
0
 private static int getAnimation(Bow item)
 {
     if (item.isStringing()) {
         return item.getItemType() == 0 ? 6678 + item.getLogType() : 6684 + item.getLogType();
     }
     return item.getLogType() == 5 ? 7211 : 1248;
 }