Jump to content

Pat

Administrators
  • Content Count

    52
  • Joined

  • Last visited

  • Days Won

    4
  • Time Online

    6h 41m 26s

Pat last won the day on June 21

Pat had the most liked content!

Community Reputation

8 Neutral

About Pat

  • Rank
    Getting There

Recent Profile Visitors

440 profile views
  1. Pat

    norse-master

    Are you using Intellij??
  2. Nice release! I will not personally use because I want to learn as I go along and if I use your code that is cheating but thank you for sharing your code for the community to use! Anyone who is using commandpacketlistener to hold their commands should be implementing this code straight away.
  3. Want me to attempt implementing this for you? 😉
  4. Pat

    MemberScrolls

    Hello Runeplace! I wrote this code for someone but they don't seem to want it so... Here. This class is based off an Enum @Bananastreet created for god statues. Kudos to Bananastreet! Why do you need to change how your server is handling the code for your scrolls? Because some parts of the code are duplicated which is causing an increase in memory. Creating an enum and storing the scrolls there is more easier for someone to add a new scroll and also more efficient, also yet again not duplicating code. You don't have to use my code 🙂 But you really should consider it. This code is server side only. You should not be asking if it needs to be added to the clients source code. This code was written for Ruse framework but can be easily modified to suit your server. Create a new Java file that must be an enum called MemberScrolls. Scroll over all of the implemented methods and paste my code replacing yours. import com.server.model.GameMode; import com.server.model.PlayerRights; import com.server.util.Misc; import com.server.world.content.PlayerPanel; import com.server.world.entity.impl.player.Player; import java.util.HashMap; import java.util.Map; import java.util.Objects; public enum MemberScrolls { TEN_SCROLL(10942, 10), TWENTY_SCROLL(10934, 20), FIFTY_SCROLL(10935, 50), ONE_HUNDRED_SCROLL(10943, 100); int itemId, scrollAmount; MemberScrolls(int itemId, int scrollAmount) { this.itemId = itemId; this.scrollAmount = scrollAmount; } static Map<Integer, MemberScrolls> scrolls = new HashMap<>(); static { for (MemberScrolls scroll : MemberScrolls.values()) { scrolls.put(scroll.getItemId(), scroll); } } public int getItemId() { return itemId; } public int getScrollAmount() { return scrollAmount; } public static boolean claimScroll(Player player, int itemId) { MemberScrolls scroll = scrolls.get(itemId); if (Objects.isNull(scroll)) { return false; } String name = scroll.name().toLowerCase().replace("_", " "); //Checking if the player is doing something. if (player.busy()) { player.getPacketSender().sendMessage("You cannot perform this action right now. " + "Please finish what you are doing first."); return false; } else {//If the player is not doing anything then this code will be read. player.getInventory().delete(scroll.getItemId(), 1); int points = scroll.getScrollAmount(); //Updating points. player.incrementAmountDonated(points);//Updating the total donated all in all. //Setting the points based on the scroll. player.getPointsHandler().setDonationPoints(points, true); //Sending a messaged with the scroll name and points claimed. player.getPacketSender().sendMessage("You claim your " + name + ". Your total funds have been updated."); //Checking if the player has enough points to move on to the next rank. checkForRank(player); //Refreshing the player panel ("Quest tab") to update the points gained. PlayerPanel.refreshPanel(player); return true; } } public static void checkForRank(Player player) { //Fetching the total amount a person has donated and storing the information to a new variable. int amountDonated = player.getAmountDonated(); //Storing string as no reason to duplicate. String noRankUpdate = "Your rank did not update due to being "; //Setting the rights to null so we can perform our rank check. PlayerRights rights = null; //Setting the players rank based on the amount donated. if (amountDonated >= 10) { rights = PlayerRights.REGULAR; } if (amountDonated >= 50) { rights = PlayerRights.SUPER; } if (amountDonated >= 250) { rights = PlayerRights.EXTREME; } if (amountDonated >= 750) { rights = PlayerRights.LEGENDARY; } if (amountDonated >= 2500) { rights = PlayerRights.ONYX; } //Checking if the player has the right already or they are a game mode that the rank cannot be changed. if (rights != null && rights != player.getRights() && !player.getRights().isStaff() && player.getGameMode() != GameMode.IRONMAN && player.getGameMode() != GameMode.HARDCORE_IRONMAN) { //Sending a message to the player if they are eligible for the rank. player.getPacketSender().sendMessage("You've become a " + Misc.formatText(rights.toString().toLowerCase()) + "! Congratulations!"); //Setting the players new rank player.setRights(rights); //Updating the players rank once the rank is set. player.getPacketSender().sendRights(); //Checking if the players game mode is anything other than a normal player. } else if (player.getGameMode() == GameMode.IRONMAN || player.getGameMode() == GameMode.HARDCORE_IRONMAN) { //If the player is not a normal player then they cannot have a rank update. player.getPacketSender().sendMessage(noRankUpdate + player.getGameMode().name().toLowerCase().replace("_", " ") + "."); } else {//Checking to see if the member is staff because that is the only rank left to check. player.getPacketSender().sendMessage(noRankUpdate + player.getRights().name().toLowerCase() + "."); //If the player is indeed a staff member then they will not have a rank update. } } } Save the file then make your way to the ItemActionPacketListener file. Search for: private static void firstAction(final Player player, Packet packet) { Scroll down to: Location targetLocation = player.getLocation(); Call the file and the method one line before or one line after like so Location targetLocation = player.getLocation(); MemberScrolls.claimScroll(player, itemId); Within the same file look for the id's to all the member scrolls, delete the whole case for them. Example below Delete from here case 10942: //all code inside break; To here for all of them and save your file then run your server and check out your fresh member scrolls! What do you do with the old MemberScrolls.java? click it. right click it. delete. Do you need some help adding this class? Hmu 😉 I will be happy to help. I do not give permission for anyone to charge for this code that I have just given for free. Feel free to point out any flaws in my code and I will be sure to rectify it 😉
  5. Dear members We are hosting an event that will allow you the chance to help Runeplace grow! check the image below out to find more information in relation on how to be a part of this event. The image says it all! Invite your friends to our discord server for your chance to win The winners will be chosen from the invite manager log You must have at least 10 invites to be eligible for entry! If caught cheating to boost your invites you will be eliminated from the event and all further events. We ask you to kindly think of what you are doing before you do it. We appreciate the gesture of good will but please do not go to other Rsps communities posting any information regarding runeplace if they do not wish for you to do so, if we get reports that your username has been in breach of this rule then we will have no option other than to forfeit you from the event. Thank you for reading! Stay safe, stay well and stay you 🙂 ~Runeplace Staff
  6. Dear members We need to keep a familiar format to each release which gives members the chance to see what they are downloading before they hit that link. Things you must do Post some information about the content you are releasing. Post clear media of the content being used. Post a virus scan of your content to ensure the safety of our members. Post credits to who ever deserves them. (Do not release something as your own if you have only downloaded and re-uploaded.) We care for all of our members. If you miss lead them into harms way you will be permanently banned! (Full virus scans on the files and ensure there are no programs within your content will compromise the member) Failure to comply with this simple list will result in Your topic being removed A temporary ban A permanent ban without a chance to appeal If you feel I should add something to this list, message me to let me know!
  7. Pat

    Omniscient

    The cache is with the files? Omniscient #119.zip
  8. Pat

    Necrotic Ruse

    This is not a leak this is a re-release so you do not have to download a torrent. Click me to download ↪ Server Features ↩ All credits to Necrotic for this release!
  9. Pat

    norse-master

    Thank you for your contribution to the community! People will love this xD
  10. I dunno my dude it looks to be as there are certain models there that should be there, they might have removed their personal models before releasing or something
  11. This theme is for invision software only. Fluent Design Theme Edition is a combination of Fluent Design styles Microsoft, iOS Design, Android Design and Google Design. Click To download This file Full credits to Craigcollo for this theme
  12. Pat

    Kappa

    This is some test spam to test the discord bot.
  13. Pat

    Santicity.gif

  14. Pat

    Santicity.gif

  15. Thank you for releasing your project with the community man!!! I hope people get what they need from this 🙂
×
×
  • Create New...