Merge branch 'master' of 60.1.1.230:backend/jieling_server
# Conflicts: # serverlogic/src/main/java/com/ljsd/jieling/config/SBloodyBattleSetting.javaback_recharge
commit
78154b6adc
|
@ -78,14 +78,12 @@ public class SBloodyBattleSetting implements BaseConfig {
|
|||
private int baseScore;
|
||||
private int extraDiscount;
|
||||
|
||||
private int[][] openPeriod;
|
||||
|
||||
private int[][] scoreConversion;
|
||||
|
||||
private Map<Integer,int[]> debuffMap;
|
||||
private Map<Integer,int[]> monsterIndexMap;
|
||||
|
||||
private int[][] openPeriod;
|
||||
|
||||
private int[][] scoreConversion;
|
||||
|
||||
|
||||
@Override
|
||||
|
|
|
@ -5,6 +5,7 @@ import com.ljsd.jieling.logic.Table;
|
|||
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
import java.util.TreeSet;
|
||||
|
||||
@Table(name = "EquipSign")
|
||||
public class SEquipSign implements BaseConfig {
|
||||
|
@ -24,15 +25,31 @@ public class SEquipSign implements BaseConfig {
|
|||
private int resolve;
|
||||
|
||||
public static Map<Integer, SEquipSign> sEquipSignMap;
|
||||
private static Map<Integer, TreeSet<Integer>> type2List = new HashMap<>();
|
||||
|
||||
private static Map<Integer, Integer> equipExpMap = new HashMap<>();
|
||||
|
||||
@Override
|
||||
public void init() throws Exception {
|
||||
sEquipSignMap = STableManager.getConfig(SEquipSign.class);
|
||||
int sum = 0;
|
||||
|
||||
for (Map.Entry<Integer, SEquipSign> entry : sEquipSignMap.entrySet()) {
|
||||
sum += entry.getValue().getExperience();
|
||||
equipExpMap.put(entry.getKey(), sum);
|
||||
TreeSet<Integer> treeSet = type2List.getOrDefault(entry.getKey()/100,null);
|
||||
if(null==treeSet){
|
||||
treeSet= new TreeSet<>();
|
||||
type2List.put(entry.getKey()/100,treeSet);
|
||||
}
|
||||
treeSet.add(entry.getKey());
|
||||
|
||||
}
|
||||
|
||||
for (TreeSet<Integer> list:type2List.values()) {
|
||||
int sum = 0;
|
||||
for (Integer id : list) {
|
||||
SEquipSign sign = sEquipSignMap.get(id);
|
||||
sum += sign.getExperience();
|
||||
equipExpMap.put(id, sum);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -23,6 +23,8 @@ public class SSpecialConfig implements BaseConfig {
|
|||
public static final String BEASTS_RANKINGSHOWNUM = "Beasts_RankingShowNum";//兽潮来袭排行榜上榜显示排名
|
||||
public static final String ADVENTURE_RANKINGSHOWNUM = "Adventure_RankingShowNum";//外敌入侵排行榜上榜显示排名
|
||||
public static final String COMBAT_RANKINGSHOWNUM = "Combat_RankingShowNum";//战力排行榜上榜显示排名
|
||||
public static final String EQUIPSIGN_LIMIT = "EquipSign_limit";//仓库中的魂印上限
|
||||
|
||||
|
||||
@Override
|
||||
public void init() throws Exception {
|
||||
|
|
|
@ -168,6 +168,10 @@ public class RedisKey {
|
|||
public static final String BLOODY_PERSON_BATTLE_INFO = "BLOODY_PERSON_BATTLE_INFO";
|
||||
|
||||
public static String getKey(String type, String key, boolean withoutServerId) {
|
||||
if(RedisKey.TOKEN.equals(type)||RedisKey.USER_SERVER_INFO.equals(type)){
|
||||
return type + RedisKey.Delimiter_colon + key;
|
||||
}
|
||||
|
||||
if (withoutServerId) {
|
||||
return GameApplication.areaId + Delimiter_colon + type + Delimiter_colon + String.valueOf(key);
|
||||
} else {
|
||||
|
|
|
@ -976,6 +976,9 @@ public class RedisUtil {
|
|||
if(RedisKey.BLOODY_RANK.equals(type) || RedisKey.BLOODY_TEAM.equals(type) || RedisKey.PLAYER_INFO_CACHE.equals(type) || RedisKey.BLOODY_PERSON_BATTLE_INFO.equals(type)) {
|
||||
return type + RedisKey.Delimiter_colon + key;
|
||||
}
|
||||
if(RedisKey.TOKEN.equals(type)||RedisKey.USER_SERVER_INFO.equals(type)){
|
||||
return type + RedisKey.Delimiter_colon + key;
|
||||
}
|
||||
return GameApplication.serverId + RedisKey.Delimiter_colon + type + RedisKey.Delimiter_colon + key;
|
||||
}
|
||||
|
||||
|
@ -1043,7 +1046,4 @@ public class RedisUtil {
|
|||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
|
|
@ -163,7 +163,7 @@ public class GMRequestHandler extends BaseHandler{
|
|||
int itemId = sItem.getId();
|
||||
int itemType = sItem.getItemType();
|
||||
int itemNum = 9999;
|
||||
if(itemType == GlobalItemType.CARD ||itemType == GlobalItemType.EQUIP ||itemType == GlobalItemType.ESPECIAL_EQUIP){
|
||||
if(itemType == GlobalItemType.CARD ||itemType == GlobalItemType.EQUIP ||itemType == GlobalItemType.ESPECIAL_EQUIP||itemType==GlobalItemType.SOUL_MARK){
|
||||
itemNum =1;
|
||||
}
|
||||
gmDrop[i++] = new int[]{itemId,itemNum};
|
||||
|
|
|
@ -1,12 +1,15 @@
|
|||
package com.ljsd.jieling.handler;
|
||||
|
||||
import com.ljsd.GameApplication;
|
||||
import com.ljsd.jieling.db.redis.RedisKey;
|
||||
import com.ljsd.jieling.db.redis.RedisUtil;
|
||||
import com.ljsd.jieling.handler.map.MapLogic;
|
||||
import com.ljsd.jieling.ktbeans.KTRequestBeans.LoginParamType;
|
||||
import com.ljsd.jieling.ktbeans.KtEventUtils;
|
||||
import com.ljsd.jieling.ktbeans.parmsBean.ParamEventBean;
|
||||
import com.ljsd.jieling.ktbeans.*;
|
||||
import com.ljsd.jieling.ktbeans.parmsBean.*;
|
||||
import com.ljsd.jieling.logic.dao.UserRecentLoginInfo;
|
||||
import com.ljsd.jieling.logic.dao.root.User;
|
||||
import com.ljsd.jieling.logic.dao.UserManager;
|
||||
import com.ljsd.jieling.netty.cocdex.PacketNetData;
|
||||
|
@ -74,8 +77,6 @@ public class LoginRequestHandler extends BaseHandler<PlayerInfoProto.LoginReques
|
|||
KTEnvironmentUtil.addUserEnviromentInfo(userId,paramEnvironmentBean);
|
||||
|
||||
|
||||
|
||||
|
||||
//登陆注册入内存
|
||||
String openIdFront = loginRequest.getOpenId();
|
||||
String[] split = openIdFront.split("\\.");
|
||||
|
@ -88,11 +89,17 @@ public class LoginRequestHandler extends BaseHandler<PlayerInfoProto.LoginReques
|
|||
user = UserManager.userLogin(userId,openIdFront,"");
|
||||
}
|
||||
|
||||
String newToken = UserManager.getNewToken(userId);
|
||||
// String newToken = UserManager.getNewToken(userId);
|
||||
|
||||
UserRecentLoginInfo userRecentLoginInfo = new UserRecentLoginInfo(System.currentTimeMillis()/1000,user.getPlayerInfoManager().getLevel()
|
||||
,user.getPlayerInfoManager().getRootId()
|
||||
,user.getPlayerInfoManager().getNickName());
|
||||
RedisUtil.getInstence().putMapEntry(RedisKey.USER_SERVER_INFO,user.getPlayerInfoManager().getOpenId(),String.valueOf(GameApplication.serverId),userRecentLoginInfo);
|
||||
|
||||
PlayerInfoProto.LoginResponse loginResponse
|
||||
= PlayerInfoProto.LoginResponse.newBuilder()
|
||||
.setResultCode(0)
|
||||
.setNewToken(newToken)
|
||||
.setNewToken(String.valueOf(iSession.getToken()))
|
||||
.build();
|
||||
|
||||
try {
|
||||
|
|
|
@ -43,13 +43,13 @@ public class UpSoulEquipQuiickHandler extends BaseHandler<HeroInfoProto.UpQuickS
|
|||
|
||||
List<String> consumIds = new LinkedList<>();
|
||||
|
||||
int nextNeedExp = SEquipSign.getEquipExpMap().get(nextEcfg.getId());
|
||||
int nextNeedExp = SEquipSign.getEquipExpMap().get(sEcfg.getId());
|
||||
|
||||
int sumExp = soulEquip.getExp();
|
||||
int leve = soulEquip.getLevel();
|
||||
for (String equipId : upQuickSoulEquipRequest.getSoulEquipIdsList()) {
|
||||
SoulEquip equip = user.getEquipManager().getSoulEquipMap().get(equipId);
|
||||
if (null == equip || !StringUtil.isEmpty(equip.getHeroId())) {
|
||||
if (null == equip) {
|
||||
MessageUtil.sendErrorResponse(iSession, 0, MessageTypeProto.MessageType.UP_SOUL_EQUIP_RESPONSE_VALUE, "");
|
||||
return;
|
||||
}
|
||||
|
@ -59,7 +59,7 @@ public class UpSoulEquipQuiickHandler extends BaseHandler<HeroInfoProto.UpQuickS
|
|||
}
|
||||
sumExp += sEquipSign1.getResolve();
|
||||
consumIds.add(equipId);
|
||||
if (sumExp > nextNeedExp) {
|
||||
if (sumExp >= nextNeedExp) {
|
||||
leve+=1;
|
||||
addleve+=1;
|
||||
SEquipSign nextEcfg1 = SEquipSign.getsEquipSignMap().get(equip.getCfgId()+addleve);
|
||||
|
|
|
@ -2649,9 +2649,9 @@ public class MapLogic {
|
|||
int[][] bossType = config.getRandomBossType();
|
||||
|
||||
type = MathUtils.randomFromWeight(bossType);
|
||||
if(mapManager.getTower()%5!=0){
|
||||
type = 3;
|
||||
}
|
||||
// if(mapManager.getTower()%5!=0){
|
||||
// type = 3;
|
||||
// }
|
||||
LOGGER.info("trigger!!!!!!!!!!!!!!!!!-------->{},{}",CellUtil.pos2XY(mapManager.getCurXY())[0],CellUtil.pos2XY(mapManager.getCurXY())[1]);
|
||||
int[][][] pointId = config.getRandomMapPointId();
|
||||
int mapId = config.getMapId();
|
||||
|
|
|
@ -1,7 +1,9 @@
|
|||
package com.ljsd.jieling.handler.map;
|
||||
|
||||
import com.ljsd.jieling.logic.dao.Equip;
|
||||
import com.ljsd.jieling.logic.dao.EspecialEquip;
|
||||
import com.ljsd.jieling.logic.dao.Item;
|
||||
import com.ljsd.jieling.logic.dao.SoulEquip;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.HashSet;
|
||||
|
@ -14,4 +16,8 @@ public class TemporaryItems {
|
|||
|
||||
public Set<Equip> equips = new HashSet<>();
|
||||
|
||||
public Set<EspecialEquip> especialEquips = new HashSet<>();
|
||||
|
||||
public Set<SoulEquip> soulEquips = new HashSet<>();
|
||||
|
||||
}
|
||||
|
|
|
@ -2,6 +2,7 @@ package com.ljsd.jieling.handler.room;
|
|||
|
||||
import com.google.gson.Gson;
|
||||
import com.ljsd.jieling.bloody.UserBloodySnpInfo;
|
||||
import com.ljsd.jieling.config.SBloodyBattleSetting;
|
||||
import com.ljsd.jieling.core.GlobalsDef;
|
||||
import com.ljsd.jieling.db.redis.RedisKey;
|
||||
import com.ljsd.jieling.db.redis.RedisUtil;
|
||||
|
@ -23,10 +24,12 @@ import com.ljsd.jieling.protocols.RoomProto;
|
|||
import com.ljsd.jieling.thrift.pool.ServiceKey;
|
||||
import com.ljsd.jieling.util.MessageUtil;
|
||||
import com.ljsd.jieling.util.StringUtil;
|
||||
import com.ljsd.jieling.util.TimeUtils;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import java.util.Calendar;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
|
@ -41,6 +44,7 @@ public class RoomMatchRequestHandler extends BaseHandler{
|
|||
|
||||
@Override
|
||||
public void process(ISession iSession, PacketNetData netData) throws Exception {
|
||||
|
||||
byte[] message = netData.parseClientProtoNetData();
|
||||
RoomProto.RoomMatchRequest request = RoomProto.RoomMatchRequest.parseFrom(message);
|
||||
int type = request.getType();
|
||||
|
@ -48,7 +52,12 @@ public class RoomMatchRequestHandler extends BaseHandler{
|
|||
}
|
||||
|
||||
public void match(ISession iSession,int type) throws Exception {
|
||||
|
||||
int responseMsgId = MessageTypeProto.MessageType.ROOM_MATCH_RESPONSE_VALUE;
|
||||
if(!isEnter()){
|
||||
MessageUtil.sendErrorResponse(iSession,0,responseMsgId,"不在开启时间范围内");
|
||||
return;
|
||||
}
|
||||
int uid = iSession.getUid();
|
||||
String status = RedisUtil.getInstence().getObject(RedisKey.MATCH_UID_KEY + ":" + uid,String.class);
|
||||
if(!StringUtil.isEmpty(status)){
|
||||
|
@ -113,4 +122,23 @@ public class RoomMatchRequestHandler extends BaseHandler{
|
|||
String key = RedisUtil.getInstence().getKey(RedisKey.BLOODY_TEAM, Integer.toString(mine.getId()));
|
||||
RedisUtil.getInstence().set(key,gson.toJson(userBloodySnpInfo));
|
||||
}
|
||||
|
||||
private boolean isEnter(){
|
||||
SBloodyBattleSetting setting = SBloodyBattleSetting.sBloodyBattleSetting;
|
||||
int[][] openPeriod = setting.getOpenPeriod();
|
||||
Calendar calendar = Calendar.getInstance();
|
||||
int minute = calendar.get(Calendar.MINUTE);
|
||||
boolean enter = true;
|
||||
for(int i = 0;i<openPeriod.length;i++){
|
||||
if(TimeUtils.getHourOfDay()<openPeriod[i][0]/10000&&minute<openPeriod[i][0]%10000/1000){
|
||||
enter =false;
|
||||
continue;
|
||||
}
|
||||
if(TimeUtils.getHourOfDay()>=openPeriod[i][0]/10000&&minute>=openPeriod[i][0]%10000/1000){
|
||||
enter = false;
|
||||
continue;
|
||||
}
|
||||
}
|
||||
return enter;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -58,6 +58,9 @@ public class BloodLogic {
|
|||
HeroManager heroManager = user.getHeroManager();
|
||||
TeamPosManager teamPosManager = user.getTeamPosManager();
|
||||
List<TeamPosHeroInfo> teamPosHeroInfos = teamPosManager.getTeamPosForHero().get(teamId);
|
||||
if(teamPosHeroInfos==null){
|
||||
teamPosHeroInfos = teamPosManager.getTeamPosForHero().get(1);
|
||||
}
|
||||
Iterator<TeamPosHeroInfo> it = teamPosHeroInfos.iterator();
|
||||
Map<String, FamilyHeroInfo> heroAllAttribute = new HashMap<>();
|
||||
while (it.hasNext()) {
|
||||
|
|
|
@ -172,7 +172,7 @@ public class Hero extends MongoBase {
|
|||
|
||||
|
||||
public Map<Integer, String> getSoulEquipByPositionMap() {
|
||||
return equipByPositionMap;
|
||||
return soulEquipByPositionMap;
|
||||
}
|
||||
|
||||
public void updateSoulEquipPositionMap(int position,String equipId) throws Exception {
|
||||
|
|
|
@ -0,0 +1,51 @@
|
|||
package com.ljsd.jieling.logic.dao;
|
||||
|
||||
public class UserRecentLoginInfo {
|
||||
|
||||
private long loginTime;
|
||||
|
||||
private int level;
|
||||
|
||||
private int uid;
|
||||
|
||||
private String name;
|
||||
|
||||
public UserRecentLoginInfo(long loginTime, int level, int uid, String name) {
|
||||
this.loginTime = loginTime;
|
||||
this.level = level;
|
||||
this.uid = uid;
|
||||
this.name = name;
|
||||
}
|
||||
|
||||
public long getLoginTime() {
|
||||
return loginTime;
|
||||
}
|
||||
|
||||
public void setLoginTime(long loginTime) {
|
||||
this.loginTime = loginTime;
|
||||
}
|
||||
|
||||
public int getLevel() {
|
||||
return level;
|
||||
}
|
||||
|
||||
public void setLevel(int level) {
|
||||
this.level = level;
|
||||
}
|
||||
|
||||
public int getUid() {
|
||||
return uid;
|
||||
}
|
||||
|
||||
public void setUid(int uid) {
|
||||
this.uid = uid;
|
||||
}
|
||||
|
||||
public String getName() {
|
||||
return name;
|
||||
}
|
||||
|
||||
public void setName(String name) {
|
||||
this.name = name;
|
||||
}
|
||||
}
|
|
@ -67,12 +67,16 @@ public class GuildFightLogic {
|
|||
Family.FamilyDefendViewResponse.Builder response = Family.FamilyDefendViewResponse.newBuilder();
|
||||
SGuildSetting guildSetting = sGuildSetting;
|
||||
for (Map.Entry<Integer, Integer> entry : defendInfo.entrySet()) {
|
||||
int force = HeroLogic.getInstance().calTeamTotalForce(UserManager.getUser(entry.getKey()), 501, false);
|
||||
if(force==0){
|
||||
force = HeroLogic.getInstance().calTeamTotalForce(UserManager.getUser(entry.getKey()), 1, false);
|
||||
}
|
||||
int memberType = GuildLogic.getMemberType(entry.getKey(), guildInfo.getMembers());
|
||||
Family.FamilyDefendInfo.Builder defend = Family.FamilyDefendInfo.newBuilder();
|
||||
defend.setStarCount(guildSetting.getStarNum()[memberType-1]);
|
||||
defend.setUid(entry.getKey());
|
||||
defend.setBuildId(entry.getValue());
|
||||
defend.setCurForce(HeroLogic.getInstance().calTeamTotalForce(UserManager.getUser(entry.getKey()), 501, false));
|
||||
defend.setCurForce(force);
|
||||
response.addInfo(defend);
|
||||
}
|
||||
MessageUtil.sendMessage(session, 1, messageType.getNumber(), response.build(), true);
|
||||
|
@ -108,12 +112,19 @@ public class GuildFightLogic {
|
|||
}
|
||||
}else{
|
||||
List<TeamPosHeroInfo> teamPosHeroInfos = teamPosManager.getTeamPosForHero().get(501);
|
||||
if(teamPosHeroInfos==null){
|
||||
teamPosHeroInfos = teamPosManager.getTeamPosForHero().get(1);
|
||||
}
|
||||
for(TeamPosHeroInfo heroInfo:teamPosHeroInfos){
|
||||
team.addHeroTid(user.getHeroManager().getHero(heroInfo.getHeroId()).getTemplateId());
|
||||
}
|
||||
}
|
||||
oneInfo.setTeam(team);
|
||||
oneInfo.setTotalForce(HeroLogic.getInstance().calTeamTotalForce(user, 501, false));
|
||||
int force = HeroLogic.getInstance().calTeamTotalForce(user, 501, false);
|
||||
if(force==0){
|
||||
force = HeroLogic.getInstance().calTeamTotalForce(user, 1, false);
|
||||
}
|
||||
oneInfo.setTotalForce(force);
|
||||
if (teamPosManager.getTeamPosForPoken().get(1) != null && teamPosManager.getTeamPosForPoken().get(1).size() > 0) {
|
||||
for (TeamPosForPokenInfo posForPokenInfo : teamPosManager.getTeamPosForPoken().get(1)) {
|
||||
oneInfo.addPokemonInfos(posForPokenInfo.getPokenId());
|
||||
|
@ -171,6 +182,10 @@ public class GuildFightLogic {
|
|||
fightInfo.addBuildBuff(buffInfo);
|
||||
}
|
||||
for (Map.Entry<Integer, Integer> entry : defendInfo.entrySet()) {
|
||||
int force = HeroLogic.getInstance().calTeamTotalForce(UserManager.getUser(entry.getKey()), 501, false);
|
||||
if(force==0){
|
||||
force = HeroLogic.getInstance().calTeamTotalForce(UserManager.getUser(entry.getKey()), 1, false);
|
||||
}
|
||||
Family.FamilyFightPlayerInfo.Builder playerInfo = Family.FamilyFightPlayerInfo.newBuilder();
|
||||
playerInfo.setBuildId(entry.getValue());
|
||||
playerInfo.setStarCount(fightValues.get(entry.getKey()).getStarCount());
|
||||
|
@ -180,7 +195,7 @@ public class GuildFightLogic {
|
|||
.setUserName(playerManager.getNickName())
|
||||
.setUserLevel(playerManager.getLevel())
|
||||
.setPosition(GuildLogic.getMemberType(entry.getKey(),GuilidManager.guildInfoMap.get(guildId).getMembers()))
|
||||
.setSoulForce(HeroLogic.getInstance().calTeamTotalForce(UserManager.getUser(entry.getKey()), 501, false))
|
||||
.setSoulForce(force)
|
||||
.setHead(playerManager.getHead())
|
||||
.setFrame(playerManager.getHeadFrame())
|
||||
.setContribute(0);
|
||||
|
@ -589,7 +604,7 @@ public class GuildFightLogic {
|
|||
}
|
||||
}
|
||||
//清除布防信息
|
||||
GuilidManager.guildInfoMap.get(Integer.valueOf(index)).removeAllDefendInfo();
|
||||
// GuilidManager.guildInfoMap.get(Integer.valueOf(index)).removeAllDefendInfo();
|
||||
}
|
||||
redisUtil.del(matchingKey);
|
||||
redisUtil.del(attackCountKey);
|
||||
|
|
|
@ -1425,7 +1425,7 @@ public class HeroLogic {
|
|||
throw new Exception("装备配置不存在" + soulEquip.getCfgId());
|
||||
}
|
||||
|
||||
if(currentType.keySet().contains(soulEquipPos.getPosition())&¤tType.get(soulEquipPos.getEquipId())!=cfg.getType()){
|
||||
if(currentType.keySet().contains(soulEquipPos.getPosition())&¤tType.get(soulEquipPos.getPosition())!=cfg.getType()){
|
||||
if(currentType.values().contains(cfg.getType())){
|
||||
continue;
|
||||
}
|
||||
|
@ -1433,6 +1433,11 @@ public class HeroLogic {
|
|||
currentType.put(soulEquipPos.getPosition(),cfg.getType());
|
||||
}
|
||||
|
||||
for (HeroInfoProto.SoulEquipPos soulEquipPos : equipIds) {
|
||||
SoulEquip soulEquip = user.getEquipManager().getSoulEquipMap().get(soulEquipPos.getEquipId());
|
||||
soulEquip.setHeroId(heroId);
|
||||
}
|
||||
|
||||
for (HeroInfoProto.SoulEquipPos soulEquipPos : equipIds) {
|
||||
hero.updateSoulEquipPositionMap(soulEquipPos.getPosition(),soulEquipPos.getEquipId());
|
||||
}
|
||||
|
@ -1448,12 +1453,16 @@ public class HeroLogic {
|
|||
if (null == cfg) {
|
||||
return false;
|
||||
}
|
||||
if(user.getPlayerInfoManager().getLevel()<cfg.getOpenRules()[0]){
|
||||
return false;
|
||||
}
|
||||
if(hero.getStar()<cfg.getOpenRules()[1]){
|
||||
return false;
|
||||
if(cfg.getOpenRules()[0]==1){
|
||||
if(user.getPlayerInfoManager().getLevel()<cfg.getOpenRules()[1]){
|
||||
return false;
|
||||
}
|
||||
}else if(cfg.getOpenRules()[0]==2){
|
||||
if(hero.getStar()<cfg.getOpenRules()[1]){
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
@ -1464,7 +1473,7 @@ public class HeroLogic {
|
|||
Hero hero = user.getHeroManager().getHero(heroId);
|
||||
|
||||
if( hero == null || equips.isEmpty()){
|
||||
MessageUtil.sendErrorResponse(session,0,MessageTypeProto.MessageType.SOUL_EQUIP_UNLOAD_OPT_REQUEST_VALUE,"");
|
||||
MessageUtil.sendErrorResponse(session,0,MessageTypeProto.MessageType.SOUL_EQUIP_UNLOAD_OPT_RESPONSE_VALUE,"");
|
||||
return;
|
||||
}
|
||||
List<Integer> positions = new ArrayList<>();
|
||||
|
@ -1473,7 +1482,7 @@ public class HeroLogic {
|
|||
SoulEquip soulEquip = user.getEquipManager().getSoulEquipMap().get(soulEquipPos.getEquipId());
|
||||
if(null == soulEquip || StringUtil.isEmpty(soulEquip.getHeroId())){
|
||||
//未装备
|
||||
MessageUtil.sendErrorResponse(session,0,MessageTypeProto.MessageType.SOUL_EQUIP_UNLOAD_OPT_REQUEST_VALUE,"");
|
||||
MessageUtil.sendErrorResponse(session,0,MessageTypeProto.MessageType.SOUL_EQUIP_UNLOAD_OPT_RESPONSE_VALUE,"");
|
||||
return;
|
||||
}
|
||||
soulEquip.setHeroId("");
|
||||
|
@ -1484,7 +1493,7 @@ public class HeroLogic {
|
|||
hero.removeSoulEquip(position);
|
||||
}
|
||||
//发送成功消息
|
||||
MessageUtil.sendMessage(session,1,MessageTypeProto.MessageType.SOUL_EQUIP_UNLOAD_OPT_REQUEST_VALUE,null,true);
|
||||
MessageUtil.sendMessage(session,1,MessageTypeProto.MessageType.SOUL_EQUIP_UNLOAD_OPT_RESPONSE_VALUE,null,true);
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -505,6 +505,15 @@ public class ItemLogic {
|
|||
int currentPool = user.getEquipManager().getSoulEquipPool();
|
||||
|
||||
int[][] cost = time == 50 ? new int[1][]:new int[time][];
|
||||
|
||||
if(time==50){
|
||||
SEquipTalismanaLottery lottery = STableManager.getConfig(SEquipTalismanaLottery.class).get(currentPool);
|
||||
if (null == lottery) {
|
||||
throw new Exception("SEquipTalismanaLottery 配置不存在" + currentPool);
|
||||
}
|
||||
cost[0]=lottery.getRepeatedlyCost();
|
||||
}
|
||||
|
||||
int[] droplist = new int[time];
|
||||
for (int i = 0; i < time; i++) {
|
||||
SEquipTalismanaLottery lottery = STableManager.getConfig(SEquipTalismanaLottery.class).get(currentPool);
|
||||
|
|
|
@ -181,8 +181,8 @@ public class ProtocolsManager implements ProtocolsAbstract {
|
|||
}
|
||||
//检查token
|
||||
// if (checkToken(session,packetNetData) != 0 ){
|
||||
// MessageUtil.sendErrorCode(session,0,"您的账号token不正确,请退出游戏重新登陆!");
|
||||
// return;
|
||||
// MessageUtil.sendErrorCode(session,0,"您的账号token不正确,请退出游戏重新登陆!");
|
||||
// return;
|
||||
// }
|
||||
|
||||
if( packetNetData.getMsgId()== MessageTypeProto.MessageType.RECONNECT_REQUEST_VALUE){
|
||||
|
@ -274,12 +274,16 @@ public class ProtocolsManager implements ProtocolsAbstract {
|
|||
int uid = packetNetData.getUserId();
|
||||
int token = packetNetData.getToken();
|
||||
session.setUid(uid);
|
||||
/* String tokenKey = RedisKey.getKey(RedisKey.TOKEN, String.valueOf(uid),false);
|
||||
int serverToken = Integer.parseInt((String)RedisUtil.getInstence().get(tokenKey));
|
||||
if (token == serverToken){
|
||||
session.setToken(token);
|
||||
return true;
|
||||
}*/
|
||||
// String tokenKey = RedisKey.getKey(RedisKey.TOKEN, String.valueOf(uid),false);
|
||||
// if(null==tokenKey||tokenKey.isEmpty()){
|
||||
// return false;
|
||||
// }
|
||||
// int serverToken = Integer.parseInt((String)RedisUtil.getInstence().get(tokenKey));
|
||||
// if (token == serverToken){
|
||||
// session.setToken(token);
|
||||
// session.setUserLoginTime(System.currentTimeMillis()/1000);
|
||||
// return true;
|
||||
// }
|
||||
return true;
|
||||
}
|
||||
|
||||
|
|
|
@ -69,8 +69,7 @@ public class CBean2Proto {
|
|||
return itemProto;
|
||||
}
|
||||
|
||||
public static CommonProto.Hero getHero(Hero hero) throws Exception {
|
||||
Map<Integer, String> equipByPositionMap = hero.getEquipByPositionMap();
|
||||
public static CommonProto.Hero getHero(Hero hero) throws Exception { Map<Integer, String> equipByPositionMap = hero.getEquipByPositionMap();
|
||||
List<String> equipList = new ArrayList<>();
|
||||
if(equipByPositionMap!=null && !equipByPositionMap.isEmpty()){
|
||||
equipList.addAll(equipByPositionMap.values());
|
||||
|
|
|
@ -64,6 +64,7 @@ public class ItemUtil {
|
|||
addItem(user,itemMap,dropBuilder,reason);
|
||||
addCard(user,cardMap,dropBuilder,reason);
|
||||
addEquip(user,equipMap,dropBuilder,reason);
|
||||
addSoulEquip(user,equipMap,dropBuilder,reason);
|
||||
return dropBuilder;
|
||||
}
|
||||
|
||||
|
@ -81,6 +82,7 @@ public class ItemUtil {
|
|||
addItem(user,itemMap,dropBuilder,reason);
|
||||
addCard(user,cardMap,dropBuilder,reason);
|
||||
addEquip(user,equipMap,dropBuilder,reason);
|
||||
addSoulEquip(user,equipMap,dropBuilder,reason);
|
||||
return dropBuilder;
|
||||
}
|
||||
|
||||
|
@ -99,6 +101,7 @@ public class ItemUtil {
|
|||
addItem(user,itemMap,dropBuilder,reason);
|
||||
addCard(user,cardMap,dropBuilder,reason);
|
||||
addEquip(user,equipMap,dropBuilder,reason);
|
||||
addSoulEquip(user,equipMap,dropBuilder,reason);
|
||||
return dropBuilder;
|
||||
}
|
||||
|
||||
|
@ -114,6 +117,7 @@ public class ItemUtil {
|
|||
addItem(user,itemMap,dropBuilder,reason);
|
||||
addCard(user,cardMap,dropBuilder,reason);
|
||||
addEquip(user,equipMap,dropBuilder,reason);
|
||||
addSoulEquip(user,equipMap,dropBuilder,reason);
|
||||
}
|
||||
return dropBuilder;
|
||||
}
|
||||
|
@ -128,6 +132,7 @@ public class ItemUtil {
|
|||
addItem(user, itemMap, dropBuilder,reason);
|
||||
addCard(user, cardMap, dropBuilder,reason);
|
||||
addEquip(user, equipMap, dropBuilder,reason);
|
||||
addSoulEquip(user,equipMap,dropBuilder,reason);
|
||||
}
|
||||
|
||||
private static void combineRewardDropGroup(User user, int[] dropGroupIds, float dropRatio, Map<Integer, Integer> itemMap, Map<Integer, Integer> cardMap, Map<Integer, Integer> equipMap, Map<Integer, Integer> randomMap) {
|
||||
|
@ -181,6 +186,7 @@ public class ItemUtil {
|
|||
} else {
|
||||
addItem(user,itemMap,dropBuilder,reason);
|
||||
addEquip(user,equipMap,dropBuilder,reason);
|
||||
addSoulEquip(user,equipMap,dropBuilder,reason);
|
||||
}
|
||||
addCard(user,cardMap,dropBuilder,reason);
|
||||
return dropBuilder;
|
||||
|
@ -239,6 +245,7 @@ public class ItemUtil {
|
|||
addItem(user, itemMap, dropBuilder,reason);
|
||||
addCard(user, cardMap, dropBuilder,reason);
|
||||
addEquip(user, equipMap, dropBuilder,reason);
|
||||
addSoulEquip(user,equipMap,dropBuilder,reason);
|
||||
}
|
||||
|
||||
public static String getReward(Map<Integer, Integer> itemMap,Map<Integer, Integer> cardMap,Map<Integer, Integer> equipMap, Map<Integer,Integer> randomMap) {
|
||||
|
@ -496,6 +503,8 @@ public class ItemUtil {
|
|||
public static void addItemToTemporaryBag(User user, Map<Integer, Integer> itemMap, Map<Integer, Integer> equipMap, CommonProto.Drop.Builder dropBuilder) throws Exception {
|
||||
List<CommonProto.Item> itemProtoList = new ArrayList<>();
|
||||
List<CommonProto.Equip> equipProtoList = new ArrayList<>();
|
||||
List<CommonProto.Equip> especialEquip = new ArrayList<>();
|
||||
List<CommonProto.Equip> soulEquip = new ArrayList<>();
|
||||
MapManager mapManager = user.getMapManager();
|
||||
TemporaryItems temporaryItems = mapManager.getTemporaryItems();
|
||||
if (temporaryItems == null) {
|
||||
|
@ -520,9 +529,18 @@ public class ItemUtil {
|
|||
LOGGER.info("the uid={},the curMapId={},add item={},addItemNum={},totalItemNum={}",user.getId(),user.getMapManager().getCurMapId(),entry.getKey(),entry.getValue(),item.getItemNum());
|
||||
}
|
||||
Set<Equip> equips = temporaryItems.equips;
|
||||
Set<EspecialEquip> especialEquips = temporaryItems.especialEquips;
|
||||
Set<SoulEquip> soulEquips = temporaryItems.soulEquips;
|
||||
for (Map.Entry<Integer, Integer> entry : equipMap.entrySet()) {
|
||||
SEquipConfig sEquipConfig = SEquipConfig.getsEquipConfigById(entry.getKey());
|
||||
if (sEquipConfig == null) {
|
||||
Map<Integer, SEquipTalismana> sEquipTalismanaMap = SEquipTalismana.equipTalismanaStarMap.get(entry.getKey());
|
||||
if(sEquipTalismanaMap!=null&&sEquipTalismanaMap.size()>0){
|
||||
EspecialEquip tempEquip = new EspecialEquip(user.getId(),entry.getKey());
|
||||
especialEquip.add(CBean2Proto.getEquipProto(tempEquip));
|
||||
especialEquips.add(tempEquip);
|
||||
}
|
||||
|
||||
continue;
|
||||
}
|
||||
Equip equip = new Equip(user.getId(), entry.getKey());
|
||||
|
@ -530,10 +548,24 @@ public class ItemUtil {
|
|||
equipProtoList.add(CBean2Proto.getEquipProto(equip));
|
||||
LOGGER.info("the uid={},the curMapId={},add equip={},equipNum={},totalEquipNum={}",user.getId(),user.getMapManager().getCurMapId(),entry.getKey(),1,equips.size());
|
||||
}
|
||||
|
||||
for (Map.Entry<Integer, Integer> entry : equipMap.entrySet()) {
|
||||
SEquipSign sEquipSign = SEquipSign.getsEquipSignMap().get(entry.getKey()*100+1);
|
||||
if (sEquipSign == null) {
|
||||
continue;
|
||||
}
|
||||
SoulEquip soulEquip1 = new SoulEquip(user.getId(), entry.getKey());
|
||||
soulEquips.add(soulEquip1);
|
||||
equipProtoList.add(CBean2Proto.getEquipProto(soulEquip1));
|
||||
LOGGER.info("the uid={},the curMapId={},add equip={},equipNum={},totalEquipNum={}",user.getId(),user.getMapManager().getCurMapId(),entry.getKey(),1,equips.size());
|
||||
}
|
||||
|
||||
mapManager.setTemporaryItems(temporaryItems);
|
||||
if (dropBuilder != null) {
|
||||
dropBuilder.addAllItemlist(itemProtoList);
|
||||
dropBuilder.addAllEquipId(equipProtoList);
|
||||
dropBuilder.addAllEspecialEquipId(especialEquip);
|
||||
dropBuilder.addAllSoulEquip(soulEquip);
|
||||
}
|
||||
|
||||
if(!sendToFront.isEmpty()){
|
||||
|
@ -550,7 +582,8 @@ public class ItemUtil {
|
|||
public static void addTemporaryItemToBag(User user, TemporaryItems temporaryItems, boolean isVictory) throws Exception {
|
||||
Map<Integer, Item> items = temporaryItems.items;
|
||||
Set<Equip> equips = temporaryItems.equips;
|
||||
if (items.isEmpty() && equips.isEmpty()) {
|
||||
Set<EspecialEquip> especialEquips = temporaryItems.especialEquips;
|
||||
if (items.isEmpty() && equips.isEmpty() && especialEquips.isEmpty()) {
|
||||
return;
|
||||
}
|
||||
Map<Integer, Item> itemMap = user.getItemManager().getItemMap();
|
||||
|
@ -615,6 +648,10 @@ public class ItemUtil {
|
|||
user.getEquipManager().addEquip(user,equip);
|
||||
KtEventUtils.onKtEvent(user, ParamEventBean.UserItemEvent,BIReason.TEMPORARY_REWARD,GlobalsDef.addReason,sItem.getId(),1,-1);
|
||||
}
|
||||
for(EspecialEquip especialEquip:especialEquips){
|
||||
user.getEquipManager().addEspecialEquip(user,especialEquip);
|
||||
|
||||
}
|
||||
user.getMapManager().setTemporaryItems(null);
|
||||
if(!isVictory){
|
||||
String title = SErrorCodeEerverConfig.getI18NMessage("map_overtime_title");
|
||||
|
@ -722,12 +759,17 @@ public class ItemUtil {
|
|||
if (equipMap.isEmpty()) {
|
||||
return;
|
||||
}
|
||||
List<Integer> filter = new ArrayList<>();
|
||||
filter.add(GlobalItemType.EQUIP);
|
||||
filter.add(GlobalItemType.ESPECIAL_EQUIP);
|
||||
|
||||
SGameSetting gameSetting = SGameSetting.getGameSetting();
|
||||
int hasEquipNum = user.getEquipManager().getEquipMap().size();
|
||||
String title = SErrorCodeEerverConfig.getI18NMessage("equip_bag_limit_title");
|
||||
String content = SErrorCodeEerverConfig.getI18NMessage("equip_bag_limit_txt");
|
||||
|
||||
if (hasEquipNum >= gameSetting.getEquipNumlimit()){
|
||||
String reward = getLimitReward(equipMap);
|
||||
String reward = getLimitReward(equipMap,filter);
|
||||
int nowTime =(int) (TimeUtils.now()/1000);
|
||||
MailLogic.getInstance().sendMail(user.getId(),title,content,reward,nowTime,Global.MAIL_EFFECTIVE_TIME);
|
||||
return;
|
||||
|
@ -736,6 +778,10 @@ public class ItemUtil {
|
|||
List<CommonProto.Equip> equipList = new CopyOnWriteArrayList<>();
|
||||
List<CommonProto.Equip> especialEquip = new CopyOnWriteArrayList<>();
|
||||
for (Map.Entry<Integer, Integer> entry : equipMap.entrySet()) {
|
||||
int itemType = SItem.getsItemMap().get(entry.getKey()).getItemType();
|
||||
if(!filter.contains(itemType)){
|
||||
continue;
|
||||
}
|
||||
int count = entry.getValue();
|
||||
for (int i = 0; i < count; i++) {
|
||||
if (user.getEquipManager().getEquipMap().size() >= gameSetting.getEquipNumlimit()) {
|
||||
|
@ -759,9 +805,45 @@ public class ItemUtil {
|
|||
dropBuilder.addAllEspecialEquipId(especialEquip);
|
||||
}
|
||||
|
||||
private static String getLimitReward(Map<Integer, Integer> equipMap) {
|
||||
public static void addSoulEquip(User user, Map<Integer, Integer> equipMap, CommonProto.Drop.Builder dropBuilder,int reason) throws Exception {
|
||||
if (equipMap.isEmpty()) {
|
||||
return;
|
||||
}
|
||||
List<CommonProto.Equip> especialEquip = new CopyOnWriteArrayList<>();
|
||||
List<CommonProto.Equip> equipList = new CopyOnWriteArrayList<>();
|
||||
List<Integer> filter = new ArrayList<>();
|
||||
filter.add(GlobalItemType.SOUL_MARK);
|
||||
int limit = SSpecialConfig.getIntegerValue(SSpecialConfig.EQUIPSIGN_LIMIT);
|
||||
if (user.getEquipManager().getSoulEquipMap().size() >=limit){
|
||||
String title = SErrorCodeEerverConfig.getI18NMessage("EquipSign_bag_limit_title");
|
||||
String content = SErrorCodeEerverConfig.getI18NMessage("EquipSign_bag_limit_txt");
|
||||
String reward = getLimitReward(equipMap,filter);
|
||||
int nowTime =(int) (TimeUtils.now()/1000);
|
||||
MailLogic.getInstance().sendMail(user.getId(),title,content,reward,nowTime,Global.MAIL_EFFECTIVE_TIME);
|
||||
return;
|
||||
}
|
||||
|
||||
for (Map.Entry<Integer, Integer> entry : equipMap.entrySet()) {
|
||||
int itemType = SItem.getsItemMap().get(entry.getKey()).getItemType();
|
||||
if(itemType!=GlobalItemType.SOUL_MARK){
|
||||
continue;
|
||||
}
|
||||
int count = entry.getValue();
|
||||
for (int i = 0; i < count; i++) {
|
||||
addEquip(user, entry.getKey(), equipList,especialEquip);
|
||||
}
|
||||
}
|
||||
dropBuilder.addAllSoulEquip(equipList);
|
||||
}
|
||||
|
||||
private static String getLimitReward(Map<Integer, Integer> equipMap,List<Integer> filter) {
|
||||
|
||||
StringBuilder reward = new StringBuilder();
|
||||
for (Map.Entry<Integer, Integer> entry :equipMap.entrySet()){
|
||||
int itemType = SItem.getsItemMap().get(entry.getKey()).getItemType();
|
||||
if(null!=filter&&!filter.contains(itemType)){
|
||||
continue;
|
||||
}
|
||||
for (int i = 0; i < entry.getValue(); i++) {
|
||||
if (reward.length() == 0){
|
||||
reward = new StringBuilder(entry.getKey() + "#1");
|
||||
|
@ -793,6 +875,7 @@ public class ItemUtil {
|
|||
}else if(itemType==GlobalItemType.SOUL_MARK){
|
||||
SoulEquip soulEquip = new SoulEquip(user.getId(),equipId);
|
||||
equipManager.addSoulEquip(soulEquip);
|
||||
equipList.add(CBean2Proto.getEquipProto(soulEquip));
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -813,7 +896,7 @@ public class ItemUtil {
|
|||
String title = SErrorCodeEerverConfig.getI18NMessage("card_bag_limit_title");
|
||||
String content = SErrorCodeEerverConfig.getI18NMessage("card_bag_limit_txt");
|
||||
if (hasHeroNum >= gameSetting.getHeroNumlimit()){
|
||||
String reward = getLimitReward(cardMap);
|
||||
String reward = getLimitReward(cardMap,null);
|
||||
int nowTime =(int) (TimeUtils.now()/1000);
|
||||
MailLogic.getInstance().sendMail(user.getId(),title,content,reward,nowTime,Global.MAIL_EFFECTIVE_TIME);
|
||||
return;
|
||||
|
|
|
@ -19,19 +19,10 @@ public class MathUtils {
|
|||
private static final Random random = new Random();
|
||||
|
||||
|
||||
// public static void main(String[] args){
|
||||
// int[][] result = new int[10][];
|
||||
// for (int i = 0; i < result.length; i++) {
|
||||
// int[] j = new int[2];
|
||||
// j[0] = 10+i;
|
||||
// j[1] = 100;
|
||||
// result[i] = j;
|
||||
// }
|
||||
// int[] re = randomFromWeightWithTaking(result,10);
|
||||
// for(int i = 0 ; i <re.length;i++){
|
||||
// System.out.println(re[i]);
|
||||
// }
|
||||
// }
|
||||
public static void main(String[] args){
|
||||
String i = "0|00|111";
|
||||
String[] split = i.split("|", 1);
|
||||
}
|
||||
public static int randomForStrArray(String [] rateArray) {
|
||||
return randomStrArray(rateArray, -1);
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue