Package org.moparscape.msc.gs.model.snapshot

Examples of org.moparscape.msc.gs.model.snapshot.Activity


                    - opp.getLastMineTimer() < 2000
                    && opp.isBusy())
                  cont = true;
              }
              if (affectedMob instanceof Player) {
                world.addEntryToSnapshots(new Activity(owner
                    .getUsername(), owner.getUsername()
                    + " attacked a Player ("
                    + ((Player) affectedMob).getUsername()
                    + ")"));
              } else {
                world.addEntryToSnapshots(new Activity(owner
                    .getUsername(), owner.getUsername()
                    + " attacked a NPC ("
                    + ((Npc) affectedMob).getDef().name
                    + ")"));
              }
              if (cont) {
                if (owner.isBusy()
                    || !owner.nextTo(affectedMob)
                    || !owner.checkAttack(affectedMob,
                        false)
                    || owner.getStatus() != Action.ATTACKING_MOB) {
                  return;
                }
              } else {
                if (owner.isBusy()
                    || affectedMob.isBusy()
                    || !owner.nextTo(affectedMob)
                    || !owner.checkAttack(affectedMob,
                        false)
                    || owner.getStatus() != Action.ATTACKING_MOB) {
                  return;
                }
              }
              if (affectedMob.getID() == 35) {
                owner.getActionSender()
                    .sendMessage(
                        "Delrith can not be attacked without the Silverlight sword");
                return;
              }
              if (affectedMob.getID() == 140
                  && affectedMob.getX() > 327
                  && affectedMob.getX() < 335
                  && affectedMob.getY() > 433
                  && affectedMob.getY() < 439) {
                owner.informOfNpcMessage(new ChatMessage(
                    affectedMob, "a curse be upon you",
                    owner));
                for (int i = 0; i < 3; i++) {
                  int stat = owner.getCurStat(i);
                  if (stat < 3)
                    owner.setCurStat(i, 0);
                  else
                    owner.setCurStat(i, stat - 3);
                }
                owner.getActionSender().sendStats();

              }

              owner.resetAll();
              owner.setStatus(Action.FIGHTING_MOB);
              if (affectedMob instanceof Player) {
                Player affectedPlayer = (Player) affectedMob;
                affectedPlayer.resetAll();
                affectedPlayer.setStatus(Action.FIGHTING_MOB);
                affectedPlayer.getActionSender().sendSound(
                    "underattack");
                affectedPlayer.getActionSender().sendMessage(
                    "You are under attack!");
                owner.setSkulledOn(affectedPlayer);
              }
              affectedMob.resetPath();

              owner.setLocation(affectedMob.getLocation(), true);
              for (Player p : owner.getViewArea()
                  .getPlayersInView()) {
                p.removeWatchedPlayer(owner);
              }

              owner.setBusy(true);
              owner.setSprite(9);
              /*
               * if(affectedMob instanceof Npc) { Npc n =
               * (Npc)affectedMob; for(Fighter p : n.fighters) {
               * p.useCombat = true; if(p.player == owner)
               * if(p.useMagic) { p.useMagic = false; break; } } }
               */
              owner.setOpponent(affectedMob);
              owner.setCombatTimer();
              affectedMob.setBusy(true);
              affectedMob.setSprite(8);
              affectedMob.setOpponent(owner);
              affectedMob.setCombatTimer();
              FightEvent fighting = new FightEvent(owner,
                  affectedMob);
              fighting.setLastRun(0);
              Instance.getDelayedEventHandler().add(fighting);
            }
          });
    } else {
      if (!new ProjectilePath(player.getX(), player.getY(),
          affectedMob.getX(), affectedMob.getY()).isValid()) {
        player.getActionSender().sendMessage(
            "I can't get a clear shot from here");
        player.resetPath();
        return;
      }
      if (Config.f2pWildy && player.getLocation().inWilderness()) {

        for (InvItem i : player.getInventory().getItems()) {
          if (i.id == 638 || i.id == 640 || i.id == 642
              || i.id == 644 || i.id == 646) {
            player.getActionSender()
                .sendMessage(
                    "You can not have any P2P arrows in your inventory in a F2P wilderness");
            return;
          }
        }

      }
      int radius = 7;
      if (player.getRangeEquip() == 59 || player.getRangeEquip() == 60)
        radius = 5;
      if (player.getRangeEquip() == 189)
        radius = 4;
      Instance.getDelayedEventHandler().add(
          new WalkToMobEvent(player, affectedMob, radius) {
            public void arrived() {
              owner.resetPath();
              if (owner.isBusy()
                  || !owner.checkAttack(affectedMob, true)
                  || owner.getStatus() != Action.ATTACKING_MOB) {
                return;
              }

              if (!new ProjectilePath(owner.getX(), owner.getY(),
                  affectedMob.getX(), affectedMob.getY())
                  .isValid()) {
                owner.getActionSender().sendMessage(
                    "I can't get a clear shot from here");
                owner.resetPath();
                return;
              }
              if (affectedMob instanceof Player) {
                world.addEntryToSnapshots(new Activity(owner
                    .getUsername(), owner.getUsername()
                    + " ranged a Player ("
                    + ((Player) affectedMob).getUsername()
                    + ")"));
              } else {
                world.addEntryToSnapshots(new Activity(owner
                    .getUsername(), owner.getUsername()
                    + " ranged a NPC ("
                    + ((Npc) affectedMob).getDef().name
                    + ")"));
              }
View Full Code Here


      break;
    case 198: // Deposit item
      itemID = p.readShort();
      amount = p.readInt();
      if (amount < 1 || inventory.countId(itemID) < amount) {
        world.addEntryToSnapshots(new Activity(player.getUsername(),
            player.getUsername() + " tried to deposit ID: "
                + itemID + " amount: " + amount));
        player.setSuspiciousPlayer(true);
        return;
      }
      world.addEntryToSnapshots(new Activity(player.getUsername(), player
          .getUsername()
          + " deposited ID: "
          + itemID
          + " amount: "
          + amount));
      if (EntityHandler.getItemDef(itemID).isMembers()
          && !World.isMembers()) {
        player.getActionSender().sendMessage(
            "This feature is only avaliable on a members server");
        return;
      }
      if (bank.canHold(itemID, amount)
          && inventory.remove(itemID, amount, false)) {
        bank.add(itemID, amount, false);
      } else {
        player.getActionSender().sendMessage(
            "You don't have room for that in your bank");
      }
      slot = bank.getLastItemSlot(itemID);
      if (slot > -1) {
        player.getActionSender().sendInventory();
        player.getActionSender().updateBankItem(slot, itemID,
            bank.countId(itemID));
      }
      break;
    case 183: // Withdraw item
      itemID = p.readShort();
      amount = p.readInt();
      if (amount < 1 || bank.countId(itemID) < amount) {
        world.addEntryToSnapshots(new Activity(player.getUsername(),
            player.getUsername() + " tried to withdraw ID: "
                + itemID + " amount: " + amount));
        player.setSuspiciousPlayer(true);
        return;
      }
      if (EntityHandler.getItemDef(itemID).isMembers()
          && !World.isMembers()) {
        player.getActionSender().sendMessage(
            "This feature is only avaliable on a members server");
        return;
      }

      if (!inventory.isStackable(itemID) && amount > 1) {
        Logger.println(player.getUsername() + " tried to withdraw ID: "
            + itemID + " amount: " + amount + " unstackable items");
        player.setSuspiciousPlayer(true);
      }

      slot = bank.getLastItemSlot(itemID);
      if (!inventory.canHold(itemID, amount)) {
        amount = inventory.maxSize() - inventory.size();
        if (amount == 0) {
          return;
        }
      }
      world.addEntryToSnapshots(new Activity(player.getUsername(), player
          .getUsername()
          + " withrew ID: "
          + itemID
          + " amount: "
          + amount));
View Full Code Here

        // shoudln't
        // happen
        player.setSuspiciousPlayer(true);
        return;
      }
      world.addEntryToSnapshots(new Activity(player.getUsername(), player
          .getUsername()
          + " used item on door"
          + item.getDef().getName()
          + "("
          + item.id
          + ")"
          + " [CMD: "
          + item.getDef().getCommand()
          + "] ON A DOOR ("
          + tile.getX()
          + "/"
          + tile.getY()
          + ") at: "
          + player.getX() + "/" + player.getY()));

      handleDoor(player, tile, object, dir, item);
      break;
    case 94: // Use Item on GameObject
      item = player.getInventory().getSlot(p.readShort());
      if (object == null || object.getType() == 1 || item == null) { // This
        // shoudln't
        // happen
        player.setSuspiciousPlayer(true);
        return;
      }
      world.addEntryToSnapshots(new Activity(player.getUsername(), player
          .getUsername()
          + " used item on GameObject"
          + item.getDef().getName()
          + "("
          + item.id
View Full Code Here

        && player.getLocation().inWilderness() && item.id != 814) {
      player.getActionSender().sendMessage(
          "Can not use a Member item in the wilderness");
      return;
    }
    world.addEntryToSnapshots(new Activity(player.getUsername(), player
        .getUsername()
        + " used item "
        + item.getDef().getName()
        + "("
        + item.id
View Full Code Here

        affectedPlayer.resetPath();
        affectedPlayer.resetAllExceptTrading();

        player.getActionSender().sendTradeWindowOpen();
        affectedPlayer.getActionSender().sendTradeWindowOpen();
        world.addEntryToSnapshots(new Activity(player.getUsername(),
            player.getUsername() + " sent trade request "
                + affectedPlayer.getUsername() + " at: "
                + player.getX() + "/" + player.getY() + " | "
                + affectedPlayer.getX() + "/"
                + affectedPlayer.getY()));

      }
      break;
    case 211: // Trade accepted
      affectedPlayer = player.getWishToTrade();
      if (affectedPlayer == null || busy(affectedPlayer)
          || !player.isTrading() || !affectedPlayer.isTrading()) { // This
        // shouldn't
        // happen
        player.setSuspiciousPlayer(true);
        unsetOptions(player);
        unsetOptions(affectedPlayer);
        return;
      }

      player.setTradeOfferAccepted(true);

      player.getActionSender().sendTradeAcceptUpdate();
      affectedPlayer.getActionSender().sendTradeAcceptUpdate();

      if (affectedPlayer.isTradeOfferAccepted()) {
        player.getActionSender().sendTradeAccept();
        affectedPlayer.getActionSender().sendTradeAccept();
      }
      world.addEntryToSnapshots(new Activity(player.getUsername(), player
          .getUsername()
          + " accepted trade "
          + affectedPlayer.getUsername()
          + " at: "
          + player.getX()
          + "/"
          + player.getY()
          + " | "
          + affectedPlayer.getX()
          + "/"
          + affectedPlayer.getY()));

      break;
    case 53: // Confirm accepted
      affectedPlayer = player.getWishToTrade();
      if (affectedPlayer == null || busy(affectedPlayer)
          || !player.isTrading() || !affectedPlayer.isTrading()
          || !player.isTradeOfferAccepted()
          || !affectedPlayer.isTradeOfferAccepted()) { // This
        // shouldn't
        // happen
        player.setSuspiciousPlayer(true);
        unsetOptions(player);
        unsetOptions(affectedPlayer);
        return;
      }
      player.setTradeConfirmAccepted(true);

      if (affectedPlayer.isTradeConfirmAccepted()) {
        world.addEntryToSnapshots(new Activity(player.getUsername(),
            player.getUsername() + " finished trade "
                + affectedPlayer.getUsername() + " at: "
                + player.getX() + "/" + player.getY() + " | "
                + affectedPlayer.getX() + "/"
                + affectedPlayer.getY()));
View Full Code Here

      return;
    }
    if (!canCast(player)) {
      return;
    }
    world.addEntryToSnapshots(new Activity(player.getUsername(), player
        .getUsername()
        + " tried to cast spell ("
        + 49
        + "): "
        + player.getX() + "/" + player.getY()));
View Full Code Here

          return;
        }
        if (sleepword_result.equalsIgnoreCase(player.getSleepword()))
          player.getActionSender().sendWakeUp(true);
        else {
          world.addEntryToSnapshots(new Activity(
              player.getUsername(), player.getUsername()
                  + " failed a sleepword"));
          player.getActionSender().sendIncorrectSleepword();
          player.getActionSender().sendEnterSleep();
          player.setLastSleepTime(now);
View Full Code Here

    player.resetAll();
    final Npc affectedNpc = world.getNpc(p.readShort());
    if (affectedNpc == null) {
      return;
    }
    world.addEntryToSnapshots(new Activity(player.getUsername(), player
        .getUsername()
        + " talked to NPC ("
        + affectedNpc.getID()
        + ") at: "
        + player.getX()
View Full Code Here

      if (object == null) {
        t.cleanItself();
        player.setSuspiciousPlayer(true);
        return;
      }
      world.addEntryToSnapshots(new Activity(player.getUsername(), player
          .getUsername()
          + " used a door ("
          + object.getID()
          + ") at: " + player.getX() + "/" + player.getY()));
     
View Full Code Here

      // Instance.getServer().getLoginConnector().getActionSender().reportUser(player.getUsernameHash(),
      // temp, b);
      DataManager.reportHandler.submitReport(player.getUsernameHash(),
          temp, b, player);
      player.setLastReport();
      world.addEntryToSnapshots(new Activity(player.getUsername(), player
          .getUsername()
          + " sent a report about: "
          + DataConversions.hashToUsername(temp)));
      player.getActionSender().sendMessage(
          "Your report has been received, thank you.");
View Full Code Here

TOP

Related Classes of org.moparscape.msc.gs.model.snapshot.Activity

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.