礼物不同种类区分

master_otnew
grimm 2024-01-09 17:25:03 +08:00
parent c738e8fc79
commit 8a9e97259b
2 changed files with 36 additions and 6 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;
@ -503,8 +502,6 @@ public class FightDataUtil {
}
SSkillLogicVo sSkillLogicVo = SSkillLogicConfig.getsSkillLogicVo(Integer.parseInt(skillId));
if (sSkillLogicVo != null && !sSkillLogicVo.getSkillTargetVoList().isEmpty()) {
Object json = JSONObject.toJSON(sSkillLogicVo);
LOGGER.info("技能信息==========={}",json.toString());
skill.rawset(1, LuaValue.valueOf(skillId));
int[][] display = sSkillLogicVo.getSkillDisplay();
int skillDisplay = display[0][0];