Merge branch 'master' of 60.1.1.230:backend/jieling_server

back_recharge
wangyuan 2019-12-26 17:21:10 +08:00
commit c4dceec25a
12 changed files with 87 additions and 61 deletions

View File

@ -30,6 +30,7 @@ import com.ljsd.jieling.logic.fight.result.FightResult;
import com.ljsd.jieling.logic.hero.HeroAttributeEnum;
import com.ljsd.jieling.logic.hero.HeroLogic;
import com.ljsd.jieling.logic.mission.GameEvent;
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;
@ -2150,7 +2151,7 @@ public class MapLogic {
// .setRank(rank++)
// .setTotalForce(userTmp.getPlayerInfoManager().getMaxForce())
// .setHeadFrame(playerInfoManager.getHeadFrame()));
// }
//// }
// Collections.sort(mainLevelRankInfoList, new Comparator<CommonProto.MainLevelRankInfo.Builder>() {
// @Override
// public int compare(CommonProto.MainLevelRankInfo.Builder o1, CommonProto.MainLevelRankInfo.Builder o2) {
@ -2164,7 +2165,7 @@ public class MapLogic {
// return o1.getRank()-o2.getRank();
// }
// });
// rank =1;
//// rank =1;
// int myRank =-1;
// int uid = session.getUid();
// for(CommonProto.MainLevelRankInfo.Builder builder1 : mainLevelRankInfoList){
@ -2689,7 +2690,7 @@ public class MapLogic {
}
// TODO 检测重置次数
PlayerManager playerInfoManager = user.getPlayerInfoManager();
if( !playerInfoManager.check(VipPrivilegeType.TOWER_RESRT_NUM, 1)){
if( !PlayerLogic.getInstance().check(user,VipPrivilegeType.TOWER_RESRT_NUM, 1)){
throw new ErrorCodeException(ErrorCode.newDefineCode("无重置次数"));
}
playerInfoManager.updateVipPrivilage(VipPrivilegeType.TOWER_RESRT_NUM,1);

View File

@ -15,6 +15,7 @@ import com.ljsd.jieling.logic.dao.*;
import com.ljsd.jieling.logic.dao.root.User;
import com.ljsd.jieling.logic.mission.GameEvent;
import com.ljsd.jieling.logic.mission.event.MissionEventDistributor;
import com.ljsd.jieling.logic.player.PlayerLogic;
import com.ljsd.jieling.logic.rank.RankContext;
import com.ljsd.jieling.logic.rank.RankEnum;
import com.ljsd.jieling.logic.store.StoreLogic;
@ -633,7 +634,7 @@ public class ActivityLogic implements IEventHandler{
boolean allowedFree = false;
if (randCount == 1) {
allowedFree = user.getPlayerInfoManager().check(VipPrivilegeType.FREE_SECRET_RANDOM, 1);
allowedFree = PlayerLogic.getInstance().check(user,VipPrivilegeType.FREE_SECRET_RANDOM, 1);
}
if (!allowedFree) {
int[][] mainCost = sDifferDemonsBoxSetting.getMainCost();

View File

@ -67,12 +67,12 @@ public class LimitRandomCardActivity extends AbstractActivity {
@Override
void updateProgressWithUser(User user, ActivityMission activityMission, int count) {
activityMission.setValue(activityMission.getValue()+count);
//150分赠一次
int[] onceArrayValue = SSpecialConfig.getOnceArrayValue(SSpecialConfig.TIME_LIMIT_RECRUITMENT_FREEINTEGRAL);
if((activityMission.getValue()+count)/onceArrayValue[0]-activityMission.getValue()/onceArrayValue[0]>0){
user.getPlayerInfoManager().updateVipPrivilage(onceArrayValue[1],-1);
}
activityMission.setValue(activityMission.getValue()+count);
}
@Override

View File

@ -14,7 +14,6 @@ class LuckWheelExpectRankActivity extends ExpectRankActivity {
public LuckWheelExpectRankActivity(int id) {
super(id);
Poster.getPoster().listenEvent(this, LuckWheelAdvanceEvent.class);
Poster.getPoster().listenEvent(this, LuckWheelEvent.class);
}
@ -22,7 +21,7 @@ class LuckWheelExpectRankActivity extends ExpectRankActivity {
public void onEvent(IEvent event) throws Exception {
if (!(event instanceof LuckWheelEvent))
return;
update(UserManager.getUser(((LuckWheelEvent) event).getUid()), 1);
update(UserManager.getUser(((LuckWheelEvent) event).getUid()), ((LuckWheelEvent) event).getTime());
}

View File

@ -46,8 +46,8 @@ public class HeroFiveStarGetEventHandler implements IEventHandler {
if(typeBagMap.containsKey(((HeroFiveStarGetEvent) event).getStar())){
long lasttime = rechargeInfo.getTypeBagMap().get(((HeroFiveStarGetEvent) event).getStar());
long diffHourTemp =(now - lasttime) / 60 ;
if (diffHourTemp < 1000) {
int diffHourTemp = (int) ((now - lasttime) / 3600 / 1000);
if (diffHourTemp < 2) {
rechargeInfo.addDyGoodsCanBuyTimes(goodsId);
}else {
rechargeInfo.putDyGoodsCanBuyTimes(goodsId,1);
@ -63,7 +63,6 @@ public class HeroFiveStarGetEventHandler implements IEventHandler {
List<CommonProto.GiftGoodsInfo> goodsBagInfo = new ArrayList<>(SRechargeCommodityConfig.rechargeCommodityConfigMap.size());
BuyGoodsLogic.getGoodsBagInfo(user.getId(), goodsBagInfo,false);
System.out.print(goodsBagInfo.toString());
ISession session = OnlineUserManager.getSessionByUid(user.getId());
if(session!=null){
if(null!= HandlerLogicThread.current()){

View File

@ -27,6 +27,7 @@ import com.ljsd.jieling.logic.hero.HeroLogic;
import com.ljsd.jieling.logic.mail.MailLogic;
import com.ljsd.jieling.logic.mission.GameEvent;
import com.ljsd.jieling.logic.mission.event.MissionEventDistributor;
import com.ljsd.jieling.logic.player.PlayerLogic;
import com.ljsd.jieling.network.server.ProtocolsManager;
import com.ljsd.jieling.network.session.ISession;
import com.ljsd.jieling.protocols.ArenaInfoProto;
@ -325,7 +326,7 @@ public class ArenaLogic {
}
SArenaSetting sArenaSetting = SArenaSetting.getSArenaSetting();
int battleFree = sArenaSetting.getBattleFree();
if(!user.getPlayerInfoManager().check(battleFree,1)){
if(!PlayerLogic.getInstance().check(user,battleFree,1)){
//校验消耗
boolean enough = ItemUtil.itemCost(user, new int[][]{sArenaSetting.getCost()}, BIReason.ARENA_CHALLENGE_CONSUME,enemyInfo.getEnemyId());
if(!enough){

View File

@ -259,38 +259,6 @@ public class PlayerManager extends MongoBase {
updateString("vipInfo", vipInfo);
}
public boolean check(int privilageId,int updateNum){
if(privilageId == 0){
return true;
}
if(!vipInfo.containsKey(privilageId)){
return false;
}
VipInfo info = vipInfo.get(privilageId);
if(info.getEffectTime()!=0&&TimeUtils.now()/1000>info.getEffectTime()){
return false;
}
SPrivilegeTypeConfig sPrivilegeTypeConfig = SPrivilegeTypeConfig.getsPrivilegeTypeConfigMap().get(privilageId);
Map<Integer, Map<Integer, Integer>> conditionMap = SPrivilegeTypeConfig.conditionMap.get(sPrivilegeTypeConfig.getUnlockType());
int maxCount = 0;
if(sPrivilegeTypeConfig.getUnlockType()!=GlobalsDef.RECHARGE_UNLOCK_PRIVILEGE){
TreeMap<Integer, Integer> condition = (TreeMap)conditionMap.get(privilageId);
maxCount = condition.floorEntry(level).getValue();
}
if(maxCount==-1){
return true;
}
if(info.getCount()+updateNum>maxCount|| (info.getEffectTime()!=0&&TimeUtils.now()/1000>info.getEffectTime())){
return false;
}
updateVipPrivilage(privilageId, updateNum);
return true;
}
public boolean checkFunctionIsAllowed(int privilageId){
if(privilageId == VipPrivilegeType.UNLOCK_TRIAL_BOMB_REWARD){
return rechargeInfo.checkOneGoodsIsOverTimeByPrivilege(privilageId);
@ -372,7 +340,7 @@ public class PlayerManager extends MongoBase {
return;
}
int maxTime = 0;
if(vipInfo.containsKey(privilageId)){
if(vipInfo.containsKey(privilageId)&&config.getContinueTime()!=0){
maxTime = (int)(TimeUtils.now()/1000>vipInfo.get(privilageId).getEffectTime()?(TimeUtils.now()/1000):vipInfo.get(privilageId).getEffectTime());
}else {
maxTime = (int)(TimeUtils.now()/1000+config.getContinueTime());

View File

@ -16,6 +16,7 @@ import com.ljsd.jieling.logic.dao.UserManager;
import com.ljsd.jieling.logic.dao.root.User;
import com.ljsd.jieling.logic.mission.GameEvent;
import com.ljsd.jieling.logic.mission.event.MissionEventDistributor;
import com.ljsd.jieling.logic.player.PlayerLogic;
import com.ljsd.jieling.network.server.ProtocolsManager;
import com.ljsd.jieling.network.session.ISession;
import com.ljsd.jieling.protocols.CommonProto;
@ -529,7 +530,7 @@ public class FriendLogic {
throw new ErrorCodeException(ErrorCode.FRIENDS_SEMD_YET);
}
friendManager.updateGiveMap(friendId,1);
boolean check = friendUser.getPlayerInfoManager().check(STableManager.getFigureConfig(CommonStaticConfig.class).getGameSetting().getMaxEnergyGet(), 1);
boolean check = PlayerLogic.getInstance().check(user,STableManager.getFigureConfig(CommonStaticConfig.class).getGameSetting().getMaxEnergyGet(), 1);
if(check){
friendManager1.updateHaveRewardMap(uid,1);
sendFriendStatedication(uid,friendId,2);
@ -547,7 +548,7 @@ public class FriendLogic {
continue;
}
friendManager.updateGiveMap(friendUserId,1);
boolean check = friendUser.getPlayerInfoManager().check(STableManager.getFigureConfig(CommonStaticConfig.class).getGameSetting().getMaxEnergyGet(), 1);
boolean check = PlayerLogic.getInstance().check(user,STableManager.getFigureConfig(CommonStaticConfig.class).getGameSetting().getMaxEnergyGet(), 1);
if(check){
friendManager1.updateHaveRewardMap(uid,1);
sendFriendStatedication(uid,friendUserId,2);
@ -573,7 +574,7 @@ public class FriendLogic {
List<Integer> friends = friendManager.getFriends();
Map<Integer, Integer> haveRewardMap = friendManager.getHaveRewardMap();
PlayerManager playerInfoManager = user.getPlayerInfoManager();
boolean check = playerInfoManager.check(STableManager.getFigureConfig(CommonStaticConfig.class).getGameSetting().getMaxEnergyGet(), 1);
boolean check = PlayerLogic.getInstance().check(user,STableManager.getFigureConfig(CommonStaticConfig.class).getGameSetting().getMaxEnergyGet(), 1);
Set<Integer> receieveFriends = new HashSet<>();
if(!check){
throw new ErrorCodeException(ErrorCode.FRIENDS_GET_MAX);
@ -605,7 +606,7 @@ public class FriendLogic {
continue;
}
if(i++>0){
check = playerInfoManager.check(STableManager.getFigureConfig(CommonStaticConfig.class).getGameSetting().getMaxEnergyGet(), 1);
check = PlayerLogic.getInstance().check(user,STableManager.getFigureConfig(CommonStaticConfig.class).getGameSetting().getMaxEnergyGet(), 1);
if(!check){
break;
}

View File

@ -21,6 +21,7 @@ import com.ljsd.jieling.logic.fight.CombatLogic;
import com.ljsd.jieling.logic.item.ItemLogic;
import com.ljsd.jieling.logic.mission.GameEvent;
import com.ljsd.jieling.logic.mission.MissionLoigc;
import com.ljsd.jieling.logic.player.PlayerLogic;
import com.ljsd.jieling.network.server.ProtocolsManager;
import com.ljsd.jieling.network.session.ISession;
import com.ljsd.jieling.protocols.CommonProto;
@ -233,7 +234,7 @@ public class HeroLogic{
break;
}
if(privilege!=0){
allowFree = user.getPlayerInfoManager().check(privilege, 1);
allowFree = PlayerLogic.getInstance().check(user,privilege, 1);
}
}

View File

@ -3,6 +3,7 @@ package com.ljsd.jieling.logic.player;
import com.ljsd.GameApplication;
import com.ljsd.jieling.config.clazzStaticCfg.CommonStaticConfig;
import com.ljsd.jieling.config.clazzStaticCfg.TaskStaticConfig;
import com.ljsd.jieling.core.GlobalsDef;
import com.ljsd.jieling.core.VipPrivilegeType;
import com.ljsd.jieling.dataReport.reportBeans_37.ChatContentType;
import com.ljsd.jieling.dataReport.reportBeans_37.Repot37EventUtil;
@ -712,4 +713,48 @@ public class PlayerLogic {
user.getPlayerInfoManager().setRideLevel(rideLevel+1);
MessageUtil.sendMessage(session,1,messageType.getNumber(),null,true);
}
public boolean check(User user,int privilageId,int updateNum){
Map<Integer, VipInfo> vipInfo = user.getPlayerInfoManager().getVipInfo();
if(privilageId == 0){
return true;
}
if(!vipInfo.containsKey(privilageId)){
return false;
}
VipInfo info = vipInfo.get(privilageId);
if(info.getEffectTime()!=0&&TimeUtils.now()/1000>info.getEffectTime()){
return false;
}
SPrivilegeTypeConfig sPrivilegeTypeConfig = SPrivilegeTypeConfig.getsPrivilegeTypeConfigMap().get(privilageId);
Map<Integer, Map<Integer, Integer>> conditionMap = SPrivilegeTypeConfig.conditionMap.get(sPrivilegeTypeConfig.getUnlockType());
int maxCount = 0;
int cond = 0;
switch (sPrivilegeTypeConfig.getUnlockType()){
case GlobalsDef.LEVEL_UNLOCK_PRIVILEGE:
cond = user.getPlayerInfoManager().getLevel();
break;
case GlobalsDef.MAIN_LEVEL_UNLOCK_PRIVILEGE:
cond = SMainLevelConfig.config.get(user.getMainLevelManager().getFightId()).getVirtureId();
break;
case GlobalsDef.VIP_UNLOCK_PRIVILEGE:
cond = user.getPlayerInfoManager().getVipLevel();
break;
}
if(sPrivilegeTypeConfig.getUnlockType()!=GlobalsDef.RECHARGE_UNLOCK_PRIVILEGE){
TreeMap<Integer, Integer> condition = (TreeMap)conditionMap.get(privilageId);
maxCount = condition.floorEntry(cond).getValue();
}
if(maxCount==-1){
return true;
}
if((info.getCount()+updateNum>maxCount)|| (info.getEffectTime()!=0&&TimeUtils.now()/1000>info.getEffectTime())){
return false;
}
user.getPlayerInfoManager().updateVipPrivilage(privilageId, updateNum);
return true;
}
}

View File

@ -18,6 +18,7 @@ import com.ljsd.jieling.logic.activity.event.Poster;
import com.ljsd.jieling.logic.activity.event.SecretEvent;
import com.ljsd.jieling.logic.dao.RechargeInfo;
import com.ljsd.jieling.logic.dao.UserManager;
import com.ljsd.jieling.logic.dao.VipInfo;
import com.ljsd.jieling.logic.dao.root.User;
import com.ljsd.jieling.logic.fight.CombatLogic;
import com.ljsd.jieling.logic.mail.MailLogic;
@ -290,9 +291,13 @@ public class BuyGoodsLogic {
int goodsType = sRechargeCommodityConfig.getType();
int[] openPrivilege = sRechargeCommodityConfig.getOpenPrivilege();
if(openPrivilege!=null && openPrivilege.length>0){
PlayerInfoProto.PrivilegeIndication.Builder indication = PlayerInfoProto.PrivilegeIndication.newBuilder();
for(int privilege:openPrivilege){
user.getPlayerInfoManager().addVipInfo(privilege);
VipInfo vipInfo = user.getPlayerInfoManager().getVipInfo().get(privilege);
indication.addInfos(CommonProto.Privilege.newBuilder().setId(privilege).setUsedTimes(vipInfo.getCount()).setEffectTime(vipInfo.getEffectTime()).build());
}
MessageUtil.sendIndicationMessage(OnlineUserManager.getSessionByUid(user.getId()),1, MessageTypeProto.MessageType.PRIVILLEGE_ADD_INDICATION_VALUE,indication.build(),true);
}
if(goodsType == GiftGoodsType.LUXURYMONTHCARD){
PlayerLogic.getInstance().sendDayilyMail(user,goodsType);
@ -393,20 +398,20 @@ public class BuyGoodsLogic {
}
startTime = typeBagMap.get(value);
int addtime = 1000;
int diffHour = (int) ((now - startTime) / 60 );
int addtime = discountType[2];
int diffHour = (int) ((now - startTime) / 3600 / 1000);
if (diffHour >= addtime) {
rechargeInfo.removeDyGoodsCanBuyTimes(goodsId);
continue;
}
endTime = startTime + addtime * 60;
endTime = startTime + addtime * 3600 * 1000;
if (rechargeInfo.getCacheSendedTypes().containsKey(value)) {
long lasttime = rechargeInfo.getCacheSendedTypes().get(value);
if(lasttime != startTime){
needChange = true;
rechargeInfo.getCacheSendedTypes().put(value, startTime);
int diffHourTemp = (int) ((now - lasttime) / 60 );
int diffHourTemp = (int) ((now - lasttime) / 3600 / 1000);
if (diffHourTemp < addtime) {
startTime =0;
}

View File

@ -13,13 +13,11 @@ import com.ljsd.jieling.logic.OnlineUserManager;
import com.ljsd.jieling.logic.activity.ActivityType;
import com.ljsd.jieling.logic.activity.event.GoldEvent;
import com.ljsd.jieling.logic.activity.event.Poster;
import com.ljsd.jieling.logic.dao.PlayerManager;
import com.ljsd.jieling.logic.dao.StoreInfo;
import com.ljsd.jieling.logic.dao.StoreManager;
import com.ljsd.jieling.logic.dao.UserManager;
import com.ljsd.jieling.logic.dao.*;
import com.ljsd.jieling.logic.dao.root.User;
import com.ljsd.jieling.logic.mail.MailLogic;
import com.ljsd.jieling.logic.mission.GameEvent;
import com.ljsd.jieling.logic.player.PlayerLogic;
import com.ljsd.jieling.network.server.ProtocolsManager;
import com.ljsd.jieling.network.session.ISession;
import com.ljsd.jieling.protocols.CommonProto;
@ -423,7 +421,14 @@ public class StoreLogic {
user.getPlayerInfoManager().setHadTakeLevelBoxVip(vipLeve);
}
if(sStoreConfig.getOpenPrivilege()!=null){
Arrays.stream(sStoreConfig.getOpenPrivilege()).forEach(n->user.getPlayerInfoManager().addVipInfo(n));
PlayerInfoProto.PrivilegeIndication.Builder indication = PlayerInfoProto.PrivilegeIndication.newBuilder();
Arrays.stream(sStoreConfig.getOpenPrivilege()).forEach(n->{
user.getPlayerInfoManager().addVipInfo(n);
VipInfo vipInfo = user.getPlayerInfoManager().getVipInfo().get(n);
indication.addInfos(CommonProto.Privilege.newBuilder().setId(n).setUsedTimes(vipInfo.getCount()).setEffectTime(vipInfo.getEffectTime()).build());
});
MessageUtil.sendIndicationMessage(iSession,1, MessageTypeProto.MessageType.PRIVILLEGE_ADD_INDICATION_VALUE,indication.build(),true);
}
PlayerInfoProto.BuyStoreItemResponse builder = PlayerInfoProto.BuyStoreItemResponse.newBuilder().setDrop(drop).build();
@ -464,9 +469,9 @@ public class StoreLogic {
if(relatedtoVIP == 1){
if(limit == 6){
int goodsNum = sStoreConfig.getGoods()[0][1]*itemNum;
check = playerInfoManager.check(limit, goodsNum);
check = PlayerLogic.getInstance().check(user,limit, goodsNum);
}else{
check = playerInfoManager.check(limit, itemNum);
check = PlayerLogic.getInstance().check(user,limit, itemNum);
}
}else{
check = limit > buyTimes;
@ -545,7 +550,7 @@ public class StoreLogic {
int refreshPrivilege = sStoreTypeConfig.getRefreshPrivilege();
int refreshNum = playerInfoManager.getVipPrivilageValue(refreshPrivilege);
int[][] cost = getCost(refreshNum, 1,sStoreTypeConfig.getRefreshItem(),1,0,0);
if(!playerInfoManager.check(refreshPrivilege,1)){
if(!PlayerLogic.getInstance().check(user,refreshPrivilege,1)){
throw new ErrorCodeException(ErrorCode.newDefineCode("over limmit"));
}
boolean result = ItemUtil.itemCost(user, cost, BIReason.STORE_HAND_REFRESH,storeId);