Merge branch 'master' of 60.1.1.230:backend/jieling_server
commit
5855a00391
|
@ -0,0 +1,71 @@
|
|||
package com.ljsd.jieling.config;
|
||||
|
||||
import com.ljsd.jieling.logic.STableManager;
|
||||
import com.ljsd.jieling.logic.Table;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
@Table(name = "ActivityRankingReward")
|
||||
public class SActivityRankingReward implements BaseConfig {
|
||||
|
||||
private int id;
|
||||
|
||||
private int activityId;
|
||||
|
||||
private int minRank;
|
||||
|
||||
private int maxRank;
|
||||
|
||||
private int[][] rankingReward;
|
||||
|
||||
private static Map<Integer, SActivityRankingReward> sActivityRankingRewardMap;
|
||||
|
||||
private static Map<Integer, List<SActivityRankingReward>> sActivityRankingRewardMapByActivityId;
|
||||
|
||||
@Override
|
||||
public void init() throws Exception {
|
||||
sActivityRankingRewardMap = STableManager.getConfig(SActivityRankingReward.class);
|
||||
Map<Integer, List<SActivityRankingReward>> integerListHashMap = new HashMap<>();
|
||||
for (SActivityRankingReward sActivityRankingReward : sActivityRankingRewardMap.values()) {
|
||||
int activityId = sActivityRankingReward.getActivityId();
|
||||
if (!integerListHashMap.containsKey(activityId)) {
|
||||
integerListHashMap.put(activityId, new ArrayList<>());
|
||||
}
|
||||
integerListHashMap.get(activityId).add(sActivityRankingReward);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public static Map<Integer, SActivityRankingReward> getsActivityRankingRewardMap() {
|
||||
return sActivityRankingRewardMap;
|
||||
}
|
||||
|
||||
public static List<SActivityRankingReward> getsActivityRankingRewardMapByActivityId(int Id) {
|
||||
return sActivityRankingRewardMapByActivityId.get(Id);
|
||||
}
|
||||
|
||||
public int getId() {
|
||||
return id;
|
||||
}
|
||||
|
||||
public int getActivityId() {
|
||||
return activityId;
|
||||
}
|
||||
|
||||
public int getMinRank() {
|
||||
return minRank;
|
||||
}
|
||||
|
||||
public int getMaxRank() {
|
||||
return maxRank;
|
||||
}
|
||||
|
||||
public int[][] getRankingReward() {
|
||||
return rankingReward;
|
||||
}
|
||||
|
||||
|
||||
}
|
|
@ -2,53 +2,62 @@ package com.ljsd.jieling.config;
|
|||
|
||||
import com.ljsd.jieling.logic.STableManager;
|
||||
import com.ljsd.jieling.logic.Table;
|
||||
import com.ljsd.jieling.logic.activity.ActivityType;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
@Table(name ="ActivityRewardConfig")
|
||||
@Table(name = "ActivityRewardConfig")
|
||||
public class SActivityRewardConfig implements BaseConfig {
|
||||
|
||||
private int id;
|
||||
private int id;
|
||||
|
||||
private int activityId;
|
||||
private int activityId;
|
||||
|
||||
private int[][] values;
|
||||
private int[][] values;
|
||||
|
||||
private int[][] reward;
|
||||
private int[][] reward;
|
||||
|
||||
private static Map<Integer, SActivityRewardConfig> sActivityRewardConfigMap;
|
||||
private static Map<Integer, SActivityRewardConfig> sActivityRewardConfigMap;
|
||||
|
||||
private static Map<Integer, List<SActivityRewardConfig>> sActivityRewardConfigListMap;
|
||||
private static Map<Integer, List<SActivityRewardConfig>> sActivityRewardConfigListMap;
|
||||
|
||||
|
||||
@Override
|
||||
private static Map<Integer, Integer> rechargeDaySum = new HashMap<>();//连续充值天数
|
||||
|
||||
@Override
|
||||
public void init() throws Exception {
|
||||
Map<Integer, SActivityRewardConfig> config = STableManager.getConfig(SActivityRewardConfig.class);
|
||||
Map<Integer, List<SActivityRewardConfig>> sActivityRewardConfigListMapTmp = new HashMap<>();
|
||||
for(SActivityRewardConfig sActivityRewardConfig : config.values()){
|
||||
for (SActivityRewardConfig sActivityRewardConfig : config.values()) {
|
||||
int activityId = sActivityRewardConfig.getActivityId();
|
||||
if(!sActivityRewardConfigListMapTmp.containsKey(activityId)){
|
||||
sActivityRewardConfigListMapTmp.put(activityId,new ArrayList<>());
|
||||
if (!sActivityRewardConfigListMapTmp.containsKey(activityId)) {
|
||||
sActivityRewardConfigListMapTmp.put(activityId, new ArrayList<>());
|
||||
}
|
||||
sActivityRewardConfigListMapTmp.get(activityId).add(sActivityRewardConfig);
|
||||
}
|
||||
sActivityRewardConfigMap = config;
|
||||
sActivityRewardConfigListMap = sActivityRewardConfigListMapTmp;
|
||||
}
|
||||
|
||||
sActivityRewardConfigListMap.get(ActivityType.RECHARGE_SUM_DAY).forEach(sActivityRewardConfig ->
|
||||
rechargeDaySum.put(sActivityRewardConfig.getValues()[0][1], sActivityRewardConfig.getId()));
|
||||
|
||||
}
|
||||
|
||||
|
||||
public static SActivityRewardConfig getsActivityRewardConfigByMissionId(int missionId) {
|
||||
return sActivityRewardConfigMap.get(missionId);
|
||||
}
|
||||
|
||||
public static List<SActivityRewardConfig> getsActivityRewardConfigByActivityId(int activityId) {
|
||||
public static List<SActivityRewardConfig> getsActivityRewardConfigByActivityId(int activityId) {
|
||||
return sActivityRewardConfigListMap.get(activityId);
|
||||
}
|
||||
|
||||
public static Map<Integer, Integer> getRechargeDaySum() {
|
||||
return rechargeDaySum;
|
||||
}
|
||||
|
||||
public int getId() {
|
||||
return id;
|
||||
}
|
||||
|
|
|
@ -101,8 +101,6 @@ public class SGameSetting implements BaseConfig {
|
|||
private Map<Integer,int[]> itemRecoveryMap;
|
||||
|
||||
|
||||
|
||||
|
||||
private static SGameSetting gameSetting;
|
||||
|
||||
@Override
|
||||
|
@ -289,4 +287,12 @@ public class SGameSetting implements BaseConfig {
|
|||
public void setItemRecoveryMap(Map<Integer, int[]> itemRecoveryMap) {
|
||||
this.itemRecoveryMap = itemRecoveryMap;
|
||||
}
|
||||
|
||||
public int getShowRank() {
|
||||
return showRank;
|
||||
}
|
||||
|
||||
public void setShowRank(int showRank) {
|
||||
showRank = showRank;
|
||||
}
|
||||
}
|
|
@ -0,0 +1,48 @@
|
|||
package com.ljsd.jieling.config;
|
||||
|
||||
import com.ljsd.jieling.logic.STableManager;
|
||||
import com.ljsd.jieling.logic.Table;
|
||||
|
||||
import java.util.Map;
|
||||
|
||||
@Table(name = "SignInConfig")
|
||||
public class SSignInConfig implements BaseConfig {
|
||||
|
||||
private int id;
|
||||
|
||||
private int month;
|
||||
|
||||
private int day;
|
||||
|
||||
private int[] reward;
|
||||
|
||||
private static Map<Integer, SSignInConfig> sSignInConfigMap;
|
||||
|
||||
@Override
|
||||
public void init() throws Exception {
|
||||
sSignInConfigMap = STableManager.getConfig(SSignInConfig.class);
|
||||
|
||||
}
|
||||
|
||||
public static Map<Integer, SSignInConfig> getsSignInConfigMap() {
|
||||
return sSignInConfigMap;
|
||||
}
|
||||
|
||||
public int getId() {
|
||||
return id;
|
||||
}
|
||||
|
||||
public int getMonth() {
|
||||
return month;
|
||||
}
|
||||
|
||||
public int getDay() {
|
||||
return day;
|
||||
}
|
||||
|
||||
public int[] getreward() {
|
||||
return reward;
|
||||
}
|
||||
|
||||
|
||||
}
|
|
@ -109,6 +109,7 @@ public class RedisKey {
|
|||
public static final String TOWER_RANK = "TOWER_RANK";
|
||||
|
||||
public static final String FORCE_RANK = "FORCE_RANK";
|
||||
public static final String EXPERT_RANK = "EXPERT_RANK";
|
||||
|
||||
public static final String FAMILY_ID = "FAMILY_ID";
|
||||
|
||||
|
|
|
@ -0,0 +1,23 @@
|
|||
package com.ljsd.jieling.handler;
|
||||
|
||||
import com.ljsd.jieling.logic.activity.ActivityLogic;
|
||||
import com.ljsd.jieling.netty.cocdex.PacketNetData;
|
||||
import com.ljsd.jieling.network.session.ISession;
|
||||
import com.ljsd.jieling.protocols.MessageTypeProto;
|
||||
import com.ljsd.jieling.protocols.PlayerInfoProto;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
@Component
|
||||
public class ExpertRankHandler extends BaseHandler {
|
||||
@Override
|
||||
public MessageTypeProto.MessageType getMessageCode() {
|
||||
return MessageTypeProto.MessageType.GETF_EXPERT_RANK_INFO_REQUEST;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void process(ISession iSession, PacketNetData netData) throws Exception {
|
||||
byte[] bytes = netData.parseClientProtoNetData();
|
||||
PlayerInfoProto.GetExpertInfoRequest getExpertInfoRequest = PlayerInfoProto.GetExpertInfoRequest.parseFrom(bytes);
|
||||
ActivityLogic.getInstance().getExpertRank(iSession,getExpertInfoRequest.getActiviteId());
|
||||
}
|
||||
}
|
|
@ -121,6 +121,7 @@ public class GetPlayerInfoHandler extends BaseHandler{
|
|||
.addAllGoodsTypeDuration(goodsTypeDurations)
|
||||
.setHadBuyTreasure(playerInfoManager.getHadBuyTreasure())
|
||||
.setTreasureScore(playerInfoManager.getTreasureScore())
|
||||
.setSignInInfo(CommonProto.SignInInfo.newBuilder().setDays(playerInfoManager.getSign()+1).setState(playerInfoManager.getSignTotay()).build())
|
||||
.build();
|
||||
try {
|
||||
MessageUtil.sendMessage(iSession, 1, MessageTypeProto.MessageType.GET_PLAYERINFO_RESPONSE_VALUE, getPlayerInfoResponse, true);
|
||||
|
|
|
@ -0,0 +1,60 @@
|
|||
package com.ljsd.jieling.handler;
|
||||
|
||||
import com.ljsd.jieling.config.SSignInConfig;
|
||||
import com.ljsd.jieling.globals.BIReason;
|
||||
import com.ljsd.jieling.logic.dao.UserManager;
|
||||
import com.ljsd.jieling.logic.dao.root.User;
|
||||
import com.ljsd.jieling.netty.cocdex.PacketNetData;
|
||||
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.ItemUtil;
|
||||
import com.ljsd.jieling.util.MessageUtil;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import java.util.Calendar;
|
||||
|
||||
@Component
|
||||
public class SignInHandler extends BaseHandler {
|
||||
@Override
|
||||
public MessageTypeProto.MessageType getMessageCode() {
|
||||
return MessageTypeProto.MessageType.SIGN_IN_REQUEST;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void process(ISession iSession, PacketNetData netData) throws Exception {
|
||||
byte[] bytes = netData.parseClientProtoNetData();
|
||||
PlayerInfoProto.SignInRequest signInRequest = PlayerInfoProto.SignInRequest.parseFrom(bytes);
|
||||
int index = signInRequest.getDayIndex();
|
||||
|
||||
SSignInConfig sign = SSignInConfig.getsSignInConfigMap().get(index);
|
||||
//check cfg
|
||||
if (sign == null) {
|
||||
MessageUtil.sendErrorResponse(iSession, 0, MessageTypeProto.MessageType.SIGN_IN_RESPONSE_VALUE, "cfg null");
|
||||
return;
|
||||
}
|
||||
|
||||
Calendar cale = Calendar.getInstance();
|
||||
int month = cale.get(Calendar.MONTH) + 1;
|
||||
if (sign.getMonth() != month) {
|
||||
return;
|
||||
}
|
||||
|
||||
User user = UserManager.getUser(iSession.getUid());
|
||||
if (sign.getDay() != (user.getPlayerInfoManager().getSign() + 1)) {
|
||||
MessageUtil.sendErrorResponse(iSession, 0, MessageTypeProto.MessageType.SIGN_IN_RESPONSE_VALUE, "day out0findex");
|
||||
return;
|
||||
}
|
||||
|
||||
user.getPlayerInfoManager().setSignTotay(1);
|
||||
|
||||
int[] reward = sign.getreward();
|
||||
int[][] cost = new int[1][];
|
||||
cost[0] = reward;
|
||||
CommonProto.Drop.Builder drop = ItemUtil.drop(user, cost, BIReason.TAKE_ACTIVITY_REWARD);
|
||||
PlayerInfoProto.SignInResponse build = PlayerInfoProto.SignInResponse.newBuilder().setDrop(drop).build();
|
||||
MessageUtil.sendMessage(iSession, 1, MessageTypeProto.MessageType.SIGN_IN_RESPONSE_VALUE, build, true);
|
||||
|
||||
}
|
||||
}
|
|
@ -14,6 +14,8 @@ import com.ljsd.jieling.handler.mission.Mission;
|
|||
import com.ljsd.jieling.ktbeans.KTGameType;
|
||||
import com.ljsd.jieling.ktbeans.KtEventUtils;
|
||||
import com.ljsd.jieling.ktbeans.parmsBean.ParamEventBean;
|
||||
import com.ljsd.jieling.logic.activity.event.Poster;
|
||||
import com.ljsd.jieling.logic.activity.event.StoryEvent;
|
||||
import com.ljsd.jieling.logic.dao.*;
|
||||
import com.ljsd.jieling.logic.dao.root.User;
|
||||
import com.ljsd.jieling.logic.fight.CheckFight;
|
||||
|
@ -181,13 +183,16 @@ public class MapLogic {
|
|||
}
|
||||
user.setMapManager(mapManager);
|
||||
user.getUserMissionManager().onGameEvent(user,GameEvent.PlAY_STORY,SChallengeConfig.sChallengeConfigs.get(mapId).getType(),1);
|
||||
Poster.getPoster().dispatchEvent(new StoryEvent(user.getId()));
|
||||
} else if (mapManager.getCurMapId() != mapId) {
|
||||
MessageUtil.sendErrorResponse(iSession, 0, messageType.getNumber(), "地图错误,应进入" + mapManager.getCurMapId());
|
||||
return;
|
||||
}
|
||||
MapInfoProto.MapEnterResponse.Builder mapEnterResponse = MapInfoProto.MapEnterResponse.newBuilder();
|
||||
SChallengeMapConfig sChallengeMapConfig = SChallengeMapConfig.integerSChallengeMapConfigMap.get(mapManager.getCurMapId());
|
||||
mapEnterResponse.setCurXY(CellUtil.xy2Pos(sChallengeMapConfig.getPosition()[0],sChallengeMapConfig.getPosition()[1]));
|
||||
|
||||
if(type ==4){
|
||||
mapManager.updateEndlessMapId(mapId);
|
||||
List<TeamPosHeroInfo> teamPosForHero = user.getTeamPosManager().getTeamPosForHero().get(teamId);
|
||||
for (int i = 0; i <teamPosForHero.size() ; i++) {
|
||||
String endlessHeroId = teamPosForHero.get(i).getHeroId();
|
||||
|
@ -195,8 +200,13 @@ public class MapLogic {
|
|||
mapManager.addEndlessHero(teamPosForHero.get(i).getHeroId(),maxHp);
|
||||
}
|
||||
if(mapManager.getEndlessMapInfo().getCurCell()!=0){
|
||||
mapManager.setCurXY(mapManager.getEndlessMapInfo().getCurCell());
|
||||
if(mapManager.getEndlessMapInfo().getCurMapId()==mapId) {
|
||||
mapEnterResponse.setCurXY(mapManager.getEndlessMapInfo().getCurCell());
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
mapManager.updateEndlessMapId(mapId);
|
||||
EndlessMapInfo endlessMapInfo = mapManager.getEndlessMapInfo();
|
||||
for(Map.Entry<Integer,Map<Integer,String>> entry :endlessMapInfo.getMapSign().entrySet()){
|
||||
int curMapId = entry.getKey();
|
||||
|
@ -238,14 +248,9 @@ public class MapLogic {
|
|||
}
|
||||
mapEnterResponse.addAllBuf(towerBuffs);
|
||||
}
|
||||
SChallengeMapConfig sChallengeMapConfig = SChallengeMapConfig.integerSChallengeMapConfigMap.get(mapManager.getCurMapId());
|
||||
mapEnterResponse.setDieCount(mapManager.getDieCount());
|
||||
mapEnterResponse.addAllMapList(cells);
|
||||
if(type==4&&mapManager.getEndlessMapInfo().getCurCell()!=0){
|
||||
mapEnterResponse.setCurXY(mapManager.getEndlessMapInfo().getCurCell());
|
||||
}else{
|
||||
mapEnterResponse.setCurXY(CellUtil.xy2Pos(sChallengeMapConfig.getPosition()[0],sChallengeMapConfig.getPosition()[1]));
|
||||
}
|
||||
|
||||
mapEnterResponse.addAllWakeCells(mapManager.getWalkCells() == null ? new ArrayList<>() : mapManager.getWalkCells());
|
||||
if (mapManager.getTemporaryItems() != null) {
|
||||
mapEnterResponse.setTemporaryItems(CBean2Proto.getDrop(mapManager.getTemporaryItems()));
|
||||
|
@ -1143,6 +1148,8 @@ public class MapLogic {
|
|||
mapManager.updateEndlessFightCount(1+mapManager.getEndlessMapInfo().getFightCount());
|
||||
}
|
||||
if (resultCode == 0) {
|
||||
//无尽副本复活消耗
|
||||
reviveConsumeExecution(user);
|
||||
// 失败需要等待n秒后复活所有英雄
|
||||
int dieCount = user.getMapManager().getDieCount();
|
||||
dieCount++;
|
||||
|
@ -1357,20 +1364,8 @@ public class MapLogic {
|
|||
}
|
||||
mapManager.setLastFightResult(resultCode);
|
||||
if (resultCode == 0) {
|
||||
if(SChallengeConfig.sChallengeConfigs.get(mapManager.getCurMapId()).getType()==4){
|
||||
mapManager.updateEndlessFightCount(mapManager.getEndlessMapInfo().getFightCount()+1);
|
||||
//消耗行动力
|
||||
int [][] cost = new int[1][];
|
||||
int costId = SChallengeSetting.getChallengeSetting().getActionPowerId();
|
||||
int costNum = SEndlessMapConfig.sEndlessMapConfigMap.get(mapManager.getCurMapId()).getDeathCost();
|
||||
mapManager.updateEndlessConsumeExecution(mapManager.getEndlessMapInfo().getConsumeExecution()+costNum);
|
||||
int [] cost1 = new int[]{costId,costNum};
|
||||
cost[0] = cost1;
|
||||
if(ItemUtil.itemCost(user,cost,BIReason.ENDLESS_CONSUME_EXECUTION,1)) {
|
||||
costNum = user.getItemManager().getItem(costId).getItemNum();
|
||||
ItemUtil.itemCost(user,cost,BIReason.ENDLESS_CONSUME_EXECUTION,1);
|
||||
}
|
||||
}
|
||||
//无尽副本复活消耗
|
||||
reviveConsumeExecution(user);
|
||||
// 失败需要等待n秒后复活所有英雄
|
||||
int dieCount = user.getMapManager().getDieCount();
|
||||
dieCount++;
|
||||
|
@ -2848,7 +2843,7 @@ public class MapLogic {
|
|||
continue;
|
||||
}
|
||||
if(calHp!=entry.getValue().getMaxHp()){
|
||||
int tempHp = calHp*entry.getValue().getCurHp()/entry.getValue().getMaxHp();
|
||||
int tempHp = (int)(entry.getValue().getCurHp()/entry.getValue().getMaxHp()*1.0F*calHp);
|
||||
endlessHeroInfo.put(entry.getKey(),new EndlessHero(calHp,tempHp));
|
||||
calHp = tempHp;
|
||||
}else{
|
||||
|
@ -2981,4 +2976,30 @@ public class MapLogic {
|
|||
MessageUtil.sendMessage(session,1,messageType.getNumber(),response.build(),true);
|
||||
}
|
||||
|
||||
/**
|
||||
* 无尽副本复活消耗行动力
|
||||
* @param user
|
||||
* @throws Exception
|
||||
*/
|
||||
private void reviveConsumeExecution(User user) throws Exception {
|
||||
MapManager mapManager = user.getMapManager();
|
||||
if(SChallengeConfig.sChallengeConfigs.get(mapManager.getCurMapId()).getType()!=4){
|
||||
return;
|
||||
}
|
||||
mapManager.updateEndlessFightCount(mapManager.getEndlessMapInfo().getFightCount()+1);
|
||||
//消耗行动力
|
||||
int [][] cost = new int[1][];
|
||||
int costId = SChallengeSetting.getChallengeSetting().getActionPowerId();
|
||||
int costNum = SEndlessMapConfig.sEndlessMapConfigMap.get(mapManager.getCurMapId()).getDeathCost();
|
||||
mapManager.updateEndlessConsumeExecution(mapManager.getEndlessMapInfo().getConsumeExecution()+costNum);
|
||||
int [] cost1 = new int[]{costId,costNum};
|
||||
cost[0] = cost1;
|
||||
if(!ItemUtil.itemCost(user,cost,BIReason.ENDLESS_CONSUME_EXECUTION,1)) {
|
||||
costNum = user.getItemManager().getItem(costId).getItemNum();
|
||||
cost1[1]= costNum;
|
||||
cost[0] = cost1;
|
||||
ItemUtil.itemCost(user,cost,BIReason.ENDLESS_CONSUME_EXECUTION,1);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -15,11 +15,13 @@ public class FinishOptionsDifficultMapProcessor implements BaseMissionProcesor{
|
|||
if(sChallengeConfig.getDifficultType()!=sAccomplishmentConfig.getValues()[1][0]){
|
||||
return GlobalsDef.MAP_MISSION_RETURN;
|
||||
}
|
||||
int[] value = sAccomplishmentConfig.getValues()[0];
|
||||
int[][] value = sAccomplishmentConfig.getValues();
|
||||
missionValue = 0-missionValue;
|
||||
for(int i = 0 ; i <value.length;i++){
|
||||
if(eventId==value[i]){
|
||||
missionValue = missionValue | (2<<i);
|
||||
for(int i = 0 ; i <value.length-1;i++){
|
||||
for(int j =0;j<value[i].length;j++){
|
||||
if(eventId==value[i][j]){
|
||||
missionValue = missionValue | (2<<i);
|
||||
}
|
||||
}
|
||||
}
|
||||
if(missionValue+2>>(value.length+1)==1){
|
||||
|
|
|
@ -13,18 +13,21 @@ public class KillMonsterAccProcessor implements BaseMissionProcesor{
|
|||
int[][] configValues = sAccomplishmentConfig.getValues();
|
||||
MapManager mapManager = user.getMapManager();
|
||||
SChallengeConfig sChallengeConfig = SChallengeConfig.sChallengeConfigs.get(mapManager.getCurMapId());
|
||||
if(sChallengeConfig.getDifficultType()!=configValues[0][0]){
|
||||
return GlobalsDef.MAP_MISSION_RETURN;
|
||||
}
|
||||
if(missionValue==configValues[1][0]){
|
||||
if(configValues[0][0]!=0 && sChallengeConfig.getDifficultType()!=configValues[0][0]){
|
||||
return GlobalsDef.MAP_MISSION_RETURN;
|
||||
}
|
||||
if(configValues[0].length<2){
|
||||
return GlobalsDef.MAP_MISSION_RETURN;
|
||||
}
|
||||
for(int i = 1 ; i <configValues.length;i++){
|
||||
if(missionValue==configValues[1][0]){
|
||||
missionValue = -1;
|
||||
}
|
||||
if(missionValue==-1){
|
||||
return missionValue;
|
||||
}
|
||||
for(int i = 1 ; i <configValues[0].length;i++){
|
||||
if(eventId!=configValues[0][i]){
|
||||
return GlobalsDef.MAP_MISSION_RETURN;
|
||||
continue;
|
||||
}
|
||||
missionValue++;
|
||||
}
|
||||
|
|
|
@ -37,7 +37,14 @@ public class NotEventFinishEventDifficultMapProcessor implements BaseMissionProc
|
|||
if(flag){
|
||||
for(int i = 0 ; i < finishEvent.length;i++){
|
||||
if(eventId==finishEvent[i]){
|
||||
missionValue = -1;
|
||||
if(missionValue<0){
|
||||
if(missionValue==-1){
|
||||
break;
|
||||
}
|
||||
missionValue = missionValue/2;
|
||||
}else{
|
||||
missionValue =0-1<<(configValues[1][1]-1);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -12,8 +12,11 @@ import com.ljsd.jieling.core.HandlerLogicThread;
|
|||
import com.ljsd.jieling.db.mongo.MongoUtil;
|
||||
import com.ljsd.jieling.handler.map.MapLogic;
|
||||
import com.ljsd.jieling.logic.activity.ActivityLogic;
|
||||
import com.ljsd.jieling.logic.activity.ActivityType;
|
||||
import com.ljsd.jieling.logic.activity.ActivityTypeEnum;
|
||||
import com.ljsd.jieling.logic.arena.ArenaLogic;
|
||||
import com.ljsd.jieling.logic.dao.GuilidManager;
|
||||
import com.ljsd.jieling.logic.dao.RechargeInfo;
|
||||
import com.ljsd.jieling.logic.dao.TimeControllerOfFunction;
|
||||
import com.ljsd.jieling.logic.dao.UserMissionManager;
|
||||
import com.ljsd.jieling.logic.dao.root.GlobalSystemControl;
|
||||
|
@ -253,6 +256,7 @@ public class GlobalDataManaager {
|
|||
FriendLogic.getInstance().refreshState(session);
|
||||
// MapLogic.getInstance().towerAutoReset(session,fBuilder);
|
||||
if(fBuilder!=null){
|
||||
fBuilder.setSignInInfo(CommonProto.SignInInfo.newBuilder().setDays(user.getPlayerInfoManager().getSign()+1).setState(user.getPlayerInfoManager().getSignTotay()).build());
|
||||
user.getPlayerInfoManager().setLoginTime(TimeUtils.now());
|
||||
Map<Integer, SDailyTasksConfig> config = SDailyTasksConfig.config;
|
||||
int dailymissionType = GameMisionType.DAILYMISSION.getType();
|
||||
|
|
|
@ -5,12 +5,12 @@ import com.ljsd.jieling.globals.BIReason;
|
|||
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.IEvent;
|
||||
import com.ljsd.jieling.logic.dao.ActivityManager;
|
||||
import com.ljsd.jieling.logic.dao.ActivityMission;
|
||||
import com.ljsd.jieling.logic.dao.ActivityProgressInfo;
|
||||
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.network.session.ISession;
|
||||
import com.ljsd.jieling.protocols.CommonProto;
|
||||
import com.ljsd.jieling.protocols.MessageTypeProto;
|
||||
|
@ -22,28 +22,42 @@ import org.slf4j.LoggerFactory;
|
|||
|
||||
import java.util.*;
|
||||
|
||||
public abstract class AbstractActivity implements IActivity {
|
||||
/**
|
||||
* 玩家无关性
|
||||
*/
|
||||
public abstract class AbstractActivity implements IActivity, IEventHandler {
|
||||
static final Logger LOGGER = LoggerFactory.getLogger(AbstractActivity.class);
|
||||
final int rewardResponseValue = MessageTypeProto.MessageType.TAKE_ACTIVITY_REWARD_RESPONSE_VALUE;
|
||||
int id;
|
||||
int id; //活动id
|
||||
|
||||
public AbstractActivity(int id) {
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onEvent(IEvent event)throws Exception {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void initActivity(User user) throws Exception {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onResume(User user) throws Exception {
|
||||
ActivityManager activityManager = user.getActivityManager();
|
||||
activityManager.removeActivity(id);
|
||||
activityManager.initAllActivityMission(id);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void update(User user, int count) {
|
||||
ActivityMission activityMission = user.getActivityManager().getActivityMissionMap().get(id);
|
||||
updateProgress(user, activityMission, count);
|
||||
//更新进度
|
||||
ISession sessionByUid = OnlineUserManager.getSessionByUid(user.getId());
|
||||
sendActivityProgress(sessionByUid, activityMission,null);
|
||||
|
||||
sendActivityProgress(sessionByUid, activityMission, null);
|
||||
|
||||
}
|
||||
|
||||
|
@ -92,12 +106,11 @@ public abstract class AbstractActivity implements IActivity {
|
|||
if (!takeRewardsProcess(session, sActivityRewardConfig, activityProgressInfo)) {
|
||||
return false;
|
||||
}
|
||||
//upto client and db
|
||||
//up miss
|
||||
int[][] reward = sActivityRewardConfig.getReward();
|
||||
CommonProto.Drop.Builder drop = ItemUtil.drop(user, reward, BIReason.TAKE_ACTIVITY_REWARD);
|
||||
activityProgressInfo.setState(ActivityType.HAD_TAKED);
|
||||
activityMission.updateProgressInfo(missionId, activityProgressInfo);
|
||||
|
||||
checkAndSetProgress(activityMission,activityProgressInfo,sActivityRewardConfig,missionId);
|
||||
//send
|
||||
sendActivityProgress(session, activityMission, Collections.singleton(missionId));
|
||||
KtEventUtils.onKtEvent(user, ParamEventBean.UserActivityEvent, id, missionId);
|
||||
PlayerInfoProto.TakeActivityRewardResponse build = PlayerInfoProto.TakeActivityRewardResponse.newBuilder().setDrop(drop).build();
|
||||
|
@ -105,8 +118,15 @@ public abstract class AbstractActivity implements IActivity {
|
|||
return true;
|
||||
}
|
||||
|
||||
void checkAndSetProgress(ActivityMission activityMission, ActivityProgressInfo activityProgressInfo, SActivityRewardConfig sActivityRewardConfig,int missionId) {
|
||||
activityProgressInfo.setState(ActivityType.HAD_TAKED);
|
||||
activityMission.updateProgressInfo(missionId, activityProgressInfo);
|
||||
}
|
||||
|
||||
/**
|
||||
* default get reward
|
||||
* TODO 旧的逻辑 这里应该加上通用检测value的逻辑
|
||||
* 根据配置解析阶段值
|
||||
*/
|
||||
boolean takeRewardsProcess(ISession session, SActivityRewardConfig sActivityRewardConfig, ActivityProgressInfo activityProgressInfo) throws Exception {
|
||||
int[][] values = sActivityRewardConfig.getValues();
|
||||
|
@ -119,13 +139,26 @@ public abstract class AbstractActivity implements IActivity {
|
|||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据配置解析数值进度完成度
|
||||
*/
|
||||
boolean checkValue(ISession session, SActivityRewardConfig sActivityRewardConfig, ActivityProgressInfo activityProgressInfo) throws Exception {
|
||||
int[][] values = sActivityRewardConfig.getValues();
|
||||
User user = UserManager.getUser(session.getUid());
|
||||
int value = user.getActivityManager().getActivityMissionMap().get(sActivityRewardConfig.getActivityId()).getValue();
|
||||
if (value < values[0][0]) {
|
||||
MessageUtil.sendErrorResponse(session, 0, rewardResponseValue, "time not");
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onActivityEnd() throws Exception {
|
||||
}
|
||||
|
||||
public List<CommonProto.ActivityInfo.MissionInfo> getAllMissInfo(ActivityMission activityMission) {
|
||||
return getAllMissInfo(activityMission,null);
|
||||
return getAllMissInfo(activityMission, null);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -145,6 +178,7 @@ public abstract class AbstractActivity implements IActivity {
|
|||
|
||||
/**
|
||||
* 更新进度
|
||||
*
|
||||
* @param filterMissId miss过滤
|
||||
*/
|
||||
void sendActivityProgress(ISession session, ActivityMission activityMission, Set<Integer> filterMissId) {
|
||||
|
@ -154,4 +188,5 @@ public abstract class AbstractActivity implements IActivity {
|
|||
MessageUtil.sendIndicationMessage(session, 1, MessageTypeProto.MessageType.ACTIVITY_UPDATE_PROGRESS_INDICATION_VALUE, builder.build(), true);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
|
File diff suppressed because it is too large
Load Diff
|
@ -3,31 +3,43 @@ package com.ljsd.jieling.logic.activity;
|
|||
public interface ActivityType {
|
||||
|
||||
int CLOSE_STATE = 0;
|
||||
int OPEN_STATE =1;
|
||||
int FINISH_STATE =2;
|
||||
int OPEN_STATE = 1;
|
||||
int FINISH_STATE = 2;
|
||||
|
||||
int OPEN_TYPE_TIME = 1; // 活动开启类型:绝对时间
|
||||
int OPEN_TYPE_ROLE = 2; // 活动开启类型:创角时间
|
||||
int OPEN_TYPE_SERVER = 3; // 活动开启类型:开服时间
|
||||
|
||||
|
||||
|
||||
int WILL_TAKE = 0; //未领取
|
||||
int HAD_TAKED =1; //已领取
|
||||
int FINISH_TAKED =-1; //完美领取
|
||||
int HAD_TAKED = 1; //已领取
|
||||
int FINISH_TAKED = -1; //完美领取
|
||||
|
||||
int OnlineReward =1; //在线奖励
|
||||
int OnlineReward = 1; //在线奖励
|
||||
int SevenLogin = 2; //七日登陆
|
||||
int ChapterReward = 3; //章节奖励
|
||||
int FirstRecharge =4; //首充
|
||||
int RechargeTotal =5; //累计充值
|
||||
int GrowthFund =6; //成长基金
|
||||
int FirstRecharge = 4; //首充
|
||||
int RechargeTotal = 5; //累计充值
|
||||
int GrowthFund = 6; //成长基金
|
||||
int BLESSACTIVITY = 7;
|
||||
int TREASURE =8; //孙龙的宝藏
|
||||
int LUCKYCAT=9;//招財貓
|
||||
int SERVERHAPPY =10; //七日狂欢
|
||||
int TREASURE = 8; //孙龙的宝藏
|
||||
int LUCKYCAT = 9;//招財貓
|
||||
int SERVERHAPPY = 10; //七日狂欢
|
||||
int FORCERANK = 11; //战力排行
|
||||
int FORCESTANDARD = 12;//战力达标
|
||||
int DAILY_RECHARGE = 13;//每日充值
|
||||
int RECHARGE_SUM_DAY = 14;//累计充值天数
|
||||
int SECURT_EXPERT = 16;// 秘境达人
|
||||
int ARENA_EXPERT = 17;// 竞技达人
|
||||
int UP_EXPERT = 18;// 进阶达人
|
||||
int EQUIP_EXPERT = 19;// 装备达人
|
||||
int GOLD_EXPERT = 20;// 点金达人
|
||||
int COPY_EXPERT = 21;//副本达人
|
||||
int STAMINA_EXPERT = 22;//体力达人
|
||||
int SIGN_IN = 23;//累计签到
|
||||
int RECHARGE_NUM = 24;//累计充值
|
||||
|
||||
|
||||
|
||||
// int EXCHANGEANDDROP = 15;//限时兑换活动
|
||||
|
||||
|
|
|
@ -18,7 +18,19 @@ public enum ActivityTypeEnum {
|
|||
LUCKYCAT(ActivityType.LUCKYCAT, LuckyCatActivity::new),
|
||||
SERVERHAPPY(ActivityType.SERVERHAPPY, DefaultEmptyActivity::new),
|
||||
FORCERANK(ActivityType.FORCERANK, ForceRankActivity::new),
|
||||
FORCESTANDARD(ActivityType.FORCESTANDARD, ForceStandardActivity::new);
|
||||
FORCESTANDARD(ActivityType.FORCESTANDARD, ForceStandardActivity::new),
|
||||
DAILY_RECHARGE(ActivityType.DAILY_RECHARGE, DailyRechargeActivity::new),
|
||||
RECHARGE_SUM(ActivityType.RECHARGE_SUM_DAY, RechargeSumDayActivity::new),
|
||||
SECURT_EXPERT(ActivityType.SECURT_EXPERT, SecretExpectRankActivity::new),
|
||||
ARENA_EXPERT(ActivityType.ARENA_EXPERT, AreanaExpectRankActivity::new),
|
||||
UP_EXPERT(ActivityType.UP_EXPERT, HeroUpExpectRankActivity::new),
|
||||
EQUIP_EXPERT(ActivityType.EQUIP_EXPERT, EquipExpectRankActivity::new),
|
||||
GOLD_EXPERT(ActivityType.GOLD_EXPERT, GoldExpectRankActivity::new),
|
||||
COPY_EXPERT(ActivityType.COPY_EXPERT, CopyExpectRankActivity::new),
|
||||
STAMINA_EXPERT(ActivityType.STAMINA_EXPERT, StaminaExpectRankActivity::new),
|
||||
SIGN_IN(ActivityType.SIGN_IN, SignInSumActivity::new),
|
||||
RECHARGE_NUM(ActivityType.RECHARGE_NUM, RechargeSumActivity::new),
|
||||
;
|
||||
private int type;
|
||||
private Function<Integer, AbstractActivity> toActivityFunction;
|
||||
private static HashMap<Integer, AbstractActivity> acticityCache = new HashMap<>();
|
||||
|
@ -40,34 +52,42 @@ public enum ActivityTypeEnum {
|
|||
|
||||
public static AbstractActivity getActicityType(int id) {
|
||||
SGlobalActivity sGlobalActivity = SGlobalActivity.getsGlobalActivityMap().get(id);
|
||||
switch (sGlobalActivity.getType()) {
|
||||
case ActivityType.OnlineReward:
|
||||
return ONLINEREWARD.toActivity(id);
|
||||
case ActivityType.SevenLogin:
|
||||
return SEVENLOGIN.toActivity(id);
|
||||
case ActivityType.ChapterReward:
|
||||
return CHAPTERREWARD.toActivity(id);
|
||||
case ActivityType.FirstRecharge:
|
||||
return FIRSTRECHARGE.toActivity(id);
|
||||
case ActivityType.RechargeTotal:
|
||||
return RECHARGETOTAL.toActivity(id);
|
||||
case ActivityType.GrowthFund:
|
||||
return GROWTHFUND.toActivity(id);
|
||||
case ActivityType.BLESSACTIVITY:
|
||||
return BLESSACTIVITY.toActivity(id);
|
||||
case ActivityType.TREASURE:
|
||||
return TREASUREACTIVITY.toActivity(id);
|
||||
case ActivityType.LUCKYCAT:
|
||||
return LUCKYCAT.toActivity(id);
|
||||
case ActivityType.FORCERANK:
|
||||
return FORCERANK.toActivity(id);
|
||||
case ActivityType.FORCESTANDARD:
|
||||
return FORCESTANDARD.toActivity(id);
|
||||
case ActivityType.SERVERHAPPY:
|
||||
return SERVERHAPPY.toActivity(id);
|
||||
default:
|
||||
return null;
|
||||
for (ActivityTypeEnum activityType:ActivityTypeEnum.values()) {
|
||||
if(activityType.getType()==sGlobalActivity.getType()){
|
||||
return activityType.toActivity(id);
|
||||
}
|
||||
}
|
||||
return null;
|
||||
// switch (sGlobalActivity.getType()) {
|
||||
// case ActivityType.OnlineReward:
|
||||
// return ONLINEREWARD.toActivity(id);
|
||||
// case ActivityType.SevenLogin:
|
||||
// return SEVENLOGIN.toActivity(id);
|
||||
// case ActivityType.ChapterReward:
|
||||
// return CHAPTERREWARD.toActivity(id);
|
||||
// case ActivityType.FirstRecharge:
|
||||
// return FIRSTRECHARGE.toActivity(id);
|
||||
// case ActivityType.RechargeTotal:
|
||||
// return RECHARGETOTAL.toActivity(id);
|
||||
// case ActivityType.GrowthFund:
|
||||
// return GROWTHFUND.toActivity(id);
|
||||
// case ActivityType.BLESSACTIVITY:
|
||||
// return BLESSACTIVITY.toActivity(id);
|
||||
// case ActivityType.TREASURE:
|
||||
// return TREASUREACTIVITY.toActivity(id);
|
||||
// case ActivityType.LUCKYCAT:
|
||||
// return LUCKYCAT.toActivity(id);
|
||||
// case ActivityType.FORCERANK:
|
||||
// return FORCERANK.toActivity(id);
|
||||
// case ActivityType.FORCESTANDARD:
|
||||
// return FORCESTANDARD.toActivity(id);
|
||||
// case ActivityType.DAILY_RECHARGE:
|
||||
// return DAILY_RECHARGE.toActivity(id);
|
||||
// case ActivityType.RECHARGE_SUM:
|
||||
// return RECHARGE_SUM.toActivity(id);
|
||||
// default:
|
||||
// return null;
|
||||
// }
|
||||
}
|
||||
|
||||
public int getType() {
|
||||
|
|
|
@ -0,0 +1,23 @@
|
|||
package com.ljsd.jieling.logic.activity;
|
||||
|
||||
|
||||
import com.ljsd.jieling.logic.activity.event.ArenaChallengeEvent;
|
||||
import com.ljsd.jieling.logic.activity.event.IEvent;
|
||||
import com.ljsd.jieling.logic.activity.event.Poster;
|
||||
import com.ljsd.jieling.logic.dao.UserManager;
|
||||
|
||||
class AreanaExpectRankActivity extends ExpectRankActivity {
|
||||
|
||||
public AreanaExpectRankActivity(int id) {
|
||||
super(id);
|
||||
Poster.getPoster().listenEvent(this, ArenaChallengeEvent.class);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onEvent(IEvent event) throws Exception {
|
||||
if (!(event instanceof ArenaChallengeEvent))
|
||||
return;
|
||||
update(UserManager.getUser(((ArenaChallengeEvent) event).getUid()), 1);
|
||||
|
||||
}
|
||||
}
|
|
@ -0,0 +1,23 @@
|
|||
package com.ljsd.jieling.logic.activity;
|
||||
|
||||
|
||||
import com.ljsd.jieling.logic.activity.event.IEvent;
|
||||
import com.ljsd.jieling.logic.activity.event.Poster;
|
||||
import com.ljsd.jieling.logic.activity.event.StoryEvent;
|
||||
import com.ljsd.jieling.logic.dao.UserManager;
|
||||
|
||||
class CopyExpectRankActivity extends ExpectRankActivity {
|
||||
|
||||
public CopyExpectRankActivity(int id) {
|
||||
super(id);
|
||||
Poster.getPoster().listenEvent(this, StoryEvent.class);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onEvent(IEvent event) throws Exception {
|
||||
if (!(event instanceof StoryEvent))
|
||||
return;
|
||||
update(UserManager.getUser(((StoryEvent) event).getUid()), 1);
|
||||
|
||||
}
|
||||
}
|
|
@ -0,0 +1,27 @@
|
|||
package com.ljsd.jieling.logic.activity;
|
||||
|
||||
import com.ljsd.jieling.config.SActivityRewardConfig;
|
||||
import com.ljsd.jieling.logic.dao.ActivityMission;
|
||||
import com.ljsd.jieling.logic.dao.ActivityProgressInfo;
|
||||
import com.ljsd.jieling.network.session.ISession;
|
||||
|
||||
/**
|
||||
* 名字叫首冲 其实不是 策划说按每日
|
||||
*/
|
||||
class DailyRechargeActivity extends AbstractActivity {
|
||||
|
||||
public DailyRechargeActivity(int id) {
|
||||
super(id);
|
||||
}
|
||||
|
||||
@Override
|
||||
void updateProgress(ActivityMission activityMission, int count) {
|
||||
activityMission.setValue(count + activityMission.getValue());
|
||||
}
|
||||
|
||||
@Override
|
||||
boolean takeRewardsProcess(ISession session, SActivityRewardConfig sActivityRewardConfig, ActivityProgressInfo activityProgressInfo) throws Exception {
|
||||
return checkValue(session, sActivityRewardConfig, activityProgressInfo);
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,33 @@
|
|||
package com.ljsd.jieling.logic.activity;
|
||||
|
||||
|
||||
import com.ljsd.jieling.config.SActivityRewardConfig;
|
||||
import com.ljsd.jieling.config.SEquipConfig;
|
||||
import com.ljsd.jieling.logic.activity.event.EquipEvent;
|
||||
import com.ljsd.jieling.logic.activity.event.IEvent;
|
||||
import com.ljsd.jieling.logic.activity.event.Poster;
|
||||
import com.ljsd.jieling.logic.dao.UserManager;
|
||||
|
||||
class EquipExpectRankActivity extends ExpectRankActivity {
|
||||
|
||||
public EquipExpectRankActivity(int id) {
|
||||
super(id);
|
||||
Poster.getPoster().listenEvent(this, EquipEvent.class);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onEvent(IEvent event) throws Exception {
|
||||
|
||||
if (!(event instanceof EquipEvent))
|
||||
return;
|
||||
SActivityRewardConfig sActivityRewardConfig = SActivityRewardConfig.getsActivityRewardConfigByActivityId(id).get(0);
|
||||
if (sActivityRewardConfig == null)
|
||||
return;
|
||||
int type = sActivityRewardConfig.getValues()[0][0];
|
||||
SEquipConfig sEquipConfig = SEquipConfig.getsEquipConfigById(((EquipEvent) event).getEquipId());
|
||||
if (type != sEquipConfig.getQuality())
|
||||
return;
|
||||
update(UserManager.getUser(((EquipEvent) event).getUid()), 1);
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,107 @@
|
|||
package com.ljsd.jieling.logic.activity;
|
||||
|
||||
|
||||
import com.ljsd.jieling.config.SActivityRankingReward;
|
||||
import com.ljsd.jieling.config.SActivityRewardConfig;
|
||||
import com.ljsd.jieling.config.SErrorCodeEerverConfig;
|
||||
import com.ljsd.jieling.db.redis.RedisKey;
|
||||
import com.ljsd.jieling.db.redis.RedisUtil;
|
||||
import com.ljsd.jieling.globals.Global;
|
||||
import com.ljsd.jieling.logic.dao.ActivityMission;
|
||||
import com.ljsd.jieling.logic.dao.ActivityProgressInfo;
|
||||
import com.ljsd.jieling.logic.dao.UserManager;
|
||||
import com.ljsd.jieling.logic.dao.root.User;
|
||||
import com.ljsd.jieling.logic.mail.MailLogic;
|
||||
import com.ljsd.jieling.network.session.ISession;
|
||||
import com.ljsd.jieling.util.ItemUtil;
|
||||
import com.ljsd.jieling.util.MessageUtil;
|
||||
import com.ljsd.jieling.util.TimeUtils;
|
||||
import org.springframework.data.redis.core.ZSetOperations;
|
||||
|
||||
import java.util.*;
|
||||
|
||||
class ExpectRankActivity extends AbstractActivity {
|
||||
|
||||
public ExpectRankActivity(int id) {
|
||||
super(id);
|
||||
}
|
||||
|
||||
@Override
|
||||
void updateProgress(User user, ActivityMission activityMission, int count) {
|
||||
activityMission.setValue(count + activityMission.getValue());
|
||||
String key = RedisKey.getKey(RedisKey.EXPERT_RANK, String.valueOf(id), false);
|
||||
RedisUtil.getInstence().zsetAddOne(key, String.valueOf(user.getId()), count);
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
boolean takeRewardsProcess(ISession session, SActivityRewardConfig sActivityRewardConfig, ActivityProgressInfo activityProgressInfo) throws Exception {
|
||||
return checkValue(session, sActivityRewardConfig, activityProgressInfo);
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据配置解析数值进度完成度
|
||||
*/
|
||||
boolean checkValue(ISession session, SActivityRewardConfig sActivityRewardConfig, ActivityProgressInfo activityProgressInfo) throws Exception {
|
||||
int[][] values = sActivityRewardConfig.getValues();
|
||||
User user = UserManager.getUser(session.getUid());
|
||||
int value = user.getActivityManager().getActivityMissionMap().get(sActivityRewardConfig.getActivityId()).getValue();
|
||||
if (value < values[1][0]) {
|
||||
MessageUtil.sendErrorResponse(session, 0, rewardResponseValue, "time not");
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void onActivityEnd() throws Exception {
|
||||
|
||||
List<SActivityRankingReward> sActivityRankingReward = SActivityRankingReward.getsActivityRankingRewardMapByActivityId(id);
|
||||
int maxRank = 0;
|
||||
Map<Integer, Integer> rank2miss = new HashMap<>();
|
||||
for (SActivityRankingReward sActivityRankingReward1 : sActivityRankingReward) {
|
||||
maxRank = Math.max(maxRank, sActivityRankingReward1.getMaxRank());
|
||||
for (Integer rank : getRankSet(sActivityRankingReward1.getMinRank(), sActivityRankingReward1.getMaxRank())) {
|
||||
rank2miss.put(rank, sActivityRankingReward1.getId());
|
||||
}
|
||||
}
|
||||
|
||||
Set<ZSetOperations.TypedTuple<String>> rankInfo = RedisUtil.getInstence().getZsetreverseRangeWithScores(RedisKey.EXPERT_RANK, Integer.toString(id), 0, maxRank - 1);
|
||||
int rank = 1;
|
||||
int nowTime = (int) (TimeUtils.now() / 1000);
|
||||
for (ZSetOperations.TypedTuple<String> item : rankInfo) {
|
||||
String value = item.getValue();
|
||||
int uid = Integer.parseInt(value);
|
||||
User user = UserManager.getUser(uid);
|
||||
|
||||
ActivityMission activityMission = user.getActivityManager().getActivityMissionMap().get(id);
|
||||
if (activityMission == null || activityMission.getActivityState() != ActivityType.OPEN_STATE || activityMission.getOpenType() == 0) {
|
||||
continue;
|
||||
}
|
||||
int missionId = rank2miss.get(rank++);
|
||||
//check value
|
||||
SActivityRankingReward sActivityRankingReward1 = SActivityRankingReward.getsActivityRankingRewardMap().get(missionId);
|
||||
//sendmail
|
||||
String content = SErrorCodeEerverConfig.getI18NMessage("powerrank_activity_title");
|
||||
String title = SErrorCodeEerverConfig.getI18NMessage("powerrank_activity_txt", new Object[]{rank});
|
||||
String mailReward = ItemUtil.getMailReward(sActivityRankingReward1.getRankingReward());
|
||||
MailLogic.getInstance().sendMail(uid, title, content, mailReward, nowTime, Global.MAIL_EFFECTIVE_TIME);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
private Set<Integer> getRankSet(int start, int end) {
|
||||
Set<Integer> set = new HashSet<>();
|
||||
if (start > end) {
|
||||
return set;
|
||||
}
|
||||
for (int i = start; i <= end; i++) {
|
||||
set.add(i);
|
||||
}
|
||||
return set;
|
||||
}
|
||||
|
||||
|
||||
}
|
|
@ -65,7 +65,7 @@ class ForceRankActivity extends AbstractActivity {
|
|||
}
|
||||
}
|
||||
|
||||
Set<ZSetOperations.TypedTuple<String>> rankInfo = RedisUtil.getInstence().getZsetreverseRangeWithScores(RedisKey.FORCE_RANK, Integer.toString(id), 0, maxRank);
|
||||
Set<ZSetOperations.TypedTuple<String>> rankInfo = RedisUtil.getInstence().getZsetreverseRangeWithScores(RedisKey.FORCE_RANK, Integer.toString(id), 0, maxRank-1);
|
||||
int rank = 1;
|
||||
int nowTime = (int) (TimeUtils.now() / 1000);
|
||||
for (ZSetOperations.TypedTuple<String> item : rankInfo) {
|
||||
|
@ -89,7 +89,7 @@ class ForceRankActivity extends AbstractActivity {
|
|||
continue;
|
||||
}
|
||||
int value2 = values[0][2];
|
||||
int missionProgress = activityProgressInfo.getProgrss();
|
||||
int missionProgress = activityMission.getValue();
|
||||
if (missionProgress < value2) {
|
||||
continue;
|
||||
}
|
||||
|
|
|
@ -3,10 +3,8 @@ package com.ljsd.jieling.logic.activity;
|
|||
import com.ljsd.jieling.config.SActivityRewardConfig;
|
||||
import com.ljsd.jieling.logic.dao.ActivityMission;
|
||||
import com.ljsd.jieling.logic.dao.ActivityProgressInfo;
|
||||
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.MessageUtil;
|
||||
|
||||
class ForceStandardActivity extends AbstractActivity {
|
||||
|
||||
|
@ -17,19 +15,12 @@ class ForceStandardActivity extends AbstractActivity {
|
|||
@Override
|
||||
public void initActivity(User user) throws Exception {
|
||||
super.initActivity(user);
|
||||
update(user,user.getPlayerInfoManager().getMaxForce());
|
||||
update(user, user.getPlayerInfoManager().getMaxForce());
|
||||
}
|
||||
|
||||
@Override
|
||||
boolean takeRewardsProcess(ISession session, SActivityRewardConfig sActivityRewardConfig, ActivityProgressInfo activityProgressInfo) throws Exception {
|
||||
int[][] values = sActivityRewardConfig.getValues();
|
||||
User user = UserManager.getUser(session.getUid());
|
||||
int value = user.getActivityManager().getActivityMissionMap().get(sActivityRewardConfig.getActivityId()).getValue();
|
||||
if (value < values[0][0]) {
|
||||
MessageUtil.sendErrorResponse(session, 0, rewardResponseValue, "time not");
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
return checkValue(session, sActivityRewardConfig, activityProgressInfo);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -0,0 +1,22 @@
|
|||
package com.ljsd.jieling.logic.activity;
|
||||
|
||||
|
||||
import com.ljsd.jieling.logic.activity.event.GoldEvent;
|
||||
import com.ljsd.jieling.logic.activity.event.IEvent;
|
||||
import com.ljsd.jieling.logic.activity.event.Poster;
|
||||
import com.ljsd.jieling.logic.dao.UserManager;
|
||||
|
||||
class GoldExpectRankActivity extends ExpectRankActivity {
|
||||
|
||||
public GoldExpectRankActivity(int id) {
|
||||
super(id);
|
||||
Poster.getPoster().listenEvent(this, GoldEvent.class);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onEvent(IEvent event) throws Exception {
|
||||
if (!(event instanceof GoldEvent))
|
||||
return;
|
||||
update(UserManager.getUser(((GoldEvent) event).getUid()), 1);
|
||||
}
|
||||
}
|
|
@ -0,0 +1,49 @@
|
|||
package com.ljsd.jieling.logic.activity;
|
||||
|
||||
|
||||
import com.ljsd.jieling.config.SActivityRewardConfig;
|
||||
import com.ljsd.jieling.db.redis.RedisKey;
|
||||
import com.ljsd.jieling.db.redis.RedisUtil;
|
||||
import com.ljsd.jieling.logic.activity.event.HeroUpStarEvent;
|
||||
import com.ljsd.jieling.logic.activity.event.IEvent;
|
||||
import com.ljsd.jieling.logic.activity.event.Poster;
|
||||
import com.ljsd.jieling.logic.dao.ActivityMission;
|
||||
import com.ljsd.jieling.logic.dao.Hero;
|
||||
import com.ljsd.jieling.logic.dao.HeroManager;
|
||||
import com.ljsd.jieling.logic.dao.UserManager;
|
||||
import com.ljsd.jieling.logic.dao.root.User;
|
||||
|
||||
class HeroUpExpectRankActivity extends ExpectRankActivity {
|
||||
|
||||
public HeroUpExpectRankActivity(int id) {
|
||||
super(id);
|
||||
Poster.getPoster().listenEvent(this, HeroUpStarEvent.class);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onEvent(IEvent event) throws Exception {
|
||||
if (!(event instanceof HeroUpExpectRankActivity))
|
||||
return;
|
||||
User user = UserManager.getUser(((HeroUpStarEvent) event).getUid());
|
||||
HeroManager heroManager = user.getHeroManager();
|
||||
SActivityRewardConfig sActivityRewardConfig = SActivityRewardConfig.getsActivityRewardConfigByActivityId(id).get(0);
|
||||
if(sActivityRewardConfig==null)
|
||||
return;
|
||||
int count = 0;
|
||||
for (Hero targetHero:heroManager.getHeroMap().values()) {
|
||||
if(targetHero.getStar()>=sActivityRewardConfig.getValues()[0][0]){
|
||||
count++;
|
||||
}
|
||||
}
|
||||
update(UserManager.getUser(((HeroUpStarEvent) event).getUid()), count);
|
||||
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
void updateProgress(User user, ActivityMission activityMission, int count) {
|
||||
activityMission.setValue(count+activityMission.getValue());
|
||||
String key = RedisKey.getKey(RedisKey.EXPERT_RANK, String.valueOf(id), false);
|
||||
RedisUtil.getInstence().zsetAddOne(key, String.valueOf(user.getId()), count);
|
||||
}
|
||||
}
|
|
@ -19,6 +19,11 @@ public interface IActivity {
|
|||
*/
|
||||
void initActivity(User user) throws Exception;
|
||||
|
||||
/**
|
||||
* 活动重开
|
||||
*/
|
||||
void onResume(User user)throws Exception;
|
||||
|
||||
/**
|
||||
* 更新活动记录
|
||||
*/
|
||||
|
@ -31,6 +36,10 @@ public interface IActivity {
|
|||
*/
|
||||
boolean takeReward(ISession session, int missionId) throws Exception;
|
||||
|
||||
/**
|
||||
* 活动结束 目前只有绝对时间活动
|
||||
* @throws Exception
|
||||
*/
|
||||
void onActivityEnd() throws Exception;
|
||||
|
||||
List<CommonProto.ActivityInfo.MissionInfo> getAllMissInfo(ActivityMission activityMission, Set<Integer> filter);
|
||||
|
|
|
@ -0,0 +1,10 @@
|
|||
package com.ljsd.jieling.logic.activity;
|
||||
|
||||
|
||||
import com.ljsd.jieling.logic.activity.event.IEvent;
|
||||
|
||||
public interface IEventHandler {
|
||||
|
||||
void onEvent(IEvent event) throws Exception;
|
||||
|
||||
}
|
|
@ -29,7 +29,7 @@ public class LuckyCatActivity extends AbstractActivity {
|
|||
}
|
||||
|
||||
@Override
|
||||
public void initActivity(User user){
|
||||
public void initActivity(User user) {
|
||||
ActivityMission mission = new ActivityMission();
|
||||
List<Integer> luckyMisionIds = new ArrayList<>();
|
||||
SLuckyCatConfig.getConfigMapByActivityId(id).values().forEach(sLuckyCatConfig ->
|
||||
|
@ -41,7 +41,7 @@ public class LuckyCatActivity extends AbstractActivity {
|
|||
|
||||
@Override
|
||||
void updateProgress(ActivityMission activityMission, int count) {
|
||||
activityMission.setValue(count);
|
||||
activityMission.setValue(count + activityMission.getValue());
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -79,7 +79,7 @@ public class LuckyCatActivity extends AbstractActivity {
|
|||
return;
|
||||
}
|
||||
|
||||
if (activityMission.getValue() < sLuckyRewardConfig.getRmbValue()){
|
||||
if (activityMission.getValue() < sLuckyRewardConfig.getRmbValue()) {
|
||||
MessageUtil.sendErrorResponse(session, 0, rewardResponseValue, "value illegality");
|
||||
return;
|
||||
}
|
||||
|
@ -106,7 +106,7 @@ public class LuckyCatActivity extends AbstractActivity {
|
|||
activityProgressInfo.setState(ActivityType.HAD_TAKED);
|
||||
}
|
||||
|
||||
sendActivityProgress(session,activityMission, Collections.singleton(missionId));
|
||||
sendActivityProgress(session, activityMission, Collections.singleton(missionId));
|
||||
//drop
|
||||
int[][] reward = new int[1][];
|
||||
int[] temp2 = new int[2];
|
||||
|
@ -119,8 +119,8 @@ public class LuckyCatActivity extends AbstractActivity {
|
|||
String nickName = user.getPlayerInfoManager().getNickName();
|
||||
SItem sItem = SItem.getsItemMap().get(temp2[0]);
|
||||
|
||||
String message = SErrorCodeEerverConfig.getI18NMessage("luck_cat_take_reward_content", new Object[]{nickName,sItem.getName(),temp2[1]});
|
||||
ChatLogic.getInstance().sendSysChatMessage(message, Global.LUCKCAT,0,0,0,0,0,0);
|
||||
String message = SErrorCodeEerverConfig.getI18NMessage("luck_cat_take_reward_content", new Object[]{nickName, sItem.getName(), temp2[1]});
|
||||
ChatLogic.getInstance().sendSysChatMessage(message, Global.LUCKCAT, 0, 0, 0, 0, 0, 0);
|
||||
|
||||
PlayerInfoProto.TakeActivityRewardResponse build = PlayerInfoProto.TakeActivityRewardResponse.newBuilder().setDrop(drop).build();
|
||||
MessageUtil.sendMessage(session, 1, rewardResponseValue, build, true);
|
||||
|
|
|
@ -0,0 +1,27 @@
|
|||
package com.ljsd.jieling.logic.activity;
|
||||
|
||||
import com.ljsd.jieling.config.SActivityRewardConfig;
|
||||
import com.ljsd.jieling.logic.dao.ActivityMission;
|
||||
import com.ljsd.jieling.logic.dao.ActivityProgressInfo;
|
||||
import com.ljsd.jieling.network.session.ISession;
|
||||
|
||||
/**
|
||||
* Created by zsx on 2019/8/5 19:20
|
||||
*/
|
||||
class RechargeSumActivity extends AbstractActivity {
|
||||
|
||||
public RechargeSumActivity(int id) {
|
||||
super(id);
|
||||
}
|
||||
|
||||
@Override
|
||||
void updateProgress(ActivityMission activityMission, int count) {
|
||||
activityMission.setValue(count);
|
||||
}
|
||||
|
||||
@Override
|
||||
boolean takeRewardsProcess(ISession session, SActivityRewardConfig sActivityRewardConfig, ActivityProgressInfo activityProgressInfo) throws Exception {
|
||||
return checkValue(session, sActivityRewardConfig, activityProgressInfo);
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,65 @@
|
|||
package com.ljsd.jieling.logic.activity;
|
||||
|
||||
import com.ljsd.jieling.config.SActivityRewardConfig;
|
||||
import com.ljsd.jieling.logic.dao.ActivityManager;
|
||||
import com.ljsd.jieling.logic.dao.ActivityMission;
|
||||
import com.ljsd.jieling.logic.dao.ActivityProgressInfo;
|
||||
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.MessageUtil;
|
||||
|
||||
import java.util.Map;
|
||||
import java.util.TreeMap;
|
||||
|
||||
class RechargeSumDayActivity extends AbstractActivity {
|
||||
|
||||
public RechargeSumDayActivity(int id) {
|
||||
super(id);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onResume(User user) throws Exception {
|
||||
ActivityManager activityManager = user.getActivityManager();
|
||||
ActivityMission activityMission = activityManager.getActivityMissionMap().get(id);
|
||||
activityMission.setValue(0);
|
||||
int missionId = SActivityRewardConfig.getRechargeDaySum().get(activityMission.getValue() + 1);
|
||||
if (user.getPlayerInfoManager().getRechargedaily() > SActivityRewardConfig.getsActivityRewardConfigByMissionId(missionId).getValues()[0][0]) {
|
||||
activityMission.setValue(activityMission.getValue() + 1);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
void updateProgress(ActivityMission activityMission, int count) {
|
||||
|
||||
int missionId = SActivityRewardConfig.getRechargeDaySum().get(activityMission.getValue() + 1);
|
||||
ActivityProgressInfo activityProgressInfo = activityMission.getActivityProgressInfoMap().get(missionId);
|
||||
if (activityProgressInfo == null || activityProgressInfo.getProgrss() == 1) {
|
||||
return;
|
||||
}
|
||||
if (count > activityProgressInfo.getProgrss()) {
|
||||
activityProgressInfo.setProgrss(1);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
boolean takeRewardsProcess(ISession session, SActivityRewardConfig sActivityRewardConfig, ActivityProgressInfo activityProgressInfo) throws Exception {
|
||||
return checkValue(session, sActivityRewardConfig, activityProgressInfo);
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据配置解析数值进度完成度
|
||||
*/
|
||||
boolean checkValue(ISession session, SActivityRewardConfig sActivityRewardConfig, ActivityProgressInfo activityProgressInfo) throws Exception {
|
||||
int[][] values = sActivityRewardConfig.getValues();
|
||||
User user = UserManager.getUser(session.getUid());
|
||||
int value = user.getActivityManager().getActivityMissionMap().get(sActivityRewardConfig.getActivityId()).getValue()+1;
|
||||
if (value < values[0][1]) {
|
||||
MessageUtil.sendErrorResponse(session, 0, rewardResponseValue, "value illegality");
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,23 @@
|
|||
package com.ljsd.jieling.logic.activity;
|
||||
|
||||
|
||||
import com.ljsd.jieling.logic.activity.event.IEvent;
|
||||
import com.ljsd.jieling.logic.activity.event.Poster;
|
||||
import com.ljsd.jieling.logic.activity.event.SecretEvent;
|
||||
import com.ljsd.jieling.logic.dao.UserManager;
|
||||
|
||||
class SecretExpectRankActivity extends ExpectRankActivity {
|
||||
|
||||
public SecretExpectRankActivity(int id) {
|
||||
super(id);
|
||||
Poster.getPoster().listenEvent(this, SecretEvent.class);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onEvent(IEvent event) throws Exception {
|
||||
if (!(event instanceof SecretEvent))
|
||||
return;
|
||||
update(UserManager.getUser(((SecretEvent) event).getUid()), 1);
|
||||
|
||||
}
|
||||
}
|
|
@ -0,0 +1,20 @@
|
|||
package com.ljsd.jieling.logic.activity;
|
||||
|
||||
import com.ljsd.jieling.logic.dao.ActivityMission;
|
||||
|
||||
/**
|
||||
* 签到不走活动 没有逻辑处理
|
||||
*/
|
||||
@Deprecated
|
||||
class SignInSumActivity extends AbstractActivity {
|
||||
|
||||
public SignInSumActivity(int id) {
|
||||
super(id);
|
||||
}
|
||||
|
||||
@Override
|
||||
void updateProgress(ActivityMission activityMission, int count) {
|
||||
activityMission.setValue(count + activityMission.getValue());
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,24 @@
|
|||
package com.ljsd.jieling.logic.activity;
|
||||
|
||||
|
||||
import com.ljsd.jieling.globals.Global;
|
||||
import com.ljsd.jieling.logic.activity.event.IEvent;
|
||||
import com.ljsd.jieling.logic.activity.event.Poster;
|
||||
import com.ljsd.jieling.logic.activity.event.UseItemEvent;
|
||||
import com.ljsd.jieling.logic.dao.UserManager;
|
||||
|
||||
class StaminaExpectRankActivity extends ExpectRankActivity {
|
||||
|
||||
public StaminaExpectRankActivity(int id) {
|
||||
super(id);
|
||||
Poster.getPoster().listenEvent(this, UseItemEvent.class);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onEvent(IEvent event) throws Exception {
|
||||
if (!(event instanceof UseItemEvent))
|
||||
return;
|
||||
int changeNum = ((UseItemEvent) event).getUseItemMap().getOrDefault(Global.STAMINA, 0);
|
||||
update(UserManager.getUser(((UseItemEvent) event).getUseId()), changeNum);
|
||||
}
|
||||
}
|
|
@ -0,0 +1,23 @@
|
|||
package com.ljsd.jieling.logic.activity.event;
|
||||
|
||||
import java.util.Map;
|
||||
|
||||
public class AddItemEvent implements IEvent {
|
||||
|
||||
private int useId;
|
||||
Map<Integer, Integer> useItemMap;
|
||||
|
||||
public AddItemEvent(int useId, Map<Integer, Integer> useItemMap) {
|
||||
this.useId = useId;
|
||||
this.useItemMap = useItemMap;
|
||||
}
|
||||
|
||||
public Map<Integer, Integer> getUseItemMap() {
|
||||
return useItemMap;
|
||||
}
|
||||
|
||||
public int getUseId() {
|
||||
return useId;
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,17 @@
|
|||
package com.ljsd.jieling.logic.activity.event;
|
||||
|
||||
/**
|
||||
* 竞技场
|
||||
*/
|
||||
public class ArenaChallengeEvent implements IEvent {
|
||||
|
||||
private int uid;
|
||||
|
||||
public ArenaChallengeEvent(int uid) {
|
||||
this.uid = uid;
|
||||
}
|
||||
|
||||
public int getUid() {
|
||||
return uid;
|
||||
}
|
||||
}
|
|
@ -0,0 +1,23 @@
|
|||
package com.ljsd.jieling.logic.activity.event;
|
||||
|
||||
/**
|
||||
* 装备
|
||||
*/
|
||||
public class EquipEvent implements IEvent {
|
||||
|
||||
private int uid;
|
||||
private int equipId;
|
||||
|
||||
public EquipEvent(int uid, int equipId) {
|
||||
this.uid = uid;
|
||||
this.equipId = equipId;
|
||||
}
|
||||
|
||||
public int getUid() {
|
||||
return uid;
|
||||
}
|
||||
|
||||
public int getEquipId() {
|
||||
return equipId;
|
||||
}
|
||||
}
|
|
@ -0,0 +1,17 @@
|
|||
package com.ljsd.jieling.logic.activity.event;
|
||||
|
||||
/**
|
||||
* 点金
|
||||
*/
|
||||
public class GoldEvent implements IEvent {
|
||||
|
||||
private int uid;
|
||||
|
||||
public GoldEvent(int uid) {
|
||||
this.uid = uid;
|
||||
}
|
||||
|
||||
public int getUid() {
|
||||
return uid;
|
||||
}
|
||||
}
|
|
@ -0,0 +1,17 @@
|
|||
package com.ljsd.jieling.logic.activity.event;
|
||||
|
||||
/**
|
||||
* 升星
|
||||
*/
|
||||
public class HeroUpStarEvent implements IEvent {
|
||||
|
||||
private int uid;
|
||||
|
||||
public HeroUpStarEvent(int uid) {
|
||||
this.uid = uid;
|
||||
}
|
||||
|
||||
public int getUid() {
|
||||
return uid;
|
||||
}
|
||||
}
|
|
@ -0,0 +1,5 @@
|
|||
package com.ljsd.jieling.logic.activity.event;
|
||||
|
||||
public interface IEvent {
|
||||
|
||||
}
|
|
@ -0,0 +1,53 @@
|
|||
package com.ljsd.jieling.logic.activity.event;
|
||||
|
||||
import com.ljsd.jieling.logic.activity.IEventHandler;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.HashSet;
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
|
||||
/**
|
||||
* 简单的活动消息处理
|
||||
* TODO 用协议包一下再发 保证数据安全
|
||||
* 目前暂时单例 需要保证事件生产和消费是单线程
|
||||
* 但像全局的 如活动关闭应该分发事件协议到各个玩家去
|
||||
*/
|
||||
|
||||
public class Poster {
|
||||
public static Poster getPoster() {
|
||||
return poster;
|
||||
}
|
||||
|
||||
static Poster poster = new Poster();
|
||||
|
||||
private Poster() {
|
||||
}
|
||||
|
||||
private Map<Class<? extends IEvent>, Set<IEventHandler>> listenMap = new HashMap<>();
|
||||
|
||||
private Set<IEventHandler> getListeners(IEvent e) {
|
||||
return listenMap.get(e.getClass());
|
||||
}
|
||||
|
||||
public <T extends IEvent> boolean listenEvent(IEventHandler eh, Class<T> c) {
|
||||
Set<IEventHandler> ehs = listenMap.get(c);
|
||||
if (ehs == null) {
|
||||
ehs = new HashSet<>();
|
||||
listenMap.put(c, ehs);
|
||||
}
|
||||
return ehs.add(eh);
|
||||
}
|
||||
|
||||
public void dispatchEvent(IEvent e) {
|
||||
final Set<IEventHandler> ehs = getListeners(e);
|
||||
if (ehs != null) {
|
||||
for (IEventHandler eh : ehs) {
|
||||
try {
|
||||
eh.onEvent(e);
|
||||
}catch (Exception e1){
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,17 @@
|
|||
package com.ljsd.jieling.logic.activity.event;
|
||||
|
||||
/**
|
||||
* 秘境场
|
||||
*/
|
||||
public class SecretEvent implements IEvent {
|
||||
|
||||
private int uid;
|
||||
|
||||
public SecretEvent(int uid) {
|
||||
this.uid = uid;
|
||||
}
|
||||
|
||||
public int getUid() {
|
||||
return uid;
|
||||
}
|
||||
}
|
|
@ -0,0 +1,17 @@
|
|||
package com.ljsd.jieling.logic.activity.event;
|
||||
|
||||
/**
|
||||
* 副本
|
||||
*/
|
||||
public class StoryEvent implements IEvent {
|
||||
|
||||
private int uid;
|
||||
|
||||
public StoryEvent(int uid) {
|
||||
this.uid = uid;
|
||||
}
|
||||
|
||||
public int getUid() {
|
||||
return uid;
|
||||
}
|
||||
}
|
|
@ -0,0 +1,23 @@
|
|||
package com.ljsd.jieling.logic.activity.event;
|
||||
|
||||
import java.util.Map;
|
||||
|
||||
public class UseItemEvent implements IEvent {
|
||||
|
||||
private int useId;
|
||||
Map<Integer, Integer> useItemMap;
|
||||
|
||||
public UseItemEvent(int useId, Map<Integer, Integer> useItemMap) {
|
||||
this.useId = useId;
|
||||
this.useItemMap = useItemMap;
|
||||
}
|
||||
|
||||
public Map<Integer, Integer> getUseItemMap() {
|
||||
return useItemMap;
|
||||
}
|
||||
|
||||
public int getUseId() {
|
||||
return useId;
|
||||
}
|
||||
|
||||
}
|
|
@ -15,6 +15,8 @@ import com.ljsd.jieling.ktbeans.KTGameType;
|
|||
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.ArenaChallengeEvent;
|
||||
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.CheckFight;
|
||||
|
@ -206,6 +208,7 @@ public class ArenaLogic {
|
|||
//组战斗数据
|
||||
ArenaInfoProto.ArenaChallengeResponse build = builder.setMyScoreChange(myscoreChange).setDefScoreChange(defScoreChange).addAllArenaEnemys(getArenaEnemyList(arenaManager.getArenaEnemies())).build();
|
||||
user.getUserMissionManager().onGameEvent(user, GameEvent.ARENA_CHALLENGE,fightResult,myscoreChange + myscore);
|
||||
Poster.getPoster().dispatchEvent(new ArenaChallengeEvent(user.getId()));
|
||||
MessageUtil.sendMessage(session,1, MessageTypeProto.MessageType.ARENA_CHALLENGE_RESPONSE_VALUE,build,true);
|
||||
KtEventUtils.onKtEvent(user, ParamEventBean.UserGameType,KTGameType.ARENA.getIndex(),challengeUid);
|
||||
}
|
||||
|
|
|
@ -32,7 +32,7 @@ public class ActivityMission extends MongoBase {
|
|||
openType=0;
|
||||
}
|
||||
activityState = ActivityType.OPEN_STATE;
|
||||
|
||||
value=0;
|
||||
return true;
|
||||
}
|
||||
|
||||
|
@ -42,6 +42,7 @@ public class ActivityMission extends MongoBase {
|
|||
activityProgressInfoMap.put(missionId, new ActivityProgressInfo(0,0));
|
||||
}
|
||||
openType=1;
|
||||
value=0;
|
||||
activityState = ActivityType.OPEN_STATE;
|
||||
}
|
||||
|
||||
|
|
|
@ -3,6 +3,8 @@ package com.ljsd.jieling.logic.dao;
|
|||
import com.ljsd.common.mogodb.MongoBase;
|
||||
import com.ljsd.jieling.config.SEquipConfig;
|
||||
import com.ljsd.jieling.db.mongo.MongoKey;
|
||||
import com.ljsd.jieling.logic.activity.event.EquipEvent;
|
||||
import com.ljsd.jieling.logic.activity.event.Poster;
|
||||
import com.ljsd.jieling.logic.dao.root.User;
|
||||
import com.ljsd.jieling.logic.mission.GameEvent;
|
||||
|
||||
|
@ -29,6 +31,7 @@ public class EquipManager extends MongoBase {
|
|||
equipMap.put(equip.getId(),equip);
|
||||
addEquipHandBook(equip.getEquipId());
|
||||
user.getUserMissionManager().onGameEvent(user, GameEvent.GET_EQUIP,equip.getEquipId());
|
||||
Poster.getPoster().dispatchEvent(new EquipEvent(user.getId(),equip.getEquipId()));
|
||||
}
|
||||
|
||||
public void remove(String equipId){
|
||||
|
|
|
@ -11,6 +11,7 @@ import com.ljsd.jieling.db.mongo.MongoKey;
|
|||
import com.ljsd.jieling.logic.dao.root.User;
|
||||
import com.ljsd.jieling.logic.mission.GameEvent;
|
||||
import com.ljsd.jieling.util.MathUtils;
|
||||
import org.springframework.data.annotation.Transient;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.HashSet;
|
||||
|
@ -73,6 +74,13 @@ public class PlayerManager extends MongoBase {
|
|||
|
||||
private int guildId ;// 公会id
|
||||
|
||||
private int sign;//月签到天数
|
||||
|
||||
private int signTotay;//今天是否签到
|
||||
|
||||
@Transient
|
||||
private int rechargedaily;
|
||||
|
||||
public PlayerManager(){
|
||||
this.setRootCollection(User._COLLECTION_NAME);
|
||||
}
|
||||
|
@ -405,4 +413,34 @@ public class PlayerManager extends MongoBase {
|
|||
updateString("guildId", guildId);
|
||||
this.guildId = guildId;
|
||||
}
|
||||
|
||||
public int getSign() {
|
||||
return sign;
|
||||
}
|
||||
|
||||
public void setSign(int sign) {
|
||||
updateString("sign", sign);
|
||||
this.sign = sign;
|
||||
}
|
||||
|
||||
public void setSignTotay(int signTotay) {
|
||||
updateString("signTotay", signTotay);
|
||||
this.signTotay = signTotay;
|
||||
}
|
||||
|
||||
public int getSignTotay() {
|
||||
return signTotay;
|
||||
}
|
||||
|
||||
public int getRechargedaily() {
|
||||
return rechargedaily;
|
||||
}
|
||||
|
||||
public void setRechargedaily(int rechargedaily) {
|
||||
this.rechargedaily = rechargedaily;
|
||||
}
|
||||
|
||||
public void addRechargedaily(int rechargedaily) {
|
||||
this.rechargedaily += rechargedaily;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -13,6 +13,7 @@ public class RechargeInfo extends MongoBase{
|
|||
private int isFirst;
|
||||
private long createTime;
|
||||
private int hadBuyFound;
|
||||
private int isDayFirst;
|
||||
|
||||
private Map<Integer,Long> levelBagMap = new HashMap<>();
|
||||
|
||||
|
@ -79,6 +80,12 @@ public class RechargeInfo extends MongoBase{
|
|||
isFirst = first;
|
||||
}
|
||||
|
||||
public void setDailyFirst(int first) {
|
||||
updateString("isFirst",first);
|
||||
isDayFirst = first;
|
||||
}
|
||||
|
||||
|
||||
public void setCreateTime(long createTime) {
|
||||
updateString("createTime",createTime);
|
||||
this.createTime = createTime;
|
||||
|
@ -120,6 +127,10 @@ public class RechargeInfo extends MongoBase{
|
|||
return isFirst;
|
||||
}
|
||||
|
||||
public int getIsDayFirst() {
|
||||
return isDayFirst;
|
||||
}
|
||||
|
||||
public int getHadBuyFound() {
|
||||
return hadBuyFound;
|
||||
}
|
||||
|
|
|
@ -13,6 +13,8 @@ import com.ljsd.jieling.ktbeans.KTGameType;
|
|||
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.Poster;
|
||||
import com.ljsd.jieling.logic.activity.event.SecretEvent;
|
||||
import com.ljsd.jieling.logic.dao.*;
|
||||
import com.ljsd.jieling.logic.dao.root.User;
|
||||
import com.ljsd.jieling.logic.dao.UserManager;
|
||||
|
@ -370,6 +372,7 @@ public class CombatLogic {
|
|||
}
|
||||
adventureFastReward = getAdventureFastReward(user, SGameSetting.getGameSetting().getAdventureFastBattle());
|
||||
user.getUserMissionManager().onGameEvent(user,GameEvent.PlAY_STORY,9999,1);
|
||||
Poster.getPoster().dispatchEvent(new SecretEvent(user.getId()));
|
||||
}
|
||||
FightInfoProto.TakeAventureRewardResponse build = FightInfoProto.TakeAventureRewardResponse.newBuilder().setDrop(adventureFastReward.get(1)).setRandomDrop(adventureFastReward.get(2)).build();
|
||||
MessageUtil.sendMessage(session,1, MessageTypeProto.MessageType.ADVENTURE_REWARD_RESPONSE_VALUE,build,true);
|
||||
|
|
|
@ -12,6 +12,8 @@ import com.ljsd.jieling.ktbeans.KtEventUtils;
|
|||
import com.ljsd.jieling.ktbeans.parmsBean.ParamEventBean;
|
||||
import com.ljsd.jieling.logic.activity.ActivityLogic;
|
||||
import com.ljsd.jieling.logic.activity.ActivityType;
|
||||
import com.ljsd.jieling.logic.activity.event.HeroUpStarEvent;
|
||||
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.dao.UserManager;
|
||||
|
@ -625,6 +627,7 @@ public class HeroLogic {
|
|||
MessageUtil.sendErrorResponse(session,0,MessageTypeProto.MessageType.UP_HERO_STAR_RESPONSE_VALUE,"");
|
||||
return;
|
||||
}
|
||||
Poster.getPoster().dispatchEvent(new HeroUpStarEvent(user.getId()));
|
||||
//删除hero
|
||||
recyleHeroBySystem(user,removeHeroIds);
|
||||
targetHero.upStar( 1 );
|
||||
|
|
|
@ -220,6 +220,7 @@ public class PlayerLogic {
|
|||
user.getPlayerInfoManager().setMaxForce(teamForce);
|
||||
user.getUserMissionManager().onGameEvent(user,GameEvent.USER_FORCE_CHANGE);
|
||||
ActivityLogic.getInstance().updateActivityMissionProgress(user, ActivityType.FORCERANK,teamForce);
|
||||
ActivityLogic.getInstance().updateActivityMissionProgress(user, ActivityType.FORCESTANDARD,teamForce);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -145,6 +145,7 @@ public class BuyGoodsLogic {
|
|||
String content = SErrorCodeEerverConfig.getI18NMessage("recharge_first_txt");
|
||||
MailLogic.getInstance().sendMail(user.getId(),title,content,ItemUtil.getMailReward(sActivityRewardConfig.getReward()),nowTime, Global.MAIL_EFFECTIVE_TIME);
|
||||
}
|
||||
|
||||
if(length>baseReward.length){
|
||||
int[][] result = new int[length][];
|
||||
int i=0;
|
||||
|
@ -171,8 +172,13 @@ public class BuyGoodsLogic {
|
|||
if(sRechargeCommodityConfig.getAccumulativeRecharge() == 1){
|
||||
int saveAmt = rechargeInfo.getSaveAmt();
|
||||
rechargeInfo.setSaveAmt(price+saveAmt);
|
||||
user.getPlayerInfoManager().addRechargedaily(price);
|
||||
//TODO 用事件分发
|
||||
ActivityLogic.getInstance().updateActivityMissionProgress(user, ActivityType.RechargeTotal,rechargeInfo.getSaveAmt());
|
||||
ActivityLogic.getInstance().updateActivityMissionProgress(user, ActivityType.LUCKYCAT,rechargeInfo.getSaveAmt());
|
||||
ActivityLogic.getInstance().updateActivityMissionProgress(user, ActivityType.LUCKYCAT,price);
|
||||
ActivityLogic.getInstance().updateActivityMissionProgress(user, ActivityType.DAILY_RECHARGE,price);
|
||||
ActivityLogic.getInstance().updateActivityMissionProgress(user, ActivityType.RECHARGE_NUM,rechargeInfo.getSaveAmt());
|
||||
ActivityLogic.getInstance().updateActivityMissionProgress(user, ActivityType.RECHARGE_SUM_DAY, user.getPlayerInfoManager().getRechargedaily());
|
||||
}
|
||||
|
||||
buyGoodsTimes.put(goodsId,buyCount);
|
||||
|
|
|
@ -7,6 +7,8 @@ import com.ljsd.jieling.globals.BIReason;
|
|||
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.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;
|
||||
|
@ -280,6 +282,9 @@ public class StoreLogic {
|
|||
if(SStoreTypeConfig.getsStoreTypeConfigMap().get(storeId).getStoreType() != StoreType.GIFT_STORE.getType()){
|
||||
user.getUserMissionManager().onGameEvent(user, GameEvent.BUY_MATERIAL,sStoreConfig.getGoods()[0][0],itemNum);
|
||||
}
|
||||
if(itemId==10015){
|
||||
Poster.getPoster().dispatchEvent(new GoldEvent(user.getId()));
|
||||
}
|
||||
|
||||
PlayerInfoProto.BuyStoreItemResponse builder = PlayerInfoProto.BuyStoreItemResponse.newBuilder().setDrop(drop).build();
|
||||
MessageUtil.sendMessage(iSession, 1,msgId, builder, true);
|
||||
|
|
|
@ -11,6 +11,8 @@ import com.ljsd.jieling.handler.map.MapManager;
|
|||
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.activity.event.Poster;
|
||||
import com.ljsd.jieling.logic.activity.event.UseItemEvent;
|
||||
import com.ljsd.jieling.logic.dao.*;
|
||||
import com.ljsd.jieling.logic.dao.root.User;
|
||||
import com.ljsd.jieling.logic.hero.HeroLogic;
|
||||
|
@ -688,6 +690,7 @@ public class ItemUtil {
|
|||
MessageUtil.sendBagIndication(user.getId(),1,sendTemToFront);
|
||||
}
|
||||
user.getUserMissionManager().onGameEvent(user,GameEvent.CONSUMER_MATERIAL,useItemMap);
|
||||
Poster.getPoster().dispatchEvent(new UseItemEvent(user.getId(),useItemMap));
|
||||
}
|
||||
|
||||
|
||||
|
|
Loading…
Reference in New Issue