activity
parent
b858e5f40a
commit
b7ef0d56fb
|
@ -2,16 +2,18 @@ package com.ljsd.jieling.logic.activity;
|
||||||
|
|
||||||
|
|
||||||
import com.ljsd.jieling.config.SActivityRewardConfig;
|
import com.ljsd.jieling.config.SActivityRewardConfig;
|
||||||
import com.ljsd.jieling.db.redis.RedisKey;
|
import com.ljsd.jieling.logic.OnlineUserManager;
|
||||||
import com.ljsd.jieling.db.redis.RedisUtil;
|
|
||||||
import com.ljsd.jieling.logic.activity.event.HeroUpStarEvent;
|
import com.ljsd.jieling.logic.activity.event.HeroUpStarEvent;
|
||||||
import com.ljsd.jieling.logic.activity.event.IEvent;
|
import com.ljsd.jieling.logic.activity.event.IEvent;
|
||||||
import com.ljsd.jieling.logic.activity.event.Poster;
|
import com.ljsd.jieling.logic.activity.event.Poster;
|
||||||
import com.ljsd.jieling.logic.dao.ActivityMission;
|
import com.ljsd.jieling.logic.dao.ActivityMission;
|
||||||
import com.ljsd.jieling.logic.dao.Hero;
|
import com.ljsd.jieling.logic.dao.ActivityProgressInfo;
|
||||||
import com.ljsd.jieling.logic.dao.HeroManager;
|
|
||||||
import com.ljsd.jieling.logic.dao.UserManager;
|
import com.ljsd.jieling.logic.dao.UserManager;
|
||||||
import com.ljsd.jieling.logic.dao.root.User;
|
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;
|
||||||
|
|
||||||
class HeroUpExpectRankActivity extends ExpectRankActivity {
|
class HeroUpExpectRankActivity extends ExpectRankActivity {
|
||||||
|
|
||||||
|
@ -24,20 +26,42 @@ class HeroUpExpectRankActivity extends ExpectRankActivity {
|
||||||
public void onEvent(IEvent event) throws Exception {
|
public void onEvent(IEvent event) throws Exception {
|
||||||
if (!(event instanceof HeroUpStarEvent))
|
if (!(event instanceof HeroUpStarEvent))
|
||||||
return;
|
return;
|
||||||
// User user = UserManager.getUser(((HeroUpStarEvent) event).getUid());
|
|
||||||
// HeroManager heroManager = user.getHeroManager();
|
User user = UserManager.getUser(((HeroUpStarEvent) event).getUid());
|
||||||
SActivityRewardConfig sActivityRewardConfig = SActivityRewardConfig.getsActivityRewardConfigByActivityId(id).get(0);
|
ActivityMission activityMission = user.getActivityManager().getActivityMissionMap().get(id);
|
||||||
if(sActivityRewardConfig==null)
|
Map<Integer, ActivityProgressInfo> activityProgressInfoMap = activityMission.getActivityProgressInfoMap();
|
||||||
return;
|
|
||||||
// int count = 0;
|
for (SActivityRewardConfig sActivityRewardConfig : SActivityRewardConfig.getsActivityRewardConfigByActivityId(id)) {
|
||||||
// for (Hero targetHero:heroManager.getHeroMap().values()) {
|
if (((HeroUpStarEvent) event).getStar() == sActivityRewardConfig.getValues()[0][0]) {
|
||||||
// if(targetHero.getStar()>=sActivityRewardConfig.getValues()[0][0]){
|
ActivityProgressInfo activityProgressInfo = activityProgressInfoMap.getOrDefault(sActivityRewardConfig.getId(), null);
|
||||||
// count++;
|
if (null == activityProgressInfo)
|
||||||
// }
|
continue;
|
||||||
// }
|
activityProgressInfo.setProgrss(activityProgressInfo.getProgrss() + 1);
|
||||||
update(UserManager.getUser(((HeroUpStarEvent) event).getUid()), 1);
|
activityMission.updateProgressInfo(sActivityRewardConfig.getId(), activityProgressInfo);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
//更新进度
|
||||||
|
ISession sessionByUid = OnlineUserManager.getSessionByUid(user.getId());
|
||||||
|
sendActivityProgress(sessionByUid, activityMission, null);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void update(User user, int count) {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@Override
|
||||||
|
boolean takeRewardsProcess(ISession session, SActivityRewardConfig sActivityRewardConfig, ActivityProgressInfo activityProgressInfo) throws Exception {
|
||||||
|
int[][] values = sActivityRewardConfig.getValues();
|
||||||
|
int missionProgress = activityProgressInfo.getProgrss();
|
||||||
|
if (missionProgress < values[1][0]) {
|
||||||
|
LOGGER.error("the uid={} the misionId={},the missionProgress={},the require is={} ", session.getUid(), sActivityRewardConfig.getId(), missionProgress, values[0][0]);
|
||||||
|
MessageUtil.sendErrorResponse(session, 0, rewardResponseValue, "time not");
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
return true;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -6,9 +6,15 @@ package com.ljsd.jieling.logic.activity.event;
|
||||||
public class HeroUpStarEvent implements IEvent {
|
public class HeroUpStarEvent implements IEvent {
|
||||||
|
|
||||||
private int uid;
|
private int uid;
|
||||||
|
private int star;
|
||||||
|
|
||||||
public HeroUpStarEvent(int uid) {
|
public HeroUpStarEvent(int uid, int star) {
|
||||||
this.uid = uid;
|
this.uid = uid;
|
||||||
|
this.star = star;
|
||||||
|
}
|
||||||
|
|
||||||
|
public int getStar() {
|
||||||
|
return star;
|
||||||
}
|
}
|
||||||
|
|
||||||
public int getUid() {
|
public int getUid() {
|
||||||
|
|
|
@ -627,10 +627,11 @@ public class HeroLogic {
|
||||||
MessageUtil.sendErrorResponse(session,0,MessageTypeProto.MessageType.UP_HERO_STAR_RESPONSE_VALUE,"");
|
MessageUtil.sendErrorResponse(session,0,MessageTypeProto.MessageType.UP_HERO_STAR_RESPONSE_VALUE,"");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
Poster.getPoster().dispatchEvent(new HeroUpStarEvent(user.getId()));
|
|
||||||
//删除hero
|
//删除hero
|
||||||
recyleHeroBySystem(user,removeHeroIds);
|
recyleHeroBySystem(user,removeHeroIds);
|
||||||
targetHero.upStar( 1 );
|
targetHero.upStar( 1 );
|
||||||
|
Poster.getPoster().dispatchEvent(new HeroUpStarEvent(user.getId(),targetHero.getStar()));
|
||||||
targetHero.setStarBreakId(scHeroRankUpConfig.getId());
|
targetHero.setStarBreakId(scHeroRankUpConfig.getId());
|
||||||
user.getUserMissionManager().onGameEvent(user,GameEvent.HERO_UP,2,targetHero.getTemplateId());
|
user.getUserMissionManager().onGameEvent(user,GameEvent.HERO_UP,2,targetHero.getTemplateId());
|
||||||
MessageUtil.sendMessage(session,1,MessageTypeProto.MessageType.UP_HERO_STAR_RESPONSE_VALUE,null,true);
|
MessageUtil.sendMessage(session,1,MessageTypeProto.MessageType.UP_HERO_STAR_RESPONSE_VALUE,null,true);
|
||||||
|
|
|
@ -34,6 +34,7 @@ public class MinuteTask extends Thread {
|
||||||
public void run() {
|
public void run() {
|
||||||
try {
|
try {
|
||||||
LOGGER.info("MinuteTask start...");
|
LOGGER.info("MinuteTask start...");
|
||||||
|
LOGGER.info("online use num::"+ OnlineUserManager.sessionMap.entrySet().size());
|
||||||
HotfixUtil.getInstance().doWork("../conf/hotfix.json");
|
HotfixUtil.getInstance().doWork("../conf/hotfix.json");
|
||||||
ActivityLogic.getInstance().checkActiviyStatus();
|
ActivityLogic.getInstance().checkActiviyStatus();
|
||||||
STableManager.updateTablesWithTableNames(true);
|
STableManager.updateTablesWithTableNames(true);
|
||||||
|
|
Loading…
Reference in New Issue