位置修改

back_recharge
lvxinran 2019-07-15 17:20:05 +08:00
parent c919681cc2
commit 89affcf6c1
2 changed files with 14 additions and 1 deletions

View File

@ -96,6 +96,13 @@ public class BehaviorUtil {
return cellValue;
}
public static Cell addBehaviorInfo(int needDistoryPointId, MapManager mapManager, int xy) throws Exception {
MapPointConfig mapPointConfig = MapPointConfig.scMapEventMap.get(needDistoryPointId);
Cell cellValue = new Cell(xy, mapPointConfig.getInitialEventId(), mapPointConfig.getId());
mapManager.addOrUpdateCell(xy, cellValue);
return cellValue;
}
/**
*

View File

@ -1,14 +1,18 @@
package com.ljsd.jieling.handler.map.behavior;
import com.ljsd.jieling.db.mongo.MongoKey;
import com.ljsd.jieling.handler.map.*;
import com.ljsd.jieling.logic.dao.root.User;
import com.ljsd.jieling.protocols.CommonProto;
import com.ljsd.jieling.protocols.MapInfoProto;
import com.ljsd.jieling.util.CellUtil;
import com.ljsd.jieling.util.MathUtils;
import org.springframework.stereotype.Component;
import java.util.List;
import static com.ljsd.jieling.db.mongo.MongoKey.mapManager;
@Component
public class DunBehavior extends BaseBehavior {
@Override
@ -27,10 +31,12 @@ public class DunBehavior extends BaseBehavior {
randomBEvents.addAll(randomAEvents);
List<Integer> randomABPosList = MathUtils.randomForOneArray(behaviorTypeValues[3], randomBNums+randomANums);
for(Integer pos : randomABPosList){
Integer eventId = randomBEvents.remove(0);
eventUpdateResponse.addAddMapInfo(CommonProto.Cell.newBuilder()
.setCellId(pos)
.setPointId(randomBEvents.remove(0))
.setPointId(eventId)
.build());
BehaviorUtil.addBehaviorInfo(eventId,user.getMapManager(),pos);
}
}
return true;