# Conflicts:
#	conf/server/RewardGroup.txt
#	conf/server/RewardItemConfig.txt
back_recharge
jiahuiwen 2019-04-15 20:36:06 +08:00
commit 8e39b783f1
7 changed files with 37 additions and 17 deletions

View File

@ -93,7 +93,7 @@ int mut,int#int,2 mut,int#int,1
103052 32 100001#100003 103052 32 100001#100003
103053 32 100005 103053 32 100005
103054 32 100005#100003#100001 103054 32 100005#100003#100001
1010001 1002#1003 100004#102005#102004 1010001 1002#1003 100004#102005#102004#748
1010002 1005#1006 100004#102002#102005 1010002 1005#1006 100004#102002#102005
1010003 1008#1009 100004#100003#102005#102004#102002#102001 1010003 1008#1009 100004#100003#102005#102004#102002#102001
1010004 1011#1012 100004#102002#102005 1010004 1011#1012 100004#102002#102005

View File

@ -1,6 +1,7 @@
package com.ljsd.jieling.globals; package com.ljsd.jieling.globals;
public interface Global { public interface Global {
int STAMINA = 2; // 体力id
int SEND_CARD_COUNT = 20; // 每页发送卡牌个数 int SEND_CARD_COUNT = 20; // 每页发送卡牌个数
int SEND_ITEM_COUNT = 200; // 每页发送道具个数 int SEND_ITEM_COUNT = 200; // 每页发送道具个数
int SEND_EQUIP_COUNT = 20; // 每页发送装备个数 int SEND_EQUIP_COUNT = 20; // 每页发送装备个数

View File

@ -536,7 +536,7 @@ public class MapLogic {
} }
private int getNextPoint(User user, MapManager mapManager, int[][] jumpTypeValues, SOptionAddCondition sOptionAddConditions) { private int getNextPoint(User user, MapManager mapManager, int[][] jumpTypeValues, SOptionAddCondition sOptionAddConditions) throws Exception {
int nextEventId = 0; int nextEventId = 0;
switch (sOptionAddConditions.getType()) { switch (sOptionAddConditions.getType()) {
// 1 完成事件点即进度100% // 1 完成事件点即进度100%
@ -1266,7 +1266,7 @@ public class MapLogic {
return; return;
} }
List<TeamPosHeroInfo> teamPosHeroInfos = user.getTeamPosManager().getTeamPosForHero().get(teamId); List<TeamPosHeroInfo> teamPosHeroInfos = user.getTeamPosManager().getTeamPosForHero().get(teamId);
if (teamPosHeroInfos == null || teamPosHeroInfos.size() != 0){ if (teamPosHeroInfos == null || teamPosHeroInfos.size() == 0){
LOGGER.info("startLevelDifficultyFight==> uid={},fightId={},teamId={}",uid,fightId,teamId); LOGGER.info("startLevelDifficultyFight==> uid={},fightId={},teamId={}",uid,fightId,teamId);
MessageUtil.sendErrorResponse(session,0, messageType.getNumber(), "阵容有误!!"); MessageUtil.sendErrorResponse(session,0, messageType.getNumber(), "阵容有误!!");
return; return;

View File

@ -4,9 +4,14 @@ package com.ljsd.jieling.handler.map;
import com.ljsd.common.mogodb.MongoBase; import com.ljsd.common.mogodb.MongoBase;
import com.ljsd.jieling.config.SGameSetting; import com.ljsd.jieling.config.SGameSetting;
import com.ljsd.jieling.core.GlobalsDef; import com.ljsd.jieling.core.GlobalsDef;
import com.ljsd.jieling.globals.Global;
import com.ljsd.jieling.handler.mission.Mission; import com.ljsd.jieling.handler.mission.Mission;
import com.ljsd.jieling.logic.dao.Item;
import com.ljsd.jieling.logic.dao.PlayerManager;
import com.ljsd.jieling.logic.dao.root.User; import com.ljsd.jieling.logic.dao.root.User;
import com.ljsd.jieling.util.ItemUtil;
import com.ljsd.jieling.util.MathUtils; import com.ljsd.jieling.util.MathUtils;
import com.ljsd.jieling.util.StringUtil;
import java.util.HashMap; import java.util.HashMap;
import java.util.HashSet; import java.util.HashSet;
@ -64,11 +69,6 @@ public class MapManager extends MongoBase {
} }
public void setCurMapId(int curMapId) throws Exception { public void setCurMapId(int curMapId) throws Exception {
if(curMapId == 0){
setLastUpdateEnergyTime((int)(System.currentTimeMillis()/1000));
}else{
setLastUpdateEnergyTime(GlobalsDef.BATTLING);
}
updateString("curMapId", curMapId); updateString("curMapId", curMapId);
this.curMapId = curMapId; this.curMapId = curMapId;
} }
@ -205,18 +205,25 @@ public class MapManager extends MongoBase {
public int getEnergy() { public static void getEnergy(User user) throws Exception {
if(curMapId==0 && energy< SGameSetting.getGameSetting().getInitialEnergy()){ PlayerManager playerInfoManager = user.getPlayerInfoManager();
Map<Integer, Item> itemMap = user.getItemManager().getItemMap();
int itemNum =0;
if (itemMap.containsKey(Global.STAMINA)) {
itemNum = itemMap.get(Global.STAMINA).getItemNum();
}
MapManager mapManager = user.getMapManager();
int lastUpdateEnergyTime = mapManager.getLastUpdateEnergyTime();
if(itemNum < playerInfoManager.getMaxStamina()){
int updateTime = (int)(System.currentTimeMillis()/1000); int updateTime = (int)(System.currentTimeMillis()/1000);
int[] energyRecoverSpeed = SGameSetting.getGameSetting().getEnergyRecoverSpeed(); int[] energyRecoverSpeed = SGameSetting.getGameSetting().getEnergyRecoverSpeed();
int addValue = (updateTime - lastUpdateEnergyTime)/60/energyRecoverSpeed[1] * energyRecoverSpeed[0]; int addValue = (updateTime - lastUpdateEnergyTime)/60/energyRecoverSpeed[1] * energyRecoverSpeed[0];
if(addValue != 0){ if(addValue != 0){
int curEnergy = MathUtils.setBetweenWithMax(energy + addValue,0,SGameSetting.getGameSetting().getInitialEnergy()); int curEnergy = MathUtils.setBetweenWithMax(itemNum + addValue,0,SGameSetting.getGameSetting().getInitialEnergy());
setEnergy(curEnergy); ItemUtil.drop(user, StringUtil.parseFiledInt2( Global.STAMINA+"#"+curEnergy));
setLastUpdateEnergyTime(updateTime); mapManager.setLastUpdateEnergyTime(updateTime);
} }
} }
return energy;
} }
public void setLastUpdateEnergyTime(int lastUpdateEnergyTime) { public void setLastUpdateEnergyTime(int lastUpdateEnergyTime) {

View File

@ -176,4 +176,8 @@ public class PlayerManager extends MongoBase {
updateString("maxStamina", maxStamina); updateString("maxStamina", maxStamina);
this.maxStamina = maxStamina; this.maxStamina = maxStamina;
} }
public int getMaxStamina() {
return maxStamina;
}
} }

View File

@ -29,7 +29,7 @@ public class CBean2Proto {
.setFamilyId(playerManager.getFamilyId()) .setFamilyId(playerManager.getFamilyId())
.setHead(playerManager.getHead()) .setHead(playerManager.getHead())
.setCurMapId((maxMapId == 0 && mapId == 0) ? 100 : mapId) .setCurMapId((maxMapId == 0 && mapId == 0) ? 100 : mapId)
.setEnergy(mapManager.getEnergy()) .setEnergy(0)
.setLastUpdateEnergyTime(mapManager.getLastUpdateEnergyTime()) .setLastUpdateEnergyTime(mapManager.getLastUpdateEnergyTime())
.setServerTime((int)(System.currentTimeMillis()/1000)) .setServerTime((int)(System.currentTimeMillis()/1000))
.build(); .build();

View File

@ -1,6 +1,8 @@
package com.ljsd.jieling.util; package com.ljsd.jieling.util;
import com.ljsd.jieling.config.*; import com.ljsd.jieling.config.*;
import com.ljsd.jieling.globals.Global;
import com.ljsd.jieling.globals.GlobalGm;
import com.ljsd.jieling.globals.GlobalItemType; import com.ljsd.jieling.globals.GlobalItemType;
import com.ljsd.jieling.handler.map.MapManager; import com.ljsd.jieling.handler.map.MapManager;
import com.ljsd.jieling.handler.map.TemporaryItems; import com.ljsd.jieling.handler.map.TemporaryItems;
@ -366,6 +368,9 @@ public class ItemUtil {
temporaryItemList = temporaryItems.items; temporaryItemList = temporaryItems.items;
} }
for (Map.Entry<Integer, Integer> userItem : useItemMap.entrySet()) { for (Map.Entry<Integer, Integer> userItem : useItemMap.entrySet()) {
if ((userItem.getKey() == Global.STAMINA)){
MapManager.getEnergy(user);
}
Item temporaryItem = temporaryItemList.get(userItem.getKey()); Item temporaryItem = temporaryItemList.get(userItem.getKey());
int needCount = userItem.getValue(); int needCount = userItem.getValue();
if (temporaryItem != null) { if (temporaryItem != null) {
@ -486,7 +491,7 @@ public class ItemUtil {
} }
} }
public static boolean checkCost(User user, Map<Integer, Integer> itemMap) { public static boolean checkCost(User user, Map<Integer, Integer> itemMap) throws Exception {
if (itemMap == null) { if (itemMap == null) {
return true; return true;
} }
@ -498,6 +503,9 @@ public class ItemUtil {
for (Map.Entry<Integer, Integer> entry : itemMap.entrySet()) { for (Map.Entry<Integer, Integer> entry : itemMap.entrySet()) {
Item temporaryItem = temporaryItemList.get(entry.getKey()); Item temporaryItem = temporaryItemList.get(entry.getKey());
if (temporaryItem == null || temporaryItem.getItemNum() < entry.getValue()) { if (temporaryItem == null || temporaryItem.getItemNum() < entry.getValue()) {
if ((entry.getKey() == Global.STAMINA)){
MapManager.getEnergy(user);
}
Item item = user.getItemManager().getItem(entry.getKey()); Item item = user.getItemManager().getItem(entry.getKey());
if (item == null) { if (item == null) {
return false; return false;
@ -611,7 +619,7 @@ public class ItemUtil {
* @param costItems * @param costItems
* @return * @return
*/ */
public static boolean fightItemCost(User user,int[][] costItems) { public static boolean fightItemCost(User user,int[][] costItems) throws Exception {
Map<Integer, Integer> itemMap = new HashMap<>(); Map<Integer, Integer> itemMap = new HashMap<>();
selectCost(costItems,itemMap); selectCost(costItems,itemMap);
boolean result = checkCost(user, itemMap); boolean result = checkCost(user, itemMap);