Пример #1
0
        private void doPlayerUpdate(RoomUser user, PathFinderNode nextNode)
        {
            user.NextX = nextNode.X;
            user.NextY = nextNode.Y;
            user.NextZ = mHeightMap[user.NextX, user.NextY];
            user.Path.Remove(nextNode);
            mPlayerMap[user.CurrentX, user.CurrentY] = false;
            mPlayerMap[user.NextX, user.NextY]       = true;
            int newDirection = SpecialMath.WorkDirection(user.CurrentX, user.CurrentY, user.NextX, user.NextY);

            user.HeadDirection = newDirection;
            user.BodyDirection = newDirection;
            mRoomInstance.AnnounceUserStatus(user.SessionID, true);
            user.CurrentX = user.NextX;
            user.CurrentY = user.NextY;
            user.CurrentZ = user.NextZ;
        }
Пример #2
0
        //79 - "LOOKTO": "AO"
        public void Listener79()
        {
            RoomUser user = mRoomInstance.GetUser(mSessionID);

            string[] part = mPacketBody.Split(' ');
            int      x, y;

            if (!user.IsMoving)
            {
                if (part.Length == 2)
                {
                    if (int.TryParse(part[0], out x) && int.TryParse(part[1], out y))
                    {
                        int  newDir     = SpecialMath.WorkDirection(user.CurrentX, user.CurrentY, x, y);
                        bool updateBody = !(newDir == user.BodyDirection + 1 || newDir == user.BodyDirection - 1 || newDir == user.BodyDirection - 7 || newDir == user.BodyDirection + 7);

                        if (!user.SpecialStates.ContainsKey("lay") && !user.SpecialStates.ContainsKey("sit"))
                        {
                            user.HeadDirection = newDir;
                            if (updateBody)
                            {
                                user.BodyDirection = newDir;
                            }
                            mRoomInstance.AnnounceUserStatus(mSessionID, true);
                        }
                        else
                        {
                            if (!updateBody)
                            {
                                user.HeadDirection = newDir;
                            }
                            mRoomInstance.AnnounceUserStatus(mSessionID, true);
                        }
                    }
                }
            }
        }