コード例 #1
0
ファイル: Fortuna.java プロジェクト: svn2github/L2J
  protected EnterInstanceResult enterInstance(L2PcInstance player, String template) {
    InstanceManager.InstanceWorld world = InstanceManager.getInstance().getPlayerWorld(player);

    if (world != null) {
      if (!(world instanceof FortunaWorld)) {
        player.sendPacket(SystemMessageId.ALREADY_ENTERED_ANOTHER_INSTANCE_CANT_ENTER);
        return EnterInstanceResult.ANOTHER_INSTANCE;
      }
    }

    world = new FortunaWorld();

    int instanceTemplateId = InstanceZoneId.FORTUNA.getId();
    EnterInstanceResult reason = checkConditions(player, instanceTemplateId);
    if (reason != EnterInstanceResult.OK) {
      return reason;
    }
    int instanceId = InstanceManager.getInstance().createDynamicInstance(template);

    world.instanceId = instanceId;
    world.templateId = instanceTemplateId;
    world.status = 0;

    InstanceManager.getInstance().addWorld(world);
    init((FortunaWorld) world);

    if ((player.isGM()) && (player.getParty() == null)) {
      player.teleToInstance(ENTRANCE, instanceId);
      world.allowed.add(Integer.valueOf(player.getObjectId()));
      ((FortunaWorld) world).playersInside.add(player);
      return EnterInstanceResult.OK;
    }

    if (player.getParty() != null) {
      for (L2PcInstance member : player.getParty().getMembers()) {
        member.teleToInstance(ENTRANCE, instanceId);
        world.allowed.add(Integer.valueOf(member.getObjectId()));
        ((FortunaWorld) world).playersInside.add(member);
      }
      return EnterInstanceResult.OK;
    }
    return EnterInstanceResult.NO_PARTY;
  }
コード例 #2
0
ファイル: Fortuna.java プロジェクト: svn2github/L2J
  public EnterInstanceResult reEnterInstance(L2PcInstance player) {
    InstanceManager.InstanceWorld world = InstanceManager.getInstance().getPlayerWorld(player);

    if (world != null) {
      if (!(world instanceof FortunaWorld)) {
        player.sendPacket(SystemMessageId.ALREADY_ENTERED_ANOTHER_INSTANCE_CANT_ENTER);
        return EnterInstanceResult.ANOTHER_INSTANCE;
      }

      if (!((FortunaWorld) world).playersInside.contains(player)) {
        ((FortunaWorld) world).playersInside.add(player);
        world.allowed.add(Integer.valueOf(player.getObjectId()));
      }

      player.teleToInstance(LAIR_ENTRANCE, world.instanceId);
      return EnterInstanceResult.OK;
    }
    return EnterInstanceResult.CANNOT_REENTER;
  }