Ejemplo n.º 1
0
 public final int getCoupleIndex(int coupleId) {
   int i = 0;
   for (Couple temp : getCouples()) {
     if ((temp != null) && (temp.getId() == coupleId)) {
       return i;
     }
     i++;
   }
   return -1;
 }
Ejemplo n.º 2
0
  public void createCouple(L2PcInstance player1, L2PcInstance player2) {
    if ((player1 != null) && (player2 != null)) {
      if ((player1.getPartnerId() == 0) && (player2.getPartnerId() == 0)) {
        int player1id = player1.getObjectId();
        int player2id = player2.getObjectId();

        Couple couple = new Couple(player1, player2);
        getCouples().add(couple);
        player1.setPartnerId(player2id);
        player2.setPartnerId(player1id);
        player1.setCoupleId(couple.getId());
        player2.setCoupleId(couple.getId());
      }
    }
  }
Ejemplo n.º 3
0
 public void deleteCouple(int coupleId) {
   int index = getCoupleIndex(coupleId);
   Couple couple = getCouples().get(index);
   if (couple != null) {
     L2PcInstance player1 = L2World.getInstance().getPlayer(couple.getPlayer1Id());
     L2PcInstance player2 = L2World.getInstance().getPlayer(couple.getPlayer2Id());
     if (player1 != null) {
       player1.setPartnerId(0);
       player1.setMarried(false);
       player1.setCoupleId(0);
     }
     if (player2 != null) {
       player2.setPartnerId(0);
       player2.setMarried(false);
       player2.setCoupleId(0);
     }
     couple.divorce();
     getCouples().remove(index);
   }
 }