Пример #1
0
 public static void SetPlayerActive(EPlayer eplr)
 {
     if (MapManager.GetMapFromUUID(eplr.MapUUID, out var map) && eplr.MapUUID != Guid.Empty)
     {
         EternalLand.OnlineEPlayer.ForEach(e =>
         {
             if (e != eplr)
             {
                 e.tsp.SendData(PacketTypes.PlayerActive, "", eplr.Index, map.Player.Contains(e.ID) ? 1 : 0);
                 eplr.SendData(PacketTypes.PlayerActive, "", e.Index, map.Player.Contains(e.ID) ? 1 : 0);
             }
         });
     }
     else //eplr 回到主世界
     {
         EternalLand.OnlineEPlayer.ForEach(e =>
         {
             if (e != eplr)
             {
                 e.tsp.SendData(PacketTypes.PlayerActive, "", eplr.Index, e.MapUUID == eplr.MapUUID ? 1 : 0);
                 eplr.SendData(PacketTypes.PlayerActive, "", e.Index, e.MapUUID == eplr.MapUUID ? 1 : 0);
             }
         });
     }
 }
Пример #2
0
        public static EPlayer GetEPlayerFromID(int id)
        {
            EPlayer eplr = null;

            EternalLand.OnlineEPlayer.ForEach(e => { if (e.ID == id)
                                                     {
                                                         eplr = e;
                                                     }
                                              });
            return(eplr);
        }
Пример #3
0
        public static bool TryGetEPlayeFromName(string name, out EPlayer eplr, bool offline = false)
        {
            eplr = null;
            var list = (from temp in (offline ? DataBase.GetEPlayerFuzzy(name).Result : EternalLand.OnlineEPlayer) where temp.Name == name select temp).ToList();

            if (list.Any())
            {
                eplr = list[0];
                return(true);
            }
            else
            {
                eplr = null;
                return(false);
            }
        }
Пример #4
0
        public static bool TryGetEPlayerFromID(int id, out EPlayer eplr)
        {
            eplr = null;
            var list = (from temp in EternalLand.OnlineEPlayer where temp.ID == id select temp).ToList();

            if (list.Any())
            {
                eplr = list[0];
                return(true);
            }
            else
            {
                eplr = null;
                return(false);
            }
        }
Пример #5
0
 public async static void UpdateInfoToOtherPlayers(EPlayer eplr)
 {
     await Task.Run(() =>
     {
         SetPlayerActive(eplr);
         Thread.Sleep(1000);
         if (eplr.IsInAnotherWorld)
         {
             eplr.Map.GetAllPlayers().ForEach(e =>
             {
                 if (e != eplr)
                 {
                     eplr.SendData(PacketTypes.PlayerUpdate, "", e.Index);
                     e.SendData(PacketTypes.PlayerUpdate, "", eplr.Index);
                 }
             });
             //NetMessage.SendData(13, -1, eplr.Index, null, eplr.Index);
         }
         else
         {
             EternalLand.OnlineEPlayerWhoInMainMap.ForEach(e =>
             {
                 if (e != eplr)
                 {
                     eplr.SendData(PacketTypes.PlayerUpdate, "", e.Index);
                     e.SendData(PacketTypes.PlayerUpdate, "", eplr.Index);
                 }
             });
             //NetMessage.SendData(13, -1, eplr.Index, null, eplr.Index);
         }
         SetCharacter(eplr);
         SetBag(eplr);
         SetBuff(eplr);
         Thread.Sleep(500);
     });
 }
Пример #6
0
 public static void SetCharacter(EPlayer eplr)
 {
     NetMessage.SendData(4, -1, -1, null, eplr.Index);
     NetMessage.SendData(16, -1, -1, null, eplr.Index);
     NetMessage.SendData(42, -1, -1, null, eplr.Index);
 }
Пример #7
0
 public static void SetBag(EPlayer eplr)
 {
     if (eplr.TempCharacter == new EPlayerData() || eplr.TempCharacter == null)
     {
         var plr = eplr.plr;
         int i   = 0;
         plr.inventory.ForEach(item => { EternalLand.OnlineEPlayer.ForEach(e => { if (e != eplr)
                                                                                  {
                                                                                      e.SendRawData(new RawDataWriter().SetType(PacketTypes.PlayerSlot).PackByte((byte)eplr.Index).PackInt16((short)i).PackInt16((short)item.stack).PackByte((byte)item.prefix).PackInt16((short)item.type).GetByteData());
                                                                                  }
                                                                           }); i++; });
         plr.armor.ForEach(item => { EternalLand.OnlineEPlayer.ForEach(e => { if (e != eplr)
                                                                              {
                                                                                  e.SendRawData(new RawDataWriter().SetType(PacketTypes.PlayerSlot).PackByte((byte)eplr.Index).PackInt16((short)i).PackInt16((short)item.stack).PackByte((byte)item.prefix).PackInt16((short)item.type).GetByteData());
                                                                              }
                                                                       }); i++; });
         plr.dye.ForEach(item => { EternalLand.OnlineEPlayer.ForEach(e => { if (e != eplr)
                                                                            {
                                                                                e.SendRawData(new RawDataWriter().SetType(PacketTypes.PlayerSlot).PackByte((byte)eplr.Index).PackInt16((short)i).PackInt16((short)item.stack).PackByte((byte)item.prefix).PackInt16((short)item.type).GetByteData());
                                                                            }
                                                                     }); i++; });
         plr.miscEquips.ForEach(item => { EternalLand.OnlineEPlayer.ForEach(e => { if (e != eplr)
                                                                                   {
                                                                                       e.SendRawData(new RawDataWriter().SetType(PacketTypes.PlayerSlot).PackByte((byte)eplr.Index).PackInt16((short)i).PackInt16((short)item.stack).PackByte((byte)item.prefix).PackInt16((short)item.type).GetByteData());
                                                                                   }
                                                                            }); i++; });
         plr.miscDyes.ForEach(item => { EternalLand.OnlineEPlayer.ForEach(e => { if (e != eplr)
                                                                                 {
                                                                                     e.SendRawData(new RawDataWriter().SetType(PacketTypes.PlayerSlot).PackByte((byte)eplr.Index).PackInt16((short)i).PackInt16((short)item.stack).PackByte((byte)item.prefix).PackInt16((short)item.type).GetByteData());
                                                                                 }
                                                                          }); i++; });
         plr.bank.item.ForEach(item => { EternalLand.OnlineEPlayer.ForEach(e => { if (e != eplr)
                                                                                  {
                                                                                      e.SendRawData(new RawDataWriter().SetType(PacketTypes.PlayerSlot).PackByte((byte)eplr.Index).PackInt16((short)i).PackInt16((short)item.stack).PackByte((byte)item.prefix).PackInt16((short)item.type).GetByteData());
                                                                                  }
                                                                           }); i++; });
         EternalLand.OnlineEPlayer.ForEach(e => { if (e != eplr)
                                                  {
                                                      e.SendRawData(new RawDataWriter().SetType(PacketTypes.PlayerSlot).PackByte((byte)eplr.Index).PackInt16((short)i).PackInt16((short)plr.trashItem.stack).PackByte((byte)plr.trashItem.prefix).PackInt16((short)plr.trashItem.type).GetByteData());
                                                  }
                                           }); i++;
         plr.bank2.item.ForEach(item => { EternalLand.OnlineEPlayer.ForEach(e => { if (e != eplr)
                                                                                   {
                                                                                       e.SendRawData(new RawDataWriter().SetType(PacketTypes.PlayerSlot).PackByte((byte)eplr.Index).PackInt16((short)i).PackInt16((short)item.stack).PackByte((byte)item.prefix).PackInt16((short)item.type).GetByteData());
                                                                                   }
                                                                            }); i++; });
         plr.bank3.item.ForEach(item => { EternalLand.OnlineEPlayer.ForEach(e => { if (e != eplr)
                                                                                   {
                                                                                       e.SendRawData(new RawDataWriter().SetType(PacketTypes.PlayerSlot).PackByte((byte)eplr.Index).PackInt16((short)i).PackInt16((short)item.stack).PackByte((byte)item.prefix).PackInt16((short)item.type).GetByteData());
                                                                                   }
                                                                            }); i++; });
         plr.bank4.item.ForEach(item => { EternalLand.OnlineEPlayer.ForEach(e => { if (e != eplr)
                                                                                   {
                                                                                       e.SendRawData(new RawDataWriter().SetType(PacketTypes.PlayerSlot).PackByte((byte)eplr.Index).PackInt16((short)i).PackInt16((short)item.stack).PackByte((byte)item.prefix).PackInt16((short)item.type).GetByteData());
                                                                                   }
                                                                            }); i++; });
     }
     else
     {
         var list = eplr.TempCharacter.Bag;
         for (int i = 0; i < 260; i++)
         {
             var item = list[i] ?? new EItem();
             EternalLand.OnlineEPlayer.ForEach(e =>
             {
                 if (e != eplr)
                 {
                     e.SendRawData(new RawDataWriter().SetType(PacketTypes.PlayerSlot).PackByte((byte)eplr.Index).PackInt16((short)i).PackInt16((short)item.stack).PackByte((byte)item.prefix).PackInt16((short)item.type).GetByteData());
                 }
             });
         }
     }
 }
Пример #8
0
 public static void SetBuff(EPlayer eplr)
 {
     NetMessage.SendData(50, -1, eplr.Index, null, eplr.Index);
 }