Exemple #1
0
 public override void OnUse(GameClient session, RoomItem item, int request, bool userHasRights)
 {
     if (session != null)
     {
         RoomUnitUser user = session.GetHabbo().GetRoomSession().GetRoomUser();
         if (user != null)
         {
             if (ThreeDCoord.smethod_0(new ThreeDCoord(user.X, user.Y), new ThreeDCoord(item.X, item.Y)) || ThreeDCoord.smethod_0(new ThreeDCoord(user.X, user.Y), item.TDC))
             {
                 RoomItemTeleport teleport = (RoomItemTeleport)item;
                 if (teleport.Interactor == null && user.Interacting == null)
                 {
                     teleport.Interactor = user;
                     teleport.Way        = 1;
                     user.Interacting    = item;
                 }
             }
             else
             {
                 if (user.Interacting == null)
                 {
                     user.MoveTo(item.TDC.x, item.TDC.y);
                 }
             }
         }
     }
 }
Exemple #2
0
        public override void OnTrigger(GameClient Session, RoomItem RoomItem_0, int int_0, bool bool_0)
        {
            RoomUser @class = RoomItem_0.method_8().GetRoomUserByHabbo(Session.GetHabbo().Id);

            if (@class != null && @class.class34_1 == null)
            {
                if (ThreeDCoord.smethod_0(@class.GStruct1_0, RoomItem_0.GStruct1_0) || ThreeDCoord.smethod_0(@class.GStruct1_0, RoomItem_0.GStruct1_1))
                {
                    if (RoomItem_0.uint_3 == 0u)
                    {
                        @class.int_19     = -1;
                        RoomItem_0.uint_3 = @class.GetClient().GetHabbo().Id;
                        @class.RoomItem_0 = RoomItem_0;
                    }
                }
                else
                {
                    if (@class.bool_0)
                    {
                        try
                        {
                            @class.method_4(RoomItem_0.GStruct1_1);
                        }
                        catch
                        {
                        }
                    }
                }
            }
        }
        public override void OnCycle()
        {
            bool open = false;

            if (this.Interactor != null && this.Interactor.Interacting == this)
            {
                if (this.Tick == 1)
                {
                    if (ThreeDCoord.smethod_0(new ThreeDCoord(this.Interactor.X, this.Interactor.Y), this.TDC))
                    {
                        open = true;

                        this.Tick = 2;
                        this.Interactor.Override = true;
                        this.Interactor.MoveTo(this.TDCO.x, this.TDCO.y);
                    }
                    else
                    {
                        this.Interactor.Interacting = null;
                        this.Interactor             = null;
                    }
                }
                else if (this.Tick == 2)
                {
                    this.Interactor.Override    = false;
                    this.Interactor.Interacting = null;
                    this.Interactor             = null;
                }
            }
            else
            {
                if (this.Interactor != null)
                {
                    this.Interactor.Interacting = null;
                    this.Interactor             = null;
                }
            }

            if (open)
            {
                if (this.ExtraData != "1")
                {
                    this.ExtraData = "1";
                    this.UpdateState(false, true);
                }
            }
            else
            {
                if (this.ExtraData != "0")
                {
                    this.ExtraData = "0";
                    this.UpdateState(false, true);
                }
            }
        }
Exemple #4
0
        public override void OnUse(GameClient session, RoomItem item, int request, bool userHasRights)
        {
            ThreeDCoord userLocation = new ThreeDCoord(session.GetHabbo().GetRoomSession().GetRoomUser().X, session.GetHabbo().GetRoomSession().GetRoomUser().Y);
            ThreeDCoord test1        = new ThreeDCoord(this.X + 1, this.Y);
            ThreeDCoord test2        = new ThreeDCoord(this.X - 1, this.Y);
            ThreeDCoord test3        = new ThreeDCoord(this.X, this.Y + 1);
            ThreeDCoord test4        = new ThreeDCoord(this.X, this.Y - 1);

            int x = this.X;
            int y = this.Y;

            if (ThreeDCoord.smethod_0(test1, userLocation))
            {
                x--;
            }
            else if (ThreeDCoord.smethod_0(test2, userLocation))
            {
                x++;
            }
            else if (ThreeDCoord.smethod_0(test3, userLocation))
            {
                y--;
            }
            else if (ThreeDCoord.smethod_0(test4, userLocation))
            {
                y++;
            }
            else
            {
                if ((session.GetHabbo().GetRoomSession().GetRoomUser().RestrictMovementType & RestrictMovementType.Client) == 0)
                {
                    session.GetHabbo().GetRoomSession().GetRoomUser().MoveTo(this.X, this.Y);
                }

                return;
            }

            RoomTile tile = this.Room.RoomGamemapManager.GetTile(x, y);

            if (tile != null && (tile.HigestRoomItem == null || tile.HigestRoomItem.GetBaseItem().Walkable))
            {
                int    oldX = this.X;
                int    oldY = this.Y;
                double oldZ = this.Z;

                if (this.Room.RoomItemManager.MoveFloorItemOnRoom(session, item, x, y, this.Rot))
                {
                    this.Room.RoomItemManager.MoveAnimation[this.ID] = new RoomItemRollerMovement(this.ID, this.X, this.Y, this.Z, 0, oldX, oldY, oldZ);
                }
            }
        }
 public override void OnUse(GameClient session, RoomItem item, int request, bool userHasRights)
 {
     if (session != null)
     {
         RoomUnitUser user = session.GetHabbo().GetRoomSession().GetRoomUser();
         if (user != null)
         {
             if (ThreeDCoord.smethod_0(new ThreeDCoord(user.X, user.Y), new ThreeDCoord(item.X, item.Y)) || ThreeDCoord.smethod_0(new ThreeDCoord(user.X, user.Y), item.TDC))
             {
                 RoomItemOneWayGate oneWayGate = (RoomItemOneWayGate)item;
                 if (oneWayGate.Interactor == null)
                 {
                     oneWayGate.Interactor = user;
                     oneWayGate.Tick       = 1;
                     user.Interacting      = item;
                 }
             }
             else
             {
                 user.MoveTo(item.TDC.x, item.TDC.y);
             }
         }
     }
 }
Exemple #6
0
        public override void OnTrigger(GameClient Session, RoomItem RoomItem_0, int int_0, bool bool_0)
        {
            Room     @class = RoomItem_0.method_8();
            RoomUser class2 = @class.GetRoomUserByHabbo(Session.GetHabbo().Id);

            if (class2 != null && @class != null)
            {
                ThreeDCoord gstruct1_  = new ThreeDCoord(RoomItem_0.Int32_0 + 1, RoomItem_0.Int32_1);
                ThreeDCoord gstruct1_2 = new ThreeDCoord(RoomItem_0.Int32_0 - 1, RoomItem_0.Int32_1);
                ThreeDCoord gstruct1_3 = new ThreeDCoord(RoomItem_0.Int32_0, RoomItem_0.Int32_1 + 1);
                ThreeDCoord gstruct1_4 = new ThreeDCoord(RoomItem_0.Int32_0, RoomItem_0.Int32_1 - 1);
                if (ThreeDCoord.smethod_1(class2.GStruct1_0, gstruct1_) && ThreeDCoord.smethod_1(class2.GStruct1_0, gstruct1_2) && ThreeDCoord.smethod_1(class2.GStruct1_0, gstruct1_3) && ThreeDCoord.smethod_1(class2.GStruct1_0, gstruct1_4))
                {
                    if (class2.bool_0)
                    {
                        class2.method_4(RoomItem_0.GStruct1_0);
                    }
                }
                else
                {
                    int num  = RoomItem_0.Int32_0;
                    int num2 = RoomItem_0.Int32_1;
                    if (ThreeDCoord.smethod_0(class2.GStruct1_0, gstruct1_))
                    {
                        num  = RoomItem_0.Int32_0 - 1;
                        num2 = RoomItem_0.Int32_1;
                    }
                    else
                    {
                        if (ThreeDCoord.smethod_0(class2.GStruct1_0, gstruct1_2))
                        {
                            num  = RoomItem_0.Int32_0 + 1;
                            num2 = RoomItem_0.Int32_1;
                        }
                        else
                        {
                            if (ThreeDCoord.smethod_0(class2.GStruct1_0, gstruct1_3))
                            {
                                num  = RoomItem_0.Int32_0;
                                num2 = RoomItem_0.Int32_1 - 1;
                            }
                            else
                            {
                                if (ThreeDCoord.smethod_0(class2.GStruct1_0, gstruct1_4))
                                {
                                    num  = RoomItem_0.Int32_0;
                                    num2 = RoomItem_0.Int32_1 + 1;
                                }
                            }
                        }
                    }
                    if (@class.method_37(num, num2, true, true, true, true, false, false))
                    {
                        List <RoomItem> list_ = new List <RoomItem>();
                        list_ = @class.method_93(num, num2);
                        double        double_ = @class.method_84(num, num2, list_);
                        ServerMessage Message = new ServerMessage(230u);
                        Message.AppendInt32(RoomItem_0.Int32_0);
                        Message.AppendInt32(RoomItem_0.Int32_1);
                        Message.AppendInt32(num);
                        Message.AppendInt32(num2);
                        Message.AppendInt32(1);
                        Message.AppendUInt(RoomItem_0.uint_0);
                        Message.AppendByte(2);
                        Message.AppendStringWithBreak(double_.ToString());
                        Message.AppendString("M");
                        @class.SendMessage(Message, null);
                        @class.method_81(RoomItem_0, num, num2, double_);
                    }
                }
            }
        }
Exemple #7
0
        public override void OnCycle()
        {
            bool open = false;
            bool tele = false;

            if (this.Interactor != null && this.Interactor.Interacting == this)
            {
                if (this.Way == 0) //none
                {
                    this.Interactor.Interacting = null;
                    this.Interactor             = null;
                }
                else if (this.Way == 1) //going in
                {
                    if (ThreeDCoord.smethod_0(new ThreeDCoord(this.Interactor.X, this.Interactor.Y), new ThreeDCoord(this.X, this.Y)))
                    {
                        KeyValuePair <uint, uint> teleDate = TeleHandler.GetTeleDestiny(this.ID);
                        if (teleDate.Key != 0 && teleDate.Value != 0)
                        {
                            tele = true;
                            if (teleDate.Value == this.Room.ID)
                            {
                                RoomItemTeleport item = (RoomItemTeleport)this.Room.RoomItemManager.TryGetRoomItem(teleDate.Key);
                                if (item != null)
                                {
                                    this.Interactor.SetLocation(item.X, item.Y, item.Z);
                                    this.Interactor.SetRotation(item.Rot, true);
                                    this.Interactor.Interacting = item;

                                    this.Interactor.Interacting = item;
                                    item.Interactor             = this.Interactor;
                                    item.Way = 2;
                                }
                                else
                                {
                                    this.Interactor.RestrictMovementType &= ~RestrictMovementType.Client;
                                    this.Interactor.Override              = false;
                                    this.Interactor.Moving = true;
                                    this.Interactor.MoveTo(this.TDC.x, this.TDC.y);
                                }
                            }
                            else
                            {
                                Room room = Skylight.GetGame().GetRoomManager().TryGetAndLoadRoom(teleDate.Value);
                                if (room != null)
                                {
                                    this.Interactor.Session.GetHabbo().GetRoomSession().HandleTeleport(room, teleDate.Key);
                                }
                                else
                                {
                                    this.Interactor.RestrictMovementType &= ~RestrictMovementType.Client;
                                    this.Interactor.Override              = false;
                                    this.Interactor.Moving = true;
                                    this.Interactor.MoveTo(this.TDC.x, this.TDC.y);
                                }
                            }
                        }
                        else
                        {
                            this.Interactor.RestrictMovementType &= RestrictMovementType.Client;
                            this.Interactor.Override              = false;
                            this.Interactor.Moving = true;
                            this.Interactor.MoveTo(this.TDC.x, this.TDC.y);
                        }
                        this.Way = 0;
                    }
                    else
                    {
                        if (ThreeDCoord.smethod_0(new ThreeDCoord(this.Interactor.X, this.Interactor.Y), this.TDC))
                        {
                            open = true;

                            this.Interactor.RestrictMovementType |= RestrictMovementType.Client;
                            this.Interactor.Override              = true;
                            this.Interactor.Moving = true;
                            this.Interactor.MoveTo(this.TDC.x, this.TDC.y);
                        }
                        else
                        {
                            this.Way = 0;
                        }
                    }
                }
                else if (this.Way == 2) //going out
                {
                    if (this.ExtraData == "2")
                    {
                        open = true;

                        this.Interactor.RestrictMovementType &= ~RestrictMovementType.Client;
                        this.Interactor.Override              = false;
                        this.Interactor.MoveTo(this.TDC.x, this.TDC.y);
                        this.Way = 0;
                    }
                    else
                    {
                        tele = true;
                    }
                }
            }
            else
            {
                if (this.Interactor != null)
                {
                    this.Interactor = null;
                }
                this.Way = 0;
            }

            if (open)
            {
                if (this.ExtraData != "1")
                {
                    this.ExtraData = "1";
                    this.UpdateState(false, true);
                }
            }
            else if (tele)
            {
                if (this.ExtraData != "2")
                {
                    this.ExtraData = "2";
                    this.UpdateState(false, true);
                }
            }
            else
            {
                if (this.ExtraData != "0")
                {
                    this.ExtraData = "0";
                    this.UpdateState(false, true);
                }
            }
        }