Esempio n. 1
0
        public static void ProcessDBNetMsg()
        {
            byte[] data = mDBPacket.GetData();
            if (data == null)
            {
                return;
            }
            PackIn inpack = new PackIn(data);
            ushort param  = inpack.ReadUInt16();

            switch (param)
            {
            case GameBase.Network.Internal.Define.QUERYROLE_RET:
            {
                uint gameid = inpack.ReadUInt32();
                int  key    = inpack.ReadInt32();
                int  key2   = inpack.ReadInt32();
                byte ret    = inpack.ReadByte();
                if (ret == 1)     //有这个帐号--
                {
                    GameSession session = FindGameSessionToGameID(gameid);
                    if (session != null)
                    {
                        //发送数据给客户端,连接mapserver
                        Log.Instance().WriteLog("通知客户端登录MapServer");
                        SendConnectMapServer(session, key, key2);
                    }
                }
                else if (ret == 2)     //重复登录,踢下线
                {
                    GameSession session = FindGameSessionToGameID(gameid);
                    if (session != null)
                    {
                        lock (_lock_session)
                        {
                            m_DicSession.Remove(session.m_Socket);
                        }

                        session.Dispose();
                    }
                }

                break;
            }
            }
        }
 public void Create(byte[] msg)
 {
     PackIn inpack = new PackIn(msg);
     inpack.ReadInt16();
     int count = inpack.ReadInt32();
     for (int i = 0; i < count; i++)
     {
         LegionInfo info = new LegionInfo();
         info.Create(inpack);
         list_item.Add(info);
     }
 }
 public void Create(PackIn inpack)
 {
     id = inpack.ReadUInt32();
     name = inpack.ReadString();
     title = inpack.ReadByte();
     leader_id = inpack.ReadInt32();
     leader_name = inpack.ReadString();
     money = inpack.ReadLong();
     notice = inpack.ReadString();
     int count = inpack.ReadInt32();
     for (int i = 0; i < count; i++)
     {
         LegionMember member = new LegionMember();
         member.Create(inpack);
         list_member.Add(member);
     }
 }
 public void Create(byte[] msg)
 {
     PackIn inpack = new PackIn(msg);
     inpack.ReadUInt16();
     accountid = inpack.ReadInt32();
 }
 public void Create(byte[] msg)
 {
     PackIn inpack = new PackIn(msg);
     inpack.ReadUInt16();
     playerid = inpack.ReadInt32();
     id = inpack.ReadUInt32();
     postion = inpack.ReadUInt16();
 }
 public void Create(byte[] data)
 {
     PackIn inpack = new PackIn(data);
     inpack.ReadUInt16();
     playerid = inpack.ReadInt32();
     gameid = inpack.ReadUInt32();
     tag = inpack.ReadBool();
 }
 public void Create(byte[] msg)
 {
     PackIn inpack = new PackIn(msg);
     inpack.ReadUInt16();
     gameid = inpack.ReadUInt32();
     key = inpack.ReadInt32();
     key2 = inpack.ReadInt32();
     ret = inpack.ReadByte();
 }
 public void Create(byte[] msg)
 {
     PackIn inpack = new PackIn(msg);
     mParam = inpack.ReadUInt16();
     gameid = inpack.ReadUInt32();
     key = inpack.ReadInt32();
     key2 = inpack.ReadInt32();
     account = inpack.ReadBuff(16);
 }
        public short y; //所在地图坐标y

        #endregion Fields

        #region Constructors

        public RoleInfo(byte[] msg = null)
        {
            mParam = Define.ROLEINFO;
            gameid = 0;
            isRole = false;
            mKey = 0;
            mKey1 = 0;
            accountid = 0;
            sAccount = "";
            name = "";
            lookface = 0;
            hair = 0;
            lv = 0;
            exp = 0;
            life = 0;
            mana = 0;
            profession = 0;
            pk = 0;
            gold = 0;
            gamegold = 0;
            mapid = 0;
            x = 0;
            y = 0;
            playerid = 0;
            hotkey = "";
            guanjue = 0;
            godlevel = 0;
            maxeudemon = 2;
            if (msg != null)
            {
                PackIn inpack = new PackIn(msg);
                mParam = inpack.ReadUInt16();
                gameid = inpack.ReadUInt32();

                mKey = inpack.ReadInt32();
                mKey1 = inpack.ReadInt32();
                accountid = inpack.ReadInt32();
                sAccount = inpack.ReadString();
                playerid = inpack.ReadInt32();
                isRole = inpack.ReadBool();
                if (isRole)
                {
                    name = inpack.ReadString();
                    lookface = inpack.ReadUInt32();
                    hair = inpack.ReadUInt32();
                    lv = inpack.ReadByte();
                    exp = inpack.ReadUInt32();
                    life = inpack.ReadUInt32();
                    mana = inpack.ReadUInt32();
                    profession = inpack.ReadByte();
                    pk = inpack.ReadInt16();
                    gold = inpack.ReadInt32();
                    gamegold = inpack.ReadInt32();
                    stronggold = inpack.ReadInt32();
                    mapid = inpack.ReadInt32();
                    x = inpack.ReadInt16();
                    y = inpack.ReadInt16();
                    hotkey = inpack.ReadString();
                    guanjue = inpack.ReadULong();
                    godlevel = inpack.ReadInt32();
                    maxeudemon = inpack.ReadByte();
                }

            }
        }
 public void Create(byte[] msg)
 {
     PackIn inpack = new PackIn(msg);
     inpack.ReadUInt16();
     playerid = inpack.ReadInt32();
     key = inpack.ReadInt32();
     key2 = inpack.ReadInt32();
     int count = inpack.ReadInt32();
     for (int i = 0; i < count; i++)
     {
         RoleData_Eudemon eudemon = new RoleData_Eudemon();
         eudemon.Create(null, inpack);
         list_item.Add(eudemon);
     }
 }
 public void Create(byte[] msg)
 {
     PackIn inpack = new PackIn(msg);
     inpack.ReadUInt16();
     ownerid = inpack.ReadInt32();
     key = inpack.ReadInt32();
     key2 = inpack.ReadInt32();
     int count = inpack.ReadInt32();
     for (int i = 0; i < count; i++)
     {
         MagicInfo item = new MagicInfo();
         item.id = inpack.ReadInt32();
         item.magicid = inpack.ReadUInt32();
         item.level = inpack.ReadByte();
         item.exp = inpack.ReadUInt32();
         mListMagic.Add(item);
     }
 }
 public void Create(byte[] msg)
 {
     PackIn inpack = new PackIn(msg);
     inpack.ReadUInt16();
     ret = inpack.ReadByte();
     play_id = inpack.ReadInt32();
     legion_id = inpack.ReadInt32();
     money = inpack.ReadInt32();
     boss_id = inpack.ReadUInt32();
 }
        public void Create(byte[] msg)
        {
            PackIn inpack = new PackIn(msg);
            inpack.ReadUInt16();

            playerid = inpack.ReadInt32();
            key = inpack.ReadInt32();
            key2 = inpack.ReadInt32();
            int count = inpack.ReadInt32();
            for (int i = 0; i < count; i++)
            {
                RoleData_Item item = new RoleData_Item();
                item.Create(null, inpack);
                //-----------------------------------------------
                //item.id = inpack.ReadUInt32();
                //item.itemid = inpack.ReadUInt32();
                //item.postion = inpack.ReadUInt16();
                //item.stronglv = inpack.ReadByte();
                //item.gemcount = inpack.ReadByte();
                //item.gem1 = inpack.ReadUInt32();
                //item.gem2 = inpack.ReadUInt32();
                //item.forgename = inpack.ReadString();
                //item.amount = inpack.ReadUInt16();

                //item.war_ghost_exp = inpack.ReadInt32();
                //item.di_attack = inpack.ReadByte();
                //item.shui_attack = inpack.ReadByte();
                //item.huo_attack = inpack.ReadByte();
                //item.feng_attack = inpack.ReadByte();
                //item.property = inpack.ReadInt32();
                //item.gem3 = inpack.ReadByte();
                //item.god_strong = inpack.ReadInt32();
                //item.god_exp = inpack.ReadInt32();
                //------------------------------------------------

                mListItem.Add(item);
            }
        }
 public void Create(byte[] msg)
 {
     PackIn inpack = new PackIn(msg);
     inpack.ReadUInt16();
     playerid = inpack.ReadInt32();
     key = inpack.ReadInt32();
     key2 = inpack.ReadInt32();
     int count = inpack.ReadInt32();
     for (int i = 0; i < count; i++)
     {
         RoleData_Friend item = new RoleData_Friend();
         item.Create(null, inpack);
         list_item.Add(item);
     }
 }
 public void Create(byte[] msg, PackIn inpack)
 {
     id = inpack.ReadInt32();
     friendtype = inpack.ReadByte();
     friendid = inpack.ReadUInt32();
     friendname = inpack.ReadString();
 }
        public void Create(byte[] msg)
        {
            PackIn inpack = new PackIn(msg);

            inpack.ReadUInt16();
            player_id = inpack.ReadInt32();
            mInfo.Create(inpack);
        }
        public void Creaet(byte[] msg)
        {
            PackIn inpack = new PackIn(msg);
            inpack.ReadInt16();
            id = inpack.ReadInt32();

            account = inpack.ReadString();
            order = inpack.ReadString();
            money = inpack.ReadInt32();
        }
        public void Create(byte[] msg)
        {
            PackIn inpack = new PackIn(msg);

            inpack.ReadUInt16();
            accountid = inpack.ReadInt32();
            IsExit = inpack.ReadBool();
            name = inpack.ReadString();
            lookface = inpack.ReadUInt32();
            hair = inpack.ReadUInt32();
            level = inpack.ReadByte();
            exp = inpack.ReadInt32();
            life = inpack.ReadUInt32();
            mana = inpack.ReadUInt32();
            profession = inpack.ReadByte();
            pk = inpack.ReadInt16();
            gold = inpack.ReadLong();
            gamegold = inpack.ReadLong();
            stronggold = inpack.ReadLong();
            mapid = inpack.ReadUInt32();
            x = inpack.ReadInt16();
            y = inpack.ReadInt16();
            hotkey = inpack.ReadString();
            guanjue = inpack.ReadULong();
            godlevel = inpack.ReadByte();
            maxeudemon = inpack.ReadByte();
        }
 public void Create(byte[] data)
 {
     PackIn inpack = new PackIn(data);
     inpack.ReadUInt16();
     gameid = inpack.ReadUInt32();
     accountid = inpack.ReadInt32();
     name = inpack.ReadString();
     lookface = inpack.ReadUInt32();
     profession = inpack.ReadByte();
 }
Esempio n. 20
0
        public void ProcessNetData(byte[] data)
        {
            byte[] dedata = new byte[data.Length];
            Buffer.BlockCopy(data, 0, dedata, 0, data.Length);
            m_stream.Write(dedata, 0, dedata.Length);
            PackIn packin  = new PackIn(m_stream.GetBuffer());
            int    nCurPos = 0; //记录当前流位置

            while (true)
            {
                ushort tag = packin.ReadUInt16();
                nCurPos += sizeof(ushort);
                if (tag != DEFAULT_TAG)
                {
                    continue;
                }
                int nLen = packin.ReadUInt16();
                nCurPos += sizeof(ushort);
                //    //预留4字节
                packin.ReadUInt32();
                nCurPos += sizeof(uint);
                //    //读取消息消耗时间
                packin.ReadInt32();
                nCurPos += sizeof(int);
                packin.ReadInt32();
                nCurPos += sizeof(int);
                if (nLen > m_stream.Length - nCurPos)     //封包不是完整的
                {
                    if (m_stream.Length == dedata.Length) //非法封包
                    {
                        m_stream.SetLength(0);
                        return;
                    }
                    break;
                }
                nCurPos += nLen;
                byte[] reData = packin.ReadBuff(nLen);
                if (reData == null || reData.Length == 0)
                {
                    break;
                }
                m_ListData.Enqueue(reData);
                if (nCurPos == m_stream.Length)
                {
                    break;
                }
            }
            int rema_Len = (int)m_stream.Length - nCurPos;

            if (rema_Len > 0)
            {
                dedata = new byte[rema_Len];
                Buffer.BlockCopy(m_stream.GetBuffer(), nCurPos, dedata, 0, rema_Len);
            }
            m_stream.SetLength(0);
            if (rema_Len > 0)
            {
                m_stream.Write(dedata, 0, dedata.Length);
            }
            return;
        }