本文整理汇总了C#中Packet.readShortA方法的典型用法代码示例。如果您正苦于以下问题:C# Packet.readShortA方法的具体用法?C# Packet.readShortA怎么用?C# Packet.readShortA使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Packet
的用法示例。
在下文中一共展示了Packet.readShortA方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: handleDropItem
private void handleDropItem(Player player, Packet packet)
{
int item = packet.readShortA();
int slot = packet.readShortA();
int interfaceId = packet.readLEShort();
int childId = packet.readUShort();
if (slot > 28 || slot < 0 || player.isDead() || player.getTemporaryAttribute("cantDoAnything") != null) {
return;
}
SkillHandler.resetAllSkills(player);
if (player.getInventory().getItemInSlot(slot) == item) {
player.getPackets().closeInterfaces();
if (ItemData.isPlayerBound(player.getInventory().getItemInSlot(slot))) {
Item[] items = {new Item(player.getInventory().getItemInSlot(slot), 1)};
//player.getPackets().sendItems(94, 0, 93, items);
player.getPackets().modifyText("Are you sure you want to destroy this item?", 94, 3); // Title
//player.getPackets().modifyText("Yes", 94, 4); // Yes
//player.getPackets().modifyText("No", 94, 5); // No
player.getPackets().modifyText("", 94, 10); // Line 1
player.getPackets().modifyText("If you wish to get another Fire cape, you must", 94, 11); // Line 2
player.getPackets().modifyText("complete the Fight cave minigame again.", 94, 12); // Line 3
player.getPackets().modifyText("Fire Cape", 94, 13); // Item name
player.getPackets().sendChatboxInterface(94);
return;
}
int id = player.getInventory().getItemInSlot(slot);
int amt = player.getInventory().getAmountInSlot(slot);
GroundItem i = new GroundItem(id, amt, new Location(player.getLocation().getX(), player.getLocation().getY(), player.getLocation().getZ()), player);
if (player.getInventory().deleteItem(id, slot, amt)) {
if (!Server.getGroundItems().addToStack(id, amt, player.getLocation(), player)) {
Server.getGroundItems().newEntityDrop(i);
}
}
}
}
示例2: handleOperateItem
private void handleOperateItem(Player player, Packet packet)
{
int item = packet.readShortA();
int slot = packet.readLEShort();
int interfaceId = packet.readLEShort();
int childId = packet.readLEShort();
if (slot < 0 || slot > 13 || player.isDead() || player.getTemporaryAttribute("cantDoAnything") != null) {
return;
}
ItemData.EQUIP equipSlot = (ItemData.EQUIP)slot;
if (player.getEquipment().getItemInSlot(equipSlot) == item)
{
SkillHandler.resetAllSkills(player);
player.getPackets().closeInterfaces();
if (JewelleryTeleport.useJewellery(player, player.getEquipment().getItemInSlot(equipSlot), slot, true))
{
return;
} else
if (equipSlot == ItemData.EQUIP.CAPE && Skillcape.emote(player))
{
return;
}
player.getPackets().sendMessage("This item isn't operable.");
}
}
示例3: handleSwapSlot
private void handleSwapSlot(Player player, Packet packet)
{
int oldSlot = packet.readUShort();
int childId = packet.readLEShort();
int interfaceId = packet.readLEShort();
int newSlot = packet.readShortA();
int swapType = packet.readByteS();
int oldItem = player.getInventory().getItemInSlot(oldSlot);
int oldAmount = player.getInventory().getAmountInSlot(oldSlot);
int newItem = player.getInventory().getItemInSlot(newSlot);
int newAmount = player.getInventory().getAmountInSlot(newSlot);
if (oldSlot > 28 || oldSlot < 0 || newSlot > 28 || oldSlot < 0 || player.isDead() || player.getTemporaryAttribute("cantDoAnything") != null) {
return;
}
switch (interfaceId) {
case 149:
if (swapType == 0 && childId == 0) {
player.getInventory().getSlot(oldSlot).setItemId(newItem);
player.getInventory().getSlot(oldSlot).setItemAmount(newAmount);
player.getInventory().getSlot(newSlot).setItemId(oldItem);
player.getInventory().getSlot(newSlot).setItemAmount(oldAmount);
}
break;
default:
misc.WriteError("UNHANDLED ITEM SWAP 1 : interface = " + interfaceId);
break;
}
//No need to update the screen since the client does it for us!
}
示例4: handleItemOnObject
private void handleItemOnObject(Player player, Packet packet)
{
int objectX = packet.readShortA();
int item = packet.readUShort();
int objectY = packet.readLEShort();
int slot = packet.readUShort();
int interfaceId = packet.readLEShort();
int child = packet.readUShort();
int objectId = packet.readShortA();
if (slot > 28 || slot < 0 || player.isDead() || player.getTemporaryAttribute("cantDoAnything") != null) {
return;
}
Console.WriteLine("Item on object = " + objectId + " " + objectX + " " + objectY);
SkillHandler.resetAllSkills(player);
player.getPackets().closeInterfaces();
player.setFaceLocation(new Location(objectX, objectY, player.getLocation().getZ()));
if (player.getInventory().getItemInSlot(slot) == item) {
if (Crafting.wantsToCraftOnObject(player, player.getInventory().getItemInSlot(slot), objectId)) {
return;
} else if (Farming.interactWithPatch(player, objectId, objectX, objectY, player.getInventory().getItemInSlot(slot))) {
return;
} else if (WarriorGuild.useAnimator(player, player.getInventory().getItemInSlot(slot), objectId, objectX, objectY)) {
return;
}
if (player.getInventory().getItemInSlot(slot) == 7936) {
if (RuneCraft.wantToRunecraft(player, objectId, objectX, objectY)) {
return;
}
if (RuneCraft.useTalisman(player, objectId, objectX, objectY)) {
return;
}
}
switch(objectId) {
case 6: // Cannon:
DwarfCannon cannon = player.getCannon();
Location l = new Location(objectX, objectY, player.getLocation().getZ());
if (cannon == null || (cannon != null & !l.withinDistance(cannon.getLocation(), 2))) {
player.getPackets().sendMessage("This isn't your cannon!");
break;
}
cannon.loadCannon();
break;
case 36781: // Lumbridge fountain.
case 24214: // Fountain in east Varrock.
case 24265: // Varrock main fountain.
case 11661: // Falador waterpump.
case 11759: // Falador south fountain.
case 879: // Camelot fountains.
case 29529: // Sink.
case 874: // Sink.
if (FillVial.fillingVial(player, new Location(objectX, objectY, player.getLocation().getZ())) && player.getInventory().getItemInSlot(slot) == 229) {
break;
}
break;
case 2728: // Range in Catherby
if (Cooking.isCooking(player, player.getInventory().getItemInSlot(slot), false, -1, -1)) {
break;
}
break;
case 2732: // Fire
if (Cooking.isCooking(player, player.getInventory().getItemInSlot(slot), true, objectX, objectY)) {
break;
}
break;
case 36956: // Lumbridge furnace
case 11666: // Falador furnace
if (Smelting.wantToSmelt(player, player.getInventory().getItemInSlot(slot))) {
break;
} else if (Crafting.wantsToCraftOnObject(player, player.getInventory().getItemInSlot(slot), objectId)) {
break;
}
break;
case 2783: // Anvil
if (Smithing.wantToSmithOnAnvil(player, player.getInventory().getItemInSlot(slot), new Location(objectX, objectY, player.getLocation().getZ()))) {
break;
}
break;
default:
player.getPackets().sendMessage("Nothing interesting happens.");
break;
}
}
}
示例5: handleInvenClickItem
private void handleInvenClickItem(Player player, Packet packet)
{
int slot = packet.readLEShortA();
int item = packet.readShortA();
int childId = packet.readLEShort();
int interfaceId = packet.readLEShort();
if (slot > 28 || slot < 0 || player.isDead() || player.getTemporaryAttribute("cantDoAnything") != null) {
return;
}
SkillHandler.resetAllSkills(player);
if (player.getInventory().getItemInSlot(slot) == item) {
player.getPackets().closeInterfaces();
if (Consumables.isEating(player, player.getInventory().getItemInSlot(slot), slot))
return;
else if (Herblore.idHerb(player, player.getInventory().getItemInSlot(slot)))
return;
else if (RuneCraft.fillPouch(player, (RuneCraftData.POUCHES)player.getInventory().getItemInSlot(slot)))
return;
else if (Prayer.wantToBury(player, player.getInventory().getItemInSlot(slot), slot))
return;
else if (Teleport.useTeletab(player, player.getInventory().getItemInSlot(slot), slot))
return;
else if (FarmingAmulet.showOptions(player, player.getInventory().getItemInSlot(slot)))
return;
switch(item) {
case 4155: // Slayer gem
Slayer.doDialogue(player, 1051);
break;
case 6: // Dwarf multicannon
if (player.getCannon() != null) {
player.getPackets().sendMessage("You already have a cannon set up!");
break;
}
player.setCannon(new DwarfCannon(player));
break;
case 5073: // Nest with seeds.
case 5074: // Nest with jewellery.
Woodcutting.randomNestItem(player, item);
break;
case 952: // Spade
player.setLastAnimation(new Animation(830));
if (Barrows.enterCrypt(player)) {
player.getPackets().sendMessage("You've broken into a crypt!");
break;
}
player.getPackets().sendMessage("You find nothing.");
break;
}
}
}
示例6: handleEquipItem
private void handleEquipItem(Player player, Packet packet)
{
int item = packet.readLEShort();
int slot = packet.readShortA();
int interfaceId = packet.readInt();
if (slot > 28 || slot < 0 || player.isDead() || player.getTemporaryAttribute("cantDoAnything") != null) {
return;
}
SkillHandler.resetAllSkills(player);
if (player.getInventory().getItemInSlot(slot) == item) {
//player.getPackets().closeInterfaces();
if (RuneCraft.emptyPouch(player, (RuneCraftData.POUCHES)player.getInventory().getItemInSlot(slot))) {
return;
}
player.getEquipment().equipItem(player.getInventory().getItemInSlot(slot), slot);
}
}
示例7: handleThirdClickNPC
private void handleThirdClickNPC(Player player, Packet packet)
{
int npcIndex = packet.readShortA();
if (npcIndex < 0 || npcIndex > Constants.MAX_NPCS || player.isDead() || player.getTemporaryAttribute("cantDoAnything") != null) {
return;
}
Npc npc = Server.getNpcList()[npcIndex];
if (npc == null || npc.isDestroyed()) {
return;
}
Console.WriteLine("Third click NPC " + npc.getId());
SkillHandler.resetAllSkills(player);
if (Thieving.wantToThieveNpc(player, npc)) {
return;
} else if (Fishing.wantToFish(player, npc, true)) {
return;
} else if (AgilityArena.dialogue(player, npc, true)) {
return;
} else if (TzHaar.interactTzhaarNPC(player, npc, 2)) {
return;
} else if (WarriorGuild.talkToWarriorGuildNPC(player, npc, 2)) {
return;
}
switch(npc.getId()) {
case 553: // Aubury
HomeArea.interactWithAubury(player, npc, 2);
break;
case 519: // Bob
BrokenBarrows.talkToBob(player, npc, -1, 2);
break;
}
}
示例8: handleMagicOnNPC
private void handleMagicOnNPC(Player player, Packet packet)
{
int childId = packet.readLEShort();
int interfaceId = packet.readLEShort();
int junk = packet.readShortA();
int npcIndex = packet.readLEShortA();
if (npcIndex < 0 || npcIndex > Constants.MAX_NPCS || player.isDead() || player.getTemporaryAttribute("cantDoAnything") != null) {
return;
}
Npc npc = Server.getNpcList()[npcIndex];
if (npc == null || npc.isDestroyed()) {
return;
}
SkillHandler.resetAllSkills(player);
player.setTarget(npc);
MagicCombat.newMagicAttack(player, npc, childId, interfaceId == 193);
Console.WriteLine(childId);
}