Jump to content

Kenny Van de Maele

Member
  • Content count

    26
  • Joined

  • Last visited

About Kenny Van de Maele

  • Rank
    Bronze Member
  1. Also you're doing java, not javascript.
  2. Okay, I get a syntax error. Not too familiar with java so... [I]Cannot make a static reference to the non-static method isPotion(int) from the type Potion[/I] Any help?
  3. Thankyou! I haven't tested it yet, but i'll post back tomorrow.
  4. [quote name='Rich']You're too young to drink probably.[/QUOTE] No, I'm not. I'm 19, and the legal drinking age here is 16. Any helpful comments?
  5. Hi, I noticed that trying to drink beer (and other, including stout and beer.) gives me a "nothing interesting happens". The code looks okay, and right below it is anti-poison which I confirmed to work. Any thoughts? [CODE]package com.rs2.model.content.consumables; import com.rs2.model.content.combat.effect.impl.PoisonEffect; import com.rs2.model.content.combat.hit.HitType; import com.rs2.model.content.minigames.duelarena.RulesData; import com.rs2.model.content.skills.Skill; import com.rs2.model.players.Player; import com.rs2.model.players.item.Item; /** * By Mikey` of Rune-Server */ public class Potion { Player player; public Potion(Player player) { this.player = player; } /** * All the potion definitions. */ private static PotionLoader.PotionDefinition[] potionDefinitions = new PotionLoader.PotionDefinition[50]; /** * Potion definition count. */ public static int potionCount = 0; public int potionIndex = 0, potionIdIndex = 0; private static final int EMPTY_VIAL = 229; public boolean isPotion(int itemId) { for (int i = 0; i < potionCount; i++) { for (int i2 = 0; i2 < 4; i2++) { if (potionDefinitions[i].getPotionIds()[i2] == itemId) { potionIndex = i; potionIdIndex = i2; return true; } } } return false; } public void drinkPotion(int itemId, int slot) { if (RulesData.NO_DRINKS.activated(player)) { player.getActionSender().sendMessage("Usage of drinks have been disabled during this fight!"); return; } if (player.getSkill().canDoAction2(600) && !player.isDead()) { player.setInstigatingAttack(false); int[] potionIds = potionDefinitions[potionIndex].getPotionIds(); int[] affectedStats = potionDefinitions[potionIndex].getAffectedStats(); int[] statAddons = potionDefinitions[potionIndex].getStatAddons(); double[] statModifiers = potionDefinitions[potionIndex].getStatModifiers(); for (int i = 0; i < affectedStats.length; i++) { if (potionDefinitions[potionIndex].getPotionType() == PotionLoader.PotionDefinition.PotionTypes.BOOST) { int index = affectedStats[i]; int currentLevel = player.getSkill().getLevel()[index]; int actualLevel = player.getSkill().getPlayerLevel(index); int levelAfterDrink = actualLevel; levelAfterDrink += actualLevel * statModifiers[i]; levelAfterDrink += statAddons[i]; if (currentLevel < actualLevel) { player.getSkill().getLevel()[index] += levelAfterDrink - actualLevel; player.getSkill().refresh(index); } else if (currentLevel < levelAfterDrink) { player.getSkill().getLevel()[index] = levelAfterDrink; player.getSkill().refresh(index); } } else if (potionDefinitions[potionIndex].getPotionType() == PotionLoader.PotionDefinition.PotionTypes.RESTORE) { int index = affectedStats[i]; int currentLevel = player.getSkill().getLevel()[index]; int actualLevel = player.getSkill().getPlayerLevel(index); int levelAfterDrink = currentLevel; levelAfterDrink += actualLevel * statModifiers[i]; levelAfterDrink += statAddons[i]; if (currentLevel > actualLevel) { continue; } if (levelAfterDrink <= actualLevel) { player.getSkill().getLevel()[index] = levelAfterDrink; player.getSkill().refresh(index); } else { player.getSkill().getLevel()[index] = player.getSkill().getPlayerLevel(index); player.getSkill().refresh(index); } } } doOtherPotionEffects(itemId); player.getUpdateFlags().sendAnimation(itemId == 3801 ? 1330 : 829, 0); player.getTask(); player.getCombatDelayTick().setWaitDuration(player.getCombatDelayTick().getWaitDuration() + 2); if (potionIdIndex < 3) { if (player.getInventory().removeItemSlot(new Item(itemId, 1), slot)) { player.getInventory().addItemToSlot(new Item(potionIds[potionIdIndex + 1], 1), slot); } else if (player.getInventory().removeItem(new Item(itemId, 1))) { player.getInventory().addItem(new Item(potionIds[potionIdIndex + 1], 1)); } player.getActionSender().sendMessage("You drink"+(isDose(itemId) ? " a dose of" :"")+" your " + potionDefinitions[potionIndex].getPotionName() + "."); } else { if (player.getInventory().removeItemSlot(new Item(itemId, 1), slot)) { player.getInventory().addItemToSlot(new Item(EMPTY_VIAL), slot); } else if (player.getInventory().removeItem(new Item(itemId, 1))) { player.getInventory().addItem(new Item(EMPTY_VIAL)); } player.getActionSender().sendMessage("You drink the last dose of your " + potionDefinitions[potionIndex].getPotionName() + "."); } } } private boolean isDose(int itemId) { return itemId != 1993 && itemId != 1978 && itemId != 1917 && itemId != 7919 && itemId != 3801; } private void doOtherPotionEffects(int itemId) { switch (itemId) { case 7919 : // Bottle of wine player.heal(14); break; case 3801 : // Keg of beer player.getActionSender().statEdit(Skill.ATTACK, -40, false); player.getActionSender().statEdit(Skill.STRENGTH, 10, true); player.heal(1); break; case 1993 : // Jug of wine player.getActionSender().statEdit(Skill.ATTACK, -2, false); player.heal(11); break; case 1978 : // Cup of tea player.getUpdateFlags().sendForceMessage("Aaah, nothing like a nice cuppa tea!"); player.heal(3); break; case 1917 : // Beer player.getActionSender().statEdit(Skill.ATTACK, (int) (player.getSkill().getPlayerLevel(Skill.ATTACK) * 0.07) * -1, false); player.heal(1); break; case 2446 : // Antipoison case 175 : case 177 : case 179 : player.removeAllEffects(PoisonEffect.class); player.getPoisonImmunity().setWaitDuration(300); player.getPoisonImmunity().reset(); break; case 3008 : // Energy case 3010 : case 3012 : case 3014 : if (player.getEnergy() + 20 < 100) { player.setEnergy(player.getEnergy() + 20); } else { player.setEnergy(100); } break; case 2448 : // Super antipoison case 181 : case 183 : case 185 : player.removeAllEffects(PoisonEffect.class); player.getPoisonImmunity().setWaitDuration(600); player.getPoisonImmunity().reset(); break; case 3016 : // Super energy case 3018 : case 3020 : case 3022 : if (player.getEnergy() + 40 < 100) { player.setEnergy(player.getEnergy() + 40); } else { player.setEnergy(100); } break; case 5943 : // Antipoison+ case 5945 : case 5947 : case 5949 : player.removeAllEffects(PoisonEffect.class); player.getPoisonImmunity().setWaitDuration(900); player.getPoisonImmunity().reset(); break; case 2452 : // Antifire case 2454 : case 2456 : case 2458 : player.getFireImmunity().setWaitDuration(600); player.getFireImmunity().reset(); break; case 5952 : // Antipoison++ case 5954 : case 5956 : case 5958 : player.removeAllEffects(PoisonEffect.class); player.getPoisonImmunity().setWaitDuration(1200); player.getPoisonImmunity().reset(); break; case 6685 : // Saradomin brew case 6687 : case 6689 : case 6691 : player.heal(2); player.getActionSender().statEdit(Skill.HITPOINTS, (int) (player.getSkill().getPlayerLevel(Skill.HITPOINTS) * 0.15), true); player.getActionSender().statEdit(Skill.DEFENCE, (int) (player.getSkill().getPlayerLevel(Skill.DEFENCE) * 0.25), true); player.getActionSender().statEdit(Skill.ATTACK, (int) ((player.getSkill().getPlayerLevel(Skill.ATTACK) * 0.10) * -1), false); player.getActionSender().statEdit(Skill.STRENGTH, (int) ((player.getSkill().getPlayerLevel(Skill.STRENGTH) * 0.10) * -1), false); player.getActionSender().statEdit(Skill.MAGIC, (int) ((player.getSkill().getPlayerLevel(Skill.MAGIC) * 0.10) * -1), false); player.getActionSender().statEdit(Skill.RANGED, (int) ((player.getSkill().getPlayerLevel(Skill.RANGED) * 0.10) * -1), false); break; case 2450 : // Zamorak brew case 189 : case 191 : case 193 : player.getActionSender().statEdit(Skill.ATTACK, (int) (player.getSkill().getPlayerLevel(Skill.ATTACK) * 0.20) + 2, true); player.getActionSender().statEdit(Skill.STRENGTH, (int) (player.getSkill().getPlayerLevel(Skill.STRENGTH) * 0.12) + 2, true); player.getActionSender().statEdit(Skill.PRAYER, (int) (player.getSkill().getPlayerLevel(Skill.PRAYER) * 0.10), true); player.getActionSender().statEdit(Skill.DEFENCE, ((int) (player.getSkill().getPlayerLevel(Skill.DEFENCE) * 0.10) + 2) * -1, false); player.hit((int) (player.getSkill().getLevel()[Skill.HITPOINTS] * 0.1) + 2, HitType.NORMAL); break; default : break; } } public static PotionLoader.PotionDefinition[] getPotionDefinitions() { return potionDefinitions; } }[/CODE]
  6. Any tips on how to read/extract those dat files for users and client resources?
  7. Hello, I'm using a base that used .dat files for both users and various resources. It's reading those using a stream in the code, but I'd like to read these files myself, and they don't seem to be plaintext, since wordpad/notepad just spews garbage characters. What are these made in?
  8. You need to add the main class in the arguments. For the server it's probably server.java instead of server.server, why would that even work?
  9. [quote name='davidflynn2']What file must I edit to change it to use my sever instead of his I cant get it to load onto mine and i cant find a file to change ot make it load mine. To change ip address is what i am looking for . Plz help thanks[/QUOTE] The IP is in Client.Java. Also I can't log in for some reason... is anything regarding accounts broken or disabled?
  10. [quote name='coweatsdog']how can i compile it into a jar[/QUOTE] I think I saw a thread about that in the tutorial section.
  11. Hello, I'm using 2006remade atm, and when I try to log in, it just always says wrong password. While a non-existing user should create a new account normally? I was able to log into the starterpack, and I just used the same method here, but it's not working. Any ideas?
  12. It compiled fine on 1.7. For those wondering: It's apparently a "bug" in java. The getHardwareAddress() function returns null in linux. -.- For the time being, I'm just programming over remote desktop to my windows server box, apparently that function of java isn't very platform independant.
  13. [quote name='kuroxasch']That's asking for a mac address. Either you don't have one (not likely) or you're not running it while rooted.[/QUOTE] Thanks for the reply, I just tried running eclipse as root, but it gave me the exact same error. Of course my computer has a mac address. Two, even. [CODE][email protected] ~ $ ifconfig -a eth0 Link encap:Ethernet HWaddr [B]f0:de:f1:d4:13:e3 [/B] UP BROADCAST MULTICAST MTU:1500 Metric:1 RX packets:0 errors:0 dropped:0 overruns:0 frame:0 TX packets:0 errors:0 dropped:0 overruns:0 carrier:0 collisions:0 txqueuelen:1000 RX bytes:0 (0.0 B) TX bytes:0 (0.0 B) lo Link encap:Local Loopback inet addr:127.0.0.1 Mask:255.0.0.0 inet6 addr: ::1/128 Scope:Host UP LOOPBACK RUNNING MTU:16436 Metric:1 RX packets:185483 errors:0 dropped:0 overruns:0 frame:0 TX packets:185483 errors:0 dropped:0 overruns:0 carrier:0 collisions:0 txqueuelen:0 RX bytes:213841858 (213.8 MB) TX bytes:213841858 (213.8 MB) wlan0 Link encap:Ethernet HWaddr [B]74:e5:0b:ae:b8:5a [/B] inet addr:192.168.0.212 Bcast:192.168.0.255 Mask:255.255.255.0 inet6 addr: fe80::76e5:bff:feae:b85a/64 Scope:Link UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1 RX packets:5559027 errors:0 dropped:0 overruns:0 frame:0 TX packets:2595092 errors:0 dropped:0 overruns:0 carrier:0 collisions:0 txqueuelen:1000 RX bytes:7772328238 (7.7 GB) TX bytes:503693774 (503.6 MB) [/CODE]
  14. [B]Thread is solved, somewhat.[/B] Hello, I've kind of asked the same question in a different thread, but now I've encountered the exact same problem with a different source, so I'm making a more detailed, separate thread on this. I was [B]trying to compile[/B] the creativescape 2007 client, but I encountered the same problem with the 2006remade source. [B]I am on linux.[/B] I know threads are handled differently internally on linux than on windows, but does it actually make a difference in syntax? While trying to compile a client, I get the following error: [CODE]Exception in thread "Thread-0" java.lang.NullPointerException at sign.signlink.run(signlink.java:120) at java.lang.Thread.run(Thread.java:722) [/CODE] The code in question giving the error is: [CODE]try { InetAddress address = InetAddress.getLocalHost(); NetworkInterface ni = NetworkInterface.getByInetAddress(address); [B] mac = ni.getHardwareAddress();[/B] for (int i = 0; i < mac.length; i++) { //System.out.format("%02X%s", mac[i], (i < mac.length - 1) ? "-" : "\n"); } //macAdd = byteArrayToInt(mac, 0); //System.out.println("Byte Array MAC Address Converted To Int:" + macAdd); } catch (UnknownHostException e) { e.printStackTrace(); } catch (SocketException e) { e.printStackTrace(); }[/CODE] The highlighted line is the line in question. What is causing this? I was able to compile when I commented it out, but that seemed to have broken the connectivity. Thanks in advance.
×