易经宝库提交
parent
aa6133e571
commit
8e3704bf67
|
@ -35,7 +35,7 @@ public class LogLinkedList<E> extends WrapList<E> {
|
|||
}
|
||||
|
||||
private void upString(E value){
|
||||
mongoBase.updateString(name,value);
|
||||
mongoBase.updateString(name,getWrapped());
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -22,11 +22,18 @@
|
|||
<Variable name="refreshTime" type="int"/>
|
||||
</Jbean>
|
||||
|
||||
<Jbean name="SubRewardPoolInfo">
|
||||
<Variable name="subRewardPool" type="list" value="int"/>挖矿奖池
|
||||
<Variable name="lay" type="int"/>挖矿奖池层
|
||||
</Jbean>
|
||||
|
||||
<Jbean name="ActivityManager">
|
||||
<Variable name="activityMissionMap" type="map" key="int" value="ActivityMission" />
|
||||
<Variable name="senvenStartTime" type="long"/> 七日狂欢开始时间
|
||||
<Variable name="luckWheel" type="LuckWheelMission"/>幸运探宝奖池
|
||||
<Variable name="luckWheelAdvance" type="LuckWheelMission"/>高级幸运探宝奖池
|
||||
<Variable name="subRewardPoolInfo" type="SubRewardPoolInfo"/>挖矿奖池
|
||||
|
||||
</Jbean>
|
||||
|
||||
|
||||
|
|
|
@ -119,6 +119,8 @@ public class ClassDeclare implements Visitor {
|
|||
|
||||
|
||||
public void visitWrop(com.dbgen.Type type, PrintStream ps, String prefix) {
|
||||
ps.print(prefix+ "@Transient");
|
||||
ps.println();
|
||||
ps.print(prefix+ "private " + "Log"+TypeName.getName(type) + " "+ getVarname()+ "Log ;");
|
||||
}
|
||||
}
|
||||
|
|
|
@ -290,4 +290,6 @@ public interface BIReason {
|
|||
|
||||
int SPECIAL_FREE_PIECE_CONSUME = 1072;//灵兽放生碎片消耗
|
||||
|
||||
int SUB_ACTIVITY_CONSUME = 1073;//易经宝库
|
||||
|
||||
}
|
|
@ -0,0 +1,92 @@
|
|||
package com.ljsd.jieling.handler.activity;
|
||||
|
||||
import com.google.protobuf.GeneratedMessage;
|
||||
import com.ljsd.jieling.exception.ErrorCode;
|
||||
import com.ljsd.jieling.exception.ErrorCodeException;
|
||||
import com.ljsd.jieling.handler.BaseHandler;
|
||||
import com.ljsd.jieling.jbean.ActivityMission;
|
||||
import com.ljsd.jieling.jbean.ActivityProgressInfo;
|
||||
import com.ljsd.jieling.logic.OnlineUserManager;
|
||||
import com.ljsd.jieling.logic.activity.AbstractActivity;
|
||||
import com.ljsd.jieling.logic.activity.ActivityTypeEnum;
|
||||
import com.ljsd.jieling.logic.activity.SubActivity;
|
||||
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.protocols.ActivityProto;
|
||||
import com.ljsd.jieling.protocols.MessageTypeProto;
|
||||
import config.SBlessingConfigNew;
|
||||
import config.SBlessingRewardPoolNew;
|
||||
import manager.STableManager;
|
||||
|
||||
import java.util.HashSet;
|
||||
|
||||
/**
|
||||
* Description: des
|
||||
* Author: zsx
|
||||
* CreateDate: 2020/11/7 9:47
|
||||
*/
|
||||
public class SeletSubRewardPoolRequestHandler extends BaseHandler<ActivityProto.SeletSubRewardPoolRequest>{
|
||||
|
||||
@Override
|
||||
public MessageTypeProto.MessageType getMessageCode() {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public GeneratedMessage processWithProto(int uid, ActivityProto.SeletSubRewardPoolRequest proto) throws Exception {
|
||||
int selectId = proto.getSelectId();
|
||||
int activityId = proto.getActivityId();
|
||||
|
||||
//check activity
|
||||
User user = UserManager.getUser(uid);
|
||||
AbstractActivity abstractActivity = ActivityTypeEnum.getActicityType(proto.getActivityId());
|
||||
if (null == abstractActivity) {
|
||||
throw new ErrorCodeException(ErrorCode.ACTIVITY_NOT_OPEN);
|
||||
}
|
||||
ActivityMission activityMission = user.getActivityManager().getActivityMissionMap().get(proto.getActivityId());
|
||||
if(activityMission==null){
|
||||
throw new ErrorCodeException(ErrorCode.ACTIVITY_NOT_OPEN);
|
||||
}
|
||||
|
||||
|
||||
//check conf
|
||||
SBlessingConfigNew sBlessingConfigNew =SBlessingConfigNew.getsBlessingConfigNewHashMap().get(activityId);
|
||||
int finalPoolId = sBlessingConfigNew.getFinalPoolId();
|
||||
|
||||
SBlessingRewardPoolNew sBlessingRewardPoolNew = STableManager.getConfig(SBlessingRewardPoolNew.class).get(selectId);
|
||||
if(sBlessingRewardPoolNew.getPoolId()!=finalPoolId){
|
||||
throw new ErrorCodeException(ErrorCode.CFG_NULL);
|
||||
}
|
||||
|
||||
|
||||
//check leve
|
||||
|
||||
if(sBlessingRewardPoolNew.getLevelLimit()>user.getPlayerInfoManager().getLevel()){
|
||||
throw new ErrorCodeException(ErrorCode.PLAYER_LEVE_NOT);
|
||||
}
|
||||
//check floor
|
||||
ActivityProgressInfo activityProgressInfo = activityMission.getActivityMissionMap().get(SubActivity.LAY_INDEX);
|
||||
if(activityProgressInfo!=null&&sBlessingRewardPoolNew.getFloorLimit()>activityProgressInfo.getProgrss()){
|
||||
throw new ErrorCodeException(ErrorCode.SERVER_DEFINE);
|
||||
}
|
||||
|
||||
// //check had select
|
||||
if(activityMission.getV()!=0){
|
||||
ActivityProgressInfo activityProgressInfo1 = activityMission.getActivityMissionMap().get(SubActivity.POOL_INDEX + activityMission.getV());
|
||||
if(activityProgressInfo1!=null&&activityProgressInfo1.getProgrss()!=0){
|
||||
activityProgressInfo1.setProgrss(activityProgressInfo1.getProgrss()-1);
|
||||
}
|
||||
user.getActivityManager().getSubRewardPoolInfo().getSubRewardPool().remove(user.getActivityManager().getSubRewardPoolInfo().getSubRewardPool().size()-1);
|
||||
}
|
||||
activityMission.setV(selectId);
|
||||
ActivityProgressInfo activityProgressInfo1 = activityMission.getActivityMissionMap().get(SubActivity.POOL_INDEX + selectId);
|
||||
if(activityProgressInfo1!=null){
|
||||
activityProgressInfo1.setProgrss(activityProgressInfo1.getProgrss()+1);
|
||||
}
|
||||
user.getActivityManager().getSubRewardPoolInfo().getSubRewardPool().add(selectId);
|
||||
ISession sessionByUid = OnlineUserManager.getSessionByUid(user.getId());
|
||||
abstractActivity.sendActivityProgress(sessionByUid, activityMission, null);
|
||||
return ActivityProto.SeletSubRewardPoolResponse.newBuilder().build();
|
||||
}
|
||||
}
|
|
@ -17,6 +17,7 @@ public final class ActivityManager extends MongoBase {
|
|||
private long senvenStartTime; // 七日狂欢开始时间
|
||||
private com.ljsd.jieling.jbean.LuckWheelMission luckWheel; // 幸运探宝奖池
|
||||
private com.ljsd.jieling.jbean.LuckWheelMission luckWheelAdvance; // 高级幸运探宝奖池
|
||||
private com.ljsd.jieling.jbean.SubRewardPoolInfo subRewardPoolInfo; // 挖矿奖池
|
||||
|
||||
public ActivityManager() {
|
||||
}
|
||||
|
@ -28,6 +29,7 @@ public final class ActivityManager extends MongoBase {
|
|||
this.senvenStartTime = _o_.senvenStartTime;
|
||||
this.luckWheel = new LuckWheelMission(_o_.luckWheel);
|
||||
this.luckWheelAdvance = new LuckWheelMission(_o_.luckWheelAdvance);
|
||||
this.subRewardPoolInfo = new SubRewardPoolInfo(_o_.subRewardPoolInfo);
|
||||
}
|
||||
|
||||
public Map<Integer, com.ljsd.jieling.jbean.ActivityMission> getActivityMissionMap() {
|
||||
|
@ -48,6 +50,10 @@ public final class ActivityManager extends MongoBase {
|
|||
return this.luckWheelAdvance;
|
||||
}
|
||||
|
||||
public com.ljsd.jieling.jbean.SubRewardPoolInfo getSubRewardPoolInfo() { // 挖矿奖池
|
||||
return this.subRewardPoolInfo;
|
||||
}
|
||||
|
||||
public void setSenvenStartTime(long senvenstarttime) { // 七日狂欢开始时间
|
||||
updateString("senvenStartTime",senvenstarttime);
|
||||
this.senvenStartTime = senvenstarttime;
|
||||
|
@ -65,6 +71,12 @@ public final class ActivityManager extends MongoBase {
|
|||
this.luckWheelAdvance = luckwheeladvance;
|
||||
}
|
||||
|
||||
public void setSubRewardPoolInfo(SubRewardPoolInfo subrewardpoolinfo) { // 挖矿奖池
|
||||
updateString("subRewardPoolInfo",subrewardpoolinfo);
|
||||
subrewardpoolinfo.init(getRootId(),getMongoKey()+ ".subRewardPoolInfo");
|
||||
this.subRewardPoolInfo = subrewardpoolinfo;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
|
@ -74,6 +86,7 @@ public final class ActivityManager extends MongoBase {
|
|||
_sb_.append(this.senvenStartTime).append(",");
|
||||
_sb_.append(this.luckWheel).append(",");
|
||||
_sb_.append(this.luckWheelAdvance).append(",");
|
||||
_sb_.append(this.subRewardPoolInfo).append(",");
|
||||
_sb_.append(")");
|
||||
return _sb_.toString();
|
||||
}
|
||||
|
|
|
@ -0,0 +1,55 @@
|
|||
package com.ljsd.jieling.jbean;
|
||||
|
||||
import com.ljsd.common.mogodb.MongoBase;
|
||||
import java.util.Map;
|
||||
import java.util.HashMap;
|
||||
import java.util.Set;
|
||||
import java.util.HashSet;
|
||||
import java.util.List;
|
||||
import java.util.LinkedList;
|
||||
import org.springframework.data.annotation.Transient;
|
||||
import com.ljsd.common.mogodb.dblog.*;
|
||||
|
||||
public final class SubRewardPoolInfo extends MongoBase {
|
||||
private LinkedList<Integer> subRewardPool = new LinkedList<Integer>(); // 挖矿奖池
|
||||
@Transient
|
||||
private LogLinkedList<Integer> subRewardPoolLog ;
|
||||
private int lay; // 挖矿奖池层
|
||||
|
||||
public SubRewardPoolInfo() {
|
||||
}
|
||||
|
||||
|
||||
public SubRewardPoolInfo(SubRewardPoolInfo _o_ ) {
|
||||
this.subRewardPool = new LinkedList<Integer>();
|
||||
_o_.subRewardPool.forEach(_v_ -> this.subRewardPool.add(_v_));
|
||||
this.lay = _o_.lay;
|
||||
}
|
||||
|
||||
public List<Integer> getSubRewardPool() { // 挖矿奖池
|
||||
if( null == subRewardPoolLog && subRewardPool != null)
|
||||
subRewardPoolLog = new LogLinkedList<Integer>( this,"subRewardPool",subRewardPool);
|
||||
return this.subRewardPoolLog;
|
||||
}
|
||||
|
||||
public int getLay() { // 挖矿奖池层
|
||||
return this.lay;
|
||||
}
|
||||
|
||||
public void setLay(int lay) { // 挖矿奖池层
|
||||
updateString("lay",lay);
|
||||
this.lay = lay;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
StringBuilder _sb_ = new StringBuilder(super.toString());
|
||||
_sb_.append("=(");
|
||||
_sb_.append(this.subRewardPool).append(",");
|
||||
_sb_.append(this.lay).append(",");
|
||||
_sb_.append(")");
|
||||
return _sb_.toString();
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,24 @@
|
|||
package com.ljsd.jieling.kefu;
|
||||
|
||||
import com.ljsd.jieling.exception.ErrorCode;
|
||||
import com.ljsd.jieling.logic.OnlineUserManager;
|
||||
import com.ljsd.jieling.network.server.SessionManager;
|
||||
import com.ljsd.jieling.network.session.ISession;
|
||||
import com.ljsd.jieling.util.MessageUtil;
|
||||
|
||||
public class Cmd_kickuser extends GmRoleAbstract {
|
||||
|
||||
@Override
|
||||
public boolean exec(String[] args) throws Exception {
|
||||
|
||||
SessionManager instance = SessionManager.getInstance();
|
||||
ISession session= OnlineUserManager.getSessionByUid(getUser().getId());
|
||||
if (session != null) {
|
||||
MessageUtil.sendErrorCode(session, ErrorCode.kickUserCode, "您已被踢下线!");
|
||||
Thread.sleep(100);
|
||||
instance.kickOldUser(getUser().getId(), "", ErrorCode.kickUserCode, "LOSE HEART PACKET!!!!", 0);
|
||||
}
|
||||
return true;
|
||||
|
||||
}
|
||||
}
|
|
@ -0,0 +1,150 @@
|
|||
package com.ljsd.jieling.kefu;
|
||||
|
||||
|
||||
import com.ljsd.fight.CheckFight;
|
||||
import com.ljsd.jieling.config.clazzStaticCfg.CommonStaticConfig;
|
||||
import com.ljsd.jieling.core.GlobalsDef;
|
||||
import com.ljsd.jieling.db.redis.RedisKey;
|
||||
import com.ljsd.jieling.db.redis.RedisUtil;
|
||||
import com.ljsd.jieling.exception.ErrorCode;
|
||||
import com.ljsd.jieling.exception.ErrorCodeException;
|
||||
import com.ljsd.jieling.logic.championship.ChampionshipLogic;
|
||||
import com.ljsd.jieling.logic.dao.ArenaRecord;
|
||||
import com.ljsd.jieling.logic.dao.FamilyFightInfo;
|
||||
import com.ljsd.jieling.logic.dao.UserManager;
|
||||
import com.ljsd.jieling.logic.dao.root.User;
|
||||
import com.ljsd.jieling.logic.fight.*;
|
||||
import com.ljsd.jieling.protocols.CommonProto;
|
||||
import com.ljsd.jieling.util.FightDataUtil;
|
||||
import config.SArenaRobotConfig;
|
||||
import manager.STableManager;
|
||||
import org.luaj.vm2.LuaValue;
|
||||
|
||||
import java.util.Arrays;
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* Description: 查看巅峰赛 战斗
|
||||
* Author: zsx
|
||||
* CreateDate: 2019/9/26 11:48
|
||||
*/
|
||||
public class Cmd_review_gm extends GmAbstract {
|
||||
@Override
|
||||
public boolean exec(String[] args) throws Exception {
|
||||
|
||||
// for (int i = 0; i <150 ; i++) {
|
||||
// String key = RedisKey.getKey(RedisKey.FORCE_RANK, "", false);
|
||||
// RedisUtil.getInstence().zsetAddOne(key, String.valueOf(10000+i), 10000+i);
|
||||
// }
|
||||
if (args.length != 1) {
|
||||
return false;
|
||||
}
|
||||
String fightID = args[0];
|
||||
ArenaRecord arenaRecord = RedisUtil.getInstence().getMapEntry(RedisKey.CHAMPION_ARENA_RECORD,"", fightID, ArenaRecord.class);
|
||||
|
||||
if(arenaRecord == null){
|
||||
throw new ErrorCodeException(ErrorCode.newDefineCode("arena_rrecord null"));
|
||||
}
|
||||
byte[] fightData = arenaRecord.getFightData();
|
||||
CommonProto.FightData fightDataProto = CommonProto.FightData.parseFrom(fightData);
|
||||
LuaValue getFightData;
|
||||
int snapTeamId = GlobalsDef.CHAMPION_ATTACK_TEAM;
|
||||
RedisUtil.getInstence().del(RedisUtil.getInstence().getKey(RedisKey.CHAMPION_FIGHT, ""));
|
||||
int warTime = STableManager.getFigureConfig(CommonStaticConfig.class).getsChampionshipSetting().getWarTime();
|
||||
Map<Integer, ChampionshipLogic.MemberInfo> memberInfoMap = RedisUtil.getInstence().getMapValues(RedisKey.CHAMPION_JOIN, "", Integer.class, ChampionshipLogic.MemberInfo.class);
|
||||
int attackId = arenaRecord.getAttackId();
|
||||
int defUid = arenaRecord.getDefUid();
|
||||
ChampionshipLogic.snapOneFightInfo(attackId, memberInfoMap);
|
||||
ChampionshipLogic.snapOneFightInfo(defUid, memberInfoMap);
|
||||
|
||||
long id = FightDispatcher.getFIghtId();
|
||||
EndFightProcessor endFightProcessor = new AreFightPro();
|
||||
((AreFightPro) endFightProcessor).setArenaRecord(arenaRecord);
|
||||
FightDispatcher.getMap().put(id, endFightProcessor);
|
||||
Map<Integer, GameFightType> gameFightTypeMap = new HashMap<>();
|
||||
|
||||
gameFightTypeMap.put(0, GameFightType.TOPArenaPersonFight);
|
||||
gameFightTypeMap.put(1, GameFightType.TOPArenaRobotFight);
|
||||
gameFightTypeMap.put(2, GameFightType.TOPArena2RobotFight);
|
||||
PVPFightEvent pvpFightEvent = new PVPFightEvent(attackId, snapTeamId, warTime, "", gameFightTypeMap.get(arenaRecord.getType()), defUid, snapTeamId);
|
||||
|
||||
ChampionshipLogic.MemberInfo attackMemberInfo = memberInfoMap.get(attackId);
|
||||
ChampionshipLogic.MemberInfo defMemberInfo = memberInfoMap.get(defUid);
|
||||
int minForce = 0;
|
||||
int defForce = 0;
|
||||
|
||||
if (defMemberInfo.getType() == 0) {
|
||||
FamilyFightInfo fightInfo = defMemberInfo.getFightInfo();
|
||||
pvpFightEvent.setDefFightSnapData(new DefFightSnapData(fightInfo.getHeroAttribute(), fightInfo.getHeroSkills(), fightInfo.getPokenmonSkills(), fightInfo.getPassiveSkills()));
|
||||
defForce = fightInfo.getForce();
|
||||
} else {
|
||||
SArenaRobotConfig sArenaRobotConfig = SArenaRobotConfig.getsArenaRobotConfigById(defUid);
|
||||
if (sArenaRobotConfig != null) {
|
||||
defForce = sArenaRobotConfig.getTotalForce();
|
||||
}
|
||||
}
|
||||
if (attackMemberInfo.getType() == 0) {
|
||||
FamilyFightInfo fightInfo = attackMemberInfo.getFightInfo();
|
||||
pvpFightEvent.setAttackFightSnapData(new DefFightSnapData(fightInfo.getHeroAttribute(), fightInfo.getHeroSkills(), fightInfo.getPokenmonSkills(), fightInfo.getPassiveSkills()));
|
||||
minForce = fightInfo.getForce();
|
||||
} else {
|
||||
SArenaRobotConfig sArenaRobotConfig = SArenaRobotConfig.getsArenaRobotConfigById(attackId);
|
||||
if (sArenaRobotConfig != null) {
|
||||
minForce = sArenaRobotConfig.getTotalForce();
|
||||
}
|
||||
}
|
||||
if (minForce > defForce) {
|
||||
if (arenaRecord.getTurn() == 2) {
|
||||
pvpFightEvent.setRever(true);
|
||||
}
|
||||
} else {
|
||||
if (arenaRecord.getTurn() == 1 || arenaRecord.getTurn() == 3) {
|
||||
pvpFightEvent.setRever(true);
|
||||
}
|
||||
}
|
||||
|
||||
CommonProto.FightTeamInfo fightTeamInfo = null;
|
||||
CommonProto.FightTeamInfo deffightTeamInfo = null;
|
||||
if(pvpFightEvent.getAttackFightSnapData()!=null){
|
||||
fightTeamInfo = FightUtil.makeFightWithSnapData(pvpFightEvent.getAttackFightSnapData());
|
||||
}
|
||||
if(pvpFightEvent.getDefFightSnapData()!=null){
|
||||
deffightTeamInfo = FightUtil.makeFightWithSnapData(pvpFightEvent.getDefFightSnapData());
|
||||
} else{
|
||||
if(pvpFightEvent.getFightType() == GameFightType.ArenaPersonFight ||pvpFightEvent.getFightType() == GameFightType.CarPersonChallenge ){
|
||||
User defInMem = UserManager.getUserInMem(pvpFightEvent.getDefUid());
|
||||
deffightTeamInfo = FightUtil.makePersonFightData(defInMem, pvpFightEvent.getDefTeamId(),null,null);
|
||||
}else{
|
||||
deffightTeamInfo = FightUtil. makeRobotFightData(pvpFightEvent.getDefUid());
|
||||
}
|
||||
|
||||
}
|
||||
if(fightTeamInfo==null){
|
||||
if( pvpFightEvent.getFightType()!= GameFightType.TOPArena2RobotFight){
|
||||
if( SArenaRobotConfig.getsArenaRobotConfigById(pvpFightEvent.getAttackUid()) !=null){
|
||||
fightTeamInfo = FightUtil. makeRobotFightData(pvpFightEvent.getAttackUid());
|
||||
}else{
|
||||
User userInMem = UserManager.getUserInMem(pvpFightEvent.getAttackUid());
|
||||
fightTeamInfo = FightUtil.makePersonFightData(userInMem, pvpFightEvent.getTeamId(),pvpFightEvent.getAttackBloodMap(),null);
|
||||
}
|
||||
}else{
|
||||
fightTeamInfo = FightUtil.makeRobotFightData(pvpFightEvent.getAttackUid());
|
||||
}
|
||||
}
|
||||
|
||||
if (pvpFightEvent.isRever()) {
|
||||
deffightTeamInfo = CommonProto.FightTeamInfo.newBuilder().mergeFrom(deffightTeamInfo).setFirstCamp(1).build();
|
||||
getFightData = FightDataUtil.getFinalPlayerFightData(fightTeamInfo, deffightTeamInfo, true);//对方先手
|
||||
} else {
|
||||
getFightData = FightDataUtil.getFinalPlayerFightData(fightTeamInfo, deffightTeamInfo);
|
||||
}
|
||||
LuaValue getOptionData = FightDataUtil.getOptionData(pvpFightEvent.getAttackUid() + "");
|
||||
int[] fightResult = CheckFight.getInstance().checkFight(fightDataProto.getFightSeed(), pvpFightEvent.getMostTime(), getFightData, getOptionData, pvpFightEvent.getFightType().getFightType());
|
||||
String string = Arrays.toString(fightResult);
|
||||
LOGGER.error("__________________________"+fightResult[0]+":::"+string);
|
||||
System.out.println("string = " + string);
|
||||
|
||||
return true;
|
||||
}
|
||||
}
|
|
@ -78,4 +78,6 @@ public interface ActivityType {
|
|||
int ITEMS_STORE= 6000;//百宝商会
|
||||
int TRIAL_EXPERT = 70;//幻境达人
|
||||
int SHEJI_ACTIVITY = 60;//社稷大典
|
||||
int SUB_ACTIVITY = 8000;//易经宝库
|
||||
|
||||
}
|
||||
|
|
|
@ -59,6 +59,7 @@ public enum ActivityTypeEnum {
|
|||
ITEMS_STORE(ActivityType.ITEMS_STORE, DefaultEmptyActivity::new),
|
||||
TRIAL_EXPERT(ActivityType.TRIAL_EXPERT,TrialExpectRankActivity::new),
|
||||
SHEJI_ACTIVITY(ActivityType.SHEJI_ACTIVITY,SheJiActivity::new),
|
||||
SUB_ACTIVITY(ActivityType.SUB_ACTIVITY, SubActivity::new),
|
||||
|
||||
;
|
||||
private int type;
|
||||
|
|
|
@ -0,0 +1,204 @@
|
|||
package com.ljsd.jieling.logic.activity;
|
||||
|
||||
import com.ljsd.jieling.exception.ErrorCode;
|
||||
import com.ljsd.jieling.exception.ErrorCodeException;
|
||||
import com.ljsd.jieling.globals.BIReason;
|
||||
import com.ljsd.jieling.jbean.*;
|
||||
import com.ljsd.jieling.logic.activity.event.IEvent;
|
||||
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.protocols.CommonProto;
|
||||
import com.ljsd.jieling.protocols.PlayerInfoProto;
|
||||
import com.ljsd.jieling.util.ItemUtil;
|
||||
import com.ljsd.jieling.util.MessageUtil;
|
||||
import config.*;
|
||||
import manager.STableManager;
|
||||
import util.MathUtils;
|
||||
|
||||
import java.util.*;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
/**
|
||||
* Description: 易经宝库
|
||||
* Author: zsx
|
||||
* CreateDate: 2020/11/6 22:26
|
||||
*/
|
||||
public class SubActivity extends AbstractActivity {
|
||||
|
||||
public static final int LAY_INDEX = 100;
|
||||
public static final int POOL_INDEX = 1000;
|
||||
public SubActivity(int id) {
|
||||
super(id);
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void initActivity(User user)throws Exception{
|
||||
//重置奖励
|
||||
randomReward(user,true);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onResume(User user) throws Exception {
|
||||
// super.onResume(user);
|
||||
//重置奖励
|
||||
randomReward(user,false);
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public boolean takeReward(ISession session, int missionId) throws Exception {
|
||||
User user = UserManager.getUser(session.getUid());
|
||||
|
||||
// //checkAndUpdate state
|
||||
ActivityManager activityManager = user.getActivityManager();
|
||||
ActivityMission activityMission = activityManager.getActivityMissionMap().get(id);
|
||||
if (activityMission == null){
|
||||
throw new ErrorCodeException(ErrorCode.SERVER_SELF_DEFINE);
|
||||
}
|
||||
if (activityMission.getActivityState() != ActivityType.OPEN_STATE || activityMission.getOpenType() == 0) {
|
||||
throw new ErrorCodeException(ErrorCode.ACTIVITY_NOT_OPEN);
|
||||
}
|
||||
ActivityProgressInfo activityProgressInfo = activityMission.getActivityMissionMap().get(missionId);
|
||||
if (activityProgressInfo == null || activityProgressInfo.getState() == ActivityType.HAD_TAKED) {
|
||||
throw new ErrorCodeException(ErrorCode.newDefineCode("活动奖励已经领取"));
|
||||
}
|
||||
//check had select
|
||||
if(activityMission.getV()==0){
|
||||
throw new ErrorCodeException(ErrorCode.SERVER_DEFINE);
|
||||
}
|
||||
|
||||
|
||||
SBlessingConfigNew sBlessingConfigNew =SBlessingConfigNew.getsBlessingConfigNewHashMap().get(id);
|
||||
//check cost
|
||||
int integerValue = SSpecialConfig.getIntegerValue(SSpecialConfig.EXPEDITION_REBORN);
|
||||
if(integerValue==0){
|
||||
throw new ErrorCodeException(ErrorCode.CFG_NULL);
|
||||
}
|
||||
int[][] cost = new int[1][2];
|
||||
cost[0]=sBlessingConfigNew.getCost();
|
||||
boolean b = ItemUtil.itemCost(user, cost, BIReason.SUB_ACTIVITY_CONSUME, 1);
|
||||
if(!b){
|
||||
throw new ErrorCodeException(ErrorCode.ITEM_NOT_ENOUGH);
|
||||
}
|
||||
int size = user.getActivityManager().getSubRewardPoolInfo().getSubRewardPool().size();
|
||||
if(size==0){
|
||||
throw new ErrorCodeException(ErrorCode.SERVER_DEFINE);
|
||||
}
|
||||
|
||||
//get reward
|
||||
long count = activityMission.getActivityMissionMap().values().stream().filter(activityProgressInfo1 -> activityProgressInfo1.getState() == ActivityType.HAD_TAKED).count();
|
||||
Integer rewardId = user.getActivityManager().getSubRewardPoolInfo().getSubRewardPool().get((int) count);
|
||||
SBlessingRewardPoolNew sBlessingRewardPoolNew = STableManager.getConfig(SBlessingRewardPoolNew.class).get(rewardId);
|
||||
|
||||
|
||||
int[] reward = sBlessingRewardPoolNew.getReward();
|
||||
int[][] rewards = new int[1][];
|
||||
rewards[0]=reward;
|
||||
CommonProto.Drop.Builder drop = ItemUtil.drop(user, rewards, BIReason.TAKE_ACTIVITY_REWARD);
|
||||
//up miss
|
||||
activityProgressInfo.setProgrss(rewardId);
|
||||
activityProgressInfo.setState( ActivityType.HAD_TAKED);
|
||||
int curLay = user.getActivityManager().getSubRewardPoolInfo().getLay();
|
||||
if(curLay!=sBlessingConfigNew.getFloorCount()&&count==(size-1)){
|
||||
ActivityLogic.getInstance().resumeActivity(user, ActivityType.SUB_ACTIVITY);
|
||||
sendActivityProgress(session, activityManager.getActivityMissionMap().get(id), null);
|
||||
}else {
|
||||
sendActivityProgress(session, activityMission, Collections.singleton(missionId));
|
||||
}
|
||||
reportTakeActivityReward(user,rewards,missionId);
|
||||
PlayerInfoProto.TakeActivityRewardResponse build = PlayerInfoProto.TakeActivityRewardResponse.newBuilder().setDrop(drop).build();
|
||||
MessageUtil.sendMessage(session, 1, rewardResponseValue, build, true);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void onEvent(IEvent event) throws Exception {
|
||||
super.onEvent(event);
|
||||
}
|
||||
|
||||
/**
|
||||
* 重置奖励
|
||||
*/
|
||||
private void randomReward(User user,boolean start) throws Exception{
|
||||
|
||||
//init lay
|
||||
SubRewardPoolInfo subRewardPoolInfo = user.getActivityManager().getSubRewardPoolInfo();
|
||||
if(subRewardPoolInfo==null){
|
||||
subRewardPoolInfo = new SubRewardPoolInfo();
|
||||
user.getActivityManager().setSubRewardPoolInfo(subRewardPoolInfo);
|
||||
}
|
||||
int lay = user.getActivityManager().getSubRewardPoolInfo().getLay();
|
||||
int curLay=lay+1;
|
||||
user.getActivityManager().getSubRewardPoolInfo().setLay(curLay);
|
||||
HashMap<Integer, HashSet<SBlessingRewardPoolNew>> integerHashSetHashMap = SBlessingRewardPoolNew.getsBlessingRewardPoolNewHashMap();
|
||||
//init Activity
|
||||
ActivityMission activityMission = user.getActivityManager().getActivityMissionMap().get(id);
|
||||
ActivityProgressInfo activityProgressInfo = new ActivityProgressInfo();
|
||||
activityProgressInfo.setProgrss(curLay);
|
||||
activityProgressInfo.setState(0);
|
||||
activityMission.getActivityMissionMap().put(LAY_INDEX, activityProgressInfo);
|
||||
activityMission.setOpenType(1);
|
||||
activityMission.setActivityState(ActivityType.OPEN_STATE);
|
||||
activityMission.setV(0);
|
||||
|
||||
|
||||
//init reward
|
||||
|
||||
SBlessingConfigNew sBlessingConfigNew = SBlessingConfigNew.getsBlessingConfigNewHashMap().get(id);
|
||||
if(null== sBlessingConfigNew){
|
||||
throw new ErrorCodeException(ErrorCode.CFG_NULL);
|
||||
}
|
||||
int[] basicPoolId = sBlessingConfigNew.getBasicPoolId();
|
||||
if(basicPoolId.length<curLay){
|
||||
throw new ErrorCodeException(ErrorCode.CFG_NULL);
|
||||
}
|
||||
int poolID = basicPoolId[curLay-1];
|
||||
HashSet<SBlessingRewardPoolNew> sBlessingRewardPoolNews = integerHashSetHashMap.get(poolID);
|
||||
if(null == sBlessingRewardPoolNews){
|
||||
throw new ErrorCodeException(ErrorCode.CFG_NULL);
|
||||
}
|
||||
List<int[]> ints = new LinkedList<>();
|
||||
for (SBlessingRewardPoolNew sBlessingRewardPoolNew:sBlessingRewardPoolNews) {
|
||||
for (int i = 0; i <sBlessingRewardPoolNew.getInitializeNum() ; i++) {
|
||||
int[] reward= new int[2];
|
||||
reward[0]=sBlessingRewardPoolNew.getId();
|
||||
reward[1]=sBlessingRewardPoolNew.getInitializeNum();
|
||||
ints.add(reward);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
int[][] ints1 = ints.toArray(new int[0][0]);
|
||||
int[] fixResult = MathUtils.randomFromWeightWithTaking(ints1, ints1.length);
|
||||
|
||||
List<Integer> list2 = Arrays.stream(fixResult).boxed().collect(Collectors.toList());
|
||||
user.getActivityManager().getSubRewardPoolInfo().getSubRewardPool().clear();
|
||||
user.getActivityManager().getSubRewardPoolInfo().getSubRewardPool().addAll(list2);
|
||||
|
||||
for (int i = 0; i <=list2.size() ; i++) {
|
||||
ActivityProgressInfo activityProgressInfo1 = new ActivityProgressInfo();
|
||||
activityProgressInfo1.setProgrss(0);
|
||||
activityProgressInfo1.setState(0);
|
||||
activityMission.getActivityMissionMap().put(i+1, activityProgressInfo1);
|
||||
}
|
||||
|
||||
//init finalRewards
|
||||
if(start){
|
||||
int finalPoolId = sBlessingConfigNew.getFinalPoolId();
|
||||
HashSet<SBlessingRewardPoolNew> sBlessingRewardPoolNews1 = integerHashSetHashMap.get(finalPoolId);
|
||||
for (SBlessingRewardPoolNew sBlessingRewardPoolNew:sBlessingRewardPoolNews1) {
|
||||
ActivityProgressInfo activityProgressInfo1 = new ActivityProgressInfo();
|
||||
activityProgressInfo1.setProgrss(0);
|
||||
activityProgressInfo1.setState(0);
|
||||
activityMission.getActivityMissionMap().put(POOL_INDEX+sBlessingRewardPoolNew.getId(), activityProgressInfo1);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
}
|
|
@ -673,6 +673,7 @@ public class ExpeditionLogic {
|
|||
builder1.setLevel(familyHeroInfo.getLevel());
|
||||
builder1.setStar(familyHeroInfo.getStar());
|
||||
builder1.setRemainHp(heroHP.get(s));
|
||||
builder1.setPosition(familyHeroInfo.getPosition());
|
||||
builders.add(builder1.build());
|
||||
});
|
||||
builder.addAllHero(builders);
|
||||
|
|
|
@ -803,7 +803,7 @@ public class BuyGoodsLogic {
|
|||
if(sRechargeCommodityConfig.getDailyUpdate()>=1){
|
||||
if(!refreshBagMap.containsKey(sRechargeCommodityConfig.getId())){
|
||||
Gson gson = new Gson();
|
||||
LOGGER.error(sRechargeCommodityConfig.getId()+"Exception= " + gson.toJson(refreshBagMap.keySet()));
|
||||
// LOGGER.error(sRechargeCommodityConfig.getId()+"Exception= " + gson.toJson(refreshBagMap.keySet()));
|
||||
return new RechargeResult();
|
||||
}
|
||||
endTime = refreshBagMap.get(sRechargeCommodityConfig.getId());
|
||||
|
@ -966,6 +966,15 @@ public class BuyGoodsLogic {
|
|||
}
|
||||
}
|
||||
|
||||
if (sRechargeCommodityConfig.getTime() == 6) {
|
||||
if (rechargeInfo.getDyGoodsCanBuyTimes().containsKey(sRechargeCommodityConfig.getId())&&rechargeInfo.getRefreshBagMap().containsKey(sRechargeCommodityConfig.getId())) {
|
||||
long endTime = rechargeInfo.getRefreshBagMap().get(sRechargeCommodityConfig.getId());
|
||||
if (now > endTime || rechargeInfo.getDyGoodsCanBuyTimes().get(sRechargeCommodityConfig.getId()) <= 0) {
|
||||
continue;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
long startTime=0;
|
||||
|
|
|
@ -0,0 +1,64 @@
|
|||
package config;
|
||||
|
||||
import manager.STableManager;
|
||||
import manager.Table;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
@Table(name = "BlessingConfigNew")
|
||||
public class SBlessingConfigNew implements BaseConfig {
|
||||
|
||||
private int id;
|
||||
|
||||
private int activityId;
|
||||
|
||||
private int[] cost;
|
||||
|
||||
private int floorCount;
|
||||
|
||||
private int[] basicPoolId;
|
||||
|
||||
private int finalPoolId;
|
||||
|
||||
private static HashMap<Integer, SBlessingConfigNew> sBlessingConfigNewHashMap = new HashMap<>();
|
||||
|
||||
@Override
|
||||
public void init() throws Exception {
|
||||
Map<Integer, SBlessingConfigNew> config = STableManager.getConfig(SBlessingConfigNew.class);
|
||||
config.forEach((integer, sBlessingConfigNew) -> sBlessingConfigNewHashMap.put(sBlessingConfigNew.getActivityId(),sBlessingConfigNew));
|
||||
|
||||
}
|
||||
|
||||
|
||||
public static HashMap<Integer, SBlessingConfigNew> getsBlessingConfigNewHashMap() {
|
||||
return sBlessingConfigNewHashMap;
|
||||
}
|
||||
|
||||
|
||||
public int getId() {
|
||||
return id;
|
||||
}
|
||||
|
||||
public int getActivityId() {
|
||||
return activityId;
|
||||
}
|
||||
|
||||
public int[] getCost() {
|
||||
return cost;
|
||||
}
|
||||
|
||||
public int getFloorCount() {
|
||||
return floorCount;
|
||||
}
|
||||
|
||||
public int[] getBasicPoolId() {
|
||||
return basicPoolId;
|
||||
}
|
||||
|
||||
public int getFinalPoolId() {
|
||||
return finalPoolId;
|
||||
}
|
||||
|
||||
|
||||
}
|
|
@ -0,0 +1,79 @@
|
|||
package config;
|
||||
|
||||
import manager.STableManager;
|
||||
import manager.Table;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.HashSet;
|
||||
import java.util.Map;
|
||||
|
||||
@Table(name = "BlessingRewardPoolNew")
|
||||
public class SBlessingRewardPoolNew implements BaseConfig {
|
||||
|
||||
private int id;
|
||||
|
||||
private int poolId;
|
||||
|
||||
private int[] reward;
|
||||
|
||||
private int initializeNum;
|
||||
|
||||
private int extractWeight;
|
||||
|
||||
private int floorLimit;
|
||||
|
||||
private int levelLimit;
|
||||
|
||||
private static HashMap<Integer, HashSet<SBlessingRewardPoolNew>> sBlessingRewardPoolNewHashMap = new HashMap<>();
|
||||
|
||||
@Override
|
||||
public void init() throws Exception {
|
||||
|
||||
Map<Integer, SBlessingRewardPoolNew> configs = STableManager.getConfig(SBlessingRewardPoolNew.class);
|
||||
for (SBlessingRewardPoolNew sBlessingRewardPoolNew : configs.values()) {
|
||||
HashSet<SBlessingRewardPoolNew> orDefault = sBlessingRewardPoolNewHashMap.getOrDefault(sBlessingRewardPoolNew.getPoolId(), new HashSet<>());
|
||||
orDefault.add(sBlessingRewardPoolNew);
|
||||
sBlessingRewardPoolNewHashMap.put(sBlessingRewardPoolNew.getPoolId(),orDefault);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
public static HashMap<Integer, HashSet<SBlessingRewardPoolNew>> getsBlessingRewardPoolNewHashMap() {
|
||||
return sBlessingRewardPoolNewHashMap;
|
||||
}
|
||||
|
||||
public static void setsBlessingRewardPoolNewHashMap(HashMap<Integer, HashSet<SBlessingRewardPoolNew>> sBlessingRewardPoolNewHashMap) {
|
||||
SBlessingRewardPoolNew.sBlessingRewardPoolNewHashMap = sBlessingRewardPoolNewHashMap;
|
||||
}
|
||||
|
||||
public int getId() {
|
||||
return id;
|
||||
}
|
||||
|
||||
public int getPoolId() {
|
||||
return poolId;
|
||||
}
|
||||
|
||||
public int[] getReward() {
|
||||
return reward;
|
||||
}
|
||||
|
||||
public int getInitializeNum() {
|
||||
return initializeNum;
|
||||
}
|
||||
|
||||
public int getExtractWeight() {
|
||||
return extractWeight;
|
||||
}
|
||||
|
||||
public int getFloorLimit() {
|
||||
return floorLimit;
|
||||
}
|
||||
|
||||
public int getLevelLimit() {
|
||||
return levelLimit;
|
||||
}
|
||||
|
||||
|
||||
}
|
Loading…
Reference in New Issue