Jump to content
  • Please do not post a message for the purpose of insulting, incitement to hatred, sexual remarks and any other which does not respect our terms of use !

MoveAvatarEvent Fixed


Akushi

Recommended Posts

Hello tout le monde,

 

Petit partage qui pour certains sera extrêmement utile peut de monde l'ont sauf ceux sous Comet bien sûr.

 

To access this link, please log in.

 

Remplacer votre MoveAvatarEvent.cs par :

[hide]

using Plus.HabboHotel.Items;
using Plus.HabboHotel.Rooms;
using System.Collections.Generic;
using System.Drawing;
using System.Linq;

namespace Plus.Communication.Packets.Incoming.Rooms.Engine
{
    internal class MoveAvatarEvent : IPacketEvent
    {
        public void Parse(HabboHotel.GameClients.GameClient Session, ClientPacket Packet)
        {
            if (Session == null || Session.GetHabbo() == null)
            {
                return;
            }

            if (!Session.GetHabbo().InRoom)
            {
                return;
            }

            Room Room = Session.GetHabbo().CurrentRoom;
            if (Room == null)
            {
                return;
            }

            RoomUser User = Room.GetRoomUserManager().GetRoomUserByHabbo(Session.GetHabbo().Id);

            if (User == null || !User.CanWalk)
            {
                return;
            }

            int MoveX = Packet.PopInt();
            int MoveY = Packet.PopInt();

            if (User.RidingHorse)
            {
                RoomUser Horse = Room.GetRoomUserManager().GetRoomUserByVirtualId(User.HorseID);
                if (Horse != null)
                {
                    Horse.MoveTo(MoveX, MoveY);
                }
            }

            if (User.isLying)
            {
                User.Z += 0.35;
                User.RemoveStatus("lay");
                User.isLying = false;
                User.UpdateNeeded = true;
            }

            if (User.isSitting)
            {
                User.Z += 0.35;
                User.RemoveStatus("sit");
                User.isSitting = false;
                User.UpdateNeeded = true;
            }

            User.MoveTo(MoveX, MoveY);
        }
    }
}

[/hide]

 

Ensuite aller dans RoomUser.cs et rechercher public void MoveTo(int pX, int pY, bool pOverride)

Remplacer la fonction par ceci :

 

[hide]

public void MoveTo(int pX, int pY, bool pOverride)
        {
            if (TeleportEnabled)
            {
                UnIdle();
                GetRoom().SendPacket(GetRoom().GetRoomItemHandler().UpdateUserOnRoller(this, new Point(pX, pY), 0, GetRoom().GetGameMap().SqAbsoluteHeight(GoalX, GoalY)));
                if (Status.ContainsKey("sit"))
                {
                    Z -= 0.35;
                }

                UpdateNeeded = true;
                return;
            }

            if ((!GetRoom().GetGameMap().IsValidMovement(pX, pY) && !AllowOverride) || Frozen)
            {
                return;
            }

            UnIdle();
            IsWalking = true;
            GoalX = pX;
            GoalY = pY;
            PathRecalcNeeded = true;
            FreezeInteracting = false;
        }

[/hide]

 

Rendez vous dans GameMap.cs et remplacer: public bool SquareHasUsers(int X, int Y)

 

[hide]

public bool SquareHasUsers(int X, int Y)
        {
            return _userMap.ContainsKey(new Point(X, Y));
        }

[/hide]

 

Voilà il permet de faire les aller retour avec sont personnage comme sur HabboCity ou encore Habbo.

Fixed by me.

 

Cordialement,

Edited by Akushi
Vrai fixe.
  • J'aime 3
  • J'adore 1
Link to post
Share on other sites

  • Replies 61
  • Created
  • Last Reply

Top Posters In This Topic

Popular Posts

Hello tout le monde,   Petit partage qui pour certains sera extrêmement utile peut de monde l'ont sauf ceux sous Comet bien sûr.  

To access this link, please log in.

  Rem

  • 3 weeks later...

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×
×
  • Create New...