Jump to content
Sign in to follow this  
Fuzenseth

667 - MagicOnGround -Packet Handler

Recommended Posts

I have added full magic on ground packet including tele grab which you need to do yourself (the actual spell).

WorldPacketsDecoder:
[CODE]else if (packetId == MAGIC_ON_GROUND_PACKET) {
MagicOnGroundPacketHandler.handlePacket(player, stream, packetId);
}[/CODE]


Create [B]new file[/B] in com.rs.net.decoders.handlers.
[CODE]package com.enso.net.decoders.handlers;

import com.enso.game.item.Item;
import com.enso.game.player.Player;
import com.enso.game.player.content.MagicAbility;
import com.enso.io.InputStream;
/**
*
* [MENTION=52317]auth[/MENTION]or Fuzen Seth
* [MENTION=3199]Sin[/MENTION]ce 9.12.2013
* [MENTION=33707]Cat[/MENTION]egory Represents a player using magic spell to a ground item.
*/
public class MagicOnGroundPacketHandler {
/**
* Tele grab spell id.
*/
public static final int TELE_GRAB = 44;
/**
* The regular spellbook.
*/
public static final int REGULAR_SPELLBOOK = 190;
/**
* The ancient spellbook.
*/
public static final int ANCIENT_SPELLBOOK = -1;
/**
* The lunar spellbook.
*/
public static final int LUNAR_SPELLBOOK = -1;
/**
* We handle the magic on ground packet.
* [MENTION=75098]Para[/MENTION]m player
* [MENTION=75098]Para[/MENTION]m stream
* [MENTION=75098]Para[/MENTION]m packetId
*/
public static final void handlePacket(Player player, InputStream stream, int packetId) {
int inventoryInter = stream.readInt() >> 16;
int itemId = stream.readShort();
int junk = stream.readShort();
int itemSlot = stream.readShortLE();
int interfaceSet = stream.readIntV1();
int spellId = interfaceSet & 0xFFF;
int magicInter = interfaceSet >> 16;
Item item = new Item(itemId);

switch (inventoryInter) {
case REGULAR_SPELLBOOK:
switch (spellId) {
/**
* Teleportation grab
* Takes a item from ground by using magic.
*/
case TELE_GRAB:
MagicAbility.preformTeleGrab(player, item);
break;
}
break;

default:
if (player.isDeveloperMode())
System.out.println("Item:" + itemId + "slot:" + itemSlot + "spell:"
+ spellId + "i:" + interfaceSet + "l:" + magicInter + "x:"
+ junk + "k:" + inventoryInter);
}
}
}
[/CODE]

Enjoy, [B]don't forget to replace imports from 'enso' to 'rs'.[/B] Edited by FUZENSETH

Share this post


Link to post
Share on other sites
[quote name='milf hunter']Niceeeee Rep++ ty for dis idk how to code pls thanx[/QUOTE]

Thanks.

Share this post


Link to post
Share on other sites
Inaccurate, because you would need location of item to remove from the floor, and also why would you need inventory interface id.. Lol just a few pointers :P

Share this post


Link to post
Share on other sites
[quote name='milf hunter']Inaccurate, because you would need location of item to remove from the floor, and also why would you need inventory interface id.. Lol just a few pointers :P[/QUOTE]

[code]
case TELE_GRAB:
[COLOR="#00FF00"]MagicAbility.preformTeleGrab(player, item);[/COLOR]
break;[/code]

[code]int inventoryInter = stream.readInt() >> 16;[/code]

With inventoryInter I mean tab interface (spellbook etc if you didn't notice):

[code]switch (inventoryInter) {
case REGULAR_SPELLBOOK:[/code]

I handle the first magic on ground spell I have made (tele grab). It's done by MagicAbility.java which will also take out the item and is pretty much perfect and same as in actual RuneScape.

Thanks for trying to improve though!

Share this post


Link to post
Share on other sites
Sign in to follow this  

×