コード例 #1
0
 private static int getArrowAmount(Player p, Ammo item)
 {
     if (item == null || p == null) {
         return 0;
     }
     int amt = item.isBolt() ? 12 : 15;
     int itemOneAmount = p.getInventory().getItemAmount(item.getItemOne());
     int itemTwoAmount = p.getInventory().getItemAmount(item.getItemTwo());
     int lowestStack = itemOneAmount > itemTwoAmount ? itemTwoAmount : itemOneAmount;
     int finalAmount = lowestStack > amt ? amt : lowestStack;
     return finalAmount;
 }
コード例 #2
0
 private static string getMessage(Ammo item, int amount)
 {
     string s = amount > 1 ? "s" : "";
     string s1 = amount > 1 ? "some" : "a";
     string s2 = amount > 1 ? "some" : "an";
     if (!item.isBolt()) {
         s = amount > 1 ? "s" : "";
         s1 = amount > 1 ? "some" : "a";
         s2 = amount > 1 ? "some" : "an";
         if (item.getItemType() == 0) {
             return "You attach Feathers to " + s1 + " of your Arrow shafts, you make " + amount + " " + ItemData.forId(item.getFinishedItem()).getName() + s + ".";
         } else {
             return "You attach " + s2 + " Arrowtip" + s + " to " + s1 + " Headless arrow" + s + ", you make " + amount + " " + ItemData.forId(item.getFinishedItem()).getName() + s + ".";
         }
     } else {
         s = amount > 1 ? "s" : "";
         s1 = amount > 1 ? "some of your bolts" : "a bolt";
         s2 = amount > 1 ? "some" : "a";
         if (item.getItemType() < 8) {
             return "You attach Feathers to " + s1 + ", you make " + amount + " " + ItemData.forId(item.getFinishedItem()).getName()+".";
         } else {
             s = amount > 1 ? "s" : "";
             s2 = amount > 1 ? "some" : "a";
             return "You attach " + s2 + " bolt tip" + s + " to " + s2 + " headless bolt" + s + ", you make " + amount + " " + ItemData.forId(item.getFinishedItem()).getName() + ".";
         }
     }
 }
コード例 #3
0
 private static bool canFletch(Player p, Ammo item)
 {
     if (item == null || item.getAmount() <= 0) {
         return false;
     }
     string s = item.getItemOne() == HEADLESS_ARROW ? "s." : ".";
     string s1 = item.getItemTwo() == HEADLESS_ARROW ? "s." : ".";
     if (p.getSkills().getGreaterLevel(Skills.SKILL.FLETCHING) < item.getLevel()) {
         p.getPackets().sendMessage("You need a Fletching level of " + item.getLevel() + " to make that.");
         return false;
     }
     if (!p.getInventory().hasItem(item.getItemOne())) {
         p.getPackets().sendMessage("You don't have any " + ItemData.forId(item.getItemOne()).getName() + s);
         return false;
     }
     if (!p.getInventory().hasItem(item.getItemTwo())) {
         p.getPackets().sendMessage("You don't have any " + ItemData.forId(item.getItemTwo()).getName() + s1);
         return false;
     }
     return true;
 }