scene
parent
c770a95a09
commit
3f16d2c1ca
|
@ -10,6 +10,12 @@ public class UserBloodySnpInfo {
|
|||
|
||||
private String name;
|
||||
|
||||
private int head;
|
||||
|
||||
private int headFrame;
|
||||
|
||||
private int level;
|
||||
|
||||
private Map<String, FamilyHeroInfo> heroAllAttributes = new HashMap<>(5);
|
||||
|
||||
private Map<String, String> heroSkills = new HashMap<>();
|
||||
|
|
|
@ -10,8 +10,11 @@ import com.ljsd.jieling.battle.room.BeanToProto;
|
|||
import com.ljsd.jieling.battle.room.Command;
|
||||
import com.ljsd.jieling.battle.room.SceneManager;
|
||||
import com.ljsd.jieling.battle.statics.AnalysisData;
|
||||
import com.ljsd.jieling.config.SBloodyBattleReward;
|
||||
import com.ljsd.jieling.config.SBloodyBattleSetting;
|
||||
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.dao.UserManager;
|
||||
import com.ljsd.jieling.logic.dao.root.User;
|
||||
|
@ -108,6 +111,10 @@ public class Scene implements Runnable{
|
|||
|
||||
private Map<Integer,Integer> monsterRecoryMap = new HashMap<>();
|
||||
|
||||
private int firstBloodyPerson;
|
||||
|
||||
private List<String> cacheMsg = new ArrayList<>(2);
|
||||
|
||||
|
||||
public void monsterReflush(){
|
||||
Iterator<Map.Entry<Integer, Integer>> iterator = monsterRecoryMap.entrySet().iterator();
|
||||
|
@ -142,7 +149,7 @@ public class Scene implements Runnable{
|
|||
}
|
||||
|
||||
//消息广播
|
||||
if(msgUpdate){
|
||||
if(msgUpdate || !cacheMsg.isEmpty()){
|
||||
for(Integer removeId : builder.getRemoveActorIdList()){
|
||||
sceneActorMap.remove(removeId);
|
||||
}
|
||||
|
@ -153,6 +160,15 @@ public class Scene implements Runnable{
|
|||
}
|
||||
}
|
||||
}
|
||||
if(!cacheMsg.isEmpty()){
|
||||
int now = (int)(System.currentTimeMillis()/1000);
|
||||
for(String msg : cacheMsg){
|
||||
CommonProto.SceneMsg build = CommonProto.SceneMsg.newBuilder().setMsg(msg).setTime(now).build();
|
||||
builder.addSceneMsg(build);
|
||||
}
|
||||
cacheMsg.clear();
|
||||
}
|
||||
|
||||
for(SceneActor sceneActor : sceneActorMap.values()){
|
||||
if(sceneActor.getType() == ActorType.Player){
|
||||
ISession sessionByUid = OnlineUserManager.getSessionByUid(sceneActor.getId());
|
||||
|
@ -161,7 +177,9 @@ public class Scene implements Runnable{
|
|||
}
|
||||
}
|
||||
}
|
||||
System.out.println("------------------------");
|
||||
System.out.println(JsonFormat.printToString(builder.build()));
|
||||
System.out.println("------------------------" + msgUpdate);
|
||||
builder.clear();
|
||||
willUpdateActors.clear();
|
||||
msgUpdate = false;
|
||||
|
@ -177,6 +195,7 @@ public class Scene implements Runnable{
|
|||
*/
|
||||
public void processEventUpdate(EventType eventType,Object parm){
|
||||
msgUpdate = true;
|
||||
System.out.println("the eventType = "+ eventType);
|
||||
switch (eventType){
|
||||
case SCENEACTORE_UPDATE:
|
||||
willUpdateActors.add((int)parm);
|
||||
|
@ -283,20 +302,48 @@ public class Scene implements Runnable{
|
|||
//退出操作
|
||||
public void gameEnd() throws Exception {
|
||||
isEnd = true;
|
||||
for(SceneActor sceneActor : sceneActorMap.values()){
|
||||
if(sceneActor.getType() == ActorType.Player){
|
||||
int id = sceneActor.getId();
|
||||
User user = UserManager.getUser(id);
|
||||
user.getRoomInfo().setRoomId(-1);
|
||||
MatchServerice.clearUidRoomInfo(id);
|
||||
ISession iSession = OnlineUserManager.getSessionByUid(id);
|
||||
if(iSession!=null){
|
||||
MessageUtil.sendIndicationMessage(iSession, 1, MessageTypeProto.MessageType.SCENE_GAME_OVER_INDICATION_VALUE, null, true);
|
||||
}
|
||||
//结算操作
|
||||
List<SortDataBean> sortDataBeans = new ArrayList<>();
|
||||
for(AnalysisData analysisData: analysisDataMap.values()){
|
||||
int playId = analysisData.getId();
|
||||
Creature creature = (Creature)sceneActorMap.get(playId);
|
||||
int mineral = creature.getMineral();
|
||||
int killNums = analysisData.getKillNums();
|
||||
sortDataBeans.add(new SortDataBean(playId,mineral,killNums));
|
||||
}
|
||||
Collections.sort(sortDataBeans);
|
||||
|
||||
int rank=1;
|
||||
int curSeason=1;
|
||||
SceneFight.SceneEndIndication.Builder builder = SceneFight.SceneEndIndication.newBuilder();
|
||||
for(SortDataBean sortDataBean : sortDataBeans){
|
||||
SBloodyBattleReward sBloodyBattleReward = SBloodyBattleReward.sBloodyBattleRewardMap.get(rank);
|
||||
int score = sBloodyBattleReward.getScore();
|
||||
int id = sortDataBean.getUid();
|
||||
int myscore = 0;
|
||||
if(curSeason!=0){
|
||||
RedisUtil.getInstence().incrementZsetScore(RedisKey.BLOODY_RANK,Integer.toString(curSeason),Integer.toString(id),score);
|
||||
myscore = RedisUtil.getInstence().getZSetScore(RedisKey.BLOODY_RANK,Integer.toString(curSeason), Integer.toString(id)).intValue();
|
||||
if(myscore<0){
|
||||
myscore=0;
|
||||
String mineRankKey = RedisKey.getKey(RedisKey.BLOODY_RANK, String.valueOf(id), false);
|
||||
RedisUtil.getInstence().zsetAddOne(mineRankKey,Integer.toString(id),myscore);
|
||||
}
|
||||
}else{
|
||||
score=0;
|
||||
}
|
||||
builder.addSceneSimpleRankInfo(SceneFight.SceneSimpleRankInfo.newBuilder().setScore(myscore).setUpdateScore(score).setUid(id).build());
|
||||
rank++;
|
||||
}
|
||||
|
||||
for(SortDataBean sortDataBean : sortDataBeans){
|
||||
ISession iSession = OnlineUserManager.getSessionByUid(sortDataBean.getUid());
|
||||
if(iSession!=null){
|
||||
MessageUtil.sendIndicationMessage(iSession, 1, MessageTypeProto.MessageType.SCENE_GAME_OVER_INDICATION_VALUE, builder.build(), true);
|
||||
}
|
||||
}
|
||||
SceneManager.clearScene(roomId);
|
||||
|
||||
MongoUtil.getLjsdMongoTemplate().lastUpdate();
|
||||
}
|
||||
|
||||
|
@ -398,4 +445,16 @@ public class Scene implements Runnable{
|
|||
public Map<Integer, AnalysisData> getAnalysisDataMap() {
|
||||
return analysisDataMap;
|
||||
}
|
||||
|
||||
public int getFirstBloodyPerson() {
|
||||
return firstBloodyPerson;
|
||||
}
|
||||
|
||||
public void setFirstBloodyPerson(int firstBloodyPerson) {
|
||||
this.firstBloodyPerson = firstBloodyPerson;
|
||||
}
|
||||
|
||||
public void addCahceBroadMsg(String msg){
|
||||
cacheMsg.add(msg);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -4,6 +4,9 @@ package com.ljsd.jieling.battle.actor;
|
|||
|
||||
import com.ljsd.jieling.battle.BattleManager;
|
||||
import com.ljsd.jieling.battle.room.SceneManager;
|
||||
import com.ljsd.jieling.battle.statics.AnalysisEventType;
|
||||
import com.ljsd.jieling.battle.statics.AnalysisSourceData;
|
||||
import com.ljsd.jieling.battle.statics.MessageBoxUtils;
|
||||
import com.ljsd.jieling.config.SBloodyBattleSetting;
|
||||
|
||||
import java.util.*;
|
||||
|
@ -78,6 +81,7 @@ public abstract class SceneActor{
|
|||
scene.processEventUpdate(EventType.SCENEACTORE_UPDATE,mineral.getId());
|
||||
}
|
||||
value.updateEffectValue(0,reallyDigger + value.getValues().get(0));
|
||||
MessageBoxUtils.onGameEvent(AnalysisEventType.DIGGER,scene,new AnalysisSourceData(value.getTarget(),value.getCaster(),reallyDigger));
|
||||
}
|
||||
int[][] debuffs = SBloodyBattleSetting.sBloodyBattleSetting.getDebuff();
|
||||
for(int i=0;i<debuffs.length;i++){
|
||||
|
@ -102,7 +106,6 @@ public abstract class SceneActor{
|
|||
}
|
||||
}
|
||||
value.updateEffectValue(i+1,value.getValues().get(i+1) +1);
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -120,6 +123,8 @@ public abstract class SceneActor{
|
|||
addOrUpdateBuffer(new EffectBuffer(scene.getBufferId(),BufferType.REMOVEBUFFER.getType(),now,now + duration*1000,id,id,0));
|
||||
}
|
||||
}
|
||||
//清楚挖抗连续事件
|
||||
MessageBoxUtils.onGameEvent(AnalysisEventType.DIGGER,scene,new AnalysisSourceData(value.getTarget(),value.getCaster(),-1));
|
||||
scene.processEventUpdate(EventType.BUFFER_REMOVE,value.getId());
|
||||
}
|
||||
continue;
|
||||
|
@ -151,6 +156,7 @@ public abstract class SceneActor{
|
|||
// 定位到出生点位置
|
||||
this.setPos(SceneManager.selectForPlayerRebirth(scene));
|
||||
scene.processEventUpdate(EventType.SCENEACTORE_UPDATE,id);
|
||||
MessageBoxUtils.onGameEvent(AnalysisEventType.BATTLE,scene,new AnalysisSourceData(value.getTarget(),value.getCaster(),effectValue));
|
||||
|
||||
}else{
|
||||
Creature creature = (Creature) scene.getSceneActorMap().get(value.getCaster());
|
||||
|
@ -167,9 +173,11 @@ public abstract class SceneActor{
|
|||
}else{
|
||||
scene.randomMineralOfUserDeath(creature,gainMineral);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
if(this.getType() == ActorType.Player){
|
||||
MessageBoxUtils.onGameEvent(AnalysisEventType.BATTLE,scene,new AnalysisSourceData(value.getTarget(),value.getCaster(),effectValue));
|
||||
}
|
||||
stateType = StateType.MOVEABLE;
|
||||
((Creature)this).setPreMoveTimestamp(now);
|
||||
scene.processEventUpdate(EventType.SCENEACTORE_UPDATE,this.getId());
|
||||
|
|
|
@ -0,0 +1,59 @@
|
|||
package com.ljsd.jieling.battle.actor;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
|
||||
public class SortDataBean implements Comparable<SortDataBean>{
|
||||
private int uid;
|
||||
private int mineral;
|
||||
private int killNums;
|
||||
|
||||
|
||||
public SortDataBean(int uid, int mineral, int killNums) {
|
||||
this.uid = uid;
|
||||
this.mineral = mineral;
|
||||
this.killNums = killNums;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int compareTo(SortDataBean o) {
|
||||
if(this.mineral>o.mineral){
|
||||
return -1;
|
||||
}
|
||||
if(this.mineral == o.mineral){
|
||||
if(this.killNums>o.killNums){
|
||||
return -1;
|
||||
}
|
||||
if(this.killNums == o.killNums){
|
||||
if(this.uid < o.uid){
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
}
|
||||
return 1;
|
||||
}
|
||||
|
||||
public int getUid() {
|
||||
return uid;
|
||||
}
|
||||
|
||||
public int getMineral() {
|
||||
return mineral;
|
||||
}
|
||||
|
||||
public int getKillNums() {
|
||||
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);
|
||||
}
|
||||
}
|
|
@ -0,0 +1,50 @@
|
|||
package com.ljsd.jieling.battle.match;
|
||||
|
||||
import com.ljsd.jieling.battle.room.Room;
|
||||
import com.ljsd.jieling.battle.room.WaitingRoom;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.concurrent.atomic.AtomicInteger;
|
||||
|
||||
public class BloodyBattleReallyMatchServer implements IMatch{
|
||||
private static WaitingRoom waitingRoom = new WaitingRoom();
|
||||
private static Map<Integer,Integer> roomFull = new HashMap<>();
|
||||
private static Map<Integer,Room> uidToRommMap = new HashMap<>();
|
||||
static {
|
||||
roomFull.put(1,10);
|
||||
}
|
||||
private static AtomicInteger atomicInteger = new AtomicInteger(10000);
|
||||
@Override
|
||||
public void tryMatch(int uid, int type) {
|
||||
Room room = waitingRoom.findRoom(type, new IMatch.IRoomMatchFilter() {
|
||||
@Override
|
||||
public Room filter(List<Room> rooms) {
|
||||
int full = roomFull.get(type);
|
||||
for (Room room : rooms) {
|
||||
if (!room.isFull(full)) {
|
||||
return room;
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@Override
|
||||
public MatchType getMatchType() {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Room getRoomId(int uid) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void clearUidRoom(int uid) {
|
||||
|
||||
}
|
||||
}
|
|
@ -42,10 +42,13 @@ public class BeanToProto {
|
|||
builder.addHeroInfo(CommonProto.BloodyHeroInfo.newBuilder().setHeroId(heroId).setHeroHp(curHp).setHeroMaxHp(hp).setHeroTid(familyHeroInfo.getTempleteId()));
|
||||
}
|
||||
}
|
||||
if(creature.getStateType() != StateType.FROZEN){
|
||||
builder.addAllPath(creature.getPath());
|
||||
}
|
||||
return builder.setCurHp(creature.getLife().getCurHp())
|
||||
.setMaxHp(creature.getLife().getMaxMp())
|
||||
.setSpeed(creature.getSpeed())
|
||||
.addAllPath(creature.getPath())
|
||||
|
||||
.setCamp(creature.getCamp())
|
||||
.setMineral(creature.getMineral())
|
||||
.build();
|
||||
|
|
|
@ -3,6 +3,7 @@ package com.ljsd.jieling.battle.room;
|
|||
import com.ljsd.jieling.battle.BattleManager;
|
||||
import com.ljsd.jieling.battle.UserBloodySnpInfo;
|
||||
import com.ljsd.jieling.battle.actor.*;
|
||||
import com.ljsd.jieling.battle.statics.AnalysisData;
|
||||
import com.ljsd.jieling.config.MapPointConfig;
|
||||
import com.ljsd.jieling.config.SBloodyBattleSetting;
|
||||
import com.ljsd.jieling.config.SCMap;
|
||||
|
@ -92,6 +93,7 @@ public class SceneManager {
|
|||
playerA.setPos(userInitBirths.remove(0));
|
||||
playerA.setSpeed(sBloodyBattleSetting.getPlayerSpeed());
|
||||
scene.addScenActor(playerA);
|
||||
scene.getAnalysisDataMap().put(uid,new AnalysisData(uid));
|
||||
}
|
||||
//创建矿点
|
||||
createMinear(scene,-1,1);
|
||||
|
|
|
@ -6,6 +6,7 @@ public class AnalysisData {
|
|||
private int deadNums; //死亡次数
|
||||
private int diggerTimes; // 连续挖矿次数
|
||||
private int continuousKillNums;//连续杀敌次数
|
||||
private int continuousKillNumsCache;//连续杀敌次数 CACHE
|
||||
private int continuousDeadNums;//连续死亡次数
|
||||
|
||||
public AnalysisData(int id) {
|
||||
|
@ -16,15 +17,53 @@ public class AnalysisData {
|
|||
killNums++;
|
||||
continuousKillNums++;
|
||||
continuousDeadNums=0;
|
||||
continuousKillNumsCache++;
|
||||
}
|
||||
|
||||
public void fail(){
|
||||
deadNums++;
|
||||
continuousKillNums=0;
|
||||
continuousDeadNums=0;
|
||||
continuousDeadNums++;
|
||||
}
|
||||
|
||||
public void digger(){
|
||||
diggerTimes++;
|
||||
}
|
||||
|
||||
public void clearDigger(){
|
||||
diggerTimes=0;
|
||||
}
|
||||
|
||||
|
||||
public int getId() {
|
||||
return id;
|
||||
}
|
||||
|
||||
public int getKillNums() {
|
||||
return killNums;
|
||||
}
|
||||
|
||||
public int getDeadNums() {
|
||||
return deadNums;
|
||||
}
|
||||
|
||||
public int getDiggerTimes() {
|
||||
return diggerTimes;
|
||||
}
|
||||
|
||||
public int getContinuousKillNums() {
|
||||
return continuousKillNums;
|
||||
}
|
||||
|
||||
public int getContinuousDeadNums() {
|
||||
return continuousDeadNums;
|
||||
}
|
||||
|
||||
public int getContinuousKillNumsCache() {
|
||||
return continuousKillNumsCache;
|
||||
}
|
||||
|
||||
public void cleanContinuousKillNumsCache(){
|
||||
continuousKillNumsCache=0;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -0,0 +1,20 @@
|
|||
package com.ljsd.jieling.battle.statics;
|
||||
|
||||
public enum AnalysisDataType {
|
||||
CONTINUOUS_KILL_NUMS(1),//杀敌
|
||||
CONTINUOUS_DIED_NUMS(2),//2被杀
|
||||
DIGGER_NUMS(3),//3挖矿
|
||||
END_CONTINUOUS_KILL_NUMS(4),// 4终结
|
||||
FIRST_BLOODY(5),// 5一血
|
||||
SEND_TO_DEATH(6),// 6狂送
|
||||
;
|
||||
private int type;
|
||||
|
||||
AnalysisDataType(int type) {
|
||||
this.type = type;
|
||||
}
|
||||
|
||||
public int getType() {
|
||||
return type;
|
||||
}
|
||||
}
|
|
@ -1,7 +1,14 @@
|
|||
package com.ljsd.jieling.battle.statics;
|
||||
|
||||
import com.ljsd.jieling.battle.BattleManager;
|
||||
import com.ljsd.jieling.battle.UserBloodySnpInfo;
|
||||
import com.ljsd.jieling.battle.actor.Scene;
|
||||
|
||||
import com.ljsd.jieling.config.SBloodyMessagesConfig;
|
||||
|
||||
import java.text.MessageFormat;
|
||||
import java.util.List;
|
||||
|
||||
public class BattleAnalysisProcessor implements AnalysisProcessor{
|
||||
@Override
|
||||
public void process(Scene scene, AnalysisSourceData analysisSourceData){
|
||||
|
@ -13,4 +20,70 @@ public class BattleAnalysisProcessor implements AnalysisProcessor{
|
|||
}
|
||||
|
||||
}
|
||||
|
||||
public void analysis(Scene scene,AnalysisData targetAnalysisData,AnalysisSourceData analysisSourceData){
|
||||
List<SBloodyMessagesConfig> sBloodyMessagesConfigs = MessageBoxUtils.analysisEventTypeAnalysisDataTypeMap.get(AnalysisEventType.BATTLE);
|
||||
for(SBloodyMessagesConfig sBloodyMessagesConfig : sBloodyMessagesConfigs){
|
||||
int count = sBloodyMessagesConfig.getCount();
|
||||
if(sBloodyMessagesConfig.getType() == AnalysisDataType.FIRST_BLOODY.getType()){
|
||||
if(targetAnalysisData.getContinuousKillNums() == count){
|
||||
int firstBloodyPerson = scene.getFirstBloodyPerson();
|
||||
if(firstBloodyPerson == 0 && targetAnalysisData.getContinuousKillNums() == 1){
|
||||
scene.setFirstBloodyPerson(targetAnalysisData.getId());
|
||||
int targetId = analysisSourceData.getTargetId();
|
||||
int casterId = analysisSourceData.getCaster();
|
||||
UserBloodySnpInfo targetBloodySnpInfo = BattleManager.bloodMyHeroInfoMap.get(targetId);
|
||||
UserBloodySnpInfo casterBloodySnpInfo = BattleManager.bloodMyHeroInfoMap.get(casterId);
|
||||
String targetName = targetBloodySnpInfo.getName();
|
||||
String casterName = casterBloodySnpInfo.getName();
|
||||
scene.addCahceBroadMsg(MessageFormat.format(sBloodyMessagesConfig.getMessage(),new String[]{targetName,casterName}));
|
||||
}
|
||||
}
|
||||
return;
|
||||
}
|
||||
if(sBloodyMessagesConfig.getType() == AnalysisDataType.CONTINUOUS_KILL_NUMS.getType()){
|
||||
if(targetAnalysisData.getContinuousKillNums() == count){
|
||||
int id = targetAnalysisData.getId();
|
||||
UserBloodySnpInfo userBloodySnpInfo = BattleManager.bloodMyHeroInfoMap.get(id);
|
||||
String name = userBloodySnpInfo.getName();
|
||||
scene.addCahceBroadMsg(MessageFormat.format(sBloodyMessagesConfig.getMessage(),new String[]{name}));
|
||||
}
|
||||
return;
|
||||
}
|
||||
if(sBloodyMessagesConfig.getType() == AnalysisDataType.CONTINUOUS_DIED_NUMS.getType()){
|
||||
if(targetAnalysisData.getContinuousDeadNums() == count){
|
||||
int id = targetAnalysisData.getId();
|
||||
UserBloodySnpInfo userBloodySnpInfo = BattleManager.bloodMyHeroInfoMap.get(id);
|
||||
String name = userBloodySnpInfo.getName();
|
||||
scene.addCahceBroadMsg(MessageFormat.format(sBloodyMessagesConfig.getMessage(),new String[]{name}));
|
||||
}
|
||||
return;
|
||||
}
|
||||
if(sBloodyMessagesConfig.getType() == AnalysisDataType.END_CONTINUOUS_KILL_NUMS.getType()){
|
||||
int targetId = analysisSourceData.getTargetId();
|
||||
int casterId = analysisSourceData.getCaster();
|
||||
AnalysisData analysisData = scene.getAnalysisDataMap().get(casterId);
|
||||
if(analysisData.getContinuousKillNumsCache()>=sBloodyMessagesConfig.getType()){
|
||||
analysisData.cleanContinuousKillNumsCache();
|
||||
UserBloodySnpInfo targetBloodySnpInfo = BattleManager.bloodMyHeroInfoMap.get(targetId);
|
||||
UserBloodySnpInfo casterBloodySnpInfo = BattleManager.bloodMyHeroInfoMap.get(casterId);
|
||||
String targetName = targetBloodySnpInfo.getName();
|
||||
String casterName = casterBloodySnpInfo.getName();
|
||||
scene.addCahceBroadMsg(MessageFormat.format(sBloodyMessagesConfig.getMessage(),new String[]{targetName,casterName}));
|
||||
}
|
||||
return;
|
||||
}
|
||||
if(sBloodyMessagesConfig.getType() == AnalysisDataType.SEND_TO_DEATH.getType()){
|
||||
if(targetAnalysisData.getContinuousDeadNums() >= count){
|
||||
int id = targetAnalysisData.getId();
|
||||
UserBloodySnpInfo userBloodySnpInfo = BattleManager.bloodMyHeroInfoMap.get(id);
|
||||
String name = userBloodySnpInfo.getName();
|
||||
scene.addCahceBroadMsg(MessageFormat.format(sBloodyMessagesConfig.getMessage(),new String[]{name}));
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,12 +1,40 @@
|
|||
package com.ljsd.jieling.battle.statics;
|
||||
|
||||
import com.ljsd.jieling.battle.BattleManager;
|
||||
import com.ljsd.jieling.battle.UserBloodySnpInfo;
|
||||
import com.ljsd.jieling.battle.actor.Scene;
|
||||
import com.ljsd.jieling.config.SBloodyMessagesConfig;
|
||||
|
||||
import java.text.MessageFormat;
|
||||
import java.util.List;
|
||||
|
||||
public class DiggerAnalysisProcessor implements AnalysisProcessor{
|
||||
|
||||
@Override
|
||||
public void process(Scene scene, AnalysisSourceData analysisSourceData) {
|
||||
AnalysisData analysisData = scene.getAnalysisDataMap().get(analysisSourceData.getTargetId());
|
||||
analysisData.digger();
|
||||
int value = analysisSourceData.getValue();
|
||||
if(value == -1){
|
||||
analysisData.clearDigger();
|
||||
}else{
|
||||
analysisData.digger();
|
||||
}
|
||||
analysis(scene,analysisData,analysisSourceData);
|
||||
}
|
||||
|
||||
public void analysis(Scene scene,AnalysisData targetAnalysisData,AnalysisSourceData analysisSourceData){
|
||||
List<SBloodyMessagesConfig> sBloodyMessagesConfigs = MessageBoxUtils.analysisEventTypeAnalysisDataTypeMap.get(AnalysisEventType.DIGGER);
|
||||
for(SBloodyMessagesConfig sBloodyMessagesConfig : sBloodyMessagesConfigs){
|
||||
int count = sBloodyMessagesConfig.getCount();
|
||||
if(sBloodyMessagesConfig.getType() == AnalysisDataType.DIGGER_NUMS.getType()){
|
||||
if(targetAnalysisData.getDiggerTimes() == count){
|
||||
int id = targetAnalysisData.getId();
|
||||
UserBloodySnpInfo userBloodySnpInfo = BattleManager.bloodMyHeroInfoMap.get(id);
|
||||
String name = userBloodySnpInfo.getName();
|
||||
scene.addCahceBroadMsg(MessageFormat.format(sBloodyMessagesConfig.getMessage(),new String[]{name}));
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,18 +1,39 @@
|
|||
package com.ljsd.jieling.battle.statics;
|
||||
|
||||
import com.ljsd.jieling.battle.actor.Scene;
|
||||
import com.ljsd.jieling.config.SBloodyMessagesConfig;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
public class MessageBoxUtils {
|
||||
private static Map<AnalysisEventType,AnalysisProcessor> analysisEventTypeIntegerMap = new HashMap<>();
|
||||
public static Map<AnalysisEventType, List<SBloodyMessagesConfig>> analysisEventTypeAnalysisDataTypeMap = new HashMap<>();
|
||||
static {
|
||||
//更新统计数据 数据汇总聚合
|
||||
analysisEventTypeIntegerMap.put(AnalysisEventType.BATTLE,new BattleAnalysisProcessor());
|
||||
analysisEventTypeIntegerMap.put(AnalysisEventType.DIGGER,new DiggerAnalysisProcessor());
|
||||
}
|
||||
|
||||
public static void init(){
|
||||
Map<Integer, SBloodyMessagesConfig> sBloodyMessagesConfigMap = SBloodyMessagesConfig.sBloodyMessagesConfigMap;
|
||||
analysisEventTypeAnalysisDataTypeMap.put(AnalysisEventType.BATTLE,new ArrayList<>());
|
||||
analysisEventTypeAnalysisDataTypeMap.put(AnalysisEventType.DIGGER,new ArrayList<>());
|
||||
for(SBloodyMessagesConfig sBloodyMessagesConfig:sBloodyMessagesConfigMap.values()){
|
||||
int type = sBloodyMessagesConfig.getType();
|
||||
if(type == AnalysisDataType.DIGGER_NUMS.getType()){
|
||||
analysisEventTypeAnalysisDataTypeMap.get(AnalysisEventType.DIGGER).add(sBloodyMessagesConfig);
|
||||
continue;
|
||||
}
|
||||
analysisEventTypeAnalysisDataTypeMap.get(AnalysisEventType.BATTLE).add(sBloodyMessagesConfig);
|
||||
}
|
||||
}
|
||||
|
||||
public static void onGameEvent(AnalysisEventType type){
|
||||
|
||||
public static void onGameEvent(AnalysisEventType type, Scene scene,AnalysisSourceData analysisSourceData){
|
||||
AnalysisProcessor analysisProcessor = analysisEventTypeIntegerMap.get(type);
|
||||
analysisProcessor.process(scene,analysisSourceData);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -0,0 +1,33 @@
|
|||
package com.ljsd.jieling.config;
|
||||
|
||||
import com.ljsd.jieling.logic.STableManager;
|
||||
import com.ljsd.jieling.logic.Table;
|
||||
|
||||
import java.util.Map;
|
||||
|
||||
@Table(name ="BloodyBattleReward")
|
||||
public class SBloodyBattleReward implements BaseConfig {
|
||||
|
||||
private int id;
|
||||
|
||||
private int score;
|
||||
|
||||
public static Map<Integer, SBloodyBattleReward> sBloodyBattleRewardMap;
|
||||
|
||||
|
||||
@Override
|
||||
public void init() throws Exception {
|
||||
sBloodyBattleRewardMap = STableManager.getConfig(SBloodyBattleReward.class);
|
||||
}
|
||||
|
||||
|
||||
public int getId() {
|
||||
return id;
|
||||
}
|
||||
|
||||
public int getScore() {
|
||||
return score;
|
||||
}
|
||||
|
||||
|
||||
}
|
|
@ -1,8 +1,12 @@
|
|||
package com.ljsd.jieling.config;
|
||||
|
||||
import com.ljsd.jieling.battle.statics.MessageBoxUtils;
|
||||
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 ="BloodyMessagesConfig")
|
||||
|
@ -18,10 +22,14 @@ public class SBloodyMessagesConfig implements BaseConfig {
|
|||
|
||||
private String message;
|
||||
|
||||
public static Map<Integer, List<SBloodyMessagesConfig>> sBloodyMessagesConfigByTypeMap;
|
||||
public static Map<Integer,SBloodyMessagesConfig> sBloodyMessagesConfigMap;
|
||||
|
||||
|
||||
@Override
|
||||
public void init() throws Exception {
|
||||
|
||||
sBloodyMessagesConfigMap = STableManager.getConfig(SBloodyMessagesConfig.class);
|
||||
MessageBoxUtils.init();
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -0,0 +1,51 @@
|
|||
package com.ljsd.jieling.config;
|
||||
|
||||
import com.ljsd.jieling.logic.STableManager;
|
||||
import com.ljsd.jieling.logic.Table;
|
||||
|
||||
import java.util.Map;
|
||||
|
||||
@Table(name ="BloodyRankConfig")
|
||||
public class SBloodyRankConfig implements BaseConfig {
|
||||
|
||||
private int id;
|
||||
|
||||
private int rank;
|
||||
|
||||
private int stage;
|
||||
|
||||
private int score;
|
||||
|
||||
private int[][] reward;
|
||||
|
||||
private static Map<Integer, SBloodyRankConfig> sBloodyRankConfigMap;
|
||||
|
||||
|
||||
@Override
|
||||
public void init() throws Exception {
|
||||
sBloodyRankConfigMap = STableManager.getConfig(SBloodyRankConfig.class);
|
||||
}
|
||||
|
||||
|
||||
public int getId() {
|
||||
return id;
|
||||
}
|
||||
|
||||
public int getRank() {
|
||||
return rank;
|
||||
}
|
||||
|
||||
public int getStage() {
|
||||
return stage;
|
||||
}
|
||||
|
||||
public int getScore() {
|
||||
return score;
|
||||
}
|
||||
|
||||
public int[][] getReward() {
|
||||
return reward;
|
||||
}
|
||||
|
||||
|
||||
}
|
|
@ -154,6 +154,8 @@ public class RedisKey {
|
|||
|
||||
public static final String SESSION_OFFLINE = "SESSION_OFFLINE";
|
||||
|
||||
public static final String BLOODY_RANK = "BLOODY_RANK";
|
||||
|
||||
public static String getKey(String type, String key, boolean withoutServerId) {
|
||||
if (withoutServerId) {
|
||||
return GameApplication.areaId + Delimiter_colon + type + Delimiter_colon + String.valueOf(key);
|
||||
|
|
|
@ -964,6 +964,9 @@ public class RedisUtil {
|
|||
|
||||
|
||||
public String getKey(String type,String key){
|
||||
if(RedisKey.BLOODY_RANK.equals(key)){
|
||||
return type + RedisKey.Delimiter_colon + key;
|
||||
}
|
||||
return GameApplication.serverId + RedisKey.Delimiter_colon + type + RedisKey.Delimiter_colon + key;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue