master_ob2
parent
de1bc8de1a
commit
ee336f0110
|
@ -92,7 +92,7 @@ public class ItemUtil {
|
||||||
addCard(user, itemObj.getCardMap(), dropBuilder,reason);
|
addCard(user, itemObj.getCardMap(), dropBuilder,reason);
|
||||||
addEquip(user, itemObj.getEquipMap(), dropBuilder,reason);
|
addEquip(user, itemObj.getEquipMap(), dropBuilder,reason);
|
||||||
addSpecialMonster(user,itemObj,dropBuilder,reason);
|
addSpecialMonster(user,itemObj,dropBuilder,reason);
|
||||||
addMagicSoldier(user,itemObj.getMagicSoldierMap(),dropBuilder,reason);
|
addMagicSoldier(user,itemObj.getMagicSoldierMap(),dropBuilder);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -151,14 +151,13 @@ public class ItemUtil {
|
||||||
return dropBuilder;
|
return dropBuilder;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static int dropByMail(User user, int[][] itemArr,CommonProto.Drop.Builder dropBuilder,int reason) throws Exception {
|
// public static int dropByMail(User user, int[][] itemArr,CommonProto.Drop.Builder dropBuilder,int reason) throws Exception {
|
||||||
ItemMap itemObj = new ItemMap();
|
// ItemMap itemObj = new ItemMap();
|
||||||
|
// selectItemArr(itemArr,itemObj);
|
||||||
selectItemArr(itemArr,itemObj);
|
// int ints = addItemByMail(user, itemObj.getItemMap(), dropBuilder, reason);
|
||||||
int ints = addItemByMail(user, itemObj.getItemMap(), dropBuilder, reason);
|
// maptoAddWithOutItem(user,itemObj,dropBuilder,reason);
|
||||||
maptoAddWithOutItem(user,itemObj,dropBuilder,reason);
|
// return ints;
|
||||||
return ints;
|
// }
|
||||||
}
|
|
||||||
|
|
||||||
public static int dropByMail(User user, long[][] itemArr,CommonProto.Drop.Builder dropBuilder,int reason) throws Exception {
|
public static int dropByMail(User user, long[][] itemArr,CommonProto.Drop.Builder dropBuilder,int reason) throws Exception {
|
||||||
ItemMap itemObj = new ItemMap();
|
ItemMap itemObj = new ItemMap();
|
||||||
|
@ -304,7 +303,7 @@ public class ItemUtil {
|
||||||
return getReward(itemObj);
|
return getReward(itemObj);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static String getMailRewardLong (List<long[][]> itemArrs) throws Exception {
|
public static String getMailRewardLong (List<long[][]> itemArrs) {
|
||||||
ItemMap itemObj = new ItemMap();
|
ItemMap itemObj = new ItemMap();
|
||||||
for(long[][] itemArr : itemArrs){
|
for(long[][] itemArr : itemArrs){
|
||||||
selectLongItemArr(itemArr,itemObj);
|
selectLongItemArr(itemArr,itemObj);
|
||||||
|
@ -322,9 +321,14 @@ public class ItemUtil {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 主线挂机奖励
|
* 主线挂机奖励
|
||||||
* @throws ErrorCodeException
|
|
||||||
*/
|
*/
|
||||||
public static void combineRewardByMainLine(User user,boolean isLoop,boolean fiexdOrRandom, int[] dropGroupIds,int time,ItemMap itemObj,int reason)throws ErrorCodeException{
|
public static void combineRewardByMainLine(User user,boolean isLoop,boolean fiexdOrRandom, int[] dropGroupIds,int time,ItemMap itemObj,int reason)throws ErrorCodeException{
|
||||||
|
combineReward(user, fiexdOrRandom, dropGroupIds, time, itemObj);
|
||||||
|
// 特权加成奖励
|
||||||
|
extraAddItem(user,itemObj.getItemMap(),reason);
|
||||||
|
}
|
||||||
|
|
||||||
|
private static void combineReward(User user, boolean fiexdOrRandom, int[] dropGroupIds, int time, ItemMap itemObj) throws ErrorCodeException {
|
||||||
for (int id:dropGroupIds){
|
for (int id:dropGroupIds){
|
||||||
SRewardGroup sRewardGroup = SRewardGroup.getsRewardItemMap().get(id);
|
SRewardGroup sRewardGroup = SRewardGroup.getsRewardItemMap().get(id);
|
||||||
// 次数
|
// 次数
|
||||||
|
@ -345,38 +349,16 @@ public class ItemUtil {
|
||||||
combineRewardDropGroup(user, new int[]{id}, 1,itemObj);
|
combineRewardDropGroup(user, new int[]{id}, 1,itemObj);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// 特权加成奖励
|
|
||||||
extraAddItem(user,itemObj.getItemMap(),reason);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 主线挂机奖励,避免循环
|
* 主线挂机奖励,避免循环
|
||||||
* @throws ErrorCodeException
|
|
||||||
*/
|
*/
|
||||||
public static void combineRewardByMainLine(User user,boolean isLoop,boolean fiexdOrRandom, List<int[][]> groupList,ItemMap itemObj,int reason)throws ErrorCodeException{
|
public static void combineRewardByMainLine(User user,boolean isLoop,boolean fiexdOrRandom, List<int[][]> groupList,ItemMap itemObj,int reason)throws ErrorCodeException{
|
||||||
for (int[][] list : groupList) {
|
for (int[][] list : groupList) {
|
||||||
int[] groups = list[0];
|
int[] groups = list[0];
|
||||||
int time = list[1][0];
|
int time = list[1][0];
|
||||||
for (int id:groups){
|
combineReward(user, fiexdOrRandom, groups, time, itemObj);
|
||||||
SRewardGroup sRewardGroup = SRewardGroup.getsRewardItemMap().get(id);
|
|
||||||
// 次数
|
|
||||||
long num = time / sRewardGroup.getDrapRate();
|
|
||||||
// 基础奖励和随机奖励
|
|
||||||
if (fiexdOrRandom){
|
|
||||||
combineRewardDropGroup(user, new int[]{id}, num,itemObj);
|
|
||||||
}else {
|
|
||||||
while (num-->0){
|
|
||||||
combineRewardDropGroup(user, new int[]{id}, 1,itemObj);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
// 不足掉落的时间,看脸随机
|
|
||||||
int remainder = time % sRewardGroup.getDrapRate();
|
|
||||||
// 1-掉落时间,随机数值
|
|
||||||
int random = MathUtils.random(1, sRewardGroup.getDrapRate());
|
|
||||||
if (random <= remainder){
|
|
||||||
combineRewardDropGroup(user, new int[]{id}, 1,itemObj);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
// 特权加成奖励
|
// 特权加成奖励
|
||||||
extraAddItem(user,itemObj.getItemMap(),reason);
|
extraAddItem(user,itemObj.getItemMap(),reason);
|
||||||
|
@ -404,9 +386,9 @@ public class ItemUtil {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void combineReward(int[][] itemArr,ItemMap itemObj)throws ErrorCodeException{
|
// public static void combineReward(int[][] itemArr,ItemMap itemObj) {
|
||||||
selectItemArr(itemArr,itemObj);
|
// selectItemArr(itemArr,itemObj);
|
||||||
}
|
// }
|
||||||
|
|
||||||
public static void drop(User user,CommonProto.Drop.Builder dropBuilder,ItemMap itemObj,int reason) throws Exception {
|
public static void drop(User user,CommonProto.Drop.Builder dropBuilder,ItemMap itemObj,int reason) throws Exception {
|
||||||
// useRandomItem(user, randomMap, reason);
|
// useRandomItem(user, randomMap, reason);
|
||||||
|
@ -450,19 +432,19 @@ public class ItemUtil {
|
||||||
return reward.toString();
|
return reward.toString();
|
||||||
}
|
}
|
||||||
|
|
||||||
private static void selectItemArr(int[][] itemArr,ItemMap itemObj) throws ErrorCodeException{
|
private static void selectItemArr(int[][] itemArr,ItemMap itemObj) {
|
||||||
for (int[] items : itemArr){
|
for (int[] items : itemArr){
|
||||||
getMap(items[0],items[1],itemObj,1);
|
getMap(items[0],items[1],itemObj,1);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private static void selectItemArr(int[][] itemArr,ItemMap itemObj,float count) throws ErrorCodeException{
|
private static void selectItemArr(int[][] itemArr,ItemMap itemObj,float count) {
|
||||||
for (int[] items : itemArr){
|
for (int[] items : itemArr){
|
||||||
getMap(items[0],items[1],itemObj,count);
|
getMap(items[0],items[1],itemObj,count);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private static void selectLongItemArr(long[][] itemArr,ItemMap itemObj) throws ErrorCodeException{
|
private static void selectLongItemArr(long[][] itemArr,ItemMap itemObj) {
|
||||||
for (long[] items : itemArr){
|
for (long[] items : itemArr){
|
||||||
getMap((int)items[0],items[1],itemObj,1);
|
getMap((int)items[0],items[1],itemObj,1);
|
||||||
}
|
}
|
||||||
|
@ -511,7 +493,7 @@ public class ItemUtil {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private static void getSuccessivelyRandmoMap(User user,SRewardGroup sRewardGroup, String[] rewardArr, String[] weightArr,ItemMap itemObj, float dropRatio) throws ErrorCodeException {
|
private static void getSuccessivelyRandmoMap(User user,SRewardGroup sRewardGroup, String[] rewardArr, String[] weightArr,ItemMap itemObj, float dropRatio) {
|
||||||
for (int i = 0; i < sRewardGroup.getRewardMaxNum(); i++) {
|
for (int i = 0; i < sRewardGroup.getRewardMaxNum(); i++) {
|
||||||
int id = 0;
|
int id = 0;
|
||||||
for (int j = 0; j < sRewardGroup.getLoop(); j++) {
|
for (int j = 0; j < sRewardGroup.getLoop(); j++) {
|
||||||
|
@ -534,7 +516,7 @@ public class ItemUtil {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private static void getRandomMap(User user,int randomItemNum ,String[] rewardArr,String[] weightArr,ItemMap itemObj,float dropRatio)throws ErrorCodeException {
|
private static void getRandomMap(User user,int randomItemNum ,String[] rewardArr,String[] weightArr,ItemMap itemObj,float dropRatio) {
|
||||||
for (int i = 0 ; i < randomItemNum;i++){
|
for (int i = 0 ; i < randomItemNum;i++){
|
||||||
int index = MathUtils.randomForStrArray(weightArr);
|
int index = MathUtils.randomForStrArray(weightArr);
|
||||||
if (index == -1) {
|
if (index == -1) {
|
||||||
|
@ -563,19 +545,18 @@ public class ItemUtil {
|
||||||
}
|
}
|
||||||
|
|
||||||
int[] randomResult = MathUtils.randomFromWeightWithTaking(randomArray,randomItemNum);
|
int[] randomResult = MathUtils.randomFromWeightWithTaking(randomArray,randomItemNum);
|
||||||
for (int i = 0 ; i < randomResult.length;i++){
|
for (int j : randomResult) {
|
||||||
SRewardItem sRewardItem = SRewardItem.getsDropMap().get(randomResult[i]);
|
SRewardItem sRewardItem = SRewardItem.getsDropMap().get(j);
|
||||||
int itemNum = getItemNum(user,sRewardItem);
|
int itemNum = getItemNum(user, sRewardItem);
|
||||||
if (itemNum <= 0){
|
if (itemNum <= 0) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
getMap(sRewardItem.getItemId(),itemNum, itemObj,dropRatio);
|
getMap(sRewardItem.getItemId(), itemNum, itemObj, dropRatio);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 成长百分比
|
* 成长百分比
|
||||||
* @return
|
|
||||||
*/
|
*/
|
||||||
private static int getItemNum(User user,SRewardItem sRewardItem) {
|
private static int getItemNum(User user,SRewardItem sRewardItem) {
|
||||||
int itemNum ;
|
int itemNum ;
|
||||||
|
@ -598,7 +579,7 @@ public class ItemUtil {
|
||||||
return itemNum;
|
return itemNum;
|
||||||
}
|
}
|
||||||
|
|
||||||
private static void getMap(User user,int[] itemInfo,ItemMap itemObj,float dropRatio) throws ErrorCodeException{
|
private static void getMap(User user,int[] itemInfo,ItemMap itemObj,float dropRatio) {
|
||||||
for (int id :itemInfo){
|
for (int id :itemInfo){
|
||||||
SRewardItem sRewardItem = SRewardItem.getsDropMap().get(id);
|
SRewardItem sRewardItem = SRewardItem.getsDropMap().get(id);
|
||||||
int itemNum = getItemNum(user,sRewardItem);
|
int itemNum = getItemNum(user,sRewardItem);
|
||||||
|
@ -691,17 +672,14 @@ public class ItemUtil {
|
||||||
}
|
}
|
||||||
|
|
||||||
private static void putCountMap(int itemId,int itemNum, Map<Integer, Integer> map) {
|
private static void putCountMap(int itemId,int itemNum, Map<Integer, Integer> map) {
|
||||||
map.merge(itemId, itemNum, (a, b) -> b + a);
|
map.merge(itemId, itemNum, Integer::sum);
|
||||||
}
|
}
|
||||||
private static void putCountLongMap(int itemId,long itemNum, Map<Integer, Long> map) {
|
private static void putCountLongMap(int itemId,long itemNum, Map<Integer, Long> map) {
|
||||||
map.merge(itemId, itemNum, (a, b) -> b + a);
|
map.merge(itemId, itemNum, Long::sum);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 添加道具
|
* 添加道具
|
||||||
* @param user
|
|
||||||
* @param itemMap
|
|
||||||
* @throws Exception
|
|
||||||
*/
|
*/
|
||||||
public static void addItem(User user, Map<Integer, Long> itemMap,CommonProto.Drop.Builder dropBuilder,int reason) throws Exception {
|
public static void addItem(User user, Map<Integer, Long> itemMap,CommonProto.Drop.Builder dropBuilder,int reason) throws Exception {
|
||||||
addItemByMail(user,itemMap,dropBuilder,reason);
|
addItemByMail(user,itemMap,dropBuilder,reason);
|
||||||
|
@ -709,9 +687,6 @@ public class ItemUtil {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 添加道具
|
* 添加道具
|
||||||
* @param user
|
|
||||||
* @param itemMap
|
|
||||||
* @throws Exception
|
|
||||||
*/
|
*/
|
||||||
public static int addItemByMail(User user, Map<Integer, Long> itemMap,CommonProto.Drop.Builder dropBuilder,int reason) throws Exception {
|
public static int addItemByMail(User user, Map<Integer, Long> itemMap,CommonProto.Drop.Builder dropBuilder,int reason) throws Exception {
|
||||||
if (itemMap.isEmpty()) {
|
if (itemMap.isEmpty()) {
|
||||||
|
@ -856,9 +831,6 @@ public class ItemUtil {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 发送装备图鉴修改推送
|
* 发送装备图鉴修改推送
|
||||||
* @param _uid
|
|
||||||
* @param _itemManage
|
|
||||||
* @param _equipList
|
|
||||||
*/
|
*/
|
||||||
private static void SendEquipBookIndication(int _uid,ItemManager _itemManage, List<Integer>_equipList){
|
private static void SendEquipBookIndication(int _uid,ItemManager _itemManage, List<Integer>_equipList){
|
||||||
if (_equipList==null||_equipList.isEmpty())return;
|
if (_equipList==null||_equipList.isEmpty())return;
|
||||||
|
@ -979,7 +951,6 @@ public class ItemUtil {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 孙龙宝藏升级 //zsx 保留 TODO 由事件分发到 Activitylogic 去处理
|
* 孙龙宝藏升级 //zsx 保留 TODO 由事件分发到 Activitylogic 去处理
|
||||||
* @param user
|
|
||||||
*/
|
*/
|
||||||
public static void treasureLevelUp(User user) throws Exception {
|
public static void treasureLevelUp(User user) throws Exception {
|
||||||
|
|
||||||
|
@ -992,7 +963,7 @@ public class ItemUtil {
|
||||||
if (levelConfig != null) {
|
if (levelConfig != null) {
|
||||||
//需要先确定下每级真实需要的经验,与客户端实现方式同步,认为表里填的升到下一级所需经验是前边各级经验总和
|
//需要先确定下每级真实需要的经验,与客户端实现方式同步,认为表里填的升到下一级所需经验是前边各级经验总和
|
||||||
int[][] integral = levelConfig.getIntegral();
|
int[][] integral = levelConfig.getIntegral();
|
||||||
if(integral==null||integral.length<=0||integral[0].length<=0){
|
if(integral==null|| integral.length == 0 || integral[0].length == 0){
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
STreasureSunlongConfig lastLevelConfig = STreasureSunlongConfig.levelTreasureConfigMap.get(activity.getId()).get(levelConfig.getLevel() - 1);
|
STreasureSunlongConfig lastLevelConfig = STreasureSunlongConfig.levelTreasureConfigMap.get(activity.getId()).get(levelConfig.getLevel() - 1);
|
||||||
|
@ -1113,12 +1084,6 @@ public class ItemUtil {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* type = 1获得 2 消耗
|
* type = 1获得 2 消耗
|
||||||
* @param user
|
|
||||||
* @param itemId
|
|
||||||
* @param itemNum
|
|
||||||
* @param type
|
|
||||||
* @param reason
|
|
||||||
* @throws Exception
|
|
||||||
*/
|
*/
|
||||||
public static void baseItemReport(User user,int itemId,int itemNum,int type,int reason) throws Exception {
|
public static void baseItemReport(User user,int itemId,int itemNum,int type,int reason) throws Exception {
|
||||||
ReportEventEnum item;
|
ReportEventEnum item;
|
||||||
|
@ -1201,9 +1166,6 @@ public class ItemUtil {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 添加装备(特指 宝器,法相等,(帽,衣,裤,鞋)基础装备算道具)
|
* 添加装备(特指 宝器,法相等,(帽,衣,裤,鞋)基础装备算道具)
|
||||||
* @param user
|
|
||||||
* @param equipMap
|
|
||||||
* @param dropBuilder
|
|
||||||
*/
|
*/
|
||||||
public static void addEquip(User user, Map<Integer,Integer> equipMap, CommonProto.Drop.Builder dropBuilder,int reason) throws Exception {
|
public static void addEquip(User user, Map<Integer,Integer> equipMap, CommonProto.Drop.Builder dropBuilder,int reason) throws Exception {
|
||||||
if (equipMap == null || equipMap.isEmpty()) {
|
if (equipMap == null || equipMap.isEmpty()) {
|
||||||
|
@ -1333,10 +1295,6 @@ public class ItemUtil {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 添加卡牌
|
* 添加卡牌
|
||||||
* @param user
|
|
||||||
* @param cardMap
|
|
||||||
* @param dropBuilder
|
|
||||||
* @throws Exception
|
|
||||||
*/
|
*/
|
||||||
public static void addCard(User user,Map<Integer,Integer> cardMap,CommonProto.Drop.Builder dropBuilder,int reason) throws Exception {
|
public static void addCard(User user,Map<Integer,Integer> cardMap,CommonProto.Drop.Builder dropBuilder,int reason) throws Exception {
|
||||||
if (cardMap.isEmpty()) {
|
if (cardMap.isEmpty()) {
|
||||||
|
@ -1410,10 +1368,8 @@ public class ItemUtil {
|
||||||
* 真充券: 只获得对应金额的妖晶和名望经验
|
* 真充券: 只获得对应金额的妖晶和名望经验
|
||||||
* 现金卡: 计入游戏内所有累计充值的活动,不计入单笔充值和直购类活动
|
* 现金卡: 计入游戏内所有累计充值的活动,不计入单笔充值和直购类活动
|
||||||
* 仙充卡(用gm扶持): 计入游戏内所有累计充值的活动和单笔充值活动,不计入直购类活动
|
* 仙充卡(用gm扶持): 计入游戏内所有累计充值的活动和单笔充值活动,不计入直购类活动
|
||||||
* @param user
|
|
||||||
* @return
|
|
||||||
*/
|
*/
|
||||||
public static boolean rmbItemHandler(User user, CommonProto.Item item) throws ErrorCodeException {
|
public static void rmbItemHandler(User user, CommonProto.Item item) throws ErrorCodeException {
|
||||||
SItem sItem = SItem.getsItemMap().get(item.getItemId());
|
SItem sItem = SItem.getsItemMap().get(item.getItemId());
|
||||||
|
|
||||||
HashSet<Integer> integers = new HashSet<>();
|
HashSet<Integer> integers = new HashSet<>();
|
||||||
|
@ -1421,7 +1377,7 @@ public class ItemUtil {
|
||||||
integers.add(GlobalItemType.DAY_TRUE_RECHARGE_JUAN);
|
integers.add(GlobalItemType.DAY_TRUE_RECHARGE_JUAN);
|
||||||
|
|
||||||
if (!rmbItemSet.contains(sItem.getItemType()) && !integers.contains(sItem.getItemType())){
|
if (!rmbItemSet.contains(sItem.getItemType()) && !integers.contains(sItem.getItemType())){
|
||||||
return false;
|
return;
|
||||||
}
|
}
|
||||||
NewRechargeInfo info = user.getPlayerInfoManager().getNewRechargeInfo();
|
NewRechargeInfo info = user.getPlayerInfoManager().getNewRechargeInfo();
|
||||||
int num = sItem.getExtraReward()[1][0];
|
int num = sItem.getExtraReward()[1][0];
|
||||||
|
@ -1440,7 +1396,6 @@ public class ItemUtil {
|
||||||
// 线下自动返利
|
// 线下自动返利
|
||||||
Poster.getPoster().dispatchEvent(new AutoRechargeBackEvent(user.getId(), (int)totalNum, GmActivityLogic.item_token));
|
Poster.getPoster().dispatchEvent(new AutoRechargeBackEvent(user.getId(), (int)totalNum, GmActivityLogic.item_token));
|
||||||
}
|
}
|
||||||
return true;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void addCard(User user,int cardId,List<CommonProto.Hero> heroList,int reason) throws Exception {
|
public static void addCard(User user,int cardId,List<CommonProto.Hero> heroList,int reason) throws Exception {
|
||||||
|
@ -1477,10 +1432,6 @@ public class ItemUtil {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 消耗道具
|
* 消耗道具
|
||||||
* @param user
|
|
||||||
* @param costItems
|
|
||||||
* @return
|
|
||||||
* @throws Exception
|
|
||||||
*/
|
*/
|
||||||
public static boolean itemCost(User user,int[][] costItems,int reason,int subReson) throws Exception {
|
public static boolean itemCost(User user,int[][] costItems,int reason,int subReson) throws Exception {
|
||||||
Map<Integer, Integer> itemMap = new HashMap<>();
|
Map<Integer, Integer> itemMap = new HashMap<>();
|
||||||
|
@ -1495,9 +1446,6 @@ public class ItemUtil {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 消耗道具
|
* 消耗道具
|
||||||
* @param user
|
|
||||||
* @return
|
|
||||||
* @throws Exception
|
|
||||||
*/
|
*/
|
||||||
public static boolean itemCost(User user,List<int[][]> itemArrs,int reason,int subReson) throws Exception {
|
public static boolean itemCost(User user,List<int[][]> itemArrs,int reason,int subReson) throws Exception {
|
||||||
Map<Integer, Integer> itemMap = new HashMap<>();
|
Map<Integer, Integer> itemMap = new HashMap<>();
|
||||||
|
@ -1630,10 +1578,6 @@ public class ItemUtil {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 使用随机物品
|
* 使用随机物品
|
||||||
* @param user
|
|
||||||
* @param randomMap
|
|
||||||
* @return
|
|
||||||
* @throws Exception
|
|
||||||
*/
|
*/
|
||||||
public static CommonProto.Drop.Builder useRandomItem(User user,Map<Integer,Integer> randomMap,int reason) throws Exception {
|
public static CommonProto.Drop.Builder useRandomItem(User user,Map<Integer,Integer> randomMap,int reason) throws Exception {
|
||||||
StringBuilder dropIds = new StringBuilder();
|
StringBuilder dropIds = new StringBuilder();
|
||||||
|
@ -1643,12 +1587,12 @@ public class ItemUtil {
|
||||||
SItem sItem = SItem.getsItemMap().get(itemId);
|
SItem sItem = SItem.getsItemMap().get(itemId);
|
||||||
int[] rewardGroup = sItem.getRewardGroup();
|
int[] rewardGroup = sItem.getRewardGroup();
|
||||||
for (int i = 0; i < itemNum; i++){
|
for (int i = 0; i < itemNum; i++){
|
||||||
for (int j = 0; j < rewardGroup.length ; j++) {
|
for (int k : rewardGroup) {
|
||||||
if (dropIds.length() == 0){
|
if (dropIds.length() == 0) {
|
||||||
dropIds = new StringBuilder();
|
dropIds = new StringBuilder();
|
||||||
dropIds.append(rewardGroup[j]);
|
dropIds.append(k);
|
||||||
}else{
|
} else {
|
||||||
dropIds.append("#").append(rewardGroup[j]);
|
dropIds.append("#").append(k);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1664,11 +1608,6 @@ public class ItemUtil {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 分解,合成 使用 道具消耗检验
|
* 分解,合成 使用 道具消耗检验
|
||||||
* @param user
|
|
||||||
* @param sItem
|
|
||||||
* @param itemNum
|
|
||||||
* @return
|
|
||||||
* @throws Exception
|
|
||||||
*/
|
*/
|
||||||
public static boolean checkCost(User user ,SItem sItem , int itemNum,int reason,int subReason) throws Exception {
|
public static boolean checkCost(User user ,SItem sItem , int itemNum,int reason,int subReason) throws Exception {
|
||||||
if (sItem == null){
|
if (sItem == null){
|
||||||
|
@ -1723,9 +1662,6 @@ public class ItemUtil {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 战斗消耗校验
|
* 战斗消耗校验
|
||||||
* @param user
|
|
||||||
* @param costItems
|
|
||||||
* @return
|
|
||||||
*/
|
*/
|
||||||
public static boolean fightItemCost(User user,int[][] costItems) throws Exception {
|
public static boolean fightItemCost(User user,int[][] costItems) throws Exception {
|
||||||
Map<Integer, Integer> itemMap = new HashMap<>();
|
Map<Integer, Integer> itemMap = new HashMap<>();
|
||||||
|
@ -1736,44 +1672,38 @@ public class ItemUtil {
|
||||||
/**
|
/**
|
||||||
* 检测卡牌和道具上限
|
* 检测卡牌和道具上限
|
||||||
* 2021-1-25:装备属于道具一种,所以不再另作处理,做默认
|
* 2021-1-25:装备属于道具一种,所以不再另作处理,做默认
|
||||||
* @param user
|
|
||||||
* @param itemArr
|
|
||||||
* @return
|
|
||||||
*/
|
*/
|
||||||
public static int checkCardAndEquipLimit( User user ,int[][] itemArr) {
|
// public static int checkCardAndEquipLimit( User user ,int[][] itemArr) {
|
||||||
int result = 0;
|
// int result = 0;
|
||||||
|
//
|
||||||
SGameSetting gameSetting = STableManager.getFigureConfig(CommonStaticConfig.class).getGameSetting();
|
// SGameSetting gameSetting = STableManager.getFigureConfig(CommonStaticConfig.class).getGameSetting();
|
||||||
Map<Integer, Integer> itemTypeMap = getItemTypeMap(itemArr);
|
// Map<Integer, Integer> itemTypeMap = getItemTypeMap(itemArr);
|
||||||
for (Map.Entry<Integer, Integer> entry : itemTypeMap.entrySet()) {
|
// for (Map.Entry<Integer, Integer> entry : itemTypeMap.entrySet()) {
|
||||||
if (entry.getKey() == GlobalItemType.CARD){
|
// if (entry.getKey() == GlobalItemType.CARD){
|
||||||
int hasHeroNum = user.getHeroManager().getHeroMap().size();
|
// int hasHeroNum = user.getHeroManager().getHeroMap().size();
|
||||||
// 英雄数量超最大上限
|
// // 英雄数量超最大上限
|
||||||
if (hasHeroNum+entry.getValue() > gameSetting.getHeroNumlimit()){
|
// if (hasHeroNum+entry.getValue() > gameSetting.getHeroNumlimit()){
|
||||||
result++;
|
// result++;
|
||||||
}
|
// }
|
||||||
}
|
// }
|
||||||
}
|
// }
|
||||||
|
//
|
||||||
// 道具校验
|
// // 道具校验
|
||||||
for(int[] ints:itemArr){
|
// for(int[] ints:itemArr){
|
||||||
Item item = user.getItemManager().getItem(ints[0]);
|
// Item item = user.getItemManager().getItem(ints[0]);
|
||||||
SItem sItem = SItem.getsItemMap().get(ints[0]);
|
// SItem sItem = SItem.getsItemMap().get(ints[0]);
|
||||||
//数量超过了
|
// //数量超过了
|
||||||
if (item!=null&&item.getItemNum()+ints[1] > sItem.getItemNumlimit()){
|
// if (item!=null&&item.getItemNum()+ints[1] > sItem.getItemNumlimit()){
|
||||||
result++;
|
// result++;
|
||||||
}
|
// }
|
||||||
}
|
// }
|
||||||
|
//
|
||||||
return result;
|
// return result;
|
||||||
}
|
// }
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 检测卡牌和道具上限
|
* 检测卡牌和道具上限
|
||||||
* 2021-1-25:装备属于道具一种,所以不再另作处理,做默认
|
* 2021-1-25:装备属于道具一种,所以不再另作处理,做默认
|
||||||
* @param user
|
|
||||||
* @param itemArr
|
|
||||||
* @return
|
|
||||||
*/
|
*/
|
||||||
public static int checkCardAndEquipLimit(User user ,long[][] itemArr) {
|
public static int checkCardAndEquipLimit(User user ,long[][] itemArr) {
|
||||||
int result = 0;
|
int result = 0;
|
||||||
|
@ -1809,25 +1739,23 @@ public class ItemUtil {
|
||||||
* @param itemArr
|
* @param itemArr
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
public static Map<Integer,Integer> getItemTypeMap(int[][] itemArr){
|
// public static Map<Integer,Integer> getItemTypeMap(int[][] itemArr){
|
||||||
Map<Integer,Integer> itemTypeMap = new HashMap<>();
|
// Map<Integer,Integer> itemTypeMap = new HashMap<>();
|
||||||
for (int[] ints : itemArr) {
|
// for (int[] ints : itemArr) {
|
||||||
int itemId = ints[0];
|
// int itemId = ints[0];
|
||||||
SItem sItem = SItem.getsItemMap().get(itemId);
|
// SItem sItem = SItem.getsItemMap().get(itemId);
|
||||||
int itemType = getItemType(sItem);
|
// int itemType = getItemType(sItem);
|
||||||
if(itemTypeMap.containsKey(itemType)){
|
// if(itemTypeMap.containsKey(itemType)){
|
||||||
itemTypeMap.put(itemType,itemTypeMap.get(itemType)+ints[1]);
|
// itemTypeMap.put(itemType,itemTypeMap.get(itemType)+ints[1]);
|
||||||
}else{
|
// }else{
|
||||||
itemTypeMap.put(itemType,ints[1]);
|
// itemTypeMap.put(itemType,ints[1]);
|
||||||
}
|
// }
|
||||||
}
|
// }
|
||||||
return itemTypeMap;
|
// return itemTypeMap;
|
||||||
}
|
// }
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 获取物品种类map
|
* 获取物品种类map
|
||||||
* @param itemArr
|
|
||||||
* @return
|
|
||||||
*/
|
*/
|
||||||
public static Map<Integer,Long> getItemTypeMap(long[][] itemArr){
|
public static Map<Integer,Long> getItemTypeMap(long[][] itemArr){
|
||||||
Map<Integer,Long> itemTypeMap = new HashMap<>();
|
Map<Integer,Long> itemTypeMap = new HashMap<>();
|
||||||
|
@ -1846,9 +1774,6 @@ public class ItemUtil {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 特权加成收益计算
|
* 特权加成收益计算
|
||||||
* @param user
|
|
||||||
* @param itemMap
|
|
||||||
* @return
|
|
||||||
*/
|
*/
|
||||||
public static void privilegeAddToMainLevelChallenge(User user, ItemMap itemMap){
|
public static void privilegeAddToMainLevelChallenge(User user, ItemMap itemMap){
|
||||||
HashMap<Integer, Long> map = new HashMap<>();
|
HashMap<Integer, Long> map = new HashMap<>();
|
||||||
|
@ -1862,10 +1787,6 @@ public class ItemUtil {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 挑战奖励加成
|
* 挑战奖励加成
|
||||||
* @param user
|
|
||||||
* @param itemId
|
|
||||||
* @param sourceNum
|
|
||||||
* @return
|
|
||||||
*/
|
*/
|
||||||
private static long challengeRewardNum(User user,int itemId,long sourceNum){
|
private static long challengeRewardNum(User user,int itemId,long sourceNum){
|
||||||
switch (itemId){
|
switch (itemId){
|
||||||
|
@ -1886,11 +1807,6 @@ public class ItemUtil {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 特权加成收益计算
|
* 特权加成收益计算
|
||||||
* @param user
|
|
||||||
* @param reason
|
|
||||||
* @param itemId
|
|
||||||
* @param sourceNum
|
|
||||||
* @return
|
|
||||||
*/
|
*/
|
||||||
public static long privilegeAdd(User user,int reason,int itemId,long sourceNum){
|
public static long privilegeAdd(User user,int reason,int itemId,long sourceNum){
|
||||||
// 基础奖励,挂机
|
// 基础奖励,挂机
|
||||||
|
@ -1906,10 +1822,6 @@ public class ItemUtil {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 挂机基础奖励加成
|
* 挂机基础奖励加成
|
||||||
* @param user
|
|
||||||
* @param itemType
|
|
||||||
* @param sourceNum
|
|
||||||
* @return
|
|
||||||
*/
|
*/
|
||||||
private static long baseReward(User user,int itemType,long sourceNum){
|
private static long baseReward(User user,int itemType,long sourceNum){
|
||||||
switch (itemType){
|
switch (itemType){
|
||||||
|
@ -1935,10 +1847,6 @@ public class ItemUtil {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 挂机随机奖励加成
|
* 挂机随机奖励加成
|
||||||
* @param user
|
|
||||||
* @param itemType
|
|
||||||
* @param sourceNum
|
|
||||||
* @return
|
|
||||||
*/
|
*/
|
||||||
private static long randomReward(User user,int itemType,long sourceNum){
|
private static long randomReward(User user,int itemType,long sourceNum){
|
||||||
switch (itemType){
|
switch (itemType){
|
||||||
|
@ -2048,13 +1956,8 @@ public class ItemUtil {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 掉落神兵
|
* 掉落神兵
|
||||||
* @param user
|
|
||||||
* @param map
|
|
||||||
* @param dropBuilder
|
|
||||||
* @param reason
|
|
||||||
* @throws Exception
|
|
||||||
*/
|
*/
|
||||||
private static void addMagicSoldier(User user,Map<Integer,Integer> map,CommonProto.Drop.Builder dropBuilder,int reason) throws Exception {
|
private static void addMagicSoldier(User user,Map<Integer,Integer> map,CommonProto.Drop.Builder dropBuilder) {
|
||||||
if(map == null || map.isEmpty()){
|
if(map == null || map.isEmpty()){
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -2064,15 +1967,6 @@ public class ItemUtil {
|
||||||
MagicSoldier soldier = new MagicSoldier(user.getId(), entry.getKey());
|
MagicSoldier soldier = new MagicSoldier(user.getId(), entry.getKey());
|
||||||
manager.setMagicSoldier(soldier);
|
manager.setMagicSoldier(soldier);
|
||||||
dropBuilder.addMagicSoldier(CBean2Proto.toBeanMagicSoldier(soldier));
|
dropBuilder.addMagicSoldier(CBean2Proto.toBeanMagicSoldier(soldier));
|
||||||
try {
|
|
||||||
// ReportUtil.onReportEvent(user,ReportEventEnum.GET_BEAST.getType(),entry.getKey(),animal.getQuality(),reason);
|
|
||||||
// if (animal.getQuality() >= SSpecialConfig.getIntegerValue(SSpecialConfig.ANIMAL_BROADCAST_QUALITY)) { //策划资质改成星级
|
|
||||||
// String nameColor = user.getPlayerInfoManager().getNameColor();
|
|
||||||
// String message = SErrorCodeEerverConfig.getI18NMessageNeedConvert("animal_get_broadcast_content",
|
|
||||||
// new Object[]{nameColor,user.getPlayerInfoManager().getNickName(), animal.getName()}, new int[]{0,0,1});
|
|
||||||
// ChatLogic.getInstance().sendSysChatMessage(message,Global.LUCKY_LUCK,"0",0,0,0,0,0);
|
|
||||||
// }
|
|
||||||
}catch (Exception e){}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue