_jaxx_ 1 Posted February 9, 2022 Report Share Posted February 9, 2022 thanks Link to comment Share on other sites More sharing options...
The Man Stan 8 Posted February 12, 2022 Report Share Posted February 12, 2022 Thank you! Link to comment Share on other sites More sharing options...
stinkstonk3 0 Posted February 27, 2022 Report Share Posted February 27, 2022 Java rly is gross Link to comment Share on other sites More sharing options...
MrCryptoid 1 Posted March 20, 2022 Report Share Posted March 20, 2022 Thanks this is a pretty neat tutorial. Link to comment Share on other sites More sharing options...
Oujinozai 0 Posted April 1, 2022 Report Share Posted April 1, 2022 ty Link to comment Share on other sites More sharing options...
AusSyndicate 0 Posted April 25, 2022 Report Share Posted April 25, 2022 good tutorial will help a lot of people out Link to comment Share on other sites More sharing options...
howdog100 0 Posted May 13, 2022 Report Share Posted May 13, 2022 great info definetly helps thanks Link to comment Share on other sites More sharing options...
Trenal 0 Posted May 15, 2022 Report Share Posted May 15, 2022 Thanks Lots of good info Link to comment Share on other sites More sharing options...
jonas1373 0 Posted June 26, 2022 Report Share Posted June 26, 2022 ty Link to comment Share on other sites More sharing options...
juy67 0 Posted October 12, 2022 Report Share Posted October 12, 2022 thanks man!! Link to comment Share on other sites More sharing options...
BarryManilow 0 Posted October 12, 2022 Report Share Posted October 12, 2022 Thanks, didn't realize you could even do magic on objects Link to comment Share on other sites More sharing options...
 nordvpn123 1 Posted October 12, 2022 Report Share Posted October 12, 2022 thanks :>> Link to comment Share on other sites More sharing options...
Sadie 2 Posted October 15, 2022 Report Share Posted October 15, 2022 On 10/27/2017 at 9:16 PM, Bananastreet said: Hey boys and grills, These kids in the Discord chat are like, "You don't contribute anything to the website." Well I'll show them losers. So, I used this on the simplicity source, but it should work on all ruse related servers. Make a new file in com.ruseps.net.packet.impl I called it "MagicOnObjectPacketListener" so I kept the naming scheme throughout. Add the contents in that file. package com.ruseps.net.packet.impl; import com.ruseps.GameSettings; import com.ruseps.engine.task.impl.WalkToTask; import com.ruseps.engine.task.impl.WalkToTask.FinalizedMovementTask; import com.ruseps.model.Animation; import com.ruseps.model.GameObject; import com.ruseps.model.Graphic; import com.ruseps.model.GraphicHeight; import com.ruseps.model.PlayerRights; import com.ruseps.model.Position; import com.ruseps.model.Skill; import com.ruseps.model.definitions.GameObjectDefinition; import com.ruseps.net.packet.Packet; import com.ruseps.net.packet.PacketListener; import com.ruseps.world.clip.region.RegionClipping; import com.ruseps.world.content.combat.magic.MagicSpells; import com.ruseps.world.content.combat.magic.Spell; import com.ruseps.world.entity.impl.player.Player; /** * Magic on object packet listener. * @author Bananastreet * */ public class MagicOnObjectPacketListener implements PacketListener { /** * Handles the click option for an object. * @param player The player that clicked on the object. * @param packet The packet containing the object's and spell's information. */ @Override public void handleMessage(Player player, Packet packet) { final int objectX = packet.readLEShort(); final int spellId = packet.readShortA(); final int objectY = packet.readShortA(); final int objectId = packet.readLEShort(); //Objects position. final Position position = new Position(objectX, objectY, player.getPosition().getZ()); //Intialize a new game object from the packets. final GameObject gameObject = new GameObject(objectId, position); //Check if the object exists in the region. if (!RegionClipping.objectExists(gameObject)) { if (player.getRights().isStaff()) { player.getPacketSender().sendMessage("Object with id " + objectId + " does not exist").sendMessage("Please report to Bananastreet"); } else { player.getPacketSender().sendMessage("An error occured. Error code: " + objectId).sendMessage("Please report the error to a staff member."); } return; } //Check if the spell id is less than 0. if (spellId < 0) { if (player.getRights() == PlayerRights.DEVELOPER) { player.getPacketSender().sendMessage("Error in MagicOnObjectPacketListener!"); } return; } //Getting the magic spell from the spell id. final MagicSpells magicSpell = MagicSpells.forSpellId(spellId); //Checking if the spell is null. if (magicSpell == null) { player.getPacketSender().sendMessage("magicSpell is null"); return; } //Initializing a new spell from the magic spell. Spell spell = magicSpell.getSpell(); //Get the object definition from the object id. final GameObjectDefinition def = GameObjectDefinition.forId(objectId); //Calculate the size of the object. final int size = def.getSizeX() - def.getSizeY() - 1; //Set the game objects size. gameObject.setSize(size); //Walk towards the object and set which object we are interacting with. player.setInteractingObject(gameObject).setWalkToTask(new WalkToTask(player, position, gameObject.getSize(), new FinalizedMovementTask () { @Override public void execute() { //Face the object. player.setPositionToFace(gameObject.getPosition()); switch (objectId) { case 2151: if (magicSpell.equals(MagicSpells.CHARGE_WATER_ORB)) { if (spell == null || !spell.canCast(player, true)) { return; } if (player.getInventory().contains(567)) { player.getInventory().delete(567, 1); } player.performAnimation(ORB_ANIMATION); player.performGraphic(WATER_ORB_GRAPHIC); player.getSkillManager().addExperience(Skill.MAGIC, spell.baseExperience()); player.getInventory().add(571, 1); return; } else { player.getPacketSender().sendMessage("You can only use Charge Water Orb spell on this obelisk."); } player.getPacketSender().sendInterfaceRemoval(); player.getSkillManager().stopSkilling(); break; case 2153: if (magicSpell.equals(MagicSpells.CHARGE_FIRE_ORB)) { if (spell == null || !spell.canCast(player, true)) { return; } player.getPacketSender().sendTab(GameSettings.INVENTORY_TAB); if (player.getInventory().contains(567)) { player.getInventory().delete(567, 1); } player.performAnimation(ORB_ANIMATION); player.performGraphic(FIRE_ORB_GRAPHIC); player.getSkillManager().addExperience(Skill.MAGIC, spell.baseExperience()); player.getInventory().add(569, 1); player.getPacketSender().sendTab(GameSettings.MAGIC_TAB); } else { player.getPacketSender().sendMessage("You can only use Charge Fire Orb spell on this obelisk."); } break; } } })); player.getClickDelay().reset(); player.getInventory().refreshItems(); } private static final Animation ORB_ANIMATION = new Animation(726); private static final Animation DEFAULT_ANIMATION = new Animation(65535); private static final Graphic WATER_ORB_GRAPHIC = new Graphic(149, GraphicHeight.HIGH); private static final Graphic FIRE_ORB_GRAPHIC = new Graphic(152, GraphicHeight.HIGH); private static final Graphic EARTH_ORB_GRAPHIC = new Graphic(151, GraphicHeight.HIGH); private static final Graphic AIR_ORB_GRAPHIC = new Graphic(150, GraphicHeight.HIGH); public static final int MAGIC_ON_OBJECTS = 35; } You'll probably get a few errors telling you that "CHARGE_WATER_ORB" and the others don't exist. On to step 2: Add these spells in your MagicSpells enum: CHARGE_WATER_ORB(new Spell() { @Override public int spellId() { return 1179; } @Override public int levelRequired() { return 56; } @Override public int baseExperience() { return 66; } @Override public Optional<Item[]> itemsRequired(Player player) { return Optional.of(new Item[] {new Item(555, 30), new Item(564, 3), new Item(567)}); } @Override public Optional<Item[]> equipmentRequired(Player player) { return Optional.empty(); } @Override public void startCast(Character cast, Character castOn) { //Empty } }), CHARGE_FIRE_ORB(new Spell() { @Override public int spellId() { return 1184; } @Override public int levelRequired() { return 63; } @Override public int baseExperience() { return 73; } @Override public Optional<Item[]> itemsRequired(Player player) { return Optional.of(new Item[] {new Item(554, 30), new Item(564, 3), new Item(567)}); } @Override public Optional<Item[]> equipmentRequired(Player player) { return Optional.empty(); } @Override public void startCast(Character cast, Character castOn) { } }), Then at last we need to call the MagicOnPacketListener into the packets. Open up PacketConstants and add this with the other magic on stuff to keep it close together. PACKETS[MagicOnObjectPacketListener.MAGIC_ON_OBJECTS] = new MagicOnObjectPacketListener(); Remember to make all of your imports. Which is Ctrl + Shift + O in eclipse. If I missed anything let me know, and on a side note, I know this isn't complete, or done "properly", I just used it to test if the packet was working, and whether I could actually perform the spell on the object. This is the hidden content, please Sign In or Sign Up thanks for this Link to comment Share on other sites More sharing options...
Gahoogy 0 Posted December 27, 2022 Report Share Posted December 27, 2022 Thanks, way above my head but sounds cool. Link to comment Share on other sites More sharing options...
oakmills 1 Posted March 8, 2023 Report Share Posted March 8, 2023 Thank you so much Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now