Merge branch 'master_dev' into master_otnew

master_0.05_aqlm
grimm 2024-01-10 15:13:16 +08:00
commit deddcd6037
2 changed files with 36 additions and 4 deletions

View File

@ -578,11 +578,44 @@ public class EquipLogic {
MessageUtil.sendMessage(iSession, 1, MessageTypeProto.MessageType.GiftEquipWearResponse_VALUE, null, true);
}
public static boolean hasDuplicates(Set<Integer> list1, Set<Integer> list2) {
for (Integer element : list2) {
if (list1.contains(element)) {
/**
* id
* @param playerGift
* @param clientGift
* @return true false
*/
public static boolean hasDuplicates(Set<Integer> playerGift, Set<Integer> clientGift) {
HashSet<Integer> set = new HashSet<>(playerGift);
Map<Integer, SEquipConfig> configMap = SEquipConfig.equipConfigMap;
// 验证添加的礼物是否重复装备过
for (Integer id : clientGift) {
if (set.contains(id)){
LOGGER.error("玩家装备的礼物已装备过了 id{}",id);
return true;
}
set.add(id);
}
for (Integer nextId : set) {
SEquipConfig playerConfig = configMap.get(nextId);
if (playerConfig == null){
LOGGER.error("玩家身上有不存在配置表中的礼物id{}",nextId);
continue;
}
for (Integer id : clientGift) {
if (id.equals(nextId)){
continue;
}
SEquipConfig notConfig = configMap.get(id);
if (notConfig == null){
LOGGER.error("玩家装备的礼物不存在于配置表 id{}",id);
return true;
}
if ((notConfig.getSuiteID() != 0 && notConfig.getSuiteID() == playerConfig.getSuiteID())){
LOGGER.error("玩家装备的礼物类型配置重复 id{}",id);
return true;
}
}
}
return false;
}

View File

@ -1,6 +1,5 @@
package com.ljsd.jieling.util;
import com.alibaba.fastjson.JSONObject;
import config.*;
import manager.STableManager;
import org.luaj.vm2.LuaTable;