当前位置: 首页>>代码示例>>C#>>正文


C# Player.getPackets方法代码示例

本文整理汇总了C#中Player.getPackets方法的典型用法代码示例。如果您正苦于以下问题:C# Player.getPackets方法的具体用法?C# Player.getPackets怎么用?C# Player.getPackets使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Player的用法示例。


在下文中一共展示了Player.getPackets方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: createAmmo

 public static void createAmmo(Player p, int sets, int type, bool bolt, bool newFletch)
 {
     Ammo item = null;
     if (newFletch || Fletching.getFletchItem(p) == null) {
         item = getAmmo(type, bolt, sets);
         Fletching.setFletchItem(p, item);
     }
     item = (Ammo) Fletching.getFletchItem(p);
     if (item == null || p == null) {
         return;
     }
     if (!canFletch(p, item)) {
         p.getPackets().closeInterfaces();
         return;
     }
     int amt = getArrowAmount(p, item);
     if (amt <= 0) {
         return;
     }
     if (p.getInventory().deleteItem(item.getItemOne(), amt) && p.getInventory().deleteItem(item.getItemTwo(), amt)) {
         p.getInventory().addItem(item.getFinishedItem(), amt);
         p.getSkills().addXp(Skills.SKILL.FLETCHING, item.getXp() * amt);
         p.getPackets().sendMessage(getMessage(item, amt));
         item.decreaseAmount();
         p.getPackets().closeInterfaces();
     }
     if (item.getAmount() >= 1) {
         Event createMoreAmmoEvent = new Event(1500);
         createMoreAmmoEvent.setAction(() => {
             createAmmo(p, -1, -1, false, false);
             createMoreAmmoEvent.stop();
         });
         Server.registerEvent(createMoreAmmoEvent);
     }
 }
开发者ID:slapglif,项目名称:runescape-server-csharp,代码行数:35,代码来源:MakeAmmo.cs

示例2: vengeance

 private static void vengeance(Player p, int id)
 {
     if (id == 14) { // Normal vengeance
         if (!p.getInventory().hasItemAmount(560, 2) || !p.getInventory().hasItemAmount(557, 10) || !p.getInventory().hasItemAmount(9075, 4)) {
             p.getPackets().sendMessage("You do not have enough runes to cast Vengeance!");
             return;
         }
         if (p.hasVengeance()) {
             p.getPackets().sendMessage("You have already filled yourself with vengeance.");
             return;
         } else {
             if (Environment.TickCount - p.getLastVengeanceTime() <= 30000)
             {
                 p.getPackets().sendMessage("You cannot cast this spell yet.");
                 return;
             }
         }
         p.getInventory().deleteItem(560, 2);
         p.getInventory().deleteItem(557, 10);
         p.getInventory().deleteItem(9075, 4);
         p.setLastAnimation(new Animation(4410));
         p.setLastGraphics(new Graphics(726, 0, 80));
         p.setLastVengeanceTime(Environment.TickCount);
         p.setVengeance(true);
     }
 }
开发者ID:slapglif,项目名称:runescape-server-csharp,代码行数:26,代码来源:Lunar.cs

示例3: displayAmmoInterface

 public static void displayAmmoInterface(Player p, int type, bool featherless, bool bolt)
 {
     string s = "<br><br><br><br>";
     string s1 = bolt && type == 0 ? "Bronze " : "";
     string text = "";
     int item = -1;
     if (!bolt) {
         if (featherless) {
             item = HEADLESS_ARROW;
             text = ARROW_AMOUNT + " Headless arrows";
         } else {
             item = ARROW[type];
             text = ItemData.forId(item).getName() + "s";
         }
     } else {
         if (featherless) {
             item = FEATHERED_BOLT[type];
             text = ItemData.forId(item).getName();
         } else {
             item = BOLT[type];
             text = ItemData.forId(item).getName();
         }
     }
     p.getPackets().sendChatboxInterface(582);
     p.getPackets().itemOnInterface(582, 2, 150, item);
     p.getPackets().modifyText(s + s1 + text, 582, 5);
 }
开发者ID:slapglif,项目名称:runescape-server-csharp,代码行数:27,代码来源:MakeAmmo.cs

示例4: displayBowOptions

 public static void displayBowOptions(Player p, int index, bool stringing, int type)
 {
     string s = "<br><br><br><br>";
     if (!stringing)
     {
         if (index == 0)
         {
             p.getPackets().sendChatboxInterface(305);
             p.getPackets().itemOnInterface(305, 2, 175, 52);
             p.getPackets().itemOnInterface(305, 3, 175, 50);
             p.getPackets().itemOnInterface(305, 4, 175, 48);
             p.getPackets().itemOnInterface(305, 5, 175, 9440);
             p.getPackets().modifyText(s + ARROW_AMOUNT + " Arrow Shafts", 305, 9);
             p.getPackets().modifyText(s + "Short Bow", 305, 13);
             p.getPackets().modifyText(s + "Long Bow", 305, 17);
             p.getPackets().modifyText(s + "Crossbow Stock", 305, 21);
             return;
         }
         p.getPackets().sendChatboxInterface(303);
         p.getPackets().itemOnInterface(303, 2, 175, UNSTRUNG_SHORTBOW[index]);
         p.getPackets().itemOnInterface(303, 3, 175, UNSTRUNG_LONGBOW[index]);
         p.getPackets().modifyText(s + "Short Bow", 303, 7);
         p.getPackets().modifyText(s + "Long Bow", 303, 11);
     }
     else
     {
         int[] bows = type == 0 ? STRUNG_SHORTBOW : STRUNG_LONGBOW;
         p.getPackets().sendChatboxInterface(309);
         p.getPackets().itemOnInterface(309, 2, 150, bows[index]);
         p.getPackets().modifyText(s + ItemData.forId(bows[index]).getName(), 309, 6);
     }
 }
开发者ID:ramatronics,项目名称:rsps,代码行数:32,代码来源:MakeBows.cs

示例5: completePotion

 public static void completePotion(Player p, int amount, bool newMix)
 {
     if (newMix && p.getTemporaryAttribute("completePotion") == null)
     {
         return;
     }
     if (!newMix && p.getTemporaryAttribute("herbloreItem") == null)
     {
         return;
     }
     if (newMix)
     {
         if (p.getTemporaryAttribute("completePotion") == null)
         {
             return;
         }
         int index = (int)p.getTemporaryAttribute("completePotion");
         p.setTemporaryAttribute("herbloreItem", new Potion(END_POTION[index], UNFINISHED[index], SECONDARY[index], POTION_LEVEL[index], POTION_XP[index], amount));
     }
     Potion item = (Potion)p.getTemporaryAttribute("herbloreItem");
     if (item == null || p == null || item.getAmount() <= 0)
     {
         resetAllHerbloreVariables(p);
         return;
     }
     if (!p.getInventory().hasItem(item.getSecondary()) || !p.getInventory().hasItem(item.getUnfinished()))
     {
         resetAllHerbloreVariables(p);
         return;
     }
     if (p.getSkills().getGreaterLevel(Skills.SKILL.HERBLORE) < item.getLevel())
     {
         p.getPackets().sendMessage("You need a Herblore level of " + item.getLevel() + " to make that potion.");
         resetAllHerbloreVariables(p);
         return;
     }
     string s = ItemData.forId(item.getFinished()).getName().Replace("(3)", "");
     if (p.getInventory().deleteItem(item.getUnfinished()) && p.getInventory().deleteItem(item.getSecondary()))
     {
         if (p.getInventory().addItem(item.getFinished()))
         {
             item.decreaseAmount();
             p.setLastAnimation(new Animation(MIX_ANIMATION));
             p.getSkills().addXp(Skills.SKILL.HERBLORE, item.getXp());
             p.getPackets().sendMessage("You add the ingredient into the murky vial, you have completed the potion.");
             p.getPackets().closeInterfaces();
         }
     }
     if (item.getAmount() >= 1)
     {
         Event completeMorePotionsEvent = new Event(750);
         completeMorePotionsEvent.setAction(() =>
         {
             completePotion(p, item.getAmount(), false);
             completeMorePotionsEvent.stop();
         });
         Server.registerEvent(completeMorePotionsEvent);
     }
 }
开发者ID:ramatronics,项目名称:rsps,代码行数:59,代码来源:Herblore.cs

示例6: craftClay

 public static void craftClay(Player p, int amount, int craftType, int craftItem, bool newCraft)
 {
     if (newCraft)
     {
         if ((craftType != 1 && craftType != 2) || craftItem < 0 || craftItem > 4)
         {
             return;
         }
         int index = craftItem;
         int endItem = craftType == 1 ? 0 : 1;
         int xp = craftType == 1 ? 3 : 4;
         p.setTemporaryAttribute("craftItem", new CraftItem(craftType, craftItem, amount, (double)CLAY_ITEMS[index][xp], (int)CLAY_ITEMS[index][endItem], (string)CLAY_ITEMS[index][5], (int)CLAY_ITEMS[index][2]));
     }
     CraftItem item = (CraftItem)p.getTemporaryAttribute("craftItem");
     if (item == null || p == null || item.getAmount() <= 0)
     {
         Crafting.resetCrafting(p);
         return;
     }
     int neededItem = item.getCraftType() == 1 ? CLAY : (int)CLAY_ITEMS[item.getCraftItem()][0];
     string s = item.getCraftType() == 1 ? "You mould the clay into a " + item.getMessage() : "You bake the " + item.getMessage() + " in the oven";
     string s1 = item.getCraftType() == 1 ? "You need some soft clay to mould a " + item.getMessage() : "You need a pre-made " + item.getMessage() + " to put in the oven";
     int animation = item.getCraftType() == 1 ? 883 : 899;
     if (p.getSkills().getGreaterLevel(Skills.SKILL.CRAFTING) < item.getLevel())
     {
         p.getPackets().sendMessage("You need a Crafting level of " + item.getLevel() + " to make a " + item.getMessage() + ".");
         Crafting.resetCrafting(p);
         return;
     }
     if (!p.getInventory().hasItem(neededItem))
     {
         p.getPackets().sendMessage(s1 + ".");
         Crafting.resetCrafting(p);
         return;
     }
     p.getPackets().closeInterfaces();
     if (p.getInventory().deleteItem(neededItem))
     {
         if (p.getInventory().addItem(item.getFinishedItem()))
         {
             p.getSkills().addXp(Skills.SKILL.CRAFTING, item.getXp());
             p.getPackets().sendMessage(s + ".");
             p.setLastAnimation(new Animation(animation));
         }
     }
     item.decreaseAmount();
     if (item.getAmount() >= 1)
     {
         Event craftMoreClayEvent = new Event(1500);
         craftMoreClayEvent.setAction(() =>
         {
             craftClay(p, -1, -1, -1, false);
             craftMoreClayEvent.stop();
         });
         Server.registerEvent(craftMoreClayEvent);
     }
 }
开发者ID:ramatronics,项目名称:rsps,代码行数:57,代码来源:Clay.cs

示例7: cutLog

 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);
     }
 }
开发者ID:ramatronics,项目名称:rsps,代码行数:56,代码来源:MakeBows.cs

示例8: displayJewelleryInterface

 public static void displayJewelleryInterface(Player p)
 {
     for (int i = 0; i < JEWELLERY_INTERFACE_VARS.Length; i++) {
         if (p.getInventory().hasItem(JEWELLERY_INTERFACE_VARS[i][0])) {
             p.getPackets().showChildInterface(675, JEWELLERY_INTERFACE_VARS[i][1], false);
             displayJewellery(p, i);
         }
     }
     p.getPackets().displayInterface(675);
 }
开发者ID:Krill156,项目名称:SharpEMU,代码行数:10,代码来源:Jewellery.cs

示例9: displaySilverOptions

 public static void displaySilverOptions(Player p)
 {
     string s = "<br><br><br><br>";
     p.getPackets().sendChatboxInterface(303);
     p.getPackets().itemOnInterface(303, 2, 175, (int)SILVER_ITEMS[0][0]);
     p.getPackets().itemOnInterface(303, 3, 175, (int)SILVER_ITEMS[1][0]);
     p.getPackets().modifyText(s + (string)SILVER_ITEMS[0][4], 303, 7);
     p.getPackets().modifyText(s + (string)SILVER_ITEMS[1][4], 303, 11);
     p.setTemporaryAttribute("craftType", 120);
 }
开发者ID:ramatronics,项目名称:rsps,代码行数:10,代码来源:Silver.cs

示例10: displayOptionInterface

 public static void displayOptionInterface(Player p, int type, bool stringing)
 {
     string s = "<br><br><br><br>";
     p.getPackets().sendChatboxInterface(309);
     if (!stringing) {
         p.getPackets().itemOnInterface(309, 2, 150, UNFINISHED_XBOW[type]);
         p.getPackets().modifyText(s + ItemData.forId(UNFINISHED_XBOW[type]).getName(), 309, 6);
         return;
     }
     p.getPackets().itemOnInterface(309, 2, 150, FINISHED_XBOW[type]);
     p.getPackets().modifyText(s + ItemData.forId(FINISHED_XBOW[type]).getName(), 309, 6);
 }
开发者ID:slapglif,项目名称:runescape-server-csharp,代码行数:12,代码来源:MakeXbow.cs

示例11: newSilverItem

 public static void newSilverItem(Player p, int amount, int index, bool newCraft)
 {
     index -= 120;
     if (newCraft)
     {
         p.setTemporaryAttribute("craftItem", new CraftItem(3, index, amount, (double)SILVER_ITEMS[index][3], (int)SILVER_ITEMS[index][0], (string)SILVER_ITEMS[index][4], (int)SILVER_ITEMS[index][2]));
     }
     CraftItem item = (CraftItem)p.getTemporaryAttribute("craftItem");
     if (item == null || p == null || item.getAmount() <= 0 || item.getCraftType() != 3)
     {
         Crafting.resetCrafting(p);
         return;
     }
     p.getPackets().closeInterfaces();
     string s = item.getCraftItem() == 0 ? "an" : "a";
     if (!p.getInventory().hasItem((int)SILVER_ITEMS[item.getCraftItem()][1]))
     {
         p.getPackets().sendMessage("You need " + s + " " + item.getMessage() + " mould to make that.");
         Crafting.resetCrafting(p);
         return;
     }
     if (!p.getInventory().hasItem(SILVER_BAR))
     {
         p.getPackets().sendMessage("You don't have a Silver bar.");
         Crafting.resetCrafting(p);
         return;
     }
     if (p.getSkills().getGreaterLevel(Skills.SKILL.CRAFTING) < item.getLevel())
     {
         p.getPackets().sendMessage("You need a Crafting level of " + item.getLevel() + " to smelt that.");
         Crafting.resetCrafting(p);
         return;
     }
     if (p.getInventory().deleteItem(SILVER_BAR))
     {
         p.getInventory().addItem(item.getFinishedItem());
         p.getSkills().addXp(Skills.SKILL.CRAFTING, item.getXp());
         p.setLastAnimation(new Animation(3243));
         p.getPackets().sendMessage("You smelt the Silver bar in to " + s + " " + item.getMessage() + ".");
     }
     item.decreaseAmount();
     if (item.getAmount() >= 1)
     {
         Event makeMoreSilverItemEvent = new Event(1500);
         makeMoreSilverItemEvent.setAction(() =>
         {
             newSilverItem(p, -1, -1, false);
             makeMoreSilverItemEvent.stop();
         });
         Server.registerEvent(makeMoreSilverItemEvent);
     }
 }
开发者ID:ramatronics,项目名称:rsps,代码行数:52,代码来源:Silver.cs

示例12: displayClayOptions

 public static void displayClayOptions(Player p, int craftType)
 {
     string s = "<br><br><br><br>";
     int j = 2;
     int k = 10;
     for (int i = 0; i < CLAY_ITEMS.Length; i++) {
         p.getPackets().itemOnInterface(306, j, 130, (int) CLAY_ITEMS[i][0]);
         p.getPackets().modifyText(s + CLAY_ITEMS[i][5], 306, k);
         j++;
         k += 4;
     }
     p.getPackets().sendChatboxInterface(306);
 }
开发者ID:Krill156,项目名称:SharpEMU,代码行数:13,代码来源:Clay.cs

示例13: fillingVial

        // TODO make this use an AreaEvent so itll work from a distance.
        /**
         * Will fill vials in a continuous motion from a water source.
         */
        public static bool fillingVial(Player p, Location loc)
        {
            if (!p.getInventory().hasItem(VIAL) || !p.getLocation().withinDistance(loc, 2))
            {
                return true;
            }
            if (p.getTemporaryAttribute("fillVialTimer") != null)
            {
                long lastFillTime = (int)p.getTemporaryAttribute("fillVialTimer");
                if (Environment.TickCount - lastFillTime < 600)
                {
                    return true;
                }
            }
            p.setTemporaryAttribute("fillingVials", true);
            p.setFaceLocation(loc);

            Event fillVialEvent = new Event(500);
            fillVialEvent.setAction(() =>
            {
                int amountFilled = 0;
                string s = amountFilled == 1 ? "vial" : "vials";
                if (p.getTemporaryAttribute("fillingVials") == null || !p.getLocation().withinDistance(loc, 2) || !p.getInventory().hasItem(229))
                {
                    p.setLastAnimation(new Animation(65535));
                    if (amountFilled > 0)
                    {
                        p.getPackets().sendMessage("You fill up the " + s + " with water.");
                    }
                    fillVialEvent.stop();
                    return;
                }
                if (p.getInventory().replaceSingleItem(VIAL, VIAL_OF_WATER))
                {
                    p.setLastAnimation(new Animation(832));
                    amountFilled++;
                    p.setTemporaryAttribute("fillVialTimer", Environment.TickCount);
                }
                else
                {
                    if (amountFilled > 0)
                    {
                        p.setLastAnimation(new Animation(65535));
                        p.getPackets().sendMessage("You fill up the " + s + " with water.");
                    }
                    fillVialEvent.stop();
                }
            });
            Server.registerEvent(fillVialEvent);
            return true;
        }
开发者ID:ramatronics,项目名称:rsps,代码行数:55,代码来源:FillVial.cs

示例14: displaySpinningInterface

 public static void displaySpinningInterface(Player p)
 {
     int k = 2;
     int l = 8;
     string s = "<br><br><br><br>";
     for (int j = 0; j < 3; j++) {
         p.getPackets().itemOnInterface(304, k, 180, (int) SPINNING_ITEMS[j][0]);
         p.getPackets().modifyText(s + (string) SPIN_FINISH[j], 304, l);
         l += 4;
         k++;
     }
     p.setTemporaryAttribute("craftType", 6);
     p.getPackets().sendChatboxInterface(304);
 }
开发者ID:slapglif,项目名称:runescape-server-csharp,代码行数:14,代码来源:Spinning.cs

示例15: craftGlass

 public static void craftGlass(Player p, int amount, int index, bool newCraft)
 {
     if (newCraft)
     {
         p.setTemporaryAttribute("craftItem", new CraftItem(3, index, amount, (double)GLASS_ITEMS[index][2], (int)GLASS_ITEMS[index][0], (string)GLASS_ITEMS[index][3], (int)GLASS_ITEMS[index][1]));
     }
     CraftItem item = (CraftItem)p.getTemporaryAttribute("craftItem");
     if (item == null || p == null || item.getAmount() <= 0 || item.getCraftType() != 3)
     {
         Crafting.resetCrafting(p);
         return;
     }
     p.getPackets().closeInterfaces();
     if (!p.getInventory().hasItem(MOLTEN_GLASS))
     {
         p.getPackets().sendMessage("You have no molten glass.");
         Crafting.resetCrafting(p);
         return;
     }
     if (!p.getInventory().hasItem(GLASSBLOWING_PIPE))
     {
         p.getPackets().sendMessage("You need a glassblowing pipe if you wish to make a glass item.");
         Crafting.resetCrafting(p);
         return;
     }
     if (p.getSkills().getGreaterLevel(Skills.SKILL.CRAFTING) < item.getLevel())
     {
         p.getPackets().sendMessage("You need a Crafting level of " + item.getLevel() + " to craft that item.");
         Crafting.resetCrafting(p);
         return;
     }
     if (p.getInventory().deleteItem(MOLTEN_GLASS))
     {
         p.getInventory().addItem(item.getFinishedItem());
         p.getSkills().addXp(Skills.SKILL.CRAFTING, item.getXp());
         p.setLastAnimation(new Animation(884));
         p.getPackets().sendMessage("You blow through the pipe, shaping the molten glass into a " + item.getMessage() + ".");
     }
     item.decreaseAmount();
     if (item.getAmount() >= 1)
     {
         Event craftMoreGlassEvent = new Event(1500);
         craftMoreGlassEvent.setAction(() =>
         {
             craftGlass(p, -1, -1, false);
             craftMoreGlassEvent.stop();
         });
         Server.registerEvent(craftMoreGlassEvent);
     }
 }
开发者ID:ramatronics,项目名称:rsps,代码行数:50,代码来源:Glass.cs


注:本文中的Player.getPackets方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。