Merge branch 'master_test_hw' into dh_dev_HavocInHeaven
commit
06a18387ed
|
@ -159,6 +159,14 @@ public class ChatLogic {
|
|||
break;
|
||||
}
|
||||
if(!result){
|
||||
char[] chars = message.toCharArray();
|
||||
char[] mes = new char[chars.length];
|
||||
mes[0] = chars[0];
|
||||
mes[1] = chars[1];
|
||||
for(int i=2;i<chars.length;i++){
|
||||
mes[i]='*';
|
||||
}
|
||||
tmp = new String(mes);
|
||||
ChatProto.ChatInfo chatInfo = CBean2Proto.getChatInfoBuilder(user,tmp,nowTime,-1);
|
||||
ChatProto.SendChatInfoResponse response = ChatProto.SendChatInfoResponse.newBuilder().setChatInfo(chatInfo).build();
|
||||
MessageUtil.sendMessage(iSession,1,msgId,response,true);
|
||||
|
|
|
@ -238,7 +238,7 @@ public class HandlerLogicThread extends Thread{
|
|||
}
|
||||
|
||||
public static boolean checkOpen(User user, SGlobalSystemConfig sGlobalSystemConfig) {
|
||||
if(!GlobalDataManaager.getInstance().checkIsOpen(sGlobalSystemConfig.getId())){
|
||||
if(sGlobalSystemConfig == null || !GlobalDataManaager.getInstance().checkIsOpen(sGlobalSystemConfig.getId())){
|
||||
return false;
|
||||
}
|
||||
int level = user.getPlayerInfoManager().getLevel();
|
||||
|
|
|
@ -63,7 +63,7 @@ public class CarDelayFunction implements FunctionManager {
|
|||
String value = item.getValue();
|
||||
int uid = Integer.parseInt(value);
|
||||
String rewardByRank = personRewardConfigTreeMap.floorEntry(rank).getValue();
|
||||
String personContent = SErrorCodeEerverConfig.getI18NMessage("family_fight_rank_personreward_txt",new Object[]{rank});
|
||||
String personContent = SErrorCodeEerverConfig.getI18NMessageNeedConvert("family_fight_rank_personreward_txt",new Object[]{rank},new int[]{0},"#");
|
||||
MailLogic.getInstance().sendMail(uid,personTitle,personContent,rewardByRank,nowTime, Global.MAIL_EFFECTIVE_TIME);
|
||||
if(times++%20==0){
|
||||
MongoUtil.getLjsdMongoTemplate().lastUpdate();
|
||||
|
@ -94,7 +94,7 @@ public class CarDelayFunction implements FunctionManager {
|
|||
if(userLevelGuildMap.containsKey(guildId)){
|
||||
values.add(usersByGuildId.get(guildId));
|
||||
}
|
||||
String guildContent = SErrorCodeEerverConfig.getI18NMessage("family_fight_rank_familyreward_txt",new Object[]{rank});
|
||||
String guildContent = SErrorCodeEerverConfig.getI18NMessageNeedConvert("family_fight_rank_familyreward_txt",new Object[]{rank},new int[0],"#");
|
||||
for(Set<Integer> uids : values){
|
||||
for(Integer uid:uids){
|
||||
MailLogic.getInstance().sendMail(uid,guildTitle,guildContent,rewardByRank,nowTime, Global.MAIL_EFFECTIVE_TIME);
|
||||
|
|
|
@ -188,9 +188,12 @@ public enum ErrorCode implements IErrorCode {
|
|||
//重复登陆
|
||||
public static final int reloginCode = -101;
|
||||
|
||||
//踢用户下线
|
||||
//踢下线
|
||||
public static final int kickUserCode = -102;
|
||||
|
||||
//token错误
|
||||
|
||||
public static final int tokenError = -103;
|
||||
|
||||
int codeId;
|
||||
String errMsg;
|
||||
|
|
|
@ -167,6 +167,7 @@ public class GMRequestHandler extends BaseHandler{
|
|||
}
|
||||
CommonProto.Hero finalHeroProto = CBean2Proto.getHero(hero);
|
||||
gmBuilder.setDrop(CommonProto.Drop.newBuilder().addHero(finalHeroProto).build());
|
||||
|
||||
break;
|
||||
case GlobalGm.OPEN_MAP:
|
||||
MapLogic.getInstance().gmCrossFight(uid, prarm1);
|
||||
|
|
|
@ -36,7 +36,10 @@ public class GetCarGrapRecordHandler extends BaseHandler{
|
|||
int time = item.getScore().intValue();
|
||||
String value = item.getValue();
|
||||
String[] split = value.split("\\|");
|
||||
builder.addCarChallengeItem(CommonProto.CarGrapRecordItem.newBuilder().setTime(time).setContent(split[0]).setUid(Integer.parseInt(split[1])));
|
||||
int last = value.lastIndexOf('|');
|
||||
String substring = value.substring(0, last);
|
||||
|
||||
builder.addCarChallengeItem(CommonProto.CarGrapRecordItem.newBuilder().setTime(time).setContent(substring).setUid(Integer.parseInt(split[split.length-1])));
|
||||
}
|
||||
MessageUtil.sendMessage(iSession,1, MessageTypeProto.MessageType.GET_CAR_GRAP_RECORD_RESPONSE_VALUE,builder.build(),true);
|
||||
}
|
||||
|
|
|
@ -0,0 +1,27 @@
|
|||
package com.ljsd.jieling.handler;
|
||||
|
||||
import com.ljsd.jieling.logic.dao.UserManager;
|
||||
import com.ljsd.jieling.netty.cocdex.PacketNetData;
|
||||
import com.ljsd.jieling.network.session.ISession;
|
||||
import com.ljsd.jieling.util.MessageUtil;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import rpc.protocols.MessageTypeProto;
|
||||
import rpc.protocols.PlayerInfoProto;
|
||||
|
||||
public class LoginConfirmHandler extends BaseHandler{
|
||||
private static final Logger LOGGER = LoggerFactory.getLogger(LoginRequestHandler.class);
|
||||
|
||||
@Override
|
||||
public MessageTypeProto.MessageType getMessageCode() {
|
||||
return MessageTypeProto.MessageType.LOGIN_CONFIRM_REQUEST;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void process(ISession iSession, PacketNetData netData) throws Exception {
|
||||
UserManager.loginConfirm();
|
||||
MessageUtil.sendMessage(iSession,1,
|
||||
MessageTypeProto.MessageType.LOGIN_CONFIRM_RESPONSE.getNumber(),null,true);
|
||||
}
|
||||
|
||||
}
|
|
@ -16,6 +16,7 @@ public class RankHandler extends BaseHandler<PlayerInfoProto.RankRequest> {
|
|||
|
||||
@Override
|
||||
public void processWithProto(ISession iSession, PlayerInfoProto.RankRequest proto) throws Exception {
|
||||
RankLogic.getInstance().getRank(iSession,proto.getType(),proto.getActiviteId(),MessageTypeProto.MessageType.GET_ONE_RANK_RESPONSE);
|
||||
RankLogic.getInstance().getRank(iSession,proto.getType(),proto.getActiviteId(),
|
||||
proto.getIndex(),MessageTypeProto.MessageType.GET_ONE_RANK_RESPONSE);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -112,7 +112,7 @@ public class GetLuckWheelRandHandler extends BaseHandler<PlayerInfoProto.GetLuck
|
|||
SItem sItem = SItem.getsItemMap().get(drops[i][0]);
|
||||
if(sItem.getQuantity()>=5){
|
||||
String nickName = user.getPlayerInfoManager().getNickName();
|
||||
String message = SErrorCodeEerverConfig.getI18NMessage("Dial_Reward_txt", new Object[]{nickName, sItem.getName()});
|
||||
String message = SErrorCodeEerverConfig.getI18NMessageNeedConvert("Dial_Reward_txt", new Object[]{nickName, sItem.getName()},new int[]{0,1});
|
||||
int sysType = sGlobalActivity.getType() == 30 ? Global.LUCKWHEEL : Global.LUCKWHEEL_ADVANCE;
|
||||
ChatLogic.getInstance().sendSysChatMessage(message, sysType, "0", 0, 0, 0, 0, 0);
|
||||
}
|
||||
|
|
|
@ -3,11 +3,14 @@ package com.ljsd.jieling.handler.hero;
|
|||
import com.google.protobuf.GeneratedMessage;
|
||||
import com.ljsd.jieling.exception.ErrorCode;
|
||||
import com.ljsd.jieling.exception.ErrorCodeException;
|
||||
import com.ljsd.jieling.globals.BIReason;
|
||||
import com.ljsd.jieling.handler.BaseHandler;
|
||||
import com.ljsd.jieling.logic.dao.Hero;
|
||||
import com.ljsd.jieling.logic.dao.UserManager;
|
||||
import com.ljsd.jieling.logic.dao.root.User;
|
||||
import com.ljsd.jieling.logic.hero.HeroLogic;
|
||||
import com.ljsd.jieling.util.ItemUtil;
|
||||
import config.SItem;
|
||||
import rpc.protocols.CommonProto;
|
||||
import rpc.protocols.HeroInfoProto;
|
||||
import rpc.protocols.MessageTypeProto;
|
||||
|
@ -68,6 +71,24 @@ public class DoHeroChangeRequestHandler extends BaseHandler<HeroInfoProto.DoHer
|
|||
newHero.setJewelInfo(hero.getJewelInfo());
|
||||
user.getHeroManager().addHero(newHero);
|
||||
drop.addHero(CBean2Proto.getHero(newHero));
|
||||
//新头像
|
||||
SItem sItem = SItem.getsItemMap().get(hero.getChangeId());
|
||||
if(sItem != null){
|
||||
if(sItem.getExtraReward()!=null && sItem.getExtraReward().length>1){
|
||||
int[] drops = sItem.getExtraReward()[1];
|
||||
if(user.getItemManager().getItem(drops[0]) == null){
|
||||
int[][] extraDrops = new int[1][2];
|
||||
extraDrops[0] = new int[2];
|
||||
extraDrops[0][0] = drops[0];
|
||||
extraDrops[0][1] =1;
|
||||
if(sItem.getExtraReward()[0][0] == 0){
|
||||
ItemUtil.drop(user,extraDrops, BIReason.EXTRA_DROP_REWARD);
|
||||
}else{
|
||||
ItemUtil.drop(user,extraDrops,CommonProto.Drop.newBuilder(),BIReason.EXTRA_DROP_REWARD);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return HeroInfoProto.DoHeroChangeResponse.newBuilder().setDrop(drop).build();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -18,9 +18,11 @@ public class RandomNameRequestHandler extends BaseHandler {
|
|||
|
||||
@Override
|
||||
public void process(ISession iSession, PacketNetData netData) throws Exception {
|
||||
String randomName = PlayerLogic.getInstance().getRandomName2();
|
||||
String[] nameInfo = PlayerLogic.getInstance().getRandomNameWithPreAndPost();
|
||||
PlayerInfoProto.RandomNameResponse randomNameResponse = PlayerInfoProto.RandomNameResponse.newBuilder()
|
||||
.setRandomName(randomName)
|
||||
.setRandomName(nameInfo[0])
|
||||
.setPreName(nameInfo[1])
|
||||
.setPostName(nameInfo[2])
|
||||
.build();
|
||||
MessageUtil.sendMessage(iSession, 1,MessageTypeProto.MessageType.RANDOMNAME_RESPONSE_VALUE, randomNameResponse, true);
|
||||
}
|
||||
|
|
|
@ -20,7 +20,7 @@ public class GetWorkShopInfoHandler extends BaseHandler {
|
|||
|
||||
@Override
|
||||
public void process(ISession iSession, PacketNetData netData) throws Exception {
|
||||
WorkShopLogic.getInstance().getWorkShopInfo(iSession);
|
||||
// WorkShopLogic.getInstance().getWorkShopInfo(iSession);
|
||||
// throw new ErrorCodeException(ErrorCode.UNKNOWN);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -11,17 +11,23 @@ import java.util.concurrent.ConcurrentHashMap;
|
|||
public class OnlineUserManager {
|
||||
|
||||
public static void userOnline(int uid, ISession session) {
|
||||
tokenMap.put(session.getToken(),uid);
|
||||
sessionMap.put(uid, session);
|
||||
}
|
||||
|
||||
public static Map<Integer, ISession> sessionMap = new ConcurrentHashMap<>();
|
||||
|
||||
public static Map<Integer,Integer> tokenMap = new ConcurrentHashMap<>();
|
||||
|
||||
public static void checkOnline(){
|
||||
UserManager.checkOffline();
|
||||
}
|
||||
|
||||
|
||||
public static void userOffline(int uid) {
|
||||
if(sessionMap.containsKey(uid)){
|
||||
tokenMap.remove(sessionMap.get(uid).getToken());
|
||||
}
|
||||
sessionMap.remove(uid);
|
||||
}
|
||||
|
||||
|
@ -50,23 +56,10 @@ public class OnlineUserManager {
|
|||
}
|
||||
return sessionMap.containsKey(uid);
|
||||
}
|
||||
|
||||
static class DefinaMap<k,v> extends HashMap<k,v>{
|
||||
|
||||
@Override
|
||||
public boolean remove(Object key, Object value) {
|
||||
return super.remove(key, value);
|
||||
}
|
||||
|
||||
@Override
|
||||
public v put(k key, v value) {
|
||||
return super.put(key, value);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void clear() {
|
||||
super.clear();
|
||||
public static boolean checkOnlineByToken(int token) {
|
||||
if (tokenMap == null) {
|
||||
return true;
|
||||
}
|
||||
return tokenMap.containsKey(token);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -147,7 +147,7 @@ public class SituationLogic {
|
|||
int index = 1;
|
||||
for(ZSetOperations.TypedTuple<String> rankInfo:rankInfos){
|
||||
String title = SErrorCodeEerverConfig.getI18NMessage("xuanyuan_Ranking_reward_title");
|
||||
String content = SErrorCodeEerverConfig.getI18NMessage("xuanyuan_Ranking_reward_txt", new Object[]{index});
|
||||
String content = SErrorCodeEerverConfig.getI18NMessageNeedConvert("xuanyuan_Ranking_reward_txt", new Object[]{index},new int[0],"#");
|
||||
SRaceTowerRewardConfig sRaceTowerRewardConfig = rewardConfigMap.get(index);
|
||||
if(sRaceTowerRewardConfig==null){
|
||||
continue;
|
||||
|
|
|
@ -186,8 +186,8 @@ public abstract class AbstractActivity implements IActivity, IEventHandler {
|
|||
SGlobalActivity sGlobalActivity = SGlobalActivity.getsGlobalActivityMap().get(id);
|
||||
if (null == sGlobalActivity)
|
||||
throw new ErrorCodeException(ErrorCode.ITEM_NOT_ENOUGH);
|
||||
String title = SErrorCodeEerverConfig.getI18NMessage("receive_activity_title", new Object[]{sGlobalActivity.getSesc()});
|
||||
String content = SErrorCodeEerverConfig.getI18NMessage("receive_activity_txt", new Object[]{sGlobalActivity.getSesc()});
|
||||
String title = SErrorCodeEerverConfig.getI18NMessageNeedConvert("receive_activity_title", new Object[]{sGlobalActivity.getSesc()},new int[]{1},"#");
|
||||
String content = SErrorCodeEerverConfig.getI18NMessageNeedConvert("receive_activity_txt", new Object[]{sGlobalActivity.getSesc()},new int[]{1},"#");
|
||||
String mailReward = ItemUtil.getMailReward(itemArrs);
|
||||
int nowTime = (int) (TimeUtils.now() / 1000);
|
||||
MailLogic.getInstance().sendMail(user.getId(), title, content, mailReward, nowTime, Global.MAIL_EFFECTIVE_TIME);
|
||||
|
|
|
@ -131,8 +131,8 @@ class ExpectRankActivity extends AbstractActivity {
|
|||
SActivityRankingReward sActivityRankingReward1 = SActivityRankingReward.getsActivityRankingRewardMap().get(missionId);
|
||||
//sendmail
|
||||
|
||||
String title = SErrorCodeEerverConfig.getI18NMessage("expertrank_activity_title", new Object[]{sGlobalActivity.getSesc()});
|
||||
String content = SErrorCodeEerverConfig.getI18NMessage("expertrank_activity_txt", new Object[]{sGlobalActivity.getSesc(), rank++});
|
||||
String title = SErrorCodeEerverConfig.getI18NMessageNeedConvert("expertrank_activity_title", new Object[]{sGlobalActivity.getSesc()},new int[]{1},"#");
|
||||
String content = SErrorCodeEerverConfig.getI18NMessageNeedConvert("expertrank_activity_txt", new Object[]{sGlobalActivity.getSesc(),rank++},new int[]{1,0},"#");
|
||||
String mailReward = ItemUtil.getMailReward(sActivityRankingReward1.getRankingReward());
|
||||
MailLogic.getInstance().sendMail(uid, title, content, mailReward, nowTime, Global.MAIL_EFFECTIVE_TIME);
|
||||
}catch (Exception e) {
|
||||
|
|
|
@ -122,7 +122,7 @@ class ForceRankActivity extends AbstractActivity {
|
|||
}
|
||||
//sendmail
|
||||
String title = SErrorCodeEerverConfig.getI18NMessage("powerrank_activity_title");
|
||||
String content = SErrorCodeEerverConfig.getI18NMessage("powerrank_activity_txt", new Object[]{rank});
|
||||
String content = SErrorCodeEerverConfig.getI18NMessageNeedConvert("powerrank_activity_txt", new Object[]{rank},new int[]{0},"#");
|
||||
String mailReward = ItemUtil.getMailReward(sActivityRewardConfig.getReward());
|
||||
MailLogic.getInstance().sendMail(uid, title, content, mailReward, nowTime, Global.MAIL_EFFECTIVE_TIME);
|
||||
rank++;
|
||||
|
|
|
@ -114,8 +114,9 @@ public class LuckyCatActivity extends AbstractActivity {
|
|||
String nickName = user.getPlayerInfoManager().getNickName();
|
||||
SItem sItem = SItem.getsItemMap().get(temp2[0]);
|
||||
|
||||
String message = SErrorCodeEerverConfig.getI18NMessage("luck_cat_take_reward_content", new Object[]{nickName, sItem.getName(), temp2[1]});
|
||||
ChatLogic.getInstance().sendSysChatMessage(message, Global.LUCKCAT, "0", 0, 0, 0, 0, 0);
|
||||
String message = SErrorCodeEerverConfig.getI18NMessageNeedConvert("luck_cat_take_reward_content", new Object[]{nickName, sItem.getName(), temp2[1]},new int[]{0,1,0});
|
||||
ChatLogic.getInstance().sendSysChatMessage(message, Global.LUCKCAT, "", 0, 0, 0, 0, 0);
|
||||
|
||||
reportTakeActivityReward(user,reward,missionId);
|
||||
|
||||
PlayerInfoProto.TakeActivityRewardResponse build = PlayerInfoProto.TakeActivityRewardResponse.newBuilder().setDrop(drop).build();
|
||||
|
|
|
@ -229,8 +229,8 @@ class SheJiActivity extends AbstractActivity {
|
|||
SGodSacrificeConfig sActivityRankingReward1 = SGodSacrificeConfig.getsGodSacrificeConfigMap().get(missionId);
|
||||
//sendmail
|
||||
|
||||
String title = SErrorCodeEerverConfig.getI18NMessage("personal_activity_reward_title", new Object[]{sGlobalActivity.getSesc()});
|
||||
String content = SErrorCodeEerverConfig.getI18NMessage("personal_activity_reward_txt", new Object[]{sGlobalActivity.getSesc(), finalIndex});
|
||||
String title = SErrorCodeEerverConfig.getI18NMessageNeedConvert("personal_activity_reward_title", new Object[]{sGlobalActivity.getSesc()},new int[]{1},"#");
|
||||
String content = SErrorCodeEerverConfig.getI18NMessageNeedConvert("personal_activity_reward_txt", new Object[]{sGlobalActivity.getSesc(), finalIndex},new int[]{1,0},"#");
|
||||
String mailReward = ItemUtil.getMailReward(sActivityRankingReward1.getRankingReward());
|
||||
MailLogic.getInstance().sendMail(uid, title, content, mailReward, nowTime, Global.MAIL_EFFECTIVE_TIME);
|
||||
|
||||
|
@ -309,8 +309,8 @@ class SheJiActivity extends AbstractActivity {
|
|||
//checkAndUpdate value
|
||||
SGodSacrificeConfig sActivityRankingReward1 = SGodSacrificeConfig.getsGodSacrificeConfigMap().get(missionId);
|
||||
//sendmail
|
||||
String title = SErrorCodeEerverConfig.getI18NMessage("guild_activity_reward_title", new Object[]{sGlobalActivity.getSesc()});
|
||||
String content = SErrorCodeEerverConfig.getI18NMessage("guild_activity_reward_txt", new Object[]{sGlobalActivity.getSesc(), finalIndex});
|
||||
String title = SErrorCodeEerverConfig.getI18NMessageNeedConvert("guild_activity_reward_title", new Object[]{sGlobalActivity.getSesc()},new int[]{1},"#");
|
||||
String content = SErrorCodeEerverConfig.getI18NMessageNeedConvert("guild_activity_reward_txt", new Object[]{sGlobalActivity.getSesc(), finalIndex},new int[]{1,0},"#");
|
||||
String mailReward = ItemUtil.getMailReward(sActivityRankingReward1.getRankingReward());
|
||||
MailLogic.getInstance().sendMail(uid, title, content, mailReward, nowTime, Global.MAIL_EFFECTIVE_TIME);
|
||||
|
||||
|
|
|
@ -239,9 +239,9 @@ public class SubActivity extends AbstractActivity {
|
|||
rewards[0] = new int[]{16, costNum*integerValue};
|
||||
|
||||
SItem getItem = SItem.getsItemMap().get(16);
|
||||
String getName =costNum*integerValue+getItem.getName();
|
||||
String getValue =String.valueOf(costNum*integerValue);
|
||||
String title = SErrorCodeEerverConfig.getI18NMessage("activity_item_retrieve_mail_titile");
|
||||
String content = SErrorCodeEerverConfig.getI18NMessage("activity_item_retrieve_mail_content", new Object[]{sGlobalActivity.getSesc(),sItem.getName(),costNum,getName});
|
||||
String content = SErrorCodeEerverConfig.getI18NMessageNeedConvert("activity_item_retrieve_mail_content", new Object[]{sGlobalActivity.getSesc(),sItem.getName(),costNum,getValue,getItem.getName()},new int[]{1,1,0,0,1},"#");
|
||||
String mailReward = ItemUtil.getMailReward(rewards);
|
||||
int nowTime = (int) (TimeUtils.now() / 1000);
|
||||
MailLogic.getInstance().sendMail(user.getId(), title, content, mailReward, nowTime, Global.MAIL_EFFECTIVE_TIME);
|
||||
|
|
|
@ -548,9 +548,9 @@ public class ArenaLogic {
|
|||
|
||||
}
|
||||
if(type == GlobalsDef.ARENA_DAILY_REWARD){
|
||||
content = SErrorCodeEerverConfig.getI18NMessage("arena_daily_reward_txt",new Object[]{rank});
|
||||
content = SErrorCodeEerverConfig.getI18NMessageNeedConvert("arena_daily_reward_txt",new Object[]{rank},new int[0],"#");
|
||||
}else{
|
||||
content = SErrorCodeEerverConfig.getI18NMessage("arena_season_reward_txt",new Object[]{rank});
|
||||
content = SErrorCodeEerverConfig.getI18NMessageNeedConvert("arena_season_reward_txt",new Object[]{rank},new int[0],"#");
|
||||
user.getPlayerInfoManager().removeRed(GlobalsDef.ARENA_CHALLENGE_TYPE);
|
||||
String key = RedisUtil.getInstence().getKey(RedisKey.ARENA_RRECORD, Integer.toString(uid));
|
||||
RedisUtil.getInstence().del(key);
|
||||
|
|
|
@ -413,7 +413,7 @@ public class ChampionshipLogic {
|
|||
user.getUserMissionManager().onGameEvent(user, GameEvent.CHAMPIONSHIP_RANK, rank);
|
||||
rank++;
|
||||
String title = SErrorCodeEerverConfig.getI18NMessage("champion_reward_title");
|
||||
String content = SErrorCodeEerverConfig.getI18NMessage("champion_reward_txt", new Object[]{sChampionshipReward.getTitleDesc()});
|
||||
String content = SErrorCodeEerverConfig.getI18NMessageNeedConvert("champion_reward_txt", new Object[]{sChampionshipReward.getTitleDesc()},new int[]{1},"#");
|
||||
MailLogic.getInstance().sendMail(user.getId(), title, content, ItemUtil.getMailReward(sChampionshipReward.getSeasonReward()), nowTime, Global.MAIL_EFFECTIVE_TIME);
|
||||
}
|
||||
}catch (Exception e){
|
||||
|
|
|
@ -184,18 +184,18 @@ public class Hero extends MongoBase implements Comparable<Hero> {
|
|||
public int getLevel(HeroManager heroManager) {
|
||||
// 英雄 配置表信息
|
||||
SCHero scHero = SCHero.getsCHero().get(templateId);
|
||||
SCHeroRankUpConfig config = STableManager.getConfig(SCHeroRankUpConfig.class).get(scHero.getMaxRank());
|
||||
int maxLevel = scHero.getMaxLevel();
|
||||
|
||||
// 如果鸿蒙碑开启 返回鸿蒙系统中神将返回鸿蒙碑等级
|
||||
if (heroManager.getHongmengTablet() > 0){
|
||||
// 存在共鸣或者使者
|
||||
if (heroManager.getResonances().values().contains(id) || heroManager.getHongmengGuards().values().contains(id)) {
|
||||
// 鸿蒙碑超过等级上限,返回鸿蒙碑等级
|
||||
if (heroManager.getHongmengTablet() <= config.getOpenLevel()){
|
||||
if (heroManager.getHongmengTablet() <= maxLevel){
|
||||
return heroManager.getHongmengTablet();
|
||||
}
|
||||
// 最高品质大于等于10的英雄,返回鸿蒙碑等级,否则返回上限等级
|
||||
return scHero.getMaxRank() >= 10?heroManager.getHongmengTablet():config.getOpenLevel();
|
||||
return scHero.getMaxRank() >= 10?heroManager.getHongmengTablet():maxLevel;
|
||||
}
|
||||
}
|
||||
if (heroManager.getResonances().values().contains(id)) {
|
||||
|
@ -203,7 +203,7 @@ public class Hero extends MongoBase implements Comparable<Hero> {
|
|||
HongMengAddAttribute hongMengAddAttribute = heroManager.getResonanceAddition().get(HongMengAttributeEnum.LEVEL);
|
||||
if (hongMengAddAttribute != null) {
|
||||
// 是否达到限制等级
|
||||
return hongMengAddAttribute.value >= config.getOpenLevel() ? config.getOpenLevel():hongMengAddAttribute.value;
|
||||
return hongMengAddAttribute.value >= maxLevel ? maxLevel:hongMengAddAttribute.value;
|
||||
}
|
||||
}
|
||||
return level;
|
||||
|
|
|
@ -1,15 +1,13 @@
|
|||
package com.ljsd.jieling.logic.dao;
|
||||
|
||||
|
||||
import com.ljsd.GameApplication;
|
||||
import com.ljsd.jieling.config.clazzStaticCfg.CommonStaticConfig;
|
||||
import com.ljsd.jieling.core.GlobalsDef;
|
||||
import com.ljsd.jieling.db.mongo.AreaManager;
|
||||
import com.ljsd.jieling.db.mongo.MongoUtil;
|
||||
import com.ljsd.jieling.globals.BIReason;
|
||||
import com.ljsd.jieling.ktbeans.KtEventUtils;
|
||||
import com.ljsd.jieling.ktbeans.ReportEventEnum;
|
||||
import com.ljsd.jieling.ktbeans.ReportUtil;
|
||||
import com.ljsd.jieling.ktbeans.parmsBean.ParamEventBean;
|
||||
import com.ljsd.jieling.logic.OnlineUserManager;
|
||||
import com.ljsd.jieling.logic.activity.ActivityLogic;
|
||||
import com.ljsd.jieling.logic.activity.event.NewWelfareEvent;
|
||||
|
@ -19,8 +17,8 @@ import com.ljsd.jieling.logic.dao.root.User;
|
|||
import com.ljsd.jieling.logic.hero.HeroLogic;
|
||||
import com.ljsd.jieling.logic.mission.GameEvent;
|
||||
import com.ljsd.jieling.logic.player.PlayerLogic;
|
||||
import com.ljsd.jieling.network.server.SessionManager;
|
||||
import com.ljsd.jieling.util.ItemUtil;
|
||||
import com.ljsd.jieling.util.SysUtil;
|
||||
import config.SGameSetting;
|
||||
import config.SPlayerLevelConfig;
|
||||
import manager.STableManager;
|
||||
|
@ -28,17 +26,22 @@ import org.slf4j.Logger;
|
|||
import org.slf4j.LoggerFactory;
|
||||
import util.TimeUtils;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.IOException;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
import java.util.concurrent.ConcurrentHashMap;
|
||||
import java.util.concurrent.atomic.AtomicInteger;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
public class UserManager {
|
||||
private static final Logger LOGGER = LoggerFactory.getLogger(UserManager.class);
|
||||
private static Map<Integer, User> userMap = new ConcurrentHashMap<>();
|
||||
private static Map<Integer,Long> userMapPutTime = new ConcurrentHashMap<>(); //离线读入
|
||||
private static AtomicInteger login_f_num = new AtomicInteger(0);//登陆计数
|
||||
private static final int LOGIN_F_LIMIT = 100;//报警界限
|
||||
|
||||
public static void addUser(User user) {
|
||||
userMap.put(user.getId(), user);
|
||||
|
@ -198,4 +201,27 @@ public class UserManager {
|
|||
|
||||
return "33521";
|
||||
}
|
||||
|
||||
public static void loginIncrease(){
|
||||
if(login_f_num.incrementAndGet() >= LOGIN_F_LIMIT){
|
||||
String path = SysUtil.getPath("conf/loginerror/loginerror"+ GameApplication.serverId +".txt");
|
||||
File file = new File(path);
|
||||
try{
|
||||
if(!file.getParentFile().exists()){
|
||||
file.getParentFile().mkdirs();
|
||||
}
|
||||
if(!file.exists()){
|
||||
file.createNewFile();
|
||||
LOGGER.info("生成登陆限制文件!"+TimeUtils.getTimeStamp(System.currentTimeMillis()));
|
||||
}
|
||||
}catch(IOException e){
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public static void loginConfirm(){
|
||||
login_f_num.decrementAndGet();
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -169,7 +169,7 @@ public class ExpeditionLogic {
|
|||
String mailReward = ItemUtil.getMailReward(itemArrs);
|
||||
int nowTime = (int) (TimeUtils.now() / 1000);
|
||||
String title = SErrorCodeEerverConfig.getI18NMessage("expedition_title");
|
||||
String content = SErrorCodeEerverConfig.getI18NMessage("expedition_txt",new Object[]{user.getExpeditionManager().getLay()-1});
|
||||
String content = SErrorCodeEerverConfig.getI18NMessageNeedConvert("expedition_txt",new Object[]{user.getExpeditionManager().getLay()-1},new int[]{0},"#");
|
||||
MailLogic.getInstance().sendMail(user.getId(), title, content, mailReward, nowTime, Global.MAIL_EFFECTIVE_TIME);
|
||||
}
|
||||
|
||||
|
|
|
@ -240,8 +240,9 @@ public class DeathPathLogic {
|
|||
}
|
||||
String gid = firstGuild.iterator().next().getValue();
|
||||
GuildInfo guildInfo = GuilidManager.guildInfoMap.get(Integer.parseInt(gid));
|
||||
String message = SErrorCodeEerverConfig.getI18NMessage("guildwar_content", new Object[]{guildInfo.getName()});
|
||||
ChatLogic.getInstance().sendSysChatMessage(message, Global.DEATH_PATH_FIRST, "0", 0, 0, 0, 0, 0);
|
||||
String message = SErrorCodeEerverConfig.getI18NMessageNeedConvert("guildwar_content", new Object[]{guildInfo.getName()},new int[]{0});
|
||||
ChatLogic.getInstance().sendSysChatMessage(message, Global.DEATH_PATH_FIRST, "", 0, 0, 0, 0, 0);
|
||||
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
|
|
|
@ -441,7 +441,7 @@ public class GuildChallengeLogic {
|
|||
int index = 1;
|
||||
for(ZSetOperations.TypedTuple<String> rankInfo:rankInfos){
|
||||
String title = SErrorCodeEerverConfig.getI18NMessage("GuildRanking_mail_gonghui_title");
|
||||
String content = SErrorCodeEerverConfig.getI18NMessage("GuildRanking_mail_gonghui_txt", new Object[]{index});
|
||||
String content = SErrorCodeEerverConfig.getI18NMessageNeedConvert("GuildRanking_mail_gonghui_txt", new Object[]{index},new int[0],"#");
|
||||
|
||||
String uid = rankInfo.getValue();
|
||||
SGuildCheckpointRank config;
|
||||
|
|
|
@ -856,7 +856,7 @@ public class GuildFightLogic {
|
|||
continue;
|
||||
}
|
||||
String title = SErrorCodeEerverConfig.getI18NMessage("family_fight_rank_reward_title");
|
||||
String content = SErrorCodeEerverConfig.getI18NMessage("family_fight_rank_reward_txt",new Object[]{String.valueOf(userResultRank)});
|
||||
String content = SErrorCodeEerverConfig.getI18NMessageNeedConvert("family_fight_rank_reward_txt",new Object[]{String.valueOf(userResultRank)},new int[0],"#");
|
||||
MailLogic.getInstance().sendMail(Integer.parseInt(next.getValue()),title,content,SGuildRewardConfig.rewardMap.get(userResultRank),(int) (TimeUtils.now()/1000), Global.MAIL_EFFECTIVE_TIME);
|
||||
}
|
||||
}
|
||||
|
@ -1198,7 +1198,7 @@ public class GuildFightLogic {
|
|||
}
|
||||
ZSetOperations.TypedTuple<String> next = bossHurtRankInfo.iterator().next();
|
||||
int maxHurt =next.getScore().intValue();
|
||||
String content = SErrorCodeEerverConfig.getI18NMessage("guildboss_daily_reward_txt",new String[]{UserManager.getUser(Integer.parseInt(next.getValue())).getPlayerInfoManager().getNickName(),Integer.toString(maxHurt)});
|
||||
String content = SErrorCodeEerverConfig.getI18NMessageNeedConvert("guildboss_daily_reward_txt",new String[]{UserManager.getUser(Integer.parseInt(next.getValue())).getPlayerInfoManager().getNickName(),Integer.toString(maxHurt)},new int[]{0,0},"#");
|
||||
int[][] mineReward = new int[bossReward.length][];
|
||||
int j=0;
|
||||
for(int i=0;i<bossReward.length;i++){
|
||||
|
|
|
@ -671,7 +671,7 @@ public class GuildLogic {
|
|||
//// MessageUtil.sendIndicationMessage(targetSession,1, MessageTypeProto.MessageType.FAMILY_KICK_INDICATION_VALUE,build,true);
|
||||
// }
|
||||
String title = SErrorCodeEerverConfig.getI18NMessage("family_kick_title");
|
||||
String content = SErrorCodeEerverConfig.getI18NMessage("family_kick_txt",new Object[]{guildInfo.getName()});
|
||||
String content = SErrorCodeEerverConfig.getI18NMessageNeedConvert("family_kick_txt",new Object[]{guildInfo.getName()},new int[]{0},"#");
|
||||
MailLogic.getInstance().sendMail(targetUid,title,content,"",(int) (TimeUtils.now()/1000), Global.MAIL_EFFECTIVE_TIME);
|
||||
MessageUtil.sendMessage(session,1,msgId,null,true);
|
||||
}
|
||||
|
@ -869,7 +869,7 @@ public class GuildLogic {
|
|||
Set<Integer> chairmans = guildInfo.getMembers().get(GlobalsDef.CHAIRMAN);
|
||||
Integer chairmanUid = chairmans.iterator().next();
|
||||
User chairmanUser = UserManager.getUser(chairmanUid);
|
||||
String content = SErrorCodeEerverConfig.getI18NMessage("guild_breakup_txt",new String[]{guildInfo.getName(),chairmanUser.getPlayerInfoManager().getNickName()});
|
||||
String content = SErrorCodeEerverConfig.getI18NMessageNeedConvert("guild_breakup_txt",new String[]{guildInfo.getName(),chairmanUser.getPlayerInfoManager().getNickName()},new int[]{0,0},"#");
|
||||
for(Set<Integer> items : members.values()){
|
||||
for(Integer sendUid : items){
|
||||
ISession session = OnlineUserManager.getSessionByUid(sendUid);
|
||||
|
|
|
@ -727,7 +727,7 @@ public class CombatLogic {
|
|||
if("".equals(rewardByRank)){
|
||||
break;
|
||||
}
|
||||
String content=SErrorCodeEerverConfig.getI18NMessage("adventure_boss_reward_txt",new Object[]{user.getPlayerInfoManager().getNickName(),rank});
|
||||
String content=SErrorCodeEerverConfig.getI18NMessageNeedConvert("adventure_boss_reward_txt",new Object[]{user.getPlayerInfoManager().getNickName(),rank},new int[]{0,0},"#");
|
||||
MailLogic.getInstance().sendMail(user.getId(),title,content,rewardByRank,nowTime, Global.MAIL_EFFECTIVE_TIME);
|
||||
rank++;
|
||||
MongoUtil.getInstence().lastUpdate();
|
||||
|
@ -979,7 +979,7 @@ public class CombatLogic {
|
|||
if(!baseItemMap.isEmpty()){
|
||||
int vipLevel = user.getPlayerInfoManager().getVipLevel();
|
||||
String title = SErrorCodeEerverConfig.getI18NMessage("adventuren_reward_of_viplevel_title");
|
||||
String content = SErrorCodeEerverConfig.getI18NMessage("adventuren_reward_of_viplevel_content",new Object[]{vipLevel});
|
||||
String content = SErrorCodeEerverConfig.getI18NMessageNeedConvert("adventuren_reward_of_viplevel_content",new Object[]{vipLevel},new int[0],"#");
|
||||
String reward = ItemUtil.getReward(baseItemMap, baseCardMap, baseEquipMap, baseRandomMap);
|
||||
String randomReward = ItemUtil.getReward(randomItemMap, randomCardMap, randomEquipMap, randomRandomMap);
|
||||
if(randomReward.length()!=0){
|
||||
|
|
|
@ -1111,11 +1111,12 @@ public class HeroLogic{
|
|||
MessageUtil.sendMessage(session,1,MessageTypeProto.MessageType.UP_HERO_STAR_RESPONSE_VALUE,baseBuilder.build(),true);
|
||||
// 觉醒飘字
|
||||
if (targetHero.getStar() >= SSpecialConfig.getIntegerValue(SSpecialConfig.lamp_awaken_hero_content_parm)) {
|
||||
String message = SErrorCodeEerverConfig.getI18NMessage("animal_awaken_broadcast_content", new Object[]{user.getPlayerInfoManager().getNickName(), scHero.getReadingName()});
|
||||
String message = SErrorCodeEerverConfig.getI18NMessageNeedConvert("animal_awaken_broadcast_content", new Object[]{user.getPlayerInfoManager().getNickName(), scHero.getReadingName()},new int[]{0,1});
|
||||
ChatLogic.getInstance().sendSysChatMessage(message, Global.DILIGENT, String.valueOf(targetHero.getTemplateId()), 0, 0, 0, 0, 0);
|
||||
} else if (targetHero.getStar() >= SSpecialConfig.getIntegerValue(SSpecialConfig.lamp_rankup_hero_content_parm)) {
|
||||
String message = SErrorCodeEerverConfig.getI18NMessage("lamp_rankup_hero_content", new Object[]{user.getPlayerInfoManager().getNickName(), scHero.getReadingName(), targetHero.getStar()});
|
||||
ChatLogic.getInstance().sendSysChatMessage(message, Global.DILIGENT, String.valueOf(targetHero.getTemplateId()), 0, 0, 0, 0, 0);
|
||||
String message = SErrorCodeEerverConfig.getI18NMessageNeedConvert("lamp_rankup_hero_content", new Object[]{user.getPlayerInfoManager().getNickName(), scHero.getReadingName(), targetHero.getStar()},new int[]{0,1,0});
|
||||
ChatLogic.getInstance().sendSysChatMessage(message, Global.DILIGENT,String.valueOf(targetHero.getTemplateId()), 0, 0, 0, 0, 0);
|
||||
|
||||
}
|
||||
String consume = StringUtil.parseArrayToString(consumeMaterial);
|
||||
// HERO_STRENGTHEN(13,"hero_strengthen", new CommonEventHandler(),new String[]{"hero_id","old_quality","new_quality","strengthen_type","cost_item_list","cost_hero_list"}),
|
||||
|
@ -3426,7 +3427,7 @@ public class HeroLogic{
|
|||
Poster.getPoster().dispatchEvent(new UserMainTeamForceEvent(session.getUid()));
|
||||
}
|
||||
if(animal.getQuality() >= SSpecialConfig.getIntegerValue(SSpecialConfig.ANIMAL_BROADCAST_QUALITY)) { //策划资质改成星级
|
||||
String message = SErrorCodeEerverConfig.getI18NMessage("animal_starup_broadcast_content", new Object[]{user.getPlayerInfoManager().getNickName(),animal.getName(),pokemon.getStar()});
|
||||
String message = SErrorCodeEerverConfig.getI18NMessageNeedConvert("animal_starup_broadcast_content", new Object[]{user.getPlayerInfoManager().getNickName(),animal.getName(),pokemon.getStar()},new int[]{0,1,0});
|
||||
if (!message.isEmpty()){
|
||||
ChatLogic.getInstance().sendSysChatMessage(message,Global.LUCKY_LUCK,"0",0,0,0,0,0);
|
||||
}
|
||||
|
|
|
@ -719,8 +719,9 @@ public class ItemLogic {
|
|||
if (hero.getEspecialEquipLevel() % value[1] != 0) {
|
||||
return;
|
||||
}
|
||||
String message = SErrorCodeEerverConfig.getI18NMessage("lamp_rankup_equiptalisman_content", new Object[]{user.getPlayerInfoManager().getNickName(), sItem.getName(), hero.getEspecialEquipLevel()});
|
||||
ChatLogic.getInstance().sendSysChatMessage(message, Global.DILIGENT, sItem.getId()+"#"+hero.getEspecialEquipLevel(), 0, 0, 0, 0, 0);
|
||||
String message = SErrorCodeEerverConfig.getI18NMessageNeedConvert("lamp_rankup_equiptalisman_content", new Object[]{user.getPlayerInfoManager().getNickName(), sItem.getName(), hero.getEspecialEquipLevel()},new int[]{0,1,0});
|
||||
ChatLogic.getInstance().sendSysChatMessage(message, Global.DILIGENT, String.valueOf(sItem.getId()), 0, 0, 0, 0, 0);
|
||||
|
||||
}
|
||||
if (HeroLogic.getInstance().isInTeam(user, heroId, 1)) {
|
||||
Poster.getPoster().dispatchEvent(new UserMainTeamForceEvent(session.getUid()));
|
||||
|
|
|
@ -1,32 +1,22 @@
|
|||
package com.ljsd.jieling.logic.item;
|
||||
|
||||
import com.ljsd.jieling.chat.logic.ChatLogic;
|
||||
import com.ljsd.jieling.config.clazzStaticCfg.CommonStaticConfig;
|
||||
import com.ljsd.jieling.core.FunctionIdEnum;
|
||||
import com.ljsd.jieling.core.GlobalsDef;
|
||||
import com.ljsd.jieling.core.HandlerLogicThread;
|
||||
import com.ljsd.jieling.exception.ErrorCode;
|
||||
import com.ljsd.jieling.exception.ErrorCodeException;
|
||||
import com.ljsd.jieling.globals.BIReason;
|
||||
import com.ljsd.jieling.globals.Global;
|
||||
import com.ljsd.jieling.logic.dao.*;
|
||||
import com.ljsd.jieling.logic.dao.root.User;
|
||||
import com.ljsd.jieling.logic.dao.UserManager;
|
||||
import com.ljsd.jieling.logic.hero.HeroLogic;
|
||||
import com.ljsd.jieling.logic.mission.GameEvent;
|
||||
import com.ljsd.jieling.logic.store.StoreLogic;
|
||||
import com.ljsd.jieling.network.session.ISession;
|
||||
import rpc.protocols.CommonProto;
|
||||
import rpc.protocols.MessageTypeProto;
|
||||
import rpc.protocols.PlayerInfoProto;
|
||||
import com.ljsd.jieling.util.CBean2Proto;
|
||||
import com.ljsd.jieling.util.ItemUtil;
|
||||
import com.ljsd.jieling.util.MessageUtil;
|
||||
import config.SGlobalSystemConfig;
|
||||
import config.*;
|
||||
import manager.STableManager;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import rpc.protocols.MessageTypeProto;
|
||||
|
||||
import java.util.*;
|
||||
|
||||
|
@ -89,37 +79,37 @@ public class WorkShopLogic {
|
|||
MessageUtil.sendMessage(iSession,1, msgId,null,true);
|
||||
}
|
||||
|
||||
public void workShopTechnogyReset(ISession session,int profession) throws Exception {
|
||||
int uid = session.getUid();
|
||||
int msgId = MessageTypeProto.MessageType.WORKSHOP_TECHNOLOGY_RESET_RESPONSE_VALUE;
|
||||
User user = UserManager.getUser(uid);
|
||||
WorkShopController workShopController = user.getWorkShopController();
|
||||
Map<Integer, Map<Integer, Integer>> technologyMap = workShopController.getTechnologyMap();
|
||||
Map<Integer, Integer> technologyByProfessionMap = technologyMap.get(profession);
|
||||
if(technologyByProfessionMap == null || technologyByProfessionMap.isEmpty()){
|
||||
throw new ErrorCodeException(ErrorCode.newDefineCode("没有科技点"));
|
||||
}
|
||||
String err = StoreLogic.checkBuyGoodsAndUpdate(user,7,10011,1);
|
||||
if (!"".equals(err)){
|
||||
throw new ErrorCodeException(ErrorCode.newDefineCode(err));
|
||||
}
|
||||
Map<Integer,Integer> returnMap = new HashMap<>();
|
||||
for(Map.Entry<Integer,Integer> item : technologyByProfessionMap.entrySet()){
|
||||
SWorkShopTechnology sWorkShopTechnology = STableManager.getFigureConfig(CommonStaticConfig.class).getsWorkTechMapByTechIdAndLevel(item.getKey(), item.getValue());
|
||||
if(sWorkShopTechnology == null){
|
||||
continue;
|
||||
}
|
||||
Map<Integer, Integer> willReturn = sWorkShopTechnology.getWillReturn();
|
||||
if(willReturn == null){
|
||||
continue;
|
||||
}
|
||||
HeroLogic.getInstance().combinedAttribute(willReturn,returnMap);
|
||||
}
|
||||
workShopController.resetTech(profession);
|
||||
CommonProto.Drop.Builder builder = ItemUtil.dropMap(user, returnMap, BIReason.WORK_SHOP_TECHNOGY_RESET_DROP);
|
||||
PlayerInfoProto.WorkTechnologyResetResponse build = PlayerInfoProto.WorkTechnologyResetResponse.newBuilder().setDrop(builder).build();
|
||||
MessageUtil.sendMessage(session,1,msgId,build,true);
|
||||
}
|
||||
// public void workShopTechnogyReset(ISession session,int profession) throws Exception {
|
||||
// int uid = session.getUid();
|
||||
// int msgId = MessageTypeProto.MessageType.WORKSHOP_TECHNOLOGY_RESET_RESPONSE_VALUE;
|
||||
// User user = UserManager.getUser(uid);
|
||||
// WorkShopController workShopController = user.getWorkShopController();
|
||||
// Map<Integer, Map<Integer, Integer>> technologyMap = workShopController.getTechnologyMap();
|
||||
// Map<Integer, Integer> technologyByProfessionMap = technologyMap.get(profession);
|
||||
// if(technologyByProfessionMap == null || technologyByProfessionMap.isEmpty()){
|
||||
// throw new ErrorCodeException(ErrorCode.newDefineCode("没有科技点"));
|
||||
// }
|
||||
// String err = StoreLogic.checkBuyGoodsAndUpdate(user,7,10011,1);
|
||||
// if (!"".equals(err)){
|
||||
// throw new ErrorCodeException(ErrorCode.newDefineCode(err));
|
||||
// }
|
||||
// Map<Integer,Integer> returnMap = new HashMap<>();
|
||||
// for(Map.Entry<Integer,Integer> item : technologyByProfessionMap.entrySet()){
|
||||
// SWorkShopTechnology sWorkShopTechnology = STableManager.getFigureConfig(CommonStaticConfig.class).getsWorkTechMapByTechIdAndLevel(item.getKey(), item.getValue());
|
||||
// if(sWorkShopTechnology == null){
|
||||
// continue;
|
||||
// }
|
||||
// Map<Integer, Integer> willReturn = sWorkShopTechnology.getWillReturn();
|
||||
// if(willReturn == null){
|
||||
// continue;
|
||||
// }
|
||||
// HeroLogic.getInstance().combinedAttribute(willReturn,returnMap);
|
||||
// }
|
||||
// workShopController.resetTech(profession);
|
||||
// CommonProto.Drop.Builder builder = ItemUtil.dropMap(user, returnMap, BIReason.WORK_SHOP_TECHNOGY_RESET_DROP);
|
||||
// PlayerInfoProto.WorkTechnologyResetResponse build = PlayerInfoProto.WorkTechnologyResetResponse.newBuilder().setDrop(builder).build();
|
||||
// MessageUtil.sendMessage(session,1,msgId,build,true);
|
||||
// }
|
||||
|
||||
public static class Instance {
|
||||
public final static WorkShopLogic instance = new WorkShopLogic();
|
||||
|
@ -207,34 +197,34 @@ public class WorkShopLogic {
|
|||
return true;
|
||||
}
|
||||
|
||||
public void getWorkShopInfo(ISession session) throws Exception {
|
||||
int uid = session.getUid();
|
||||
User user = UserManager.getUser(uid);
|
||||
WorkShopController workShopController = user.getWorkShopController();
|
||||
Map<Integer, List<Integer>> openBlueStateMap = workShopController.getOpenBlueStateMap();
|
||||
int workShopLevel = workShopController.getWorkShopLevel();
|
||||
int workShopExp = workShopController.getWorkShopExp();
|
||||
|
||||
int cookLevel = workShopController.getCookLevel();
|
||||
int cookExp = workShopController.getCookExp();
|
||||
List<Integer> workShopList = openBlueStateMap.get(GlobalsDef.WORK_SHOP_TYPE);
|
||||
List<Integer> cookShopList = openBlueStateMap.get(GlobalsDef.COOK_SHOP_TYPE);
|
||||
|
||||
List<CommonProto.WorkShopBaseInfo> workShopBaseInfoList = new ArrayList<>(2);
|
||||
workShopBaseInfoList.add(CommonProto.WorkShopBaseInfo.newBuilder().setType(GlobalsDef.WORK_SHOP_TYPE).setLevle(workShopLevel).setExp(workShopExp).build());
|
||||
workShopBaseInfoList.add(CommonProto.WorkShopBaseInfo.newBuilder().setType(GlobalsDef.COOK_SHOP_TYPE).setLevle(cookLevel).setExp(cookExp).build());
|
||||
List<CommonProto.WorkShopUnLockInfo> workShopUnLockInfoList = new ArrayList<>(2);
|
||||
workShopUnLockInfoList.add(CommonProto.WorkShopUnLockInfo.newBuilder().setType(GlobalsDef.WORK_BASE_TYPE).addAllId(workShopList == null ?new ArrayList<>(1):workShopList).build());
|
||||
workShopUnLockInfoList.add(CommonProto.WorkShopUnLockInfo.newBuilder().setType(GlobalsDef.WORK_CREATE_TYPE).addAllId(cookShopList==null?new ArrayList<>(1):cookShopList).build());
|
||||
Equip unDetermined = user.getEquipManager().getUnDetermined();
|
||||
PlayerInfoProto.GetWorkShopInfoResponse.Builder builder = PlayerInfoProto.GetWorkShopInfoResponse.newBuilder().addAllWorkShopBaseInfo(workShopBaseInfoList).addAllWorkShopUnLockInfo(workShopUnLockInfoList);
|
||||
if(unDetermined !=null){
|
||||
CommonProto.Equip equipProto = CBean2Proto.getEquipProto(unDetermined);
|
||||
builder.setUnDetermined(equipProto);
|
||||
}
|
||||
builder.addAllTechnologyInfo(CBean2Proto.getTechInfo(workShopController.getTechnologyMap().values()));
|
||||
MessageUtil.sendMessage(session,1, MessageTypeProto.MessageType.GET_WORKSHOP_INFO_RESPONSE_VALUE,builder.build(),true);
|
||||
}
|
||||
// public void getWorkShopInfo(ISession session) throws Exception {
|
||||
// int uid = session.getUid();
|
||||
// User user = UserManager.getUser(uid);
|
||||
// WorkShopController workShopController = user.getWorkShopController();
|
||||
// Map<Integer, List<Integer>> openBlueStateMap = workShopController.getOpenBlueStateMap();
|
||||
// int workShopLevel = workShopController.getWorkShopLevel();
|
||||
// int workShopExp = workShopController.getWorkShopExp();
|
||||
//
|
||||
// int cookLevel = workShopController.getCookLevel();
|
||||
// int cookExp = workShopController.getCookExp();
|
||||
// List<Integer> workShopList = openBlueStateMap.get(GlobalsDef.WORK_SHOP_TYPE);
|
||||
// List<Integer> cookShopList = openBlueStateMap.get(GlobalsDef.COOK_SHOP_TYPE);
|
||||
//
|
||||
// List<CommonProto.WorkShopBaseInfo> workShopBaseInfoList = new ArrayList<>(2);
|
||||
// workShopBaseInfoList.add(CommonProto.WorkShopBaseInfo.newBuilder().setType(GlobalsDef.WORK_SHOP_TYPE).setLevle(workShopLevel).setExp(workShopExp).build());
|
||||
// workShopBaseInfoList.add(CommonProto.WorkShopBaseInfo.newBuilder().setType(GlobalsDef.COOK_SHOP_TYPE).setLevle(cookLevel).setExp(cookExp).build());
|
||||
// List<CommonProto.WorkShopUnLockInfo> workShopUnLockInfoList = new ArrayList<>(2);
|
||||
// workShopUnLockInfoList.add(CommonProto.WorkShopUnLockInfo.newBuilder().setType(GlobalsDef.WORK_BASE_TYPE).addAllId(workShopList == null ?new ArrayList<>(1):workShopList).build());
|
||||
// workShopUnLockInfoList.add(CommonProto.WorkShopUnLockInfo.newBuilder().setType(GlobalsDef.WORK_CREATE_TYPE).addAllId(cookShopList==null?new ArrayList<>(1):cookShopList).build());
|
||||
// Equip unDetermined = user.getEquipManager().getUnDetermined();
|
||||
// PlayerInfoProto.GetWorkShopInfoResponse.Builder builder = PlayerInfoProto.GetWorkShopInfoResponse.newBuilder().addAllWorkShopBaseInfo(workShopBaseInfoList).addAllWorkShopUnLockInfo(workShopUnLockInfoList);
|
||||
// if(unDetermined !=null){
|
||||
//// CommonProto.Equip equipProto = CBean2Proto.getEquipProto(unDetermined);
|
||||
// builder.setUnDetermined(equipProto);
|
||||
// }
|
||||
// builder.addAllTechnologyInfo(CBean2Proto.getTechInfo(workShopController.getTechnologyMap().values()));
|
||||
// MessageUtil.sendMessage(session,1, MessageTypeProto.MessageType.GET_WORKSHOP_INFO_RESPONSE_VALUE,builder.build(),true);
|
||||
// }
|
||||
|
||||
|
||||
|
||||
|
@ -259,75 +249,75 @@ public class WorkShopLogic {
|
|||
}
|
||||
|
||||
//装备打造 TODO
|
||||
public void createEquipByUser(ISession session,int equipTid, List<Integer> runneIdsList,int nums) throws Exception {
|
||||
int uid=session.getUid();
|
||||
User user = UserManager.getUser(uid);
|
||||
SGlobalSystemConfig sGlobalSystemConfig = STableManager.getConfig(SGlobalSystemConfig.class).get(FunctionIdEnum.Adventure.getFunctionType());
|
||||
if (!HandlerLogicThread.checkOpen(user,sGlobalSystemConfig)) {
|
||||
throw new ErrorCodeException(ErrorCode.newDefineCode("未开"));
|
||||
}
|
||||
SWorkShopEquipmentConfig sWorkShopEquipmentConfig = SWorkShopEquipmentConfig.getsWorkShopEquipmentConfigMap().get(equipTid);
|
||||
if(sWorkShopEquipmentConfig == null){
|
||||
throw new ErrorCodeException(ErrorCode.newDefineCode("equipTid not exists"));
|
||||
}
|
||||
if(!checkIsUnlock(GlobalsDef.WORK_CREATE_TYPE,sWorkShopEquipmentConfig.getType(),user.getWorkShopController(),sWorkShopEquipmentConfig.getOpenRules(),sWorkShopEquipmentConfig.getId())){
|
||||
throw new ErrorCodeException(ErrorCode.newDefineCode("未开"));
|
||||
}
|
||||
int runesNum = sWorkShopEquipmentConfig.getRunesNum();
|
||||
int[][] specialRunes = sWorkShopEquipmentConfig.getSpecialRunes();
|
||||
int needNums = runesNum - specialRunes.length;
|
||||
if(runneIdsList.size()!=needNums){
|
||||
throw new ErrorCodeException(ErrorCode.newDefineCode("符文错误"));
|
||||
}
|
||||
int costLength = runesNum + 1;
|
||||
int[] costMineral = sWorkShopEquipmentConfig.getMineral();
|
||||
if(costMineral == null || costMineral.length == 0){
|
||||
costLength = costLength-1;
|
||||
}
|
||||
int[][] costs = new int[costLength][];
|
||||
if(costMineral!=null && costMineral.length>0){
|
||||
costs[--costLength] =costMineral;
|
||||
}
|
||||
if(runneIdsList.size() ==0){
|
||||
runneIdsList =new ArrayList<>(specialRunes.length);
|
||||
}
|
||||
for(Integer runneId : runneIdsList){
|
||||
costs[--costLength] = new int[]{runneId, 1};
|
||||
}
|
||||
for(int specialRunneId[] : specialRunes){
|
||||
costs[--costLength] = new int[]{specialRunneId[0],specialRunneId[1]};
|
||||
}
|
||||
|
||||
boolean enoughCost = ItemUtil.itemCost(user,costs,nums,BIReason.WORKSHOP_EQUIP_CONSUME,equipTid);
|
||||
if(!enoughCost){
|
||||
throw new ErrorCodeException(ErrorCode.ITEM_NOT_ENOUGH);
|
||||
}
|
||||
CommonProto.Drop.Builder dropBuilder = CommonProto.Drop.newBuilder();
|
||||
//熟练度提升
|
||||
int type = sWorkShopEquipmentConfig.getType();
|
||||
int workShopLevel = user.getWorkShopController().getWorkShopLevel();
|
||||
if(type == GlobalsDef.WORK_SHOP_TYPE){
|
||||
user.getUserMissionManager().onGameEvent(user, GameEvent.WORKSHOP_CREATE_EQUIP,nums);
|
||||
while (nums-->0){
|
||||
Equip equip = new Equip(uid, equipTid, workShopLevel, runneIdsList);
|
||||
SEquipConfig sEquipConfig = STableManager.getConfig(SEquipConfig.class).get(equip.getEquipId());
|
||||
if (sEquipConfig.getQuality() >= SSpecialConfig.getIntegerValue(SSpecialConfig.lamp_lottery_equip_content_parm)) {
|
||||
String nickName = user.getPlayerInfoManager().getNickName();
|
||||
String message = SErrorCodeEerverConfig.getI18NMessage("lamp_lottery_equip_content", new Object[]{
|
||||
nickName, ItemUtil.equipQulityNameMap.get(sEquipConfig.getQuality()),SItem.getsItemMap().get(equip.getEquipId()).getName()});
|
||||
ChatLogic.getInstance().sendSysChatMessage(message, Global.LUCKY_LUCK,String.valueOf(equip.getEquipId()),0,0,0,0,0);
|
||||
}
|
||||
user.getEquipManager().addEquip(user,equip);
|
||||
dropBuilder.addEquipId(CBean2Proto.getEquipProto(equip));
|
||||
}
|
||||
}else if( type == GlobalsDef.COOK_SHOP_TYPE){
|
||||
Map<Integer,Integer> items = new HashMap<>();
|
||||
items.put(equipTid,SMysteryFoodSetting.getsMysteryFoodSetting().getFoodNum()*nums);
|
||||
ItemUtil.addItem(user,items,dropBuilder,BIReason.WORKSHOP_CREATEQUIP);
|
||||
}
|
||||
PlayerInfoProto.WorkShopEquipCreateResponse build = PlayerInfoProto.WorkShopEquipCreateResponse.newBuilder().setType(type).setDrop(dropBuilder).build();
|
||||
MessageUtil.sendMessage(session,1, MessageTypeProto.MessageType.WORKSHOP_EQUIP_CREATE_RESPONSE_VALUE,build,true);
|
||||
}
|
||||
// public void createEquipByUser(ISession session,int equipTid, List<Integer> runneIdsList,int nums) throws Exception {
|
||||
// int uid=session.getUid();
|
||||
// User user = UserManager.getUser(uid);
|
||||
// SGlobalSystemConfig sGlobalSystemConfig = STableManager.getConfig(SGlobalSystemConfig.class).get(FunctionIdEnum.Adventure.getFunctionType());
|
||||
// if (!HandlerLogicThread.checkOpen(user,sGlobalSystemConfig)) {
|
||||
// throw new ErrorCodeException(ErrorCode.newDefineCode("未开"));
|
||||
// }
|
||||
// SWorkShopEquipmentConfig sWorkShopEquipmentConfig = SWorkShopEquipmentConfig.getsWorkShopEquipmentConfigMap().get(equipTid);
|
||||
// if(sWorkShopEquipmentConfig == null){
|
||||
// throw new ErrorCodeException(ErrorCode.newDefineCode("equipTid not exists"));
|
||||
// }
|
||||
// if(!checkIsUnlock(GlobalsDef.WORK_CREATE_TYPE,sWorkShopEquipmentConfig.getType(),user.getWorkShopController(),sWorkShopEquipmentConfig.getOpenRules(),sWorkShopEquipmentConfig.getId())){
|
||||
// throw new ErrorCodeException(ErrorCode.newDefineCode("未开"));
|
||||
// }
|
||||
// int runesNum = sWorkShopEquipmentConfig.getRunesNum();
|
||||
// int[][] specialRunes = sWorkShopEquipmentConfig.getSpecialRunes();
|
||||
// int needNums = runesNum - specialRunes.length;
|
||||
// if(runneIdsList.size()!=needNums){
|
||||
// throw new ErrorCodeException(ErrorCode.newDefineCode("符文错误"));
|
||||
// }
|
||||
// int costLength = runesNum + 1;
|
||||
// int[] costMineral = sWorkShopEquipmentConfig.getMineral();
|
||||
// if(costMineral == null || costMineral.length == 0){
|
||||
// costLength = costLength-1;
|
||||
// }
|
||||
// int[][] costs = new int[costLength][];
|
||||
// if(costMineral!=null && costMineral.length>0){
|
||||
// costs[--costLength] =costMineral;
|
||||
// }
|
||||
// if(runneIdsList.size() ==0){
|
||||
// runneIdsList =new ArrayList<>(specialRunes.length);
|
||||
// }
|
||||
// for(Integer runneId : runneIdsList){
|
||||
// costs[--costLength] = new int[]{runneId, 1};
|
||||
// }
|
||||
// for(int specialRunneId[] : specialRunes){
|
||||
// costs[--costLength] = new int[]{specialRunneId[0],specialRunneId[1]};
|
||||
// }
|
||||
//
|
||||
// boolean enoughCost = ItemUtil.itemCost(user,costs,nums,BIReason.WORKSHOP_EQUIP_CONSUME,equipTid);
|
||||
// if(!enoughCost){
|
||||
// throw new ErrorCodeException(ErrorCode.ITEM_NOT_ENOUGH);
|
||||
// }
|
||||
// CommonProto.Drop.Builder dropBuilder = CommonProto.Drop.newBuilder();
|
||||
// //熟练度提升
|
||||
// int type = sWorkShopEquipmentConfig.getType();
|
||||
// int workShopLevel = user.getWorkShopController().getWorkShopLevel();
|
||||
// if(type == GlobalsDef.WORK_SHOP_TYPE){
|
||||
// user.getUserMissionManager().onGameEvent(user, GameEvent.WORKSHOP_CREATE_EQUIP,nums);
|
||||
// while (nums-->0){
|
||||
// Equip equip = new Equip(uid, equipTid, workShopLevel, runneIdsList);
|
||||
// SEquipConfig sEquipConfig = STableManager.getConfig(SEquipConfig.class).get(equip.getEquipId());
|
||||
// if (sEquipConfig.getQuality() >= SSpecialConfig.getIntegerValue(SSpecialConfig.lamp_lottery_equip_content_parm)) {
|
||||
// String nickName = user.getPlayerInfoManager().getNickName();
|
||||
// String message = SErrorCodeEerverConfig.getI18NMessage("lamp_lottery_equip_content", new Object[]{
|
||||
// nickName, ItemUtil.equipQulityNameMap.get(sEquipConfig.getQuality()),SItem.getsItemMap().get(equip.getEquipId()).getName()});
|
||||
// ChatLogic.getInstance().sendSysChatMessage(message, Global.LUCKY_LUCK,equip.getEquipId(),0,0,0,0,0);
|
||||
// }
|
||||
// user.getEquipManager().addEquip(user,equip);
|
||||
// dropBuilder.addEquipId(CBean2Proto.getEquipProto(equip));
|
||||
// }
|
||||
// }else if( type == GlobalsDef.COOK_SHOP_TYPE){
|
||||
// Map<Integer,Integer> items = new HashMap<>();
|
||||
// items.put(equipTid,SMysteryFoodSetting.getsMysteryFoodSetting().getFoodNum()*nums);
|
||||
// ItemUtil.addItem(user,items,dropBuilder,BIReason.WORKSHOP_CREATEQUIP);
|
||||
// }
|
||||
// PlayerInfoProto.WorkShopEquipCreateResponse build = PlayerInfoProto.WorkShopEquipCreateResponse.newBuilder().setType(type).setDrop(dropBuilder).build();
|
||||
// MessageUtil.sendMessage(session,1, MessageTypeProto.MessageType.WORKSHOP_EQUIP_CREATE_RESPONSE_VALUE,build,true);
|
||||
// }
|
||||
|
||||
//装备重铸
|
||||
// public void rebuildEquip(ISession session, String equipId, List<String> consumeEquipIds) throws Exception {
|
||||
|
|
|
@ -250,7 +250,7 @@ public class MailLogic {
|
|||
int[][] itemArr = StringUtil.parseFiledInt2(mailItem.toString());
|
||||
// 检测卡牌和装备背包
|
||||
int limit = ItemUtil.checkCardAndEquipLimit(user,itemArr);
|
||||
int state = 1;
|
||||
int state = 0;
|
||||
if (limit == 0){
|
||||
// 领取道具
|
||||
state = ItemUtil.dropByMail(user, itemArr, dropBuilder, BIReason.TAKE_MAIL_REWARD);
|
||||
|
|
|
@ -116,6 +116,21 @@ public class PlayerLogic {
|
|||
while (checkNameShield(name));
|
||||
return name;
|
||||
}
|
||||
|
||||
public String[] getRandomNameWithPreAndPost() {
|
||||
String name ;
|
||||
Map<Integer, String> surnameMap = SRandomName.getSurnameMap();
|
||||
Map<Integer, String> nameMap = SRandomName.getNameMap();
|
||||
String pre ;
|
||||
String post ;
|
||||
do {
|
||||
pre = surnameMap.get(MathUtils.random(1, surnameMap.size()));
|
||||
post = nameMap.get(MathUtils.random(1, nameMap.size()));
|
||||
name = pre + post;
|
||||
}
|
||||
while (checkNameShield(name));
|
||||
return new String[]{name,pre,post};
|
||||
}
|
||||
private boolean checkNameShield(String name) {
|
||||
return SensitivewordFilter.isContaintSensitiveWord(name, 1);
|
||||
}
|
||||
|
@ -192,7 +207,8 @@ public class PlayerLogic {
|
|||
if (length == -1) {
|
||||
throw new ErrorCodeException(ErrorCode.NAME_ILLEGAL);
|
||||
}
|
||||
if (length > STableManager.getFigureConfig(CommonStaticConfig.class).getGameSetting().getMaxNameLength() || length < 1) {
|
||||
// STableManager.getFigureConfig(CommonStaticConfig.class).getGameSetting().getMaxNameLength()
|
||||
if (length > 18 || length < 1) {
|
||||
throw new ErrorCodeException(ErrorCode.NAME_LENTH);
|
||||
}
|
||||
;
|
||||
|
@ -226,11 +242,11 @@ public class PlayerLogic {
|
|||
return -1;// 如果含有敏感词汇 -1
|
||||
}
|
||||
|
||||
// if (temp.matches(chinese)) {
|
||||
// valueLength += 2;
|
||||
// } else {
|
||||
if (temp.matches(chinese)) {
|
||||
valueLength += 3;
|
||||
} else {
|
||||
valueLength += 1;
|
||||
// }
|
||||
}
|
||||
}
|
||||
return valueLength;
|
||||
}
|
||||
|
@ -550,7 +566,7 @@ public class PlayerLogic {
|
|||
mailReward = ItemUtil.getMailReward(SLuxuryFund.getByFoundIdAndDay(goodsInfo.getKey(),sRechargeCommodityConfig.getContiueDays()-remainDays).getreward());
|
||||
LOGGER.info(":{}:",sRechargeCommodityConfig.getContiueDays()-remainDays - sendTims);
|
||||
}
|
||||
String content = SErrorCodeEerverConfig.getI18NMessage("recharge_"+type+"_daily_txt",new Object[]{remainDays + sendTims});
|
||||
String content = SErrorCodeEerverConfig.getI18NMessageNeedConvert("recharge_"+type+"_daily_txt",new Object[]{remainDays + sendTims},new int[]{0},"#");
|
||||
MailLogic.getInstance().sendMail(user.getId(),title,content,mailReward,nowTime, Global.MAIL_EFFECTIVE_TIME);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -61,7 +61,7 @@ public class RankLogic {
|
|||
public static class Instance {
|
||||
public final static RankLogic instance = new RankLogic();
|
||||
}
|
||||
public void getRank(ISession session, int type, int activityId,MessageTypeProto.MessageType messageType) throws Exception {
|
||||
public void getRank(ISession session, int type, int activityId,int index,MessageTypeProto.MessageType messageType) throws Exception {
|
||||
LOGGER.info("获取排行榜信息type={},activityId={}",type,activityId);
|
||||
int page = 1;
|
||||
String rkey = "";
|
||||
|
@ -87,7 +87,7 @@ public class RankLogic {
|
|||
}
|
||||
|
||||
}else{
|
||||
rankResponse = rank.getRank(session.getUid(),rkey,1, -1);
|
||||
rankResponse = rank.getRank(session.getUid(),rkey,index/20+1, 20);
|
||||
}
|
||||
ReportUtil.onReportEvent(UserManager.getUser(session.getUid()), ReportEventEnum.CHECK_RANKING.getType(),String.valueOf(type));
|
||||
MessageUtil.sendMessage(session,1,messageType.getNumber(),rankResponse,true);
|
||||
|
|
|
@ -47,8 +47,8 @@ public abstract class AbstractRank implements IRank {
|
|||
}
|
||||
int start = (page - 1) * rankEndLine, end = page * rankEndLine - 1;
|
||||
Set<ZSetOperations.TypedTuple<String>> zsetreverseRangeWithScores = getRankByKey(rkey,start,end);
|
||||
if(start==0){
|
||||
start=1;
|
||||
if(start%rankEndLine == 0){
|
||||
start++;
|
||||
}
|
||||
PlayerInfoProto.RankResponse.Builder allUserResponse = getAllUserResponse(zsetreverseRangeWithScores,start);
|
||||
//当前用户信息
|
||||
|
|
|
@ -410,13 +410,13 @@ public class BuyGoodsLogic {
|
|||
String title = SErrorCodeEerverConfig.getI18NMessage("recharge_" + sRechargeCommodityConfig.getType() + "_title");
|
||||
String content = SErrorCodeEerverConfig.getI18NMessage("recharge_" + sRechargeCommodityConfig.getType() + "_txt");
|
||||
if(type== 3 || type==1 || type==6){
|
||||
content = SErrorCodeEerverConfig.getI18NMessage("recharge_" + sRechargeCommodityConfig.getType() + "_txt",new Object[]{rewardStr.split("#")[1]});
|
||||
content = SErrorCodeEerverConfig.getI18NMessageNeedConvert("recharge_" + sRechargeCommodityConfig.getType() + "_txt",new Object[]{rewardStr.split("#")[1]},new int[]{0},"#");
|
||||
}
|
||||
if(type==10){
|
||||
//红包事件
|
||||
Poster.getPoster().dispatchEvent(new BuyGoodsDirectEvent(uid,goodsId));
|
||||
title = SErrorCodeEerverConfig.getI18NMessage("recharge_" + sRechargeCommodityConfig.getType() + "_title",new Object[]{sRechargeCommodityConfig.getName()});
|
||||
content = SErrorCodeEerverConfig.getI18NMessage("recharge_" + sRechargeCommodityConfig.getType() + "_txt",new Object[]{sRechargeCommodityConfig.getName()});
|
||||
title = SErrorCodeEerverConfig.getI18NMessageNeedConvert("recharge_" + sRechargeCommodityConfig.getType() + "_title",new Object[]{sRechargeCommodityConfig.getName()},new int[]{1},"#");
|
||||
content = SErrorCodeEerverConfig.getI18NMessageNeedConvert("recharge_" + sRechargeCommodityConfig.getType() + "_txt",new Object[]{sRechargeCommodityConfig.getName()},new int[]{1},"#");
|
||||
}
|
||||
if(!rewardStr.isEmpty()){
|
||||
MailLogic.getInstance().sendMail(user.getId(),title,content,rewardStr,nowTime, Global.MAIL_EFFECTIVE_TIME);
|
||||
|
|
|
@ -2,6 +2,7 @@ package com.ljsd.jieling.network.server;
|
|||
|
||||
import com.ljsd.jieling.db.redis.RedisKey;
|
||||
import com.ljsd.jieling.db.redis.RedisUtil;
|
||||
import com.ljsd.jieling.exception.ErrorCode;
|
||||
import com.ljsd.jieling.netty.cocdex.PacketNetData;
|
||||
import com.ljsd.jieling.network.session.ISession;
|
||||
import com.ljsd.jieling.util.MessageUtil;
|
||||
|
@ -38,7 +39,7 @@ import com.ljsd.jieling.util.MessageUtil;
|
|||
|
||||
static boolean auCheck(ISession session, PacketNetData packetNetData) {
|
||||
if (session.getToken() != packetNetData.getToken()) {
|
||||
SessionManager.getInstance().serverKick(session,"您的账号token不正确,请退出游戏重新登陆!");
|
||||
SessionManager.getInstance().serverKick(session, ErrorCode.tokenError,"您的账号token不正确,请退出游戏重新登陆!");
|
||||
return false;
|
||||
}
|
||||
|
||||
|
|
|
@ -98,8 +98,16 @@ public class SessionManager implements INetSession<ISession>, INetReceived<ISess
|
|||
//聊天请求太多了 过滤掉
|
||||
LOGGER.info("request={} commond ={}: ", packetNetData.getUserId(), MessageTypeProto.MessageType.valueOf(packetNetData.getMsgId()));
|
||||
}
|
||||
if (packetNetData.getMsgId() == MessageTypeProto.MessageType.LOGIN_REQUEST_VALUE ||
|
||||
packetNetData.getMsgId() == MessageTypeProto.MessageType.RECONNECT_REQUEST_VALUE) {
|
||||
if (packetNetData.getMsgId() == MessageTypeProto.MessageType.LOGIN_REQUEST_VALUE) {
|
||||
UserManager.loginIncrease();
|
||||
if (!onLoginORReLoginRequest(session, packetNetData)) {
|
||||
return;
|
||||
}
|
||||
|
||||
//在线列表加入session
|
||||
OnlineUserManager.userOnline(session.getUid(), session);
|
||||
}
|
||||
if(packetNetData.getMsgId() == MessageTypeProto.MessageType.RECONNECT_REQUEST_VALUE){
|
||||
if (!onLoginORReLoginRequest(session, packetNetData)) {
|
||||
return;
|
||||
}
|
||||
|
@ -131,7 +139,7 @@ public class SessionManager implements INetSession<ISession>, INetReceived<ISess
|
|||
|
||||
|
||||
private void dealHeartBeat(ISession session) {
|
||||
session.setHeartBreatNums(3);
|
||||
session.setHeartBreatNums(4);
|
||||
MessageUtil.sendHeartBeat(session);
|
||||
}
|
||||
|
||||
|
@ -154,7 +162,7 @@ public class SessionManager implements INetSession<ISession>, INetReceived<ISess
|
|||
private boolean onLoginORReLoginRequest(ISession session, PacketNetData packetNetData) {
|
||||
//初始化session
|
||||
if (!AuthManager.auVertiyFromRedis(session, packetNetData)) {
|
||||
serverKick(session,"您的账号token不正确,请退出游戏重新登陆!");
|
||||
serverKick(session,ErrorCode.tokenError,"您的账号token不正确,请退出游戏重新登陆!");
|
||||
return false;
|
||||
}
|
||||
//处理多设备重登
|
||||
|
@ -170,13 +178,13 @@ public class SessionManager implements INetSession<ISession>, INetReceived<ISess
|
|||
*/
|
||||
private int onRepeatLogin(ISession newSession) {
|
||||
int uid = newSession.getUid();
|
||||
if (OnlineUserManager.checkUidOnline(uid)) {
|
||||
if (OnlineUserManager.checkUidOnline(uid)&&!OnlineUserManager.checkOnlineByToken(newSession.getToken())) {
|
||||
ISession iSession = OnlineUserManager.getSessionByUid(uid);
|
||||
if (iSession == newSession) {
|
||||
return 0;
|
||||
}
|
||||
LOGGER.error("您的账号已经在其他设备上登陆,请确认账号安全!"+iSession.getId()+"\r\nnew "+newSession.getId());
|
||||
serverKick(iSession,"您的账号已经在其他设备上登陆,请确认账号安全!");
|
||||
serverKick(iSession,ErrorCode.reloginCode,"您的账号已经在其他设备上登陆,请确认账号安全!");
|
||||
return 1;
|
||||
}
|
||||
return 0;
|
||||
|
@ -293,9 +301,9 @@ public class SessionManager implements INetSession<ISession>, INetReceived<ISess
|
|||
}
|
||||
|
||||
|
||||
void serverKick(ISession session,String err){
|
||||
MessageUtil.sendErrorCode(session, ErrorCode.reloginCode,err);
|
||||
session.setOfflineType(ErrorCode.reloginCode);
|
||||
void serverKick(ISession session,int errorCode,String err){
|
||||
MessageUtil.sendErrorCode(session, errorCode,err);
|
||||
session.setOfflineType(errorCode);
|
||||
User userInMem = UserManager.getUserInMem(session.getUid());
|
||||
if(userInMem!=null){
|
||||
processUserOfflineData(userInMem,session);
|
||||
|
|
|
@ -52,7 +52,7 @@ public class ISession extends NettyGameSession {
|
|||
}
|
||||
}
|
||||
|
||||
private int heartBreatNums = 3;
|
||||
private int heartBreatNums = 4;
|
||||
|
||||
//<<<<<<< HEAD
|
||||
//=======
|
||||
|
|
|
@ -75,7 +75,7 @@ public class GuildChangeTask implements GeneralTask{
|
|||
//发送邮件 GuildLeaderPass_mail_title
|
||||
int leadPassTime = SSpecialConfig.getIntegerValue(SSpecialConfig.GUILD_LEADER_PASS_TIME);
|
||||
String title = SErrorCodeEerverConfig.getI18NMessage("GuildLeaderPass_mail_title");
|
||||
String content = SErrorCodeEerverConfig.getI18NMessage("GuildLeaderPass_mail_content", new Object[]{leadPassTime,user.getPlayerInfoManager().getNickName()});
|
||||
String content = SErrorCodeEerverConfig.getI18NMessageNeedConvert("GuildLeaderPass_mail_content", new Object[]{leadPassTime,user.getPlayerInfoManager().getNickName()},new int[]{0,0},"#");
|
||||
sendMailToGuild(guildInfo,title,content,(int)(now/1000));
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
|
@ -93,7 +93,7 @@ public class GuildChangeTask implements GeneralTask{
|
|||
GuildInfo guildInfo = guildInfoMap.get(next);
|
||||
int releaseTime = SSpecialConfig.getIntegerValue(SSpecialConfig.GUILD_DISMISS_TIME);
|
||||
String title = SErrorCodeEerverConfig.getI18NMessage("GuildDismiss_mail_title");
|
||||
String content = SErrorCodeEerverConfig.getI18NMessage("GuildDismiss_mail_content", new Object[]{releaseTime,guildInfo.getName()});
|
||||
String content = SErrorCodeEerverConfig.getI18NMessageNeedConvert("GuildDismiss_mail_content", new Object[]{releaseTime,guildInfo.getName()},new int[]{0,0},"#");
|
||||
sendMailToGuild(guildInfo,title,content,(int)(now/1000));
|
||||
Map<Integer, Set<Integer>> members = guildInfo.getMembers();
|
||||
for(Map.Entry<Integer, Set<Integer>> entry:members.entrySet()){
|
||||
|
|
|
@ -767,7 +767,7 @@ public class ItemUtil {
|
|||
builder.append(entry.getKey()).append("#").append(entry.getValue());
|
||||
String title = SErrorCodeEerverConfig.getI18NMessage("item_max_mail_title");
|
||||
SItem item = SItem.getsItemMap().get(entry.getKey());
|
||||
String content = SErrorCodeEerverConfig.getI18NMessage("item_max_mail_content",new String[]{item.getName(),String.valueOf(item.getItemNumlimit())});
|
||||
String content = SErrorCodeEerverConfig.getI18NMessageNeedConvert("item_max_mail_content",new String[]{item.getName(),String.valueOf(item.getItemNumlimit())},new int[]{1,0},"#");
|
||||
MailLogic.getInstance().sendMail(user.getId(),title,content,builder.toString(),TimeUtils.nowInt(),Global.MAIL_EFFECTIVE_TIME);
|
||||
builder = new StringBuilder();
|
||||
}
|
||||
|
@ -783,7 +783,7 @@ public class ItemUtil {
|
|||
*/
|
||||
public static int addItemByMail(User user, Map<Integer, Integer> itemMap,CommonProto.Drop.Builder dropBuilder,int reason) throws Exception {
|
||||
if (itemMap.isEmpty()) {
|
||||
return 0;
|
||||
return 1;
|
||||
}
|
||||
List<CommonProto.Item> itemProtoList = new CopyOnWriteArrayList<>();
|
||||
ItemManager itemManager = user.getItemManager();
|
||||
|
@ -1375,8 +1375,9 @@ public class ItemUtil {
|
|||
}
|
||||
if (item.getQuantity() >= SSpecialConfig.getIntegerValue(msgTem+"_parm")) {
|
||||
String nickName = user.getPlayerInfoManager().getNickName();
|
||||
String message = SErrorCodeEerverConfig.getI18NMessage(msgTem, new Object[]{nickName, equipQulityNameMap.get(item.getQuantity()), item.getName()});
|
||||
String message = SErrorCodeEerverConfig.getI18NMessageNeedConvert(msgTem, new Object[]{nickName, equipQulityNameMap.get(item.getQuantity()), item.getName()},new int[]{0,1,1});
|
||||
ChatLogic.getInstance().sendSysChatMessage(message,Global.LUCKY_LUCK,String.valueOf(equipId),0,0,0,0,0);
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -1457,7 +1458,7 @@ public class ItemUtil {
|
|||
heroList.add(CBean2Proto.getHero(hero));
|
||||
SCHero scHero = SCHero.getsCHero().get(hero.getTemplateId());
|
||||
if (scHero.getStar() >= SSpecialConfig.getIntegerValue(SSpecialConfig.lamp_lottery_content_parm)) { //策划资质改成星级
|
||||
String message = SErrorCodeEerverConfig.getI18NMessage("lamp_lottery_content", new Object[]{playerInfoManager.getNickName(), scHero.getStar(), scHero.getReadingName()});
|
||||
String message = SErrorCodeEerverConfig.getI18NMessageNeedConvert("lamp_lottery_content", new Object[]{playerInfoManager.getNickName(), scHero.getStar(), scHero.getReadingName()},new int[]{0,0,1});
|
||||
if (!message.isEmpty()){
|
||||
ChatLogic.getInstance().sendSysChatMessage(message,Global.LUCKY_LUCK,String.valueOf(hero.getTemplateId()),0,0,0,0,0);
|
||||
}
|
||||
|
@ -1833,7 +1834,7 @@ public class ItemUtil {
|
|||
SSpiritAnimal animal = STableManager.getConfig(SSpiritAnimal.class).get(entry.getKey());
|
||||
ReportUtil.onReportEvent(user,ReportEventEnum.GET_BEAST.getType(),entry.getKey(),animal.getQuality(),reason);
|
||||
if (animal.getQuality() >= SSpecialConfig.getIntegerValue(SSpecialConfig.ANIMAL_BROADCAST_QUALITY)&&reason!=BIReason.COMPOS_HERO_REWARD) { //策划资质改成星级
|
||||
String message = SErrorCodeEerverConfig.getI18NMessage("animal_get_broadcast_content", new Object[]{user.getPlayerInfoManager().getNickName(), animal.getName()});
|
||||
String message = SErrorCodeEerverConfig.getI18NMessageNeedConvert("animal_get_broadcast_content", new Object[]{user.getPlayerInfoManager().getNickName(), animal.getName()},new int[]{0,1});
|
||||
if (!message.isEmpty()){
|
||||
ChatLogic.getInstance().sendSysChatMessage(message,Global.LUCKY_LUCK,"0",0,0,0,0,0);
|
||||
}
|
||||
|
|
File diff suppressed because it is too large
Load Diff
|
@ -9,7 +9,7 @@ import java.util.concurrent.ConcurrentHashMap;
|
|||
|
||||
@Table(name ="ErrorCodeEerverConfig")
|
||||
public class SErrorCodeEerverConfig implements BaseConfig {
|
||||
private static Map<String ,String> errorCodeMap;
|
||||
private static Map<String ,SErrorCodeEerverConfig> errorCodeMap;
|
||||
private int id;
|
||||
|
||||
private String key;
|
||||
|
@ -17,14 +17,16 @@ public class SErrorCodeEerverConfig implements BaseConfig {
|
|||
private String value;
|
||||
|
||||
private String englishValue;
|
||||
|
||||
|
||||
private String vNValue;
|
||||
|
||||
@Override
|
||||
public void init() throws Exception {
|
||||
Map<Integer, SErrorCodeEerverConfig> config = STableManager.getConfig(SErrorCodeEerverConfig.class);
|
||||
Map<String ,String> errorCodeEerverConfigMap = new ConcurrentHashMap<>();
|
||||
Map<String ,SErrorCodeEerverConfig> errorCodeEerverConfigMap = new ConcurrentHashMap<>();
|
||||
for (Map.Entry<Integer, SErrorCodeEerverConfig> entry :config.entrySet()){
|
||||
SErrorCodeEerverConfig sErrorCodeEerverConfig = entry.getValue();
|
||||
errorCodeEerverConfigMap.put(sErrorCodeEerverConfig.getkey(),sErrorCodeEerverConfig.getvalue());
|
||||
errorCodeEerverConfigMap.put(sErrorCodeEerverConfig.getkey(),sErrorCodeEerverConfig);
|
||||
}
|
||||
errorCodeMap = errorCodeEerverConfigMap;
|
||||
}
|
||||
|
@ -46,19 +48,46 @@ public class SErrorCodeEerverConfig implements BaseConfig {
|
|||
return englishValue;
|
||||
}
|
||||
|
||||
public String getvNValue() {
|
||||
return vNValue;
|
||||
}
|
||||
|
||||
public static String getI18NMessage(String key){
|
||||
String value = errorCodeMap.get(key);
|
||||
SErrorCodeEerverConfig value = errorCodeMap.get(key);
|
||||
if (value == null) {
|
||||
return "";
|
||||
}
|
||||
return value;
|
||||
return value.getvalue();
|
||||
}
|
||||
|
||||
public static String getI18NMessage(String key,Object[] obj ){
|
||||
String value = errorCodeMap.get(key);
|
||||
if (value == null) {
|
||||
SErrorCodeEerverConfig value = errorCodeMap.get(key);
|
||||
if(value==null){
|
||||
return "";
|
||||
}
|
||||
return MessageFormat.format(value, obj);
|
||||
return MessageFormat.format(value.getvalue(), obj) + "|" + MessageFormat.format(value.getEnglishValue(), obj) +"|"+MessageFormat.format(value.getvNValue(), obj);
|
||||
|
||||
}
|
||||
public static String getI18NMessageNeedConvert(String key,Object[] obj ,int[] convert){
|
||||
return getI18NMessageNeedConvert(key,obj,convert,"|");
|
||||
}
|
||||
public static String getI18NMessageNeedConvert(String key,Object[] obj ,int[] convert,String split){
|
||||
if(!split.equals("#")&&!split.equals("|")){
|
||||
return "";
|
||||
}
|
||||
SErrorCodeEerverConfig value = errorCodeMap.get(key);
|
||||
if(value==null){
|
||||
return "";
|
||||
}
|
||||
if(convert.length!=obj.length){
|
||||
convert = new int[obj.length];
|
||||
}
|
||||
StringBuilder str = new StringBuilder();
|
||||
for(int i = 0 ; i <obj.length;i++) {
|
||||
str.append(split).append(convert[i]).append(obj[i].toString());
|
||||
}
|
||||
System.out.println("组合字符串:"+value.getvalue()+str.toString());
|
||||
return value.getvalue()+str.toString();
|
||||
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue