Beispiel #1
0
  @Override
  public void handlePacket(Client client, int packetType, int packetSize) {

    int magicOn = client.inStream.readSignedWordA();
    int spellId = client.inStream.readSignedWordBigEndian();

    Client enemy = (Client) PlayerManager.getPlayerManager().getPlayers()[magicOn];

    ActionManager.destructActions(client.getUsername());

    // System.out.println(spellId);

    if (enemy == null) return;

    for (int[] s : TeleOther.SPELLS) {
      if (s[0] == spellId) {
        TeleOther.castSpell(client, enemy, spellId);
        client.stopMovement();
        return;
      }
    }

    client.setRetaliateDelay(0);
    client.spellId = spellId;
    client.turnOffSpell = false;
    CombatEngine.addEvent(client, enemy);
    client.stopMovement();
  }
Beispiel #2
0
 @Override
 public void handlePacket(Client client, int packetType, int packetSize) {
   ActionManager.destructActions(client.getUsername());
   if (packetType == REQUEST) {
     int trade = client.inStream.readSignedWordBigEndian();
     if (trade < 0 || trade >= Constants.MAX_PLAYERS) return;
     if (PlayerManager.getPlayerManager().getPlayers()[trade] != null) {
       Client c = (Client) PlayerManager.getPlayerManager().getPlayers()[trade];
       client.getTradeHandler().requestTrade(c);
     }
     client.println_debug("Trade Request to: " + trade);
   } else if (packetType == ANSWER) {
     int trade = client.inStream.readSignedWordBigEndian();
     if (trade < 0 || trade >= Constants.MAX_PLAYERS) return;
     if (PlayerManager.getPlayerManager().getPlayers()[trade] != null) {
       Client c = (Client) PlayerManager.getPlayerManager().getPlayers()[trade];
       client.getTradeHandler().answerTrade(c);
     }
     client.println_debug("Trade Answer to: " + trade);
   }
 }