事件行为38
parent
10f745f37f
commit
1f396ec9a0
|
@ -97,6 +97,8 @@ public class EventType {
|
||||||
public static final int thirtyFive = 35;
|
public static final int thirtyFive = 35;
|
||||||
public static final int thirtySix = 36;
|
public static final int thirtySix = 36;
|
||||||
|
|
||||||
|
public static final int thirtyEight = 38;
|
||||||
|
|
||||||
public static final int updatePonintEvent = 1;
|
public static final int updatePonintEvent = 1;
|
||||||
public static final int fightEvent = 2;
|
public static final int fightEvent = 2;
|
||||||
public static final int shopEvent = 3;
|
public static final int shopEvent = 3;
|
||||||
|
|
|
@ -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;
|
||||||
|
}
|
||||||
|
}
|
|
@ -19,8 +19,9 @@ public class TwentyFourBehavior extends BaseBehavior {
|
||||||
public boolean process(int optionId, User user, int[][] behaviorTypeValues, MapInfoProto.EventUpdateResponse.Builder eventUpdateResponse) throws Exception {
|
public boolean process(int optionId, User user, int[][] behaviorTypeValues, MapInfoProto.EventUpdateResponse.Builder eventUpdateResponse) throws Exception {
|
||||||
Map<Integer, Cell> mapInfos = user.getMapManager().getMapInfo();
|
Map<Integer, Cell> mapInfos = user.getMapManager().getMapInfo();
|
||||||
for (Cell cell : mapInfos.values()) {
|
for (Cell cell : mapInfos.values()) {
|
||||||
if (cell.getPointId() == behaviorTypeValues[0][0]) {
|
for(int i=0;i<behaviorTypeValues.length;i++)
|
||||||
cell.setEventId(behaviorTypeValues[0][1]);
|
if (cell.getPointId() == behaviorTypeValues[i][0]) {
|
||||||
|
cell.setEventId(behaviorTypeValues[i][1]);
|
||||||
user.getMapManager().addOrUpdateCell(cell.getCellId(), cell);
|
user.getMapManager().addOrUpdateCell(cell.getCellId(), cell);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue