예제 #1
0
        public static void AppendPlayerData(Client client, bool sendMyPlayerData, PacketHitList packetList)
        {
            TcpPacket packet = TcpPacket.CreatePacket("playerdata",
                                                                  client.ConnectionID.ToString(), client.Player.Name, client.Player.GetActiveRecruit().Sprite.ToString(),
                                                                  client.Player.GetActiveRecruit().Form.ToString(), ((int)client.Player.GetActiveRecruit().Shiny).ToString(), ((int)client.Player.GetActiveRecruit().Sex).ToString(),
                                                                  client.Player.MapID, client.Player.X.ToString(), client.Player.Y.ToString(),
                                                                  ((int)client.Player.Direction).ToString(), ((int)client.Player.Access).ToString(), client.Player.Hunted.ToIntString(),
                                                                  client.Player.Dead.ToIntString(), client.Player.GuildName, ((int)client.Player.GuildAccess).ToString(),
                                                                  client.Player.Status);

            packet.AppendParameters(0, (int)client.Player.GetActiveRecruit().StatusAilment, client.Player.GetActiveRecruit().VolatileStatus.Count);
            for (int j = 0; j < client.Player.GetActiveRecruit().VolatileStatus.Count; j++) {
                packet.AppendParameter(client.Player.GetActiveRecruit().VolatileStatus[j].Emoticon);
            }
            packetList.AddPacketToSurroundingPlayersBut(client, client.Player.Map, packet);
            //packetList.AddPacketToMapBut(client, client.Player.MapID, packet);

            Recruit recruit = client.Player.GetActiveRecruit();
            int mobility = 0;
            for (int i = 15; i >= 0; i--) {
                if (recruit.Mobility[i]) {
                    mobility += (int)System.Math.Pow(2, i);
                }
            }
            if (sendMyPlayerData) {
                TcpPacket myPacket = TcpPacket.CreatePacket("myplayerdata", client.Player.ActiveSlot.ToString(),
                                                      client.Player.Name, recruit.Sprite.ToString(), recruit.Form.ToString(), ((int)recruit.Shiny).ToString(), ((int)recruit.Sex).ToString(),
                                                      client.Player.MapID, client.Player.X.ToString(), client.Player.Y.ToString(),
                                                      ((int)client.Player.Direction).ToString(), ((int)client.Player.Access).ToString(), client.Player.Hunted.ToIntString(),
                                                      client.Player.Dead.ToIntString(), client.Player.GuildName, ((int)client.Player.GuildAccess).ToString(),
                                                      client.Player.Solid.ToIntString(), client.Player.Status, client.Player.GetActiveRecruit().Confused.ToIntString(),
                                                      ((int)client.Player.GetActiveRecruit().StatusAilment).ToString(), ((int)client.Player.SpeedLimit).ToString(),
                                                      mobility.ToString(), client.Player.GetActiveRecruit().TimeMultiplier.ToString(),
                                                      recruit.Darkness.ToString());

                myPacket.AppendParameter(client.Player.GetActiveRecruit().VolatileStatus.Count);
                for (int j = 0; j < client.Player.GetActiveRecruit().VolatileStatus.Count; j++) {
                    myPacket.AppendParameter(client.Player.GetActiveRecruit().VolatileStatus[j].Emoticon);
                }
                packetList.AddPacket(client, myPacket);
            }
        }