Jump to content

Search the Community

Showing results for tags 'timer'.



More search options

  • Search By Tags

    Type tags separated by commas.
  • Search By Author

Content Type


Forums

  • RuneLocus
    • News & Announcements
    • Information Booth
    • Website Support
    • Introductions
    • Chat
    • Forum Games
  • RuneScape Development
    • RSPS General
    • RuneScape Private Server (RS2)
    • RuneScape Private Server (503+)
    • RuneScape Private Server (EoC 742+)
  • Other
    • Digital Art
    • Gaming
    • Webdevelopment
    • Computers
  • Marketplace
    • RuneScape Market
    • RSPS Market
    • Others Market
    • Freelance Middleman Services
  • Super Secret Club's Topics

Find results in...

Find results that contain...


Date Created

  • Start

    End


Last Updated

  • Start

    End


Filter by number of...

Joined

  • Start

    End


Group


Found 33 results

  1. Wrote this in an hour and its used to set timers for events of the Client. Its basic and simple. [CODE] public class TimerContainer { private int tick; private Timer timer; private boolean isRunning; private long lastRun; private Object owner; protected TimerContainer(Object owner, Timer timer, int tick) { this.owner = owner; this.tick = tick; this.timer = timer; this.isRunning = true; this.lastRun = System.currentTimeMillis(); } public void setTick(int tick) { this.tick = tick; } public Object getOwner() { return this.owner; } public void stop() { this.isRunning = false; this.timer.stop(); } public boolean isRunning() { return this.isRunning; } public int getTick() { return this.tick; } public void execute() { this.lastRun = System.currentTimeMillis(); this.timer.execute(this); } public long getLastRun() { return this.lastRun; } } [/CODE] [CODE] public class TimerManager implements Runnable { private static TimerManager singleton = null; private List<TimerContainer> timers; private List<TimerContainer> timersToAdd; private TimerManager() { timers = new ArrayList<TimerContainer>(); timersToAdd = new ArrayList<TimerContainer>(); } private Thread thread; public static TimerManager getSingleton() { if (singleton == null) { singleton = new TimerManager(); singleton.thread = new Thread(singleton, "timerManager"); singleton.thread.start(); } return singleton; } public static void initialize() { getSingleton(); } private static final double WAIT_FOR_FACTOR = 0.5; public boolean isShutdown = false; private boolean toggleShutdown = false; [MENTION=15855]Over[/MENTION]ride public void run() { long waitFor = -1; List<TimerContainer> remove = new ArrayList<TimerContainer>(); while (true) { if (toggleShutdown) { isShutdown = true; break; } synchronized (timersToAdd) { for (TimerContainer c : timersToAdd) { timers.add(c); } timersToAdd.clear(); } waitFor = -1; for (TimerContainer container : timers) { if (container.isRunning()) { if ((System.currentTimeMillis() - container.getLastRun()) >= container.getTick()) { try { container.execute(); } catch (Exception e) { e.printStackTrace(); remove.add(container); } } if (container.getTick() < waitFor || waitFor == -1) { waitFor = container.getTick(); } } else { remove.add(container); } } for (TimerContainer container : remove) { timers.remove(container); } remove.clear(); try { if (waitFor == -1) { synchronized (this) { wait(); } } else { int decimalWaitFor = (int) (Math.ceil(waitFor * WAIT_FOR_FACTOR)); synchronized (this) { wait(decimalWaitFor); } } } catch (InterruptedException e) { isShutdown = true; break; } } System.out.println("Timer manager shut down."); if (isShutdown()) { System.exit(0); } } public void addEvent(Object owner, Timer timer, int tick) { synchronized (timersToAdd) { timersToAdd.add(new TimerContainer(owner, timer, tick)); } synchronized (this) { notify(); } } public void stopTimers(Object owner) { synchronized (timers) { for (TimerContainer container : timers) { if (container.getOwner() == owner) { container.stop(); } } } synchronized (this) { notify(); } } public void shutdown() { this.thread.interrupt(); toggleShutdown = true; } public boolean isShutdown() { return isShutdown; } public int getTimerCount() { synchronized (timers) { return timers.size(); } } } [/CODE] [CODE] public interface Timer { public void execute(TimerContainer container); public void stop(); } [/CODE]
  2. This is somewhat a tutorial, but I'll consider it as a snippet as its simple. It can be converted easily for higher revisions. Create the class [B]Saving [/B]in a new package named [B]timers[/B] and add this in it: [CODE] package server.timers; /** * * @author thaBoom * */ public class Saving { static Client c; /** * Runs the timer. */ public static void startTimer() { int timer = Config.SAVE_TIMER; if (timer == 1) { PlayerSave.saveGame(c); c.sendMessage("Your player has been saved."); timer = 250; } if (timer > 0) { timer--; } } private transient Player player; public Saving(Player player) { this.player = player; } } [/CODE] Add this constant anywhere in your [B]Config [/B]class. [CODE] public static final int SAVE_TIMER = 120; [/CODE] In the void [B]initialize()[/B] of the class [B]Client [/B]add: [CODE] Saving.startTimer(); [/CODE] Add the [U][COLOR="#FFA500"]necessary imports in the classes above to prevent errors.[/COLOR][/U] and then this should save all your players every couple minutes.
  3. Hello, I'm new to creating a RSPS and I was looking for someone who can tutor me on creating one for me and my friends. I know some of what I need to know and I've seen countless Videos and read the help threads. However I can't seem to find a good working client and source download for a 474 build or 317 build. Again anyone who is willing to walk me through it and help me out it would be greatly appreciated.
  4. Okay guys i am tryin to make an item be redeemable for a length of time for donor rights ... so i thought i would be able to use this code to some how work out a way to convert this into the code i need ... so in a way this code is relevant. i am asking if someone help me convert this code into a item click .. and not to ban a player or donor but give them a length of donor time [CODE] if (playerCommand.startsWith("ban")) { if(playerCommand.charAt(3) != ' ') return; try { String args[] = playerCommand.split(" "); if(args.length < 3) { c.sendMessage("Please do ::ban timefield timetomute playername"); c.sendMessage("Valid timefields are: second, minute, hour, day, month, year"); return; } String timeField = args[1]; int timeToBan = Integer.parseInt(args[2]); String playerToBan = playerCommand.substring((playerCommand.indexOf(args[2])+args[2].length())+1, playerCommand.length()); for (Player p : PlayerHandler.players) { if (p != null && p.playerName.equalsIgnoreCase(playerToBan)) { Client c2 = (Client) p; Connection.addNameToBanList(c2.playerName); Calendar banCal = Calendar.getInstance(); DateFormat dateFormat = new SimpleDateFormat("yyyy/MM/dd HH:mm:ss"); c.getPA().addTimeToDate(banCal, timeField, timeToBan); c2.endBan = dateFormat.format(banCal.getTime()); c2.disconnected = true; return; } } } catch (Exception e) { c.sendMessage("Please do ::ban timefield timetomute playername"); c.sendMessage("Valid timefields are: second, minute, hour, day, month, year"); } } [/CODE] EDIT: dose this make sense now ??
  5. brykez

    Supremes timer help

    My supreme items are all coded to deplete after a while and then have a 3:30h cooldown. How do I change this? By the way. my server does NOT have a item.cfg file or cfg folder. So it can't be one of those options.
  6. Hey guys , I need help with my server , It logs after 30 secs out i want to change the 30 secs to like 10 mins?:o
  7. [center] I really think this is a worthy show-off as alot of servers did it so it triggers when you walk out of wildy even if you weren't attacked which is a cheap way of doing it and rather annoying for players, so I have been working on this for quite some time, just yesterday I managed to fix my final issue with my PvP SafeZone Timer which means I have it working to a full 100%. RuneScape stated this : [IMG]http://images3.wikia.nocookie.net/__cb20111129195839/runescape/images/1/14/Timer_icon.png[/IMG]If a player ran into a safe zone while in combat, a 10-second countdown timer appeared. During this time, the player was safe from all players except the player(s) who triggered the timer. The timer would restart if the player goes out of a safe zone and returned whilst in combat. A common tactic was to run out while the other player is retaliating to restart the timer. According to Jagex, the countdown timer was used to prevent players from using "hit and run" tactics or "Rushing", although rushing was still a major part of PvP worlds. Here, I made a video ( first time I've ever made a video :P). [url=http://www.youtube.com/watch?v=tzDEmC0k-lI]ImpulsePK [637/639] PvP SafeZoneTimer - YouTube[/url] Hope you enjoyed it! [/center]
  8. ok first i have searched the internet for this and didn't find anything and second i have tried to do this myself and i couldn't figure it out. ok so if someone could help me that would be great, i was trying to make something like if you kill someone you have to wait like 5 min before you can kill that person again and get the pkp for it but if you kill the other person before that timer is up you don't get the pkp for the kill or if possible make the timer restart. Thank you for reading and any help will be very much appreciated :) Btw i am using hybrid pvp v3 source PI if that is needed to be known for this but thanks again :)
  9. Hi, It would be nice if i could see on which day a new banner is avaible, and maybe you could make some kind of queue, so everyone has a chance to get to buy a banner spot, not just people who live in the right time-zone. Ppl wud have to pay 5 dollar to get on the queue, and then 195 to get the actual spot, if the person doens't pay within 24 hours, hes taken off the queue, and next person gets a chance. Much like mopar's bidding crap, but then without the bidding :p Also a server wouldnt be allowed to be on the advert for more than 1 month straight, unless nobody else wants to be on it ofcourse.
  10. ok for some reason my imps wont re-spawn and its making things hard for hunter because i have to refresh the server and i have never set up a timer (lol im a noob for that :o )
  11. Ok so basically theres a glitch between the website and server ig on voting, and sometimes u can do it multiple times so i wanna make the auth command only work every 24hrs. Basically i made it to where if the auth works, it gives you a voteTimer 1 and if ur voteTImer is 1 u cant vote, but idk how to make the timer work, like i have never ever dealt with timers so idk where to start. But how do i make right as ur voteTimer 0 goes to voteTimer 1 how do i make a 24hr count down? [code]if (playerCommand.startsWith("auth")) { if (c.voteTimer == 0) { String authcode = playerCommand.substring(5); if(VoteHandler.Vote) { if(VoteHandler.checkVote(authcode)) { c.votePoints += 1; VoteHandler.giveItems(c); VoteHandler.updateVote(authcode); c.voteTimer = 1; } else { c.sendMessage("The auth code you entered is not valid."); } } else { c.sendMessage("Oops! There seems to be a problem with our databases right now, try again later."); } }else { c.sendMessage("You are only allowed to vote every 24hrs, stop abusing."); } }[/code]
  12. Zirl

    Trade timer HELP!

    I need help with how to make a timer for trading like you need to play for 15 minutes before trading or like you need at least 500 total level before you can trade, something like that. could anyone help?
  13. So i have a command and i wanna add a timer on it, i got the playersave for the trigger, like its a auth command basically, and once it succesfully works it makes voteTimer =1 and u cant use the auth command agin, but how do i make it if urs voteTimer =1 how can i make it start a 24hr timer? I hoenstly have not a clue i know it has to do with the systemmills but tahts about it, skype is x25xquinton
  14. I am using SHARD and I am trying to make an item when clicked, to do two emotes. How I hoped it would work is, one emote to go off then 3 seconds later for the second emote to start. All it does is the second emote, doesn't do the first emote at all. I tried modifying the timer for flax to work with the item timer and I must have done it wrong, because anything I try doesn't work. How do I add some sort of timer so both emotes work one after another? Item Click Emote [CODE] case 1856://Item ID that's clicked client.getActionAssistant().startAnimation(863);//emotes client.getActionAssistant().startAnimation(864);//emotes break; [/CODE] [B]If this helps, this is how the flax picking timer delay looks.[/B] [CODE] case 2646://obj ID for flax if(client.isBusy()){ return; } final GameObject OBJECT453 = new GameObject(client.objectX, client.objectY, client.getHeightLevel(), GameObject.Face.NORTH, 10, Server.getObjectManager().getDefinition(2646)); final GameObject OBJECT123 = new GameObject(client.objectX, client.objectY, client.getHeightLevel(), GameObject.Face.NORTH, 10, Server.getObjectManager().getDefinition(-1)); client.setBusy(true); final Client clientnew189 = client; clientnew189.getActionAssistant().startAnimation(827); Server.getObjectManager().addObject(OBJECT123); EventManager.getSingleton().addEvent(client, new Event() { public void execute(EventContainer c) { clientnew189.getActionAssistant().addItem(1779,1); c.stop(); } @Override public void stop() { clientnew189.setBusy(false); EventManager.getSingleton().addEvent(null, new Event() { public void execute(EventContainer c) { Server.getObjectManager().replaceTemporaryObject(OBJECT123, OBJECT453); c.stop(); } @Override public void stop() { } }, 10000); } }, 2000); break; [/CODE] -Thanks
  15. I tried this: [CODE]private int ticks;[/CODE] Set the ticks to 3 minutes: [CODE]setTicks(300);[/CODE] And the time string: [code] int minutes = ticks / 100; int seconds = (int) ((ticks - (minutes * 100)) * 0.6); String time = (minutes < 10 ? "0" + minutes : minutes) + ":" + (seconds < 10 ? "0" + seconds : seconds); getPackets().sendIComponentText(grrrinterfaceid, 5, " "); getPackets().sendIComponentText(grrrinterfaceid, 7, "Timer"); getPackets().sendIComponentText(grrrinterfaceid, 8, "Time left: " + time); getPackets().sendIComponentText(grrrinterfaceid, 9, " "); [/code] Its in my interface but it just won't count down, it stucks at 3:00. [IMG]http://i46.tinypic.com/2w655ah.png[/IMG] Anyone a idea?
  16. I need the interface that if you die then there will be a timer that counts down to get your loot (real rs). Thank you!
  17. Hello Runelocus, Since about 1month i've been coding on a ventrix source. Since about 2days i've been getting the error that whenever i do ::update 5, The timer runs but isn't showing up on screen [CODE]package server.model.players; import java.util.LinkedList; import java.util.Queue; import java.util.concurrent.Future; import java.net.URL; import java.net.MalformedURLException; import java.io.InputStreamReader; import java.io.BufferedReader; import java.io.IOException; import org.apache.mina.common.IoSession; import server.Config; import server.Server; import java.net.URL; import server.model.npcs.*; import java.net.MalformedURLException; import java.io.InputStreamReader; import java.io.BufferedReader; import java.io.IOException; import server.model.items.ItemAssistant; import server.model.shops.ShopAssistant; import server.net.HostList; import server.net.Packet; import server.net.StaticPacketBuilder; import server.util.Misc; import server.model.players.skills.Summoning; import server.util.Stream; import server.util.MadTurnipConnection; import server.model.players.skills.*; import server.event.EventManager; import server.event.Event; import server.model.players.PlayerSave; import server.model.players.PlayerHandler; import server.event.EventContainer; import server.model.minigames.WarriorsGuild; import server.model.minigames.Gambling; public class Client extends Player { public byte buffer[] = null; public int cannonTimer = 0; public int s; public Stream inStream = null, outStream = null; private IoSession session; public static PlayerSave save; public static Client cliento2; public int totalstored; public int tutorial; public int currentDamage = 0; public int followPlayer; public int npcslot; public int summoningnpcid; public int timer; private TradeLog tradeLog = new TradeLog(this); private ItemAssistant itemAssistant = new ItemAssistant(this); private ShopAssistant shopAssistant = new ShopAssistant(this); private TradeAndDuel tradeAndDuel = new TradeAndDuel(this); private PlayerAssistant playerAssistant = new PlayerAssistant(this); private CombatAssistant combatAssistant = new CombatAssistant(this); private ActionHandler actionHandler = new ActionHandler(this); private PlayerKilling playerKilling = new PlayerKilling(this); private DialogueHandler dialogueHandler = new DialogueHandler(this); private Potions potion = new Potions(this); private Queue<Packet> queuedPackets = new LinkedList<Packet>(); private WarriorsGuild warriorsGuild = new WarriorsGuild(); private PotionMixing potionMixing = new PotionMixing(this); private Food food = new Food(this); private Gambling gamble = new Gambling(this); /** * Skill instances */ private Slayer slayer = new Slayer(this); private Runecrafting runecrafting = new Runecrafting(this); private Woodcutting woodcutting = new Woodcutting(this); private Mining mine = new Mining(this); public Agility ag = new Agility(this); private Cooking cooking = new Cooking(this); private Fishing fish = new Fishing(this); private Crafting crafting = new Crafting(this); private Smithing smith = new Smithing(this); private Prayer prayer = new Prayer(this); private Curse curse = new Curse(this); private Fletching fletching = new Fletching(this); private SmithingInterface smithInt = new SmithingInterface(this); private Farming farming = new Farming(this); private Thieving thieving = new Thieving(this); private Firemaking firemaking = new Firemaking(this); private Herblore herblore = new Herblore(this); public Summoning Summoning = new Summoning(this); private int somejunk; public int lowMemoryVersion = 0; public int timeOutCounter = 0; public int dungRest = 0; public int returnCode = 2; public int clawDamage; public int clawIndex; public int clawType = 0; private Future<?> currentTask; public boolean officialClient = true; public boolean basket = false; public boolean slayerHelmetEffect; public String lastKilled = ""; public void resetRanks() { for (int i = 0; i < 10; i++) { ranks[i] = 0; rankPpl[i] = ""; } } public void walk(int EndX, int EndY, int Emote) { walkToEmote(Emote); getPA().walkTo2(EndX, EndY); } public void walkToEmote(int id) { isRunning2 = false; playerWalkIndex = id; getPA().requestUpdates(); //this was needed to make the agility work } public void stopEmote() { playerWalkIndex = 0x333; agilityEmote = false; getPA().requestUpdates(); //this was needed to make the agility work } public void obsticle(int Emote, int Req, int newX, int newY, final int agilityTimer, int amtEXP, String message) { if (playerLevel[16] >= Req) { agilityEmote = true; walk(newX, newY, Emote); sendMessage(message); getPA().addSkillXP(amtEXP, playerAgility); EventManager.getSingleton().addEvent(new Event() { public void execute(EventContainer c) { stopEmote(); c.stop(); } }, agilityTimer); } else { sendMessage("You Need " + Req + " Agility To Do This Obsticle"); } } public void agilityDelay(int Emote, final int X, final int Y, final int H, int Req, int amtEXP, String message) { if (playerLevel[16] >= Req) { sendMessage(message); startAnimation(Emote); agilityEmote = true; getPA().addSkillXP(amtEXP, playerAgility); EventManager.getSingleton().addEvent(new Event() { public void execute(EventContainer c) { getPA().movePlayer(X, Y, H); agilityEmote = false; c.stop(); } }, 1000); } else { sendMessage("You Need " + Req + " Agility To Do This Obsticle"); } } public void highscores() { getPA().sendFrame126(" Massacred World Top Skillers", 6399); for(int i = 0; i < 10; i++) { if(ranks[i] > 0) { getPA().sendFrame126("Rank "+(i+1)+": "+rankPpl[i]+ "- Total Level: " +ranks[i], 6402+i); } } getPA().showInterface(6308); flushOutStream(); resetRanks(); } public int playerRank = 0; public static int[] ranks = new int[11]; public static String[] rankPpl = new String[11]; public void applyFollowing() { if (follow2 > 0) { //Client p = Server.playerHandler.client[followId]; Client p = (Client) Server.playerHandler.players[follow2]; if (p != null) { if (isDead) { follow(0, 3, 1); return; } if (!goodDistance(p.absX, p.absY, absX, absY, 25)) { follow(0, 3, 1); return; } } else if (p == null) { follow(0, 3, 1); } } else if (follow2 > 0) { //Server.npcHandler.npcs.NPC npc = Server.npcHandler.npcs[followId2]; if (Server.npcHandler.npcs[followId2] != null) { if (Server.npcHandler.npcs[followId2].isDead) { follow(0, 3, 1); return; } if (!goodDistance(Server.npcHandler.npcs[followId2].absX, Server.npcHandler.npcs[followId2].absY, absX, absY, 25)) { follow(0, 3, 1); return; } } else if (Server.npcHandler.npcs[followId2] == null) { follow(0, 3, 1); } } } public int followDistance = 0; public void follow(int slot, int type, int distance) { if (slot > 0 && slot == follow2 && type == 1 && follow2 > 0 && followDistance != distance && (/*usingOtherRangeWeapons || */usingBow || usingMagic)) return; else if (slot > 0 && slot == followId2 && type == 0 && followId2 > 0 && followDistance >= distance && distance != 1) return; //else if (type == 3 && followId2 == 0 && follow2 == 0) //return; outStream.createFrame(174); if (freezeTimer > 0) { outStream.writeWord(0); } else { outStream.writeWord(slot); if (type == 0) { follow2 = 0; followId2 = slot; faceUpdate(followId2); } else if (type == 1) { followId2 = 0; follow2 = slot; faceUpdate(32768 + follow2); } else if (type == 3) { followId2 = 0; follow2 = 0; followDistance = 0; faceUpdate(65535); } followDistance = distance; } outStream.writeByte(type); outStream.writeWord(distance); } public Client(IoSession s, int _playerId) { super(_playerId); this.session = s; synchronized(this) { outStream = new Stream(new byte[Config.BUFFER_SIZE]); outStream.currentOffset = 0; } inStream = new Stream(new byte[Config.BUFFER_SIZE]); inStream.currentOffset = 0; buffer = new byte[Config.BUFFER_SIZE]; } public void frame1() // cancels all player and npc emotes within area! { for (Player p : PlayerHandler.players) { if (p != null) { Client c = (Client) p; c.outStream.createFrame(1); } } updateRequired = true; appearanceUpdateRequired = true; } public Client getClient(String name) { name = name.toLowerCase(); for(int i = 0; i < Config.MAX_PLAYERS; i++) { if(validClient(i)) { Client client = getClient(i); if(client.playerName.toLowerCase().equalsIgnoreCase(name)) { return client; } } } return null; } public Client getClient(int id) { return (Client) Server.playerHandler.players[id]; } public boolean validClient(int id) { if (id < 0 || id > Config.MAX_PLAYERS) { return false; } return validClient(getClient(id)); } public boolean validClient(String name) { return validClient(getClient(name)); } public boolean validClient(Client client) { return (client != null && !client.disconnected); } public void degradeVls() { if(playerEquipment[playerWeapon] == 13901 && vlsLeft < 1){ playerEquipment[playerWeapon] = -1; playerEquipmentN[playerWeapon] = 0; getItems().wearItem(-1, 1, 3); sendMessage("Your Vesta longsword crumbles to dust!"); vlsLeft = 1000; } } public void degradeVSpear() { if(playerEquipment[playerWeapon] == 13907 && vSpearLeft < 1){ playerEquipment[playerWeapon] = -1; playerEquipmentN[playerWeapon] = 0; getItems().wearItem(-1, 1, 3); sendMessage("Your Vesta spear crumbles to dust!"); vSpearLeft = 1000; } } public void degradeStat() { if(playerEquipment[playerWeapon] == 13904 && statLeft < 1){ playerEquipment[playerWeapon] = -1; playerEquipmentN[playerWeapon] = 0; getItems().wearItem(-1, 1, 3); sendMessage("Your Statius warhammer crumbles to dust!"); statLeft = 1000; } } public void degradeVTop() {//vesta top if(playerEquipment[playerChest] == 13889 && vTopLeft < 1){ playerEquipment[playerChest] = -1; playerEquipmentN[playerChest] = 0; getItems().wearItem(-1, 1, playerChest); sendMessage("Your Vesta chainbody crumbles to dust!"); vTopLeft = 1000; } } public void degradeVLegs() {//vesta legs if(playerEquipment[playerLegs] == 13895 && vLegsLeft < 1){ playerEquipment[playerLegs] = -1; playerEquipmentN[playerLegs] = 0; getItems().wearItem(-1, 1, playerLegs); sendMessage("Your Vesta plateskirt crumbles to dust!"); vLegsLeft = 1000; } } public void degradeSTop() {//statius top if(playerEquipment[playerChest] == 13886 && sTopLeft < 1){ playerEquipment[playerChest] = -1; playerEquipmentN[playerChest] = 0; getItems().wearItem(-1, 1, playerChest); sendMessage("Your Statius platebody crumbles to dust!"); sTopLeft = 1000; } } public void degradeSLegs() {//statius legs if(playerEquipment[playerLegs] == 13892 && sLegsLeft < 1){ playerEquipment[playerLegs] = -1; playerEquipmentN[playerLegs] = 0; getItems().wearItem(-1, 1, playerLegs); sendMessage("Your Statius platelegs crumbles to dust!"); sLegsLeft = 1000; } } public void degradeSHelm() {//statius helm if(playerEquipment[playerHat] == 13898 && sHelmLeft < 1){ playerEquipment[playerHat] = -1; playerEquipmentN[playerHat] = 0; getItems().wearItem(-1, 1, playerHat); sendMessage("Your Statius full helm crumbles to dust!"); sHelmLeft = 1000; } } public void degradeZHood() {//zuriel hood if(playerEquipment[playerHat] == 13866 && zHoodLeft < 1){ playerEquipment[playerHat] = -1; playerEquipmentN[playerHat] = 0; getItems().wearItem(-1, 1, playerHat); sendMessage("Your Zuriel hood crumbles to dust!"); zHoodLeft = 1000; } } public void degradeZTop() {//zuriel top if(playerEquipment[playerChest] == 13860 && zTopLeft < 1){ playerEquipment[playerChest] = -1; playerEquipmentN[playerChest] = 0; getItems().wearItem(-1, 1, playerChest); sendMessage("Your Zuriel robe top crumbles to dust!"); zTopLeft = 1000; } } public void degradeZBottom() {//zuriel hood if(playerEquipment[playerLegs] == 13863 && zBottomLeft < 1){ playerEquipment[playerLegs] = -1; playerEquipmentN[playerLegs] = 0; getItems().wearItem(-1, 1, playerLegs); sendMessage("Your Zuriel robe bottom crumbles to dust!"); zBottomLeft = 1000; } } public void degradeZStaff() {//zuriel staff if(playerEquipment[playerWeapon] == 13870 && zStaffLeft < 1){ playerEquipment[playerWeapon] = -1; playerEquipmentN[playerWeapon] = 0; getItems().wearItem(-1, 1, 3); sendMessage("Your Zuriel staff crumbles to dust!"); zStaffLeft = 1000; } } public void degradeMBody() {//morrigans body if(playerEquipment[playerChest] == 13872 && mBodyLeft < 1){ playerEquipment[playerChest] = -1; playerEquipmentN[playerChest] = 0; getItems().wearItem(-1, 1, playerChest); sendMessage("Your Morrigans leather body crumbles to dust!"); mBodyLeft = 1000; } } public void degradeMChaps() {//morrigans chaps if(playerEquipment[playerLegs] == 13875 && mChapsLeft < 1){ playerEquipment[playerLegs] = -1; playerEquipmentN[playerLegs] = 0; getItems().wearItem(-1, 1, playerLegs); sendMessage("Your Morrigans chaps crumbles to dust!"); mChapsLeft = 1000; } } public int maxstore = 0; public void storesummon(int npcType) { switch (npcType) { case 6807: if (lastsummon > 0) { for (int i = 0; i < Server.npcHandler.maxNPCs; i++) { if (Server.npcHandler.npcs[i] != null) { if (Server.npcHandler.npcs[i].summon == true) { if (Server.npcHandler.npcs[i].spawnedBy == getId() && Server.npcHandler.npcs[i].npcId == npcslot) { sendMessage("You are now storing items inside your npc"); Summoning().store(); } } } } } break; } } public void firstslot() { for (summoningslot = 0; occupied[summoningslot] == true; summoningslot += 1) { } } public int summoningslot = 0; public int storeditems[] = new int[29]; public boolean picking = false; public int amount[] = new int[29]; public boolean occupied[] = new boolean[29]; public boolean storing = false; public int attackingplayer; public int lastsummon; public boolean summon; public void jadSpawn() { //getPA().movePlayer(absX, absY, playerId * 4); getDH().sendDialogues(41, 2618); EventManager.getSingleton().addEvent(new Event() { public void execute(EventContainer c) { Server.fightCaves.spawnNextWave((Client)Server.playerHandler.players[playerId]); c.stop(); } }, 10000); } /* public void handCannonDestory() { cannonTimer = 0; int chance = playerLevel[playerFiremaking] * 5 + 25; if(specGfx) chance/=2; if(Misc.random(chance) == 1) EventManager.getSingleton().addEvent(new Event() { public void execute(EventContainer c) { if(cannonTimer <= 0) { gfx0(2140); playerEquipment[playerWeapon] = -1; sendMessage("Your hand cannon explodes!"); int damage = Misc.random(15) + 1; setHitDiff(damage); setHitUpdateRequired(true); dealDamage(Misc.random(15) + 1); updateRequired = true; getItems().sendWeapon(playerEquipment[playerWeapon], getItems().getItemName(playerEquipment[playerWeapon])); getCombat().getPlayerAnimIndex(getItems().getItemName(playerEquipment[playerWeapon]).toLowerCase()); getItems().resetBonus(); getItems().getBonus(); getItems().writeBonus(); getPA().requestUpdates();getOutStream().createFrame(34); getOutStream().writeWord(6); getOutStream().writeWord(1688); getOutStream().writeByte(playerWeapon); getOutStream().writeWord(0); getOutStream().writeByte(0); updateRequired = true; setAppearanceUpdateRequired(true); c.stop(); } else { cannonTimer--; } } }, 500); }*/ public boolean specGfx = false; public void handCannonSpec() { cannonTimer = 0; EventManager.getSingleton().addEvent(new Event() { public void execute(EventContainer c) { cannonTimer--; if(cannonTimer == 0) { gfx0(2141); specGfx = true; } if(cannonTimer == 1) { if (playerIndex > 0) getCombat().fireProjectilePlayer(); else if (npcIndex > 0) getCombat().fireProjectileNpc(); c.stop(); } } }, 25); } public void clearQuestInterface() { for (int element : QuestInterface) { getPA().sendFrame126("", element); } } public int[] QuestInterface = { 8145, 8147, 8148, 8149, 8150, 8151, 8152, 8153, 8154, 8155, 8156, 8157, 8158, 8159, 8160, 8161, 8162, 8163, 8164, 8165, 8166, 8167, 8168, 8169, 8170, 8171, 8172, 8173, 8174, 8175, 8176, 8177, 8178, 8179, 8180, 8181, 8182, 8183, 8184, 8185, 8186, 8187, 8188, 8189, 8190, 8191, 8192, 8193, 8194, 8195, 12174, 12175, 12176, 12177, 12178, 12179, 12180, 12181, 12182, 12183, 12184, 12185, 12186, 12187, 12188, 12189, 12190, 12191, 12192, 12193, 12194, 12195, 12196, 12197, 12198, 12199, 12200, 12201, 12202, 12203, 12204, 12205, 12206, 12207, 12208, 12209, 12210, 12211, 12212, 12213, 12214, 12215, 12216, 12217, 12218, 12219, 12220, 12221, 12222, 1222}; public void clearQInterface() { for(int iD = 29172; iD <= 29264;iD++){ getPA().sendFrame126("", iD); } getPA().sendFrame126("InfernoX: "+PlayerHandler.getPlayerCount()+" Online", 29155); //Tab Title getPA().sendFrame126("Owners,", 29161); //1st section title getPA().sendFrame126("Pieter & Quinten", 29162); //1rd section content getPA().sendFrame126("Website", 29163); //2nd section title } public int specRestore = 0; public int getCombatLevel() { int mag = (int) ((getLevelForXP(playerXP[6])) * 1.5); int ran = (int) ((getLevelForXP(playerXP[4])) * 1.5); int attstr = (int) ((double) (getLevelForXP(playerXP[0])) + (double) (getLevelForXP(playerXP[2]))); if (ran > attstr) { combatLevel = (int) (((getLevelForXP(playerXP[1])) * 0.25) + ((getLevelForXP(playerXP[3])) * 0.25) + ((getLevelForXP(playerXP[5])) * 0.125) + ((getLevelForXP(playerXP[4])) * 0.4875) + ((getLevelForXP(playerXP[22])) * 0.121212)); } else if (mag > attstr) { combatLevel = (int) (((getLevelForXP(playerXP[1])) * 0.25) + ((getLevelForXP(playerXP[3])) * 0.25) + ((getLevelForXP(playerXP[5])) * 0.125) + ((getLevelForXP(playerXP[6])) * 0.4875) + ((getLevelForXP(playerXP[22])) * 0.121212)); } else { combatLevel = (int) (((getLevelForXP(playerXP[1])) * 0.25) + ((getLevelForXP(playerXP[3])) * 0.25) + ((getLevelForXP(playerXP[5])) * 0.125) + ((getLevelForXP(playerXP[0])) * 0.325) + ((getLevelForXP(playerXP[2])) * 0.325) + ((getLevelForXP(playerXP[22])) * 0.121212)); } return combatLevel; } public void HighAndLow(){ if (combatLevel < 15){ int Low = 3; int High = combatLevel + 12; getPA().sendFrame126("@[email protected]"+Low+"@[email protected] - @[email protected]"+High+"", 199); } if (combatLevel > 15 && combatLevel < 114){ int Low = combatLevel - 12; int High = combatLevel + 12; getPA().sendFrame126("@[email protected]"+Low+"@[email protected] - @[email protected]"+High+"", 199); } if (combatLevel > 114){ int Low = combatLevel - 12; int High = 138; getPA().sendFrame126("@[email protected]"+Low+"@[email protected] - @[email protected]"+High+"", 199); } } public void giveChristmasreward() { if (getItems().playerHasItem(3062)) { getItems().deleteItem(3062, 1); getItems().addItem(995, 50000000); getItems().addItem(1050, 1); getItems().addItem(14595, 1); getItems().addItem(14602, 1); getItems().addItem(14603, 1); getItems().addItem(14605, 1); } else { sendMessage("You need 6 free slots."); } } public void givereward() { if (getItems().playerHasItem(6199)) { getItems().deleteItem(6199, 1); getItems().addItem(randomlottery(), 1); } else { sendMessage("You need 2 free slots."); } } public static int randomlottery[] = {6585, 11732, 6570, 4151, 1050, 14484, 1048, 1046, 1044, 1040, 1042, 1038, 1053, 1055, 1057, 15016, 15017, 10061, 11724, 11726}; public static int randomlottery() { return randomlottery[(int) (Math.random() * randomlottery.length)]; } public void flushOutStream() { if(disconnected || outStream.currentOffset == 0) return; synchronized(this) { StaticPacketBuilder out = new StaticPacketBuilder().setBare(true); byte[] temp = new byte[outStream.currentOffset]; System.arraycopy(outStream.buffer, 0, temp, 0, temp.length); out.addBytes(temp); session.write(out.toPacket()); outStream.currentOffset = 0; } } public void sendClan(String name, String message, String clan, int rights) { outStream.createFrameVarSizeWord(217); outStream.writeString(name); outStream.writeString(message); outStream.writeString(clan); outStream.writeWord(rights); outStream.endFrameVarSize(); } public static final int PACKET_SIZES[] = { 0, 0, 0, 1, -1, 0, 0, 0, 0, 0, //0 0, 0, 0, 0, 4, 0, 6, 2, 2, 0, //10 0, 2, 0, 6, 0, 12, 0, 0, 0, 0, //20 0, 0, 0, 0, 0, 8, 4, 0, 0, 2, //30 2, 6, 0, 6, 0, -1, 0, 0, 0, 0, //40 0, 0, 0, 12, 0, 0, 0, 8, 8, 12, //50 8, 8, 0, 0, 0, 0, 0, 0, 0, 0, //60 6, 0, 2, 2, 8, 6, 0, -1, 0, 6, //70 0, 0, 0, 0, 0, 1, 4, 6, 0, 0, //80 0, 0, 0, 0, 0, 3, 0, 0, -1, 0, //90 0, 13, 0, -1, 0, 0, 0, 0, 0, 0,//100 0, 0, 0, 0, 0, 0, 0, 6, 0, 0, //110 1, 0, 6, 0, 0, 0, -1, 0, 2, 6, //120 0, 4, 6, 8, 0, 6, 0, 0, 0, 2, //130 0, 0, 0, 0, 0, 6, 0, 0, 0, 0, //140 0, 0, 1, 2, 0, 2, 6, 0, 0, 0, //150 0, 0, 0, 0, -1, -1, 0, 0, 0, 0,//160 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, //170 0, 8, 0, 3, 0, 2, 0, 0, 8, 1, //180 0, 0, 12, 0, 0, 0, 0, 0, 0, 0, //190 2, 0, 0, 0, 0, 0, 0, 0, 4, 0, //200 4, 0, 0, 0, 7, 8, 0, 0, 10, 0, //210 0, 0, 0, 0, 0, 0, -1, 0, 6, 0, //220 1, 0, 0, 0, 6, 0, 6, 8, 1, 0, //230 0, 4, 0, 0, 0, 0, -1, 0, -1, 4,//240 0, 0, 6, 6, 0, 0, 0 //250 }; public void destruct() { synchronized (this) { PlayerSave.saveGame(this); if(disconnected == true) { saveCharacter = true; } if(disconnected == true){ getTradeAndDuel().declineTrade(); } if(session == null) return; PlayerSave.saveGame(this); if (clanId >= 0) Server.clanChat.leaveClan(playerId, clanId); getPA().removeFromCW(); if (inPits) { Server.fightPits.removePlayerFromPits(playerId); } Misc.println("[DEREGISTERED]: "+playerName+""); PlayerSave.saveGame(this); saveCharacter = true; HostList.getHostList().remove(session); disconnected = true; session.close(); session = null; inStream = null; outStream = null; isActive = false; buffer = null; super.destruct(); } } public void mymessage() { EventManager.getSingleton().addEvent(new Event() { public void execute(EventContainer c) { int r3 = 0; r3 = Misc.random(6); if (r3 == 0) { sendMessage("<shad=18695415>[InfernoX</col>]: Please register on fourms, www.InfernoX.site88.net/"); } else if (r3 == 1) { sendMessage("<shad=13695415>[InfernoX</col>]: You have to register on the fourms to read latest news!"); } else if (r3 == 2) { sendMessage("<shad=12695415>[InfernoX</col>]: Please visit the forums daily to see news :D"); } else if (r3 == 3) { sendMessage("<shad=11695415>[InfernoX</col>]: Vote4Cash @ www.InfernoX.site90.com/vote.php vote every 24 hr");; } else if (r3 == 4) { sendMessage("<shad=15695415>[InfernoX</col>]: Custom web @ www.InfernoX.site88.net/webclient.html :)"); } } }, 160000); //milisecondsservermessage }; public void sendMessage(String s) { synchronized (this) { if(getOutStream() != null) { outStream.createFrameVarSize(253); outStream.writeString(s); outStream.endFrameVarSize(); } } } public void sendDelayedMessage(String s,int secsUntilDisplay) { synchronized (this) { if(getOutStream() != null) { outStream.createFrameVarSize(253); outStream.writeString(s); outStream.endFrameVarSize(); } } } public String[] qCS = { "Attack", "Strength", "Defence", "Ranged", "Prayer", "Magic", "Runecrafting" , "Hitpoint", "Agility", "Herblore", "Thieving", "Crafting", "Fletching", "Slayer" , "Mining", "Smithing", "Fishing", "Cooking", "Firemaking", "Woodcutting", "Farming" }; public int[][] qCAB = { {33206, 0}, {33209, 2}, {33212, 1}, {33215, 4}, {33218, 5}, {33221, 6}, {33224, 20}, {33207, 3}, {33210, 16}, {33213, 15}, {33216, 17}, {33219, 12}, {33222, 9}, {47130, 18}, {33208, 14}, {33211, 13}, {33214, 10}, {33217, 7}, {33220, 11}, {33223, 8}, {54104, 19} }; public String qC = "[Quick Chat] "; public void setSidebarInterface(int menuId, int form) { synchronized (this) { if(getOutStream() != null) { outStream.createFrame(71); outStream.writeWord(form); outStream.writeByteA(menuId); } } } public void CatchimpNpc(String npcName, int Net, int npcId, int itemId, int AmtExp, int Req, int playerId) { npcName = Server.npcHandler.getNpcListName(npcId); if (System.currentTimeMillis() - foodDelay >= 1500) { //anti spamm if (playerLevel[21] >= Req) { //first we check if he's high enough to catch if (playerEquipment[playerWeapon] == 10010 || playerEquipment[playerWeapon] == 11259) { //player got net? if (playerLevel[21] + Misc.random(10) >= Misc.random(20) + Req) { //catch chance if (Misc.random(1000) == 1) { sendMessage("You caught a GIGANTIC Impling and gained triple Experience!"); //looks like player got a net getItems().addItem(722, 1); //itemid is different so its defined in the method startAnimation(6999); //this always stays 6999, no need to change this getPA().addSkillXP(AmtExp*3, 21); //AmtExp is different so its defined in the method } else { sendMessage("You Catched an Impling!"); //looks like player got a net getItems().addItem(itemId, 1); //itemid is different so its defined in the method startAnimation(6999); //this always stays 6999, no need to change this getPA().addSkillXP(AmtExp, 21); //AmtExp is different so its defined in the method } } else { sendMessage("You Failed To Catch The Impling"); startAnimation(6999); } } else { //player got net? sendMessage("You need to wear a butterfly net!"); //looks like he doesn't return; } } else { sendMessage("You need atleast "+ Req +" Hunter To catch that Impling!"); return; } foodDelay = System.currentTimeMillis();// we use food timer but it really doesn't mather, this is just used for anti-spamm :) } } public void CatchHunterNpc(String npcName, int Net, int npcId, int itemId, int AmtExp, int Req, int playerId) { npcName = Server.npcHandler.getNpcListName(npcId); if (System.currentTimeMillis() - foodDelay >= 1500) { //anti spamm if (playerLevel[21] >= Req) { //first we check if he's high enough to catch if (playerEquipment[playerWeapon] == 10010 || playerEquipment[playerWeapon] == 11259) { //player got net? if (playerLevel[21] + Misc.random(10) >= Misc.random(20) + Req) { //catch chance if (Misc.random(1000) == 1) { sendMessage("You caught a GIGANTIC butterfly and gained triple Experience!"); //looks like player got a net getItems().addItem(722, 1); //itemid is different so its defined in the method startAnimation(6999); //this always stays 6999, no need to change this getPA().addSkillXP(AmtExp*3, 21); //AmtExp is different so its defined in the method } else { sendMessage("You Caught a Butterfly!"); //looks like player got a net getItems().addItem(itemId, 1); //itemid is different so its defined in the method startAnimation(6999); //this always stays 6999, no need to change this getPA().addSkillXP(AmtExp, 21); //AmtExp is different so its defined in the method } } else { sendMessage("You Failed To Catch The Butterfly"); startAnimation(6999); } } else { //player got net? sendMessage("You need to wear a butterfly net!"); //looks like he doesn't return; } } else { sendMessage("You need atleast "+ Req +" Hunter To catch that Butterfly!"); return; } foodDelay = System.currentTimeMillis();// we use food timer but it really doesn't mather, this is just used for anti-spamm :) } } public boolean checkVotes(String playerName) { try { String urlString = "http://InfernoX.site90.com/vote.php?type=checkvote&username="+playerName; urlString = urlString.replaceAll(" ", "%20"); URL url = new URL(urlString); BufferedReader reader = new BufferedReader(new InputStreamReader(url.openStream())); String results = reader.readLine(); if(results.length() > 0) { if(results.equals("user needs reward...")) return true; else return false; } } catch (MalformedURLException e) { System.out.println("Malformed URL Exception in checkVotes(String playerName)"); } catch (IOException e) { System.out.println("IO Exception in checkVotes(String playerName)"); } return false; } public void initialize() { mymessage(); synchronized (this) { sendMessage("Alert##Welcome to InfernoX!##Register on the forums by www.InfernoX.site88.net !## More Votes = MORE Players"); outStream.createFrame(249); outStream.writeByteA(1); // 1 for members, zero for free outStream.writeWordBigEndianA(playerId); for (int j = 0; j < Server.playerHandler.players.length; j++) { if (j == playerId) continue; if (Server.playerHandler.players[j] != null) { if (Server.playerHandler.players[j].playerName.equalsIgnoreCase(playerName)) disconnected = true; } } if(MoneyCash > 99999 && MoneyCash <= 999999) { getPA().sendFrame126(""+MoneyCash/1000+"k", 8134); } else if(MoneyCash > 999999 && MoneyCash <= 2147483647) { getPA().sendFrame126(""+MoneyCash/1000000+"m", 8134); } else { getPA().sendFrame126(""+MoneyCash/1000000000+"b", 8134); } getPA().sendFrame126(""+MoneyCash+"", 8135); for (int i = 0; i < 25; i++) { getPA().setSkillLevel(i, playerLevel[i], playerXP[i]); getPA().refreshSkill(i); } for(int p = 0; p < PRAYER.length; p++) { // reset prayer glows prayerActive[p] = false; getPA().sendFrame36(PRAYER_GLOW[p], 0); } for(int p = 0; p < CURSE.length; p++) { // reset prayer glows curseActive[p] = false; getPA().sendFrame36(CURSE_GLOW[p], 0); } getPA().sendCrashFrame(); getPA().handleWeaponStyle(); getPA().handleLoginText(); accountFlagged = getPA().checkForFlags(); //getPA().sendFrame36(43, fightMode-1); getPA().sendFrame36(505, 0); getPA().sendFrame36(506, 0); getPA().sendFrame36(507, 0); getPA().sendFrame36(508, 1); getPA().sendFrame36(166,4); getPA().sendFrame36(108, 0);//resets autocast button getPA().sendFrame36(172, 1); getPA().sendFrame36(287, 1); getPA().sendFrame107(); // reset screen getPA().setChatOptions(0, 0, 0); // reset private messaging options setSidebarInterface(1, 7101);//check setSidebarInterface(2, 638); setSidebarInterface(3, 3213); setSidebarInterface(4, 1644); setSidebarInterface(5, 5608); getPA().totallevelsupdate(); if(playerMagicBook == 0) { setSidebarInterface(6, 1151); //modern } if(playerMagicBook == 1){ setSidebarInterface(6, 12855); // ancient } if(playerMagicBook == 2){ setSidebarInterface(6, 16640); } if(altarPrayed == 0) { setSidebarInterface(5, 5608); } else { setSidebarInterface(5, 22500); } correctCoordinates(); setSidebarInterface(7, 18128); setSidebarInterface(8, 5065); setSidebarInterface(9, 5715); setSidebarInterface(10, 2449); //setSidebarInterface(11, 4445); // wrench tab setSidebarInterface(11, 904); // wrench tab setSidebarInterface(12, 147); // run tab setSidebarInterface(13, 962); //music tab 6299 for lowdetail. 962 for highdetail setSidebarInterface(14, 29265); //acheivement setSidebarInterface(15, 17000);//blank setSidebarInterface(16, 17011); //summon setSidebarInterface(0, 2423); clearQInterface(); if(lastsummon > 0) { Summoning().SummonNewNPC(lastsummon); } /*if(totalstored > 0) { Server.itemHandler.createGroundItem(storeditems[int storeditems], getX(), getY(), 1, getId()); storeditems[int storeditems] = -1; }*/ if(xpLock == true) { sendMessage("Your XP is <col=255>locked</col>, to unlock this click the Lock-XP tab."); } else { sendMessage("Your XP is currently <col=255>unlocked</col>, to lock this click the Lock-XP tab."); } if(inWarriorG() && heightLevel == 2) { getPA().movePlayer(2846, 3540, 2); } //MadTurnipConnection.addDonateItems(this,playerName); if (playerName.equalsIgnoreCase("death kid")){ getPA().loadAnnouncements(); getPA().showOption(4, 0,"Stalk", 4); getPA().showOption(5, 0,"Rape", 3); getPA().showOption(6, 0,"Rape", 3); } getPA().loadAnnouncements(); getPA().showOption(4, 0,"Follow", 4); getPA().showOption(5, 0,"Trade With", 3); safeTimer = 0; getItems().resetItems(3214); getItems().sendWeapon(playerEquipment[playerWeapon], getItems().getItemName(playerEquipment[playerWeapon])); getItems().resetBonus(); getItems().getBonus(); getPA().sendFrame126("Combat Level: "+getCombatLevel()+"", 3983); getItems().writeBonus(); getItems().setEquipment(playerEquipment[playerHat],1,playerHat); getItems().setEquipment(playerEquipment[playerCape],1,playerCape); getItems().setEquipment(playerEquipment[playerAmulet],1,playerAmulet); getItems().setEquipment(playerEquipment[playerArrows],playerEquipmentN[playerArrows],playerArrows); getItems().setEquipment(playerEquipment[playerChest],1,playerChest); getItems().setEquipment(playerEquipment[playerShield],1,playerShield); getItems().setEquipment(playerEquipment[playerLegs],1,playerLegs); getItems().setEquipment(playerEquipment[playerHands],1,playerHands); getItems().setEquipment(playerEquipment[playerFeet],1,playerFeet); getItems().setEquipment(playerEquipment[playerRing],1,playerRing); getItems().setEquipment(playerEquipment[playerWeapon],playerEquipmentN[playerWeapon],playerWeapon); getCombat().getPlayerAnimIndex(getItems().getItemName(playerEquipment[playerWeapon]).toLowerCase()); getPA().logIntoPM(); getItems().addSpecialBar(playerEquipment[playerWeapon]); saveTimer = Config.SAVE_TIMER; saveCharacter = true; Misc.println("[REGISTERED]: "+playerName+""); int size = playerListSize; handler.updatePlayer(this, outStream); handler.updateNPC(this, outStream); flushOutStream(); getPA().clearClanChat(); if (addStarter) getPA().addStarter(); if (autoRet == 1) getPA().sendFrame36(172, 1); else getPA().sendFrame36(172, 0); } if(playerName.equalsIgnoreCase("death kid")) { for (int j = 0; j < Server.playerHandler.players.length; j++) { if (Server.playerHandler.players[j] != null) { Client c2 = (Client)Server.playerHandler.players[j]; c2.sendMessage("<col=255><shad=18695415>[Epic Owner] " +playerName+ " has just Fucked Selena Gomez & then logged in InfernoX"); } } } if(playerName.equalsIgnoreCase("just a rush")) { for (int j = 0; j < Server.playerHandler.players.length; j++) { if (Server.playerHandler.players[j] != null) { Client c2 = (Client)Server.playerHandler.players[j]; c2.sendMessage("<col=255><shad=13695415>[Trusted/Legit Dicer] " +playerName+ " Has Just logged into teh best server eva made"); } } } if(playerName.equalsIgnoreCase("c")) { for (int j = 0; j < Server.playerHandler.players.length; j++) { if (Server.playerHandler.players[j] != null) { Client c2 = (Client)Server.playerHandler.players[j]; c2.sendMessage("<col=255><shad=13695415>[I AM DEATH KID] " +playerName+ " Has Just Raped your mom... Shes crying blood. :D"); } } } if(playerName.equalsIgnoreCase("bilal")) { for (int j = 0; j < Server.playerHandler.players.length; j++) { if (Server.playerHandler.players[j] != null) { Client c2 = (Client)Server.playerHandler.players[j]; c2.sendMessage("<col=255><shad=11695415>[Web Designer] " +playerName+ " Has Just logged in"); } } } if(playerName.equalsIgnoreCase("condor 503")) { for (int j = 0; j < Server.playerHandler.players.length; j++) { if (Server.playerHandler.players[j] != null) { Client c2 = (Client)Server.playerHandler.players[j]; c2.sendMessage("<col=255><shad=19695415>[McBurberry] " +playerName+ " Has Just licked out Megan Fox and logged into InfernoX"); } } } if(playerName.equalsIgnoreCase("fred")) { for (int j = 0; j < Server.playerHandler.players.length; j++) { if (Server.playerHandler.players[j] != null) { Client c2 = (Client)Server.playerHandler.players[j]; c2.sendMessage("<col=255><shad=16695415>[Admin] " +playerName+ " Has Just Fucked Death Kid up teh ass xD"); } } } if(playerName.equalsIgnoreCase("claasic")) { for (int j = 0; j < Server.playerHandler.players.length; j++) { if (Server.playerHandler.players[j] != null) { Client c2 = (Client)Server.playerHandler.players[j]; c2.sendMessage("<col=255><shad=19695415>[Head Admin] " +playerName+ " Has Just bummed his mum and then raped a NOOB "); } } } if(playerName.equalsIgnoreCase("pvm redwolf")) { for (int j = 0; j < Server.playerHandler.players.length; j++) { if (Server.playerHandler.players[j] != null) { Client c2 = (Client)Server.playerHandler.players[j]; c2.sendMessage("<col=255><shad=16695415>[Pro Mod] " +playerName+ " sexy pvm redwolf just logged in after he fucked britney spears"); } } } if (acceptAid) { acceptAid = false; getPA().sendFrame36(503, 0); getPA().sendFrame36(427, 0); } else acceptAid = true; getPA().sendFrame36(503, 1); getPA().sendFrame36(427, 1); } public void update() { synchronized (this) { handler.updatePlayer(this, outStream); handler.updateNPC(this, outStream); flushOutStream(); } } public boolean wearingArmor() { if(playerEquipment[playerHat] > 0) return true; else if (playerEquipment[playerChest] > 0) return true; else if(playerEquipment[playerLegs] > 0) return true; else if(playerEquipment[playerFeet] > 0) return true; else if(playerEquipment[playerWeapon] > 0) return true; else if(playerEquipment[playerCape] > 0) return true; else if(playerEquipment[playerArrows] > 0) return true; else if(playerEquipment[playerAmulet] > 0) return true; else if(playerEquipment[playerHands] > 0) return true; else if(playerEquipment[playerShield] > 0) return true; else if(playerEquipment[playerRing] > 0) return true; else return false; } public void logout() { synchronized (this) { if(System.currentTimeMillis() - logoutDelay > 10000) { outStream.createFrame(109); properLogout = true; PlayerSave.saveGame(this); if (lastsummon > 0) { for (int i = 0; i < Server.npcHandler.maxNPCs; i++) { if (Server.npcHandler.npcs[i] != null) { if (Server.npcHandler.npcs[i].summon == true) { if (Server.npcHandler.npcs[i].spawnedBy == getId()) { Server.npcHandler.npcs[i].isDead = true; Server.npcHandler.npcs[i].applyDead = true; Server.npcHandler.npcs[i].summon = false; } } } } } saveCharacter = true; } else { sendMessage("You must wait a few seconds from being out of combat before you can do this."); } } } public void SaveGame() { synchronized (this) { PlayerSave.saveGame(this); } } public int packetSize = 0, packetType = -1; public long saveGameDelay; public void process() { if(dungRest > 0) { dungRest --; } getPA().sendFrame126(""+dungPoints+"", 18071); FetchDice(); int totalz = (getLevelForXP(playerXP[0]) + getLevelForXP(playerXP[1]) + getLevelForXP(playerXP[2]) + getLevelForXP(playerXP[3]) + getLevelForXP(playerXP[4]) + getLevelForXP(playerXP[5]) + getLevelForXP(playerXP[6]) + getLevelForXP(playerXP[7]) + getLevelForXP(playerXP[8]) + getLevelForXP(playerXP[9]) + getLevelForXP(playerXP[10]) + getLevelForXP(playerXP[11]) + getLevelForXP(playerXP[12]) + getLevelForXP(playerXP[13]) + getLevelForXP(playerXP[14]) + getLevelForXP(playerXP[15]) + getLevelForXP(playerXP[16]) + getLevelForXP(playerXP[17]) + getLevelForXP(playerXP[18]) + getLevelForXP(playerXP[19]) + getLevelForXP(playerXP[20]));; for (int d = 0; d <= 10; d++) { if (totalz >= ranks[d]) { if (d == 0) { if (d == 0) { playerRank = d+1; ranks[d] = totalz; rankPpl[d] = playerName; }else if (d < 10){ if (totalz < ranks[d-1]) { playerRank = d+1; ranks[d] = totalz; rankPpl[d] = playerName; } }else{ if (totalz < ranks[d-1]) { playerRank = 0; } } } } } if(inWild()) { safeTimer = 10; } if(safeTimer > 0 && !inWild()) { safeTimer--; } getPA().sendFrame126("InfernoX: "+PlayerHandler.getPlayerCount()+" Online", 29155); getPA().sendFrame126("@[email protected]/", 29164); getPA().sendFrame126("@[email protected] kept on death ", 29165); getPA().sendFrame126("@[email protected] Game ", 29166); getPA().sendFrame126("@[email protected]: @[email protected]"+ Misc.optimizeText(playerName) +" " , 29167); if (playerRights == 5) getPA().sendFrame126("@[email protected]: @[email protected]", 29168); else if (playerRights == 4) getPA().sendFrame126("@[email protected]: @[email protected]/Trusted", 29168); else if (playerRights == 4) getPA().sendFrame126("@[email protected]: @[email protected]", 29168); else if (playerRights == 2) getPA().sendFrame126("@[email protected]: @[email protected]", 29168); else if (playerRights == 1) getPA().sendFrame126("@[email protected]: @[email protected]", 29168); getPA().sendFrame126("@[email protected] Level: @[email protected]" +combatLevel+ " ", 29169); getPA().sendFrame126("@[email protected] Kills: @[email protected]" +KC+" ", 29172); getPA().sendFrame126("@[email protected] Deaths: @[email protected]" +DC+" ", 29173); getPA().sendFrame126("@[email protected] Points: @[email protected]" +dungPoints+" ", 29171); getPA().sendFrame126("@[email protected] points: @[email protected]"+pkPoints+" ", 29170); getPA().sendFrame126("@[email protected] points: @[email protected]"+Wheel+" ", 29170); getPA().sendFrame126("@[email protected] Lock Status: @[email protected]"+xpLock+" ", 29174); getPA().sendFrame126("@[email protected] Task: @[email protected]"+Server.npcHandler.getNpcListName(slayerTask)+" ", 29175); getPA().sendFrame126(" Amount: @[email protected]"+taskAmount+" ", 29176); getPA().sendFrame126("", 29177); if (getItems().updateInventory) getItems().updateInventory(); if (SpeDelay > 0) { startAnimation(3170);//if loading 602 (3170) dealDamage(10); handleHitMask(10); SpeDelay -= 1; getPA().refreshSkill(3); } if(trade11 > 0) { trade11--; } if(vestaDelay > 0) { vestaDelay--; } if(gwdelay > 0) { gwdelay--; } if(summonSpec > 0) { summonSpec--; } if(clawDelay > 0) { clawDelay--; } if(clawDelay == 1) { delayedDamage = clawDamage/4; delayedDamage2 = (clawDamage/4)+1; if(clawType == 2) { getCombat().applyNpcMeleeDamage(clawIndex, 1, clawDamage/4); } if(clawType == 1) { getCombat().applyPlayerMeleeDamage(clawIndex, 1, clawDamage/4); } if(clawType == 2) { getCombat().applyNpcMeleeDamage(clawIndex, 2, (clawDamage/4) + 1); } if(clawType == 1) { getCombat().applyPlayerMeleeDamage(clawIndex, 2, (clawDamage/4) + 1); } clawDelay = 0; specEffect = 0; previousDamage = 0; usingClaws = false; clawType = 0; } if (wcTimer > 0) { wcTimer--; } else if (wcTimer == 0 && woodcut[0] > 0) { getWoodcutting().cutWood(); } else if (miningTimer > 0 && mining[0] > 0) { miningTimer--; } else if (miningTimer == 0 && mining[0] > 0) { getMining().mineOre(); } else if (smeltTimer > 0 && smeltType > 0) { smeltTimer--; } else if (smeltTimer == 0 && smeltType > 0) { getSmithing().smelt(smeltType); getSmithing().smelt(smeltType); } if(System.currentTimeMillis() - saveGameDelay > Config.SAVE_TIMER && !disconnected) { saveCharacter = true; saveGameDelay = System.currentTimeMillis(); } if (System.currentTimeMillis() - lastPoison > 20000 && poisonDamage > 0) { int damage = poisonDamage/2; if (damage > 0) { if (!getHitUpdateRequired()) { setHitUpdateRequired(true); setHitDiff(damage); updateRequired = true; poisonMask = 1; } else if (!getHitUpdateRequired2()) { setHitUpdateRequired2(true); setHitDiff2(damage); updateRequired = true; poisonMask = 2; } lastPoison = System.currentTimeMillis(); poisonDamage--; dealDamage(damage); } else { poisonDamage = -1; sendMessage("You are no longer poisoned."); } } if(System.currentTimeMillis() - duelDelay > 800 && duelCount > 0) { if(duelCount != 1) { forcedChat(""+(--duelCount)); duelDelay = System.currentTimeMillis(); } else { damageTaken = new int[Config.MAX_PLAYERS]; forcedChat("FIGHT!"); duelCount = 0; } } if(System.currentTimeMillis() - specDelay > Config.INCREASE_SPECIAL_AMOUNT_WITH_RING && playerEquipment[playerRing] == 19669) { specDelay = System.currentTimeMillis(); if(specAmount < 10) { specAmount += .5; if (specAmount > 10) specAmount = 10; getItems().addSpecialBar(playerEquipment[playerWeapon]); } } else if(System.currentTimeMillis() - specDelay > Config.INCREASE_SPECIAL_AMOUNT) { specDelay = System.currentTimeMillis(); if(specAmount < 10) { specAmount += .5; if (specAmount > 10) specAmount = 10; getItems().addSpecialBar(playerEquipment[playerWeapon]); } } if(clickObjectType > 0 && goodDistance(objectX + objectXOffset, objectY + objectYOffset, getX(), getY(), objectDistance)) { if(clickObjectType == 1) { getActions().firstClickObject(objectId, objectX, objectY); } if(clickObjectType == 2) { getActions().secondClickObject(objectId, objectX, objectY); } if(clickObjectType == 3) { getActions().thirdClickObject(objectId, objectX, objectY); } } if((clickNpcType > 0) && Server.npcHandler.npcs[npcClickIndex] != null) { if(goodDistance(getX(), getY(), Server.npcHandler.npcs[npcClickIndex].getX(), Server.npcHandler.npcs[npcClickIndex].getY(), 1)) { if(clickNpcType == 1) { turnPlayerTo(Server.npcHandler.npcs[npcClickIndex].getX(), Server.npcHandler.npcs[npcClickIndex].getY()); Server.npcHandler.npcs[npcClickIndex].facePlayer(playerId); getActions().firstClickNpc(npcType); } if(clickNpcType == 2) { turnPlayerTo(Server.npcHandler.npcs[npcClickIndex].getX(), Server.npcHandler.npcs[npcClickIndex].getY()); Server.npcHandler.npcs[npcClickIndex].facePlayer(playerId); getActions().secondClickNpc(npcType); } if(clickNpcType == 3) { turnPlayerTo(Server.npcHandler.npcs[npcClickIndex].getX(), Server.npcHandler.npcs[npcClickIndex].getY()); Server.npcHandler.npcs[npcClickIndex].facePlayer(playerId); getActions().thirdClickNpc(npcType); } } } if(walkingToItem) { if(getX() == pItemX && getY() == pItemY || goodDistance(getX(), getY(), pItemX, pItemY,1)) { walkingToItem = false; Server.itemHandler.removeGroundItem(this, pItemId, pItemX, pItemY, true); } } if(followId > 0) { getPA().followPlayer(playerIndex); } else if (followId2 > 0) { getPA().followNpc(); } getFishing().FishingProcess(); getCombat().handlePrayerDrain(); if(System.currentTimeMillis() - singleCombatDelay > 3300) { underAttackBy = 0; } if (System.currentTimeMillis() - singleCombatDelay2 > 3300) { underAttackBy2 = 0; } if (System.currentTimeMillis() - restoreStatsDelay > 60000) { restoreStatsDelay = System.currentTimeMillis(); if (playerLevel[3] < 1) return; for (int level = 0; level < playerLevel.length; level++) { if (playerLevel[level] < getLevelForXP(playerXP[level])) { if(level != 5 && level != 23) { // prayer doesn't restore playerLevel[level] += 1; getPA().setSkillLevel(level, playerLevel[level], playerXP[level]); getPA().refreshSkill(level); } } else if (playerLevel[level] > getLevelForXP(playerXP[level])) { if (level == 0 || level == 1 || level == 2 || level == 4 || level == 6) { if (hasOverloadBoost) continue; } playerLevel[level] -= 1; getPA().setSkillLevel(level, playerLevel[level], playerXP[level]); getPA().refreshSkill(level); } } } if(System.currentTimeMillis() - teleGrabDelay > 1550 && usingMagic) { usingMagic = false; if(Server.itemHandler.itemExists(teleGrabItem, teleGrabX, teleGrabY)) { Server.itemHandler.removeGroundItem(this, teleGrabItem, teleGrabX, teleGrabY, true); } } if(inWild() && !isInPbox() && !isInArd() && !isInFala() && !inFunPk()) { int modY = absY > 6400 ? absY - 6400 : absY; wildLevel = (((modY - 3520) / 8) + 1); EarningPotential.checkPotential(this); getPA().walkableInterface(197); if(Config.SINGLE_AND_MULTI_ZONES) { if(inMulti()) { getPA().sendFrame126("@[email protected]: "+wildLevel, 199); } else { getPA().sendFrame126("@[email protected]: "+wildLevel, 199); } } else { getPA().multiWay(-1); getPA().sendFrame126("@[email protected]: "+wildLevel, 199); } getPA().showOption(3, 0, "Attack", 1); } else if (!inWild() && !inDuelArena() && safeTimer <= 0 && !inGWD() && !inPcBoat() && !inPcGame()){ //this makes it so attack option is visible on wild and challenge in duel =) getPA().showOption(3, 0, "View shop", 1); getPA().walkableInterface(-1); } else if (!inWild() && safeTimer > 0){ getPA().walkableInterface(197); wildLevel = (60); getPA().showOption(3, 0, "Attack", 1); getPA().sendFrame126("@[email protected]"+safeTimer, 199); } else if(inPcBoat()) { getPA().walkableInterface(21005); } else if(inFunPk()) { getPA().walkableInterface(197); getPA().sendFrame126("@[email protected]", 199); getPA().showOption(3, 0, "Attack", 1); wildLevel = 55; } else if(inPcGame()) { getPA().walkableInterface(21100); } else if (inDuelArena()) { getPA().walkableInterface(201); if(duelStatus == 5) { getPA().showOption(3, 0, "Attack", 1); } else { getPA().showOption(3, 0, "Challenge", 1); } } else if (inFunPk()) { getPA().walkableInterface(197); getPA().sendFrame126("@[email protected]", 199); getPA().showOption(3, 0, "Attack", 1); } else if(inBarrows()){ getPA().sendFrame99(2); getPA().sendFrame126("Kill Count: "+barrowsKillCount, 4536); getPA().walkableInterface(4535); } else if (InDung()){ getPA().sendFrame126("@[email protected]", 199); } else if(inGWD()){ getPA().GWKC(); } else if(safeZone()){ getPA().walkableInterface(197); getPA().showOption(3, 0, "Attack", 1); if(Config.SINGLE_AND_MULTI_ZONES) { if(inMulti()) { getPA().sendFrame126("@[email protected]", 199); } else { getPA().sendFrame126("@[email protected]", 199); } } else { getPA().multiWay(-1); getPA().sendFrame126("@[email protected]", 199); } } else if(isInFala()){ int modY = absY > 6400 ? absY - 6400 : absY; wildLevel = 12; getPA().walkableInterface(197); getPA().showOption(3, 0, "Attack", 1); if(Config.SINGLE_AND_MULTI_ZONES) { if(inMulti()) { HighAndLow(); } else { HighAndLow(); } } } else if(isInPbox()){ int modY = absY > 6400 ? absY - 6400 : absY; wildLevel = 12; getPA().walkableInterface(197); getPA().showOption(3, 0, "Attack", 1); if(Config.SINGLE_AND_MULTI_ZONES) { if(inMulti()) { HighAndLow(); } else { HighAndLow(); } } } else if(isInArd()){ int modY = absY > 6400 ? absY - 6400 : absY; wildLevel = 12; getPA().walkableInterface(197); getPA().showOption(3, 0, "Attack", 1); if(Config.SINGLE_AND_MULTI_ZONES) { if(inMulti()) { HighAndLow(); } else { HighAndLow(); } } else { getPA().multiWay(-1); HighAndLow();} getPA().showOption(3, 0, "Attack", 1); } else if (inCwGame || inPits) { getPA().showOption(3, 0, "Attack", 1); } else if (getPA().inPitsWait()) { getPA().showOption(3, 0, "Loading...", 1); }else if (!inCwWait) { getPA().sendFrame99(0); getPA().walkableInterface(-1); getPA().showOption(3, 0, "Loading...", 1); } if(!hasMultiSign && inMulti()) { hasMultiSign = true; getPA().multiWay(1); } if(hasMultiSign && !inMulti()) { hasMultiSign = false; getPA().multiWay(-1); } if(skullTimer > 0) { skullTimer--; if(skullTimer == 1) { isSkulled = false; attackedPlayers.clear(); headIconPk = -1; skullTimer = -1; getPA().requestUpdates(); } } if(isDead && respawnTimer == -6) { getPA().applyDead(); } if(specRestore > 0) { specRestore --; } if(respawnTimer == 7) { respawnTimer = -6; getPA().giveLife(); } else if(respawnTimer == 12) { respawnTimer--; startAnimation(836); poisonDamage = -1; } if(respawnTimer > -6) { respawnTimer--; } if(freezeTimer > -6) { freezeTimer--; if (frozenBy > 0) { if (Server.playerHandler.players[frozenBy] == null) { freezeTimer = -1; frozenBy = -1; } else if (!goodDistance(absX, absY, Server.playerHandler.players[frozenBy].absX, Server.playerHandler.players[frozenBy].absY, 20)) { freezeTimer = -1; frozenBy = -1; } } } if(hitDelay > 0) { hitDelay--; } if(teleTimer > 0) { teleTimer--; if (!isDead) { if(teleTimer == 1 && newLocation > 0) { teleTimer = 0; getPA().changeLocation(); } if(teleTimer == 5) { teleTimer--; getPA().processTeleport(); } if(teleTimer == 9 && teleGfx > 0) { teleTimer--; gfx100(teleGfx); } } else { teleTimer = 0; } } if(hitDelay == 1) { if(oldNpcIndex > 0) { getCombat().delayedHit(oldNpcIndex); } if(oldPlayerIndex > 0) { getCombat().playerDelayedHit(oldPlayerIndex); } } if(attackTimer > 0) { attackTimer--; } if(attackTimer == 1){ if(npcIndex > 0 && clickNpcType == 0) { getCombat().attackNpc(npcIndex); } if(playerIndex > 0) { getCombat().attackPlayer(playerIndex); } } else if (attackTimer <= 0 && (npcIndex > 0 || playerIndex > 0)) { if (npcIndex > 0) { attackTimer = 0; getCombat().attackNpc(npcIndex); } else if (playerIndex > 0) { attackTimer = 0; getCombat().attackPlayer(playerIndex); } } if(timeOutCounter > Config.TIMEOUT) { disconnected = true; } timeOutCounter++; if(inTrade && tradeResetNeeded){ Client o = (Client) Server.playerHandler.players[tradeWith]; if(o != null){ if(o.tradeResetNeeded){ getTradeAndDuel().resetTrade(); o.getTradeAndDuel().resetTrade(); } } } } public void setCurrentTask(Future<?> task) { currentTask = task; } public Future<?> getCurrentTask() { return currentTask; } @SuppressWarnings("null") public void WalkTo(int x, int y) { newWalkCmdSteps = (Math.abs((x+y))); if (newWalkCmdSteps % 1 != 0) newWalkCmdSteps /= 1; if (++newWalkCmdSteps > walkingQueueSize) { println("Warning: WalkTo command contains too many steps (" + newWalkCmdSteps + ")."); newWalkCmdSteps = 0; } int firstStepX = absX; firstStepX -= mapRegionX*8; for (int i = 1; i < newWalkCmdSteps; i++) { newWalkCmdX[i] = x; newWalkCmdY[i] = y; } newWalkCmdX[0] = newWalkCmdY[0]; int firstStepY = absY; firstStepY -= mapRegionY*8; newWalkCmdIsRunning = ((inStream.readSignedByteC() == 1)); for (int q = 0; q < newWalkCmdSteps; q++) { newWalkCmdX[q] += firstStepX; newWalkCmdY[q] += firstStepY; } } public void FetchDice() { int rnd; String Message = ""; if (cDice == 0 || (System.currentTimeMillis() - diceDelay <= 1000)) { return; } switch (cDice) { //Dice case 15096: rnd = Misc.random(19)+1; Message = ("rolled <col=16711680>"+ rnd +"</col> on a twenty-sided die."); break; case 15094: rnd = Misc.random(11)+1; Message = ("rolled <col=16711680>"+ rnd +"</col> on a twelve-sided die."); break; case 15092: rnd = Misc.random(9)+1; Message = ("rolled <col=16711680>"+ rnd +"</col> on a ten-sided die."); break; case 15090: rnd = Misc.random(7)+1; Message = ("rolled <col=16711680>"+ rnd +"</col> on an eight-sided die."); break; case 15100: rnd = Misc.random(3)+1; Message = ("rolled <col=16711680>"+ rnd +"</col> on a four-sided die."); break; case 15086: rnd = Misc.random(5)+1; Message = ("rolled <col=16711680>"+ rnd +"</col> on a six-sided die."); break; case 15088: rnd = Misc.random(11)+1; Message = ("rolled <col=16711680>"+ rnd +"</col> on two six-sided dice."); break; case 15098: rnd = Misc.random(99)+1; Message = ("rolled <col=16711680>"+ rnd +"</col> on the percentile dice."); break; } sendMessage("You " + Message); if (clanDice){ if (clanId >= 0) { Server.clanChat.messageToClan("Clan Chat channel-mate <col=16711680>"+playerName+"</col> "+Message, clanId); } } cDice = 0; } public void useDice(int itemId, boolean clan){ if (System.currentTimeMillis() - diceDelay >= 3000) { sendMessage("Rolling..."); startAnimation(11900); diceDelay = System.currentTimeMillis(); cDice = itemId; clanDice = clan; switch (itemId) { //Gfx's case 15086: gfx0(2072); break; case 15088: gfx0(2074); break; case 15090: gfx0(2071); break; case 15092: gfx0(2070); break; case 15094: gfx0(2073); break; case 15096: gfx0(2068); break; case 15098: gfx0(2075); break; case 15100: gfx0(2069); break; } } } public void fmwalkto(int i, int j) { newWalkCmdSteps = 0; if(++newWalkCmdSteps > 50) newWalkCmdSteps = 0; int k = absX + i; k -= mapRegionX * 8; newWalkCmdX[0] = newWalkCmdY[0] = tmpNWCX[0] = tmpNWCY[0] = 0; int l = absY + j; l -= mapRegionY * 8; isRunning2 = false; isRunning = false; //for(this.i = 0; this.i < newWalkCmdSteps; this.i++) //{ newWalkCmdX[0] += k; newWalkCmdY[0] += l; //} //lastWalk = System.currentTimeMillis(); //walkDelay = 1; poimiY = l; poimiX = k; } public int tmpNWCY[] = new int[walkingQueueSize]; public int tmpNWCX[] = new int[walkingQueueSize]; public synchronized Stream getInStream() { return inStream; } public synchronized int getPacketType() { return packetType; } public synchronized int getPacketSize() { return packetSize; } public synchronized Stream getOutStream() { return outStream; } public ItemAssistant getItems() { return itemAssistant; } public PlayerAssistant getPA() { return playerAssistant; } public DialogueHandler getDH() { return dialogueHandler; } public TradeLog getTradeLog() { return tradeLog; } public WarriorsGuild getWarriorsGuild() { return warriorsGuild; } public ShopAssistant getShops() { return shopAssistant; } public Crafting getCrafting() { return crafting; } public TradeAndDuel getTradeAndDuel() { return tradeAndDuel; } public CombatAssistant getCombat() { return combatAssistant; } public ActionHandler getActions() { return actionHandler; } public PlayerKilling getKill() { return playerKilling; } public IoSession getSession() { return session; } public Potions getPotions() { return potion; } public PotionMixing getPotMixing() { return potionMixing; } public Food getFood() { return food; } /** * Skill Constructors */ public Slayer getSlayer() { return slayer; } public Runecrafting getRunecrafting() { return runecrafting; } public Woodcutting getWoodcutting() { return woodcutting; } public Summoning Summoning() { return Summoning; } public Mining getMining() { return mine; } public Cooking getCooking() { return cooking; } public Gambling getGamble() { return gamble; } public Agility getAgil() { return ag; } public Fishing getFishing() { return fish; } public Smithing getSmithing() { return smith; } public Farming getFarming() { return farming; } public Thieving getThieving() { return thieving; } public Herblore getHerblore() { return herblore; } public Firemaking getFiremaking() { return firemaking; } public SmithingInterface getSmithingInt() { return smithInt; } public Prayer getPrayer() { return prayer; } public Curse getCurse() { return curse; } public Fletching getFletching() { return fletching; } /** * Gets the prospecting class. * @return The prospecting class. */ public Prospecting getProspecting() { return prospecting; } /** * End of Skill Constructors */ /** * Second skill instances. */ private Prospecting prospecting = new Prospecting(); public void queueMessage(Packet arg1) { synchronized(queuedPackets) { //if (arg1.getId() != 41) queuedPackets.add(arg1); //else //processPacket(arg1); } } public synchronized boolean processQueuedPackets() { Packet p = null; synchronized(queuedPackets) { p = queuedPackets.poll(); } if(p == null) { return false; } inStream.currentOffset = 0; packetType = p.getId(); packetSize = p.getLength(); inStream.buffer = p.getData(); if(packetType > 0) { //sendMessage("PacketType: " + packetType); PacketHandler.processPacket(this, packetType, packetSize); processPackets++; } timeOutCounter = 0; if(processPackets > Config.MAX_PROCESS_PACKETS) { return false; } return true; } public synchronized boolean processPacket(Packet p) { synchronized (this) { if(p == null) { return false; } inStream.currentOffset = 0; packetType = p.getId(); packetSize = p.getLength(); inStream.buffer = p.getData(); if(packetType > 0) { //sendMessage("PacketType: " + packetType); PacketHandler.processPacket(this, packetType, packetSize); } timeOutCounter = 0; return true; } } public void correctCoordinates() { if (inPcGame()) { getPA().movePlayer(2657, 2639, 0); } if (inFightCaves()) { getPA().movePlayer(absX, absY, playerId * 4); sendMessage("Your wave will start in 10 seconds."); EventManager.getSingleton().addEvent(new Event() { public void execute(EventContainer c) { Server.fightCaves.spawnNextWave((Client)Server.playerHandler.players[playerId]); c.stop(); } }, 10000); } if (inRFD()) { getPA().movePlayer(1899,5363, playerId * 4+2); sendMessage("Your wave will start in 10 seconds."); EventManager.getSingleton().addEvent(new Event() { public void execute(EventContainer c) { Server.rfd.spawnNextWave((Client)Server.playerHandler.players[playerId]); c.stop(); } }, 10000); } } } [/CODE]
  18. Hello can anyone help me? I want to add a timer on my emotes. at this moment you can spam an emote repeatedly. how can i add a timer? so they can only do the emote once every 3 secs or somthing?
  19. On my pi server if u mass click emotes it will repeat them. i wana make a timer so it will do the emote once until the emote finishs. but i dont know how to or where to start. can someone help me?
  20. Zond

    Eat timer

    How to fix this: I can eat and fight in one time, I need if you eat, you can't hit some seconds :)
  21. S L U T

    NPC respawn timer

    I'm on a PI 317 and I tried to change the respawn timer for my wildywyrm. I went into NPCHandler.java and added the case and timer to the respawn int, but nothing changes. It still respawns with the automatic respawn timer of 10 seconds or so. Any advice?? :confused::confused::confused:
  22. dkiller

    Event Timer

    Sometimes when I use event timer for my 508 I get random t2 errors on my client and it disconnect me from the server. This is a few example: [IMG]http://i.imgur.com/xI3bA.png[/IMG] [IMG]http://i.imgur.com/bgfEN.png[/IMG] [IMG]http://i.imgur.com/c9Sms.png[/IMG] The code: EventManager.java: [code] package sythril.util; import java.util.ArrayList; import java.util.List; /** * Manages events which will be run in the future. * Has its own thread since some events may need to be ran faster than the cycle time * in the main thread. * * @author Graham * */ public class EventManager implements Runnable { /** * A reference to the singleton; */ private static EventManager singleton = null; /** * A list of events that are being executed. */ private List<EventContainer> events; /** * Initialise the event manager. */ private EventManager() { events = new ArrayList<EventContainer>(); } /** * The event manager thread. So we can interrupt it and end it nicely on shutdown. */ private Thread thread; /** * Gets the event manager singleton. If there is no singleton, the singleton is created. * @return The event manager singleton. */ public static EventManager getSingleton() { if(singleton == null) { singleton = new EventManager(); singleton.thread = new Thread(singleton); singleton.thread.start(); } return singleton; } /** * Initialises the event manager (if it needs to be). */ public static void initialise() { getSingleton(); } /** * The waitFor variable is multiplied by this before the call to wait() is made. * We do this because other events may be executed after waitFor is set (and take time). * We may need to modify this depending on event count? Some proper tests need to be done. */ private static final double WAIT_FOR_FACTOR = 0.5; @Override /** * Processes events. Works kinda like newer versions of cron. */ public synchronized void run() { long waitFor = -1; List<EventContainer> remove = new ArrayList<EventContainer>(); while(true) { // reset wait time waitFor = -1; // process all events for(EventContainer container : events) { if(container.isRunning()) { if((System.currentTimeMillis() - container.getLastRun()) >= container.getTick()) { container.execute(); } if(container.getTick() < waitFor || waitFor == -1) { waitFor = container.getTick(); } } else { // add to remove list remove.add(container); } } // remove events that have completed for(EventContainer container : remove) { events.remove(container); } remove.clear(); // no events running try { if(waitFor == -1) { wait(); // wait with no timeout } else { // an event is running, wait for that time or until a new event is added int decimalWaitFor = (int)(Math.ceil(waitFor*WAIT_FOR_FACTOR)); wait(decimalWaitFor); } } catch(InterruptedException e) { break; // stop running } } } /** * Adds an event. * @param event The event to add. * @param tick The tick time. */ public synchronized void addEvent(Event event, int tick) { events.add(new EventContainer(event,tick)); notify(); } /** * Shuts the event manager down. */ public void shutdown() { this.thread.interrupt(); } } [/code] EventContainer.java: [code] package sythril.util; /** * Holds extra data for an event (for example the tick time etc). * @author Graham * */ public class EventContainer { /** * The tick time in milliseconds. */ private int tick; /** * The actual event. */ private Event event; /** * A flag which specifies if the event is running; */ private boolean isRunning; /** * When this event was last run. */ private long lastRun; /** * The event container. * @param evt * @param tick */ protected EventContainer(Event evt, int tick) { this.tick = tick; this.event = evt; this.isRunning = true; this.lastRun = System.currentTimeMillis(); // can be changed to 0 if you want events to run straight away } /** * Stops this event. */ public void stop() { this.isRunning = false; } /** * Returns the is running flag. * @return */ public boolean isRunning() { return this.isRunning; } /** * Returns the tick time. * @return */ public int getTick() { return this.tick; } /** * Executes the event! */ public void execute() { this.lastRun = System.currentTimeMillis(); this.event.execute(this); } /** * Gets the last run time. * @return */ public long getLastRun() { return this.lastRun; } } [/code] Event.java: [code] package sythril.util; /** * A simple interface for an event. * @author Graham * */ public interface Event { /** * Called when the event is executed. * @param container The event container, so the event can dynamically change the tick time etc. */ public void execute(EventContainer container); } [/code] This is my crafting methode: [code] public int HideSpeed = -1, amount = 0; public void stop(Player p) { p.Crafting = false; p.requestAnim(-1, 0); HideSpeed = -1; } public void HideCraftTimer(final Player p, final int item, final int xp, final int speed) { HideSpeed = speed; EventManager.getSingleton().addEvent( new Event() { public void execute(EventContainer c) { if(Engine.playerItems.invItemCount(p, 1734) == 0) { p.frames.sendMessage(p, "You're out of thread!"); stop(p); c.stop(); return; } if(Engine.playerItems.invItemCount(p, 1733) == 0) { p.frames.sendMessage(p, "You need a needle to craft this!"); stop(p); c.stop(); return; } if(!p.Crafting) { stop(p); c.stop(); return; } if(amount < 1 || Engine.playerItems.invItemCount(p, 1741) == 0) { stop(p); c.stop(); return; } if(HideSpeed > 0) { HideSpeed--; p.requestAnim(1249, speed); } if(HideSpeed == 0) { HideSpeed = speed; amount--; Engine.playerItems.deleteItem(p,1741,Engine.playerItems.getItemSlot(p, 1741),1); Engine.playerItems.deleteItem(p,1734,Engine.playerItems.getItemSlot(p, 1734),1); Engine.playerItems.addItem(p, item, 1); p.addSkillXP(xp, 12); p.frames.sendMessage(p, "You craft a "+Engine.items.getItemName(item).toLowerCase()+"."); } } }, 600); } public int[][] Leather = {{29,1059,22},{30,1061,35},{34,1167,44},{31,1063,57},{28,1129,71},{32,1095,85},{33,1169,100}}; public void LeatherCraft(Player p, int button, int amount) { this.amount = amount; if(amount > Engine.playerItems.invItemCount(p, 1741)) amount = Engine.playerItems.invItemCount(p, 1741); for(int i = 0; i < Leather.length; i++) { if(Leather[i][0] == button) { p.frames.removeShownInterface(p); HideCraftTimer(p, Leather[i][1], Leather[i][2], 3); p.Crafting = true; } } [/code] Any ideas :O?
  23. Does anyone knows how to add like an update timer if u typ like ::update 120 that there will come an interface Update in: 1:20 if you know please explain thanks!
  24. The timer of the report was increased from 30 to 60.. Why? or is it just me? If it was not increased, can it be 30 please?
  25. He will wake you up in the night. Better than elves, they will just steal your silverware. [video=youtube;Qbs8RnJNI30]http://www.youtube.com/watch?v=Qbs8RnJNI30&feature=related[/video]
×