Esempio n. 1
0
        //保存幻兽技能数据
        public static void SaveRoleData_Eudemon_MagicInfo(GameBase.Network.Internal.ROLEDATE_EUDEMON info)
        {
            MySqlCommand command;
            String       sql;

            for (int i = 0; i < info.list_item.Count; i++)
            {
                RoleData_Eudemon item = info.list_item[i];
                for (int j = 0; j < item.mListMagicInfo.Count; j++)
                {
                    GameBase.Network.Internal.MagicInfo itemex = item.mListMagicInfo[j];
                    if (itemex.id == 0)
                    {
                        sql = String.Format(MysqlString.ADD_EUDEMON_MAGIC, info.list_item[i].id, itemex.magicid, itemex.level, item.exp);
                    }
                    else if (itemex.id == -1)   //删除技能
                    {
                        sql = String.Format(MysqlString.DELETE_EUDEMON_MAGIC, itemex.magicid);
                    }
                    else
                    {
                        sql = String.Format(MysqlString.UPDATE_EUDEMON_MAGIC, itemex.magicid, itemex.level, itemex.exp, itemex.ownerid, itemex.id);
                    }
                    command = new MySqlCommand(sql, MysqlConn.GetConn());
                    MysqlConn.Conn_Open();
                    command.ExecuteNonQuery();

                    MysqlConn.Conn_Close();
                    command.Dispose();
                }
            }
        }
Esempio n. 2
0
        //载入幻兽技能数据
        public static void LoadRoleData_Eudemon_MagicInfo(GameBase.Network.Internal.ROLEDATE_EUDEMON info)
        {
            MySqlCommand command;

            for (int i = 0; i < info.list_item.Count; i++)
            {
                RoleData_Eudemon item = info.list_item[i];
                String           _key = String.Format(MysqlString.LOADROLEDATA_EUDEMON_MAGIC, item.id);
                command = new MySqlCommand(_key, MysqlConn.GetConn());
                MysqlConn.Conn_Open();
                MySqlDataReader reader = command.ExecuteReader();
                while (reader.Read())
                {
                    if (!reader.HasRows)
                    {
                        break;
                    }
                    GameBase.Network.Internal.MagicInfo itemex = new GameBase.Network.Internal.MagicInfo();
                    itemex.id      = reader.GetInt32("id");
                    itemex.ownerid = reader.GetInt32("ownerid");
                    itemex.magicid = reader.GetUInt32("magicid");
                    itemex.exp     = reader.GetUInt32("level");
                    item.mListMagicInfo.Add(itemex);
                }
                MysqlConn.Conn_Close();
                command.Dispose();
            }
        }
Esempio n. 3
0
        //保存幻兽数据
        public static void SaveRoleData_Eudemon(GameBase.Network.Internal.ROLEDATE_EUDEMON info)
        {
            String       sql = "";
            MySqlCommand command;

            for (int i = 0; i < info.list_item.Count; i++)
            {
                RoleData_Eudemon item = info.list_item[i];
                item.name = Coding.GB2312ToLatin1(item.name);
                if (item.id == 0) //不存在就插入
                {
                    sql = String.Format(MysqlString.SAVEROLEDATA_EUDEMON, item.itemid, info.playerid, item.name, item.phyatk_grow_rate, item.phyatk_grow_rate_max, item.magicatk_grow_rate,
                                        item.magicatk_grow_rate_max, item.life_grow_rate, item.defense_grow_rate, item.magicdef_grow_rate, item.init_life, item.init_atk_min, item.init_atk_max, item.init_magicatk_min, item.init_magicatk_max, item.init_defense, item.init_magicdef, item.luck,
                                        item.intimacy, item.level, item.card, item.exp, item.quality, item.wuxing, item.recall_count);
                }
                else
                {
                    sql = String.Format(MysqlString.UPDATEROLEDATA_EUDEMON, item.itemid, info.playerid, item.name, item.phyatk_grow_rate, item.phyatk_grow_rate_max, item.magicatk_grow_rate,
                                        item.magicatk_grow_rate_max, item.life_grow_rate, item.defense_grow_rate, item.magicdef_grow_rate, item.init_life, item.init_atk_min, item.init_atk_max, item.init_magicatk_min, item.init_magicatk_max, item.init_defense, item.init_magicdef, item.luck,
                                        item.intimacy, item.level, item.card, item.exp, item.quality, item.wuxing, item.recall_count, item.id);
                }

                command = new MySqlCommand(sql, MysqlConn.GetConn());
                MysqlConn.Conn_Open();
                command.ExecuteNonQuery();
                MysqlConn.Conn_Close();
                command.Dispose();

                //如果是插入- 取出主键- 要用于存储幻兽技能
                if (item.id == 0)
                {
                    String _key = "select max(id) from cq_eudemon";
                    command = new MySqlCommand(_key, MysqlConn.GetConn());
                    MysqlConn.Conn_Open();
                    MySqlDataReader reader = command.ExecuteReader();
                    uint            ret    = 0;
                    reader.Read();
                    if (reader.HasRows)
                    {
                        ret = Convert.ToUInt32(reader[0].ToString());
                    }
                    item.id = ret;
                    MysqlConn.Conn_Close();
                    command.Dispose();
                }
            }
            SaveRoleData_Eudemon_MagicInfo(info);
        }
Esempio n. 4
0
        //载入幻兽数据
        public static void LoadRoleData_Eudemon(GameBase.Network.Internal.ROLEDATE_EUDEMON info)
        {
            MySqlCommand command;
            String       _key = String.Format(MysqlString.LOADROLEDATA_EUDEMON, info.playerid);

            command = new MySqlCommand(_key, MysqlConn.GetConn());
            MysqlConn.Conn_Open();
            MySqlDataReader reader = command.ExecuteReader();

            while (reader.Read())
            {
                if (!reader.HasRows)
                {
                    break;
                }
                GameBase.Network.Internal.RoleData_Eudemon item = new GameBase.Network.Internal.RoleData_Eudemon();
                item.id                     = reader.GetUInt32("id");
                item.itemid                 = reader.GetUInt32("itemid");
                item.name                   = reader.GetString("name");
                item.name                   = Coding.Latin1ToGB2312(item.name);
                item.phyatk_grow_rate       = reader.GetFloat("phyatk_grow_rate");
                item.phyatk_grow_rate_max   = reader.GetFloat("phyatk_grow_rate_max");
                item.magicatk_grow_rate     = reader.GetFloat("magicatk_grow_rate");
                item.magicatk_grow_rate_max = reader.GetFloat("magicatk_grow_rate_max");
                item.life_grow_rate         = reader.GetFloat("life_grow_rate");
                item.defense_grow_rate      = reader.GetFloat("defense_grow_rate");
                item.magicdef_grow_rate     = reader.GetFloat("magicdef_grow_rate");
                item.init_life              = reader.GetInt32("life");
                item.init_atk_min           = reader.GetInt32("atk_min");
                item.init_atk_max           = reader.GetInt32("atk_max");
                item.init_magicatk_min      = reader.GetInt32("magicatk_min");
                item.init_magicatk_max      = reader.GetInt32("magicatk_max");
                item.init_defense           = reader.GetInt32("defense");
                item.init_magicdef          = reader.GetInt32("magicdef");
                item.luck                   = reader.GetInt32("luck");
                item.intimacy               = reader.GetInt32("intimacy");
                item.level                  = reader.GetInt16("level");
                item.card                   = reader.GetInt32("card");
                item.exp                    = reader.GetInt32("exp");
                item.quality                = reader.GetInt32("quality");
                item.wuxing                 = reader.GetInt32("wuxing");
                item.recall_count           = reader.GetInt32("recall_count");
                info.list_item.Add(item);
            }
            MysqlConn.Conn_Close();
            command.Dispose();
            LoadRoleData_Eudemon_MagicInfo(info);
        }
Esempio n. 5
0
        public void ProcessDBNetMsg()
        {
            if (!mbConnect && System.Environment.TickCount - mnReconnectTick > 5000)//五秒重连
            {
                mTcpDBClient.ReConnect();
                mnReconnectTick = System.Environment.TickCount;
            }
            byte[] buff = null;
            lock (_lock)
            {
                buff = mDBPacket.GetData();
            }

            if (buff == null)
            {
                return;
            }
            PackIn inpack = new PackIn(buff);
            ushort param  = inpack.ReadUInt16();

            switch (param)
            {
            case GameBase.Network.Internal.Define.ROLEINFO:
            {
                GameBase.Network.Internal.RoleInfo roleinfo = new GameBase.Network.Internal.RoleInfo(buff);
                //判断是否有缓存数据-
                PlayerObject cacheplay = UserEngine.Instance().GetCachePlay(roleinfo.sAccount);
                if (cacheplay != null)
                {
                    Log.Instance().WriteLog("检测到角色缓存数据,保存中!" + cacheplay.GetName());
                    UserEngine.Instance().RemoveCachePlay(cacheplay);
                    cacheplay.ExitGame();
                    return;
                }
                UserEngine.Instance().AddTempPlayObject(roleinfo);

                //回发给dbserver 表示收到了角色信息- 让他通知loginserver 发数据给玩家连接mapserver
                GameBase.Network.Internal.RoleInfo_Ret ret = new GameBase.Network.Internal.RoleInfo_Ret();
                ret.gameid    = roleinfo.gameid;
                ret.key       = roleinfo.mKey;
                ret.key2      = roleinfo.mKey1;
                ret.accountid = roleinfo.accountid;
                mTcpDBClient.SendData(ret.GetBuffer());
                Log.Instance().WriteLog("收到临时角色信息:" + roleinfo.sAccount + " id:" + roleinfo.accountid.ToString());
                break;
            }

            case GameBase.Network.Internal.Define.QUERYROLENAME_RET:
            {
                QueryRoleName_Ret ret = new QueryRoleName_Ret();
                ret.Create(buff);
                TempPlayObject temp = UserEngine.Instance().GetTempPlayObj(ret.gameid);
                if (temp == null)
                {
                    Log.Instance().WriteLog("找到玩家对象..在--ProcessDBNetMsg code:2");
                    break;
                }

                NetMsg.MsgNotice notice = new NetMsg.MsgNotice();
                notice.Create(null, temp.play.GetGamePackKeyEx());
                temp.play.SendData(notice.GetQueryNameBuff(!ret.tag));

                break;
            }

            case GameBase.Network.Internal.Define.CREATEROLE_RET:
            {
                CreateRole_Ret ret = new CreateRole_Ret();
                ret.Create(buff);
                TempPlayObject temp = UserEngine.Instance().GetTempPlayObj(ret.gameid);
                if (temp == null)
                {
                    Log.Instance().WriteLog("未找到玩家对象..在--ProcessDBNetMsg code:3");
                    break;
                }


                UserEngine.Instance().RemoveTempPlayObject(ret.gameid);         //从临时列表出移除--
                //进入游戏
                temp.play.GetBaseAttr().account_id = temp.accountid;
                temp.play.GetBaseAttr().player_id  = ret.playerid;
                temp.play.EnterGame(null, true);
                break;
            }

            case GameBase.Network.Internal.Define.ADDROLEDATA_ITEM_RET:
            {
                GameBase.Network.Internal.AddRoleData_Item_Ret ret = new GameBase.Network.Internal.AddRoleData_Item_Ret();
                ret.Create(buff);
                PlayerObject play = UserEngine.Instance().FindPlayerObjectToID(ret.gameid);
                if (play == null)
                {
                    Log.Instance().WriteLog("未找到玩家对象..在--ProcessDBNetMsg code:4");
                    break;
                }
                play.GetItemSystem().AwardItem_Ret(ret.sordid, ret.id);
                break;
            }

            case GameBase.Network.Internal.Define.LOADROLEDATA_ITEM:
            {
                GameBase.Network.Internal.ROLEDATA_ITEM item = new GameBase.Network.Internal.ROLEDATA_ITEM();
                item.Create(buff);
                TempPlayObject play = UserEngine.Instance().GetTempPlayObj(item.key, item.key2);
                if (play == null)
                {
                    Log.Instance().WriteLog("未找到玩家对象..在--ProcessDBNetMsg code:5");
                    break;
                }
                for (int i = 0; i < item.mListItem.Count; i++)
                {
                    play.play.GetItemSystem().AddItemInfo(item.mListItem[i]);
                }
                break;
            }

            case GameBase.Network.Internal.Define.LOADROLEDATA_MAGIC:
            {
                GameBase.Network.Internal.RoleData_Magic magic = new GameBase.Network.Internal.RoleData_Magic();
                magic.Create(buff);
                TempPlayObject play = UserEngine.Instance().GetTempPlayObj(magic.key, magic.key2);
                if (play == null)
                {
                    Log.Instance().WriteLog("未找到玩家对象..在--ProcessDBNetMsg code:6");
                    break;
                }
                for (int i = 0; i < magic.mListMagic.Count; i++)
                {
                    GameBase.Network.Internal.MagicInfo info = magic.mListMagic[i];
                    play.play.GetMagicSystem().AddMagicInfo(info);
                }

                break;
            }

            case GameBase.Network.Internal.Define.KICKGAMEPLAY:
            {
                GameBase.Network.Internal.KickGamePlay kickplay = new GameBase.Network.Internal.KickGamePlay();
                kickplay.Create(buff);
                PlayerObject play = UserEngine.Instance().FindPlayerObjectToAccountId(kickplay.accountid);
                if (play != null)
                {
                    SessionManager.Instance().RemoveSession(play.GetGameSession().m_Socket);
                    play.Kick();
                }
                break;
            }

            case GameBase.Network.Internal.Define.LOADROLEDATA_EUDEMON:
            {
                GameBase.Network.Internal.ROLEDATE_EUDEMON eudemon = new GameBase.Network.Internal.ROLEDATE_EUDEMON();
                eudemon.Create(buff);

                TempPlayObject play = UserEngine.Instance().GetTempPlayObj(eudemon.key, eudemon.key2);
                if (play == null)
                {
                    //只是为了下断点后延迟问题解决方案
                    PlayerObject _play = UserEngine.Instance().FindPlayerObjectToPlayerId(eudemon.playerid);
                    if (_play == null)
                    {
                        Log.Instance().WriteLog("未找到玩家对象..在--ProcessDBNetMsg code:6");
                    }
                    else
                    {
                        _play.GetEudemonSystem().DB_Load(eudemon);
                        _play.GetEudemonSystem().SendAllEudemonInfo();
                    }

                    break;
                }
                else
                {
                    play.play.GetEudemonSystem().DB_Load(eudemon);
                }


                break;
            }

            case GameBase.Network.Internal.Define.LOADROLEDATA_FRIEND:
            {
                GameBase.Network.Internal.ROLEDATA_FRIEND friend = new GameBase.Network.Internal.ROLEDATA_FRIEND();
                friend.Create(buff);
                TempPlayObject play = UserEngine.Instance().GetTempPlayObj(friend.key, friend.key2);
                if (play == null)
                {
                    //只是为了下断点后延迟问题解决方案
                    PlayerObject _play = UserEngine.Instance().FindPlayerObjectToPlayerId(friend.playerid);
                    if (_play == null)
                    {
                        Log.Instance().WriteLog("未找到玩家对象..在--ProcessDBNetMsg code:7");
                    }
                    else
                    {
                        _play.GetFriendSystem().DB_Load(friend);
                        _play.GetFriendSystem().SendAllFriendInfo();
                    }

                    break;
                }
                else
                {
                    play.play.GetFriendSystem().DB_Load(friend);
                }

                break;
            }

            case GameBase.Network.Internal.Define.GUANJUEDATA:     //爵位数据
            {
                GameBase.Network.Internal.GUANJUEINFO juewei = new GameBase.Network.Internal.GUANJUEINFO();
                juewei.Create(buff);
                GuanJueManager.Instance().DB_Load(juewei);
                break;
            }

            case GameBase.Network.Internal.Define.LOADLEGION:     //军团数据
            {
                GameBase.Network.Internal.LEGIONINFO info = new GameBase.Network.Internal.LEGIONINFO();
                info.Create(buff);
                LegionManager.Instance().DB_Load(info);
                break;
            }

            case GameBase.Network.Internal.Define.CREATELEGION_RET:    //创建军团返回数据
            {
                GameBase.Network.Internal.CreateLegion_Ret info = new GameBase.Network.Internal.CreateLegion_Ret();
                info.Create(buff);
                LegionManager.Instance().CreateLegion_Ret(info);
                break;
            }

            case GameBase.Network.Internal.Define.LOADPAYRECINFO:     //充值数据
            {
                GameBase.Network.Internal.PackPayRecInfo info = new GameBase.Network.Internal.PackPayRecInfo();
                info.Creaet(buff);
                PayManager.Instance().DB_Load(info);
                break;
            }
            }
        }
Esempio n. 6
0
 //保存幻兽数据
 public void DB_Save()
 {
     GameBase.Network.Internal.ROLEDATE_EUDEMON info = new GameBase.Network.Internal.ROLEDATE_EUDEMON();
     info.SetSaveTag();
     info.playerid = play.GetBaseAttr().player_id;
     foreach (RoleData_Eudemon obj in mDicEudemon.Values)
     {
         info.list_item.Add(obj);
     }
     DBServer.Instance().GetDBClient().SendData(info.GetBuffer());
 }
Esempio n. 7
0
        //数据库读取幻兽
        public void DB_Load(ROLEDATE_EUDEMON data)
        {
            for (int i = 0; i < data.list_item.Count; i++)
            {
                RoleData_Eudemon info = data.list_item[i];

                GameStruct.RoleItemInfo itemdata = play.GetItemSystem().FindItem(info.itemid);
                if (itemdata != null)
                {
                    info.typeid = itemdata.typeid;

                    mDicEudemon[info.GetTypeID()] = info;
                    //创建幻兽实例对象-
                    EudemonObject obj = new EudemonObject(info, play);
                    obj.CalcAttribute();

                    mListObj.Add(obj);
                }

            }
            //死亡幻兽删掉

            play.GetItemSystem().Process_DieEudemon();
        }
Esempio n. 8
0
        public void ProcessDBNetMsg()
        {
            if (!mbConnect && System.Environment.TickCount - mnReconnectTick > 5000)//五秒重连
            {
                mTcpDBClient.ReConnect();
                mnReconnectTick = System.Environment.TickCount;
            }
            byte[] buff = null;
            lock (_lock)
            {
                buff = mDBPacket.GetData();
            }

            if (buff == null) return;
            PackIn inpack = new PackIn(buff);
            ushort param = inpack.ReadUInt16();
            switch (param)
            {
                case GameBase.Network.Internal.Define.ROLEINFO:
                    {
                        GameBase.Network.Internal.RoleInfo roleinfo = new GameBase.Network.Internal.RoleInfo(buff);
                        //判断是否有缓存数据-
                        PlayerObject cacheplay = UserEngine.Instance().GetCachePlay(roleinfo.sAccount);
                        if (cacheplay != null)
                        {
                            Log.Instance().WriteLog("检测到角色缓存数据,保存中!" + cacheplay.GetName());
                            UserEngine.Instance().RemoveCachePlay(cacheplay);
                            cacheplay.ExitGame();
                            return;
                        }
                        UserEngine.Instance().AddTempPlayObject(roleinfo);

                        //回发给dbserver 表示收到了角色信息- 让他通知loginserver 发数据给玩家连接mapserver
                        GameBase.Network.Internal.RoleInfo_Ret ret = new GameBase.Network.Internal.RoleInfo_Ret();
                        ret.gameid = roleinfo.gameid;
                        ret.key = roleinfo.mKey;
                        ret.key2 = roleinfo.mKey1;
                        ret.accountid = roleinfo.accountid;
                        mTcpDBClient.SendData(ret.GetBuffer());
                        Log.Instance().WriteLog("收到临时角色信息:" + roleinfo.sAccount+" id:"+roleinfo.accountid.ToString());
                        break;
                    }
                case GameBase.Network.Internal.Define.QUERYROLENAME_RET:
                    {
                        QueryRoleName_Ret ret = new QueryRoleName_Ret();
                        ret.Create(buff);
                        TempPlayObject temp = UserEngine.Instance().GetTempPlayObj(ret.gameid);
                        if (temp == null)
                        {
                            Log.Instance().WriteLog("找到玩家对象..在--ProcessDBNetMsg code:2");
                            break;
                        }

                        NetMsg.MsgNotice notice = new NetMsg.MsgNotice();
                        notice.Create(null, temp.play.GetGamePackKeyEx());
                        temp.play.SendData(notice.GetQueryNameBuff(!ret.tag));

                        break;
                    }
                case GameBase.Network.Internal.Define.CREATEROLE_RET:
                    {

                        CreateRole_Ret ret = new CreateRole_Ret();
                        ret.Create(buff);
                        TempPlayObject temp = UserEngine.Instance().GetTempPlayObj(ret.gameid);
                        if (temp == null)
                        {
                            Log.Instance().WriteLog("未找到玩家对象..在--ProcessDBNetMsg code:3");
                            break;
                        }

                        UserEngine.Instance().RemoveTempPlayObject(ret.gameid); //从临时列表出移除--
                        //进入游戏
                        temp.play.GetBaseAttr().account_id = temp.accountid;
                        temp.play.GetBaseAttr().player_id = ret.playerid;
                        temp.play.EnterGame(null,true);
                        break;
                    }
                case GameBase.Network.Internal.Define.ADDROLEDATA_ITEM_RET:
                    {
                        GameBase.Network.Internal.AddRoleData_Item_Ret ret = new GameBase.Network.Internal.AddRoleData_Item_Ret();
                        ret.Create(buff);
                        PlayerObject play = UserEngine.Instance().FindPlayerObjectToID(ret.gameid);
                        if (play == null)
                        {
                            Log.Instance().WriteLog("未找到玩家对象..在--ProcessDBNetMsg code:4");
                            break;
                        }
                        play.GetItemSystem().AwardItem_Ret(ret.sordid, ret.id);
                        break;
                    }
                case GameBase.Network.Internal.Define.LOADROLEDATA_ITEM:
                    {
                        GameBase.Network.Internal.ROLEDATA_ITEM item = new GameBase.Network.Internal.ROLEDATA_ITEM();
                        item.Create(buff);
                        TempPlayObject play = UserEngine.Instance().GetTempPlayObj(item.key,item.key2);
                        if (play == null)
                        {
                            Log.Instance().WriteLog("未找到玩家对象..在--ProcessDBNetMsg code:5");
                            break;
                        }
                        for (int i = 0; i < item.mListItem.Count; i++)
                        {
                            play.play.GetItemSystem().AddItemInfo(item.mListItem[i]);
                        }
                         break;
                    }
                case GameBase.Network.Internal.Define.LOADROLEDATA_MAGIC:
                    {
                        GameBase.Network.Internal.RoleData_Magic magic = new GameBase.Network.Internal.RoleData_Magic();
                        magic.Create(buff);
                        TempPlayObject play = UserEngine.Instance().GetTempPlayObj(magic.key, magic.key2);
                        if (play == null)
                        {
                            Log.Instance().WriteLog("未找到玩家对象..在--ProcessDBNetMsg code:6");
                            break;
                        }
                        for(int i = 0;i < magic.mListMagic.Count;i++)
                        {
                            GameBase.Network.Internal.MagicInfo info = magic.mListMagic[i];
                            play.play.GetMagicSystem().AddMagicInfo(info);
                        }

                        break;
                    }
                case GameBase.Network.Internal.Define.KICKGAMEPLAY:
                    {
                        GameBase.Network.Internal.KickGamePlay kickplay = new GameBase.Network.Internal.KickGamePlay();
                        kickplay.Create(buff);
                        PlayerObject play = UserEngine.Instance().FindPlayerObjectToAccountId(kickplay.accountid);
                        if (play != null)
                        {
                            SessionManager.Instance().RemoveSession(play.GetGameSession().m_Socket);
                            play.Kick();
                        }
                        break;
                    }
                case GameBase.Network.Internal.Define.LOADROLEDATA_EUDEMON:
                    {
                        GameBase.Network.Internal.ROLEDATE_EUDEMON eudemon = new GameBase.Network.Internal.ROLEDATE_EUDEMON();
                        eudemon.Create(buff);

                        TempPlayObject play = UserEngine.Instance().GetTempPlayObj(eudemon.key, eudemon.key2);
                        if (play == null)
                        {
                            //只是为了下断点后延迟问题解决方案
                            PlayerObject _play = UserEngine.Instance().FindPlayerObjectToPlayerId(eudemon.playerid);
                            if (_play == null)
                            {
                                Log.Instance().WriteLog("未找到玩家对象..在--ProcessDBNetMsg code:6");
                            }
                            else
                            {
                                _play.GetEudemonSystem().DB_Load(eudemon);
                                _play.GetEudemonSystem().SendAllEudemonInfo();
                            }

                            break;
                        }
                        else
                        {
                            play.play.GetEudemonSystem().DB_Load(eudemon);
                        }

                        break;
                    }
                case GameBase.Network.Internal.Define.LOADROLEDATA_FRIEND:
                    {
                        GameBase.Network.Internal.ROLEDATA_FRIEND friend = new GameBase.Network.Internal.ROLEDATA_FRIEND();
                        friend.Create(buff);
                        TempPlayObject play = UserEngine.Instance().GetTempPlayObj(friend.key, friend.key2);
                        if (play == null)
                        {
                            //只是为了下断点后延迟问题解决方案
                            PlayerObject _play = UserEngine.Instance().FindPlayerObjectToPlayerId(friend.playerid);
                            if (_play == null)
                            {
                                Log.Instance().WriteLog("未找到玩家对象..在--ProcessDBNetMsg code:7");
                            }
                            else
                            {

                                _play.GetFriendSystem().DB_Load(friend);
                                _play.GetFriendSystem().SendAllFriendInfo();
                            }

                            break;
                        }
                        else
                        {
                            play.play.GetFriendSystem().DB_Load(friend);
                        }

                        break;
                    }
                case GameBase.Network.Internal.Define.GUANJUEDATA: //爵位数据
                    {
                        GameBase.Network.Internal.GUANJUEINFO juewei = new GameBase.Network.Internal.GUANJUEINFO();
                        juewei.Create(buff);
                        GuanJueManager.Instance().DB_Load(juewei);
                        break;
                    }
                case GameBase.Network.Internal.Define.LOADLEGION: //军团数据
                    {
                        GameBase.Network.Internal.LEGIONINFO info = new GameBase.Network.Internal.LEGIONINFO();
                        info.Create(buff);
                        LegionManager.Instance().DB_Load(info);
                        break;
                    }
                case GameBase.Network.Internal.Define.CREATELEGION_RET://创建军团返回数据
                    {
                        GameBase.Network.Internal.CreateLegion_Ret info = new GameBase.Network.Internal.CreateLegion_Ret();
                        info.Create(buff);
                        LegionManager.Instance().CreateLegion_Ret(info);
                        break;
                    }
                case GameBase.Network.Internal.Define.LOADPAYRECINFO: //充值数据
                    {
                        GameBase.Network.Internal.PackPayRecInfo info = new GameBase.Network.Internal.PackPayRecInfo();
                        info.Creaet(buff);
                        PayManager.Instance().DB_Load(info);
                        break;
                    }
            }
        }
Esempio n. 9
0
 public void ProcessSaveRoleData_Eudemon(byte[] data)
 {
     GameBase.Network.Internal.ROLEDATE_EUDEMON info = new GameBase.Network.Internal.ROLEDATE_EUDEMON();
     info.Create(data);
     Data.SaveRoleData_Eudemon(info);
 }
Esempio n. 10
0
        private void ProcessQueryRole(byte[] data)
        {
            GameBase.Network.Internal.QueryRole info = new GameBase.Network.Internal.QueryRole();
            info.Create(data);
            byte   ret       = 0;
            String sAccount  = info.GetAccount();
            int    accountid = Data.QueryAccount(sAccount);

            //查询数据库是否有该角色--
            if (accountid != -1)
            {
                ret = 1;
                //-优先查询是否在线,要是在线就踢掉了--
                int mapserverindex = -1;
                if (Data.IsOnline(sAccount, ref mapserverindex))
                {
                    ret = 2;
                    //发送给mapserver踢掉该玩家,因为被挤下线了
                    GameBase.Network.Internal.KickGamePlay kickplay = new GameBase.Network.Internal.KickGamePlay();
                    kickplay.accountid = accountid;
                    SessionManager.Instance().SendMapServer(mapserverindex, kickplay.GetBuffer());
                    //设置该玩家帐号为离线状态
                    Data.SetOnlineState(accountid, -1);
                }
                if (ret == 1)
                {
                    Log.Instance().WriteLog("查询角色成功:" + sAccount + "id:" + accountid.ToString());
                    //发送给mapserver服务器
                    GameBase.Network.Internal.RoleInfo roleinfo = Data.QueryRoleInfo(accountid);
                    roleinfo.gameid   = info.gameid;
                    roleinfo.mKey     = info.key;
                    roleinfo.mKey1    = info.key2;
                    roleinfo.sAccount = sAccount;
                    SessionManager.Instance().SendMapServer(roleinfo.mapid, roleinfo.GetBuffer());

                    //如果有角色,读取角色的其他信息
                    //物品数据
                    GameBase.Network.Internal.ROLEDATA_ITEM item = new GameBase.Network.Internal.ROLEDATA_ITEM();
                    item.key      = info.key;
                    item.key2     = info.key2;
                    item.playerid = roleinfo.playerid;
                    item.SetLoadTag();
                    Data.LoadRoleData_Item(item);
                    if (item.mListItem.Count > 0) //没数据就不发了。。
                    {
                        SessionManager.Instance().SendMapServer(0, item.GetBuffer());
                    }
                    //技能数据
                    GameBase.Network.Internal.RoleData_Magic magic = new GameBase.Network.Internal.RoleData_Magic();
                    magic.SetLoadTag();
                    magic.ownerid = roleinfo.playerid;
                    magic.key     = roleinfo.mKey;
                    magic.key2    = roleinfo.mKey1;
                    Data.LoadRoleData_Magic(magic);
                    if (magic.mListMagic.Count > 0)
                    {
                        SessionManager.Instance().SendMapServer(0, magic.GetBuffer());
                    }
                    //幻兽数据--
                    List <RoleData_Item> list_eudemondata = item.GetEudemonItemList();
                    if (list_eudemondata != null)
                    {
                        GameBase.Network.Internal.ROLEDATE_EUDEMON eudemon = new GameBase.Network.Internal.ROLEDATE_EUDEMON();
                        eudemon.SetLoadTag();
                        eudemon.playerid = roleinfo.playerid;
                        eudemon.key      = roleinfo.mKey;
                        eudemon.key2     = roleinfo.mKey1;
                        Data.LoadRoleData_Eudemon(eudemon);
                        SessionManager.Instance().SendMapServer(0, eudemon.GetBuffer());
                    }
                    //好友数据
                    GameBase.Network.Internal.ROLEDATA_FRIEND friend = new GameBase.Network.Internal.ROLEDATA_FRIEND();
                    friend.SetLoadTag();
                    friend.playerid = roleinfo.playerid;
                    friend.key      = roleinfo.mKey;
                    friend.key2     = roleinfo.mKey1;
                    Data.LoadRoleData_Friend(friend);
                    SessionManager.Instance().SendMapServer(0, friend.GetBuffer());
                }
                else
                {
                    Log.Instance().WriteLog("查询角色失败:" + sAccount + "id:" + accountid.ToString());
                }
            }
            if (ret == 1)
            {
                return;           //有该角色
            }
            //发送给loginserver服务器--
            GameBase.Network.Internal.QueryRole_Ret queryrole_ret = new GameBase.Network.Internal.QueryRole_Ret();
            queryrole_ret.gameid = info.gameid;
            queryrole_ret.key    = info.key;
            queryrole_ret.key2   = info.key2;
            queryrole_ret.ret    = ret;

            mTcpServer.SendData(mSocket, queryrole_ret.GetBuffer());
        }