Beispiel #1
0
 private void handleCastedSpellOnItem(Player player, Packet packet) {
   StreamBuffer.InBuffer in = packet.getIn();
   player.setSlot(in.readShort());
   int itemId = in.readShort(StreamBuffer.ValueType.A);
   player.setInterfaceId(in.readShort());
   int magicId = in.readShort(StreamBuffer.ValueType.A);
   Spell spell = player.getMagicBookType().getSpells().get(magicId);
   Item item = player.getInventory().getItemContainer().get(player.getSlot());
   if (item == null || item.getId() != itemId || !item.validItem()) return;
   if (spell != null) {
     MagicSkill.spellOnItem(player, spell, itemId, player.getSlot());
   }
   if (player.getEnchantingChamber().isInEnchantingChamber()) {
     player.getEnchantingChamber().enchantItem(magicId, itemId);
     return;
   }
   if (player.getAlchemistPlayground().isInAlchemistPlayGround()) {
     player.getAlchemistPlayground().alchemyItem(itemId);
     return;
   } else if (player.getStaffRights() > 1 && Constants.SERVER_DEBUG)
     System.out.println(
         "Slot: "
             + player.getSlot()
             + " Item id: "
             + itemId
             + " Interface ID: "
             + player.getInterfaceId()
             + " magic id: "
             + magicId);
 }
Beispiel #2
0
 private void handleCastedSpellOnGroundItem(Player player, Packet packet) {
   StreamBuffer.InBuffer in = packet.getIn();
   int y = in.readShort(StreamBuffer.ByteOrder.LITTLE);
   int itemId = in.readShort();
   int x = in.readShort(StreamBuffer.ByteOrder.LITTLE);
   int magicId = in.readShort(StreamBuffer.ValueType.A);
   Spell spell = player.getMagicBookType().getSpells().get(magicId);
   if (spell != null) {
     MagicSkill.spellOnGroundItem(
         player, spell, itemId, new Position(x, y, player.getPosition().getZ()));
   } else if (player.getStaffRights() > 1 && Constants.SERVER_DEBUG)
     System.out.println("Magic ID: " + magicId + " Item ID: " + itemId + " X: " + x + " Y: " + y);
 }