コード例 #1
0
        void c_ClientSpawnLoadInfo(object sender, ClientSpawnLoadEventArgs e)
        {
            Client           c  = (Client)sender;
            SpawnRequestInfo sr = e.Info;

            Client[]  nearbyClients  = GetNearByClients(c);
            MapItem[] nearbyMapItems = mapEngine.GetNearbyMapItems(c.MyCharacter.X, c.MyCharacter.Y);

            byte[] bufferSendShowMap = PacketManager.SendShowMap();
            c.Send(bufferSendShowMap);

            byte[] bufferSendSpawn10 = PacketManager.SendSpawn10(c.MyCharacter);
            // c.Send(bufferSendSpawn10);
            SendSpecific(nearbyClients, bufferSendSpawn10);

            for (int i = 0; i < nearbyClients.Length; i++)
            {
                if (nearbyClients[i].MyCharacter.CharacterId != c.MyCharacter.CharacterId)
                {
                    byte[] bufferSendMeToThem = PacketManager.SendSpawnPlayers(c.MyCharacter);
                    nearbyClients[i].Send(bufferSendMeToThem);

                    byte[] bufferSendPlayers = PacketManager.SendSpawnPlayers(nearbyClients[i].MyCharacter);
                    c.Send(bufferSendPlayers);
                }
            }

            for (int i = 0; i < nearbyMapItems.Length; i++)
            {
                byte[] bufferSendMapItems = PacketManager.SendItemOnGround(nearbyMapItems[i]);
                c.Send(bufferSendMapItems);
            }

            // this should send everything in range, players,monsters etc
            byte[] bufferSendSpawn12 = PacketManager.SendSpawn12(nearbyClients);
            c.Send(bufferSendSpawn12);

            Npc[] nearbyNpcs = mapEngine.GetNearbyNpcs(c.MyCharacter);

            byte[] bufferSendNpcList = PacketManager.SendSpawnNpc(nearbyNpcs.Cast <Npc>().ToList(), c.Map.MapID);
            c.Send(bufferSendNpcList);
        }
コード例 #2
0
        void c_ClientSpawnLoadInfo(object sender, ClientSpawnLoadEventArgs e)
        {
            Client c = (Client)sender;
            SpawnRequestInfo sr = e.Info;

            Client[] nearbyClients = GetNearByClients(c);
            MapItem[] nearbyMapItems = mapEngine.GetNearbyMapItems(c.MyCharacter.X, c.MyCharacter.Y);

            byte[] bufferSendShowMap = PacketManager.SendShowMap();
            c.Send(bufferSendShowMap);

            byte[] bufferSendSpawn10 = PacketManager.SendSpawn10(c.MyCharacter);
            // c.Send(bufferSendSpawn10);
            SendSpecific(nearbyClients, bufferSendSpawn10);

            for (int i = 0; i < nearbyClients.Length; i++)
            {
                if (nearbyClients[i].MyCharacter.CharacterId != c.MyCharacter.CharacterId)
                {
                    byte[] bufferSendMeToThem = PacketManager.SendSpawnPlayers(c.MyCharacter);
                    nearbyClients[i].Send(bufferSendMeToThem);

                    byte[] bufferSendPlayers = PacketManager.SendSpawnPlayers(nearbyClients[i].MyCharacter);
                    c.Send(bufferSendPlayers);
                }
            }

            for (int i = 0; i < nearbyMapItems.Length; i++)
            {
                byte[] bufferSendMapItems = PacketManager.SendItemOnGround(nearbyMapItems[i]);
                c.Send(bufferSendMapItems);
            }

            // this should send everything in range, players,monsters etc
            byte[] bufferSendSpawn12 = PacketManager.SendSpawn12(nearbyClients);
            c.Send(bufferSendSpawn12);

            Npc[] nearbyNpcs = mapEngine.GetNearbyNpcs(c.MyCharacter);

            byte[] bufferSendNpcList = PacketManager.SendSpawnNpc(nearbyNpcs.Cast<Npc>().ToList(), c.Map.MapID);
            c.Send(bufferSendNpcList);
        }
コード例 #3
0
        void c_ClientSpawnLoadInfo(object sender, ClientSpawnLoadEventArgs e)
        {
            Client c = (Client)sender;
            SpawnRequestInfo sr = e.Info;
            MapEngine mapEngine = GetMapEngine(c.MyCharacter.MapId);
            Client[] clients = GetClientsForChars(mapEngine.GetCharactersInRange(c.MyCharacter.Position, 150).ToArray());
            MapItem[] nearbyMapItems = mapEngine.GetNearbyMapItems(c.MyCharacter);

            c.MyCharacter.Online = true;
            c.MyCharacter.Alive = true;

            byte[] bufferSendShowMap = PacketManager.SendShowMap();
            c.Send(bufferSendShowMap);

            byte[] bufferSendSpawn10 = PacketManager.SendSpawn10(c.MyCharacter);
            // c.Send(bufferSendSpawn10);
            SendToClients(bufferSendSpawn10, clients);

            for (int i = 0; i < clients.Length; i++)
            {
                if (clients[i].MyCharacter.CharacterId != c.MyCharacter.CharacterId)
                {
                    byte[] bufferSendMeToThem = PacketManager.SendSpawnPlayers(c.MyCharacter);
                    clients[i].Send(bufferSendMeToThem);

                    byte[] SendActiveSkills = PacketManager.SendPlayerActiveSkills(clients[i].MyCharacter);
                    c.Send(SendActiveSkills);

                    byte[] bufferSendPlayers = PacketManager.SendSpawnPlayers(clients[i].MyCharacter);
                    c.Send(bufferSendPlayers);

                    if (clients[i].MyCharacter.Pet != null && !clients[i].MyCharacter.Pet.IsSealed)
                    {
                        byte[] bufferSendOtherPlayerPet = PacketManager.SendPetOtherPlayerSpawn2(clients[i].MyCharacter.Pet);
                        c.Send(bufferSendOtherPlayerPet);
                    }
                }
            }

            for (int i = 0; i < nearbyMapItems.Length; i++)
            {
                byte[] bufferSendMapItems = PacketManager.SendItemOnGround(nearbyMapItems[i]);
                c.Send(bufferSendMapItems);
            }

            // this should send everything in range, players,monsters etc
            byte[] bufferSendSpawn12 = PacketManager.SendSpawn12(clients);
            c.Send(bufferSendSpawn12);

            Npc[] nearbyNpcs = mapEngine.GetNearbyNpcs(c.MyCharacter);

            if (nearbyNpcs != null)
            {
                byte[] bufferSendNpcList = PacketManager.SendSpawnNpc(nearbyNpcs.Cast<Npc>().ToList(), c.Map.MapID);
                c.Send(bufferSendNpcList);
            }
        }