|
|
|
@ -1,19 +1,19 @@
|
|
|
|
|
package com.ljsd.jieling.handler.hero;
|
|
|
|
|
|
|
|
|
|
import com.ljsd.common.mogodb.util.GlobalData;
|
|
|
|
|
import com.ljsd.jieling.core.GlobalsDef;
|
|
|
|
|
import com.ljsd.jieling.exception.ErrorCode;
|
|
|
|
|
import com.ljsd.jieling.exception.ErrorCodeException;
|
|
|
|
|
import com.ljsd.jieling.globals.BIReason;
|
|
|
|
|
import com.ljsd.jieling.handler.BaseHandler;
|
|
|
|
|
import com.ljsd.jieling.logic.dao.HeroManager;
|
|
|
|
|
import com.ljsd.jieling.logic.dao.PlayerManager;
|
|
|
|
|
import com.ljsd.jieling.logic.dao.UserManager;
|
|
|
|
|
import com.ljsd.jieling.logic.dao.root.User;
|
|
|
|
|
import com.ljsd.jieling.network.session.ISession;
|
|
|
|
|
import com.ljsd.jieling.util.ItemUtil;
|
|
|
|
|
import com.ljsd.jieling.util.MessageUtil;
|
|
|
|
|
import config.SCHero;
|
|
|
|
|
import config.SItem;
|
|
|
|
|
import config.SLikeAbilityConfig;
|
|
|
|
|
import config.SSpecialConfig;
|
|
|
|
|
import config.*;
|
|
|
|
|
import org.springframework.stereotype.Component;
|
|
|
|
|
import rpc.protocols.HeroInfoProto;
|
|
|
|
|
import rpc.protocols.MessageTypeProto;
|
|
|
|
@ -41,10 +41,10 @@ public class HeroUpLikableRequestHandler extends BaseHandler<HeroInfoProto.HeroU
|
|
|
|
|
User user = UserManager.getUser(uid);
|
|
|
|
|
HeroManager heroManager=user.getHeroManager();
|
|
|
|
|
|
|
|
|
|
if (itemNum+heroManager.getLikableSendTime()> SSpecialConfig.getIntegerValue(SSpecialConfig.LIKE_ABILITY)){
|
|
|
|
|
LOGGER.error("好感度赠送次数超出每日限制");
|
|
|
|
|
throw new ErrorCodeException(ErrorCode.REFRESH_WHEL_TIME_NOT);
|
|
|
|
|
}
|
|
|
|
|
// if (itemNum+heroManager.getLikableSendTime()> SSpecialConfig.getIntegerValue(SSpecialConfig.LIKE_ABILITY)){
|
|
|
|
|
// LOGGER.error("好感度赠送次数超出每日限制");
|
|
|
|
|
// throw new ErrorCodeException(ErrorCode.REFRESH_WHEL_TIME_NOT);
|
|
|
|
|
// }
|
|
|
|
|
int[][]costArr=new int[1][2];
|
|
|
|
|
costArr[0][0]=itemId;
|
|
|
|
|
costArr[0][1]=itemNum;
|
|
|
|
@ -70,6 +70,8 @@ public class HeroUpLikableRequestHandler extends BaseHandler<HeroInfoProto.HeroU
|
|
|
|
|
if (curAllLikaLv>oldAllLikaLv){
|
|
|
|
|
Map<Integer,Integer>allHeroPropAdd=GetAllHeroLikableAddPeop(curAllLikaLv);
|
|
|
|
|
heroManager.putAllLikablePropAddMap(allHeroPropAdd);
|
|
|
|
|
int[][]condition= SPrivilegeTypeConfig.getsPrivilegeTypeConfigMap().get(2).getCondition();
|
|
|
|
|
user.getPlayerInfoManager().updateVipPrivilage(1,condition[curAllLikaLv][1]);
|
|
|
|
|
}
|
|
|
|
|
int sendTime= heroManager.getLikableSendTime()+itemNum;
|
|
|
|
|
heroManager.UpdateLikableSendTime(sendTime);
|
|
|
|
@ -84,7 +86,7 @@ public class HeroUpLikableRequestHandler extends BaseHandler<HeroInfoProto.HeroU
|
|
|
|
|
int likaLv=0;
|
|
|
|
|
for (Map.Entry<Integer, Integer> integerEntry : SLikeAbilityConfig.heroLikeAbilityByLevel.entrySet()) {
|
|
|
|
|
if (_likaNum>=integerEntry.getValue()){
|
|
|
|
|
likaLv= integerEntry.getKey();
|
|
|
|
|
likaLv= integerEntry.getKey()+1;
|
|
|
|
|
}else{
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
@ -96,7 +98,7 @@ public class HeroUpLikableRequestHandler extends BaseHandler<HeroInfoProto.HeroU
|
|
|
|
|
int likaLv=0;
|
|
|
|
|
for (Map.Entry<Integer, Integer> integerEntry : SLikeAbilityConfig.allLikeAbilityByLevel.entrySet()) {
|
|
|
|
|
if (_likaNum>=integerEntry.getValue()){
|
|
|
|
|
likaLv= integerEntry.getKey();
|
|
|
|
|
likaLv= integerEntry.getKey()+1;
|
|
|
|
|
}else{
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
@ -107,14 +109,14 @@ public class HeroUpLikableRequestHandler extends BaseHandler<HeroInfoProto.HeroU
|
|
|
|
|
public Map<Integer,Integer>GetHeroLikableAddPeop(int _lv){
|
|
|
|
|
Map<Integer,Integer>_propMap=new HashMap<>();
|
|
|
|
|
for (int i = 0; i <= _lv; i++) {
|
|
|
|
|
SLikeAbilityConfig _config= SLikeAbilityConfig.heroLikeAbilityConfigMap.get(_lv);
|
|
|
|
|
SLikeAbilityConfig _config= SLikeAbilityConfig.heroLikeAbilityConfigMap.get(i);
|
|
|
|
|
if (_config.getProperty()==null)continue;
|
|
|
|
|
for (int[] ints : _config.getProperty()) {
|
|
|
|
|
if (_propMap.containsKey(ints[1])) {
|
|
|
|
|
int absProp=_propMap.get(ints[1])+ints[2];
|
|
|
|
|
_propMap.put(ints[1],absProp);
|
|
|
|
|
if (_propMap.containsKey(ints[0])) {
|
|
|
|
|
int absProp=_propMap.get(ints[0])+ints[1];
|
|
|
|
|
_propMap.put(ints[0],absProp);
|
|
|
|
|
}else{
|
|
|
|
|
_propMap.put(ints[1],ints[2]);
|
|
|
|
|
_propMap.put(ints[0],ints[1]);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
@ -125,9 +127,10 @@ public class HeroUpLikableRequestHandler extends BaseHandler<HeroInfoProto.HeroU
|
|
|
|
|
public Map<Integer,Integer>GetAllHeroLikableAddPeop(int _allLv){
|
|
|
|
|
Map<Integer,Integer>_propMap=new HashMap<>();
|
|
|
|
|
for (int i = 0; i <= _allLv; i++) {
|
|
|
|
|
SLikeAbilityConfig _config= SLikeAbilityConfig.allLikeAbilityConfigMap.get(_allLv);
|
|
|
|
|
SLikeAbilityConfig _config= SLikeAbilityConfig.allLikeAbilityConfigMap.get(i);
|
|
|
|
|
if (_config.getProperty()!=null){
|
|
|
|
|
for (int[] ints : _config.getProperty()) {
|
|
|
|
|
if(ints.length<=0)continue;
|
|
|
|
|
if (_propMap.containsKey(ints[0])) {
|
|
|
|
|
int absProp=_propMap.get(ints[0])+ints[1];
|
|
|
|
|
_propMap.put(ints[0],absProp);
|
|
|
|
@ -136,17 +139,6 @@ public class HeroUpLikableRequestHandler extends BaseHandler<HeroInfoProto.HeroU
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
if (_config.getPrivilegeProperty()!=null){
|
|
|
|
|
for (int[] ints : _config.getPrivilegeProperty()) {
|
|
|
|
|
if (_propMap.containsKey(ints[0])) {
|
|
|
|
|
int absProp=_propMap.get(ints[0])+ints[1];
|
|
|
|
|
_propMap.put(ints[0],absProp);
|
|
|
|
|
}else{
|
|
|
|
|
_propMap.put(ints[0],ints[1]);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
return _propMap;
|
|
|
|
|
}
|
|
|
|
@ -155,7 +147,7 @@ public class HeroUpLikableRequestHandler extends BaseHandler<HeroInfoProto.HeroU
|
|
|
|
|
public int GetAllHeroLikableNum(Map<Integer,Integer>_heroLikableMap){
|
|
|
|
|
int likableNum=0;
|
|
|
|
|
for (Map.Entry<Integer, Integer> integerEntry : _heroLikableMap.entrySet()) {
|
|
|
|
|
likableNum+=integerEntry.getKey();
|
|
|
|
|
likableNum+=integerEntry.getValue();
|
|
|
|
|
}
|
|
|
|
|
return likableNum;
|
|
|
|
|
}
|
|
|
|
|