Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- ### Eclipse Workspace Patch 1.0
- #P L2J_Mobius_CT_2.6_HighFive
- Index: dist/game/data/scripts/instances/DarkCloudMansion/DarkCloudMansion.java
- ===================================================================
- --- dist/game/data/scripts/instances/DarkCloudMansion/DarkCloudMansion.java (revision 7173)
- +++ dist/game/data/scripts/instances/DarkCloudMansion/DarkCloudMansion.java (working copy)
- @@ -16,57 +16,53 @@
- */
- package instances.DarkCloudMansion;
- -import java.util.ArrayList;
- import java.util.List;
- +import org.l2jmobius.commons.util.CommonUtil;
- import org.l2jmobius.gameserver.enums.ChatType;
- import org.l2jmobius.gameserver.instancemanager.InstanceManager;
- import org.l2jmobius.gameserver.model.Location;
- import org.l2jmobius.gameserver.model.Party;
- +import org.l2jmobius.gameserver.model.PlayerCondOverride;
- +import org.l2jmobius.gameserver.model.StatSet;
- import org.l2jmobius.gameserver.model.actor.Npc;
- import org.l2jmobius.gameserver.model.actor.instance.PlayerInstance;
- -import org.l2jmobius.gameserver.model.instancezone.Instance;
- +import org.l2jmobius.gameserver.model.holders.SkillHolder;
- import org.l2jmobius.gameserver.model.instancezone.InstanceWorld;
- -import org.l2jmobius.gameserver.model.skills.Skill;
- import org.l2jmobius.gameserver.network.NpcStringId;
- import org.l2jmobius.gameserver.network.SystemMessageId;
- -import org.l2jmobius.gameserver.network.serverpackets.MagicSkillUse;
- -import org.l2jmobius.gameserver.network.serverpackets.NpcSay;
- import org.l2jmobius.gameserver.network.serverpackets.SystemMessage;
- import instances.AbstractInstance;
- /**
- - * Dark Cloud Mansion instance zone.
- + * Dark Cloud Mansion instance.
- + * @author malyelfik
- */
- public class DarkCloudMansion extends AbstractInstance
- {
- // NPCs
- - private static int YIYEN = 32282;
- - private static int SOFaith = 32288; // Symbol of Faith
- - private static int SOAdversity = 32289; // Symbol of Adversity
- - private static int SOAdventure = 32290; // Symbol of Adventure
- - private static int SOTruth = 32291; // Symbol of Truth
- - private static int BSM = 32324; // Black Stone Monolith
- - private static int SC = 22402; // Shadow Column
- + private static final int YIYEN = 32282;
- + private static final int FAITH = 32288; // Symbol of Faith
- + private static final int ADVERSITY = 32289; // Symbol of Adversity
- + private static final int ADVENTURE = 32290; // Symbol of Adventure
- + private static final int TRUTH = 32291; // Symbol of Truth
- + private static final int MONOLITH = 32324; // Black Stone Monolith
- + private static final int COLUMN = 22402; // Shadow Column
- // Mobs
- - private static int[] CCG =
- + private static final int PARME_HEALER = 22400;
- + private static final int[] BELETH_SUBORDINATE =
- {
- - 18369,
- - 18370
- - }; // Chromatic Crystal Golem
- - private static int[] BM =
- - {
- 22272,
- 22273,
- 22274
- - }; // Beleth's Minions
- - private static int[] HG =
- + };
- + private static final int[] MONOLITH_PRIVATES =
- {
- - 22264,
- - 22264
- - }; // [22318,22319] #Hall Guards
- - private static int[] BS =
- + 18369,
- + 18370
- + };
- + private static final int[] BELETH_SAMPLE =
- {
- 18371,
- 18372,
- @@ -75,46 +71,23 @@
- 18375,
- 18376,
- 18377
- - }; // Beleth's Samples
- - private static int[] TOKILL =
- - {
- - 18371,
- - 18372,
- - 18373,
- - 18374,
- - 18375,
- - 18376,
- - 18377,
- - // 22318,
- - // 22319,
- - 22272,
- - 22273,
- - 22274,
- - 18369,
- - 18370,
- - 22402,
- - 22264
- };
- -
- + // Skill
- + private static final SkillHolder INCARNATION = new SkillHolder(5441, 1);
- // Items
- - private static int CC = 9690; // Contaminated Crystal
- - // Misc
- - private static final int TEMPLATE_ID = 9;
- - private static int D1 = 24230001; // Starting Room
- - private static int D2 = 24230002; // First Room
- - private static int D3 = 24230005; // Second Room
- - private static int D4 = 24230003; // Third Room
- - private static int D5 = 24230004; // Forth Room
- - private static int D6 = 24230006; // Fifth Room
- - private static int W1 = 24230007; // Wall 1
- - // private static int W2 = 24230008; // Wall 2
- - // private static int W3 = 24230009; // Wall 3
- - // private static int W4 = 24230010; // Wall 4
- - // private static int W5 = 24230011; // Wall 5
- - // private static int W6 = 24230012; // Wall 6
- - // private static int W7 = 24230013; // Wall 7
- - private static boolean noRndWalk = true;
- - private static NpcStringId[] _spawnChat =
- + private static final int CC = 9690; // Contaminated Crystal
- + // Doors
- + private static final int START_DOOR = 24230001; // Starting Room
- + private static final int ROOM_A_DOOR = 24230002; // First Room
- + private static final int ROOM_B_DOOR = 24230005; // Second Room
- + private static final int ROOM_C_DOOR = 24230003; // Third Room
- + private static final int ROOM_D_DOOR = 24230004; // Forth Room
- + private static final int ROOM_E_DOOR = 24230006; // Fifth Room
- + // Locations
- + private static final Location ENTER_LOC = new Location(146534, 180464, -6117);
- + private static final Location EXIT_LOC = new Location(139968, 150367, -3111);
- + // Messages
- + private static final NpcStringId[] SPAWN_CHAT =
- {
- NpcStringId.I_M_THE_REAL_ONE,
- NpcStringId.PICK_ME,
- @@ -122,13 +95,13 @@
- NpcStringId.NOT_THAT_DUDE_I_M_THE_REAL_ONE,
- NpcStringId.DON_T_BE_FOOLED_DON_T_BE_FOOLED_I_M_THE_REAL_ONE
- };
- - private static NpcStringId[] _decayChat =
- + private static final NpcStringId[] DECAY_CHAT =
- {
- NpcStringId.I_M_THE_REAL_ONE_PHEW,
- NpcStringId.CAN_T_YOU_EVEN_FIND_OUT,
- NpcStringId.FIND_ME
- };
- - private static NpcStringId[] _successChat =
- + private static final NpcStringId[] SUCCESS_CHAT =
- {
- NpcStringId.HUH_HOW_DID_YOU_KNOW_IT_WAS_ME,
- NpcStringId.EXCELLENT_CHOICE_TEEHEE,
- @@ -135,101 +108,35 @@
- NpcStringId.YOU_VE_DONE_WELL,
- NpcStringId.OH_VERY_SENSIBLE
- };
- - private static NpcStringId[] _faildChat =
- + private static final NpcStringId[] FAIL_CHAT =
- {
- NpcStringId.YOU_VE_BEEN_FOOLED,
- NpcStringId.SORRY_BUT_I_M_THE_FAKE_ONE
- };
- - // @formatter:off
- - // Second room - random monolith order
- - private static int[][] MonolithOrder = new int[][]
- - {
- - {1, 2, 3, 4, 5, 6},
- - {6, 5, 4, 3, 2, 1},
- - {4 ,5, 6, 3, 2, 1},
- - {2, 6, 3, 5, 1, 4},
- - {4, 1, 5, 6, 2, 3},
- - {3, 5, 1, 6, 2, 4},
- - {6, 1, 3, 4, 5, 2},
- - {5, 6, 1, 2, 4, 3},
- - {5, 2, 6, 3, 4, 1},
- - {1, 5, 2, 6, 3, 4},
- - {1, 2, 3, 6, 5, 4},
- - {6, 4, 3, 1, 5, 2},
- - {3, 5, 2, 4, 1, 6},
- - {3, 2, 4, 5, 1, 6},
- - {5, 4, 3, 1, 6, 2},
- - };
- - // Second room - golem spawn locatons - random
- - private static int[][] GolemSpawn = new int[][]
- - {
- - {CCG[0], 148060, 181389},
- - {CCG[1], 147910, 181173},
- - {CCG[0], 147810, 181334},
- - {CCG[1], 147713, 181179},
- - {CCG[0], 147569, 181410},
- - {CCG[1], 147810, 181517},
- - {CCG[0], 147805, 181281},
- - };
- - // forth room - random shadow column
- - private static int[][] ColumnRows = new int[][]
- - {
- - {1, 1, 0, 1, 0},
- - {0, 1, 1, 0, 1},
- - {1, 0, 1, 1, 0},
- - {0, 1, 0, 1, 1},
- - {1, 0, 1, 0, 1},
- - };
- + // Misc
- + private static final int TEMPLATE_ID = 9;
- - // Fifth room - beleth order
- - private static int[][] Beleths = new int[][]
- + public DarkCloudMansion()
- {
- - {1, 0, 1, 0, 1, 0, 0},
- - {0, 0, 1, 0, 1, 1, 0},
- - {0, 0, 0, 1, 0, 1, 1},
- - {1, 0, 1, 1, 0, 0, 0},
- - {1, 1, 0, 0, 0, 1, 0},
- - {0, 1, 0, 1, 0, 1, 0},
- - {0, 0, 0, 1, 1, 1, 0},
- - {1, 0, 1, 0, 0, 1, 0},
- - {0, 1, 1, 0, 0, 0, 1},
- - };
- - // @formatter:on
- -
- - private DarkCloudMansion()
- - {
- - addFirstTalkId(BSM, SOTruth);
- + super();
- addStartNpc(YIYEN);
- - addTalkId(YIYEN, SOTruth);
- - addAttackId(SC);
- - addAttackId(BS);
- - addAttackId(CCG);
- - addKillId(TOKILL);
- + addFirstTalkId(MONOLITH, TRUTH, FAITH, ADVERSITY, ADVENTURE);
- + addTalkId(YIYEN, TRUTH);
- + addAttackId(COLUMN, PARME_HEALER);
- + addAttackId(BELETH_SAMPLE);
- + addKillId(COLUMN, PARME_HEALER);
- + addKillId(BELETH_SAMPLE);
- + addKillId(BELETH_SUBORDINATE);
- }
- - protected static class DMCNpc
- - {
- - public Npc npc;
- - public boolean isDead = false;
- - public Npc golem = null;
- - public int status = 0;
- - public int order = 0;
- - public int count = 0;
- - }
- -
- - protected static class DMCRoom
- - {
- - public List<DMCNpc> npcList = new ArrayList<>();
- - public int counter = 0;
- - public int reset = 0;
- - public int founded = 0;
- - public int[] Order;
- - }
- -
- @Override
- protected boolean checkConditions(PlayerInstance player)
- {
- + if (player.canOverrideCond(PlayerCondOverride.INSTANCE_CONDITIONS))
- + {
- + return true;
- + }
- final Party party = player.getParty();
- if (party == null)
- {
- @@ -269,9 +176,15 @@
- @Override
- public void onEnterInstance(PlayerInstance player, InstanceWorld world, boolean firstEntrance)
- {
- - if (firstEntrance)
- + if (player.canOverrideCond(PlayerCondOverride.INSTANCE_CONDITIONS))
- {
- - runStartRoom(world);
- + world.setStatus(0);
- + world.addAllowed(player);
- + teleportPlayer(player, ENTER_LOC, world.getInstanceId());
- + }
- + else if (firstEntrance)
- + {
- + world.setStatus(0);
- final Party party = player.getParty();
- if (party != null)
- {
- @@ -282,651 +195,174 @@
- newQuestState(partyMember);
- }
- world.addAllowed(partyMember);
- - teleportPlayer(partyMember, new Location(146534, 180464, -6117), world.getInstanceId());
- + teleportPlayer(partyMember, ENTER_LOC, world.getInstanceId());
- }
- }
- }
- else
- {
- - teleportPlayer(player, new Location(146534, 180464, -6117), world.getInstanceId());
- + teleportPlayer(player, ENTER_LOC, world.getInstanceId());
- }
- }
- - protected void runStartRoom(InstanceWorld world)
- + @Override
- + public String onAdvEvent(String event, Npc npc, PlayerInstance player)
- {
- - world.setStatus(0);
- - final DMCRoom startRoom = new DMCRoom();
- - DMCNpc thisNpc;
- - thisNpc = new DMCNpc();
- - thisNpc.npc = addSpawn(BM[0], 146817, 180335, -6117, 0, false, 0, false, world.getInstanceId());
- - startRoom.npcList.add(thisNpc);
- - if (noRndWalk)
- + final InstanceWorld world = InstanceManager.getInstance().getWorld(npc);
- + if (world != null)
- {
- - thisNpc.npc.setRandomWalking(false);
- - }
- -
- - thisNpc = new DMCNpc();
- - thisNpc.npc = addSpawn(BM[0], 146741, 180589, -6117, 0, false, 0, false, world.getInstanceId());
- - startRoom.npcList.add(thisNpc);
- - if (noRndWalk)
- - {
- - thisNpc.npc.setRandomWalking(false);
- - }
- - world.setParameter("StartRoom", startRoom);
- - }
- -
- - protected void spawnHall(InstanceWorld world)
- - {
- - final DMCRoom hall = new DMCRoom();
- - DMCNpc thisNpc;
- - world.getParameters().remove("Hall"); // remove room instance to avoid adding mob every time
- - thisNpc = new DMCNpc();
- - thisNpc.npc = addSpawn(BM[1], 147217, 180112, -6117, 0, false, 0, false, world.getInstanceId());
- - if (noRndWalk)
- - {
- - thisNpc.npc.setRandomWalking(false);
- - }
- - hall.npcList.add(thisNpc);
- -
- - thisNpc = new DMCNpc();
- - thisNpc.npc = addSpawn(BM[2], 147217, 180209, -6117, 0, false, 0, false, world.getInstanceId());
- - if (noRndWalk)
- - {
- - thisNpc.npc.setRandomWalking(false);
- - }
- - hall.npcList.add(thisNpc);
- -
- - thisNpc = new DMCNpc();
- - thisNpc.npc = addSpawn(BM[1], 148521, 180112, -6117, 0, false, 0, false, world.getInstanceId());
- - if (noRndWalk)
- - {
- - thisNpc.npc.setRandomWalking(false);
- - }
- - hall.npcList.add(thisNpc);
- -
- - thisNpc = new DMCNpc();
- - thisNpc.npc = addSpawn(BM[0], 148521, 180209, -6117, 0, false, 0, false, world.getInstanceId());
- - if (noRndWalk)
- - {
- - thisNpc.npc.setRandomWalking(false);
- - }
- - hall.npcList.add(thisNpc);
- -
- - thisNpc = new DMCNpc();
- - thisNpc.npc = addSpawn(BM[1], 148525, 180910, -6117, 0, false, 0, false, world.getInstanceId());
- - if (noRndWalk)
- - {
- - thisNpc.npc.setRandomWalking(false);
- - }
- - hall.npcList.add(thisNpc);
- -
- - thisNpc = new DMCNpc();
- - thisNpc.npc = addSpawn(BM[2], 148435, 180910, -6117, 0, false, 0, false, world.getInstanceId());
- - if (noRndWalk)
- - {
- - thisNpc.npc.setRandomWalking(false);
- - }
- - hall.npcList.add(thisNpc);
- -
- - thisNpc = new DMCNpc();
- - thisNpc.npc = addSpawn(BM[1], 147242, 180910, -6117, 0, false, 0, false, world.getInstanceId());
- - if (noRndWalk)
- - {
- - thisNpc.npc.setRandomWalking(false);
- - }
- - hall.npcList.add(thisNpc);
- -
- - thisNpc = new DMCNpc();
- - thisNpc.npc = addSpawn(BM[2], 147242, 180819, -6117, 0, false, 0, false, world.getInstanceId());
- - if (noRndWalk)
- - {
- - thisNpc.npc.setRandomWalking(false);
- - }
- - hall.npcList.add(thisNpc);
- -
- - world.setParameter("Hall", hall);
- - }
- -
- - protected void runHall(InstanceWorld world)
- - {
- - spawnHall(world);
- - world.setStatus(1);
- - world.openDoor(D1);
- - }
- -
- - protected void runFirstRoom(InstanceWorld world)
- - {
- - final DMCRoom firstRoom = new DMCRoom();
- - DMCNpc thisNpc;
- - thisNpc = new DMCNpc();
- - thisNpc.npc = addSpawn(HG[1], 147842, 179837, -6117, 0, false, 0, false, world.getInstanceId());
- - if (noRndWalk)
- - {
- - thisNpc.npc.setRandomWalking(false);
- - }
- - firstRoom.npcList.add(thisNpc);
- -
- - thisNpc = new DMCNpc();
- - thisNpc.npc = addSpawn(HG[0], 147711, 179708, -6117, 0, false, 0, false, world.getInstanceId());
- - if (noRndWalk)
- - {
- - thisNpc.npc.setRandomWalking(false);
- - }
- - firstRoom.npcList.add(thisNpc);
- -
- - thisNpc = new DMCNpc();
- - thisNpc.npc = addSpawn(HG[1], 147842, 179552, -6117, 0, false, 0, false, world.getInstanceId());
- - if (noRndWalk)
- - {
- - thisNpc.npc.setRandomWalking(false);
- - }
- - firstRoom.npcList.add(thisNpc);
- -
- - thisNpc = new DMCNpc();
- - thisNpc.npc = addSpawn(HG[0], 147964, 179708, -6117, 0, false, 0, false, world.getInstanceId());
- - if (noRndWalk)
- - {
- - thisNpc.npc.setRandomWalking(false);
- - }
- - firstRoom.npcList.add(thisNpc);
- -
- - world.setParameter("FirstRoom", firstRoom);
- - world.setStatus(2);
- - world.openDoor(D2);
- - }
- -
- - protected void runHall2(InstanceWorld world)
- - {
- - addSpawn(SOFaith, 147818, 179643, -6117, 0, false, 0, false, world.getInstanceId());
- - spawnHall(world);
- - world.setStatus(3);
- - }
- -
- - protected void runSecondRoom(InstanceWorld world)
- - {
- - final DMCRoom secondRoom = new DMCRoom();
- - DMCNpc thisNpc;
- -
- - // TODO: find a better way to initialize to [1,0,0,0,0,0,0]
- - secondRoom.Order = new int[7];
- - secondRoom.Order[0] = 1;
- - for (int i = 1; i < 7; i++)
- - {
- - secondRoom.Order[i] = 0;
- - }
- -
- - final int i = getRandom(MonolithOrder.length);
- - thisNpc = new DMCNpc();
- - thisNpc.npc = addSpawn(BSM, 147800, 181150, -6117, 0, false, 0, false, world.getInstanceId());
- - thisNpc.order = MonolithOrder[i][0];
- - secondRoom.npcList.add(thisNpc);
- -
- - thisNpc = new DMCNpc();
- - thisNpc.npc = addSpawn(BSM, 147900, 181215, -6117, 0, false, 0, false, world.getInstanceId());
- - thisNpc.order = MonolithOrder[i][1];
- - secondRoom.npcList.add(thisNpc);
- -
- - thisNpc = new DMCNpc();
- - thisNpc.npc = addSpawn(BSM, 147900, 181345, -6117, 0, false, 0, false, world.getInstanceId());
- - thisNpc.order = MonolithOrder[i][2];
- - secondRoom.npcList.add(thisNpc);
- -
- - thisNpc = new DMCNpc();
- - thisNpc.npc = addSpawn(BSM, 147800, 181410, -6117, 0, false, 0, false, world.getInstanceId());
- - thisNpc.order = MonolithOrder[i][3];
- - secondRoom.npcList.add(thisNpc);
- -
- - thisNpc = new DMCNpc();
- - thisNpc.npc = addSpawn(BSM, 147700, 181345, -6117, 0, false, 0, false, world.getInstanceId());
- - thisNpc.order = MonolithOrder[i][4];
- - secondRoom.npcList.add(thisNpc);
- -
- - thisNpc = new DMCNpc();
- - thisNpc.npc = addSpawn(BSM, 147700, 181215, -6117, 0, false, 0, false, world.getInstanceId());
- - thisNpc.order = MonolithOrder[i][5];
- - secondRoom.npcList.add(thisNpc);
- -
- - world.setParameter("SecondRoom", secondRoom);
- - world.setStatus(4);
- - world.openDoor(D3);
- - }
- -
- - protected void runHall3(InstanceWorld world)
- - {
- - addSpawn(SOAdversity, 147808, 181281, -6117, 16383, false, 0, false, world.getInstanceId());
- - spawnHall(world);
- - world.setStatus(5);
- - }
- -
- - protected void runThirdRoom(InstanceWorld world)
- - {
- - final DMCRoom thirdRoom = new DMCRoom();
- - final DMCNpc thisNpc = new DMCNpc();
- - thisNpc.isDead = false;
- - thisNpc.npc = addSpawn(BM[1], 148765, 180450, -6117, 0, false, 0, false, world.getInstanceId());
- - if (noRndWalk)
- - {
- - thisNpc.npc.setRandomWalking(false);
- - }
- - thirdRoom.npcList.add(thisNpc);
- - thisNpc.npc = addSpawn(BM[2], 148865, 180190, -6117, 0, false, 0, false, world.getInstanceId());
- - if (noRndWalk)
- - {
- - thisNpc.npc.setRandomWalking(false);
- - }
- - thirdRoom.npcList.add(thisNpc);
- - thisNpc.npc = addSpawn(BM[1], 148995, 180190, -6117, 0, false, 0, false, world.getInstanceId());
- - if (noRndWalk)
- - {
- - thisNpc.npc.setRandomWalking(false);
- - }
- - thirdRoom.npcList.add(thisNpc);
- - thisNpc.npc = addSpawn(BM[0], 149090, 180450, -6117, 0, false, 0, false, world.getInstanceId());
- - if (noRndWalk)
- - {
- - thisNpc.npc.setRandomWalking(false);
- - }
- - thirdRoom.npcList.add(thisNpc);
- - thisNpc.npc = addSpawn(BM[1], 148995, 180705, -6117, 0, false, 0, false, world.getInstanceId());
- - if (noRndWalk)
- - {
- - thisNpc.npc.setRandomWalking(false);
- - }
- - thirdRoom.npcList.add(thisNpc);
- - thisNpc.npc = addSpawn(BM[2], 148865, 180705, -6117, 0, false, 0, false, world.getInstanceId());
- - if (noRndWalk)
- - {
- - thisNpc.npc.setRandomWalking(false);
- - }
- - thirdRoom.npcList.add(thisNpc);
- - world.setParameter("ThirdRoom", thirdRoom);
- - world.setStatus(6);
- - world.openDoor(D4);
- - }
- -
- - protected void runThirdRoom2(InstanceWorld world)
- - {
- - addSpawn(SOAdventure, 148910, 178397, -6117, 16383, false, 0, false, world.getInstanceId());
- - final DMCRoom thirdRoom = new DMCRoom();
- - final DMCNpc thisNpc = new DMCNpc();
- - thisNpc.isDead = false;
- - thisNpc.npc = addSpawn(BM[1], 148765, 180450, -6117, 0, false, 0, false, world.getInstanceId());
- - if (noRndWalk)
- - {
- - thisNpc.npc.setRandomWalking(false);
- - }
- - thirdRoom.npcList.add(thisNpc);
- - thisNpc.npc = addSpawn(BM[2], 148865, 180190, -6117, 0, false, 0, false, world.getInstanceId());
- - if (noRndWalk)
- - {
- - thisNpc.npc.setRandomWalking(false);
- - }
- - thirdRoom.npcList.add(thisNpc);
- - thisNpc.npc = addSpawn(BM[1], 148995, 180190, -6117, 0, false, 0, false, world.getInstanceId());
- - if (noRndWalk)
- - {
- - thisNpc.npc.setRandomWalking(false);
- - }
- - thirdRoom.npcList.add(thisNpc);
- - thisNpc.npc = addSpawn(BM[0], 149090, 180450, -6117, 0, false, 0, false, world.getInstanceId());
- - if (noRndWalk)
- - {
- - thisNpc.npc.setRandomWalking(false);
- - }
- - thirdRoom.npcList.add(thisNpc);
- - thisNpc.npc = addSpawn(BM[1], 148995, 180705, -6117, 0, false, 0, false, world.getInstanceId());
- - if (noRndWalk)
- - {
- - thisNpc.npc.setRandomWalking(false);
- - }
- - thirdRoom.npcList.add(thisNpc);
- - thisNpc.npc = addSpawn(BM[2], 148865, 180705, -6117, 0, false, 0, false, world.getInstanceId());
- - if (noRndWalk)
- - {
- - thisNpc.npc.setRandomWalking(false);
- - }
- - thirdRoom.npcList.add(thisNpc);
- - world.setParameter("ThirdRoom2", thirdRoom);
- - world.setStatus(8);
- - }
- -
- - protected void runForthRoom(InstanceWorld world)
- - {
- - final DMCRoom forthRoom = new DMCRoom();
- - forthRoom.counter = 0;
- - DMCNpc thisNpc;
- - final int[] temp = new int[7];
- - final int[][] templist = new int[7][5];
- - int xx = 0;
- - for (int i = 0; i < 7; i++)
- - {
- - temp[i] = getRandom(ColumnRows.length);
- - }
- -
- - for (int i = 0; i < 7; i++)
- - {
- - templist[i] = ColumnRows[temp[i]];
- - }
- -
- - for (int x = 148660; x < 149285; x += 125)
- - {
- - int yy = 0;
- - for (int y = 179280; y > 178405; y -= 125)
- + switch (event)
- {
- - thisNpc = new DMCNpc();
- - thisNpc.npc = addSpawn(SC, x, y, -6115, 16215, false, 0, false, world.getInstanceId());
- - thisNpc.status = templist[yy][xx];
- - thisNpc.order = yy;
- - forthRoom.npcList.add(thisNpc);
- - yy++;
- + case "DELETE_ONE":
- + {
- + npc.deleteMe();
- + break;
- + }
- + case "DELETE":
- + {
- + world.getNpcs(BELETH_SAMPLE).stream().filter(n -> n != npc).forEach(Npc::deleteMe);
- + world.setParameter("blocked", false);
- + spawnRoomE(world);
- + break;
- + }
- + case "CHAT":
- + {
- + world.getNpcs(BELETH_SAMPLE).stream().filter(n -> n.isScriptValue(1)).forEach(n -> n.broadcastSay(ChatType.NPC_GENERAL, getRandomEntry(DECAY_CHAT)));
- + break;
- + }
- }
- - xx++;
- }
- - // TODO: unify this into previous loop
- - for (DMCNpc npc : forthRoom.npcList)
- - {
- - if (npc.status == 0)
- - {
- - npc.npc.setInvul(true);
- - }
- - }
- -
- - world.setParameter("ForthRoom", forthRoom);
- - world.setStatus(7);
- - world.openDoor(D5);
- + return null;
- }
- - protected void runFifthRoom(InstanceWorld world)
- + @Override
- + public String onTalk(Npc npc, PlayerInstance player)
- {
- - spawnFifthRoom(world);
- - world.setStatus(9);
- - world.openDoor(D6);
- - }
- -
- - private void spawnFifthRoom(InstanceWorld world)
- - {
- - final DMCRoom fifthRoom = new DMCRoom();
- - DMCNpc thisNpc;
- - int idx = 0;
- - final int[] temp = Beleths[getRandom(Beleths.length)];
- - fifthRoom.reset = 0;
- - fifthRoom.founded = 0;
- - for (int x = 148720; x < 149175; x += 65)
- + if (npc.getId() == YIYEN)
- {
- - thisNpc = new DMCNpc();
- - thisNpc.npc = addSpawn(BS[idx], x, 182145, -6117, 48810, false, 0, false, world.getInstanceId());
- - thisNpc.npc.setRandomWalking(false);
- - thisNpc.order = idx;
- - thisNpc.status = temp[idx];
- - thisNpc.count = 0;
- - fifthRoom.npcList.add(thisNpc);
- - if ((temp[idx] == 1) && (getRandom(100) < 95))
- - {
- - thisNpc.npc.broadcastPacket(new NpcSay(thisNpc.npc.getObjectId(), ChatType.GENERAL, thisNpc.npc.getId(), _spawnChat[getRandom(_spawnChat.length)]));
- - }
- - else if ((temp[idx] != 1) && (getRandom(100) < 67))
- - {
- - thisNpc.npc.broadcastPacket(new NpcSay(thisNpc.npc.getObjectId(), ChatType.GENERAL, thisNpc.npc.getId(), _spawnChat[getRandom(_spawnChat.length)]));
- - }
- - idx++;
- + enterInstance(player, TEMPLATE_ID);
- }
- -
- - world.setParameter("FifthRoom", fifthRoom);
- - }
- -
- - protected boolean checkKillProgress(Npc npc, DMCRoom room)
- - {
- - boolean cont = true;
- - for (DMCNpc npcobj : room.npcList)
- + else
- {
- - if (npcobj.npc == npc)
- + final InstanceWorld world = InstanceManager.getInstance().getWorld(npc);
- + if (world != null)
- {
- - npcobj.isDead = true;
- + teleportPlayer(player, EXIT_LOC, 0);
- }
- - if (!npcobj.isDead)
- - {
- - cont = false;
- - }
- }
- - return cont;
- + return null;
- }
- - protected void spawnRndGolem(InstanceWorld world, DMCNpc npc)
- + @Override
- + public String onFirstTalk(Npc npc, PlayerInstance player)
- {
- - if (npc.golem != null)
- + final InstanceWorld world = InstanceManager.getInstance().getWorld(npc);
- + if (world != null)
- {
- - return;
- - }
- -
- - final int i = getRandom(GolemSpawn.length);
- - final int mobId = GolemSpawn[i][0];
- - final int x = GolemSpawn[i][1];
- - final int y = GolemSpawn[i][2];
- - npc.golem = addSpawn(mobId, x, y, -6117, 0, false, 0, false, world.getInstanceId());
- - if (noRndWalk)
- - {
- - npc.golem.setRandomWalking(false);
- - }
- - }
- -
- - protected void checkStone(Npc npc, int[] order, DMCNpc npcObj, InstanceWorld world)
- - {
- - for (int i = 1; i < 7; i++)
- - {
- - // if there is a non zero value in the precedent step, the sequence is ok
- - if ((order[i] == 0) && (order[i - 1] != 0) && (npcObj.order == i) && (npcObj.status == 0))
- + switch (npc.getId())
- {
- - order[i] = 1;
- - npcObj.status = 1;
- - npcObj.isDead = true;
- - npc.broadcastPacket(new MagicSkillUse(npc, npc, 5441, 1, 1, 0));
- - return;
- - }
- - }
- -
- - spawnRndGolem(world, npcObj);
- - }
- -
- - protected void endInstance(InstanceWorld world)
- - {
- - world.setStatus(10);
- - addSpawn(SOTruth, 148911, 181940, -6117, 16383, false, 0, false, world.getInstanceId());
- - world.getParameters().remove("StartRoom");
- - world.getParameters().remove("Hall");
- - world.getParameters().remove("FirstRoom");
- - world.getParameters().remove("SecondRoom");
- - world.getParameters().remove("ThirdRoom");
- - world.getParameters().remove("ForthRoom");
- - world.getParameters().remove("FifthRoom");
- - }
- -
- - protected void checkBelethSample(InstanceWorld world, Npc npc, PlayerInstance player)
- - {
- - final DMCRoom fifthRoom = world.getParameters().getObject("FifthRoom", DMCRoom.class);
- - for (DMCNpc mob : fifthRoom.npcList)
- - {
- - if (mob.npc == npc)
- - {
- - if (mob.count == 0)
- + case FAITH:
- {
- - mob.count = 1;
- - if (mob.status == 1)
- + world.openDoor(ROOM_A_DOOR);
- + npc.showChatWindow(player);
- + break;
- + }
- + case MONOLITH:
- + {
- + if (world.isStatus(4) && !npc.isScriptValue(-1))
- {
- - mob.npc.broadcastPacket(new NpcSay(mob.npc.getObjectId(), ChatType.NPC_GENERAL, mob.npc.getId(), _successChat[getRandom(_successChat.length)]));
- - fifthRoom.founded += 1;
- - startQuestTimer("decayMe", 1500, npc, player);
- + int current = world.getParameters().getInt("current", 0);
- + if (npc.isScriptValue(current))
- + {
- + npc.setScriptValue(-1);
- + npc.doCast(INCARNATION.getSkill());
- + world.setParameter("current", ++current);
- + if (current == 6)
- + {
- + world.setStatus(5);
- + world.spawnGroup("roomBClear");
- + world.spawnGroup("hall");
- + world.getNpcs(MONOLITH).forEach(Npc::deleteMe);
- + }
- + }
- + else
- + {
- + addSpawn(getRandomEntry(MONOLITH_PRIVATES), npc, false, 0, false, world.getInstanceId());
- + }
- + world.closeDoor(ROOM_B_DOOR);
- }
- - else
- - {
- - fifthRoom.reset = 1;
- - mob.npc.broadcastPacket(new NpcSay(mob.npc.getObjectId(), ChatType.NPC_GENERAL, mob.npc.getId(), _faildChat[getRandom(_faildChat.length)]));
- - startQuestTimer("decayChatBelethSamples", 4000, npc, player);
- - startQuestTimer("decayBelethSamples", 4500, npc, player);
- - }
- + break;
- }
- - else
- + case ADVERSITY:
- {
- - return;
- + world.openDoor(ROOM_B_DOOR);
- + npc.showChatWindow(player);
- + break;
- }
- - }
- - }
- - }
- -
- - protected void killedBelethSample(InstanceWorld world, Npc npc)
- - {
- - int decayedSamples = 0;
- - final DMCRoom fifthRoom = world.getParameters().getObject("FifthRoom", DMCRoom.class);
- - for (DMCNpc mob : fifthRoom.npcList)
- - {
- - if (mob.npc == npc)
- - {
- - decayedSamples += 1;
- - mob.count = 2;
- - }
- - else
- - {
- - if (mob.count == 2)
- + case ADVENTURE:
- {
- - decayedSamples += 1;
- + if (world.isStatus(7))
- + {
- + world.spawnGroup("roomC").forEach(n -> n.setScriptValue(8));
- + world.setStatus(8);
- + world.openDoor(ROOM_D_DOOR);
- + }
- + npc.showChatWindow(player);
- + break;
- }
- - }
- - }
- -
- - if (fifthRoom.reset == 1)
- - {
- - for (DMCNpc mob : fifthRoom.npcList)
- - {
- - if ((mob.count == 0) || ((mob.status == 1) && (mob.count != 2)))
- + case TRUTH:
- {
- - decayedSamples += 1;
- - mob.npc.decayMe();
- - mob.count = 2;
- - }
- - }
- - if (decayedSamples == 7)
- - {
- - startQuestTimer("respawnFifth", 6000, npc, null);
- - }
- - }
- - else
- - {
- - if ((fifthRoom.reset == 0) && (fifthRoom.founded == 3))
- - {
- - for (DMCNpc mob : fifthRoom.npcList)
- - {
- - mob.npc.decayMe();
- - }
- - endInstance(world);
- - }
- - }
- - }
- -
- - protected boolean allStonesDone(InstanceWorld world)
- - {
- - final DMCRoom secondRoom = world.getParameters().getObject("SecondRoom", DMCRoom.class);
- - for (DMCNpc mob : secondRoom.npcList)
- - {
- - if (mob.isDead)
- - {
- - continue;
- - }
- - return false;
- - }
- - return true;
- - }
- -
- - protected void removeMonoliths(InstanceWorld world)
- - {
- - final DMCRoom secondRoom = world.getParameters().getObject("SecondRoom", DMCRoom.class);
- - for (DMCNpc mob : secondRoom.npcList)
- - {
- - mob.npc.decayMe();
- - }
- - }
- -
- - protected void chkShadowColumn(InstanceWorld world, Npc npc)
- - {
- - final DMCRoom forthRoom = world.getParameters().getObject("ForthRoom", DMCRoom.class);
- - for (DMCNpc mob : forthRoom.npcList)
- - {
- - if (mob.npc == npc)
- - {
- - for (int i = 0; i < 7; i++)
- - {
- - if ((mob.order == i) && (forthRoom.counter == i))
- + if (!hasQuestItems(player, CC))
- {
- - world.openDoor(W1 + i);
- - forthRoom.counter += 1;
- - if (forthRoom.counter == 7)
- - {
- - runThirdRoom2(world);
- - }
- + giveItems(player, CC, 1);
- }
- + npc.showChatWindow(player);
- + break;
- }
- }
- }
- + return null;
- }
- @Override
- - public String onAdvEvent(String event, Npc npc, PlayerInstance player)
- + public String onAttack(Npc npc, PlayerInstance attacker, int damage, boolean isSummon)
- {
- - if (npc == null)
- - {
- - return "";
- - }
- -
- final InstanceWorld world = InstanceManager.getInstance().getWorld(npc);
- - if (world == null)
- + if (world != null)
- {
- - return "";
- - }
- -
- - final DMCRoom fifthRoom = world.getParameters().getObject("FifthRoom", DMCRoom.class);
- - if (fifthRoom != null)
- - {
- - if (event.equalsIgnoreCase("decayMe"))
- + switch (npc.getId())
- {
- - for (DMCNpc mob : fifthRoom.npcList)
- + case PARME_HEALER:
- {
- - if ((mob.npc == npc) || ((fifthRoom.reset == 0) && (fifthRoom.founded == 3)))
- + if (world.isStatus(2) && (attacker.getY() < 179986))
- {
- - mob.npc.decayMe();
- - mob.count = 2;
- + world.closeDoor(ROOM_A_DOOR);
- }
- + break;
- }
- - if ((fifthRoom.reset == 0) && (fifthRoom.founded == 3))
- + case COLUMN:
- {
- - endInstance(world);
- - }
- - }
- - else if (event.equalsIgnoreCase("decayBelethSamples"))
- - {
- - for (DMCNpc mob : fifthRoom.npcList)
- - {
- - if (mob.count == 0)
- + if (world.isStatus(7))
- {
- - mob.npc.decayMe();
- - mob.count = 2;
- + world.closeDoor(ROOM_D_DOOR);
- + // if (npc.isHpBlocked() && (getRandom(100) < 12))
- + if (npc.isInvul() && (getRandom(100) < 12))
- + {
- + addSpawn(getRandomEntry(BELETH_SUBORDINATE), npc, false, 0, false, world.getInstanceId());
- + }
- }
- + break;
- }
- - }
- - else if (event.equalsIgnoreCase("decayChatBelethSamples"))
- - {
- - for (DMCNpc mob : fifthRoom.npcList)
- + default:
- {
- - if (mob.status == 1)
- + if (world.isStatus(9))
- {
- - mob.npc.broadcastPacket(new NpcSay(mob.npc.getObjectId(), ChatType.NPC_GENERAL, mob.npc.getId(), _decayChat[getRandom(_decayChat.length)]));
- + handleRoomE(world, npc);
- }
- }
- }
- - else if (event.equalsIgnoreCase("respawnFifth"))
- - {
- - spawnFifthRoom(world);
- - }
- }
- -
- - return "";
- + return super.onAttack(npc, attacker, damage, isSummon);
- }
- @Override
- @@ -935,178 +371,158 @@
- final InstanceWorld world = InstanceManager.getInstance().getWorld(npc);
- if (world != null)
- {
- - if (world.getStatus() == 0)
- + switch (world.getStatus())
- {
- - if (checkKillProgress(npc, world.getParameters().getObject("StartRoom", DMCRoom.class)))
- + case 0: // Start room
- {
- - runHall(world);
- + if (world.getAliveNpcs().isEmpty())
- + {
- + world.setStatus(1);
- + world.spawnGroup("hall");
- + world.openDoor(START_DOOR);
- + }
- + break;
- }
- - }
- - if (world.getStatus() == 1)
- - {
- - if (checkKillProgress(npc, world.getParameters().getObject("Hall", DMCRoom.class)))
- + case 1: // Hall
- {
- - runFirstRoom(world);
- + if (world.getAliveNpcs().isEmpty())
- + {
- + world.setStatus(2);
- + world.spawnGroup("roomA");
- + world.openDoor(ROOM_A_DOOR);
- + }
- + break;
- }
- - }
- - if (world.getStatus() == 2)
- - {
- - if (checkKillProgress(npc, world.getParameters().getObject("FirstRoom", DMCRoom.class)))
- + case 2: // Room A - cleared
- {
- - runHall2(world);
- + if (world.getAliveNpcs().isEmpty())
- + {
- + world.setStatus(3);
- + world.spawnGroup("roomAClear");
- + world.spawnGroup("hall");
- + }
- + break;
- }
- - }
- - if (world.getStatus() == 3)
- - {
- - if (checkKillProgress(npc, world.getParameters().getObject("Hall", DMCRoom.class)))
- + case 3: // Hall
- {
- - runSecondRoom(world);
- + if (world.getAliveNpcs(BELETH_SUBORDINATE).isEmpty())
- + {
- + world.setStatus(4);
- + world.openDoor(ROOM_B_DOOR);
- + int current = 0;
- + final List<Npc> desks = world.spawnGroup("roomB");
- + while (!desks.isEmpty())
- + {
- + final Npc desk = desks.remove(getRandom(desks.size()));
- + desk.setScriptValue(current++);
- + }
- + }
- + break;
- }
- - }
- - if (world.getStatus() == 4)
- - {
- - final DMCRoom SecondRoom = world.getParameters().getObject("SecondRoom", DMCRoom.class);
- - for (DMCNpc mob : SecondRoom.npcList)
- + case 5: // Hall
- {
- - if (mob.golem == npc)
- + if (world.getAliveNpcs(BELETH_SUBORDINATE).isEmpty())
- {
- - mob.golem = null;
- + world.setStatus(6);
- + world.spawnGroup("roomC");
- + world.openDoor(ROOM_C_DOOR);
- }
- + break;
- }
- - }
- - if (world.getStatus() == 5)
- - {
- - if (checkKillProgress(npc, world.getParameters().getObject("Hall", DMCRoom.class)))
- + case 6: // Room C
- {
- - runThirdRoom(world);
- + if (world.getAliveNpcs(BELETH_SUBORDINATE).isEmpty())
- + {
- + world.setStatus(7);
- + world.spawnGroup("roomD");
- + world.openDoor(ROOM_D_DOOR);
- + for (int i = 1; i <= 7; i++)
- + {
- + final List<Npc> row = world.spawnGroup("roomD" + i);
- + for (int x = 0; x < 2; x++)
- + {
- + final Npc col = row.remove(getRandom(row.size()));
- + col.setInvul(true);
- + }
- + }
- + }
- + break;
- }
- - }
- - if (world.getStatus() == 6)
- - {
- - if (checkKillProgress(npc, world.getParameters().getObject("ThirdRoom", DMCRoom.class)))
- + case 8: // Room C
- {
- - runForthRoom(world);
- + final long roomClear = world.getAliveNpcs(BELETH_SUBORDINATE).stream().filter(n -> n.isScriptValue(8)).count();
- + if (roomClear == 0)
- + {
- + world.setStatus(9);
- + world.openDoor(ROOM_E_DOOR);
- + spawnRoomE(world);
- + }
- + break;
- }
- - }
- - if (world.getStatus() == 7)
- - {
- - chkShadowColumn(world, npc);
- - }
- - if (world.getStatus() == 8)
- - {
- - if (checkKillProgress(npc, world.getParameters().getObject("ThirdRoom2", DMCRoom.class)))
- + case 9:
- {
- - runFifthRoom(world);
- + handleRoomE(world, npc);
- + break;
- }
- }
- - if (world.getStatus() == 9)
- - {
- - killedBelethSample(world, npc);
- - }
- }
- - return "";
- + return null;
- }
- - @Override
- - public String onAttack(Npc npc, PlayerInstance attacker, int damage, boolean isSummon, Skill skill)
- + private void spawnRoomE(InstanceWorld world)
- {
- - final InstanceWorld world = InstanceManager.getInstance().getWorld(npc);
- - if (world != null)
- + final List<Npc> npcs = world.spawnGroup("roomE");
- + for (Npc n : npcs)
- {
- - if (world.getStatus() == 7)
- - {
- - final DMCRoom forthRoom = world.getParameters().getObject("ForthRoom", DMCRoom.class);
- - for (DMCNpc mob : forthRoom.npcList)
- - {
- - if ((mob.npc == npc) && mob.npc.isInvul() && (getRandom(100) < 12))
- - {
- - addSpawn(BM[getRandom(BM.length)], attacker.getX(), attacker.getY(), attacker.getZ(), 0, false, 0, false, world.getInstanceId());
- - }
- - }
- - }
- - if (world.getStatus() == 9)
- - {
- - checkBelethSample(world, npc, attacker);
- - }
- + n.broadcastSay(ChatType.NPC_GENERAL, getRandomEntry(SPAWN_CHAT));
- }
- - return super.onAttack(npc, attacker, damage, isSummon);
- + for (int i = 0; i < 3; i++)
- + {
- + final Npc n = npcs.remove(getRandom(npcs.size()));
- + n.setScriptValue(1);
- + }
- }
- - @Override
- - public String onFirstTalk(Npc npc, PlayerInstance player)
- + private void handleRoomE(InstanceWorld world, Npc npc)
- {
- - final InstanceWorld world = InstanceManager.getInstance().getWorld(npc);
- - if (world != null)
- + if (CommonUtil.contains(BELETH_SAMPLE, npc.getId()))
- {
- - if (world.getStatus() == 4)
- + final StatSet params = world.getParameters();
- + if (!params.getBoolean("blocked", false))
- {
- - final DMCRoom secondRoom = world.getParameters().getObject("SecondRoom", DMCRoom.class);
- - for (DMCNpc mob : secondRoom.npcList)
- + if (npc.isScriptValue(1))
- {
- - if (mob.npc == npc)
- + final int found = params.getInt("found", 0) + 1;
- + world.setParameter("found", found);
- + npc.setScriptValue(-1);
- + npc.broadcastSay(ChatType.NPC_GENERAL, getRandomEntry(SUCCESS_CHAT));
- + if (found != 3)
- {
- - checkStone(npc, secondRoom.Order, mob, world);
- + startQuestTimer("DELETE_ONE", 1500, npc, null);
- }
- + else
- + {
- + world.setStatus(10);
- + world.getNpcs().forEach(Npc::deleteMe);
- + world.spawnGroup("roomEClear");
- + }
- }
- -
- - if (allStonesDone(world))
- + else if (!npc.isScriptValue(-1))
- {
- - removeMonoliths(world);
- - runHall3(world);
- + world.setParameter("blocked", true);
- + world.setParameter("found", 0);
- + npc.broadcastSay(ChatType.NPC_GENERAL, getRandomEntry(FAIL_CHAT));
- + npc.setScriptValue(-1);
- + startQuestTimer("CHAT", 4000, npc, null);
- + startQuestTimer("DELETE", 4500, npc, null);
- }
- + world.closeDoor(ROOM_E_DOOR);
- }
- -
- - if ((npc.getId() == SOTruth) && (world.getStatus() == 10))
- - {
- - npc.showChatWindow(player);
- -
- - if (!hasQuestItems(player, CC))
- - {
- - giveItems(player, CC, 1);
- - }
- - }
- }
- -
- - return "";
- }
- - @Override
- - public String onTalk(Npc npc, PlayerInstance player)
- - {
- - final int npcId = npc.getId();
- - if (npcId == YIYEN)
- - {
- - enterInstance(player, TEMPLATE_ID);
- - }
- - else
- - {
- - final InstanceWorld world = InstanceManager.getInstance().getWorld(npc);
- - if (world == null)
- - {
- - return "";
- - }
- -
- - if (npcId == SOTruth)
- - {
- - if (world.isAllowed(player))
- - {
- - world.removeAllowed(player);
- - }
- - teleportPlayer(player, new Location(139968, 150367, -3111), 0);
- - final int instanceId = npc.getInstanceId();
- - final Instance instance = InstanceManager.getInstance().getInstance(instanceId);
- - if (instance.getPlayers().isEmpty())
- - {
- - InstanceManager.getInstance().destroyInstance(instanceId);
- - }
- - return "";
- - }
- - }
- - return "";
- - }
- -
- public static void main(String[] args)
- {
- new DarkCloudMansion();
- }
- -}
- +}
- \ No newline at end of file
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement