bloody
parent
e1cbbac567
commit
0db40f7fde
|
@ -4,6 +4,7 @@ import com.google.gson.Gson;
|
|||
import com.ljsd.battle.handler.BaseHandler;
|
||||
import com.ljsd.battle.handler.BloodyHandleLogicThread;
|
||||
import com.ljsd.battle.room.SceneManager;
|
||||
import com.ljsd.battle.statics.MessageBoxUtils;
|
||||
import com.ljsd.jieling.config.json.CoreSettings;
|
||||
import com.ljsd.jieling.db.redis.RedisKey;
|
||||
import com.ljsd.jieling.db.redis.RedisUtil;
|
||||
|
@ -68,6 +69,7 @@ public class BattleServerApplication {
|
|||
final NettyServerAutoConfiguration netServerConfig = configurableApplicationContext.getBean(NettyServerAutoConfiguration.class);
|
||||
NettyProperties properties = netServerConfig.getNettyProperties();
|
||||
register(properties);
|
||||
MessageBoxUtils.init();
|
||||
|
||||
Runtime.getRuntime().addShutdownHook(new Thread() {
|
||||
@Override
|
||||
|
|
|
@ -162,14 +162,14 @@ public abstract class Creature extends SceneActor{
|
|||
int curPos = getPos();
|
||||
|
||||
LOGGER.info("the id={},preMoveTimestamp={},the time ={},move={},the oldXy={},the curXy={}",getId(),new Date(preMoveTimestamp),new Date(timestamp),moveDistance,CellUtil.pos2XY(oldXY),CellUtil.pos2XY(curPos));
|
||||
|
||||
setStateType(StateType.MOVEABLE);
|
||||
preMoveTimestamp = timestamp;
|
||||
return curPos;
|
||||
}
|
||||
|
||||
public boolean canMoveNext(int nextPath,boolean update){
|
||||
for(SceneActor sceneActor : getScene().getSceneActorMap().values()){
|
||||
if(sceneActor == this ) {
|
||||
if(sceneActor == this || getScene().checkIsDied(sceneActor)) {
|
||||
continue;
|
||||
}
|
||||
if(sceneActor.getType() == ActorType.Player && sceneActor.getStateType() == StateType.INVINCIBLE){
|
||||
|
@ -215,7 +215,7 @@ public abstract class Creature extends SceneActor{
|
|||
Set<Integer> xySet = CellUtil.getSurroundPos(maxX,maxY,curPos);
|
||||
Map<Integer, SceneActor> sceneActorMap = scene.getSceneActorMap();
|
||||
for(SceneActor sceneActor : sceneActorMap.values()){
|
||||
if(sceneActor == this) {
|
||||
if(sceneActor == this || getScene().checkIsDied(sceneActor)) {
|
||||
continue;
|
||||
}
|
||||
if(triggerEvent(sceneActor,timestamp,xySet)){
|
||||
|
@ -229,7 +229,6 @@ public abstract class Creature extends SceneActor{
|
|||
int curPos = getPos();
|
||||
boolean result= false;
|
||||
ActorType type = sceneActor.getType();
|
||||
//int triggerEvent = 0;
|
||||
int triggerBuffer = 0;
|
||||
if(type == ActorType.Npc){
|
||||
if(curPos == sceneActor.getPos()){
|
||||
|
@ -237,7 +236,7 @@ public abstract class Creature extends SceneActor{
|
|||
}
|
||||
}
|
||||
if(type == ActorType.Mineral && this.getType() == ActorType.Player){
|
||||
if(curPos == sceneActor.getPos()){
|
||||
if(curPos == sceneActor.getPos() && getStateType()!=StateType.DIGGER && getStateType()!=StateType.FROZEN){
|
||||
triggerBuffer=BufferType.DIGGER.getType();
|
||||
setStateType(StateType.DIGGER);
|
||||
}
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
package com.ljsd.battle.actor;
|
||||
|
||||
import com.google.gson.Gson;
|
||||
import com.ljsd.battle.room.BeanToProto;
|
||||
import com.ljsd.battle.room.Command;
|
||||
import com.ljsd.battle.room.SceneManager;
|
||||
|
@ -81,6 +82,10 @@ public class Scene implements Runnable{
|
|||
}
|
||||
|
||||
|
||||
public boolean checkIsDied(SceneActor sceneActor){
|
||||
return builder.getRemoveActorIdList().contains(sceneActor.getId());
|
||||
}
|
||||
|
||||
public void addScenActor(SceneActor sceneActor){
|
||||
sceneActorMap.put(sceneActor.getId(),sceneActor);
|
||||
if(startTime>0){
|
||||
|
@ -208,6 +213,7 @@ public class Scene implements Runnable{
|
|||
case SCENEACTORE_REMOVE:
|
||||
int deadId = (int) parm;
|
||||
builder.addRemoveActorId(deadId);
|
||||
System.out.println("remove the scene id is " + deadId);
|
||||
break;
|
||||
case POSMINERAL_REMOVE:
|
||||
builder.addRemovePosMineralId( (int) parm);
|
||||
|
@ -308,7 +314,7 @@ public class Scene implements Runnable{
|
|||
Creature creature = (Creature)sceneActorMap.get(playId);
|
||||
int mineral = creature.getMineral();
|
||||
int killNums = analysisData.getKillNums();
|
||||
sortDataBeans.add(new SortDataBean(playId,mineral,killNums));
|
||||
sortDataBeans.add(new SortDataBean(playId,mineral,killNums,analysisData.getServerId()));
|
||||
}
|
||||
Collections.sort(sortDataBeans);
|
||||
|
||||
|
@ -339,6 +345,7 @@ public class Scene implements Runnable{
|
|||
rank++;
|
||||
SceneManager.clearUidScene(id);
|
||||
RedisUtil.getInstence().del(RedisKey.MATCH_UID_KEY + ":" + id);
|
||||
RedisUtil.getInstence().putMapEntry(RedisKey.BLOODY_PERSON_BATTLE_INFO, Integer.toString(sortDataBean.getServerId()),Integer.toString(id),sortDataBean);
|
||||
}
|
||||
|
||||
for(SortDataBean sortDataBean : sortDataBeans){
|
||||
|
@ -352,7 +359,6 @@ public class Scene implements Runnable{
|
|||
|
||||
|
||||
|
||||
|
||||
public void execASync(BattleRequest battleRequest){
|
||||
executorService.submit(new Callable<Integer>() {
|
||||
@Override
|
||||
|
|
|
@ -8,6 +8,9 @@ import com.ljsd.battle.statics.AnalysisEventType;
|
|||
import com.ljsd.battle.statics.AnalysisSourceData;
|
||||
import com.ljsd.battle.statics.MessageBoxUtils;
|
||||
import com.ljsd.jieling.config.SBloodyBattleSetting;
|
||||
import com.ljsd.jieling.logic.hero.HeroLogic;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
import java.util.*;
|
||||
import java.util.concurrent.ConcurrentHashMap;
|
||||
|
@ -17,6 +20,7 @@ import java.util.concurrent.ConcurrentHashMap;
|
|||
* 场景里的各种演员
|
||||
*/
|
||||
public abstract class SceneActor{
|
||||
private static final Logger LOGGER = LoggerFactory.getLogger(SceneActor.class);
|
||||
private int id;
|
||||
private int pos;
|
||||
private Map<Integer,EffectBuffer> bufferMap = new ConcurrentHashMap<>(2);
|
||||
|
@ -35,13 +39,12 @@ public abstract class SceneActor{
|
|||
|
||||
public void addOrUpdateBuffer(EffectBuffer effectBuffer){
|
||||
|
||||
System.out.println(effectBuffer);
|
||||
LOGGER.info("add buffer={}",effectBuffer);
|
||||
if(effectBuffer.getType() == BufferType.BATTLE.getType()){
|
||||
stateType = StateType.FROZEN;
|
||||
scene.processEventUpdate(EventType.SCENEACTORE_UPDATE,this.getId());
|
||||
//停止挖矿
|
||||
checkUpdateBuffer(effectBuffer.getStartTime(),true);
|
||||
System.out.println("the actor" + id + "is frozen");
|
||||
}
|
||||
if(effectBuffer.getType() == BufferType.DIGGER.getType()){
|
||||
effectBuffer.updateEffectValue(0,0);
|
||||
|
@ -73,6 +76,11 @@ public abstract class SceneActor{
|
|||
int willDgger = (int)((now - value.getStartTime()) / intervalMs)-value.getValues().get(0);
|
||||
Creature creature = (Creature) this;
|
||||
Creature mineral =(Creature) scene.getSceneActorMap().get(value.getCaster());
|
||||
if(mineral == null){
|
||||
iterator.remove();
|
||||
LOGGER.error("the mineral ={} is null",value.getCaster());
|
||||
continue;
|
||||
}
|
||||
if(willDgger>0&&mineral.getLife().getCurHp()>0) {
|
||||
int reallyDigger = mineral.getLife().reduceHp(willDgger);
|
||||
creature.addMineral(reallyDigger);
|
||||
|
@ -115,7 +123,7 @@ public abstract class SceneActor{
|
|||
if(mineral.getLife().getCurHp()<=0){
|
||||
scene.processEventUpdate(EventType.SCENEACTORE_REMOVE,value.getCaster());
|
||||
}
|
||||
System.out.println("remove the digger buffer" + value.getId());
|
||||
LOGGER.info("the target={},remove the digger buffer={}," ,this.getId(), value.getId());
|
||||
int[][] debuff = SBloodyBattleSetting.sBloodyBattleSetting.getDebuff();
|
||||
for(int[] debuffItem : debuff){
|
||||
int duration = debuffItem[3];
|
||||
|
@ -134,7 +142,7 @@ public abstract class SceneActor{
|
|||
isUpdate = true;
|
||||
whenBufferRemove(value,now);
|
||||
scene.processEventUpdate(EventType.BUFFER_REMOVE,value.getId());
|
||||
System.out.println("---------------------update--------------------------" + value.getType() +" "+new Date(now) + "end time" + new Date(value.getEndTime()));
|
||||
LOGGER.info("the target={},remove the buffer={}," ,this.getId(), value.getId());
|
||||
}
|
||||
}
|
||||
if(isUpdate){
|
||||
|
|
|
@ -8,12 +8,14 @@ public class SortDataBean implements Comparable<SortDataBean>{
|
|||
private int uid;
|
||||
private int mineral;
|
||||
private int killNums;
|
||||
private int serverId; //服务器id
|
||||
|
||||
|
||||
public SortDataBean(int uid, int mineral, int killNums) {
|
||||
public SortDataBean(int uid, int mineral, int killNums,int serverId) {
|
||||
this.uid = uid;
|
||||
this.mineral = mineral;
|
||||
this.killNums = killNums;
|
||||
this.serverId = serverId;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -46,14 +48,7 @@ public class SortDataBean implements Comparable<SortDataBean>{
|
|||
return killNums;
|
||||
}
|
||||
|
||||
public static void main(String[] args) {
|
||||
List<SortDataBean> sortDataBeans = new ArrayList<>();
|
||||
sortDataBeans.add(new SortDataBean(1,2,2));
|
||||
sortDataBeans.add(new SortDataBean(2,2,3));
|
||||
sortDataBeans.add(new SortDataBean(3,3,2));
|
||||
sortDataBeans.add(new SortDataBean(4,4,2));
|
||||
sortDataBeans.add(new SortDataBean(5,4,2));
|
||||
Collections.sort(sortDataBeans);
|
||||
System.out.println(sortDataBeans);
|
||||
public int getServerId() {
|
||||
return serverId;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -97,13 +97,13 @@ public class SceneManager {
|
|||
playerA.setPos(userInitBirths.remove(0));
|
||||
playerA.setSpeed(sBloodyBattleSetting.getPlayerSpeed());
|
||||
scene.addScenActor(playerA);
|
||||
scene.getAnalysisDataMap().put(uid,new AnalysisData(uid));
|
||||
scene.getAnalysisDataMap().put(uid,new AnalysisData(uid,userBloodySnpInfo.getServerId()));
|
||||
sceneByUidMap.put(uid,scene);
|
||||
}
|
||||
//创建矿点
|
||||
createMinear(scene,-1,1);
|
||||
//创建怪物
|
||||
createMonster(scene,-1);
|
||||
// createMonster(scene,-1);
|
||||
|
||||
sceneMap.put(room.getId(),scene);
|
||||
System.out.println("create romm --- -"+room.getId());
|
||||
|
@ -152,13 +152,14 @@ public class SceneManager {
|
|||
System.out.println("find and break... " + monsterIndex);
|
||||
break;
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
public static void createMinear(Scene scene,int target,int nums){
|
||||
//创建矿
|
||||
System.out.println("target--" + target + "-- nums --" + nums);
|
||||
SBloodyBattleSetting sBloodyBattleSetting = SBloodyBattleSetting.sBloodyBattleSetting;
|
||||
Map<Integer, Integer> initializeMineMap = sBloodyBattleSetting.getInitializeMineMap();
|
||||
Map<Integer, SCMap> scMap = SCMap.sCMap.get(bloodyMap.getMapId());
|
||||
|
@ -166,10 +167,11 @@ public class SceneManager {
|
|||
for(SceneActor sceneActor : scene.getSceneActorMap().values()){
|
||||
excluIndexs.add(sceneActor.getPos());
|
||||
}
|
||||
System.out.println(excluIndexs);
|
||||
for (Map.Entry<Integer, SCMap> entry : scMap.entrySet()) {
|
||||
SCMap scMap1 = entry.getValue();
|
||||
int event = scMap1.getEvent();
|
||||
if(event == 1 || event == 2 ){
|
||||
if(event == 1 || event == 2 || event == 3){
|
||||
if(target!=-1 && target!=event){
|
||||
continue;
|
||||
}
|
||||
|
@ -202,7 +204,6 @@ public class SceneManager {
|
|||
sceneMineral.setStateType(StateType.READYED_STATE);
|
||||
sceneMineral.setSize(event);
|
||||
scene.addScenActor(sceneMineral);
|
||||
break;
|
||||
}
|
||||
if(target!=-1){
|
||||
break;
|
||||
|
|
|
@ -8,9 +8,11 @@ public class AnalysisData {
|
|||
private int continuousKillNums;//连续杀敌次数
|
||||
private int continuousKillNumsCache;//连续杀敌次数 CACHE
|
||||
private int continuousDeadNums;//连续死亡次数
|
||||
private int serverId;
|
||||
|
||||
public AnalysisData(int id) {
|
||||
public AnalysisData(int id,int serverId) {
|
||||
this.id = id;
|
||||
this.serverId = serverId;
|
||||
}
|
||||
|
||||
public void win(){
|
||||
|
@ -66,4 +68,8 @@ public class AnalysisData {
|
|||
public void cleanContinuousKillNumsCache(){
|
||||
continuousKillNumsCache=0;
|
||||
}
|
||||
|
||||
public int getServerId() {
|
||||
return serverId;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
package com.ljsd.battle.util;
|
||||
import com.googlecode.protobuf.format.JsonFormat;
|
||||
import com.ljsd.battle.actor.ActorType;
|
||||
import com.ljsd.battle.actor.Scene;
|
||||
import com.ljsd.battle.actor.SceneActor;
|
||||
|
@ -24,6 +25,7 @@ public class MessageUtil {
|
|||
backMessage = new byte[0];
|
||||
} else {
|
||||
backMessage = generatedMessage.toByteArray();
|
||||
LOGGER.info(JsonFormat.printToString(generatedMessage));
|
||||
}
|
||||
|
||||
int length = PackageConstant.UID_FIELD_LEN + PackageConstant.TOKEN_LEN
|
||||
|
|
|
@ -26,6 +26,8 @@ public class UserBloodySnpInfo {
|
|||
|
||||
private int maxHp;
|
||||
|
||||
private int serverId;
|
||||
|
||||
|
||||
public UserBloodySnpInfo(int uid, String name) {
|
||||
this.uid = uid;
|
||||
|
@ -106,4 +108,8 @@ public class UserBloodySnpInfo {
|
|||
public void setLevel(int level) {
|
||||
this.level = level;
|
||||
}
|
||||
|
||||
public int getServerId() {
|
||||
return serverId;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -0,0 +1,36 @@
|
|||
package com.ljsd.jieling.bloody;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
|
||||
public class SortDataBean{
|
||||
private int uid;
|
||||
private int mineral;
|
||||
private int killNums;
|
||||
private int serverId; //服务器id
|
||||
|
||||
|
||||
public SortDataBean(int uid, int mineral, int killNums) {
|
||||
this.uid = uid;
|
||||
this.mineral = mineral;
|
||||
this.killNums = killNums;
|
||||
}
|
||||
|
||||
public int getUid() {
|
||||
return uid;
|
||||
}
|
||||
|
||||
public int getMineral() {
|
||||
return mineral;
|
||||
}
|
||||
|
||||
public int getKillNums() {
|
||||
return killNums;
|
||||
}
|
||||
|
||||
|
||||
public int getServerId() {
|
||||
return serverId;
|
||||
}
|
||||
}
|
|
@ -4,12 +4,15 @@ package com.ljsd.jieling.bloody;
|
|||
|
||||
|
||||
|
||||
import com.ljsd.GameApplication;
|
||||
import com.ljsd.jieling.logic.dao.FamilyHeroInfo;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
public class UserBloodySnpInfo {
|
||||
private int serverId;
|
||||
|
||||
private int uid;
|
||||
|
||||
private String name;
|
||||
|
@ -34,6 +37,7 @@ public class UserBloodySnpInfo {
|
|||
public UserBloodySnpInfo(int uid, String name) {
|
||||
this.uid = uid;
|
||||
this.name = name;
|
||||
this.serverId = GameApplication.serverId;
|
||||
}
|
||||
|
||||
public void updateHeroSkill(String heroId, String skills){
|
||||
|
|
|
@ -78,9 +78,15 @@ public class SBloodyBattleSetting implements BaseConfig {
|
|||
private int baseScore;
|
||||
private int extraDiscount;
|
||||
|
||||
private int[][] openPeriod;
|
||||
|
||||
private int[][] scoreConversion;
|
||||
|
||||
private Map<Integer,int[]> debuffMap;
|
||||
private Map<Integer,int[]> monsterIndexMap;
|
||||
|
||||
|
||||
|
||||
|
||||
@Override
|
||||
public void init() throws Exception {
|
||||
|
@ -280,4 +286,12 @@ public class SBloodyBattleSetting implements BaseConfig {
|
|||
public void setMonsterIndexMap(Map<Integer, int[]> monsterIndexMap) {
|
||||
this.monsterIndexMap = monsterIndexMap;
|
||||
}
|
||||
|
||||
public int[][] getOpenPeriod() {
|
||||
return openPeriod;
|
||||
}
|
||||
|
||||
public int[][] getScoreConversion() {
|
||||
return scoreConversion;
|
||||
}
|
||||
}
|
|
@ -0,0 +1,45 @@
|
|||
package com.ljsd.jieling.config;
|
||||
|
||||
import com.ljsd.jieling.logic.STableManager;
|
||||
import com.ljsd.jieling.logic.Table;
|
||||
|
||||
import java.util.Map;
|
||||
|
||||
@Table(name ="BloodyBattleTask")
|
||||
public class SBloodyBattleTask implements BaseConfig {
|
||||
|
||||
private int id;
|
||||
|
||||
private int taskType;
|
||||
|
||||
private int[][] taskValue;
|
||||
|
||||
private int rewardGroup;
|
||||
|
||||
public static Map<Integer, SBloodyBattleTask> sBloodyBattleTaskMap;
|
||||
|
||||
|
||||
@Override
|
||||
public void init() throws Exception {
|
||||
sBloodyBattleTaskMap = STableManager.getConfig(SBloodyBattleTask.class);
|
||||
}
|
||||
|
||||
|
||||
public int getId() {
|
||||
return id;
|
||||
}
|
||||
|
||||
public int getTaskType() {
|
||||
return taskType;
|
||||
}
|
||||
|
||||
public int[][] getTaskValue() {
|
||||
return taskValue;
|
||||
}
|
||||
|
||||
public int getRewardGroup() {
|
||||
return rewardGroup;
|
||||
}
|
||||
|
||||
|
||||
}
|
|
@ -165,6 +165,7 @@ public class RedisKey {
|
|||
public static final String MATCH_UID_KEY = "MATCH_UID_KEY";
|
||||
public static final String BLOODY_TEAM = "BLOODY_TEAM";
|
||||
public static final String BLOODY_SERVER_INFO = "BLOODY_SERVER_INFO";
|
||||
public static final String BLOODY_PERSON_BATTLE_INFO = "BLOODY_PERSON_BATTLE_INFO";
|
||||
|
||||
public static String getKey(String type, String key, boolean withoutServerId) {
|
||||
if (withoutServerId) {
|
||||
|
|
|
@ -973,7 +973,7 @@ public class RedisUtil {
|
|||
|
||||
public String getKey(String type,String key){
|
||||
|
||||
if(RedisKey.BLOODY_RANK.equals(type) || RedisKey.BLOODY_TEAM.equals(type) || RedisKey.PLAYER_INFO_CACHE.equals(type)) {
|
||||
if(RedisKey.BLOODY_RANK.equals(type) || RedisKey.BLOODY_TEAM.equals(type) || RedisKey.PLAYER_INFO_CACHE.equals(type) || RedisKey.BLOODY_PERSON_BATTLE_INFO.equals(type)) {
|
||||
return type + RedisKey.Delimiter_colon + key;
|
||||
}
|
||||
return GameApplication.serverId + RedisKey.Delimiter_colon + type + RedisKey.Delimiter_colon + key;
|
||||
|
|
|
@ -271,6 +271,7 @@ public class GlobalDataManaager {
|
|||
PlayerLogic.getInstance().vipflushEveryDay(user,fBuilder);
|
||||
PlayerLogic.getInstance().flushUserdataEvery(user,fBuilder);
|
||||
user.getUserMissionManager().onGameEvent(user, GameEvent.DAILY_REFRESH,0);
|
||||
user.getUserMissionManager().onGameEvent(user, GameEvent.BLOODY_REFRESH,0);
|
||||
FriendLogic.getInstance().refreshState(session);
|
||||
int sendDays = user.getPlayerInfoManager().getSendDays();
|
||||
int differentDays = TimeUtils.differentDaysByHour( user.getPlayerInfoManager().getLoginTime(),System.currentTimeMillis(), 5);
|
||||
|
|
|
@ -1,13 +1,17 @@
|
|||
package com.ljsd.jieling.logic.blood;
|
||||
|
||||
import com.ljsd.GameApplication;
|
||||
import com.ljsd.jieling.bloody.SortDataBean;
|
||||
import com.ljsd.jieling.config.SBloodyBattleSetting;
|
||||
import com.ljsd.jieling.config.SBloodyBattleTreasure;
|
||||
import com.ljsd.jieling.config.SBloodyRankConfig;
|
||||
import com.ljsd.jieling.db.mongo.MongoUtil;
|
||||
import com.ljsd.jieling.db.redis.RedisKey;
|
||||
import com.ljsd.jieling.db.redis.RedisUtil;
|
||||
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.ActivityType;
|
||||
import com.ljsd.jieling.logic.dao.*;
|
||||
import com.ljsd.jieling.logic.dao.root.User;
|
||||
|
@ -17,6 +21,10 @@ import com.ljsd.jieling.logic.hero.HeroAttributeEnum;
|
|||
import com.ljsd.jieling.logic.hero.HeroLogic;
|
||||
import com.ljsd.jieling.logic.item.ItemLogic;
|
||||
import com.ljsd.jieling.logic.mail.MailLogic;
|
||||
import com.ljsd.jieling.logic.mission.GameEvent;
|
||||
import com.ljsd.jieling.logic.mission.GameMisionType;
|
||||
import com.ljsd.jieling.logic.mission.event.MissionEventDistributor;
|
||||
import com.ljsd.jieling.logic.mission.main.MissionStateChangeInfo;
|
||||
import com.ljsd.jieling.network.session.ISession;
|
||||
import com.ljsd.jieling.protocols.CommonProto;
|
||||
import com.ljsd.jieling.protocols.MessageTypeProto;
|
||||
|
@ -288,4 +296,39 @@ public class BloodLogic {
|
|||
bloodyInfo.setHadBuy(1);
|
||||
MessageUtil.sendMessage(session,1,resId,null,true);
|
||||
}
|
||||
|
||||
public void calBloodyMissionInfo(User user,SortDataBean sortDataBean) throws Exception {
|
||||
int killNums = sortDataBean.getKillNums();
|
||||
BloodyInfo bloodyInfo = user.getBloodyInfo();
|
||||
bloodyInfo.setKillNums(bloodyInfo.getKillNums() + 9999);
|
||||
int changeScore = calScore(sortDataBean);
|
||||
if(changeScore>0){
|
||||
bloodyInfo.setScore(bloodyInfo.getScore() + calScore(sortDataBean));
|
||||
}
|
||||
MissionEventDistributor.requestStart();
|
||||
user.getUserMissionManager().onGameEvent(user, GameEvent.BLOODY_END);
|
||||
ISession session = OnlineUserManager.getSessionByUid(user.getId());
|
||||
if(session!=null){
|
||||
MissionEventDistributor.requestEnd(session,true);
|
||||
MessageUtil.sendIndicationMessage(session,1, MessageTypeProto.MessageType.BLOODY_SCORE_CHANGE_INDICATION_VALUE, RoomProto.BloodyScoreChangeIndication.newBuilder().setMyscore(bloodyInfo.getScore()).build(),true);
|
||||
}
|
||||
MongoUtil.getInstence().lastUpdate();
|
||||
}
|
||||
|
||||
private int calScore(SortDataBean sortDataBean){
|
||||
int result = 0;
|
||||
int killNums = sortDataBean.getKillNums();
|
||||
int mineral = sortDataBean.getMineral();
|
||||
int[][] scoreConversion = SBloodyBattleSetting.sBloodyBattleSetting.getScoreConversion();
|
||||
for(int [] scoreItem : scoreConversion){
|
||||
int type = scoreItem[0];
|
||||
if(type == 1){
|
||||
result+=mineral/scoreItem[1];
|
||||
}else{
|
||||
result+=killNums/scoreItem[1];
|
||||
}
|
||||
|
||||
}
|
||||
return result;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -12,6 +12,8 @@ public class BloodyInfo extends MongoBase {
|
|||
|
||||
private int hadBuy; //是否已购
|
||||
|
||||
private int killNums;// 每日杀死人数
|
||||
|
||||
private Map<Integer, Integer> stateInfo = new HashMap<>();
|
||||
|
||||
|
||||
|
@ -41,4 +43,13 @@ public class BloodyInfo extends MongoBase {
|
|||
updateString("stateInfo." + missionId,status);
|
||||
this.stateInfo.put(missionId,status);
|
||||
}
|
||||
|
||||
public int getKillNums() {
|
||||
return killNums;
|
||||
}
|
||||
|
||||
public void setKillNums(int killNums) {
|
||||
updateString("killNums",killNums);
|
||||
this.killNums = killNums;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -196,6 +196,10 @@ public class CumulationData {
|
|||
this.subType = subType;
|
||||
this.param2 = param2;
|
||||
}
|
||||
|
||||
public void setValue(long value) {
|
||||
this.value = value;
|
||||
}
|
||||
}
|
||||
|
||||
public void updateHeroUpStarTimes(int heroTid){
|
||||
|
|
|
@ -87,6 +87,7 @@ public class UserManager {
|
|||
PlayerLogic.getInstance().playerInfoUpdate(user);
|
||||
user.getUserMissionManager().onGameEvent(user, GameEvent.USER_LEVELUP,0,1);
|
||||
user.getUserMissionManager().onGameEvent(user, GameEvent.DAILY_REFRESH,0);
|
||||
user.getUserMissionManager().onGameEvent(user, GameEvent.BLOODY_REFRESH,0);
|
||||
user.getUserMissionManager().onGameEvent(user, GameEvent.BEGINNER);
|
||||
KtEventUtils.onKtEvent(user, ParamEventBean.UserRegister);
|
||||
}
|
||||
|
|
|
@ -1,10 +1,7 @@
|
|||
package com.ljsd.jieling.logic.dao;
|
||||
|
||||
import com.ljsd.common.mogodb.MongoBase;
|
||||
import com.ljsd.jieling.config.SBeginnerTask;
|
||||
import com.ljsd.jieling.config.SDailyTasksConfig;
|
||||
import com.ljsd.jieling.config.STreasureTaskConfig;
|
||||
import com.ljsd.jieling.config.SVipLevelConfig;
|
||||
import com.ljsd.jieling.config.*;
|
||||
import com.ljsd.jieling.logic.dao.root.User;
|
||||
import com.ljsd.jieling.logic.mission.*;
|
||||
import com.ljsd.jieling.logic.mission.event.MissionEventDistributor;
|
||||
|
@ -22,6 +19,7 @@ public class UserMissionManager extends MongoBase {
|
|||
|
||||
private TreasureMissionType treasureMissionIdsType=new TreasureMissionType();
|
||||
private ServenMissionIdsType sevenHappyMissionType =new ServenMissionIdsType();
|
||||
private BloodyMissionIdsType bloodyMissionIdsType =new BloodyMissionIdsType();
|
||||
//数据累加项
|
||||
private CumulationData cumulationData = new CumulationData();
|
||||
private CumulationData dailyCumulationData = new CumulationData();
|
||||
|
@ -94,6 +92,15 @@ public class UserMissionManager extends MongoBase {
|
|||
updateString("beginerTaskIdsType", beginerTaskIdsType);
|
||||
updateString("beginCumulationData", beginCumulationData);
|
||||
break;
|
||||
|
||||
case BLOODY_REFRESH:
|
||||
Set<Integer> bloodyMissionIds = SBloodyBattleTask.sBloodyBattleTaskMap.keySet();
|
||||
bloodyMissionIdsType.getDoingMissionIds().clear();
|
||||
bloodyMissionIdsType.getFinishMissionIds().clear();
|
||||
bloodyMissionIdsType.getRewardedMissionIds().clear();
|
||||
bloodyMissionIdsType.getDoingMissionIds().addAll(bloodyMissionIds);
|
||||
updateString("bloodyMissionIdsType",bloodyMissionIdsType);
|
||||
break;
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -132,6 +139,11 @@ public class UserMissionManager extends MongoBase {
|
|||
updateString("beginerTaskIdsType",beginerTaskIdsType);
|
||||
}
|
||||
break;
|
||||
case BLOODY_MISSION_REWARD:{
|
||||
bloodyMissionIdsType.rewardMission((int)parm[0], missionTypeEnumListMap.get(GameMisionType.BLOODYMISSION));
|
||||
updateString("bloodyMissionIdsType",bloodyMissionIdsType);
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -142,6 +154,16 @@ public class UserMissionManager extends MongoBase {
|
|||
|
||||
|
||||
public void calCumulationDataResult(User user, MissionType missionType, Map<GameMisionType, List<MissionStateChangeInfo>> missionTypeEnumListMap , Object...parm) throws Exception {
|
||||
if( missionType == MissionType.BLOODY_KILL_NUMS ){
|
||||
if(!bloodyMissionIdsType.getDoingMissionIds().isEmpty()){
|
||||
CumulationData.Result result = new CumulationData.Result(missionType, 0);
|
||||
bloodyMissionIdsType.calCumulationDataResult(user,result,missionTypeEnumListMap.get(GameMisionType.BLOODYMISSION),null);
|
||||
if(result.value == 1){
|
||||
updateString("bloodyMissionIdsType",bloodyMissionIdsType);
|
||||
}
|
||||
}
|
||||
return;
|
||||
}
|
||||
if(!dailyMissionIdsType.getDoingMissionIds().isEmpty()){
|
||||
List<SDailyTasksConfig> sTaskConfigs = SDailyTasksConfig.getsTaskConfigByTypeMap(missionType.getMissionTypeValue());
|
||||
if (sTaskConfigs != null) {
|
||||
|
@ -248,4 +270,8 @@ public class UserMissionManager extends MongoBase {
|
|||
public CumulationData getBeginCumulationData() {
|
||||
return beginCumulationData;
|
||||
}
|
||||
|
||||
public BloodyMissionIdsType getBloodyMissionIdsType() {
|
||||
return bloodyMissionIdsType;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -3,6 +3,7 @@ package com.ljsd.jieling.logic.mission;
|
|||
public enum GameEvent {
|
||||
VIP_LEVLUP, //vip等级提升
|
||||
DAILY_REFRESH,//日常任务刷新
|
||||
BLOODY_REFRESH,//血战任务刷新
|
||||
TREASH_REFRESH,//孙龙的宝藏
|
||||
SERVENHAPPY_REFRESH,//七日狂欢
|
||||
BEGINNER,//新手
|
||||
|
@ -25,6 +26,7 @@ public enum GameEvent {
|
|||
VIP_MISSION_REWARD, //vip任务领取事件
|
||||
DAILY_MISSION_REWARD, //每日任务领取事件
|
||||
BEGINNER_MISSION_REWARD, //新手任务领取
|
||||
BLOODY_MISSION_REWARD, //血战任务领取
|
||||
TREASURE_MISSION_REWARD,// 领取孙龙的宝藏
|
||||
SEVENHAPPY_MISSION_REWARD,// 领取孙龙的宝藏
|
||||
WORKSHOP_CREATE_EQUIP,//打造装备
|
||||
|
@ -54,4 +56,6 @@ public enum GameEvent {
|
|||
|
||||
TO_BE_STRONGER,//我要变强
|
||||
|
||||
BLOODY_END,// 血战结束
|
||||
|
||||
}
|
||||
|
|
|
@ -7,6 +7,7 @@ public enum GameMisionType {
|
|||
TREASUREMISSION(4),
|
||||
SEVENMISSION(5),
|
||||
BEGINNERMISSION(6),
|
||||
BLOODYMISSION(7),
|
||||
;
|
||||
private int type;
|
||||
|
||||
|
|
|
@ -36,12 +36,35 @@ public class MissionLoigc {
|
|||
getVipMission(user,missionList);
|
||||
getCopyMission(user,missionList);
|
||||
getTreasureMission(user,missionList,ActivityType.TREASURE);
|
||||
getTreasureMission(user,missionList,ActivityType.SERVERHAPPY);
|
||||
getBeginnerMisssion(user,missionList);
|
||||
getTreasureMission(user,missionList,ActivityType.SERVERHAPPY);
|
||||
getBeginnerMisssion(user,missionList);
|
||||
getBloodyMisison(user,missionList);
|
||||
PlayerInfoProto.GetMissionResponse build = PlayerInfoProto.GetMissionResponse.newBuilder().addAllUserMissionInfo(missionList).build();
|
||||
MessageUtil.sendMessage(session,1, MessageTypeProto.MessageType.GET_MISSION_RESPONSE_VALUE,build,true);
|
||||
}
|
||||
|
||||
private static void getBloodyMisison(User user, List<CommonProto.UserMissionInfo> missionList){
|
||||
UserMissionManager userMissionManager = user.getUserMissionManager();
|
||||
BloodyMissionIdsType bloodyMissionIdsType = userMissionManager.getBloodyMissionIdsType();
|
||||
|
||||
Set<Integer> doingMissionIds = bloodyMissionIdsType.getDoingMissionIds();
|
||||
Set<Integer> finishMissionIds = bloodyMissionIdsType.getFinishMissionIds();
|
||||
Map<Integer, SBloodyBattleTask> sBloodyBattleTaskMap = SBloodyBattleTask.sBloodyBattleTaskMap;
|
||||
int dailymissionType = GameMisionType.BLOODYMISSION.getType();
|
||||
for(SBloodyBattleTask sBloodyBattleTask:sBloodyBattleTaskMap.values()){
|
||||
int state = 2;
|
||||
int missionId = sBloodyBattleTask.getId();
|
||||
int progrss = sBloodyBattleTask.getTaskValue()[1][0];
|
||||
if(doingMissionIds.contains(missionId)){
|
||||
state = 0;
|
||||
progrss = getDoingProgress(user,null,sBloodyBattleTask.getTaskType(),sBloodyBattleTask.getTaskValue()[0]);
|
||||
}else if(finishMissionIds.contains(missionId)){
|
||||
state = 1;
|
||||
}
|
||||
missionList.add(CommonProto.UserMissionInfo.newBuilder().setMissionId(missionId).setState(state).setType(dailymissionType).setProgress(progrss).build());
|
||||
}
|
||||
}
|
||||
|
||||
private static void getBeginnerMisssion(User user, List<CommonProto.UserMissionInfo> missionList) {
|
||||
UserMissionManager userMissionManager = user.getUserMissionManager();
|
||||
BeginerTaskIdsType beginerTaskIdsType = userMissionManager.getBeginerTaskIdsType();
|
||||
|
@ -277,6 +300,21 @@ public class MissionLoigc {
|
|||
User user = UserManager.getUser(uid);
|
||||
UserMissionManager userMissionManager = user.getUserMissionManager();
|
||||
List<MissionStateChangeInfo> missionStateChangeInfos = null;
|
||||
if(type == GameMisionType.BLOODYMISSION.getType()){ //vip 任务
|
||||
Map<GameMisionType, List<MissionStateChangeInfo>> gameMisionTypeListMap = userMissionManager.onGameEvent(user, GameEvent.BLOODY_MISSION_REWARD, missionId);
|
||||
missionStateChangeInfos = gameMisionTypeListMap.get(GameMisionType.BLOODYMISSION);
|
||||
if(missionStateChangeInfos.isEmpty()){
|
||||
MessageUtil.sendErrorResponse(session,0, MessageTypeProto.MessageType.TAKE_MISSION_REWARD_RESPONSE_VALUE,"had taked reward");
|
||||
return;
|
||||
}
|
||||
int rewardGroup = SBloodyBattleTask.sBloodyBattleTaskMap.get(missionId).getRewardGroup();
|
||||
CommonProto.Drop.Builder drop = ItemUtil.drop(user, new int[]{rewardGroup}, 1.0f, 0, BIReason.TAKE_MISSION_REWARD);
|
||||
PlayerInfoProto.TakeMissionRewardResponse build = PlayerInfoProto.TakeMissionRewardResponse.newBuilder().setDrop(drop).build();
|
||||
MessageUtil.sendMessage(session,1, MessageTypeProto.MessageType.TAKE_MISSION_REWARD_RESPONSE_VALUE,build,true);
|
||||
KtEventUtils.onKtEvent(user, ParamEventBean.UserTaskEvent,type,missionId);
|
||||
Repot37EventUtil.onKtEvent(user, Repot37EventUtil.Report37EventType.TASK_FINISH_EVEMT,missionId,"");
|
||||
return;
|
||||
}
|
||||
if(type == GameMisionType.VIPMISSION.getType()){ //vip 任务
|
||||
Map<GameMisionType, List<MissionStateChangeInfo>> gameMisionTypeListMap = userMissionManager.onGameEvent(user, GameEvent.VIP_MISSION_REWARD, missionId);
|
||||
missionStateChangeInfos = gameMisionTypeListMap.get(GameMisionType.VIPMISSION);
|
||||
|
@ -587,6 +625,9 @@ public class MissionLoigc {
|
|||
case TO_BE_STRONGER:
|
||||
count = cumulationData.toBeStronger;
|
||||
break;
|
||||
case BLOODY_KILL_NUMS:
|
||||
count = user.getBloodyInfo().getKillNums();
|
||||
break;
|
||||
default:
|
||||
count = 0;
|
||||
break;
|
||||
|
|
|
@ -76,7 +76,8 @@ public enum MissionType {
|
|||
|
||||
JOIN_MONSTER_ATTACK_TIMES(56),//参与兽潮来袭的次数
|
||||
MONSTER_ATTACK_LEVEL(57),//兽潮来袭到达x层
|
||||
TO_BE_STRONGER(58)//我要变强点击:%s次
|
||||
TO_BE_STRONGER(58),//我要变强点击:%s次
|
||||
BLOODY_KILL_NUMS(59),// 血战每日击杀人数
|
||||
|
||||
;
|
||||
|
||||
|
@ -208,6 +209,8 @@ public enum MissionType {
|
|||
return MONSTER_ATTACK_LEVEL;//兽潮来袭到达x层
|
||||
case 58:
|
||||
return TO_BE_STRONGER;
|
||||
case 59:
|
||||
return BLOODY_KILL_NUMS;
|
||||
default:
|
||||
return null;
|
||||
}
|
||||
|
|
|
@ -33,6 +33,7 @@ public class MissionEventDistributor {
|
|||
|
||||
|
||||
eventProcessor.put(GameEvent.DAILY_REFRESH,new DailyRefreshEventProcess());
|
||||
eventProcessor.put(GameEvent.BLOODY_REFRESH,new DailyRefreshEventProcess());
|
||||
eventProcessor.put(GameEvent.TREASH_REFRESH,new TreasureRefreshEventProcess());
|
||||
eventProcessor.put(GameEvent.SERVENHAPPY_REFRESH,new TreasureRefreshEventProcess());
|
||||
eventProcessor.put(GameEvent.BEGINNER,new BeginneRefreshEventProcessor());
|
||||
|
@ -170,6 +171,7 @@ public class MissionEventDistributor {
|
|||
eventProcessor.put(GameEvent.TREASURE_MISSION_REWARD,new RewardEventProcessor());
|
||||
eventProcessor.put(GameEvent.SEVENHAPPY_MISSION_REWARD,new RewardEventProcessor());
|
||||
eventProcessor.put(GameEvent.BEGINNER_MISSION_REWARD,new RewardEventProcessor());
|
||||
eventProcessor.put(GameEvent.BLOODY_MISSION_REWARD,new RewardEventProcessor());
|
||||
|
||||
typeList = new ArrayList<>();
|
||||
typeList.add(MissionType.RING_FIREA_DVANCED);
|
||||
|
@ -246,6 +248,11 @@ public class MissionEventDistributor {
|
|||
eventEnumListMap.put(GameEvent.TO_BE_STRONGER,typeList);
|
||||
eventProcessor.put(GameEvent.TO_BE_STRONGER,new CumulationDataEventProcessor());
|
||||
|
||||
typeList = new ArrayList<>();
|
||||
typeList.add(MissionType.BLOODY_KILL_NUMS);
|
||||
eventEnumListMap.put(GameEvent.BLOODY_END,typeList);
|
||||
eventProcessor.put(GameEvent.BLOODY_END,new CumulationDataEventProcessor());
|
||||
|
||||
}
|
||||
|
||||
private static final ThreadLocal<Map<GameMisionType, List<MissionStateChangeInfo>>> threadMissionChangeList =
|
||||
|
@ -270,6 +277,7 @@ public class MissionEventDistributor {
|
|||
missionTypeEnumListMap.put(GameMisionType.TREASUREMISSION, new ArrayList<>());
|
||||
missionTypeEnumListMap.put(GameMisionType.SEVENMISSION, new ArrayList<>());
|
||||
missionTypeEnumListMap.put(GameMisionType.BEGINNERMISSION, new ArrayList<>());
|
||||
missionTypeEnumListMap.put(GameMisionType.BLOODYMISSION, new ArrayList<>());
|
||||
} else {
|
||||
missionTypeEnumListMap.get(GameMisionType.VIPMISSION).clear();
|
||||
missionTypeEnumListMap.get(GameMisionType.DAILYMISSION).clear();
|
||||
|
@ -277,6 +285,7 @@ public class MissionEventDistributor {
|
|||
missionTypeEnumListMap.get(GameMisionType.TREASUREMISSION).clear();
|
||||
missionTypeEnumListMap.get(GameMisionType.SEVENMISSION).clear();
|
||||
missionTypeEnumListMap.get(GameMisionType.BEGINNERMISSION).clear();
|
||||
missionTypeEnumListMap.get(GameMisionType.BLOODYMISSION).clear();
|
||||
}
|
||||
threadMissionChangeList.set(missionTypeEnumListMap);
|
||||
}
|
||||
|
@ -309,7 +318,7 @@ public class MissionEventDistributor {
|
|||
MissionState missionState = missionStateChangeInfo.getMissionState();
|
||||
int state = missionState.getState();
|
||||
int progress = 0;
|
||||
if(gameMisionType == GameMisionType.COPYMISSION || gameMisionType == GameMisionType.TREASUREMISSION || gameMisionType == GameMisionType.SEVENMISSION){
|
||||
if(gameMisionType == GameMisionType.COPYMISSION || gameMisionType == GameMisionType.TREASUREMISSION || gameMisionType == GameMisionType.SEVENMISSION || gameMisionType == GameMisionType.BLOODYMISSION){
|
||||
progress = missionStateChangeInfo.getProgress();
|
||||
}
|
||||
if(missionState == MissionState.DOING){
|
||||
|
|
|
@ -0,0 +1,40 @@
|
|||
package com.ljsd.jieling.logic.mission.main;
|
||||
|
||||
import com.ljsd.jieling.config.SBloodyBattleTask;
|
||||
import com.ljsd.jieling.logic.dao.CumulationData;
|
||||
import com.ljsd.jieling.logic.dao.root.User;
|
||||
import com.ljsd.jieling.logic.mission.MissionState;
|
||||
|
||||
import java.util.Iterator;
|
||||
import java.util.List;
|
||||
|
||||
|
||||
public class BloodyMissionIdsType extends AbstractMissionType{
|
||||
@Override
|
||||
public void openMission(User user, int missionId, List<MissionStateChangeInfo> missionTypeEnumList) {
|
||||
}
|
||||
|
||||
@Override
|
||||
public int[][] reward(int missionId) {
|
||||
return new int[0][];
|
||||
}
|
||||
|
||||
@Override
|
||||
public void calCumulationDataResult(User user, CumulationData.Result result, List<MissionStateChangeInfo> missionStateChangeInfos, CumulationData cumulationData) {
|
||||
int killNums = user.getBloodyInfo().getKillNums();
|
||||
Iterator<Integer> iterator = getDoingMissionIds().iterator();
|
||||
while (iterator.hasNext()){
|
||||
Integer doingMissionId = iterator.next();
|
||||
SBloodyBattleTask sBloodyBattleTask = SBloodyBattleTask.sBloodyBattleTaskMap.get(doingMissionId);
|
||||
if(killNums>=sBloodyBattleTask.getTaskValue()[1][0]){
|
||||
iterator.remove();
|
||||
missionStateChangeInfos.add(new MissionStateChangeInfo(doingMissionId, MissionState.FINISH,killNums));
|
||||
getFinishMissionIds().add(doingMissionId);
|
||||
result.setValue(1);
|
||||
}else{
|
||||
missionStateChangeInfos.add(new MissionStateChangeInfo(doingMissionId, MissionState.DOING,killNums));
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
|
@ -86,6 +86,7 @@ public class ThreadManager {
|
|||
scheduledExecutor.scheduleAtFixedRate(platConfigureTask, 10, SLEEP_INTEVAL_TIME, TimeUnit.SECONDS);
|
||||
scheduledExecutor.scheduleAtFixedRate(new MinuteTask(), delayForMinute, 60, TimeUnit.SECONDS);
|
||||
scheduledExecutor.scheduleAtFixedRate(new SecondsTask(), 0, 1, TimeUnit.SECONDS);
|
||||
scheduledExecutor.scheduleAtFixedRate(new FetchBloodyEndDataThread(), 0, 1, TimeUnit.SECONDS);
|
||||
scheduledExecutor.scheduleAtFixedRate(new Thread(){
|
||||
public void run () {
|
||||
long lastMilis = System.currentTimeMillis();
|
||||
|
|
|
@ -0,0 +1,53 @@
|
|||
package com.ljsd.jieling.thread.task;
|
||||
|
||||
import com.ljsd.GameApplication;
|
||||
import com.ljsd.jieling.bloody.SortDataBean;
|
||||
import com.ljsd.jieling.core.HandlerLogicThread;
|
||||
import com.ljsd.jieling.db.mongo.MongoUtil;
|
||||
import com.ljsd.jieling.db.redis.RedisKey;
|
||||
import com.ljsd.jieling.db.redis.RedisUtil;
|
||||
import com.ljsd.jieling.logic.OnlineUserManager;
|
||||
import com.ljsd.jieling.logic.blood.BloodLogic;
|
||||
import com.ljsd.jieling.logic.dao.UserManager;
|
||||
import com.ljsd.jieling.logic.dao.root.User;
|
||||
import com.ljsd.jieling.network.server.ProtocolsManager;
|
||||
import com.ljsd.jieling.util.AyyncWorker;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
import java.util.Map;
|
||||
|
||||
public class FetchBloodyEndDataThread extends Thread{
|
||||
private static final Logger LOGGER = LoggerFactory.getLogger(FetchBloodyEndDataThread.class);
|
||||
|
||||
public FetchBloodyEndDataThread(){
|
||||
this.setName("FetchBloodyEndDataThread");
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void run() {
|
||||
try {
|
||||
Map<Integer, SortDataBean> mapValues = RedisUtil.getInstence().getMapValues(RedisKey.BLOODY_PERSON_BATTLE_INFO, Integer.toString(GameApplication.serverId), Integer.class, SortDataBean.class);
|
||||
for(SortDataBean sortDataBean : mapValues.values()){
|
||||
int uid = sortDataBean.getUid();
|
||||
User user = UserManager.getUser(uid);
|
||||
AyyncWorker ayyncWorker = new AyyncWorker(user,true) {
|
||||
@Override
|
||||
public void work(User user) throws Exception {
|
||||
BloodLogic.getInstance().calBloodyMissionInfo(user,sortDataBean);
|
||||
}
|
||||
};
|
||||
ProtocolsManager instance = ProtocolsManager.getInstance();
|
||||
HandlerLogicThread handlerThread = instance.handlerThreads[uid % instance.HANDLER_THREAD_NUM];
|
||||
handlerThread.addAyyncWorker(ayyncWorker);
|
||||
RedisUtil.getInstence().removeMapEntrys(RedisKey.BLOODY_PERSON_BATTLE_INFO, Integer.toString(GameApplication.serverId),Integer.toString(uid));
|
||||
|
||||
}
|
||||
}catch (Exception e){
|
||||
LOGGER.error("e->",e);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
Loading…
Reference in New Issue