Merge branch 'master_test_mcz_redpacket' into master_test_gn

# Conflicts:
#	serverlogic/src/main/java/com/ljsd/jieling/handler/GetPlayerInfoHandler.java
#	serverlogic/src/main/java/com/ljsd/jieling/logic/hero/HeroLogic.java
back_recharge
mengchengzhen 2021-05-24 11:43:44 +08:00
commit 2010a1a9ce
14 changed files with 337 additions and 8 deletions

View File

@ -168,7 +168,8 @@ public enum ErrorCode implements IErrorCode {
HONGMENG_ING(139,"英雄在鸿蒙阵中,操作失败"),
LOCK_FILL(138,"锁定数量已满,无法刷新"),
LOCK_FILL(140,"锁定数量已满,无法刷新"),
REDPACKET_DAILY_LIMIT(141,"今日福利红包已达领取上限"),
;
private static final Set<Integer> CodeSet = new HashSet<>();

View File

@ -18,6 +18,7 @@ import com.ljsd.jieling.logic.activity.event.Poster;
import com.ljsd.jieling.logic.dao.*;
import com.ljsd.jieling.logic.dao.root.GlobalSystemControl;
import com.ljsd.jieling.logic.dao.root.User;
import com.ljsd.jieling.logic.family.GuildLogic;
import com.ljsd.jieling.logic.mission.GameEvent;
import com.ljsd.jieling.logic.player.PlayerLogic;
import com.ljsd.jieling.logic.question.QuestionLogic;
@ -70,7 +71,7 @@ public class GetPlayerInfoHandler extends BaseHandler{
PlayerManager playerInfoManager = user.getPlayerInfoManager();
ActivityLogic.getInstance().flushForLogin(user,iSession);
GlobalDataManaager.checkNeedReFlush(iSession,user,null);
GuildLogic.sendWelfareRedPacketInfo(user);
BuyGoodsNewLogic.refreshWelfareState(user);
// Poster.getPoster().dispatchEvent(new UserOnlineEvent(userId));
user.getUserMissionManager().onGameEvent(user, GameEvent.LOGIN_GAME,0);
@ -221,6 +222,7 @@ public class GetPlayerInfoHandler extends BaseHandler{
.addAllUserTitleList(CBean2Proto.getUserTitleList(user))
.setPracticeLevel(heroManager.getPracticeLevel())
.addAllSealList(CBean2Proto.getPurpleMansionSealInfo(user))
.setDailyredpack(playerInfoManager.getDailyWelfareRedPacket())
.build();
ReportUtil.onReportEvent(user, ReportEventEnum.APP_LOGIN.getType());
try {

View File

@ -40,6 +40,8 @@ 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.redpacket.WelfareRedPackEvent;
import com.ljsd.jieling.logic.redpacket.WelfareRedPacketType;
import com.ljsd.jieling.logic.store.BuyGoodsNewLogic;
import com.ljsd.jieling.logic.store.StoreLogic;
import com.ljsd.jieling.logic.store.StoreType;
@ -2288,6 +2290,8 @@ public class MapLogic {
itemIdList.add(item.getItemId());
itemNumList.add((int)item.getItemNum());
});
//发福利红包
Poster.getPoster().dispatchEvent(new WelfareRedPackEvent(user.getId(), WelfareRedPacketType.soul_demon.getType(),checkFightId));
ReportUtil.onReportEvent(user,ReportEventEnum.COMPLETE_XINMO.getType(),checkFightId,sFloodConfig.getMonster(),MonsterUtil.getMonsterForce(new int[]{sFloodConfig.getMonster()}),new Date(),"",itemIdList,itemNumList,"成功");
}

View File

@ -2,7 +2,14 @@ package com.ljsd.jieling.handler.map.miniGame;
import com.ljsd.jieling.globals.BIReason;
import com.ljsd.jieling.handler.map.MapGameInfo;
import com.ljsd.jieling.logic.OnlineUserManager;
import com.ljsd.jieling.logic.activity.event.Poster;
import com.ljsd.jieling.logic.dao.root.User;
import com.ljsd.jieling.logic.redpacket.WelfareRedPackEvent;
import com.ljsd.jieling.logic.redpacket.WelfareRedPacketType;
import com.ljsd.jieling.logic.store.BuyGoodsNewLogic;
import com.ljsd.jieling.network.session.ISession;
import config.SSpiritAnimal;
import rpc.protocols.CommonProto;
import rpc.protocols.MapInfoProto;
import com.ljsd.jieling.util.ItemUtil;
@ -63,7 +70,9 @@ public class CircleGame extends ColorGame{
//todo 需要告诉前端一个拿到的id
STrialGameConfig config = STrialGameConfig.trialGameConfigMap.get(id[0]);
CommonProto.Drop.Builder drop = ItemUtil.drop(user, new int[][]{{config.getRewardID(), config.getMin()}}, BIReason.MAP_EVENET_REWARD);
if(drop.getPokemonList().size()>0){
fiveStarPokemonPushByRandom(user,drop.getPokemonList().get(0).getTempId());
}
MapInfoProto.MapGameUpdateResponse response = MapInfoProto.MapGameUpdateResponse.newBuilder()
.setGameStatus(0)
@ -73,4 +82,13 @@ public class CircleGame extends ColorGame{
user.getMapManager().updateMapGameInfo(new MapGameInfo());
return response;
}
private void fiveStarPokemonPushByRandom(User user,int itemId) throws Exception{
SSpiritAnimal ssa = SSpiritAnimal.mapConfig.get(itemId);
if(ssa != null && ssa.getQuality()==5){
Poster.getPoster().dispatchEvent(new WelfareRedPackEvent(user.getId(), WelfareRedPacketType.game_pokemon.getType(),1));
ISession session = OnlineUserManager.getSessionByUid(user.getId());
BuyGoodsNewLogic.openPush(session,user,8,5,1);
}
}
}

View File

@ -13,6 +13,7 @@ import com.ljsd.jieling.logic.activity.ActivityLogic;
import com.ljsd.jieling.logic.activity.FightMainEventHandler;
import com.ljsd.jieling.logic.activity.RemoveEventHeroHandler;
import com.ljsd.jieling.logic.activity.UserLevelEventHandler;
import com.ljsd.jieling.logic.redpacket.WelfareRedPackSendHandler;
import com.ljsd.jieling.logic.activity.eventhandler.ActivityStateChangeHandler;
import com.ljsd.jieling.logic.activity.eventhandler.BuyGoodsDirectHandler;
import com.ljsd.jieling.logic.activity.eventhandler.GuildForceChangeEventHandler;
@ -257,6 +258,7 @@ public class GlobalDataManaager implements IManager {
new RemoveEventHeroHandler();
new FightMainEventHandler();
new BuyGoodsDirectHandler();
new WelfareRedPackSendHandler();
new ActivityStateChangeHandler();
new GuildForceChangeEventHandler();
new ShanHeSheJiTuEventHandler();

View File

@ -15,6 +15,7 @@ import com.ljsd.jieling.globals.Global;
import com.ljsd.jieling.handler.map.behavior.BehaviorUtil;
import com.ljsd.jieling.logic.GlobalDataManaager;
import com.ljsd.jieling.logic.OnlineUserManager;
import com.ljsd.jieling.logic.activity.event.Poster;
import com.ljsd.jieling.logic.dao.*;
import com.ljsd.jieling.logic.dao.root.User;
import com.ljsd.jieling.logic.fight.*;
@ -24,6 +25,8 @@ 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.logic.redpacket.WelfareRedPackEvent;
import com.ljsd.jieling.logic.redpacket.WelfareRedPacketType;
import com.ljsd.jieling.network.server.GlobalidHelper;
import com.ljsd.jieling.network.server.WorldHelper;
import com.ljsd.jieling.network.session.ISession;
@ -568,6 +571,9 @@ public class ArenaLogic {
if(!"".equals(rewardByRank)){
MailLogic.getInstance().sendMail(user.getId(),title,content,rewardByRank,nowTime, Global.MAIL_EFFECTIVE_TIME);
}
if(rank == 1){
Poster.getPoster().dispatchEvent(new WelfareRedPackEvent(user.getId(), WelfareRedPacketType.arena_rank.getType(),1));
}
}
MongoUtil.getInstence().lastUpdate();
}

View File

@ -19,6 +19,7 @@ import com.ljsd.jieling.ktbeans.ReportEventEnum;
import com.ljsd.jieling.ktbeans.ReportUtil;
import com.ljsd.jieling.logic.GlobalDataManaager;
import com.ljsd.jieling.logic.OnlineUserManager;
import com.ljsd.jieling.logic.activity.event.Poster;
import com.ljsd.jieling.logic.arena.ArenaLogic;
import com.ljsd.jieling.logic.blood.BloodLogic;
import com.ljsd.jieling.logic.dao.*;
@ -28,6 +29,8 @@ 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.player.PlayerLogic;
import com.ljsd.jieling.logic.redpacket.WelfareRedPackEvent;
import com.ljsd.jieling.logic.redpacket.WelfareRedPacketType;
import com.ljsd.jieling.network.server.ProtocolsManager;
import com.ljsd.jieling.network.session.ISession;
import rpc.protocols.ArenaInfoProto;
@ -415,6 +418,9 @@ public class ChampionshipLogic {
String title = SErrorCodeEerverConfig.getI18NMessage("champion_reward_title");
String content = SErrorCodeEerverConfig.getI18NMessageNeedConvert("champion_reward_txt", new Object[]{sChampionshipReward.getTitleDesc()},new int[]{1},"#");
MailLogic.getInstance().sendMail(user.getId(), title, content, ItemUtil.getMailReward(sChampionshipReward.getSeasonReward()), nowTime, Global.MAIL_EFFECTIVE_TIME);
if(rank == 1){
Poster.getPoster().dispatchEvent(new WelfareRedPackEvent(user.getId(), WelfareRedPacketType.top_match_rank.getType(),1));
}
}
}catch (Exception e){
LOGGER.info("Exception e = "+"size"+ arenaRankInfo.size()+ e.toString());

View File

@ -149,6 +149,10 @@ public class PlayerManager extends MongoBase {
private Map<Integer,Integer> situationPass = new HashMap<>();
private Map<Integer,Integer> welfareRedPackets = new HashMap<>();
private int dailyWelfareRedPacket;
public PlayerManager(){
this.setRootCollection(User._COLLECTION_NAME);
@ -1011,6 +1015,15 @@ public class PlayerManager extends MongoBase {
updateString("situationPass",situationPass);
}
public Map<Integer, Integer> getWelfareRedPackets() {
return welfareRedPackets;
}
public void setWelfareRedPackets(Map<Integer, Integer> welfareRedPackets) {
this.welfareRedPackets = welfareRedPackets;
updateString("welfareRedPackets",welfareRedPackets);
}
public int getSheJiOpenTime() {
return sheJiOpenTime;
}
@ -1038,4 +1051,13 @@ public class PlayerManager extends MongoBase {
this.newRechargeInfo = newRechargeInfo;
updateString("newRechargeInfo", newRechargeInfo);
}
public int getDailyWelfareRedPacket() {
return dailyWelfareRedPacket;
}
public void setDailyWelfareRedPacket(int dailyWelfareRedPacket) {
this.dailyWelfareRedPacket = dailyWelfareRedPacket;
updateString("dailyWelfareRedPacket",dailyWelfareRedPacket);
}
}

View File

@ -1,6 +1,7 @@
package com.ljsd.jieling.logic.family;
import com.google.protobuf.GeneratedMessage;
import com.google.protobuf.Message;
import com.ljsd.GameApplication;
import com.ljsd.jieling.core.GlobalsDef;
import com.ljsd.jieling.dataReport.reportBeans_37.ChatContentType;
@ -24,6 +25,8 @@ 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.rank.rankImpl.AbstractRank;
import com.ljsd.jieling.logic.redpacket.WelfareRedPackEvent;
import com.ljsd.jieling.logic.redpacket.WelfareRedPacketType;
import com.ljsd.jieling.logic.store.StoreLogic;
import com.ljsd.jieling.network.server.ProtocolsManager;
import com.ljsd.jieling.network.session.ISession;
@ -619,7 +622,7 @@ public class GuildLogic {
}
targetUser.getGuildMyInfo().setJoinTime(TimeUtils.nowInt());
ReportUtil.onReportEvent(targetUser, ReportEventEnum.JOIN_GUILD.getType(),String.valueOf(guildInfo.getId()),guildInfo.getName(),guildInfo.getLevel(),guildInfo.getTotalMembers());
sendNewGuyRedPacket(guildInfo);
}
/**
@ -1161,16 +1164,163 @@ public class GuildLogic {
}
AbstractRank rank = RankContext.getRankEnum(RankEnum.GUILD_RED_PACKAGE_RANK.getType());
double scoreById = rank.getScoreById(uid, String.valueOf(user.getPlayerInfoManager().getGuildId()));
double price = SRechargeCommodityNewConfig.configMap.get(config.getTradeId()).getPrice();
double price = 0;
if(config.getBaseType() == 1){
price = SRechargeCommodityNewConfig.configMap.get(config.getTradeId()).getPrice();
}
if(scoreById==-1||scoreById==0){
price+=TimeUtils.getDoubleTime();
}else{
price+=scoreById;
}
if(config.getBaseType() == 2){//福利红包
Map<Integer,Integer> map = user.getPlayerInfoManager().getWelfareRedPackets();
int old = map.get(redId);
SGuildRedPackConfig redPacket = SGuildRedPackConfig.sGuildRedPackConfigMap.get(redId);
if(redPacket.getRuleType() != 1){
map.put(redId,-1);
if(redPacket.getRuleType() == 3){
openNext(map,redPacket.getGroupId(),redId);
}
}else{
map.put(redId,old-1);
}
user.getPlayerInfoManager().setWelfareRedPackets(map);
PlayerInfoProto.WelfareRedPacketSendResponse.Builder build = PlayerInfoProto.WelfareRedPacketSendResponse.newBuilder();
for(Map.Entry<Integer,Integer> entry : map.entrySet()){
if(entry.getValue() >= 0){
build.addRedpacket(CommonProto.WelfareRedPacket.newBuilder().setId(entry.getKey()).setNum(entry.getValue()));
}
}
ISession session = OnlineUserManager.getSessionByUid(user.getId());
MessageUtil.sendMessage(session,1, MessageTypeProto.MessageType.WELFARE_RED_PACKET_SEND_RESPONSE.getNumber(),build.build());
}
rank.addRank(uid,String.valueOf(user.getPlayerInfoManager().getGuildId()),price);
RedisUtil.getInstence().lSet(RedisKey.getKey("red_remain_list",String.valueOf(increment),false),reward,config.getLastTime());
}
public static void openNext(Map<Integer,Integer> map,int groupId,int cur){
boolean f = false;
for(SGuildRedPackConfig config : SGuildRedPackConfig.welfareRedPackBySerise.get(groupId)){
if(f){
map.put(config.getId(),0);
break;
}
if(config.getId() == cur){
f = true;
}
}
}
/**
*
* @param uid
* @param redId
* @throws Exception
*/
public static void addWelfareRedPacket(int uid,int redId) throws Exception {
User user = UserManager.getUser(uid);
SGuildRedPackConfig config = SGuildRedPackConfig.sGuildRedPackConfigMap.get(redId);
if(config==null || config.getBaseType() != 2){
return;
}
Map<Integer,Integer> redPacketsMap = user.getPlayerInfoManager().getWelfareRedPackets();
switch (config.getRuleType()){
case 1:
if(redPacketsMap.get(config.getId())>0){
if(redPacketsMap.get(config.getId()) < config.getMaxNum()){
redPacketsMap.put(config.getId(),redPacketsMap.get(config.getId())+1);
}
}else{
redPacketsMap.put(config.getId(),1);
}
break;
case 2:
if(redPacketsMap.get(config.getId())>=0){
redPacketsMap.put(config.getId(),1);
}
break;
case 3:
List<SGuildRedPackConfig> serise = SGuildRedPackConfig.welfareRedPackBySerise.get(config.getGroupId());
for(SGuildRedPackConfig c : serise){
if(redPacketsMap.containsKey(c.getId())){
if(redPacketsMap.get(c.getId())>-1){
if(c.getId() == config.getId()){
redPacketsMap.put(c.getId(),1);
break;
}
}else{
continue;
}
}else{
if(c.getId() == config.getId()){
redPacketsMap.put(config.getId(),1);
}else{
break;
}
}
}
break;
}
user.getPlayerInfoManager().setWelfareRedPackets(redPacketsMap);
sendWelfareRedPacketInfoIndication(user);
}
public static void sendWelfareRedPacketInfo(User user){
Map<Integer,Integer> redPacketsMap = user.getPlayerInfoManager().getWelfareRedPackets();
if(redPacketsMap.size() == 0){//初始化
initWelfareRedPacketInfo(user);
}
PlayerInfoProto.WelfareRedPacketPush.Builder build = PlayerInfoProto.WelfareRedPacketPush.newBuilder();
for(Map.Entry<Integer,Integer> entry : redPacketsMap.entrySet()){
if(entry.getValue() >= 0){
build.addRedpacket(CommonProto.WelfareRedPacket.newBuilder().setId(entry.getKey()).setNum(entry.getValue()));
}
}
ISession session = OnlineUserManager.getSessionByUid(user.getId());
MessageUtil.sendMessage(session,1, MessageTypeProto.MessageType.WELFARE_RED_PACKET_INFO.getNumber(),build.build(),true);
}
public static void sendWelfareRedPacketInfoIndication(User user){
Map<Integer,Integer> redPacketsMap = user.getPlayerInfoManager().getWelfareRedPackets();
if(redPacketsMap.size() == 0){//初始化
initWelfareRedPacketInfo(user);
}
PlayerInfoProto.WelfareRedPacketPush.Builder build = PlayerInfoProto.WelfareRedPacketPush.newBuilder();
for(Map.Entry<Integer,Integer> entry : redPacketsMap.entrySet()){
if(entry.getValue() >= 0){
build.addRedpacket(CommonProto.WelfareRedPacket.newBuilder().setId(entry.getKey()).setNum(entry.getValue()));
}
}
ISession session = OnlineUserManager.getSessionByUid(user.getId());
MessageUtil.sendIndicationMessage(session,1, MessageTypeProto.MessageType.WELFARE_RED_PACKET_INFO.getNumber(),build.build(),true);
}
public static void initWelfareRedPacketInfo(User user){
Map<Integer,Integer> redPacketsMap = user.getPlayerInfoManager().getWelfareRedPackets();
for(SGuildRedPackConfig config : SGuildRedPackConfig.sWelfareRedPackByRule.values()){
if(config.getRuleType() == 3){
if(config.getGroupId() == 2){
int num = user.getMapManager().getLastMonsterAttack();
for(SGuildRedPackConfig config1 : SGuildRedPackConfig.welfareRedPackBySerise.get(config.getGroupId())){
if(num >= config1.getRuleId()[1]){
redPacketsMap.put(config.getId(),1);
}else{
redPacketsMap.put(config.getId(),0);
break;
}
}
}else{
if(config.getId()==SGuildRedPackConfig.welfareRedPackBySerise.get(config.getGroupId()).get(0).getId())
redPacketsMap.put(config.getId(),0);
}
}else{
redPacketsMap.put(config.getId(),0);
}
}
}
/**
*
* @param session
@ -1209,6 +1359,7 @@ public class GuildLogic {
*/
public static void robRedPackage(ISession session, int redId, MessageTypeProto.MessageType messageType) throws Exception{
int uid = session.getUid();
AcceptRedInfo isAlready = RedisUtil.getInstence().getMapValue("red_already_list", String.valueOf(redId), String.valueOf(uid), AcceptRedInfo.class);
if(isAlready!=null){
throw new ErrorCodeException(ErrorCode.SERVER_SELF_DEFINE);
@ -1221,6 +1372,17 @@ public class GuildLogic {
if(packInfo==null){
throw new ErrorCodeException(ErrorCode.FAMILY_NULL);
}
//福利红包
if(SGuildRedPackConfig.welfareRedPackIds.contains(packInfo.getTypeId())){
User user = UserManager.getUser(uid);
int dailyGet = user.getPlayerInfoManager().getDailyWelfareRedPacket();
int maxGet = SSpecialConfig.getIntegerValue(SSpecialConfig.WELFAREREDPACKET_LIMIT);
if(dailyGet < maxGet){
user.getPlayerInfoManager().setDailyWelfareRedPacket(dailyGet+1);
}else{
throw new ErrorCodeException(ErrorCode.REDPACKET_DAILY_LIMIT);
}
}
SGuildRedPackConfig config = SGuildRedPackConfig.sGuildRedPackConfigMap.get(packInfo.getTypeId());
int count = Integer.parseInt(String.valueOf(redPackage));
ItemUtil.drop(UserManager.getUser(uid),new int[][]{new int[]{config.getTotalMoney()[0],count}},BIReason.RED_PACKAGE_REWARD);
@ -1539,5 +1701,13 @@ public class GuildLogic {
return true;
}
private static void sendNewGuyRedPacket(GuildInfo guildInfo) throws Exception{
for(int id : guildInfo.getMembers().get(GlobalsDef.CHAIRMAN)){
User user = UserManager.getUser(id);
if(user == null)
continue;
Poster.getPoster().dispatchEvent(new WelfareRedPackEvent(user.getId(), WelfareRedPacketType.newfish_come.getType(),0));
}
}
}

View File

@ -18,6 +18,7 @@ import com.ljsd.jieling.jbean.ActivityMission;
import com.ljsd.jieling.jbean.ActivityProgressInfo;
import com.ljsd.jieling.ktbeans.ReportEventEnum;
import com.ljsd.jieling.ktbeans.ReportUtil;
import com.ljsd.jieling.logic.OnlineUserManager;
import com.ljsd.jieling.logic.activity.ActivityType;
import com.ljsd.jieling.logic.activity.event.*;
import com.ljsd.jieling.logic.activity.eventhandler.HeroFiveStarGetEventHandler;
@ -29,6 +30,10 @@ import com.ljsd.jieling.logic.fight.passiveSkillCal.PassiveskillCalEnum;
import com.ljsd.jieling.logic.item.ItemLogic;
import com.ljsd.jieling.logic.mission.GameEvent;
import com.ljsd.jieling.logic.player.PlayerLogic;
import com.ljsd.jieling.logic.redpacket.WelfareRedPackEvent;
import com.ljsd.jieling.logic.redpacket.WelfareRedPacketType;
import com.ljsd.jieling.logic.store.BuyGoodsNewLogic;
import com.ljsd.jieling.network.server.ProtocolsManager;
import com.ljsd.jieling.network.session.ISession;
import com.ljsd.jieling.util.*;
import config.*;
@ -343,6 +348,7 @@ public class HeroLogic{
heroManager.updateRandCount(type,perCount);
CommonProto.Drop.Builder drop = ItemUtil.dropPer(user, resultRandom,BIReason.HERO_RANDOM);
fiveStarPushByRandom(user,resultRandom);
fiveStarPokemonPushByRandom(user,resultRandom);
builder.setDrop(drop);
MessageUtil.sendMessage(session, 1, MessageTypeProto.MessageType.HERO_RAND_RESPONSE_VALUE, builder.build(), true);
// System.out.println(System.currentTimeMillis()-time);
@ -1151,6 +1157,7 @@ public class HeroLogic{
}
String consume = StringUtil.parseArrayToString(consumeMaterial);
Poster.getPoster().dispatchEvent(new WelfareRedPackEvent(user.getId(), WelfareRedPacketType.hero_star.getType(),targetHero.getStar()));
ReportUtil.onReportEvent(user, ReportEventEnum.HERO_STRENGTHEN.getType(),String.valueOf(targetHero.getTemplateId()),String.valueOf(oldStar),String.valueOf(targetHero.getStar()),consume,reportConsumeHero.toString());
}
@ -2465,6 +2472,9 @@ public class HeroLogic{
if(drop.getHeroList().size()>0){
fiveStarPushByCombine(user,drop.getHero(0).getHeroId(), composeNum);
}
if(drop.getPokemonList().size()>0){
fiveStarPokemonPushByCombine(user,drop.getPokemonList().get(0).getTempId());
}
HeroInfoProto.HeroComposeResponse heroComposeResponse = HeroInfoProto.HeroComposeResponse
.newBuilder()
.setDrop(drop)
@ -3655,7 +3665,7 @@ public class HeroLogic{
consumeBuilder.append(consume[0]).append("#").append(consume[1]);
}
ReportUtil.onReportEvent(user,ReportEventEnum.BEAST_STAR.getType(),pokemon.getTmpId(),oldStar,pokemon.getStar(),consumeBuilder.toString());
BuyGoodsNewLogic.openPush(session,user,9,pokemon.getStar(),1);
}
@ -4572,4 +4582,32 @@ public class HeroLogic{
}
}
/**
*
*/
public static void fiveStarPokemonPushByRandom(User user,int[][] getHeros) throws Exception{
int fiveStarNum = 0;
for(int[] i : getHeros){
SSpiritAnimal ssa = SSpiritAnimal.mapConfig.get(i);
if(ssa != null && ssa.getQuality()==5){
fiveStarNum = 1;
Poster.getPoster().dispatchEvent(new WelfareRedPackEvent(user.getId(), WelfareRedPacketType.random_pokemon.getType(),1));
}
}
if(fiveStarNum > 0){
ISession session = OnlineUserManager.getSessionByUid(user.getId());
BuyGoodsNewLogic.openPush(session,user,8,5,fiveStarNum);
}
}
/**
*
*/
public static void fiveStarPokemonPushByCombine(User user,int itemId) throws Exception{
SSpiritAnimal ssa = SSpiritAnimal.mapConfig.get(itemId);
if(ssa != null && ssa.getQuality()==5){
ISession session = OnlineUserManager.getSessionByUid(user.getId());
BuyGoodsNewLogic.openPush(session,user,8,5,1);
}
}
}

View File

@ -444,7 +444,7 @@ public class PlayerLogic {
}
}
playerInfoManager.setDailyWelfareRedPacket(0);
}
public void modifyDecoration(ISession session, int type,int decorationId,MessageTypeProto.MessageType messageType) throws Exception {

View File

@ -4,7 +4,9 @@ package config;
import manager.STableManager;
import manager.Table;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
@Table(name ="GuildRedPackConfig")
@ -28,19 +30,54 @@ public class SGuildRedPackConfig implements BaseConfig {
private int tradeId;
private int baseType;
private int ruleType;
private int maxNum;
private int groupId;
private int[] ruleId;
public static Map<Integer,SGuildRedPackConfig> sGuildRedPackConfigMap;
public static Map<Integer,SGuildRedPackConfig> sGuildRedPackByGoodsId;
public static Map<Integer,SGuildRedPackConfig> sWelfareRedPackByRule;
public static Map<Integer, List<SGuildRedPackConfig>> welfareRedPackBySerise;
public static List<Integer> welfareRedPackIds;
@Override
public void init() throws Exception {
sGuildRedPackConfigMap = STableManager.getConfig(SGuildRedPackConfig.class);
sGuildRedPackByGoodsId = new HashMap<>();
sWelfareRedPackByRule = new HashMap<>();
welfareRedPackBySerise = new HashMap<>();
welfareRedPackIds = new ArrayList<>();
for(Map.Entry<Integer,SGuildRedPackConfig> entry:sGuildRedPackConfigMap.entrySet()){
int tradeId = entry.getValue().getTradeId();
if(!sGuildRedPackConfigMap.containsKey(tradeId)){
if(entry.getValue().getBaseType() == 1 && !sGuildRedPackConfigMap.containsKey(tradeId)){
sGuildRedPackByGoodsId.put(tradeId,entry.getValue());
}
if(entry.getValue().getBaseType() == 2){
welfareRedPackIds.add(entry.getKey());
}
if(entry.getValue().getBaseType() == 2 && !sWelfareRedPackByRule.containsKey(entry.getValue().getRuleId()[0])){
sWelfareRedPackByRule.put(entry.getValue().getRuleId()[0],entry.getValue());
}
if(entry.getValue().getRuleType() == 3){
if(welfareRedPackBySerise.containsKey(entry.getValue().getGroupId())){
welfareRedPackBySerise.get(entry.getValue().getGroupId()).add(entry.getValue());
}else{
List<SGuildRedPackConfig> list = new ArrayList<>();
list.add(entry.getValue());
welfareRedPackBySerise.put(entry.getValue().getGroupId(),list);
}
}
}
}
@ -81,5 +118,23 @@ public class SGuildRedPackConfig implements BaseConfig {
return tradeId;
}
public int getBaseType() {
return baseType;
}
public int getRuleType() {
return ruleType;
}
public int getMaxNum() {
return maxNum;
}
public int getGroupId() {
return groupId;
}
public int[] getRuleId() {
return ruleId;
}
}

View File

@ -100,6 +100,7 @@ public class SSpecialConfig implements BaseConfig {
public static final String FU_XING = "FuXing";//福星高照可购买天数和可领取天数
public static final String FU_XING_STORE = "FuXingStore";//福星高照购买解锁奖励
public static final String YIJIANGOUMAI = "YiJianGouMai";//一件购买
public static final String WELFAREREDPACKET_LIMIT = "RedPackMaxGainNum";//每日领取红包数量上限
@Override
public void init() throws Exception {

View File

@ -44,15 +44,19 @@ public class SSpiritAnimal implements BaseConfig {
private int[] returnCost;
public static Map<Integer,SSpiritAnimal> pieceConfig;
public static Map<Integer,SSpiritAnimal> mapConfig;
@Override
public void init() throws Exception {
Map<Integer, SSpiritAnimal> config = STableManager.getConfig(SSpiritAnimal.class);
Map<Integer,SSpiritAnimal> pieceConfigTemp = new HashMap<>();
Map<Integer,SSpiritAnimal> tempMap = new HashMap<>();
for(Map.Entry<Integer,SSpiritAnimal> entry :config.entrySet()){
pieceConfigTemp.put(entry.getValue().getPiecesId(),entry.getValue());
tempMap.put(entry.getKey(),entry.getValue());
}
pieceConfig = pieceConfigTemp;
mapConfig = tempMap;
}