Merge branch 'master' of http://60.1.1.230/backend/jieling_server
# Conflicts: # conf/server/RewardGroup.txt # conf/server/RewardItemConfig.txtback_recharge
commit
8e39b783f1
|
@ -93,7 +93,7 @@ int mut,int#int,2 mut,int#int,1
|
|||
103052 32 100001#100003
|
||||
103053 32 100005
|
||||
103054 32 100005#100003#100001
|
||||
1010001 1002#1003 100004#102005#102004
|
||||
1010001 1002#1003 100004#102005#102004#748
|
||||
1010002 1005#1006 100004#102002#102005
|
||||
1010003 1008#1009 100004#100003#102005#102004#102002#102001
|
||||
1010004 1011#1012 100004#102002#102005
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
package com.ljsd.jieling.globals;
|
||||
|
||||
public interface Global {
|
||||
int STAMINA = 2; // 体力id
|
||||
int SEND_CARD_COUNT = 20; // 每页发送卡牌个数
|
||||
int SEND_ITEM_COUNT = 200; // 每页发送道具个数
|
||||
int SEND_EQUIP_COUNT = 20; // 每页发送装备个数
|
||||
|
|
|
@ -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;
|
||||
switch (sOptionAddConditions.getType()) {
|
||||
// 1 完成事件点,即进度100%
|
||||
|
@ -1266,7 +1266,7 @@ public class MapLogic {
|
|||
return;
|
||||
}
|
||||
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);
|
||||
MessageUtil.sendErrorResponse(session,0, messageType.getNumber(), "阵容有误!!");
|
||||
return;
|
||||
|
|
|
@ -4,9 +4,14 @@ package com.ljsd.jieling.handler.map;
|
|||
import com.ljsd.common.mogodb.MongoBase;
|
||||
import com.ljsd.jieling.config.SGameSetting;
|
||||
import com.ljsd.jieling.core.GlobalsDef;
|
||||
import com.ljsd.jieling.globals.Global;
|
||||
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.util.ItemUtil;
|
||||
import com.ljsd.jieling.util.MathUtils;
|
||||
import com.ljsd.jieling.util.StringUtil;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.HashSet;
|
||||
|
@ -64,11 +69,6 @@ public class MapManager extends MongoBase {
|
|||
}
|
||||
|
||||
public void setCurMapId(int curMapId) throws Exception {
|
||||
if(curMapId == 0){
|
||||
setLastUpdateEnergyTime((int)(System.currentTimeMillis()/1000));
|
||||
}else{
|
||||
setLastUpdateEnergyTime(GlobalsDef.BATTLING);
|
||||
}
|
||||
updateString("curMapId", curMapId);
|
||||
this.curMapId = curMapId;
|
||||
}
|
||||
|
@ -205,18 +205,25 @@ public class MapManager extends MongoBase {
|
|||
|
||||
|
||||
|
||||
public int getEnergy() {
|
||||
if(curMapId==0 && energy< SGameSetting.getGameSetting().getInitialEnergy()){
|
||||
public static void getEnergy(User user) throws Exception {
|
||||
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[] energyRecoverSpeed = SGameSetting.getGameSetting().getEnergyRecoverSpeed();
|
||||
int addValue = (updateTime - lastUpdateEnergyTime)/60/energyRecoverSpeed[1] * energyRecoverSpeed[0];
|
||||
if(addValue != 0){
|
||||
int curEnergy = MathUtils.setBetweenWithMax(energy + addValue,0,SGameSetting.getGameSetting().getInitialEnergy());
|
||||
setEnergy(curEnergy);
|
||||
setLastUpdateEnergyTime(updateTime);
|
||||
int curEnergy = MathUtils.setBetweenWithMax(itemNum + addValue,0,SGameSetting.getGameSetting().getInitialEnergy());
|
||||
ItemUtil.drop(user, StringUtil.parseFiledInt2( Global.STAMINA+"#"+curEnergy));
|
||||
mapManager.setLastUpdateEnergyTime(updateTime);
|
||||
}
|
||||
}
|
||||
return energy;
|
||||
}
|
||||
|
||||
public void setLastUpdateEnergyTime(int lastUpdateEnergyTime) {
|
||||
|
|
|
@ -176,4 +176,8 @@ public class PlayerManager extends MongoBase {
|
|||
updateString("maxStamina", maxStamina);
|
||||
this.maxStamina = maxStamina;
|
||||
}
|
||||
|
||||
public int getMaxStamina() {
|
||||
return maxStamina;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -29,7 +29,7 @@ public class CBean2Proto {
|
|||
.setFamilyId(playerManager.getFamilyId())
|
||||
.setHead(playerManager.getHead())
|
||||
.setCurMapId((maxMapId == 0 && mapId == 0) ? 100 : mapId)
|
||||
.setEnergy(mapManager.getEnergy())
|
||||
.setEnergy(0)
|
||||
.setLastUpdateEnergyTime(mapManager.getLastUpdateEnergyTime())
|
||||
.setServerTime((int)(System.currentTimeMillis()/1000))
|
||||
.build();
|
||||
|
|
|
@ -1,6 +1,8 @@
|
|||
package com.ljsd.jieling.util;
|
||||
|
||||
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.handler.map.MapManager;
|
||||
import com.ljsd.jieling.handler.map.TemporaryItems;
|
||||
|
@ -366,6 +368,9 @@ public class ItemUtil {
|
|||
temporaryItemList = temporaryItems.items;
|
||||
}
|
||||
for (Map.Entry<Integer, Integer> userItem : useItemMap.entrySet()) {
|
||||
if ((userItem.getKey() == Global.STAMINA)){
|
||||
MapManager.getEnergy(user);
|
||||
}
|
||||
Item temporaryItem = temporaryItemList.get(userItem.getKey());
|
||||
int needCount = userItem.getValue();
|
||||
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) {
|
||||
return true;
|
||||
}
|
||||
|
@ -498,6 +503,9 @@ public class ItemUtil {
|
|||
for (Map.Entry<Integer, Integer> entry : itemMap.entrySet()) {
|
||||
Item temporaryItem = temporaryItemList.get(entry.getKey());
|
||||
if (temporaryItem == null || temporaryItem.getItemNum() < entry.getValue()) {
|
||||
if ((entry.getKey() == Global.STAMINA)){
|
||||
MapManager.getEnergy(user);
|
||||
}
|
||||
Item item = user.getItemManager().getItem(entry.getKey());
|
||||
if (item == null) {
|
||||
return false;
|
||||
|
@ -611,7 +619,7 @@ public class ItemUtil {
|
|||
* @param costItems
|
||||
* @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<>();
|
||||
selectCost(costItems,itemMap);
|
||||
boolean result = checkCost(user, itemMap);
|
||||
|
|
Loading…
Reference in New Issue