back_recharge
gaojie 2019-04-22 16:12:50 +08:00
commit f135001dac
21 changed files with 155 additions and 79 deletions

View File

@ -608,3 +608,4 @@ int int mut,int#int,1 int int
8150 1 32050#31050 5 0
55001 1 50401 1 0
55002 1 50402 1 0
100001 1 100001 1 0

View File

@ -29,7 +29,7 @@ local effectList = {
[1] = function(caster, target, args, interval)
local f1 = args[1]
local dt = args[2]
caster.Event:DispatchEvent(BattleEventName.RoleViewBullet, interval)
caster.Event:DispatchEvent(BattleEventName.RoleViewBullet, interval, target)
if caster.camp == 0 and target.camp == 1 then
BattleLogic.Event:DispatchEvent(BattleEventName.ZoomChange, target, interval)
end
@ -95,7 +95,7 @@ local effectList = {
end
for i=1, count do
BattleLogic.WaitForTrigger(d * (i-1), function ()
caster.Event:DispatchEvent(BattleEventName.RoleViewBullet, d)
caster.Event:DispatchEvent(BattleEventName.RoleViewBullet, d, target)
BattleLogic.WaitForTrigger(d, function ()
BattleUtil.CalDamage(caster, target, dt, f1)
end)
@ -142,6 +142,7 @@ local effectList = {
target.skill.sp = min(target.skill.sp + floor(target.skill.spPass * f1), target.skill.spPass)
end
end
target.Event:DispatchEvent(BattleEventName.RoleCDChanged, target.skill.sp, target.skill.spPass)
end
end)
end)
@ -163,7 +164,7 @@ local effectList = {
local f1 = args[1]
local dt = args[2]
local f2 = args[3]
caster.Event:DispatchEvent(BattleEventName.RoleViewBullet, interval)
caster.Event:DispatchEvent(BattleEventName.RoleViewBullet, interval, target)
if caster.camp == 0 and target.camp == 1 then
BattleLogic.Event:DispatchEvent(BattleEventName.ZoomChange, target, interval)
end
@ -179,7 +180,7 @@ local effectList = {
local dt = args[2]
local i1 = args[3]
local f2 = args[4]
caster.Event:DispatchEvent(BattleEventName.RoleViewBullet, interval)
caster.Event:DispatchEvent(BattleEventName.RoleViewBullet, interval, target)
if caster.camp == 0 and target.camp == 1 then
BattleLogic.Event:DispatchEvent(BattleEventName.ZoomChange, target, interval)
end
@ -220,7 +221,7 @@ local effectList = {
local rid = args[4]
local f3 = args[5]
local i1 = args[6]
caster.Event:DispatchEvent(BattleEventName.RoleViewBullet, interval)
caster.Event:DispatchEvent(BattleEventName.RoleViewBullet, interval, target)
BattleLogic.WaitForTrigger(interval, function ()
local layer
if BattleLogic.BuffMgr:HasBuff(target, BuffName.Brand, function (buff)
@ -245,7 +246,7 @@ local effectList = {
local f1 = args[1]
local dt = args[2]
local f2 = args[3]
caster.Event:DispatchEvent(BattleEventName.RoleViewBullet, interval)
caster.Event:DispatchEvent(BattleEventName.RoleViewBullet, interval, target)
if caster.camp == 0 and target.camp == 1 then
BattleLogic.Event:DispatchEvent(BattleEventName.ZoomChange, target, interval)
end
@ -277,7 +278,7 @@ local effectList = {
local dt = args[2]
local i1 = args[3]
local f2 = args[4] * (1 + caster:GetRoleData(RoleDataName.Hit) / (1 + target:GetRoleData(RoleDataName.Dodge)))
caster.Event:DispatchEvent(BattleEventName.RoleViewBullet, interval)
caster.Event:DispatchEvent(BattleEventName.RoleViewBullet, interval, target)
if caster.camp == 0 and target.camp == 1 then
BattleLogic.Event:DispatchEvent(BattleEventName.ZoomChange, target, interval)
end
@ -300,7 +301,7 @@ local effectList = {
local f1 = args[1]
local dt = args[2]
local f2 = args[3]
caster.Event:DispatchEvent(BattleEventName.RoleViewBullet, interval)
caster.Event:DispatchEvent(BattleEventName.RoleViewBullet, interval, target)
if caster.camp == 0 and target.camp == 1 then
BattleLogic.Event:DispatchEvent(BattleEventName.ZoomChange, target, interval)
end
@ -334,7 +335,7 @@ local effectList = {
end
for i=1, count do
BattleLogic.WaitForTrigger(d * (i-1), function ()
caster.Event:DispatchEvent(BattleEventName.RoleViewBullet, d)
caster.Event:DispatchEvent(BattleEventName.RoleViewBullet, d, target)
BattleLogic.WaitForTrigger(d, function ()
BattleUtil.CalDamage(caster, target, dt, f1)
end)
@ -348,7 +349,7 @@ local effectList = {
local dt = args[2]
local i1 = args[3]
local f2 = args[4]
caster.Event:DispatchEvent(BattleEventName.RoleViewBullet, interval)
caster.Event:DispatchEvent(BattleEventName.RoleViewBullet, interval, target)
if caster.camp == 0 and target.camp == 1 then
BattleLogic.Event:DispatchEvent(BattleEventName.ZoomChange, target, interval)
end
@ -398,7 +399,7 @@ local effectList = {
local dt = args[2]
local ht = args[3]
local f2 = args[4]
caster.Event:DispatchEvent(BattleEventName.RoleViewBullet, interval)
caster.Event:DispatchEvent(BattleEventName.RoleViewBullet, interval, target)
if caster.camp == 0 and target.camp == 1 then
BattleLogic.Event:DispatchEvent(BattleEventName.ZoomChange, target, interval)
end
@ -473,7 +474,7 @@ local effectList = {
local dt = args[2]
local dot = args[3]
local f2 = args[4]
caster.Event:DispatchEvent(BattleEventName.RoleViewBullet, interval)
caster.Event:DispatchEvent(BattleEventName.RoleViewBullet, interval, target)
if caster.camp == 0 and target.camp == 1 then
BattleLogic.Event:DispatchEvent(BattleEventName.ZoomChange, target, interval)
end
@ -501,7 +502,7 @@ local effectList = {
end
for i=1, count do
BattleLogic.WaitForTrigger(d * (i-1), function ()
caster.Event:DispatchEvent(BattleEventName.RoleViewBullet, d)
caster.Event:DispatchEvent(BattleEventName.RoleViewBullet, d, target)
BattleLogic.WaitForTrigger(d, function ()
if target.professionId == pt then
f1 = f1 + f2
@ -518,7 +519,7 @@ local effectList = {
local dt = args[2]
local ct = args[3]
local f2 = args[4]
caster.Event:DispatchEvent(BattleEventName.RoleViewBullet, interval)
caster.Event:DispatchEvent(BattleEventName.RoleViewBullet, interval, target)
if caster.camp == 0 and target.camp == 1 then
BattleLogic.Event:DispatchEvent(BattleEventName.ZoomChange, target, interval)
end
@ -566,6 +567,7 @@ local effectList = {
target.skill.sp = min(target.skill.sp + floor(target.skill.spPass * f1), target.skill.spPass)
end
end
target.Event:DispatchEvent(BattleEventName.RoleCDChanged, target.skill.sp, target.skill.spPass)
end
end
func()

View File

@ -215,13 +215,9 @@ function Skill:Cast()
BattleLogic.Event:DispatchEvent(BattleEventName.ZoomOut, 0.3)
end)
end
if chooseId == 10000 then --我方aoe
self.owner.Event:DispatchEvent(BattleEventName.AOE, 0)
for j=1, #arr do
takeEffect(self.owner, arr[j], effects, duration)
end
elseif chooseId == 20000 then --敌方aoe
self.owner.Event:DispatchEvent(BattleEventName.AOE, 1)
if chooseId == 10000 or chooseId == 20000 then --10000 我方aoe 20000 敌方aoe
local camp = chooseId == 10000 and self.owner.camp or 1 - self.owner.camp
self.owner.Event:DispatchEvent(BattleEventName.AOE, camp)
for j=1, #arr do
takeEffect(self.owner, arr[j], effects, duration)
end

View File

@ -198,6 +198,9 @@ function BattleLogic.InitAggro()
end
function BattleLogic.SetAggro(role)
if role.isTeam then
return
end
if role.camp == 1 then
playerAggro = role
BattleLogic.Event:DispatchEvent(BattleEventName.ZoomChange, role, 1)
@ -280,13 +283,13 @@ function BattleLogic.CurFrame()
return curFrame
end
function BattleLogic.Query(func)
function BattleLogic.Query(func, inCludeDeadRole)
local list = {}
local index = 1
if func then
for i=1, objList.size do
local v = objList.vList[i]
if func(v) and not v.isDead then
if func(v) and (inCludeDeadRole or not v.isDead) then
list[index] = v
index = index + 1
end
@ -364,6 +367,11 @@ function BattleLogic.Update()
local teamSkill = playerTeamSkillList[playerTeamSkillIndex]
if teamSkill then
teamSkill:Cast()
playerTeamSkillIndex = playerTeamSkillIndex + 1
if playerTeamSkillIndex > #playerTeamSkillList then
playerTeamSkillIndex = 1
end
playerMP = 0
end
end
end

View File

@ -27,6 +27,7 @@ BattleEventName = {
RoleDead = indexAdd(),
RoleRevive = indexAdd(),
RolePropertyChanged = indexAdd(),
RoleCDChanged = indexAdd(),
SkillCast = indexAdd(),

View File

@ -59,7 +59,7 @@ function RoleLogic:Init(uid, data)
Passivity[id](self, args)
end
self.isDead = self:GetRoleData(RoleDataName.Hp) == 0
self.isDead = self:GetRoleData(RoleDataName.Hp) <= 0
self.Auto = true
self.IsDebug = false
self.enable = true

View File

@ -44,11 +44,12 @@ public class GetPlayerInfoHandler extends BaseHandler{
User user = UserManager.getUser(userId);
// 需要隔天刷新的字段统一在这里处理
if (TimeUtils.isOverTime(5, user.getLoginTime())) {
user.setLoginTime(TimeUtils.now());
if (TimeUtils.isOverTime(5, user.getPlayerInfoManager().getLoginTime())) {
user.getPlayerInfoManager().setLoginTime(TimeUtils.now());
MapLogic.getInstance().resetDayInfo(user);
}
MapLogic.getInstance().checkIsInMap(user);
Map<Integer, Integer> guidePoints = user.getPlayerInfoManager().getGuidePoints();
List<CommonProto.NewPlayerGuidePoint> list = new ArrayList<>();
for(Map.Entry<Integer,Integer> guideItem : guidePoints.entrySet()){

View File

@ -18,6 +18,6 @@ public class MapBuyFightCountRequestHandler extends BaseHandler {
public void process(ISession iSession, PacketNetData netData) throws Exception {
byte[] message = netData.parseClientProtoNetData();
MapInfoProto.MapBuyFightCountRequest mapBuyFightCountRequest = MapInfoProto.MapBuyFightCountRequest.parseFrom(message);
MapLogic.getInstance().buyFightCount(iSession, mapBuyFightCountRequest.getBuyCount(), MessageTypeProto.MessageType.MAP_SWEEP_RESPONSE);
MapLogic.getInstance().buyFightCount(iSession, mapBuyFightCountRequest.getBuyCount(), MessageTypeProto.MessageType.MAP_BUY_FIGHT_COUNT_RESPONSE);
}
}

View File

@ -76,12 +76,7 @@ public class MapLogic {
MessageUtil.sendErrorResponse(iSession, 0, messageType.getNumber(), "");
return;
}
if (mapManager.getCurMapId() > 0) {
int leftTime = getLeftTime(user);
if (leftTime == 0) {
resetMapInfo(user, true);
}
}
checkIsInMap(user);
// 初始序章地图
if (user.getPlayerInfoManager().getMapId() == 0) {
String error = initTeamInfo(teamId, uid, user, mapManager);
@ -131,9 +126,9 @@ public class MapLogic {
// }
// }
SChallengeSetting sChallengeSetting = SChallengeSetting.challengeSetting;
if (mapManager.getDayFightCount() > sChallengeSetting.getLimit()) {
if (mapManager.getDayFightCount() >= sChallengeSetting.getLimit() + mapManager.getBuyFightCount()) {
LOGGER.info("enterMap() uid=>{} max fight count =>{} ", uid, mapManager.getDayFightCount());
MessageUtil.sendErrorResponse(iSession, 0, messageType.getNumber(), "");
MessageUtil.sendErrorResponse(iSession, 0, messageType.getNumber(), "请购买挑战次数");
return;
}
if (user.getPlayerInfoManager().getMapId() < mapId) {
@ -191,6 +186,19 @@ public class MapLogic {
}else{
LOGGER.error("the curmap={}",mapManager.getCurMapId());
}
List<TeamPosHeroInfo> teamPosHeroInfos = user.getTeamPosManager().getTeamPosForHero().get(teamId);
Map<String, Map<Integer, Integer>> heroAllAttributeMap = mapManager.getHeroAllAttributeMap();
for (TeamPosHeroInfo teamPosHeroInfo : teamPosHeroInfos) {
Map<Integer, Integer> map = heroAllAttributeMap.get(teamPosHeroInfo.getHeroId());
if (map == null) {
continue;
}
MapInfoProto.HeroInfo heroInfo = MapInfoProto.HeroInfo.newBuilder()
.setHeroId(teamPosHeroInfo.getHeroId())
.setHeroHp(map.get(HeroAttributeEnum.CurHP.getPropertyId()) == null ? 0 : map.get(HeroAttributeEnum.CurHP.getPropertyId()))
.build();
mapEnterResponse.addHeroInfos(heroInfo);
}
MessageUtil.sendMessage(iSession, 1, messageType.getNumber(), mapEnterResponse.build(), true);
}
@ -454,7 +462,6 @@ public class MapLogic {
int[][] behaviorTypeValues = sOptionConfig.getBehaviorTypeValues();
BaseBehavior baseBehavior = baseBehaviorMap.get(behaviorType);
MapInfoProto.EventUpdateResponse.Builder eventUpdateResponse = MapInfoProto.EventUpdateResponse.newBuilder();
int targetEventId = cell.getEventId();
if (baseBehavior != null) {
boolean isSuccess = baseBehavior.process(user, behaviorTypeValues, eventUpdateResponse);
if (!isSuccess) {
@ -523,10 +530,10 @@ public class MapLogic {
else if (cell != null && nextEventId != 0) {
cell.setEventId(nextEventId);
mapManager.addOrUpdateCell(cell.getCellId(), cell);
targetEventId = nextEventId;
}
updateMapMission(mapManager,EventType.updateEvent, targetEventId,0);
updateMapMission(mapManager,EventType.updateEvent, optionId,0);
LOGGER.info("optionId={}" ,optionId);
int totalWeight = updateMapMission(mapManager,EventType.updateEvent, pointId,0);
if (totalWeight >= 100) {
CrossInfo crossInfo = mapManager.getCrossInfoMap().get(mapManager.getCurMapId());
@ -829,7 +836,11 @@ public class MapLogic {
int[] checkResult = CheckFight.getInstance().checkFight(seed, getFightData, getOptionData);
List<Integer> remainHp = new ArrayList<>(5);
for (int i = 1; i < checkResult.length; i++) {
remainHp.add(checkResult[i]);
if (checkResult[i] <= 0) {
remainHp.add(0);
} else {
remainHp.add(checkResult[i]);
}
}
//校验结果码 1胜利
int resultCode = checkResult[0];
@ -850,6 +861,7 @@ public class MapLogic {
if (leftTime <= (int) (time / 1000)) {
resetMapInfo(user, false);
} else {
initTeamInfo(mapManager.getTeamId(), uid, user, mapManager);
List<TeamPosHeroInfo> teamPosHeroInfos = user.getTeamPosManager().getTeamPosForHero().get(mapManager.getTeamId());
for (TeamPosHeroInfo heroInfo : teamPosHeroInfos) {
Hero hero = user.getHeroManager().getHero(heroInfo.getHeroId());
@ -877,13 +889,14 @@ public class MapLogic {
// hero.setCurHp(checkResult[teamPosHeroInfo.getPosition()]);
mapManager.updateHeroOneAttribute(teamPosHeroInfo.getHeroId(),HeroAttributeEnum.CurHP.getPropertyId(),checkResult[teamPosHeroInfo.getPosition()]);
}
CommonProto.Drop.Builder drop = ItemUtil.drop(user, new int[0], 1, 1);
SMonsterGroup sMonsterGroup = SMonsterGroup.getsMonsterGroupMap().get(groupId);
CommonProto.Drop.Builder drop = ItemUtil.drop(user, sMonsterGroup.getRewardgroup(), 1, 1);
FightInfoProto.FastFightResponse.Builder fastFightResponse = FightInfoProto.FastFightResponse.newBuilder();
fastFightResponse.setEnventDrop(drop.build());
fastFightResponse.setResult(resultCode);
fastFightResponse.addAllRemainHpList(remainHp);
fastFightResponse.build();
if (!missionId.isEmpty()) {
if (!missionId.equals("0")) {
MapInfoProto.EventUpdateResponse.Builder eventUpdateResponse = MapInfoProto.EventUpdateResponse.newBuilder();
BehaviorUtil.updateMission(user, Integer.parseInt(missionId), eventUpdateResponse);
fastFightResponse.setMission(eventUpdateResponse.getMission());
@ -891,17 +904,19 @@ public class MapLogic {
fastFightResponse.setMissionDrop(eventUpdateResponse.getDrop());
}
}
if (!destroyId.isEmpty()) {
if (!destroyId.equals("0")) {
BehaviorUtil.destoryPoint(user, mapManager.getCurMapId(), Integer.parseInt(destroyId));
}
if (destoryXY != 0) {
BehaviorUtil.destoryApointXY(user, destoryXY);
}
if (!nextEventId.isEmpty()) {
if (!nextEventId.equals("0")) {
int triggerXY = mapManager.getTriggerXY();
cell = mapManager.getMapInfo().get(mapManager.getTriggerXY());
if (cell.getEventId() != -1) {
cell.setEventId(Integer.parseInt(nextEventId));
mapManager.addOrUpdateCell(triggerXY, cell);
updateMapMission(mapManager,EventType.updateEvent,cell.getEventId(),0);
}
}
// LOGGER.info("endFight() uid=>{},nextEventId=>{}", uid, nextEventId);
updateMapMission(mapManager,EventType.fightEvent,0, 1);
@ -1026,7 +1041,11 @@ public class MapLogic {
List<Integer> remainHp = new ArrayList<>(5);
for (int i = 1; i < checkResult.length; i++) {
remainHp.add(checkResult[i]);
if (checkResult[i] <= 0) {
remainHp.add(0);
} else {
remainHp.add(checkResult[i]);
}
}
//校验结果码 1胜利
int resultCode = checkResult[0];
@ -1104,7 +1123,6 @@ public class MapLogic {
if (cell != null) {
cell.setEventId(nextEventId);
mapManager.addOrUpdateCell(triggerXY, cell);
updateMapMission(mapManager,EventType.updateEvent,cell.getEventId(),0);
}
}
// LOGGER.info("endFight() uid=>{},nextEventId=>{}", uid, nextEventId);
@ -1425,9 +1443,15 @@ public class MapLogic {
// MessageUtil.sendErrorResponse(session,0, messageType.getNumber(), "");
// return;
// }
int dayFightCount = mapManager.getDayFightCount();
if (dayFightCount == 0) {
LOGGER.info("buyFightCount() uid=>{} dayFightCount == 0", uid);
MessageUtil.sendErrorResponse(session,0, messageType.getNumber(), "");
return;
}
int needGem = 0;
SChallengeSetting sChallengeSetting = SChallengeSetting.challengeSetting;
for (int i = 1; i < buyCount; i++) {
for (int i = 0; i < buyCount; i++) {
mapManager.setBuyFightCount(mapManager.getBuyFightCount() + 1);
needGem += MathUtils.calABX(mapManager.getBuyFightCount(), sChallengeSetting.getCost());
}
@ -1438,8 +1462,6 @@ public class MapLogic {
MessageUtil.sendErrorResponse(session,0, messageType.getNumber(), "");
return;
}
int dayFightCount = mapManager.getDayFightCount();
mapManager.setDayFightCount(dayFightCount - buyCount < 0 ? 0 : dayFightCount - buyCount);
MessageUtil.sendMessage(session, 1, messageType.getNumber(), null, true);
}
@ -1468,7 +1490,7 @@ public class MapLogic {
return;
}
SChallengeSetting sChallengeSetting = SChallengeSetting.challengeSetting;
if (mapManager.getDayFightCount() + count > sChallengeSetting.getLimit()) {
if (mapManager.getDayFightCount() + count > sChallengeSetting.getLimit() + mapManager.getBuyFightCount()) {
LOGGER.info("sweep over max count: {}", (mapManager.getDayFightCount() + count));
MessageUtil.sendErrorResponse(session,0, messageType.getNumber(), "");
return;
@ -1807,4 +1829,17 @@ public class MapLogic {
}
}
public void checkIsInMap(User user) throws Exception {
if (user.getMapManager().getCurMapId() == 0) {
return;
}
int leftTime = getLeftTime(user);
if (leftTime >= 0) {
return;
}
// TODO 发邮件
resetMapInfo(user, true);
}
}

View File

@ -159,12 +159,8 @@ public class MapManager extends MongoBase {
public void eatFood(int foodId,int remainStep){
int finalRemainStep = remainStep;
if(this.foodBufferMap.containsKey(foodId)){
finalRemainStep += this.foodBufferMap.get(foodId);
}
this.foodBufferMap.put(foodId,finalRemainStep);
updateString( "foodBuffers."+foodId, this.foodBufferMap.get(foodId));
this.foodBufferMap.put(foodId,remainStep);
updateString( "foodBuffers."+foodId, remainStep);
}

View File

@ -1,11 +1,14 @@
package com.ljsd.jieling.handler.map;
import com.ljsd.jieling.handler.BaseHandler;
import com.ljsd.jieling.logic.dao.UserManager;
import com.ljsd.jieling.logic.dao.root.User;
import com.ljsd.jieling.netty.cocdex.PacketNetData;
import com.ljsd.jieling.network.session.ISession;
import com.ljsd.jieling.protocols.FightInfoProto;
import com.ljsd.jieling.protocols.MapInfoProto;
import com.ljsd.jieling.protocols.MessageTypeProto;
import com.ljsd.jieling.util.MessageUtil;
import org.springframework.stereotype.Component;
@Component
@ -23,7 +26,15 @@ public class StartFightRequestHandler extends BaseHandler{
int type = fightStartRequest.getType();
int fightId = fightStartRequest.getFightId();
int teamId = fightStartRequest.getTeamId();
if (type ==1){
User user = UserManager.getUser(iSession.getUid());
int curMapId = user.getMapManager().getCurMapId();
if(curMapId>0){
MessageUtil.sendErrorResponse(iSession, 0, MessageTypeProto.MessageType.FIGHT_START_RESPONSE.getNumber(),"在地图探索中,不可以操作");
return;
}
MapLogic.getInstance().startLevelDifficultyFight(iSession,fightId,teamId,type,MessageTypeProto.MessageType.FIGHT_START_RESPONSE);
}else{
MapLogic.getInstance().startFight(iSession, MessageTypeProto.MessageType.FIGHT_START_RESPONSE);

View File

@ -16,7 +16,9 @@ public class OpenMissionBehavior extends BaseBehavior {
public boolean process(User user, int[][] behaviorTypeValues, MapInfoProto.EventUpdateResponse.Builder eventUpdateResponse) throws Exception {
BehaviorUtil.updateMission(user, behaviorTypeValues[0][0], eventUpdateResponse);
// 开新事件
BehaviorUtil.addBehaviorInfo(behaviorTypeValues[1][3], user.getMapManager(), behaviorTypeValues[1][0], behaviorTypeValues[1][1], behaviorTypeValues[1][2]);
for (int i = 1; i < behaviorTypeValues.length; i++) {
BehaviorUtil.addBehaviorInfo(behaviorTypeValues[i][3], user.getMapManager(), behaviorTypeValues[i][0], behaviorTypeValues[i][1], behaviorTypeValues[i][2]);
}
return true;
}
}

View File

@ -14,7 +14,9 @@ public class ThirtyBehavior extends BaseBehavior {
@Override
public boolean process(User user, int[][] behaviorTypeValues, MapInfoProto.EventUpdateResponse.Builder eventUpdateResponse) throws Exception {
BehaviorUtil.addBehaviorInfo(behaviorTypeValues[0][3], user.getMapManager(), behaviorTypeValues[0][0], behaviorTypeValues[0][1], behaviorTypeValues[0][2]);
for (int i = 0; i < behaviorTypeValues.length; i++) {
BehaviorUtil.addBehaviorInfo(behaviorTypeValues[i][3], user.getMapManager(), behaviorTypeValues[i][0], behaviorTypeValues[i][1], behaviorTypeValues[i][2]);
}
return true;
}
}

View File

@ -23,6 +23,7 @@ public class AdventureManager extends MongoBase {
public void station(AdventureStateInfo adventureStateInfo) throws Exception {
int position = adventureStateInfo.getPosition();
adventureStateInfo.init(getRootId(), getMongoKey() + ".adventureStateInfoMap."+ position);
updateString("adventureStateInfoMap." + position, adventureStateInfo);
adventureStateInfoMap.put(position,adventureStateInfo);
}

View File

@ -43,6 +43,8 @@ public class PlayerManager extends MongoBase {
private long offLineTime;// 离线时间
private long loginTime;
private Map<Integer,Integer> guidePoints = new HashMap<>();
public PlayerManager(){
@ -191,4 +193,13 @@ public class PlayerManager extends MongoBase {
updateString("offLineTime", offLineTime);
this.offLineTime = offLineTime;
}
public long getLoginTime() {
return loginTime;
}
public void setLoginTime(long loginTime) {
updateString("loginTime", loginTime);
this.loginTime = loginTime;
}
}

View File

@ -12,8 +12,6 @@ public class User {
private String id;
private long loginTime;
private PlayerManager playerManager;
private ItemManager itemManager;
@ -42,7 +40,6 @@ public class User {
public User(int uid){
this.id = Integer.toString(uid);
this.loginTime = TimeUtils.now();
this.playerManager = new PlayerManager();
this.itemManager = new ItemManager();
this.heroManager = new HeroManager();
@ -145,14 +142,6 @@ public class User {
return workShopController;
}
public long getLoginTime() {
return loginTime;
}
public void setLoginTime(long loginTime) {
this.loginTime = loginTime;
}
public LevelDifficultyManager getLevelDifficultyManager() {
return levelDifficultyManager;
}

View File

@ -48,6 +48,12 @@ public class CombatLogic {
FightInfoProto.GetAdventureStateInfoResponse response = FightInfoProto.GetAdventureStateInfoResponse.newBuilder().addAllAdventureStateInfoList(result).setDrop(dropBuilder.build()).setOutTime(offLineTime).
build();
MessageUtil.sendMessage(session,1, MessageTypeProto.MessageType.GET_ADVENTURE_INFO_RESPONSE_VALUE,response,true);
List<CommonProto.Item> itemlistList = dropBuilder.getItemlistList();
for(CommonProto.Item item: itemlistList){
LOGGER.info("the uid={},itemID={}itemNum={}",uid,item.getItemId(),item.getItemNum());
}
LOGGER.info("the uid={},offlineTimeLong={}",uid,offLineTime);
}
@ -141,8 +147,9 @@ public class CombatLogic {
adventureStateInfoTmp.setStartTime(startTime+times*adventureRefresh);
SAdventureConfig sAdventureConfig = SAdventureConfig.getSAdventureConfigByPosition(positionTmp);
int leaveBonus = sAdventureConfig.getLeaveBonus();
int maxTimes = leaveBonus * 3600 / adventureRefresh;
if(!isOnLine){
times = times>leaveBonus?leaveBonus:times;
times = times>maxTimes?maxTimes:times;
}
int baseRewardGroup[] = sAdventureConfig.getBaseRewardGroup();
float rewardRation = calRation(size,sAdventureConfig.getNumIncome());

View File

@ -680,7 +680,14 @@ public class HeroLogic {
}
public StringBuilder getHeroProperty(User user, Hero hero, StringBuilder sb){
Map<Integer, Integer> heroAttributeMap = calHeroFinalAttributeWhenInMap(user, hero);
int curMapId = user.getMapManager().getCurMapId();
Map<Integer, Integer> heroAttributeMap;
if(curMapId == 0){
heroAttributeMap=calHeroNotBufferAttribute(user, hero);
}else {
heroAttributeMap=calHeroFinalAttributeWhenInMap(user, hero);
}
sb.append(hero.getLevel()).append(DIVISION);
SCHero scHero = SCHero.getsCHero().get(hero.getTemplateId());
List<Integer> templatePropetyIds = transTemplateByHeroPropertyName.get(scHero.getPropertyName());

View File

@ -3,6 +3,8 @@ package com.ljsd.jieling.network.server;
import com.google.protobuf.GeneratedMessage;
import com.google.protobuf.InvalidProtocolBufferException;
import com.ljsd.GameApplication;
import com.ljsd.common.mogodb.LjsdMongoTemplate;
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.exception.ErrorCode;
@ -228,6 +230,7 @@ public class ProtocolsManager implements ProtocolsAbstract {
OnlineUserManager.userOffline(session.getUid());
User user = UserManager.getUser(session.getUid());
user.getPlayerInfoManager().setOffLineTime(System.currentTimeMillis());
MongoUtil.getInstence().lastUpdate();
// 下线处理的逻辑需要添加在这里
} catch (Exception e) {
e.printStackTrace();

View File

@ -251,6 +251,9 @@ public class ItemUtil {
if (sItem == null){
continue;
}
if(entry.getValue() == 0){
continue;
}
Item item = itemManager.getItem(entry.getKey());
if (item == null) {
item = itemManager.newItem(entry.getKey(), entry.getValue());

View File

@ -76,14 +76,14 @@ public class NettyClient {
return HeroInfoProto.HeroComposeRequest.newBuilder().setItem(item).build();
}
private static MessageLite useAndPriceItemRequest(int type ,int itemId , int itemNum) {
CommonProto.Item item = CommonProto.Item.newBuilder()
.setItemId(itemId)
.setItemNum(itemNum)
.build();
return PlayerInfoProto.UseAndPriceItemRequest.newBuilder().setType(type).setItem(item).build();
}
// private static MessageLite useAndPriceItemRequest(int type ,int itemId , int itemNum) {
// CommonProto.Item item = CommonProto.Item.newBuilder()
// .setItemId(itemId)
// .setItemNum(itemNum)
// .build();
// return PlayerInfoProto.UseAndPriceItemRequest.newBuilder().setType(type).setItem(item).build();
//
// }
public static HeroInfoProto.GetHeroListInfoRequest getHero(){
return HeroInfoProto.GetHeroListInfoRequest.newBuilder().setIndex(1).build();