Example #1
0
  public void KillSession(Channel Channel) {
    Session mSession = GrabSession(Channel);

    try {
      mSession.GrabHabbo().RefreshMessenger(false);
    } catch (SQLException e) {
    }

    if (mSession.GrabActor().InRoom()) {
      mSession.LeaveRoom();
    }

    SessionList.remove(Channel);

    // if (!mSession.RecievedPolicy)
    // {
    Grizzly.GrabDatabase()
        .RunFastQuery(
            "UPDATE server_users SET online = '0' WHERE id = '" + mSession.GrabHabbo().ID + "'");
    // }

    Grizzly.WriteOut(
        "Killed communication with " + mSession.GrabIP() + " [" + mSession.GrabID() + "]");

    mSession.GrabChannel().disconnect();

    mSession = null;

    System.gc();
  }
Example #2
0
  public void sendResponse(EventResponse Message) {
    if (Grizzly.getConfig().get("net.grizzly.packetlog").equals("1")) {
      Grizzly.write("[" + Message.header() + "] " + Message.body() + " sent by " + this.ip());
      Grizzly.write("[" + Message.header() + "] " + Message.SimpleResponse);
    }

    this.Channel.write(Message);
  }
Example #3
0
  public void InvokeCommand(String Command) {
    if (!Commands.containsKey(SplitCommand(Command, true)[0])) {
      Grizzly.WriteOut(Command + " is not a valid Console Command!");
      return;
    }

    Commands.get(SplitCommand(Command, true)[0]).Parse(SplitCommand(Command, false));
  }
Example #4
0
 public Session GrabSession(Channel Channel) {
   if (SessionList.containsKey(Channel)) {
     return SessionList.get(Channel);
   } else {
     Grizzly.WriteOut("For some reason Grizzly tried to retrieve an empty session!!");
     return null;
   }
 }
Example #5
0
 public void tryLogin(String Ticket) {
   this.Habbo = new User(Ticket);
   this.Actor = new Actor(this);
   if (Grizzly.roleplayEnabled()) {
     this.RoleplayObject = new RoleplayObject(this);
   } else {
     this.RoleplayObject = null;
   }
 }
Example #6
0
  public Session CreateSession(Channel Channel) {
    Session mSession = new Session(Channel, (SessionList.size() + 1));

    SessionList.put(Channel, mSession);

    Grizzly.WriteOut(
        "Started communication with " + mSession.GrabIP() + " [" + mSession.GrabID() + "]");

    return mSession;
  }
Example #7
0
  public void compose(Session Session, EventRequest Request) {
    if (Session.getActor().CurrentRoom.Owner == Session.getHabbo().getID()
        || Session.getHabbo().getRank() >= 6) {
      String PlaceData = Request.readString();
      String[] Bits = PlaceData.split(" ");
      Integer ID = Integer.valueOf(Integer.parseInt(Bits[0]));
      if (Bits[1].startsWith(":")) {
        String X = Bits[1] + " " + Bits[2] + " " + Bits[3];
        InventoryItem Y = (InventoryItem) Session.getHabbo().getItems().getWalls().get(ID);

        try {
          Grizzly.getStorage()
              .execute(
                  "UPDATE server_items SET room = \'"
                      + Session.getActor().CurrentRoom.ID
                      + "\', base = \'"
                      + Y.getBase().ID
                      + "\', position = \'"
                      + X
                      + "\', extra = \'0\', floor = \'0\' WHERE id = \'"
                      + ID
                      + "\'");
        } catch (Exception var14) {;
        }

        int Rotation =
            Grizzly.getStorage()
                .getLastEntry(
                    "server_items", "room = \'" + Session.getActor().CurrentRoom.ID + "\'");
        Session.getActor()
            .CurrentRoom
            .sendMessage(
                SendWallItemToRoomComposer.compose(
                    Rotation, Y.getBase().Sprite, X, Session.getActor().CurrentRoom));
        Session.getHabbo().getItems().remove(ID.intValue(), false);
        Session.sendResponse(DisposeItemFromInventoryComposer.compose(ID.intValue()));
        (new InitializeInventoryEvent()).compose(Session, Request);
        Session.getActor().CurrentRoom.generateItem(ID.intValue());
        WallItem Height = null;
        Iterator mItem = Session.getActor().CurrentRoom.getWalls().values().iterator();

        while (mItem.hasNext()) {
          WallItem Item = (WallItem) mItem.next();
          if (Item.Position.equals(X)) {
            Height = Item;
            break;
          }
        }

        if (Height != null) {
          Grizzly.getHabboHotel()
              .getInteractions()
              .onPlace(Height.getBase().Interaction, Session, Height);
        }
      } else {
        Integer X1 = Integer.valueOf(Integer.parseInt(Bits[1]));
        Integer Y1 = Integer.valueOf(Integer.parseInt(Bits[2]));
        Integer Rotation1 = Integer.valueOf(Integer.parseInt(Bits[3]));
        Float Height1 =
            Float.valueOf(
                (float)
                    Session.getActor()
                        .CurrentRoom
                        .getModel()
                        .getTileHeight(X1.intValue(), Y1.intValue()));
        if (Session.getActor()
            .CurrentRoom
            .nonStackableTile(new Position(X1.intValue(), Y1.intValue(), 0.0D))) {
          return;
        }

        Height1 =
            Float.valueOf(
                Height1.floatValue()
                    + (float)
                        Session.getActor()
                            .CurrentRoom
                            .getTopHeight(
                                new Position(X1.intValue(), Y1.intValue(), 0.0D),
                                (FloorItem) null));
        Grizzly.write(Height1);

        try {
          InventoryItem Item1 = (InventoryItem) Session.getHabbo().getItems().getFloors().get(ID);
          Grizzly.getStorage()
              .execute(
                  "UPDATE server_items SET room = \'"
                      + Session.getActor().CurrentRoom.ID
                      + "\', base = \'"
                      + Item1.getBase().ID
                      + "\', x = \'"
                      + X1
                      + "\', y = \'"
                      + Y1
                      + "\', extra = \' \', floor = \'1\', rotation = \'"
                      + Rotation1
                      + "\', height = \'"
                      + Height1
                      + "\' WHERE id = \'"
                      + ID
                      + "\'");
          Session.getActor()
              .CurrentRoom
              .sendMessage(
                  SendFloorItemToRoomComposer.compose(
                      ID.intValue(),
                      Item1.getBase().Sprite,
                      X1.intValue(),
                      Y1.intValue(),
                      Rotation1.intValue(),
                      Float.toString(Height1.floatValue()),
                      Session.getActor().CurrentRoom));
          Session.getHabbo().getItems().remove(ID.intValue(), false);
          Session.sendResponse(DisposeItemFromInventoryComposer.compose(ID.intValue()));
          (new InitializeInventoryEvent()).compose(Session, Request);
          Session.getActor().CurrentRoom.generateItem(ID.intValue());
          if (Session.getActor()
                  .CurrentRoom
                  .getItemsByPosition(
                      new Position(X1.intValue(), Y1.intValue(), (double) Height1.intValue()))
              != null) {
            FloorItem mItem1 = null;
            Iterator var13 =
                Session.getActor()
                    .CurrentRoom
                    .getItemsByPosition(new Position(X1.intValue(), Y1.intValue(), 0.0D))
                    .values()
                    .iterator();

            while (var13.hasNext()) {
              FloorItem Furni = (FloorItem) var13.next();
              if (Furni.Height.equals(Height1)) {
                mItem1 = Furni;
                break;
              }
            }

            if (mItem1 != null) {
              Grizzly.getHabboHotel()
                  .getInteractions()
                  .onPlace(mItem1.getBase().Interaction, Session, mItem1);
            }
          }
        } catch (Exception var15) {;
        }
      }
    }
  }
 public void compose(Session Session, EventRequest Request) {
   int StreamID = Request.readInt().intValue();
   Grizzly.getStorage()
       .execute("UPDATE server_stream SET likes = likes + 1 WHERE id = \'" + StreamID + "\'");
 }