少年修仙传客户端代码仓库
lcy
2025-02-26 3d7382bc2c4ab9b8bb0cc498ea60f99f9d6102f2
10384 福地鼠管 防同时采集同一位道友的资源
2个文件已修改
46 ■■■■ 已修改文件
System/BlessedLand/BlessedLandManageMouseModel.cs 37 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
System/BlessedLand/BlessedLandModel.cs 9 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
System/BlessedLand/BlessedLandManageMouseModel.cs
@@ -331,6 +331,8 @@
            int nowSendCnt = 0;
            //敌对福地和周围福地已经发过包的玩家ID
            List<uint> sendPlayerIDList = new List<uint>();
            //自己福地发过包的索引位置
            List<int> sendIndexList = new List<int>();
            for (int i = 0; i < sandCntMax; i++)
            {
@@ -360,6 +362,8 @@
                                return isHas;
                            int index = mineItemsList[k];
                            var mineItem = mineAreaInfo.MineItems[index];
                            if (sendIndexList.Contains(index))
                                continue;
                            if (!MineAreaItemConfig.Has(mineItem.MineID))
                                continue;
                            MineAreaItemConfig config = MineAreaItemConfig.Get(mineItem.MineID);
@@ -369,9 +373,10 @@
                            //不是指定的矿物
                            if (itemId != config.ItemID || config.ItemLV < itemLv)
                                continue;
                            blessedLandModel.SendCB030Pack(myPlayerId, (byte)index, (byte)1, 0);
                            isHas = true;
                            nowSendCnt += 1;
                            sendIndexList.Add(index);
                            blessedLandModel.SendCB030Pack(myPlayerId, (byte)index, (byte)1, 0);
                        }
                    }
@@ -388,6 +393,10 @@
                                continue;
                            if (sendPlayerIDList.Contains(playerId))
                                continue;
                            //是否采集了这个人的其他资源
                            bool isSnatchItem = blessedLandModel.IsSnatchItem(playerId);
                            if (isSnatchItem)
                                continue;
                            var mineItems = mineAreaInfo.MineItems;
                            var mineItemsList = mineItems.Keys.ToList();
@@ -396,6 +405,8 @@
                            {
                                int index = mineItemsList[l];
                                var mineItem = mineItems[index];
                                if (sendPlayerIDList.Contains(playerId))
                                    continue;
                                if (!MineAreaItemConfig.Has(mineItem.MineID))
                                    continue;
                                MineAreaItemConfig config = MineAreaItemConfig.Get(mineItem.MineID);
@@ -405,15 +416,10 @@
                                //当前资源正在被自己或别人采集
                                if (mineItem.RobWorkerCount > 0)
                                    continue;
                                //是否采集了这个人的其他资源
                                bool isSnatchItem = blessedLandModel.IsSnatchItem(playerId);
                                if (isSnatchItem)
                                    break;
                                blessedLandModel.SendCB030Pack(playerId, (byte)index, (byte)1, 0);
                                isHas = true;
                                nowSendCnt += 1;
                                if (!sendPlayerIDList.Contains(playerId))
                                    sendPlayerIDList.Add(playerId);
                                sendPlayerIDList.Add(playerId);
                                blessedLandModel.SendCB030Pack(playerId, (byte)index, (byte)1, 0);
                                break;
                            }
                        }
@@ -432,6 +438,10 @@
                                continue;
                            if (sendPlayerIDList.Contains(playerId))
                                continue;
                            //是否采集了这个人的其他资源
                            bool isSnatchItem = blessedLandModel.IsSnatchItem(playerId);
                            if (isSnatchItem)
                                continue;
                            var mineItems = mineAreaInfo.MineItems;
                            var mineItemsList = mineItems.Keys.ToList();
                            mineItemsList.Sort((int a, int b) => SortByItemLV(playerId, a, b));
@@ -439,6 +449,8 @@
                            {
                                int index = mineItemsList[l];
                                var mineItem = mineItems[index];
                                if (sendPlayerIDList.Contains(playerId))
                                    continue;
                                if (!MineAreaItemConfig.Has(mineItem.MineID))
                                    continue;
                                MineAreaItemConfig config = MineAreaItemConfig.Get(mineItem.MineID);
@@ -448,15 +460,10 @@
                                //当前资源正在被自己或别人采集
                                if (mineItem.RobWorkerCount > 0)
                                    continue;
                                //是否采集了这个人的其他资源
                                bool isSnatchItem = blessedLandModel.IsSnatchItem(playerId);
                                if (isSnatchItem)
                                    break;
                                blessedLandModel.SendCB030Pack(playerId, (byte)index, (byte)1, 0);
                                isHas = true;
                                nowSendCnt += 1;
                                if (!sendPlayerIDList.Contains(playerId))
                                    sendPlayerIDList.Add(playerId);
                                sendPlayerIDList.Add(playerId);
                                blessedLandModel.SendCB030Pack(playerId, (byte)index, (byte)1, 0);
                                break;
                            }
                        }
System/BlessedLand/BlessedLandModel.cs
@@ -592,7 +592,7 @@
            }
        }
        //在当前这个人福地是否除了当前选中的资源以外是否有在当前这个人其他资源
        //您不能同时采集同一位道友的资源
        public bool IsSnatchItem()
        {
            var mineItems = newAreaDataDict[showPlayerId].MineItems;
@@ -600,15 +600,13 @@
            {
                if (mineItems[i].RobPlayerID == myPlayerId)
                {
                    if (mineItems[i].Index == detailsIndex)
                        continue;
                    return true;
                }
            }
            return false;
        }
        //在当前这个人福地是否除了当前选中的资源以外是否有在当前这个人其他资源
        //对象福地是否有被我正在采集中
        public bool IsSnatchItem(uint playerId)
        {
            var mineItems = newAreaDataDict[playerId].MineItems;
@@ -616,14 +614,13 @@
            {
                if (mineItems[i].RobPlayerID == myPlayerId)
                {
                    if (mineItems[i].Index == detailsIndex)
                        continue;
                    return true;
                }
            }
            return false;
        }
        //将byte[]转成int[]
        int[] ConvertByteArrayToIntArray(byte[] byteArray)
        {