事件行为38

back_recharge
wangyuan 2019-06-13 15:27:17 +08:00
parent 10f745f37f
commit 1f396ec9a0
3 changed files with 37 additions and 2 deletions

View File

@ -97,6 +97,8 @@ public class EventType {
public static final int thirtyFive = 35;
public static final int thirtySix = 36;
public static final int thirtyEight = 38;
public static final int updatePonintEvent = 1;
public static final int fightEvent = 2;
public static final int shopEvent = 3;

View File

@ -0,0 +1,32 @@
package com.ljsd.jieling.handler.map.behavior;
import com.ljsd.jieling.handler.map.Cell;
import com.ljsd.jieling.handler.map.EventType;
import com.ljsd.jieling.logic.dao.root.User;
import com.ljsd.jieling.protocols.MapInfoProto;
import org.springframework.stereotype.Component;
import java.util.Map;
@Component
public class ThirtyEightBehavior extends BaseBehavior {
@Override
public int getBehaviorType() {
return EventType.thirtyEight;
}
@Override
public boolean process(int optionId, User user, int[][] behaviorTypeValues, MapInfoProto.EventUpdateResponse.Builder eventUpdateResponse) throws Exception {
BehaviorUtil.fightReady(user.getId(), behaviorTypeValues[0][0] + "#" + Integer.toString(optionId));
Map<Integer, Cell> mapInfos = user.getMapManager().getMapInfo();
for (Cell cell : mapInfos.values()) {
for(int i=1;i<behaviorTypeValues.length;i++)
if (cell.getPointId() == behaviorTypeValues[i][0]) {
cell.setEventId(behaviorTypeValues[i][1]);
user.getMapManager().addOrUpdateCell(cell.getCellId(), cell);
}
}
return true;
}
}

View File

@ -19,8 +19,9 @@ public class TwentyFourBehavior extends BaseBehavior {
public boolean process(int optionId, User user, int[][] behaviorTypeValues, MapInfoProto.EventUpdateResponse.Builder eventUpdateResponse) throws Exception {
Map<Integer, Cell> mapInfos = user.getMapManager().getMapInfo();
for (Cell cell : mapInfos.values()) {
if (cell.getPointId() == behaviorTypeValues[0][0]) {
cell.setEventId(behaviorTypeValues[0][1]);
for(int i=0;i<behaviorTypeValues.length;i++)
if (cell.getPointId() == behaviorTypeValues[i][0]) {
cell.setEventId(behaviorTypeValues[i][1]);
user.getMapManager().addOrUpdateCell(cell.getCellId(), cell);
}
}