Merge branch 'master_test_hw' of http://60.1.1.230/backend/jieling_server into master_test_hw
commit
0c8cfc0e4a
|
@ -40,6 +40,7 @@ import com.ljsd.jieling.logic.player.PlayerLogic;
|
|||
import com.ljsd.jieling.logic.rank.rankImpl.AbstractRank;
|
||||
import com.ljsd.jieling.logic.rank.RankContext;
|
||||
import com.ljsd.jieling.logic.rank.RankEnum;
|
||||
import com.ljsd.jieling.logic.store.BuyGoodsLogic;
|
||||
import com.ljsd.jieling.logic.store.StoreLogic;
|
||||
import com.ljsd.jieling.logic.store.StoreType;
|
||||
|
||||
|
@ -2160,6 +2161,12 @@ public class MapLogic {
|
|||
FightInfoProto.MainLevelFightUpdateIndication build = FightInfoProto.MainLevelFightUpdateIndication.newBuilder().setState(mainLevelManager.getState()).setFightId(mainLevelManager.getFightId()).build();
|
||||
MessageUtil.sendIndicationMessage(session,1, MessageTypeProto.MessageType.MAIN_LEVEL_FIGHT_UPDATE_INDICATION_VALUE,build,true);
|
||||
MessageUtil.sendMessage(session, 1, messageType.getNumber(), fightEndResponse.build(), true);
|
||||
|
||||
int integerValue = SSpecialConfig.getIntegerValue(SSpecialConfig.DISCOUNT_MAIN);
|
||||
if (sMainLevelConfig.getSortId() % integerValue == 0) {
|
||||
openRechargeBagIds(session, user, 25);
|
||||
}
|
||||
|
||||
// String rankKey = RedisKey.getKey(RedisKey.MAINLEVEL_RANK, "", false);
|
||||
// RedisUtil.getInstence().zsetAddOne(rankKey, String.valueOf(user.getId()), sMainLevelConfig.getVirtureId());
|
||||
RankContext.getRankEnum(RankEnum.MAIN_LEVEL_RANK.getType()).addRank(uid,"",sMainLevelConfig.getVirtureId(),user.getPlayerInfoManager().getMaxForce());
|
||||
|
@ -2167,6 +2174,46 @@ public class MapLogic {
|
|||
|
||||
}
|
||||
|
||||
/**
|
||||
* 开启礼包
|
||||
* @param session
|
||||
* @param user
|
||||
* @param type
|
||||
* @throws Exception
|
||||
*/
|
||||
public void openRechargeBagIds(ISession session, User user, int type) throws Exception {
|
||||
Map<Integer, SRechargeCommodityConfig> integerSRechargeCommodityConfigMap = SRechargeCommodityConfig.rechargeIndetions.get(type);
|
||||
if (integerSRechargeCommodityConfigMap == null || integerSRechargeCommodityConfigMap.isEmpty()) {
|
||||
return;
|
||||
}
|
||||
RechargeInfo rechargeInfo = user.getPlayerInfoManager().getRechargeInfo();
|
||||
double saveAmt = rechargeInfo.getSaveAmt();
|
||||
int sendRechargeId = 0;
|
||||
long lastTime = 0;
|
||||
for (SRechargeCommodityConfig sRechargeCommodityConfig : integerSRechargeCommodityConfigMap.values()) {
|
||||
if (saveAmt >= sRechargeCommodityConfig.getDiscountType()[1] && saveAmt <= sRechargeCommodityConfig.getDiscountType()[2]) {
|
||||
sendRechargeId = sRechargeCommodityConfig.getId();
|
||||
lastTime = sRechargeCommodityConfig.getDiscountType()[3] * 3600 * 1000L;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (sendRechargeId == 0) {
|
||||
LOGGER.info("sendRechargeId indetion id==0 uid=>{} saveAmt=>{}", user.getId(), saveAmt);
|
||||
} else {
|
||||
if (!rechargeInfo.getBuyGoodsTimes().containsKey(sendRechargeId)) {
|
||||
rechargeInfo.updateBuyGoodsTimes(sendRechargeId, 0);
|
||||
rechargeInfo.putDyGoodsCanBuyTimes(sendRechargeId, 1);
|
||||
} else {
|
||||
rechargeInfo.putDyGoodsCanBuyTimes(sendRechargeId, rechargeInfo.getDyGoodsCanBuyTimes().get(sendRechargeId) + 1);
|
||||
}
|
||||
rechargeInfo.updateRefreshMapByKey(sendRechargeId, TimeUtils.now() + lastTime);
|
||||
List<CommonProto.GiftGoodsInfo> goodsBagInfo = new ArrayList<>(SRechargeCommodityConfig.rechargeCommodityConfigMap.size());
|
||||
BuyGoodsLogic.getGoodsBagInfo(user.getId(), goodsBagInfo, false);
|
||||
PlayerInfoProto.AllGiftGoodsIndication goodsBuild = PlayerInfoProto.AllGiftGoodsIndication.newBuilder().addAllGiftGoodsInfo(goodsBagInfo).build();
|
||||
MessageUtil.sendIndicationMessage(session, 1, MessageTypeProto.MessageType.ALL_GIFTGOODS_INDICATION_VALUE, goodsBuild, true);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public void openNextMainLevel(User user,int fightId) throws Exception {
|
||||
int level = user.getPlayerInfoManager().getLevel();
|
||||
|
@ -2302,6 +2349,25 @@ public class MapLogic {
|
|||
user.getUserMissionManager().onGameEvent(user,GameEvent.MONSTER_ATTACK_LEVEL);
|
||||
MessageUtil.sendMessage(session, 1, messageType.getNumber(), fightEndResponse.build(), true);
|
||||
|
||||
String stringValue = SSpecialConfig.getStringValue(SSpecialConfig.DISCOUNT_MONSTER_LEVEL);
|
||||
if (stringValue != null && !stringValue.isEmpty()) {
|
||||
String[] split1 = stringValue.split("\\|");
|
||||
String[] split2 = split1[0].split("#");
|
||||
boolean ifTreer = false;
|
||||
if (checkFightId > Integer.parseInt(split2[split2.length - 1])) {
|
||||
if (checkFightId % Integer.parseInt(split1[1]) == 0) {
|
||||
ifTreer = true;
|
||||
}
|
||||
} else {
|
||||
List<String> strings = Arrays.asList(split2);
|
||||
if (strings.contains(Integer.toString(checkFightId))) {
|
||||
ifTreer = true;
|
||||
}
|
||||
}
|
||||
if (ifTreer) {
|
||||
openRechargeBagIds(session, user, 26);
|
||||
}
|
||||
}
|
||||
List<CommonProto.Item> itemDrop = drop.getItemlistList();
|
||||
List<Integer> itemIdList = new ArrayList<>();
|
||||
List<Integer> itemNumList = new ArrayList<>();
|
||||
|
|
|
@ -164,12 +164,33 @@ public class BuyGoodsLogic {
|
|||
int type = sRechargeCommodityConfig.getType();
|
||||
if(limit!=0){
|
||||
if(buyCount>limit){
|
||||
LOGGER.error("the uid={},the goodId={}, is over limit={}",uid,goodsId,buyCount);
|
||||
LOGGER.error("sendGoods the uid={},the goodId={}, is over limit={}",uid,goodsId,buyCount);
|
||||
resultRes.setResultCode(0);
|
||||
resultRes.setResultMsg("over limit");
|
||||
return resultRes;
|
||||
}
|
||||
}else {
|
||||
// 25闯关礼包、26、心魔试炼礼包
|
||||
if (sRechargeCommodityConfig.getTime() == 6) {
|
||||
if (!rechargeInfo.getBuyGoodsTimes().containsKey(goodsId)) {
|
||||
LOGGER.error("sendGoods the uid={},the goodId={}, is not open={}",uid,goodsId,buyCount);
|
||||
resultRes.setResultCode(0);
|
||||
resultRes.setResultMsg("not open");
|
||||
return resultRes;
|
||||
}
|
||||
if (!rechargeInfo.getDyGoodsCanBuyTimes().containsKey(goodsId)) {
|
||||
LOGGER.error("sendGoods the uid={},the goodId={}, is not open={}",uid,goodsId,buyCount);
|
||||
resultRes.setResultCode(0);
|
||||
resultRes.setResultMsg("not open");
|
||||
return resultRes;
|
||||
}
|
||||
if (rechargeInfo.getDyGoodsCanBuyTimes().get(goodsId) <= 0) {
|
||||
LOGGER.error("sendGoods the uid={},the goodId={}, buyCount=>{}, is over limit={}",uid, goodsId, buyCount, rechargeInfo.getDyGoodsCanBuyTimes().get(goodsId));
|
||||
resultRes.setResultCode(0);
|
||||
resultRes.setResultMsg("over limit");
|
||||
return resultRes;
|
||||
}
|
||||
}
|
||||
if(sRechargeCommodityConfig.getTime()==4&&(sRechargeCommodityConfig.getDiscountType().length==3||sRechargeCommodityConfig.getDiscountType().length==4)){
|
||||
int[] discountType = sRechargeCommodityConfig.getDiscountType();
|
||||
int temptype = discountType[0];
|
||||
|
@ -181,7 +202,6 @@ public class BuyGoodsLogic {
|
|||
resultRes.setResultMsg("over limit");
|
||||
return resultRes;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -355,7 +375,8 @@ public class BuyGoodsLogic {
|
|||
|
||||
ISession session = OnlineUserManager.getSessionByUid(uid);
|
||||
//特殊礼包次数
|
||||
if(sRechargeCommodityConfig.getTime()==4&&(sRechargeCommodityConfig.getDiscountType().length==3||sRechargeCommodityConfig.getDiscountType().length==4)){
|
||||
if((sRechargeCommodityConfig.getTime()==4 || sRechargeCommodityConfig.getTime()==6)
|
||||
&&(sRechargeCommodityConfig.getDiscountType().length==3||sRechargeCommodityConfig.getDiscountType().length==4)){
|
||||
int[] discountType = sRechargeCommodityConfig.getDiscountType();
|
||||
int temptype = discountType[0];
|
||||
int tempvalue = discountType[1];
|
||||
|
@ -560,6 +581,11 @@ public class BuyGoodsLogic {
|
|||
}
|
||||
|
||||
for(SRechargeCommodityConfig sRechargeCommodityConfig :SRechargeCommodityConfig.rechargeCommodityConfigMap.values()){
|
||||
// 25闯关礼包、26、心魔试炼礼包 特殊处理
|
||||
if ((sRechargeCommodityConfig.getShowType() == 25 || sRechargeCommodityConfig.getShowType() == 26)
|
||||
&& !rechargeInfo.getBuyGoodsTimes().containsKey(sRechargeCommodityConfig.getId())) {
|
||||
continue;
|
||||
}
|
||||
int limit = sRechargeCommodityConfig.getLimit();
|
||||
int goodsId = sRechargeCommodityConfig.getId();
|
||||
Integer buyTimes = buyGoodsTimes.get(goodsId);
|
||||
|
@ -761,8 +787,15 @@ public class BuyGoodsLogic {
|
|||
rechargeInfo.getCacheSendedTypes().put(goodsId, startTime);
|
||||
}
|
||||
}
|
||||
|
||||
}else{
|
||||
} else if (time == 6) {
|
||||
if (rechargeInfo.getDyGoodsCanBuyTimes().containsKey(sRechargeCommodityConfig.getId())) {
|
||||
endTime = rechargeInfo.getRefreshBagMap().get(sRechargeCommodityConfig.getId());
|
||||
if (now > endTime || rechargeInfo.getDyGoodsCanBuyTimes().get(sRechargeCommodityConfig.getId()) <= 0) {
|
||||
return new RechargeResult();
|
||||
}
|
||||
startTime = endTime - sRechargeCommodityConfig.getDiscountType()[3] * 3600000;
|
||||
}
|
||||
} else {
|
||||
if(sRechargeCommodityConfig.getDailyUpdate()>=1){
|
||||
if(!refreshBagMap.containsKey(sRechargeCommodityConfig.getId())){
|
||||
Gson gson = new Gson();
|
||||
|
|
|
@ -38,8 +38,8 @@ public class MessageUtil {
|
|||
backMessage = new byte[0];
|
||||
} else {
|
||||
backMessage = generatedMessage.toByteArray();
|
||||
if (backMessage.length != 0)
|
||||
LOGGER.info("wrappedBuffer uid=>{}, generatedMessage=>{}", uid, JsonFormat.printToString(generatedMessage));
|
||||
// if (backMessage.length != 0)
|
||||
// LOGGER.info("wrappedBuffer uid=>{}, generatedMessage=>{}", uid, JsonFormat.printToString(generatedMessage));
|
||||
}
|
||||
|
||||
int length = PackageConstant.UID_FIELD_LEN + PackageConstant.TOKEN_LEN
|
||||
|
@ -63,9 +63,9 @@ public class MessageUtil {
|
|||
}
|
||||
int[] secretKey = Tea.KEY;
|
||||
byte[] bytes1 = Tea.encrypt2(bytes, secretKey);
|
||||
if (backMessage.length != 0) {
|
||||
LOGGER.info("wrappedBuffer uid=>{} sendbyte=>{}", uid, bytes1.length);
|
||||
}
|
||||
// if (backMessage.length != 0) {
|
||||
// LOGGER.info("wrappedBuffer uid=>{} sendbyte=>{}", uid, bytes1.length);
|
||||
// }
|
||||
return bytes1;
|
||||
}
|
||||
|
||||
|
|
|
@ -41,6 +41,8 @@ public class SMainLevelConfig implements BaseConfig {
|
|||
|
||||
private int virtureId; //虚拟id,关卡是自增的。
|
||||
|
||||
private int sortId;
|
||||
|
||||
public static Map<Integer, SMainLevelConfig> config;
|
||||
public static Map<Integer, SMainLevelConfig> sMainLevelConfigByVirtureIdMap;
|
||||
public static Map<Integer,SMainLevelConfig> fightPreMap;
|
||||
|
@ -131,4 +133,8 @@ public class SMainLevelConfig implements BaseConfig {
|
|||
public void setVirtureId(int virtureId) {
|
||||
this.virtureId = virtureId;
|
||||
}
|
||||
|
||||
public int getSortId() {
|
||||
return sortId;
|
||||
}
|
||||
}
|
|
@ -61,7 +61,7 @@ public class SRechargeCommodityConfig implements BaseConfig {
|
|||
|
||||
private int[] passiveSkill;
|
||||
|
||||
|
||||
private int showType;
|
||||
|
||||
public static Map<Integer, SRechargeCommodityConfig> rechargeCommodityConfigMap;
|
||||
public static Map<String, SRechargeCommodityConfig> sdkRechargeCommodityConfigMap;
|
||||
|
@ -70,6 +70,8 @@ public class SRechargeCommodityConfig implements BaseConfig {
|
|||
public static TreeMap<Integer,Integer> rechargePlayerLevelMap;
|
||||
public static Set<SRechargeCommodityConfig> refreshItemInfo;
|
||||
|
||||
public static Map<Integer, Map<Integer, SRechargeCommodityConfig>> rechargeIndetions;
|
||||
|
||||
@Override
|
||||
public void init() throws Exception {
|
||||
Map<Integer, SRechargeCommodityConfig> config = STableManager.getConfig(SRechargeCommodityConfig.class);
|
||||
|
@ -81,6 +83,7 @@ public class SRechargeCommodityConfig implements BaseConfig {
|
|||
|
||||
TreeMap<Integer,Integer> rechargePlayerLevelTemp = new TreeMap<>();
|
||||
Set<SRechargeCommodityConfig> refreshItemInfoTmp = new HashSet<>();
|
||||
Map<Integer, Map<Integer, SRechargeCommodityConfig>> rechargeIndetionsTemp = new HashMap<>();
|
||||
for(SRechargeCommodityConfig sRechargeCommodityConfig : config.values()){
|
||||
sdkRechargeCommodityConfigMap.put(sRechargeCommodityConfig.getRechargeId(),sRechargeCommodityConfig);
|
||||
sdkRechargeCommodityConfigMap.put(sRechargeCommodityConfig.getRechargeId2(),sRechargeCommodityConfig);
|
||||
|
@ -121,13 +124,19 @@ public class SRechargeCommodityConfig implements BaseConfig {
|
|||
if(!StringUtil.isEmpty(endtime)){
|
||||
sRechargeCommodityConfig.setEndTimeLong(Long.parseLong(endtime));
|
||||
}
|
||||
if (sRechargeCommodityConfig.getShowType() == 25 || sRechargeCommodityConfig.getShowType() == 26) {
|
||||
if (!rechargeIndetionsTemp.containsKey(sRechargeCommodityConfig.getShowType())) {
|
||||
rechargeIndetionsTemp.put(sRechargeCommodityConfig.getShowType(), new HashMap<>());
|
||||
}
|
||||
rechargeIndetionsTemp.get(sRechargeCommodityConfig.getShowType()).put(sRechargeCommodityConfig.getId(), sRechargeCommodityConfig);
|
||||
}
|
||||
}
|
||||
rechargeCommodityConfigMap = config;
|
||||
rechargeLevelMap = rechargeLevelMapTmp;
|
||||
recharegeHeroTime = recharegeHeroTimeTmp;
|
||||
refreshItemInfo = refreshItemInfoTmp;
|
||||
rechargePlayerLevelMap = rechargePlayerLevelTemp;
|
||||
|
||||
rechargeIndetions = rechargeIndetionsTemp;
|
||||
}
|
||||
|
||||
|
||||
|
@ -254,4 +263,8 @@ public class SRechargeCommodityConfig implements BaseConfig {
|
|||
public String getRechargeId3() {
|
||||
return rechargeId3;
|
||||
}
|
||||
|
||||
public int getShowType() {
|
||||
return showType;
|
||||
}
|
||||
}
|
|
@ -77,6 +77,10 @@ public class SSpecialConfig implements BaseConfig {
|
|||
|
||||
public static final String SKY_TREASURE_SCORE_INGIFT = "sky_treasure_score_ingift";//天宫密保购买默认获得积分
|
||||
|
||||
public static final String DISCOUNT_MONSTER_LEVEL = "discount_monster_level";// 心魔试炼折扣礼包触发条件
|
||||
|
||||
public static final String DISCOUNT_MAIN = "discount_main";//关卡礼包
|
||||
|
||||
@Override
|
||||
public void init() throws Exception {
|
||||
|
||||
|
|
Loading…
Reference in New Issue