LKCamelot.io.IOClient.LoadPlayer C# (CSharp) Méthode

LoadPlayer() public méthode

public LoadPlayer ( ) : void
Résultat void
        public void LoadPlayer()
        {
            if (player == null || Loaded)
                return;
            Loaded = true;

            if (!LKCamelot.model.Map.FullMaps.ContainsKey(player.Map))
            {
                player.m_Map = "Rest";
                player.m_Loc = new Point2D(15, 15);
            }

            var invent = World.NewItems.Where(xe => xe.Value.ParSer == player.Serial).Select(xe => xe.Value);
            foreach (var item in invent)
            {
                item.Parent = player;
            }

            SendPacket(new LoadWorld(player, 1).Compile());

            SendPacket(new UpdateCharStats(player).Compile());
            SendPacket(new SetLevelGold(player).Compile());

            player.LoadNPCs();

            foreach (var spell in player.MagicLearned)
                SendPacket(new CreateSlotMagic2(spell).Compile());

            foreach (var item in World.NewItems.Where(xe => xe.Value.m_Parent == player || xe.Value.ParSer == player.Serial).ToList())
            {
                if (item.Value.InvSlot >= 0 && item.Value.InvSlot <= 24)
                {
                    SendPacket(new AddItemToInventory2(item.Value).Compile());
                }
                else if (item.Value.InvSlot >= 25 && item.Value.InvSlot <= 30)
                {
                    player.Equipped2.TryAdd(item.Value.InvSlot, item.Value);
                    SendPacket(new EquipItem2(item.Value).Compile());
                }
            }

            player.Map = player.Map;

            //01 05 green 
            string text = "Welcome to Last Kingdom Eclipse. ";
            SendPacket(new UpdateChatBox(0x25, 0x65, 5, (short)text.Count(), text).Compile());
            text = "Version 2.0.6. Alpha. June 26, 2013 : 12:17 UTC ";
            SendPacket(new UpdateChatBox(0x00, 0xff, 20737, (short)text.Count(), text).Compile());
            string text2 = "Dedi: Kernel=Linux 3.2.13, Ram=8.2GB, Cores=4 ";
            SendPacket(new UpdateChatBox(0x50, 0x65, 5, (short)text2.Count(), text2).Compile());
            text2 = "Code open-sourced lk.kingdomofk.net/source. ";
            SendPacket(new UpdateChatBox(0x00, 0xff, 5, (short)text2.Count(), text2).Compile());
            text2 = "Added extra exception handling to keep Trader online.";
            SendPacket(new UpdateChatBox(0x00, 0xff, 5, (short)text2.Count(), text2).Compile());
            text2 = "Added new security module called NSA.";
            SendPacket(new UpdateChatBox(0x00, 0xff, 5, (short)text2.Count(), text2).Compile());
            text2 = "It taps your data stream if you fall under suspicion.";
            SendPacket(new UpdateChatBox(0x00, 0xff, 5, (short)text2.Count(), text2).Compile());
            text2 = "To report players use @time to get the current UTC time + ";
            SendPacket(new UpdateChatBox(0x00, 0xff, 5, (short)text2.Count(), text2).Compile());
            text2 = "Then record their player name and do @bug with the info or contact a mod.";
            SendPacket(new UpdateChatBox(0x00, 0xff, 5, (short)text2.Count(), text2).Compile());
            // text2 = "@stats added. hp mp extra off 65k cap ";
            // SendPacket(new UpdateChatBox(0x00, 0xff, 5, (short)text2.Count(), text2).Compile());

            if (firstlogin)
            {
                text2 = "Welcome to the Last Kingdom! Here are some tips ";
                SendPacket(new UpdateChatBox(0x25, 0x65, 5, (short)text2.Count(), text2).Compile());
                text2 = "First @go beginner and get level 5 ";
                SendPacket(new UpdateChatBox(0x25, 0x65, 5, (short)text2.Count(), text2).Compile());
                text2 = "Next @go aron and pick a class (knight, swordman, wizard, shaman) ";
                SendPacket(new UpdateChatBox(0x25, 0x65, 5, (short)text2.Count(), text2).Compile());
                text2 = "Next checkout @go weakly and @go skel ";
                SendPacket(new UpdateChatBox(0x25, 0x65, 5, (short)text2.Count(), text2).Compile());
                text2 = "After which you can try @go level and @go item ";
                SendPacket(new UpdateChatBox(0x25, 0x65, 5, (short)text2.Count(), text2).Compile());
                text2 = "Refer to the maps in your client to find you way ";
                SendPacket(new UpdateChatBox(0x25, 0x65, 5, (short)text2.Count(), text2).Compile());
            }

            World.SendToAll(new QueDele(player.Map, new ChangeObjectSpritePlayer(player).Compile()));
        }