Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public void acceptInvite() {
- Player invitedBy = (Player) player.getTemporaryAttributtes().remove(Key.DUNGEON_INVITED_BY);
- if (invitedBy == null)
- return;
- DungeonPartyManager party = invitedBy.getDungManager().getParty();
- if (invitedBy.getDungManager().invitingPlayer != player || party == null || !party.isLeader(invitedBy)) {
- player.closeInterfaces();
- player.getPackets().sendGameMessage("You can't do that right now.");
- return;
- }
- if (party.getTeam().size() >= 5) {
- player.closeInterfaces();
- player.getPackets().sendGameMessage("The party is full.");
- return;
- }
- if (party.getComplexity() > maxComplexity) {
- player.closeInterfaces();
- player.getPackets().sendGameMessage("You can't do this complexity.");
- return;
- }
- if (party.getFloor() > maxFloor) {
- player.closeInterfaces();
- player.getPackets().sendGameMessage("You can't do this floor.");
- return;
- }
- invitedBy.getDungManager().resetInvitation();
- invitedBy.getDungManager().getParty().setDificulty(0);
- invitedBy.getDungManager().getParty().add(player);
- player.stopAll();
- invitedBy.stopAll();
- }
- public void invite(String name) {
- player.stopAll();
- if (party == null) {
- final Player p2 = World.getPlayerByDisplayName(name);
- if (p2 == null) {
- player.getPackets().sendGameMessage("Unable to find " + name);
- return;
- }
- DungeonPartyManager party = p2.getDungManager().getParty();
- if (p2.getDungManager().invitingPlayer != player || player.getPlane() != 0 || party == null
- || !party.isLeader(p2)) {
- player.getPackets().sendGameMessage("You can't do that right now.");
- return;
- }
- player.getTemporaryAttributtes().put(Key.DUNGEON_INVITED_BY, p2);
- player.getInterfaceManager().sendInterface(949);
- for (int i = 0; i < 5; i++) {
- Player teamMate = i >= party.getTeam().size() ? null : party.getTeam().get(i);
- player.getPackets().sendGlobalString(284 + i, teamMate == null ? "" : teamMate.getDisplayName());
- player.getPackets().sendCSVarInteger(1153 + i,
- teamMate == null ? -1 : teamMate.getSkills().getCombatLevelWithSummoning());
- player.getPackets().sendCSVarInteger(1158 + i,
- teamMate == null ? -1 : teamMate.getSkills().getLevelForXp(Skills.DUNGEONEERING));
- player.getPackets().sendCSVarInteger(1163 + i,
- teamMate == null ? -1 : teamMate.getSkills().getHighestSkillLevel());
- player.getPackets().sendCSVarInteger(1168 + i,
- teamMate == null ? -1 : teamMate.getSkills().getTotalLevel());
- }
- player.getPackets().sendCSVarInteger(1173, party.getFloor());
- player.getPackets().sendCSVarInteger(1174, party.getComplexity());
- player.setCloseInterfacesEvent(new Runnable() {
- @Override
- public void run() {
- p2.getDungManager().expireInvitation();
- player.getTemporaryAttributtes().remove(Key.DUNGEON_INVITED_BY);
- }
- });
- } else {
- if (!party.isLeader(player) || party.getDungeon() != null) {
- player.getPackets().sendGameMessage("You can't do that right now.");
- return;
- }
- if (party.getSize() >= 5) {
- player.getPackets().sendGameMessage("Your party is full.");
- return;
- }
- Player p2 = World.getPlayerByDisplayName(name);
- if (p2 == null) {
- player.getPackets().sendGameMessage("That player is offline, or has privacy mode enabled.");
- return;
- }
- if (!(p2.getControlerManager().getControler() instanceof Kalaboss)) {
- player.getPackets().sendGameMessage("You can only invite a player in or around Daemonheim.");
- return;
- }
- if (p2.getDungManager().party != null) {
- player.getPackets().sendGameMessage(p2.getDisplayName() + " is already in a party.");
- return;
- }
- if (p2.getInterfaceManager().containsScreenInter() || p2.isCantTrade() || p2.isLocked()) {
- player.getPackets().sendGameMessage("The other player is busy.");
- return;
- }
- expireInvitation();
- invitingPlayer = p2;
- player.getPackets().sendGameMessage("Sending party invitation to " + p2.getDisplayName() + "...");
- p2.getPackets().sendDungeonneringRequestMessage(player);
- }
- }
- public void openResetProgress() {
- player.stopAll();
- player.getDialogueManager().startDialogue("PrestigeReset");
- }
- public void switchGuideMode() {
- if (party == null) {
- player.getPackets().sendGameMessage("You must be in a party to do that.");
- return;
- }
- if (party.getDungeon() != null) {
- player.getPackets().sendGameMessage("You cannot change the guide mode once the dungeon has started.");
- return;
- }
- if (!party.isLeader(this.player)) {
- this.player.getPackets().sendGameMessage("Only your party's leader can switch guide mode!");
- return;
- }
- player.stopAll();
- party.setGuideMode(!party.getGuideMode());
- if (party.getGuideMode())
- player.getPackets().sendGameMessage(
- "Guide mode enabled. Your map will show you the critical path, but you will receive an xp penalty.");
- else
- player.getPackets().sendGameMessage("Guide mode disabled. Your map will no longer show the critical path.");
- for (Player p2 : party.getTeam())
- p2.getDungManager().refreshPartyGuideModeComponent();
- }
- public void changeFloor() {
- if (party == null) {
- player.getPackets().sendGameMessage("You must be in a party to do that.");
- return;
- }
- if (party.getDungeon() != null) {
- player.getPackets().sendGameMessage("You cannot change these settings while in a dungeon.");
- return;
- }
- if (!party.isLeader(this.player)) {
- this.player.getPackets().sendGameMessage("Only your party's leader can change floor!");
- return;
- }
- player.stopAll();
- player.getInterfaceManager().sendInterface(947);
- for (int i = 0; i < party.getMaxFloor(); i++)
- player.getPackets().sendHideIComponent(947, 48 + i, false);
- for (int index = party.getTeam().size() - 1; index >= 0; index--) {
- Player teamMate = party.getTeam().get(index);
- for (int floor = 1; floor < teamMate.getDungManager().getMaxFloor(); floor++) {
- player.getPackets().sendHideIComponent(947, 120 + floor + (4 - index) * 122, false);
- if (teamMate.getDungManager().currentProgress[floor - 1])
- player.getPackets().sendHideIComponent(947, 180 + floor + (4 - index) * 122, false);
- }
- }
- player.setCloseInterfacesEvent(new Runnable() {
- @Override
- public void run() {
- player.getTemporaryAttributtes().remove(Key.DUNG_FLOOR);
- }
- });
- }
- public void selectFloor(int floor) {
- if (party == null) {
- player.getPackets().sendGameMessage("You must be in a party to do that.");
- return;
- }
- /*
- * cant happen, cuz u cant click anyway but oh well
- */
- if (party.getMaxFloor() < party.getMaxFloor()) {
- player.getPackets().sendGameMessage("A member in your party can't do this floor.");
- return;
- }
- player.getPackets().sendIComponentText(947, 765, "" + floor);
- player.getTemporaryAttributtes().put(Key.DUNG_FLOOR, floor);
- }
- public void confirmFloor() {
- Integer selectedFloor = (Integer) player.getTemporaryAttributtes().remove(Key.DUNG_FLOOR);
- player.stopAll();
- if (party == null) {
- player.getPackets().sendGameMessage("You must be in a party to do that.");
- return;
- }
- if (selectedFloor == null)
- selectedFloor = party.getMaxFloor();
- if (party.getMaxFloor() < party.getMaxFloor()) {
- player.getPackets().sendGameMessage("A member in your party can't do this floor.");
- return;
- }
- if (party.getDungeon() != null) {
- player.getPackets().sendGameMessage("You cannot change these settings while in a dungeon.");
- return;
- }
- if (!party.isLeader(player)) {
- player.getPackets().sendGameMessage("Only your party's leader can change floor!");
- return;
- }
- party.setFloor(selectedFloor);
- }
- public void changeComplexity() {
- if (party == null) {
- player.getPackets().sendGameMessage("You must be in a party to do that.");
- return;
- }
- if (party.getDungeon() != null) {
- player.getPackets().sendGameMessage("You cannot change these settings while in a dungeon.");
- return;
- }
- if (!party.isLeader(player)) {
- player.getPackets().sendGameMessage("Only your party's leader can change complexity!");
- return;
- }
- player.stopAll();
- player.getInterfaceManager().sendInterface(938);
- selectComplexity(party.getMaxComplexity());
- player.setCloseInterfacesEvent(new Runnable() {
- @Override
- public void run() {
- player.getTemporaryAttributtes().remove(Key.DUNG_COMPLEXITY);
- }
- });
- }
- public void selectComplexity(int complexity) {
- if (party == null) {
- player.getPackets().sendGameMessage("You must be in a party to do that.");
- return;
- }
- if (party.getMaxComplexity() < complexity) {
- player.getPackets().sendGameMessage("A member in your party can't do this complexity.");
- return;
- }
- Integer selectedComplexity = (Integer) player.getTemporaryAttributtes().remove(Key.DUNG_COMPLEXITY);
- if (selectedComplexity != null)
- markComplexity(selectedComplexity, false);
- markComplexity(complexity, true);
- hideSkills(complexity);
- int penalty = complexity == 6 ? 0 : ((6 - complexity) * 5 + 25);
- player.getPackets().sendIComponentText(938, 42, "" + complexity);
- player.getPackets().sendIComponentText(938, 119, penalty + "% XP Penalty");
- player.getTemporaryAttributtes().put(Key.DUNG_COMPLEXITY, complexity);
- }
- public void confirmComplexity() {
- Integer selectedComplexity = (Integer) player.getTemporaryAttributtes().remove(Key.DUNG_COMPLEXITY);
- player.stopAll();
- if (selectedComplexity == null)
- return;
- if (party == null) {
- player.getPackets().sendGameMessage("You must be in a party to do that.");
- return;
- }
- if (party.getMaxComplexity() < selectedComplexity) {
- player.getPackets().sendGameMessage("A member in your party can't do this complexity.");
- return;
- }
- if (party.getDungeon() != null) {
- player.getPackets().sendGameMessage("You cannot change these settings while in a dungeon.");
- return;
- }
- if (!party.isLeader(player)) {
- player.getPackets().sendGameMessage("Only your party's leader can change complexity!");
- return;
- }
- party.setComplexity(selectedComplexity);
- }
- private void markComplexity(int complexity, boolean mark) {
- player.getPackets().sendHideIComponent(938, 57 + ((complexity - 1) * 5), !mark);
- }
- private static final String[] COMPLEXITY_SKILLS = { "Combat", "Cooking", "Firemaking", "Woodcutting", "Fishing",
- "Creating Weapons", "Mining", "Runecrafting", "Farming Textiles", "Hunting", "Creating Armour",
- "Farming Seeds", "Herblore", "Thieving", "Summoning", "Construction" };
- private void hideSkills(int complexity) {
- int count = 0;
- if (complexity >= 1)
- count += 1;
- if (complexity >= 2)
- count += 3;
- if (complexity >= 3)
- count += 3;
- if (complexity >= 4)
- count += 3;
- if (complexity >= 5)
- count += 3;
- if (complexity >= 6)
- count += 3;
- for (int i = 0; i < COMPLEXITY_SKILLS.length; i++) {
- player.getPackets().sendIComponentText(938, 88 + i * 2,
- (i >= count ? "<col=383838>" : "") + COMPLEXITY_SKILLS[i]);
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment