Merge branch 'online_1121'

# Conflicts:
#	serverlogic/src/main/java/com/ljsd/jieling/logic/hero/HeroLogic.java
back_recharge
lvxinran 2019-11-27 16:10:41 +08:00
commit 2c5148e1ed
20 changed files with 301 additions and 67 deletions

View File

@ -1264,7 +1264,7 @@ local passivityList = {
end
role.Event:AddEvent(BattleEventName.RoleBeHit, OnBeHit)
end,
--造成暴击时,额外造成目标最大生命值[a]%的伤害。造成伤害时,有[a]的概率立即造成攻击[b]%的伤害该伤害造成的暴击伤害不会触发额外最大生命值伤害。效果55+效果56目标最大生命值伤害总上限为施法者2.5倍攻击
--造成暴击时,额外造成目标最大生命值[a]%的伤害。造成伤害时,有[a]的概率立即造成攻击[b]%的伤害该伤害造成的暴击伤害不会触发额外最大生命值伤害。效果55+效果56目标最大生命值伤害总上限为施法者5倍攻击
--a[float],b[float],c[float]
[69] = function(role, args)
local f1 = args[1]
@ -1279,7 +1279,7 @@ local passivityList = {
end
if bCrit then
local ar1 = BattleUtil.FP_Mul(defRole:GetRoleData(RoleDataName.MaxHp), f1)
local ar2 = BattleUtil.FP_Mul(role:GetRoleData(RoleDataName.Attack), 2.5)
local ar2 = BattleUtil.FP_Mul(role:GetRoleData(RoleDataName.Attack), 5)
BattleUtil.ApplyDamage(role, defRole, floor(math.min(ar1, ar2)))
else
BattleUtil.RandomAction(f2, function ()

View File

@ -41,6 +41,14 @@ public class SimpleTransaction {
}
return combineList;
});
combineMsgId.put(MessageTypeProto.MessageType.ALL_GIFTGOODS_INDICATION_VALUE, (MessageUtil.CombinePolicy< PlayerInfoProto.AllGiftGoodsIndication>) list -> {
List<PlayerInfoProto.AllGiftGoodsIndication> combineList = new LinkedList<>();
if(list.size()>0){
combineList.add(list.get(0));
}
return combineList;
});
}
SimpleTransaction(ISession session) {

View File

@ -142,7 +142,8 @@ public enum ErrorCode implements IErrorCode {
IN_BLACK(108,"对方已被您加入黑名单,无法添加好友"),
NULL_NAME(109,"名字不能为空"),
NAME_LENGTH_ERROR(110,"公会名长度不符"),
EXIST_NAME(111,"此名已存在");
EXIST_NAME(111,"此名已存在"),
ANNOUNCE_SIZE(112,"公会宣言长度不符"),
;

View File

@ -65,6 +65,7 @@ public class GetPlayerInfoHandler extends BaseHandler{
PlayerLogic.getInstance().sendDayilyMail(user,-1);
QuestionLogic.getInstence().onLogin(user);
PlayerManager playerInfoManager = user.getPlayerInfoManager();
ActivityLogic.getInstance().flushForLogin(user,iSession);
GlobalDataManaager.checkNeedReFlush(iSession,user,null);
playerInfoManager.setLoginTime(TimeUtils.now());
Map<Integer, Integer> guidePoints = playerInfoManager.getGuidePoints();
@ -165,7 +166,7 @@ public class GetPlayerInfoHandler extends BaseHandler{
.build();
try {
MessageUtil.sendMessage(iSession, 1, MessageTypeProto.MessageType.GET_PLAYERINFO_RESPONSE_VALUE, getPlayerInfoResponse, true);
ActivityLogic.getInstance().flushForLogin(user,iSession);
// DoFix.getInstance().loginFix(user);
if(playerInfoManager.getIsdayFirst()==0){
playerInfoManager.setIsdayFirst(1);

View File

@ -28,6 +28,7 @@ import com.ljsd.jieling.logic.mission.GameMisionType;
import com.ljsd.jieling.logic.mission.data.DataManagerDistributor;
import com.ljsd.jieling.logic.mission.event.MissionEventDistributor;
import com.ljsd.jieling.logic.player.PlayerLogic;
import com.ljsd.jieling.logic.store.BuyGoodsLogic;
import com.ljsd.jieling.logic.store.StoreLogic;
import com.ljsd.jieling.netty.cocdex.PacketNetData;
import com.ljsd.jieling.netty.cocdex.Tea;
@ -303,6 +304,7 @@ public class GlobalDataManaager implements IManager {
ActivityLogic.getInstance().flushEveryDay(user,fBuilder);
PlayerLogic.getInstance().vipflushEveryDay(user,fBuilder);
PlayerLogic.getInstance().flushUserdataEvery(user,fBuilder);
BuyGoodsLogic.flushEveryDay(user);
user.getUserMissionManager().onGameEvent(user, GameEvent.DAILY_REFRESH,0);
user.getUserMissionManager().onGameEvent(user, GameEvent.BLOODY_REFRESH,0);
FriendLogic.getInstance().refreshState(session);

View File

@ -421,7 +421,11 @@ public class ActivityLogic {
if(user.getMainLevelManager().getState() == 2 ){
mineMainLevelConfig = SMainLevelConfig.config.get(user.getMainLevelManager().getFightId());
}
if(mineMainLevelConfig!=null && virtureId > mineMainLevelConfig.getVirtureId()){
int myVirtureId =0;
if(mineMainLevelConfig != null){
myVirtureId =mineMainLevelConfig.getVirtureId();
}
if(virtureId > myVirtureId){
state = ActivityType.UNOPEN_STATE;
}
}else{

View File

@ -31,30 +31,20 @@ public class FightMainEventHandler implements IEventHandler{
return;
FightMainEvent fightMainEvent = (FightMainEvent) event;
int fightId = fightMainEvent.getFightId();
List<SGlobalSystemConfig> sGlobalSystemConfigs = STableManager.getFigureConfig(CommonStaticConfig.class).getsGlobalSystemConfigMapByTypeAndConditionMap().get(1).get(fightId);
if(sGlobalSystemConfigs == null){
return;
}
int uid = fightMainEvent.getUid();
User user = UserManager.getUser(uid);
for(SGlobalSystemConfig sGlobalSystemConfig : sGlobalSystemConfigs){
int[][] openGifts = sGlobalSystemConfig.getOpenGifts();
if(openGifts!=null && openGifts.length>0){
ItemUtil.drop(user,openGifts, BIReason.SYSTERM_OPEN_REWARD);
}
}
for(SGlobalActivity sGlobalActivity : SGlobalActivity.getsGlobalActivityMap().values()){
int[] openRules = sGlobalActivity.getOpenRules();
if(openRules!=null && openRules.length>0 && openRules[0] == 1){
ActivityMission activityMission = user.getActivityManager().getActivityMissionMap().get(sGlobalActivity.getId());
if(activityMission!=null && activityMission.getActivityState() == ActivityType.UNOPEN_STATE){
int virtureId = SMainLevelConfig.config.get( openRules[1]).getVirtureId();
SMainLevelConfig mineMainLevelConfig = SMainLevelConfig.fightPreMap.get(fightId);
if(user.getMainLevelManager().getState() == 2 ){
mineMainLevelConfig = SMainLevelConfig.config.get(user.getMainLevelManager().getFightId());
}
if(mineMainLevelConfig!=null && virtureId > mineMainLevelConfig.getVirtureId()){
SMainLevelConfig mineMainLevelConfig = SMainLevelConfig.config.get(fightId);
// if(user.getMainLevelManager().getState() == 2 ){
// mineMainLevelConfig = SMainLevelConfig.config.get(user.getMainLevelManager().getFightId());
// }
if(mineMainLevelConfig!=null && virtureId <= mineMainLevelConfig.getVirtureId()){
activityMission.updateActivityState(ActivityType.OPEN_STATE);
ActivityLogic.getInstance().sendActivityInfo(user,sGlobalActivity.getId());
}
@ -62,6 +52,16 @@ public class FightMainEventHandler implements IEventHandler{
}
}
List<SGlobalSystemConfig> sGlobalSystemConfigs = STableManager.getFigureConfig(CommonStaticConfig.class).getsGlobalSystemConfigMapByTypeAndConditionMap().get(1).get(fightId);
if(sGlobalSystemConfigs == null){
return;
}
for(SGlobalSystemConfig sGlobalSystemConfig : sGlobalSystemConfigs){
int[][] openGifts = sGlobalSystemConfig.getOpenGifts();
if(openGifts!=null && openGifts.length>0){
ItemUtil.drop(user,openGifts, BIReason.SYSTERM_OPEN_REWARD);
}
}
}
}

View File

@ -104,7 +104,10 @@ public class NewWelfareActivity extends AbstractActivity {
return;
}
}
for(ActivityProgressInfo activityProgressInfo : activityProgressInfoMap.values()){
activityProgressInfo.setState(2);
}
List<SActivityRewardConfig> sActivityRewardConfigs = SActivityRewardConfig.getsActivityRewardConfigByActivityId(id);
itemAttrs.add(sActivityRewardConfigs.get(0).getValues());
itemAttrs.add(sActivityRewardConfigs.get(0).getReward());
}
}

View File

@ -0,0 +1,18 @@
package com.ljsd.jieling.logic.activity.event;
/**
* Description:
* Author: zsx
* CreateDate: 2019/11/25 10:36
*/
public class HeroFiveStarGetEvent implements IEvent {
private int uid;
public HeroFiveStarGetEvent(int uid) {
this.uid = uid;
}
public int getUid() {
return uid;
}
}

View File

@ -0,0 +1,50 @@
package com.ljsd.jieling.logic.activity.eventhandler;
import com.ljsd.jieling.core.HandlerLogicThread;
import com.ljsd.jieling.core.SimpleTransaction;
import com.ljsd.jieling.logic.OnlineUserManager;
import com.ljsd.jieling.logic.activity.IEventHandler;
import com.ljsd.jieling.logic.activity.event.HeroFiveStarGetEvent;
import com.ljsd.jieling.logic.activity.event.IEvent;
import com.ljsd.jieling.logic.dao.RechargeInfo;
import com.ljsd.jieling.logic.dao.UserManager;
import com.ljsd.jieling.logic.dao.root.User;
import com.ljsd.jieling.logic.store.BuyGoodsLogic;
import com.ljsd.jieling.network.session.ISession;
import com.ljsd.jieling.protocols.CommonProto;
import com.ljsd.jieling.protocols.MessageTypeProto;
import com.ljsd.jieling.protocols.PlayerInfoProto;
import com.ljsd.jieling.util.MessageUtil;
import config.SRechargeCommodityConfig;
import java.util.ArrayList;
import java.util.List;
/**
* Description: des
* Author: zsx
* CreateDate: 2019/11/25 10:46
*/
public class HeroFiveStarGetEventHandler implements IEventHandler {
@Override
public void onEvent(IEvent event) throws Exception {
if (!(event instanceof HeroFiveStarGetEvent))
return;
User user = UserManager.getUser(((HeroFiveStarGetEvent) event).getUid());
RechargeInfo rechargeInfo = user.getPlayerInfoManager().getRechargeInfo();
rechargeInfo.addTypeBagMap(5,System.currentTimeMillis());
List<CommonProto.GiftGoodsInfo> goodsBagInfo = new ArrayList<>(SRechargeCommodityConfig.rechargeCommodityConfigMap.size());
BuyGoodsLogic.getGoodsBagInfo(user.getId(), goodsBagInfo,false);
ISession session = OnlineUserManager.getSessionByUid(user.getId());
if(session!=null){
if(null!= HandlerLogicThread.current()){
//获得多个英雄进行协议合并
PlayerInfoProto.AllGiftGoodsIndication.Builder build = PlayerInfoProto.AllGiftGoodsIndication.newBuilder().addAllGiftGoodsInfo(goodsBagInfo);
HandlerLogicThread.current().dealWhileCommit(new SimpleTransaction.SendTask(build.build(), MessageTypeProto.MessageType.ALL_GIFTGOODS_INDICATION_VALUE));
}
}
}
}

View File

@ -57,7 +57,6 @@ public class CumulationData {
private int consumeGem ;
private Map<Integer,Integer> storyFightInfo =new HashMap<>(3);
private BitSet exploreFight = new BitSet(512);
public int buyGoldTimes; // 买金币次数
public int buyStaminaTimes; // 买金币次数
@ -256,9 +255,6 @@ public class CumulationData {
return sEquipQualityCount;
}
public void addExploreFight(int exploreFigtId){
exploreFight.set(exploreFigtId);
}
public void setStoryFightInfo(Map<Integer, Integer> storyFightInfo) {
this.storyFightInfo = storyFightInfo;
@ -267,8 +263,4 @@ public class CumulationData {
public Map<Integer, Integer> getStoryFightInfo() {
return storyFightInfo;
}
public BitSet getExploreFight() {
return exploreFight;
}
}

View File

@ -18,7 +18,7 @@ public class RechargeInfo extends MongoBase{
@Transient
private Set<Integer> cacheSendedIds = new ConcurrentSet<>();
private volatile Set<Integer> cacheSendedIds = new ConcurrentSet<>();
private Map<Integer,Long> levelBagMap = new HashMap<>();
private Map<Integer,Integer> buyGoodsTimes = new HashMap<>();
@ -27,6 +27,13 @@ public class RechargeInfo extends MongoBase{
private Map<Integer,Integer> goodseSendDailyMap = new HashMap<>();
//特殊类型控制触发开启的商品表 如五星妖灵师类型5
private Map<Integer,Long> typeBagMap = new HashMap<>();
@Transient
private Map<Integer,Long> cacheSendedTypes = new HashMap<>();
public RechargeInfo(){
}
@ -173,4 +180,25 @@ public class RechargeInfo extends MongoBase{
this.soulCrystalAmt += soulCrystalAmt;
updateString("soulCrystalAmt",soulCrystalAmt);
}
public Map<Integer, Long> getTypeBagMap() {
return typeBagMap;
}
public void addTypeBagMap(Integer type, Long createTime) {
this.typeBagMap.put(type, createTime);
updateString("typeBagMap",typeBagMap);
}
public void removeTypeBagMap(Integer type) {
this.typeBagMap.remove(type);
updateString("typeBagMap",typeBagMap);
}
public Map<Integer, Long> getCacheSendedTypes() {
return cacheSendedTypes;
}
public void setCacheSendedTypes(Map<Integer, Long> cacheSendedTypes) {
this.cacheSendedTypes = cacheSendedTypes;
}
}

View File

@ -98,6 +98,9 @@ public class GuildLogic {
if(StringUtil.isEmpty(announce)){
announce= SGuildSetting.sGuildSetting.getDefaultDeclaration();
}
if(announce.length()<0||announce.length()>32){
throw new ErrorCodeException(ErrorCode.ANNOUNCE_SIZE);
}
GuildInfo guildInfo = new GuildInfo(user.getId(),familyName,announce);
GuilidManager.addGuildInfo(guildInfo);
user.getPlayerInfoManager().setGuildId(guildInfo.getId());
@ -470,7 +473,10 @@ public class GuildLogic {
case 4: //拒绝一个
GuilidManager.removeOneApplyGuildInfos(guildId,applyId);
Family.RefuseJoinFamily refuseName = Family.RefuseJoinFamily.newBuilder().setName(guildInfo.getName()).build();
MessageUtil.sendIndicationMessage(OnlineUserManager.getSessionByUid(applyId),1, MessageTypeProto.MessageType.FAMILY_REFUSE_JOIN_INDICATION_VALUE,refuseName,true);
ISession targetSession = OnlineUserManager.getSessionByUid(applyId);
if(null!=targetSession){
MessageUtil.sendIndicationMessage(targetSession,1, MessageTypeProto.MessageType.FAMILY_REFUSE_JOIN_INDICATION_VALUE,refuseName,true);
}
break;
}
}finally {
@ -680,6 +686,9 @@ public class GuildLogic {
throw new ErrorCodeException(ErrorCode.FAMILY_IN_SENSITIVE);
}else{
if(type==1){
if(content.length()<0||content.length()>32){
throw new ErrorCodeException(ErrorCode.ANNOUNCE_SIZE);
}
guildInfo.setAnnounce(content);
}else{
checkForCreateGuild(user, content, guildInfo.getAnnounce());

View File

@ -11,9 +11,12 @@ import com.ljsd.jieling.exception.ErrorCode;
import com.ljsd.jieling.exception.ErrorCodeException;
import com.ljsd.jieling.globals.BIReason;
import com.ljsd.jieling.globals.Global;
import com.ljsd.jieling.logic.activity.ActivityLogic;
import com.ljsd.jieling.logic.activity.event.HeroFiveStarGetEvent;
import com.ljsd.jieling.logic.activity.event.HeroUpStarEvent;
import com.ljsd.jieling.logic.activity.event.Poster;
import com.ljsd.jieling.logic.activity.eventhandler.HeroFiveStarGetEventHandler;
import com.ljsd.jieling.logic.dao.*;
import com.ljsd.jieling.logic.dao.root.User;
import com.ljsd.jieling.logic.fight.CombatLogic;
@ -34,14 +37,17 @@ import util.MathUtils;
import util.StringUtil;
import java.math.BigDecimal;
import java.rmi.server.ExportException;
import java.util.*;
import java.util.concurrent.ConcurrentHashMap;
public class HeroLogic {
public class HeroLogic{
private static final Logger LOGGER = LoggerFactory.getLogger(HeroLogic.class);
private HeroLogic(){}
private HeroLogic(){
//英雄事件监听
Poster.getPoster().listenEvent(new HeroFiveStarGetEventHandler(), HeroFiveStarGetEvent.class);
}
public static List<Integer> transTemplate = new ArrayList<>();
public static List<Integer> equipSkillPositionTemaplge = new ArrayList<>(6);
@ -101,6 +107,7 @@ public class HeroLogic {
private static final String VERTICAL = "|";
private static final String DIVISION = "#";
/**
*
* @param iSession
@ -189,13 +196,13 @@ public class HeroLogic {
}
}
boolean isSpecial = false;
if(sLotterySetting.getOrderBoxPool()!=null && sLotterySetting.getOrderBoxPool().length>0){
pooId = getOrderBoxPoolId(sLotterySetting);
if(pooId == 0){
throw new ErrorCodeException(ErrorCode.newDefineCode("pooId 0"));
}
isSpecial =true;
}
//检验消耗
@ -238,28 +245,26 @@ public class HeroLogic {
int j=0;
for(int i=0;i<perCount;i++){
randCount++;
if(pooId == 0){
pooId = getSpecialPoolByRandcount(type, randCount,poolCount);
if(pooId==0){
pooId = getPooId(sLotterySetting, pooId);
poolCount++;
int randomPoolId = pooId;
int specialPoolId = getSpecialPoolByRandcount(sLotterySetting, randCount,poolCount);
if(specialPoolId == 0){
if(randomPoolId==0){
randomPoolId = getPooId(sLotterySetting);
}
}else{
randomPoolId =specialPoolId;
}
LOGGER.info("the uid={},the type={},the poolId={}",uid,type,pooId);
totalCount++;
SLotteryRewardConfig sLotteryRewardConfig = randomHeroByPoolId(pooId, totalCount, user.getPlayerInfoManager().getLevel());
SLotteryRewardConfig sLotteryRewardConfig = randomHeroByPoolId(randomPoolId, totalCount, user.getPlayerInfoManager().getLevel());
LOGGER.info("the uid={},the type={},the poolId={},reward={},poolCount={}",uid,type,randomPoolId,sLotteryRewardConfig.getId(),poolCount);
if(sLotteryRewardConfig.getStar() == 1){
poolCount=0;
}else{
poolCount++;
}
int[] reward =sLotteryRewardConfig.getReward();
if(reward!=null){
dropHeroAndItem[j++] = reward;
}
if(!isSpecial){
pooId=0;
}
}
heroManager.updateRandPoolTypeCount(sLotterySetting.getMergePool(),poolCount);
@ -291,10 +296,17 @@ public class HeroLogic {
MessageUtil.sendMessage(session, 1, MessageTypeProto.MessageType.HERO_RAND_RESPONSE_VALUE, builder.build(), true);
}
private int getSpecialPoolByRandcount(int type, int randCount,int poolCount) {
List<SLotterySpecialConfig> list = SLotterySpecialConfig.getLotterySpecialConfigListByType(type);
private int getSpecialPoolByRandcount(SLotterySetting sLotterySetting, int randCount,int poolCount) {
int id = sLotterySetting.getId();
List<SLotterySpecialConfig> list = SLotterySpecialConfig.getLotterySpecialConfigListByType(1,id);
boolean isMergePool = false;
if (list == null) {
return 0;
list = SLotterySpecialConfig.getLotterySpecialConfigListByType(2,sLotterySetting.getMergePool());
if(list == null){
return 0;
}
isMergePool = true;
}
int poolId = 0;
for (SLotterySpecialConfig data : list) {
@ -302,6 +314,9 @@ public class HeroLogic {
poolId = data.getpool_id();
break;
}
if(isMergePool){
continue;
}
if (randCount % data.getCount() != 0) {
continue;
}
@ -317,7 +332,7 @@ public class HeroLogic {
return poolId;
}
private int getPooId(SLotterySetting sLotterySetting, int pooId) throws Exception {
private int getPooId(SLotterySetting sLotterySetting) throws Exception {
int[][] diamondBoxContain = sLotterySetting.getDiamondBoxContain();
int totalWeight = 0;
for(int i=0;i<diamondBoxContain.length;i++){
@ -330,11 +345,10 @@ public class HeroLogic {
int[] poolWeightInfo = diamondBoxContain[i];
weight += poolWeightInfo[1];
if(randWeight<=weight){
pooId = poolWeightInfo[0];
break;
return poolWeightInfo[0];
}
}
return pooId;
return 0;
}
public int getOrderBoxPoolId(SLotterySetting sLotterySetting) throws Exception {
@ -715,6 +729,9 @@ public class HeroLogic {
// recyleHeroBySystem(user,removeHeroIds);
targetHero.upStar( 1 );
Poster.getPoster().dispatchEvent(new HeroUpStarEvent(user.getId(),targetHero.getStar()));
if(targetHero.getStar()==5){
Poster.getPoster().dispatchEvent(new HeroFiveStarGetEvent(user.getId()));
}
targetHero.setStarBreakId(scHeroRankUpConfig.getId());
user.getUserMissionManager().onGameEvent(user,GameEvent.HERO_UP,2,targetHero.getTemplateId(),targetHero.getStar());
MessageUtil.sendMessage(session,1,MessageTypeProto.MessageType.UP_HERO_STAR_RESPONSE_VALUE,baseBuilder.build(),true);

View File

@ -456,7 +456,18 @@ public class MissionLoigc {
}
break;
case GENERAL_STORY_PASS:
count = cumulationData.getExploreFight().get(missionSubType[0])?1:0;
Map<Integer, CrossInfo> crossInfoGenMap = user.getMapManager().getCrossInfoMap();
for(Map.Entry<Integer,CrossInfo> item : crossInfoGenMap.entrySet()){
CrossInfo value = item.getValue();
if(value.getStars().contains(MapLogic.STAR_1)){
Integer fightId = item.getKey();
SChallengeConfig sChallengeConfig = SChallengeConfig.sChallengeConfigs.get(fightId);
if(sChallengeConfig.getType() == 1 && sChallengeConfig.getMapId() == missionSubType[0]){
count++;
break;
}
}
}
break;
case HERO_STORY_PASS:
Map<Integer, CrossInfo> crossInfoMap = user.getMapManager().getCrossInfoMap();
@ -467,6 +478,7 @@ public class MissionLoigc {
SChallengeConfig sChallengeConfig = SChallengeConfig.sChallengeConfigs.get(fightId);
if(sChallengeConfig.getType() == 3 && sChallengeConfig.getDifficultType() == missionSubType[0] && sChallengeConfig.getMapId() == missionSubType[1]){
count++;
break;
}
}
}

View File

@ -26,7 +26,10 @@ public class FightDataManager implements BaseDataManager{
data.heroStoryTimes+=fightTimes;
result = new CumulationData.Result(missionType);
}else if(missionType == MissionType.GENERAL_STORY_PASS){
data.addExploreFight(fightId);
SChallengeConfig sChallengeConfig = SChallengeConfig.sChallengeConfigs.get(fightId);
if(sChallengeConfig.getType() == 1){
result = new CumulationData.Result(missionType);
}
result = new CumulationData.Result(missionType);
}else if(missionType == MissionType.HERO_STORY_PASS){
SChallengeConfig sChallengeConfig = SChallengeConfig.sChallengeConfigs.get(fightId);

View File

@ -43,6 +43,19 @@ public class BuyGoodsLogic {
private static final Logger LOGGER = LoggerFactory.getLogger(BuyGoodsLogic.class);
public static void flushEveryDay(User user) throws Exception {
//更新5星成长礼
user.getPlayerInfoManager().getRechargeInfo().getBuyGoodsTimes().put(21,0);
List<CommonProto.GiftGoodsInfo> goodsBagInfo = new ArrayList<>(SRechargeCommodityConfig.rechargeCommodityConfigMap.size());
BuyGoodsLogic.getGoodsBagInfo(user.getId(), goodsBagInfo,false);
ISession session = OnlineUserManager.getSessionByUid(user.getId());
if(session!=null){
PlayerInfoProto.AllGiftGoodsIndication build = PlayerInfoProto.AllGiftGoodsIndication.newBuilder().addAllGiftGoodsInfo(goodsBagInfo).build();
MessageUtil.sendIndicationMessage(session,1, MessageTypeProto.MessageType.ALL_GIFTGOODS_INDICATION_VALUE,build,true);
}
}
public static void testBuyGoods(ISession session,int goodsId) throws Exception {
int uid = session.getUid();
SRechargeCommodityConfig sRechargeCommodityConfig = SRechargeCommodityConfig.rechargeCommodityConfigMap.get(goodsId);
@ -198,6 +211,26 @@ public class BuyGoodsLogic {
PlayerInfoProto.DirectBuyIndication build = PlayerInfoProto.DirectBuyIndication.newBuilder().setDrop(drop).build();
MessageUtil.sendIndicationMessage(session,1, MessageTypeProto.MessageType.DIRECT_BUY_GOODS_INDICATION_VALUE,build,true);
}
if(sRechargeCommodityConfig.getTime()==4&&sRechargeCommodityConfig.getDiscountType().length==3){
int[] discountType = sRechargeCommodityConfig.getDiscountType();
int temptype = discountType[0];
int tempvalue = discountType[1];
if(temptype == 4&&tempvalue==5){
if (rechargeInfo.getTypeBagMap().containsKey(tempvalue)){
rechargeInfo.removeTypeBagMap(tempvalue);
}
if (rechargeInfo.getCacheSendedTypes().containsKey(tempvalue)){
rechargeInfo.getCacheSendedTypes().remove(tempvalue);
}
List<CommonProto.GiftGoodsInfo> goodsBagInfo = new ArrayList<>(SRechargeCommodityConfig.rechargeCommodityConfigMap.size());
BuyGoodsLogic.getGoodsBagInfo(uid, goodsBagInfo,false);
PlayerInfoProto.AllGiftGoodsIndication build = PlayerInfoProto.AllGiftGoodsIndication.newBuilder().addAllGiftGoodsInfo(goodsBagInfo).build();
MessageUtil.sendIndicationMessage(session,1, MessageTypeProto.MessageType.ALL_GIFTGOODS_INDICATION_VALUE,build,true);
}
}
}else{
String title = SErrorCodeEerverConfig.getI18NMessage("recharge_" + sRechargeCommodityConfig.getType() + "_title");
String content = SErrorCodeEerverConfig.getI18NMessage("recharge_" + sRechargeCommodityConfig.getType() + "_txt");
@ -273,6 +306,7 @@ public class BuyGoodsLogic {
long now = TimeUtils.now();
Map<Integer, Integer> buyGoodsTimes = rechargeInfo.getBuyGoodsTimes();
Map<Integer, Long> levelBagMap = rechargeInfo.getLevelBagMap();
Map<Integer, Long> typeBagMap = rechargeInfo.getTypeBagMap();
Map<Integer,Integer> goodsOrder = new HashMap<>(6);
Map<Integer,CommonProto.GiftGoodsInfo> giftGoodsInfoMap = new HashMap<>();
long createTime = user.getPlayerInfoManager().getCreateTime();
@ -317,6 +351,36 @@ public class BuyGoodsLogic {
}
endTime = startTime + value*3600*1000;
}
if(type == 4){
if(!typeBagMap.containsKey(value)){
continue;
}
startTime = typeBagMap.get(value);
int addtime = discountType[2];
int diffHour = (int) ((now - startTime) / 3600 / 1000);
if (diffHour >= addtime) {
continue;
}
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) / 3600 / 1000);
if (diffHourTemp < addtime) {
startTime =0;
}
}
}else {
rechargeInfo.getCacheSendedTypes().put(value, startTime);
}
}
}else{
startTime = ToolsUtil.getTimeLong(sRechargeCommodityConfig.getStartTimeLong(),sRechargeCommodityConfig.getEndTimeLong(),sRechargeCommodityConfig.getTime(),createTime,1);
endTime = ToolsUtil.getTimeLong(sRechargeCommodityConfig.getStartTimeLong(),sRechargeCommodityConfig.getEndTimeLong(),sRechargeCommodityConfig.getTime(),createTime,2);
@ -365,7 +429,6 @@ public class BuyGoodsLogic {
PlayerInfoProto.AllGiftGoodsIndication build = PlayerInfoProto.AllGiftGoodsIndication.newBuilder().addAllGiftGoodsInfo(goodsBagInfo).build();
MessageUtil.sendIndicationMessage(session,1, MessageTypeProto.MessageType.ALL_GIFTGOODS_INDICATION_VALUE,build,true);
}
}
public static void minuteCheckReharge() throws Exception {

View File

@ -14,6 +14,7 @@ import com.ljsd.jieling.handler.map.TemporaryItems;
import com.ljsd.jieling.ktbeans.KtEventUtils;
import com.ljsd.jieling.ktbeans.parmsBean.ParamEventBean;
import com.ljsd.jieling.logic.OnlineUserManager;
import com.ljsd.jieling.logic.activity.event.HeroFiveStarGetEvent;
import com.ljsd.jieling.logic.activity.event.Poster;
import com.ljsd.jieling.logic.activity.event.UseItemEvent;
import com.ljsd.jieling.logic.activity.event.UserLevelEvent;
@ -1190,6 +1191,9 @@ public class ItemUtil {
}
}
user.getUserMissionManager().onGameEvent(user,GameEvent.GET_HERO,heroStar[0],heroStar[1]);
if(scHero.getStar()==5){
Poster.getPoster().dispatchEvent(new HeroFiveStarGetEvent(user.getId()));
}
KtEventUtils.onKtEvent(user, ParamEventBean.UserItemEvent,reason,GlobalsDef.addReason,cardId,1,heroStar[1]);
}

View File

@ -26,25 +26,32 @@ public class SLotterySpecialConfig implements BaseConfig {
private int pool_id;
private static Map<Integer, List<SLotterySpecialConfig>> lotterySpecialConfigMap;
private static Map<Integer, Map<Integer,List<SLotterySpecialConfig>>> lotterySpecialConfigMap;
@Override
public void init() throws Exception {
Map<Integer, SLotterySpecialConfig> config = STableManager.getConfig(SLotterySpecialConfig.class);
Map<Integer, List<SLotterySpecialConfig>> lotterySpecialConfigMapTmp = new HashMap<>();
Map<Integer, Map<Integer,List<SLotterySpecialConfig>>> lotterySpecialConfigMapTmp = new HashMap<>();
for(SLotterySpecialConfig sLotterySpecialConfig : config.values()){
int type = sLotterySpecialConfig.getType();
if(!lotterySpecialConfigMapTmp.containsKey(type)){
lotterySpecialConfigMapTmp.put(type,new ArrayList<>());
int differentType = sLotterySpecialConfig.getDifferentType();
if(!lotterySpecialConfigMapTmp.containsKey(differentType)){
lotterySpecialConfigMapTmp.put(differentType,new HashMap<>());
}
lotterySpecialConfigMapTmp.get(type).add(sLotterySpecialConfig);
int type = sLotterySpecialConfig.getType();
if(!lotterySpecialConfigMapTmp.get(differentType).containsKey(type)){
lotterySpecialConfigMapTmp.get(differentType).put(type,new ArrayList<>());
}
lotterySpecialConfigMapTmp.get(differentType).get(type).add(sLotterySpecialConfig);
}
lotterySpecialConfigMap = lotterySpecialConfigMapTmp;
}
public static List<SLotterySpecialConfig> getLotterySpecialConfigListByType(int type) {
return lotterySpecialConfigMap.get(type);
public static List<SLotterySpecialConfig> getLotterySpecialConfigListByType(int differentType,int type) {
if(!lotterySpecialConfigMap.containsKey(differentType)){
return null;
}
return lotterySpecialConfigMap.get(differentType).get(type);
}
public int getId() {

View File

@ -6,7 +6,9 @@ import util.TimeUtils;
import util.StringUtil;
import java.util.HashMap;
import java.util.HashSet;
import java.util.Map;
import java.util.Set;
@Table(name ="RechargeCommodityConfig")
public class SRechargeCommodityConfig implements BaseConfig {
@ -56,18 +58,23 @@ public class SRechargeCommodityConfig implements BaseConfig {
public static Map<Integer, SRechargeCommodityConfig> rechargeCommodityConfigMap;
public static Map<Integer, SRechargeCommodityConfig> rechargeLevelMap;
private static Set<Integer> rchargeHeroGet;
@Override
public void init() throws Exception {
Map<Integer, SRechargeCommodityConfig> config = STableManager.getConfig(SRechargeCommodityConfig.class);
Map<Integer, SRechargeCommodityConfig> rechargeLevelMapTmp = new HashMap<>();
Set<Integer> rchargeHeroGetTemp = new HashSet<>();
for(SRechargeCommodityConfig sRechargeCommodityConfig : config.values()){
int[] discountType = sRechargeCommodityConfig.getDiscountType();
if(discountType!=null && discountType.length>0 &&discountType[0] == 2){
int level = discountType[1];
rechargeLevelMapTmp.put(level,sRechargeCommodityConfig);
}
if(discountType!=null && discountType.length>0 &&discountType[0] == 4){
rchargeHeroGetTemp.add(sRechargeCommodityConfig.getId());
}
int time = sRechargeCommodityConfig.getTime();
String startTime = sRechargeCommodityConfig.getStartTime();
@ -91,6 +98,7 @@ public class SRechargeCommodityConfig implements BaseConfig {
}
rechargeCommodityConfigMap = config;
rechargeLevelMap = rechargeLevelMapTmp;
rchargeHeroGet = rchargeHeroGetTemp;
}
@ -190,4 +198,8 @@ public class SRechargeCommodityConfig implements BaseConfig {
public int getLimitShow() {
return limitShow;
}
public static Set<Integer> getRchargeHeroGet() {
return rchargeHeroGet;
}
}