private void startGame() {
            Event startFightCaveGameEvent = new Event(3000);
            startFightCaveGameEvent.setAction(() => {
				if (completed) {
					startFightCaveGameEvent.stop();
					return;
				}
				if (mobAmount > 0 || currentWave > 63) {
					return;
				}
				if (gamePaused && currentWave != 63) {
					startFightCaveGameEvent.stop();
					p.getPackets().forceLogout();
					return;
				}
				if (currentWave == 62) {
					startFightCaveGameEvent.setTick(8000);
					currentWave++;
					showJadMessage();
					return;
				} else if (currentWave < 62){
					currentWave++;
				}
				int[] mobs = decryptWave(currentWave);
				int amount = 0;
				for (int i = 0; i < mobs.Length; i++) {
					if (mobs[i] > 0) {
						Npc npc = new Npc(mobs[i]);
						Location minCoords = new Location(((20000 + 2363) + (200 * p.getIndex())), 25051, 0);
						Location maxCoords = new Location(((20000 + 2430) + (200 * p.getIndex())), 25123, 0);
						npc.setMinimumCoords(minCoords);
						npc.setMaximumCoords(maxCoords);
						npc.setLocation(new Location((20000 + 2387) + (200 * p.getIndex()) + misc.random(22), 20000 + 5069 + misc.random(33), 0));
						npc.setEntityFocus(p.getClientIndex());
						npc.setOwner(p);
						npc.setTarget(p);
						npc.getFollow().setFollowing(p);
						Server.getNpcList().Add(npc);
						amount++;
					}
				}
				mobAmount = (byte)amount;
		    });
            Server.registerEvent(startFightCaveGameEvent);
	    }
Exemplo n.º 2
0
	    private static void summonJadHealers(Player p,  Npc jad) {
		    for (int i = 0; i < 4; i++) {
			    Npc npc = new Npc(2746);
			    Location minCoords = new Location((20000 + 2363) + (200 * p.getIndex()), 25502, 0);
			    Location maxCoords = new Location((20000 + 2430) + (200 * p.getIndex()), 25123, 0);
			    npc.setMinimumCoords(minCoords);
			    npc.setMaximumCoords(maxCoords);
			    npc.setLocation(new Location((20000 + 2387) + (200 * p.getIndex()) + misc.random(22), 20000 + 5069 + misc.random(33), 0));
			    npc.setEntityFocus(jad.getClientIndex());
			    npc.setOwner(p);
			    npc.getFollow().setFollowing(jad);
			    npc.setTarget(null);
			    Server.getNpcList().Add(npc);

                Event jadHealerEvent = new Event(2000);
                jadHealerEvent.setAction(() => {
					if (npc.isDead() || !npc.isVisible() || npc.isDestroyed()) {
						jadHealerEvent.stop();
						return;
					}
					if (npc.getLocation().withinDistance(jad.getLocation(), 2) && !npc.inCombat()) {
						if (misc.random(7) == 0) {
							jad.setLastGraphics(new Graphics(444));
							npc.setLastAnimation(new Animation(9254));
							int jadMaxHp = jad.getMaxHp();
							jad.heal((int) (jadMaxHp * 0.5));
						}
					}
			    });
                Server.registerEvent(jadHealerEvent);
		    }
	    }