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

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


        affectedPlayer.clearDuelOptions();
        affectedPlayer.resetAllExceptDueling();

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

      }
      break;
    case 252: // Duel accepted
      affectedPlayer = player.getWishToDuel();
      if (affectedPlayer == null || busy(affectedPlayer)
          || !player.isDueling() || !affectedPlayer.isDueling()) { // This
        // shouldn't
        // happen
        player.setSuspiciousPlayer(true);
        unsetOptions(player);
        unsetOptions(affectedPlayer);
        return;
      }

      player.setDuelOfferAccepted(true);

      player.getActionSender().sendDuelAcceptUpdate();
      affectedPlayer.getActionSender().sendDuelAcceptUpdate();

      if (affectedPlayer.isDuelOfferAccepted()) {
        player.getActionSender().sendDuelAccept();
        affectedPlayer.getActionSender().sendDuelAccept();
      }
      world.addEntryToSnapshots(new Activity(player.getUsername(), player
          .getUsername()
          + " accepted duel request "
          + affectedPlayer.getUsername()
          + " at: "
          + player.getX()
          + "/"
          + player.getY()
          + " | "
          + affectedPlayer.getX()
          + "/"
          + affectedPlayer.getY()));

      break;
    case 87: // Confirm accepted
      affectedPlayer = player.getWishToDuel();
      if (affectedPlayer == null || busy(affectedPlayer)
          || !player.isDueling() || !affectedPlayer.isDueling()
          || !player.isDuelOfferAccepted()
          || !affectedPlayer.isDuelOfferAccepted()) { // This
        // shouldn't
        // happen
        player.setSuspiciousPlayer(true);
        unsetOptions(player);
        unsetOptions(affectedPlayer);
        return;
      }
      player.setDuelConfirmAccepted(true);

      if (affectedPlayer.isDuelConfirmAccepted()) {
        world.addEntryToSnapshots(new Activity(player.getUsername(),
            player.getUsername() + " started duel "
                + affectedPlayer.getUsername() + " at: "
                + player.getX() + "/" + player.getY() + " | "
                + affectedPlayer.getX() + "/"
                + affectedPlayer.getY()));
        player.getActionSender().sendDuelWindowClose();
        player.getActionSender().sendMessage("Commencing Duel");
        affectedPlayer.getActionSender().sendDuelWindowClose();
        affectedPlayer.getActionSender().sendMessage("Commencing Duel");

        player.resetAllExceptDueling();
        player.setBusy(true);
        player.setStatus(Action.DUELING_PLAYER);

        affectedPlayer.resetAllExceptDueling();
        affectedPlayer.setBusy(true);
        affectedPlayer.setStatus(Action.DUELING_PLAYER);

        if (player.getDuelSetting(3)) {
          int slot = 0;
          for (InvItem item : player.getInventory().getItems()) {
            if (item.wielded) {
              player.getInventory().setWield(slot, false);
              player.updateWornItems(
                  ItemAttributes.getWieldable(item.id)
                      .getWieldPos(),
                  player.getPlayerAppearance().getSprite(
                      ItemAttributes
                          .getWieldable(item.id)
                          .getWieldPos()));
            }
            slot++;
          }
          player.getActionSender().sendSound("click");
          player.getActionSender().sendInventory();
          player.getActionSender().sendEquipmentStats();

          slot = 0;
          for (InvItem item : affectedPlayer.getInventory()
              .getItems()) {
            if (item.wielded) {
              affectedPlayer.getInventory().setWield(slot, false);
              affectedPlayer.updateWornItems(
                  ItemAttributes.getWieldable(item.id)
                      .getWieldPos(),
                  affectedPlayer.getPlayerAppearance()
                      .getSprite(
                          ItemAttributes
                              .getWieldable(
                                  item.id)
                              .getWieldPos()));
            }
            slot++;
          }
          affectedPlayer.getActionSender().sendSound("click");
          affectedPlayer.getActionSender().sendInventory();
          affectedPlayer.getActionSender().sendEquipmentStats();

        }

        if (player.getDuelSetting(2)) {
          for (int x = 0; x < 14; x++) {
            if (player.isPrayerActivated(x)) {
              player.removePrayerDrain(x);
              player.setPrayer(x, false);
            }
            if (affectedPlayer.isPrayerActivated(x)) {
              affectedPlayer.removePrayerDrain(x);
              affectedPlayer.setPrayer(x, false);
            }
          }
          player.getActionSender().sendPrayers();
          affectedPlayer.getActionSender().sendPrayers();
        }

        player.setFollowing(affectedPlayer);
        WalkToMobEvent walking = new WalkToMobEvent(player,
            affectedPlayer, 1) {
          public void arrived() {
            Instance.getDelayedEventHandler().add(
                new SingleEvent(owner, 300) {
                  public void action() {
                    Player affectedPlayer = (Player) affectedMob;
                    owner.resetPath();
                    if (!owner.nextTo(affectedPlayer)) {
                      unsetOptions(owner);
                      unsetOptions(affectedPlayer);
                      return;
                    }
                    affectedPlayer.resetPath();

                    owner.resetAllExceptDueling();
                    affectedPlayer.resetAllExceptDueling();

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

                    owner.setSprite(9);
                    owner.setOpponent(affectedMob);
                    owner.setCombatTimer();

                    affectedPlayer.setSprite(8);
                    affectedPlayer.setOpponent(owner);
                    affectedPlayer.setCombatTimer();

                    Player attacker, opponent;
                    if (owner.getCombatLevel() > affectedPlayer
                        .getCombatLevel()) {
                      attacker = affectedPlayer;
                      opponent = owner;
                    } else if (affectedPlayer
                        .getCombatLevel() > owner
                        .getCombatLevel()) {
                      attacker = owner;
                      opponent = affectedPlayer;
                    } else if (DataConversions.random(0, 1) == 1) {
                      attacker = owner;
                      opponent = affectedPlayer;
                    } else {
                      attacker = affectedPlayer;
                      opponent = owner;
                    }
                    DuelEvent dueling = new DuelEvent(
                        attacker, opponent);
                    dueling.setLastRun(0);
                    Instance.getDelayedEventHandler().add(
                        dueling);
                  }
                });
          }

          public void failed() {
            Player affectedPlayer = (Player) affectedMob;
            owner.getActionSender().sendMessage(
                "Error walking to "
                    + affectedPlayer.getUsername()
                    + " (known bug)");
            affectedPlayer.getActionSender().sendMessage(
                "Error walking to " + owner.getUsername()
                    + " (known bug)");
            unsetOptions(owner);
            unsetOptions(affectedPlayer);
            owner.setBusy(false);
            affectedPlayer.setBusy(false);
          }
        };
        walking.setLastRun(GameEngine.getTime() + 500);
        Instance.getDelayedEventHandler().add(walking);
      }
      break;
    case 35: // Decline duel
      affectedPlayer = player.getWishToDuel();
      if (affectedPlayer == null || busy(affectedPlayer)
          || !player.isDueling() || !affectedPlayer.isDueling()) { // This
        // shouldn't
        // happen
        player.setSuspiciousPlayer(true);
        unsetOptions(player);
        unsetOptions(affectedPlayer);
        return;
      }
      affectedPlayer.getActionSender().sendMessage(
          player.getUsername() + " has declined the duel.");

      unsetOptions(player);
      unsetOptions(affectedPlayer);
      world.addEntryToSnapshots(new Activity(player.getUsername(), player
          .getUsername()
          + " declined duel "
          + affectedPlayer.getUsername()
          + " at: "
          + player.getX()
View Full Code Here


            "Your friend list is too full");
        return;
      }
      loginSender.addFriend(user, friend);
      player.addFriend(friend, 0);
      world.addEntryToSnapshots(new Activity(player.getUsername(), player
          .getUsername()
          + " added friend "
          + DataConversions.hashToUsername(friend)
          + " at: "
          + player.getX() + "/" + player.getY()));

      break;
    case 52: // Remove friend
      loginSender.removeFriend(user, friend);
      player.removeFriend(friend);
      world.addEntryToSnapshots(new Activity(player.getUsername(), player
          .getUsername()
          + " removed friend "
          + DataConversions.hashToUsername(friend)
          + " at: "
          + player.getX() + "/" + player.getY()));
View Full Code Here

        }
        if (owner.hasMoved()) {
          this.stop();
          return;
        }
        world.addEntryToSnapshots(new Activity(owner.getUsername(),
            owner.getUsername() + " dropped ID: " + item.id
                + " amount: " + item.amount + " at: "
                + owner.getX() + "/" + owner.getY()));

        owner.getActionSender().sendSound("dropobject");
View Full Code Here

    int value;
    InvItem item;
    switch (pID) {
    case 253: // Close shop
      player.resetShop();
      world.addEntryToSnapshots(new Activity(player.getUsername(), player
          .getUsername()
          + " closed shop window at: "
          + player.getX()
          + "/" + player.getY()));

      break;
    case 128: // Buy item

      Short s = p.readShort();
      item = new InvItem(s, 1);
      world.addEntryToSnapshots(new Activity(player.getUsername(), player
          .getUsername()
          + " tried to buy item ("
          + s
          + "): "
          + player.getX() + "/" + player.getY()));

      if (item.getDef().isMembers() && !World.isMembers()) {
        player.getActionSender().sendMessage(
            "This feature is only avaliable on a members server");
        return;
      }
      value = p.readInt();
      if (value < item.getDef().basePrice) {
        Logger.println("[SHOPDUPE] " + player.getUsername()
            + " tried to buy " + item.getDef().name + " for "
            + value);
        return;
      }
      if (shop.countId(item.id) < 1)
        return;
      if (player.getInventory().countId(10) < value) {
        player.getActionSender().sendMessage(
            "You don't have enough money to buy that!");
        return;
      }
      List<InvItem> rec = new ArrayList<InvItem>();
      rec.add(item);
      List<InvItem> give = new ArrayList<InvItem>();
      give.add(new InvItem(10, value));
      if (!player.getInventory().canHold(rec, give)) {
        player.getActionSender().sendMessage(
            "You don't have room for that in your inventory");
        return;
      }
      int itemprice = Formulae.getPrice(
          shop.getItems().get(Formulae.getItemPos(shop, item.id)),
          shop, true);
      int sellprice = Formulae.getPrice(
          shop.getItems().get(Formulae.getItemPos(shop, item.id)),
          shop, false);
      if (itemprice == 0)
        return;

      if (sellprice >= itemprice)
        return;
      if (player.getInventory().remove(10, itemprice, false)) {
        shop.remove(item.id, item.amount, true);
        player.getInventory().add(item.id, item.amount, false);
        player.getActionSender().sendSound("coins");
        player.getActionSender().sendInventory();
        shop.updatePlayers();
      }
      break;
    case 255: // Sell item
      Short s1 = p.readShort();
      item = new InvItem(s1, 1);
      world.addEntryToSnapshots(new Activity(player.getUsername(), player
          .getUsername()
          + " tried to sell item ("
          + s1
          + "): "
          + player.getX() + "/" + player.getY()));
View Full Code Here

        if (cl.getRecievers().contains(a) || cl.getOwner().equals(a)) {
          chatlog.append((cl.getTimestamp() / 1000) + " <"
              + cl.getOwner() + "> " + cl.getMessage() + "\n");
        }
      } else if (s instanceof Activity) {
        Activity ac = (Activity) s;
        if (ac.getOwner().equals(f)) {
          snapshot_from.append((ac.getTimestamp() / 1000) + " "
              + ac.getActivity() + "\n");
        } else if (ac.getOwner().equals(a)) {
          snapshot_about.append((ac.getTimestamp() / 1000) + " "
              + ac.getActivity() + "\n");
        }
      }
    }
    try {
      insertNewReportRow.setLong(1, from);
View Full Code Here

            || cl.getOwner().equals(username)) {
          data.append((cl.getTimestamp() / 1000) + " <"
              + cl.getOwner() + "> " + cl.getMessage() + "\n");
        }
      } else if (s instanceof Activity) {
        Activity ac = (Activity) s;
        if (ac.getOwner().equals(username)) {
          data.append((ac.getTimestamp() / 1000) + " "
              + ac.getActivity() + "\n");
        }
      }
    }
    try {
      insertNewDupeDataRow.setString(1, username);
View Full Code Here

                  .usernameToHash(owner.getUsername());
              loginServer.tradeLog(droppedby, playerLong,
                  item.getID(), item.getAmount(),
                  owner.getX(), owner.getY(), 3);
            }
            world.addEntryToSnapshots(new Activity(owner
                .getUsername(), owner.getUsername()
                + " picked up an item "
                + item.getDef().getName() + " (" + item.getID()
                + ") amount: " + item.getAmount() + " at: "
                + owner.getX() + "/" + owner.getY() + "|"
View Full Code Here

      if (item == null || myItem == null) {
        player.setSuspiciousPlayer(true);
        player.resetPath();
        return;
      }
      world.addEntryToSnapshots(new Activity(player.getUsername(), player
          .getUsername()
          + " used item "
          + myItem.getDef().getName()
          + "("
          + myItem.id
View Full Code Here

      return;
    player.resetAll();
    player.setFollowing(affectedPlayer, 1);
    player.getActionSender().sendMessage(
        "Now following " + affectedPlayer.getUsername());
    world.addEntryToSnapshots(new Activity(player.getUsername(), player
        .getUsername()
        + " started to follow "
        + affectedPlayer.getUsername()
        + " at: "
        + player.getX()
View Full Code Here

    this.suspicious = suspicious;
    Logger.println(this.getUsername()
        + " was set suspicious! Stacktrace: \n" + stacktrace);
    Logger.systemerr(this.getUsername()
        + " was set suspicious! Stacktrace: \n" + stacktrace);
    world.addEntryToSnapshots(new Activity(this.getUsername(), this
        .getUsername()
        + " was set suspicious! Stacktrace: \n"
        + stacktrace));
  }
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.