Task 【ID1005360】 【达人活动】新增寻宝达人等4项达人活动

back_recharge
zhangshanxue 2019-12-29 17:24:30 +08:00
parent 2f9fb3c349
commit 50e9aee159
14 changed files with 262 additions and 6 deletions

View File

@ -659,6 +659,7 @@ public class ActivityLogic implements IEventHandler{
PlayerInfoProto.SecretBoxRandomResponse build = PlayerInfoProto.SecretBoxRandomResponse.newBuilder().setDrop(drop).setExtrarReward(extraDrop).build();
MessageUtil.sendMessage(session, 1, MessageTypeProto.MessageType.SECRETBOX_RANDOM_RESPONSE_VALUE, build, true);
user.getUserMissionManager().onGameEvent(user, GameEvent.SECRETBOX, id, randCount);
Poster.getPoster().dispatchEvent(new SecretBoxEvent(uid,randCount));
}
private int[] getSecretBoxRewardByPool(int secretBoxRandomPool) {

View File

@ -50,6 +50,11 @@ public interface ActivityType {
int NEW_WELFARE = 42;//萌新福利
int LIMIT_RANDOM_CARD = 43;//限时抽卡
int MISSIONSEARCH_EXPERT = 46;//寻宝达人
int LUCKWHEEL_EXPERT = 47;//探宝达人
int HERORANDOM_EXPERT = 48;//征募达人
int SECURTBOX_EXPERT = 49;//秘宝达人
}

View File

@ -38,6 +38,10 @@ public enum ActivityTypeEnum {
LUCK_WHEEL_ADVANCE(ActivityType.LUCK_WHEEL_ADVANCE, LuckWheelAdvancedActivity::new),
NEW_WELFARE(ActivityType.NEW_WELFARE, NewWelfareActivity::new),
LIMIT_RANDOM_CARD(ActivityType.LIMIT_RANDOM_CARD,LimitRandomCardActivity::new),
MISSIONSEARCH_EXPERT(ActivityType.MISSIONSEARCH_EXPERT,MissSearchExpectRankActivity::new),
LUCKWHEEL_EXPERT(ActivityType.LUCKWHEEL_EXPERT,LuckWheelExpectRankActivity::new),
HERORANDOM_EXPERT(ActivityType.HERORANDOM_EXPERT,HeroRandomExpectRankActivity::new),
SECURTBOX_EXPERT(ActivityType.SECURTBOX_EXPERT,SecurtBoxExpectRankActivity::new),
;
private int type;
private Function<Integer, AbstractActivity> toActivityFunction;

View File

@ -0,0 +1,27 @@
package com.ljsd.jieling.logic.activity;
import com.ljsd.jieling.logic.activity.event.HeroRandomEvent;
import com.ljsd.jieling.logic.activity.event.IEvent;
import com.ljsd.jieling.logic.activity.event.Poster;
import com.ljsd.jieling.logic.dao.UserManager;
/**
*
*/
class HeroRandomExpectRankActivity extends ExpectRankActivity {
public HeroRandomExpectRankActivity(int id) {
super(id);
Poster.getPoster().listenEvent(this, HeroRandomEvent.class);
}
@Override
public void onEvent(IEvent event) throws Exception {
if (!(event instanceof HeroRandomEvent))
return;
update(UserManager.getUser(((HeroRandomEvent) event).getUid()), ((HeroRandomEvent) event).getTime());
}
}

View File

@ -0,0 +1,29 @@
package com.ljsd.jieling.logic.activity;
import com.ljsd.jieling.logic.activity.event.IEvent;
import com.ljsd.jieling.logic.activity.event.LuckWheelAdvanceEvent;
import com.ljsd.jieling.logic.activity.event.LuckWheelEvent;
import com.ljsd.jieling.logic.activity.event.Poster;
import com.ljsd.jieling.logic.dao.UserManager;
/**
*
*/
class LuckWheelExpectRankActivity extends ExpectRankActivity {
public LuckWheelExpectRankActivity(int id) {
super(id);
Poster.getPoster().listenEvent(this, LuckWheelAdvanceEvent.class);
Poster.getPoster().listenEvent(this, LuckWheelEvent.class);
}
@Override
public void onEvent(IEvent event) throws Exception {
if (!(event instanceof LuckWheelEvent))
return;
update(UserManager.getUser(((LuckWheelEvent) event).getUid()), 1);
}
}

View File

@ -0,0 +1,63 @@
package com.ljsd.jieling.logic.activity;
import com.ljsd.jieling.logic.OnlineUserManager;
import com.ljsd.jieling.logic.activity.event.*;
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 config.SActivityRewardConfig;
import config.SEquipConfig;
import manager.STableManager;
import java.util.Map;
/**
*
*/
class MissSearchExpectRankActivity extends ExpectRankActivity {
public MissSearchExpectRankActivity(int id) {
super(id);
Poster.getPoster().listenEvent(this, MissingRoomBestEvent.class);
}
@Override
public void onEvent(IEvent event) throws Exception {
if (!(event instanceof MissingRoomBestEvent))
return;
User user = UserManager.getUser(((MissingRoomBestEvent) event).getUid());
ActivityMission activityMission = user.getActivityManager().getActivityMissionMap().get(id);
Map<Integer, ActivityProgressInfo> activityProgressInfoMap = activityMission.getActivityProgressInfoMap();
for (SActivityRewardConfig sActivityRewardConfig : SActivityRewardConfig.getsActivityRewardConfigByActivityId(id)) {
if (((MissingRoomBestEvent) event).getTaskType() == sActivityRewardConfig.getValues()[0][0]) {
ActivityProgressInfo activityProgressInfo = activityProgressInfoMap.getOrDefault(sActivityRewardConfig.getId(), null);
if (null == activityProgressInfo)
continue;
activityProgressInfo.setProgrss(activityProgressInfo.getProgrss() + 1);
activityMission.updateProgressInfo(sActivityRewardConfig.getId(), activityProgressInfo);
}
}
//更新进度
ISession sessionByUid = OnlineUserManager.getSessionByUid(user.getId());
System.out.print(activityMission.toString());
sendActivityProgress(sessionByUid, activityMission, null);
}
@Override
boolean takeRewardsProcess(ISession session, SActivityRewardConfig sActivityRewardConfig, ActivityProgressInfo activityProgressInfo) throws Exception {
int[][] values = sActivityRewardConfig.getValues();
int missionProgress = activityProgressInfo.getProgrss();
if (missionProgress < values[1][0]) {
return false;
}
return true;
}
}

View File

@ -0,0 +1,27 @@
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.SecretBoxEvent;
import com.ljsd.jieling.logic.dao.UserManager;
/**
*
*/
class SecurtBoxExpectRankActivity extends ExpectRankActivity {
public SecurtBoxExpectRankActivity(int id) {
super(id);
Poster.getPoster().listenEvent(this, SecretBoxEvent.class);
}
@Override
public void onEvent(IEvent event) throws Exception {
if (!(event instanceof SecretBoxEvent))
return;
update(UserManager.getUser(((SecretBoxEvent) event).getUid()), ((SecretBoxEvent) event).getTime());
}
}

View File

@ -0,0 +1,21 @@
package com.ljsd.jieling.logic.activity.event;
public class HeroRandomEvent implements IEvent {
private int uid;
private int time;
public HeroRandomEvent(int uid, int time) {
this.uid = uid;
this.time = time;
}
public int getTime() {
return time;
}
public int getUid() {
return uid;
}
}

View File

@ -8,6 +8,11 @@ package com.ljsd.jieling.logic.activity.event;
public class MissingRoomBestEvent implements IEvent{
private int taskType;
private int uid;
public int getUid() {
return uid;
}
public int getTaskType() {
return taskType;
@ -17,7 +22,8 @@ public class MissingRoomBestEvent implements IEvent{
this.taskType = taskType;
}
public MissingRoomBestEvent(int taskType) {
public MissingRoomBestEvent(int taskType, int uid) {
this.taskType = taskType;
this.uid = uid;
}
}

View File

@ -0,0 +1,23 @@
package com.ljsd.jieling.logic.activity.event;
/**
*
*/
public class SecretBoxEvent implements IEvent {
private int uid;
private int time;
public SecretBoxEvent(int uid, int time) {
this.uid = uid;
this.time = time;
}
public int getTime() {
return time;
}
public int getUid() {
return uid;
}
}

View File

@ -13,10 +13,7 @@ import com.ljsd.jieling.globals.BIReason;
import com.ljsd.jieling.globals.Global;
import com.ljsd.jieling.logic.activity.ActivityLogic;
import com.ljsd.jieling.logic.activity.event.HeroFiveStarGetEvent;
import com.ljsd.jieling.logic.activity.event.HeroUpStarEvent;
import com.ljsd.jieling.logic.activity.event.Poster;
import com.ljsd.jieling.logic.activity.event.RandomCardEvent;
import com.ljsd.jieling.logic.activity.event.*;
import com.ljsd.jieling.logic.activity.eventhandler.HeroFiveStarGetEventHandler;
import com.ljsd.jieling.logic.dao.*;
import com.ljsd.jieling.logic.dao.root.User;
@ -318,6 +315,8 @@ public class HeroLogic{
if( (alreadyCount + perCount)/lotterySecurityReward[0] > alreadyCount/lotterySecurityReward[0]){
builder.setExtraBox(ItemUtil.drop(user, new int[]{lotterySecurityReward[1]},1F,0,BIReason.HERO_RANDOM));
}
Poster.getPoster().dispatchEvent(new HeroRandomEvent(uid,perCount));
}
user.getUserMissionManager().onGameEvent(user,GameEvent.RANDOM_HERO,sLotterySetting.getLotteryType(),perCount);
heroManager.updateRandCount(type,randCount);

View File

@ -691,7 +691,7 @@ public class MissionLoigc {
User user = UserManager.getUser(session.getUid());
MissingRoomMissionType missingRoomMissionType = user.getUserMissionManager().getMissingRoomMissionType();
missingRoomMissionType.heroSend(user,hero,missionId);
Poster.getPoster().dispatchEvent(new MissingRoomBestEvent(SMazeTreasure.sMazeTreasureMap.get(missionId%10_000).getTaskType()));
Poster.getPoster().dispatchEvent(new MissingRoomBestEvent(SMazeTreasure.sMazeTreasureMap.get(missionId%10_000).getTaskType(),user.getId()));
user.getUserMissionManager().updateString("missingRoomMissionType",missingRoomMissionType);
MessageUtil.sendMessage(session,1,messageType.getNumber(),null,true);
}

View File

@ -138,6 +138,13 @@ public class PlayerLogic {
playerInfoManager.setNickName(name);
if(sex==0||sex==1){
playerInfoManager.setSex(sex);
int headID =SPlayerRole.getRolePic(sex);
if(headID==0){
LOGGER.error("Exception::sex pic null");
}else {
playerInfoManager.setHead(headID);
}
playerInfoUpdate(user);
}
String key = RedisKey.getKey(RedisKey.C_User_Name_Key, name, false);
RedisUtil.getInstence().set(key, String.valueOf(uid),RedisKey.REDIS_OVER_FOREVER);

View File

@ -0,0 +1,44 @@
package config;
import manager.STableManager;
import manager.Table;
import java.util.HashMap;
import java.util.Map;
@Table(name ="PlayerRole")
public class SPlayerRole implements BaseConfig {
private int id;
private int role;
private int rolePic;
private static Map<Integer,Integer> roleMap;
@Override
public void init() throws Exception {
roleMap = new HashMap<>();
for (SPlayerRole entry:STableManager.getConfig(SPlayerRole.class).values()) {
roleMap.put(entry.getRole(),entry.getRolePic());
}
}
public int getId() {
return id;
}
public int getRole() {
return role;
}
public int getRolePic() {
return rolePic;
}
public static int getRolePic(Integer sex) {
return SPlayerRole.roleMap.getOrDefault(sex,0);
}
}