Esempio n. 1
0
        public static CCharacter LoadData(int UserId, CMapleClient client)
        {
            CCharacter character = Sql.MySqlFactory.GetFactory.Query <CCharacter>().Where(a => a.Id == UserId).FirstOrDefault();


            if (character != null)
            {
                //设置上下文跟踪实体
                Sql.MySqlFactory.GetFactory.TrackEntity(character);
                client.CharacterInfo        = new CMapleCharacter(character);
                client.CharacterInfo.client = client;
                foreach (CMapleInventory inv in client.CharacterInfo.inventory)
                {
                    inv.Load(character.Id);
                }
            }

            return(character);
        }
Esempio n. 2
0
        /// <summary>
        /// 新建玩家
        /// </summary>
        /// <param name="Userid"></param>
        /// <param name="character"></param>
        /// <returns></returns>
        public static bool CreatorPlayer(int Userid, CMapleClient client, CCharacter character, Dictionary <short, int> EquipList)
        {
            CCharacter ret = Common.Sql.MySqlFactory.GetFactory.Insert <CCharacter>(character);

            if (ret != null)
            {
                //自动创建道具栏
                Common.Sql.MySqlFactory.GetFactory.Insert <CInventoryslot>(new CInventoryslot
                {
                    Chid  = ret.Id,
                    Elab  = 32,
                    Equip = 32,
                    Setup = 32,
                    Use   = 32,
                    Etc   = 32,
                    Cash  = 32,
                });

                client.CharacterInfo = new CMapleCharacter(ret);


                foreach (KeyValuePair <short, int> itmeid in EquipList)
                {
                    CItem item = new CItem();
                    item.ItemId   = itmeid.Value;
                    item.Position = itmeid.Key;
                    item.Cid      = ret.Id;
                    client.CharacterInfo.GetMapleInventory(InventoryType.佩戴).addFromDB(item);
                }
                client.CharacterInfo.GetMapleInventory(InventoryType.佩戴).SevsDB();

                return(true);
            }

            return(false);
        }
Esempio n. 3
0
 public override void SendSpawnData(CMapleClient c, MaplePakcet pakcet)
 {
     //注册玩家
     c.SendDatat(pakcet);
 }
Esempio n. 4
0
 public override void SendDestroyData(CMapleClient c, MaplePakcet pakcet)
 {
     //删除玩家
     c.SendDatat(pakcet);
 }