Realscape 0 #1 Posted July 18, 2012 [COLOR="Lime"]What are you adding? Fully 63 Wave Fight Caves like runescape[/COLOR] Lets start First make a new class named Location:server/model/minigames/thzaar/FightCaves.java [CODE]package server.game.minigames.tzhaar; import server.Server; import server.game.npcs.NPCHandler; import server.game.players.Client; public class FightCaves { public static final int TZ_KIH = 2627, TZ_KEK_SPAWN = 2738, TZ_KEK = 2630, TOK_XIL = 2631, YT_MEJKOT = 2741, KET_ZEK = 2743, TZTOK_JAD = 2745; /** * Holds the data for the 63 waves fight cave. */ private final int[][] WAVES = {{TZ_KIH}, {TZ_KIH,TZ_KIH}, {TZ_KEK}, {TZ_KEK,TZ_KIH}, {TZ_KEK,TZ_KIH,TZ_KIH}, {TZ_KEK,TZ_KEK}, {TOK_XIL}, {TOK_XIL,TZ_KIH}, {TOK_XIL,TZ_KIH,TZ_KIH}, {TOK_XIL,TZ_KEK}, {TOK_XIL,TZ_KEK,TZ_KIH}, {TOK_XIL,TZ_KEK,TZ_KIH,TZ_KIH}, {TOK_XIL,TZ_KEK,TZ_KEK}, {TOK_XIL,TOK_XIL}, {YT_MEJKOT}, {YT_MEJKOT,TZ_KIH}, {YT_MEJKOT,TZ_KIH,TZ_KIH}, {YT_MEJKOT,TZ_KEK}, {YT_MEJKOT,TZ_KEK,TZ_KIH}, {YT_MEJKOT,TZ_KEK,TZ_KIH,TZ_KIH}, {YT_MEJKOT,TZ_KEK,TZ_KEK}, {YT_MEJKOT,TOK_XIL}, {YT_MEJKOT,TOK_XIL,TZ_KIH}, {YT_MEJKOT,TOK_XIL,TZ_KIH,TZ_KIH}, {YT_MEJKOT,TOK_XIL,TZ_KEK}, {YT_MEJKOT,TOK_XIL,TZ_KEK,TZ_KIH}, {YT_MEJKOT,TOK_XIL,TZ_KEK,TZ_KIH,TZ_KIH}, {YT_MEJKOT,TOK_XIL,TZ_KEK,TZ_KEK}, {YT_MEJKOT,TOK_XIL,TOK_XIL}, {YT_MEJKOT,YT_MEJKOT}, {KET_ZEK}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390, 5096}, {2392, 5077}, {2408, 5080}, {2413, 5108}, {2381, 5106}, {2379, 5072}, {2420, 5082}}; /** * Handles spawning the next fightcave wave. * [MENTION=75098]Para[/MENTION]m c * The player. */ public void spawnNextWave(Client c) { if (c != null) { if (c.waveId >= WAVES.length) { c.waveId = 0; return; } if (c.waveId < 0){ return; } int npcAmount = WAVES[c.waveId].length; for (int j = 0; j < npcAmount; j++) { int npc = WAVES[c.waveId][j]; int X = COORDINATES[j][0]; int Y = COORDINATES[j][1]; int H = c.heightLevel; int hp = getHp(npc); int max = getMax(npc); int atk = getAtk(npc); int def = getDef(npc); Server.npcHandler.spawnNpc(c, npc, X, Y, H, 0, hp, max, atk, def, true, false); } c.tzhaarToKill = npcAmount; c.tzhaarKilled = 0; } } /** * Handles the correct tz-kih effect; prayer * is drained by the formula: drain = damage + 1 * [MENTION=75098]Para[/MENTION]m c * The player * [MENTION=75098]Para[/MENTION]m i * The npcId * [MENTION=75098]Para[/MENTION]m damage * What the npchit */ public static void tzKihEffect(Client c,int i, int damage) { if(NPCHandler.npcs[i].npcType == TZ_KIH) { if(c != null) { if(c.playerLevel[5] > 0) { c.playerLevel[5] -= 1 + damage; c.getPA().refreshSkill(5); } } } } public static void tzKekEffect(Client c, int i) { if(NPCHandler.npcs[i].npcType == TZ_KEK) { int x = NPCHandler.npcs[i].absX + 2; int y = NPCHandler.npcs[i].absY + 2; int x1 = NPCHandler.npcs[i].absX - 2; int y1 = NPCHandler.npcs[i].absY - 2; int hp = getHp(TZ_KEK_SPAWN); int max = getMax(TZ_KEK_SPAWN); int atk = getAtk(TZ_KEK_SPAWN); int def = getDef(TZ_KEK_SPAWN); if(c != null) { if(c.tzKekTimer == 0) { if(NPCHandler.npcs[i].isDead) { Server.npcHandler.spawnNpc(c, TZ_KEK_SPAWN, x, y, c.heightLevel, 0, hp, max, atk, def, true, false); Server.npcHandler.spawnNpc(c, TZ_KEK_SPAWN, x1, y1, c.heightLevel, 0, hp, max, atk, def, true, false); } } } } } public static int getHp(int npc) { switch (npc) { case TZ_KIH: case TZ_KEK_SPAWN: return 10; case TZ_KEK: return 20; case TOK_XIL: return 40; case YT_MEJKOT: return 80; case KET_ZEK: return 150; case TZTOK_JAD: return 250; } return 100; } public static int getMax(int npc) { switch (npc) { case TZ_KIH: case TZ_KEK_SPAWN: return 4; case TZ_KEK: return 7; case TOK_XIL: return 13; case YT_MEJKOT: return 28; case KET_ZEK: return 54; case TZTOK_JAD: return 97; } return 5; } public static int getAtk(int npc) { switch (npc) { case TZ_KIH: case TZ_KEK_SPAWN: return 30; case TZ_KEK: return 50; case TOK_XIL: return 100; case YT_MEJKOT: return 150; case KET_ZEK: return 450; case TZTOK_JAD: return 650; } return 100; } public static int getDef(int npc) { switch (npc) { case TZ_KIH: case TZ_KEK_SPAWN: return 30; case TZ_KEK: return 50; case TOK_XIL: return 100; case YT_MEJKOT: return 150; case KET_ZEK: return 300; case TZTOK_JAD: return 500; } return 100; } }[/CODE] Next go to NPCHandler look for something [B]private void killedBarrow(int i) {[/B] add this under the last } u see: [CODE] private void tzhaarDeathHandler(int i) { if (isFightCaveNpc(i) && npcs[i].npcType != FightCaves.TZ_KEK) killedTzhaar(i); if(npcs[i].npcType == FightCaves.TZ_KEK_SPAWN) { int p = npcs[i].killerId; if (PlayerHandler.players[p] != null) { Client c = (Client) PlayerHandler.players[p]; c.tzKekSpawn += 1; if(c.tzKekSpawn == 2) { killedTzhaar(i); c.tzKekSpawn = 0; } } } if(npcs[i].npcType == FightCaves.TZ_KEK) { int p = npcs[i].killerId; if (PlayerHandler.players[p] != null) { Client c = (Client) PlayerHandler.players[p]; FightCaves.tzKekEffect(c, i); } } } private void killedTzhaar(int i) { final Client c2 = (Client) PlayerHandler.players[npcs[i].spawnedBy]; c2.tzhaarKilled++; if (c2.tzhaarKilled == c2.tzhaarToKill) { c2.waveId++; EventManager.getSingleton().addEvent(new Event() { public void execute(EventContainer c) { if (c2 != null) { Server.fightCaves.spawnNextWave(c2); } c.stop(); } }, 7500); } } public void handleJadDeath(int i) { Client c = (Client)Server.playerHandler.players[npcs[i].spawnedBy]; c.getItems().addItem(6570,1); c.getDH().sendDialogues(69, 2617); c.getPA().resetTzhaar(); c.waveId = 300; }[/CODE] then look for [B]if (npcs[i].isDead == true) {[/B] scroll down till u see something like this [CODE]dropItems(i); // npc drops items! appendSlayerExperience(i);[/CODE] under one of them add : [CODE]tzhaarDeathHandler(i); [/CODE] and [CODE] if (npcs[i].npcType == 2745) { handleJadDeath(i); }[/CODE] then look for [B]public void applydamage[/B] and scroll down till u reach the end of the public above [B]c.getPA().refreshSkill(3);[/B] add : [CODE] FightCaves.tzKihEffect(c, i, damage);[/CODE] Next go to PlayerAssistant and add this somewhere : [CODE] public void resetTzhaar() { c.waveId = -1; c.tzhaarToKill = -1; c.tzhaarKilled = -1; movePlayer(2438, 5168, 0); } public void enterCaves() { c.getPA().movePlayer(2413,5117, c.playerId * 4); c.waveId = 0; c.tzhaarToKill = -1; c.tzhaarKilled = -1; EventManager.getSingleton().addEvent(new Event() { public void execute(EventContainer e) { Server.fightCaves.spawnNextWave((Client)PlayerHandler.players[c.playerId]); e.stop(); } }, 10000); }[/CODE] Next look for givelife and add this: [CODE] } else if (c.inFightCaves()) { c.getPA().resetTzhaar();[/CODE] next go to client.java and look for [B]correctCoordinates()[/B] put this under it [CODE] 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)PlayerHandler.players[playerId]); c.stop(); } }, 10000); }[/CODE] Next go to player.java and add this: [CODE] tzhaarToKill = 0, tzhaarKilled = 0, tzKekSpawn = 0, tzKekTimer = 0, waveId,[/CODE] Next search for [B]inMulti()[/B] add this under the last } u see after inmulti : [CODE] public boolean inFightCaves() { return absX >= 2360 && absX <= 2445 && absY >= 5045 && absY <= 5125; }[/CODE] go to your sendialogue and add this : [CODE] case 69: sendNpcChat2("You even defeated TzTok-Jad, I am most impressed!", "Please accept this gift as a reward.", c.talkingNpc, "Tzhaar-Mej-Tal"); c.nextChat = -1; break;[/CODE] reply if i forgot something btw add the imports Credits : 25% me for ripping from source and editing a little part 75% to the owner of the source Share this post Link to post Share on other sites
Hash 0 #2 Posted July 19, 2012 Seems nice, code looks decent, nice work. Share this post Link to post Share on other sites
JiliXI 0 #3 Posted July 23, 2012 (edited) This is mine and you don't have permission to release this. And the fact you removed the [MENTION=52317]auth[/MENTION]or javadoc, and then claim 25% credits, is absurd and to me shows that you are knowingly releasing code that isn't yours. Proof: [URL="http://i45.tinypic.com/xl9wsk.png"]http://i45.tinypic.com/xl9wsk.png[/URL] (to big to show on this page) Edited July 23, 2012 by JiliXI Share this post Link to post Share on other sites
JiliXI 0 #4 Posted July 23, 2012 Edit: Double post on accident, please delete this double post. Thanks. Share this post Link to post Share on other sites
Realscape 0 #5 Posted August 6, 2012 i didnt remove the auth i just rape this from a server Share this post Link to post Share on other sites
crf10071 0 #7 Posted October 18, 2012 I got this error with player.java, and i got a error with my dialogue but that isn't important right now. [url]http://gyazo.com/c297bc6f04bd4581c1fc3ab1def4682a[/url] Share this post Link to post Share on other sites