Example #1
0
        /// <summary>
        /// 处理拥有皇帝特效的角色死亡,而失去皇帝特效的事件
        /// </summary>
        public static void HandleDeadHuangDiRoleChanging(GameClient client)
        {
            if (null != client)
            {
                if (client.ClientData.RoleID != HuangDiRoleID)
                {
                    return;
                }

                if ((int)LingDiIDs.HuangCheng != JunQiManager.GetLingDiIDBy2MapCode(client.ClientData.MapCode))
                {
                    return;
                }

                if (!IsInHuangChengFightingTime())
                {
                    return;
                }

                //皇帝产生了
                if (!WaitingHuangChengResult)
                {
                    return;
                }
            }

            int oldHuangDiRoleID = 0;

            //先锁定互斥,防止重复安插的操作
            lock (HuangChengManager.SheLiZhiYuanMutex)
            {
                //处理提取舍利之源的操作
                oldHuangDiRoleID = HuangChengManager.ProcessTakeSheLiZhiYuan(0, "", "");
            }

            if (oldHuangDiRoleID > 0)
            {
                GameClient oldClient = GameManager.ClientMgr.FindClient(oldHuangDiRoleID);
                if (null != oldClient)
                {
                    //从buffer数据到列表删除指定的临时Buffer
                    Global.RemoveBufferData(oldClient, (int)BufferItemTypes.SheLiZhiYuan);
                }
            }

            //通知在线的所有人(不限制地图)皇帝角色ID变更消息
            GameManager.ClientMgr.NotifyAllChgHuangDiRoleIDMsg(Global._TCPManager.MySocketListener, Global._TCPManager.TcpOutPacketPool, oldHuangDiRoleID, HuangChengManager.GetHuangDiRoleID());

            //通知地图数据变更信息
            NotifyAllHuangChengMapInfoData();
        }
Example #2
0
        public static void HandleDeadHuangDiRoleChanging(GameClient client)
        {
            if (null != client)
            {
                if (client.ClientData.RoleID != HuangChengManager.HuangDiRoleID)
                {
                    return;
                }
                if (2 != JunQiManager.GetLingDiIDBy2MapCode(client.ClientData.MapCode))
                {
                    return;
                }
                if (!HuangChengManager.IsInHuangChengFightingTime())
                {
                    return;
                }
                if (!HuangChengManager.WaitingHuangChengResult)
                {
                    return;
                }
            }
            int oldHuangDiRoleID = 0;

            lock (HuangChengManager.SheLiZhiYuanMutex)
            {
                oldHuangDiRoleID = HuangChengManager.ProcessTakeSheLiZhiYuan(0, "", "", true);
            }
            if (oldHuangDiRoleID > 0)
            {
                GameClient oldClient = GameManager.ClientMgr.FindClient(oldHuangDiRoleID);
                if (null != oldClient)
                {
                    Global.RemoveBufferData(oldClient, 14);
                }
            }
            GameManager.ClientMgr.NotifyAllChgHuangDiRoleIDMsg(Global._TCPManager.MySocketListener, Global._TCPManager.TcpOutPacketPool, oldHuangDiRoleID, HuangChengManager.GetHuangDiRoleID());
            HuangChengManager.NotifyAllHuangChengMapInfoData();
        }