好感度脚本提交

back_recharge
yuanshuai 2021-09-26 19:43:02 +08:00
parent 4f8249150d
commit 970b3911f8
5 changed files with 26 additions and 29 deletions

View File

@ -111,6 +111,7 @@ public interface GlobalsDef {
int MAIN_LEVEL_UNLOCK_PRIVILEGE = 2;
int VIP_UNLOCK_PRIVILEGE = 3;
int RECHARGE_UNLOCK_PRIVILEGE = 4;
int LIKABLE_UNLOCK=6;
//特殊商店id
int DAILY_GOODS_FAST_ID = 1004;//每日礼包一键购买的礼包ID

View File

@ -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;
}

View File

@ -121,6 +121,7 @@ public class UserManager {
playerManager.setSendDays(1);
playerManager.updateVipInfo(GlobalsDef.LEVEL_UNLOCK_PRIVILEGE,1);
playerManager.updateVipInfo(GlobalsDef.VIP_UNLOCK_PRIVILEGE,0);
playerManager.updateVipInfo(GlobalsDef.LIKABLE_UNLOCK,0);
playerManager.setNewRechargeInfo(new NewRechargeInfo());
playerManager.setPhoneBindInfo(new PhoneBindInfo(""));
playerManager.setChannel(channel);

View File

@ -1224,6 +1224,9 @@ public class PlayerLogic {
case GlobalsDef.VIP_UNLOCK_PRIVILEGE:
cond = user.getPlayerInfoManager().getVipLevel();
break;
case GlobalsDef.LIKABLE_UNLOCK:
cond = 2;
break;
default:{
break;
}

View File

@ -7,7 +7,7 @@ import java.util.HashMap;
import java.util.Map;
import java.util.TreeMap;
@Table(name ="FourQuadrantConfig")
@Table(name ="LikeAbility")
public class SLikeAbilityConfig implements BaseConfig {
private int id;