Пример #1
0
        public static void HandleUseCharacter(Int32 id, Int32 slot)
        {
            // Make sure the user exists.
            if (!Data.Players.ContainsKey(id))
            {
                return;
            }

            // If the user isn't already in-game, send them all the appropriate data!
            if (!Data.TempPlayers[id].InGame)
            {
                // Player is using this character!
                Data.TempPlayers[id].CurrentCharacter = slot;

                // Send our client the go-ahead!
                Send.LoginOK(id);

                // Send our clients their game data!
                // This includes everyone on the same map as our lovely friend.
                Send.PlayerData(id, id);
                for (var i = 0; i < Data.Players.Count; i++)
                {
                    var key = Data.Players.ElementAt(i).Key;
                    if (Data.TempPlayers[key].InGame && Data.Players[key].Characters[Data.TempPlayers[key].CurrentCharacter].Map == Data.Players[id].Characters[Data.TempPlayers[id].CurrentCharacter].Map)
                    {
                        Send.PlayerData(key, id);
                        Send.PlayerData(id, key);
                        Send.PlayerMoving(id, key);
                    }
                }

                // Now send our friendly friend our map!
                Send.LoadMap(id, Data.Players[id].Characters[Data.TempPlayers[id].CurrentCharacter].Map);
            }
        }
Пример #2
0
 internal static void HandlePlayerMoving(Int32 id, DataBuffer buffer)
 {
     for (var i = 0; i < (Int32)Enumerations.Direction.Direction_Count; i++)
     {
         Data.TempPlayers[id].IsMoving[i] = buffer.ReadBoolean();
     }
     for (var i = 0; i < Data.Players.Keys.Count; i++)
     {
         var key = Data.Players.ElementAt(i).Key;
         if (Data.TempPlayers.ContainsKey(key))
         {
             if (Data.TempPlayers[key].InGame)
             {
                 if (Data.Players[id].Characters[Data.TempPlayers[id].CurrentCharacter].Map == Data.Players[key].Characters[Data.TempPlayers[key].CurrentCharacter].Map)
                 {
                     Send.PlayerMoving(key, id);
                 }
             }
         }
     }
 }