Merge branch 'master' of http://60.1.1.230/backend/jieling_server
commit
8bfa9dc498
|
@ -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,29 @@ 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.getValue().getType(),new TreeSet<>());
|
||||
treeSet.add(entry.getKey());
|
||||
if(!treeSet.contains(entry.getValue().getType())){
|
||||
type2List.put(entry.getValue().getType(),treeSet);
|
||||
}
|
||||
}
|
||||
|
||||
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 {
|
||||
|
|
|
@ -167,6 +167,10 @@ public class RedisKey {
|
|||
public static final String BLOODY_SERVER_INFO = "BLOODY_SERVER_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)) {
|
||||
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 {
|
|||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
}
|
|
@ -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) {
|
||||
|
@ -750,6 +757,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(itemType!=GlobalItemType.EQUIP||itemType!=GlobalItemType.ESPECIAL_EQUIP){
|
||||
continue;
|
||||
}
|
||||
int count = entry.getValue();
|
||||
for (int i = 0; i < count; i++) {
|
||||
if (user.getEquipManager().getEquipMap().size() >= gameSetting.getEquipNumlimit()) {
|
||||
|
@ -773,6 +784,28 @@ public class ItemUtil {
|
|||
dropBuilder.addAllEspecialEquipId(especialEquip);
|
||||
}
|
||||
|
||||
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<>();
|
||||
|
||||
// EQUIPSIGN_LIMIT
|
||||
|
||||
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) {
|
||||
StringBuilder reward = new StringBuilder();
|
||||
for (Map.Entry<Integer, Integer> entry :equipMap.entrySet()){
|
||||
|
@ -807,6 +840,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));
|
||||
}
|
||||
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue