命格,宝石

master_ob2
PC-202302260912\Administrator 2023-08-25 17:27:46 +08:00
parent 454345fff4
commit 6e69024fd4
33 changed files with 710 additions and 321 deletions

View File

@ -894,4 +894,8 @@ public class TimeUtils {
LocalDate start = LocalDate.parse(startTime, form);
return ChronoUnit.DAYS.between(start, LocalDate.parse(endTime, form));
}
public static long getToTomorrowTimeS(){
return getTomorrowZero() - now();
}
}

View File

@ -18,9 +18,6 @@ public class Utils {
/**
* bytesint
* @param data
* @param offset
* @return
*/
public static int bytesToInt(byte[] data, int offset) {
int num = 0;
@ -33,8 +30,6 @@ public class Utils {
/**
* intbyte
* @param num
* @return
*/
public static byte[] intToBytes(int num) {
byte[] b = new byte[4];
@ -56,7 +51,7 @@ public class Utils {
* MD5
* */
public static String MD5(String inStr) {
MessageDigest md5 = null;
MessageDigest md5;
try {
md5 = MessageDigest.getInstance("MD5");
} catch (Exception e) {
@ -71,10 +66,10 @@ public class Utils {
byte[] md5Bytes = md5.digest(byteArray);
StringBuffer hexValue = new StringBuffer();
StringBuilder hexValue = new StringBuilder();
for (int i = 0; i < md5Bytes.length; i++) {
int val = ((int) md5Bytes[i]) & 0xff;
for (byte md5Byte : md5Bytes) {
int val = ((int) md5Byte) & 0xff;
if (val < 16)
hexValue.append("0");
hexValue.append(Integer.toHexString(val));
@ -90,7 +85,7 @@ public class Utils {
String[] str = {"1","2","3","4","5","6","7","8","9","A","B","C","D","E","F","G","H","J","K","L","M","N","P","Q","R","S","T","U","V","W","X","Y","Z"};
int strLength =str.length;
Random random = new Random();
int rand = 0 ;
int rand;
StringBuilder stringBuffer = new StringBuilder();
for (int i=0; i< num;i++){
rand = random.nextInt(strLength);
@ -101,8 +96,6 @@ public class Utils {
/**
*
* @param string
* @return
*/
public static String getIntByString(String string){
String regEx = "[^0-9]";
@ -112,9 +105,6 @@ public class Utils {
}
/** Serializable
* @param obj
* @param <T>
* @return
*/
public static <T extends Serializable> T clone(T obj) {
T cloneObj = null;
@ -139,10 +129,8 @@ public class Utils {
/**
* intlist
* @param list
* @return
*/
public static int[][] getTwoArrayObject(List<int[]> list){
public static int[][] getTwoArrayInt(List<int[]> list){
int[][] objects = new int[list.size()][];
for (int i = 0; i < list.size(); i++) {
objects[i] = list.get(i);
@ -152,8 +140,6 @@ public class Utils {
/**
* listmap使
* @param list
* @return
*/
public static Map<Integer, Long> getItemMapObject(List<int[][]> list){
HashMap<Integer, Long> map = new HashMap<>();
@ -189,17 +175,17 @@ public class Utils {
/**
* map
*/
public static Object[][] getTwoArrayObject(Map map) {
Object[][] object = null;
public static int[][] getTwoArrayInt(Map<Integer, Integer> map) {
int[][] object = null;
if (map != null && !map.isEmpty()) {
int size = map.size();
object = new Object[size][2];
object = new int[size][2];
Iterator iterator = map.entrySet().iterator();
Iterator<Map.Entry<Integer, Integer>> iterator = map.entrySet().iterator();
for (int i = 0; i < size; i++) {
Map.Entry entry = (Map.Entry) iterator.next();
Object key = entry.getKey();
Object value = entry.getValue();
Map.Entry<Integer, Integer> entry = iterator.next();
int key = entry.getKey();
int value = entry.getValue();
object[i][0] = key;
object[i][1] = value;
}

View File

@ -77,6 +77,8 @@ public enum FunctionIdEnum {
CrossServerChat(127,null),//跨服聊天
TwoTowerChallenge(139,null),//双队塔
ThereTowerChallenge(140,null),//三队塔
GemNew(144, null),//命格新
GemNewAdvanced(145, null),//命格新-高级
WeekGood(9091,null),
;

View File

@ -30,7 +30,7 @@ public class SevenWorldFunction implements FunctionManager {
LOGGER.error("七界试炼,重置排行榜退出, key{} 跨服分组 ={},锁状态:{},未获取到锁",lockKey, crossGroup, lock);
return;
}
RedisUtil.getInstence().expire2(lockKey,TimeUtils.ONE_MINUTE*5);
RedisUtil.getInstence().expireMills(lockKey,TimeUtils.ONE_MINUTE*5);
String crossRedisKey = RankContext.getRankEnum(RankEnum.CROSS_SEVEN_WORLD_RANK.getType()).getCrossRedisKey();
// LOGGER.info("七界试炼活动结束,开始发奖...");
// // 排行榜

View File

@ -352,55 +352,24 @@ public class RedisKey {
public static final String GOD_LEVEL_UP_TIME = "GOD_LEVEL_UP_TIME";//晋升神尊等级排序
public static Set<String> familyKey = new HashSet<>();
// 四灵试炼0首次通关1最低战力
// public final static String FOUR_CHALLENGE = "FOUR_CHALLENGE";
/**
*
* key
*/
public final static String FOUR_CHALLENGE_TIER_RANK = "FOUR_CHALLENGE_TIER_RANK";
/**
*
* key
*/
public final static String POWER_RICE_RANK = "POWER_RICE_RANK";
/**
*
* key
*/
public final static String EXPLORE_RANK = "EXPLORE_RANK";
public final static String FOUR_CHALLENGE_TIER_RANK = "FOUR_CHALLENGE_TIER_RANK";//四灵试炼层数排行榜
/**
*
* key
*/
public final static String HERO_HOT_RANK = "HERO_HOT_RANK";
public final static String POWER_RICE_RANK = "POWER_RICE_RANK";//战力冲刺排行榜
/**
*
* key
*/
public final static String DUO_DUI_RANK = "DUO_DUI_RANK";
public final static String EXPLORE_RANK = "EXPLORE_RANK";//探索排行榜
/**
*
* key
*/
public static final String USER_LIKE_HERO_HOT_RANK = "USER_LIKE_HERO_HOT_RANK";
public final static String HERO_HOT_RANK = "HERO_HOT_RANK";//英雄热度排行榜
/**
*
*/
public static final String HERO_STAR_RANK = "HERO_STAR_RANK";
/**
*
*/
public static final String EQUIP_SCORE_RANK = "EQUIP_SCORE_RANK";
/**
*
*/
public static final String SOUL_SEAL_RANK = "SOUL_SEAL_RANK";
public final static String DUO_DUI_RANK = "DUO_DUI_RANK";//多对塔
public static final String USER_LIKE_HERO_HOT_RANK = "USER_LIKE_HERO_HOT_RANK";//玩家给点击过的英雄
public static final String HERO_STAR_RANK = "HERO_STAR_RANK";//升星排行榜
public static final String EQUIP_SCORE_RANK = "EQUIP_SCORE_RANK";//战力排行榜
public static final String SOUL_SEAL_RANK = "SOUL_SEAL_RANK";//魂印排行榜
/**
*
@ -416,15 +385,8 @@ public class RedisKey {
*/
public final static String HELP_FIGHT = "HELP_FIGHT";
/**
*
*/
//七届积分排行
public static final String SEVEN_WORLD_INTEGRAL_RANK = "SEVEN_WORLD_INTEGRAL_RANK";
//七届标记
// public static final String SEVEN_WORLD_MARK = "SEVEN_WORLD_MARK";
//网页支付特殊处理用
// public static final String WEB_PAY = "WEB_PAY";
// 御剑飞行排行
public static final String RIDING_SWARD_RANK = "RIDING_SWARD_RANK";
// 御剑飞行记录
@ -435,14 +397,15 @@ public class RedisKey {
public static final String ALL_PEOPLE_WELFARE_BUY_COUNT = "ALL_PEOPLE_WELFARE_BUY_COUNT";
// 邮件奖励
public static final String MAIL_REWARD_MARK = "MAIL_REWARD_MARK";
// 罗浮称号奖励标记
public static final String LUOFU_TITLE_REWARD_MARK = "LUOFU_TITLE_REWARD_MARK";
// 首充标记
public static final String First_Recharge = "First_Recharge";
// 命格抽卡次数每日
public static final String GEM_DRAW_COUNT_DAY = "GEM_DRAW_COUNT_DAY";
public static Set<String> newAreaCacChe = new HashSet<>();//进程排行 合区统一
//进程排行 合区统一
public static Set<String> newAreaCacChe = new HashSet<>();
public static Set<String> rankCacChe = new HashSet<>();

View File

@ -117,7 +117,7 @@ public class RedisUtil {
* @param key
* @param time ()
*/
public void expire2(String key, long time) {
public void expireMills(String key, long time) {
try {
if (time > 0) {
redisTemplate.expire(key, time, TimeUnit.MILLISECONDS);
@ -195,7 +195,7 @@ public class RedisUtil {
// 重命名
redisTemplate.rename(oldName, newName);
// 设置过期时间
expire2(newName, time);
expireMills(newName, time);
}
}
}

View File

@ -438,4 +438,7 @@ public interface BIReason {
int MAGIC_SOLDIER_UP_STAR_COST = 1329;//神兵升星消耗
int VOUCHERS_BUY_GOOD_COST = 1330;//代金卷购买礼包消耗
int GEM_NEW_LOTTERY_REWARD = 1331;//命格抽卡奖励
int GEM_NEW_LOTTERY_COST = 1332;//命格抽卡消耗
}

View File

@ -283,7 +283,7 @@ public class FastChallengeHandler extends BaseHandler<FightInfoProto.FastFightCh
}
if (!value.contains(uid) && uid != 0){
value.add(uid);
RedisUtil.getInstence().putMapEntry(key, "", guildIdStr,value);
RedisUtil.getInstence().putMapEntry(key, "", guildIdStr, value);
}
return value.size();
}

View File

@ -0,0 +1,19 @@
package com.ljsd.jieling.handler.equip;
import com.ljsd.jieling.handler.BaseHandler;
import com.ljsd.jieling.logic.equip.EquipLogic;
import com.ljsd.jieling.network.session.ISession;
import rpc.protocols.MessageTypeProto;
import rpc.protocols.PlayerInfoProto;
public class GemNewLotteryHandler extends BaseHandler<PlayerInfoProto.GemNewDrawRequest> {
@Override
public MessageTypeProto.MessageType getMessageCode() {
return MessageTypeProto.MessageType.GemNewDrawRequest;
}
@Override
public void processWithProto(ISession iSession, PlayerInfoProto.GemNewDrawRequest proto) throws Exception {
EquipLogic.getInstance().GemNewDraw(iSession, proto);
}
}

View File

@ -0,0 +1,19 @@
package com.ljsd.jieling.handler.equip;
import com.ljsd.jieling.handler.BaseHandler;
import com.ljsd.jieling.logic.equip.EquipLogic;
import com.ljsd.jieling.network.session.ISession;
import rpc.protocols.MessageTypeProto;
import rpc.protocols.PlayerInfoProto;
public class GetGemNewInfoHandler extends BaseHandler<PlayerInfoProto.GemNewDrawRequest> {
@Override
public MessageTypeProto.MessageType getMessageCode() {
return MessageTypeProto.MessageType.GemNewDrawRequest;
}
@Override
public void processWithProto(ISession iSession, PlayerInfoProto.GemNewDrawRequest proto) throws Exception {
EquipLogic.getInstance().getGemNewInfo(iSession);
}
}

View File

@ -4,7 +4,6 @@ import com.google.protobuf.GeneratedMessage;
import com.ljsd.jieling.logic.player.PlayerLogic;
import rpc.net.RpcMessage;
import rpc.net.gtGBaseHandler;
import rpc.protocols.PlayerInfoProto;
import rpc.world.WorldProto;
/**
@ -17,11 +16,10 @@ public class GetPlayerOneTeamInfoRequestHandler extends gtGBaseHandler<WorldPro
@Override
public GeneratedMessage processWithProto(RpcMessage rpcMessage, WorldProto.GetPlayerOneTeamInfoRequest proto) throws Exception {
PlayerInfoProto.GetPlayerOneTeamInfoResponse oneTeamInfo = PlayerLogic.getInstance().getOneTeamInfo( proto.getPlayerId(), proto.getTeamId());
// WorldProto.ViewHeroInfoResponse build = WorldProto.ViewHeroInfoResponse.newBuilder().addAllEquip(viewHeroInfoResponse.getEquipList())
// WorldProto.ViewHeroInfoResponse build = WorldProto.ViewHeroInfoResponse.newBuilder().addAllEquip(viewHeroInfoResponse.getEquipList())
// .setHero(viewHeroInfoResponse.getHero()).setForce(viewHeroInfoResponse.getForce())
// .setGuildSkill(viewHeroInfoResponse.getGuildSkill()).addAllSpecialEffects(viewHeroInfoResponse.getSpecialEffectsList()).build();s
return oneTeamInfo;
return PlayerLogic.getInstance().getOneTeamInfo( proto.getPlayerId(), proto.getTeamId());
}
}

View File

@ -61,7 +61,7 @@ public class XiuxianLevelUpRequestHandler extends BaseHandler<HeroInfoProto.Sixi
if (curIndex == -1) {
curMaxLevel = maxLevel;
} else {
int integerValue[] = SSpecialConfig.getIntegerArrayValue(SSpecialConfig.FightForPerXiuweiLevel);
int[] integerValue = SSpecialConfig.getIntegerArrayValue(SSpecialConfig.FightForPerXiuweiLevel);
int fightForPerXiuweiLevel = integerValue[curIndex];
if (curIndex - 1 >= 0) {
maxForce -= fightForPerXiuweiForces[curIndex - 1];

View File

@ -1,6 +1,5 @@
package com.ljsd.jieling.handler.player;
import com.ljsd.jieling.core.GlobalsDef;
import com.ljsd.jieling.db.redis.RedisKey;
import com.ljsd.jieling.db.redis.RedisUtil;
import com.ljsd.jieling.exception.ErrorCode;
@ -37,7 +36,7 @@ public class ViewHeroInfoHandler extends BaseHandler<PlayerInfoProto.ViewHeroInf
if(proto.getTeamId()== TeamEnum.CROSS_YU_XU_LUN_DAO_ONE.getTeamId()||
proto.getTeamId()== TeamEnum.CROSS_YU_XU_LUN_DAO_TWO.getTeamId()||
proto.getTeamId()== TeamEnum.CROSS_YU_XU_LUN_DAO_THREE.getTeamId()){
PlayerInfoProto.ViewHeroInfoResponse viewHeroInfoResponse = PlayerLogic.getInstance().viewYuxuHeroInfo(proto.getTargetUid(), proto.getHeroId(), proto.getTeamId());
PlayerInfoProto.ViewHeroInfoResponse viewHeroInfoResponse = PlayerLogic.getInstance().viewYuxuHeroInfo(proto.getTargetUid(), proto.getHeroId());
MessageUtil.sendMessage(iSession,1,MessageTypeProto.MessageType.VIEW_HERO_INFO_RESPONSE_VALUE,viewHeroInfoResponse,true);
return;
}
@ -66,7 +65,7 @@ public class ViewHeroInfoHandler extends BaseHandler<PlayerInfoProto.ViewHeroInf
if(proto.getTeamId()== TeamEnum.CROSS_YU_XU_LUN_DAO_ONE.getTeamId()||
proto.getTeamId()== TeamEnum.CROSS_YU_XU_LUN_DAO_TWO.getTeamId()||
proto.getTeamId()== TeamEnum.CROSS_YU_XU_LUN_DAO_THREE.getTeamId()){
PlayerInfoProto.ViewHeroInfoResponse viewHeroInfoResponse = PlayerLogic.getInstance().viewCrossYuxuHeroInfo(proto.getTargetUid(), proto.getHeroId(), proto.getTeamId());
PlayerInfoProto.ViewHeroInfoResponse viewHeroInfoResponse = PlayerLogic.getInstance().viewCrossYuxuHeroInfo(proto.getTargetUid(), proto.getHeroId());
MessageUtil.sendMessage(iSession,1,MessageTypeProto.MessageType.VIEW_HERO_INFO_RESPONSE_VALUE,viewHeroInfoResponse,true);
}else {
PlayerInfoProto.ViewHeroInfoResponse viewHeroInfoResponse = PlayerLogic.getInstance().viewHeroInfo(proto.getTargetUid(), proto.getHeroId(), proto.getTeamId());

View File

@ -101,6 +101,12 @@ public class GlobleSystemLogic implements IEventHandler {
result = false;
}
break;
case 6://修行等级
int xiuxingLv = user.getHeroManager().getPracticeLevel();
if (xiuxingLv < openRule[1]){
result = false;
}
break;
default:break;
}
return result;

View File

@ -1819,7 +1819,7 @@ public class ActivityLogic implements IEventHandler{
}
}
// 处理奖励
int[][] rewards = Utils.getTwoArrayObject(list);
int[][] rewards = Utils.getTwoArrayInt(list);
CommonProto.Drop.Builder drop = ItemUtil.dropPer(user, rewards, BIReason.QIMENDUNJIA_DRAW);
// 事件分发
Poster.getPoster().dispatchEvent(new QiMenDunJiaEvent(user.getId(),activityId,num));

View File

@ -142,7 +142,7 @@ public class SevenWorldActivity extends AbstractActivity {
if (rewardList.isEmpty()){
throw new ErrorCodeException(ErrorCode.SERVER_SELF_DEFINE);
}
int[][] rewards = Utils.getTwoArrayObject(rewardList);
int[][] rewards = Utils.getTwoArrayInt(rewardList);
ItemUtil.drop(user, rewards, drop, BIReason.SEVEN_WORLD_TREASURE);
reportTakeActivityReward(user,treasure.getTreasureReward(),missionId);
// 更新数据库

View File

@ -777,7 +777,7 @@ public class ArenaLogic {
LOGGER.error("罗浮争锋,发奖退出,未获取到锁:{}",lockKey);
return;
}
RedisUtil.getInstence().expire2(lockKey,TimeUtils.ONE_MINUTE * 5);
RedisUtil.getInstence().expireMills(lockKey,TimeUtils.ONE_MINUTE * 5);
AbstractRank rank = RankContext.getRankEnum(RankEnum.CROSS_SERVICE_ARENA.getType());
String title = SErrorCodeEerverConfig.getI18NMessage("mserverarena_reward_title");
@ -826,7 +826,7 @@ public class ArenaLogic {
redisUtil.putMapEntry2(key,String.valueOf(reward[0]),time);
LOGGER.info("罗浮争锋发送称号奖励到redis缓存uid{}称号id{},到期时间:{}",uid,reward[0],time);
}
redisUtil.expire2(key,TimeUtils.WEEK);
redisUtil.expireMills(key,TimeUtils.WEEK);
}
/**
@ -907,7 +907,7 @@ public class ArenaLogic {
LOGGER.error("罗浮争锋,初始化排行榜退出,未获取到锁");
return;
}
RedisUtil.getInstence().expire2(lockKey, TimeUtils.ONE_MINUTE * 5);
RedisUtil.getInstence().expireMills(lockKey, TimeUtils.ONE_MINUTE * 5);
LOGGER.info("罗浮争锋,初始化排行榜开始...");
String key1 = RedisUtil.getInstence().getKey(RedisKey.CROSS_ARENA_ROBOT_INFO, String.valueOf(crossGroup));

View File

@ -16,6 +16,8 @@ public class EquipManager extends MongoBase {
private final Map<String,Jewel> jewelMap = new HashMap<>();
private final Map<Integer,Integer> equipHandBook;
private Map<Integer, GemNew> gemNewMap = new HashMap<>();
private int soulEquipPool;//占星装备卡池
/**
@ -147,7 +149,11 @@ public class EquipManager extends MongoBase {
public void addEquipBookEnabled(int bookId) {
equipBookEnabled.add(bookId);
updateString("equipBookEnabled", equipBookEnabled);
}
public void setEquipHomeRankUp(int equipHomeRankUp) {
this.equipHomeRankUp = equipHomeRankUp;
updateString("equipBookEnabled", equipBookEnabled);
}
public Set<Integer> getEquipList() {
@ -157,4 +163,18 @@ public class EquipManager extends MongoBase {
equipList.add(equipId);
updateString("equipList",equipList);
}
public void putGemNewMap(int type, GemNew gemNew) {
this.gemNewMap.put(type, gemNew);
updateString("gemNewMap",gemNewMap);
}
public void setGemNewMap(Map<Integer, GemNew> gemNewMap) {
this.gemNewMap = gemNewMap;
updateString("gemNewMap",gemNewMap);
}
public Map<Integer, GemNew> getGemNewMap() {
return gemNewMap;
}
}

View File

@ -0,0 +1,25 @@
package com.ljsd.jieling.logic.dao;
import java.util.HashMap;
import java.util.Map;
public class GemNew {
private int id;
private Map<Integer, Integer> attribute = new HashMap<>();
public int getId() {
return id;
}
public void setId(int id) {
this.id = id;
}
public Map<Integer, Integer> getAttribute() {
return attribute;
}
public void setAttribute(Map<Integer, Integer> attribute) {
this.attribute = attribute;
}
}

View File

@ -23,7 +23,7 @@ public class PlayerManager extends MongoBase {
private static final long serialVersionUID = 145421254563L;
private transient String openId;
private transient String openId;
private int pid;
@ -41,8 +41,6 @@ public class PlayerManager extends MongoBase {
private String nameColor;
private String cc_id;
private int sex;
private int level;
@ -59,8 +57,6 @@ public class PlayerManager extends MongoBase {
private long createTime; //创建时间
private String clientVersion;
private int maxStamina ; // 最大体力
private long offLineTime;// 离线时间
@ -195,57 +191,34 @@ public class PlayerManager extends MongoBase {
private boolean compareNumEndGame;
/**
* key value
*/
// 开启的七界层数, key 七届类型, value 最高层数
private Map<Integer,Integer> sevenWorldOpenTier = new HashMap<>();
/**
* keyid value01
*/
// 七界试炼遗物信息,只存储激活的遗物信息, key遗物id value遗物状态0未激活1已激活
private Map<Integer,Integer> sevenWorldRelic = new HashMap<>();
// 御剑行游玩次数
private int ridingSwardNum;
/**
*
* keyidvkeyvalue01
*/
private int ridingSwardNum;// 御剑行游玩次数
//周卡 key周卡idvkey天数value领取状态0未领取1已领取
private Map<Integer,Map<Integer,Integer>> weekCard = new HashMap<>();
//玩家抽取到的五星次数,目前只应用于招募基金使用
private int getFiveStarHeroNum;
//探索
private Map<Integer,ExplorerInfo> explorer = new HashMap<>(); //<teamId,队伍数据>
private List<KeyVal> exploreEvent = new ArrayList<>();//随机事件
private int exploreEventMatchDefUid;//探索事件 镜像心魔 匹配对手uid
/**
*
*/
private Map<Integer,ArchitectureInfo> architectureInfoMap = new HashMap<>();
/**
*
*/
private Map<Integer,LandInfo> landInfoMap = new HashMap<>();
/**
*
*/
private HashSet<Integer> heroDispatchAgos = new HashSet<>();
private Map<Integer,ArchitectureInfo> architectureInfoMap = new HashMap<>();//浮生阁建筑列表
private Map<Integer,LandInfo> landInfoMap = new HashMap<>();//栖云阁地块列表
private HashSet<Integer> heroDispatchAgos = new HashSet<>();//栖云阁已派遣英雄列表
private Set<Integer> desireOpenHeroList = new HashSet<>();//心愿可以选择的英雄列表
private Set<Integer> desireOpenFabaoList = new HashSet<>();//心愿可以选择的法宝列表
private final Map<Integer, Integer> desireDraw = new HashMap<>();//选择的心愿
/**
*
*/
private Set<Integer> desireOpenHeroList = new HashSet<>();
//挑战副本等级
private int endlessNewReplica; //无尽副本
private int treasureReplica; //宝物副本
private int exploreKillTotalNum; //探索杀敌总数
private long lastWholeLifeTime;//最近一次领取终身卡的时间
/**
*
*/
private Set<Integer> desireOpenFabaoList = new HashSet<>();
/**
*
*/
private final Map<Integer, Integer> desireDraw = new HashMap<>();
private Map<Integer, Integer> gemDrawCountMap = new HashMap<>();// 命格抽卡次数记录
public PlayerManager(){
this.setRootCollection(User._COLLECTION_NAME);
@ -255,17 +228,6 @@ public class PlayerManager extends MongoBase {
return architectureInfoMap;
}
/**
*
*/
private int endlessNewReplica; //无尽副本
private int treasureReplica; //宝物副本
private int exploreKillTotalNum; //探索杀敌总数
private long lastWholeLifeTime;//最近一次领取终身卡的时间
public Map<Integer, Integer> getDesireDraw() {
return desireDraw;
}
@ -1584,4 +1546,19 @@ public class PlayerManager extends MongoBase {
this.compareNumEndGame = compareNumEndGame;
updateString("compareNumEndGame", this.compareNumEndGame);
}
public Map<Integer, Integer> getGemDrawCountMap() {
return gemDrawCountMap;
}
public void setGemDrawCountMap(Map<Integer, Integer> gemDrawCountMap) {
this.gemDrawCountMap = gemDrawCountMap;
updateString("gemDrawCountMap", this.gemDrawCountMap);
}
public void addGemDrawCount(int libraryId, int count) {
Integer num = gemDrawCountMap.getOrDefault(libraryId, 0);
gemDrawCountMap.put(libraryId, num + count);
updateString("gemDrawCountMap", this.gemDrawCountMap);
}
}

View File

@ -1,34 +1,37 @@
package com.ljsd.jieling.logic.equip;
import com.ljsd.jieling.core.FunctionIdEnum;
import com.ljsd.jieling.db.redis.RedisKey;
import com.ljsd.jieling.db.redis.RedisUtil;
import com.ljsd.jieling.exception.ErrorCode;
import com.ljsd.jieling.exception.ErrorCodeException;
import com.ljsd.jieling.globals.BIReason;
import com.ljsd.jieling.logic.GlobleSystemLogic;
import com.ljsd.jieling.logic.activity.event.Poster;
import com.ljsd.jieling.logic.activity.event.SaveHeroForceEvent;
import com.ljsd.jieling.logic.dao.EquipManager;
import com.ljsd.jieling.logic.dao.Faxiang;
import com.ljsd.jieling.logic.dao.Hero;
import com.ljsd.jieling.logic.dao.UserManager;
import com.ljsd.jieling.logic.dao.*;
import com.ljsd.jieling.logic.dao.root.User;
import com.ljsd.jieling.network.session.ISession;
import com.ljsd.jieling.tools.Utils;
import com.ljsd.jieling.util.CBean2Proto;
import com.ljsd.jieling.util.ItemUtil;
import com.ljsd.jieling.util.MessageUtil;
import config.SCHero;
import config.SFaxiangConfig;
import config.SFaxiangLevelConfig;
import config.SFaxiangStarConfig;
import config.*;
import org.apache.commons.lang3.RandomUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import rpc.protocols.CommonProto;
import rpc.protocols.MessageTypeProto;
import rpc.protocols.PlayerInfoProto;
import util.StringUtil;
import util.TimeUtils;
import java.util.*;
import java.util.stream.Collectors;
/**
*
*/
public class EquipLogic {
private static final Logger LOGGER = LoggerFactory.getLogger(EquipLogic.class);
public static class Instance {
@ -278,4 +281,183 @@ public class EquipLogic {
PlayerInfoProto.GetAllFaxiangEquipResponse build = PlayerInfoProto.GetAllFaxiangEquipResponse.newBuilder().addAllEquips(equips).setIsFinish(isFinish).build();
MessageUtil.sendMessage(iSession, 1, MessageTypeProto.MessageType.GET_ALL_FAXIANG_EQUIP_RESPONSE_VALUE, build, true);
}
/**
*
*/
public void GemNewDraw(ISession iSession, PlayerInfoProto.GemNewDrawRequest proto) throws Exception {
User user = UserManager.getUser(iSession.getUid());
int libraryId = proto.getLibraryId();
int drawNum = proto.getDrawNum();
gemLotteryCost(user, libraryId, drawNum);
CommonProto.Drop.Builder drop = CommonProto.Drop.newBuilder();
int count = drawNum == 1?1:10;
for (int i = 0; i < count; i++) {
oneGemLottery(user, libraryId, drop);
}
sendGemNewIndication(iSession);
PlayerInfoProto.GemNewDrawResponse.Builder builder = PlayerInfoProto.GemNewDrawResponse.newBuilder().setDrop(drop);
MessageUtil.sendMessage(iSession, 1, MessageTypeProto.MessageType.GemNewDrawResponse_VALUE, builder.build(), true);
}
/**
*
*/
public void gemLotteryCost(User user, int libraryId, int drawNum) throws Exception {
// 功能开启条件判断
SGlobalSystemConfig systemConfig;
if (libraryId == 1){
systemConfig = SGlobalSystemConfig.getConfigById(FunctionIdEnum.GemNew.getFunctionType());
}else {
systemConfig = SGlobalSystemConfig.getConfigById(FunctionIdEnum.GemNewAdvanced.getFunctionType());
}
boolean open = GlobleSystemLogic.checkOpen(user, systemConfig);
if (!open){
throw new ErrorCodeException(ErrorCode.ACTIVITY_NOT_OPEN);
}
// 消耗道具数量判断
int[][] cost;
if (libraryId == 1){
if (drawNum == 1){
cost = SSpecialConfig.getTwiceArrayValue(SSpecialConfig.Gem_Lottery);
}else {
cost = SSpecialConfig.getTwiceArrayValue(SSpecialConfig.Gem_Lottery10);
}
}else {
if (drawNum == 1){
cost = SSpecialConfig.getTwiceArrayValue(SSpecialConfig.Gem_Senior_Lottery);
}else {
cost = SSpecialConfig.getTwiceArrayValue(SSpecialConfig.Gem_Senior_Lottery10);
}
}
// 一级道具消耗
boolean cost1 = ItemUtil.itemCost(user, new int[][]{cost[0]}, BIReason.GEM_NEW_LOTTERY_COST, 0);
if (cost1){
return;
}
// 二级道具消耗
boolean cost2 = ItemUtil.itemCost(user, new int[][]{cost[1]}, BIReason.GEM_NEW_LOTTERY_COST, 0);
if (!cost2){
throw new ErrorCodeException(ErrorCode.ITEM_NOT_ENOUGH);
}
}
/**
*
*/
public void oneGemLottery(User user, int libraryId, CommonProto.Drop.Builder drop) throws Exception {
Map<Integer, SGemLotteryConfig> lotteryConfigMap = SGemLotteryConfig.libraryMap.get(libraryId);
if (lotteryConfigMap == null){
throw new ErrorCodeException(ErrorCode.CFG_NULL);
}
// 总抽卡次数/等级判断
int num = user.getPlayerInfoManager().getGemDrawCountMap().getOrDefault(libraryId, 0);
SGemLotteryConfig config = null;
for (SGemLotteryConfig value : lotteryConfigMap.values()) {
if (num > value.getLibraryNumber() && (config == null || value.getLibraryNumber() > config.getLibraryNumber())){
config = value;
}
}
if (config == null){
throw new ErrorCodeException(ErrorCode.CFG_NULL);
}
// 每日抽奖次数判断
int count = getDayLotteryCount(user.getId(), libraryId);
int[] dailyNumber = config.getDailyNumber();
int indexOfNum = 0;
for (int i = 0; i < dailyNumber.length; i++) {
if (dailyNumber[i] > count){
indexOfNum = i;
}
}
// 品质概率判断
int[] quality = config.getQualityProbability()[indexOfNum];
int qualityTotalWeight = Arrays.stream(quality).sum();
int qualityResult = RandomUtils.nextInt(0, qualityTotalWeight);
int indexOfQuality = 0;
for (int i = 0; i < quality.length; i++) {
if (qualityResult > quality[i]){
indexOfQuality = i;
}
}
int level = config.getGemLevel()[indexOfQuality];
// 类型概率判断
int[] typeProbability = config.getGemTypeProbability();
int typeTotalWeight = Arrays.stream(typeProbability).sum();
int typeResult = RandomUtils.nextInt(0, typeTotalWeight);
int indexOfType = 0;
for (int i = 0; i < typeProbability.length; i++) {
if (typeResult > typeProbability[i]){
indexOfType = i;
}
}
int type = config.getGemType()[indexOfType];
// 获取到具体宝石
SGemConfigNew gemConfigNew = SGemConfigNew.typeMap.get(type).get(level);
// 属性权重区间判断
int[] proportion = gemConfigNew.getProportion();
int proportionTotalWeight = Arrays.stream(proportion).sum();
int proportionResult = RandomUtils.nextInt(0, proportionTotalWeight);
int indexOfProportion = 0;
for (int i = 0; i < proportion.length; i++) {
if (proportionResult > proportion[i]){
indexOfProportion = i;
}
}
// 获取命格属性
int[] property = gemConfigNew.getPropertyNumber()[indexOfProportion];
int propertyResult = RandomUtils.nextInt(property[0], property[1]);
// 封装命格对象
GemNew gemNew = new GemNew();
gemNew.setId(gemConfigNew.getId());
HashMap<Integer, Integer> attrMap = new HashMap<>();
attrMap.put(gemConfigNew.getProperty(), propertyResult);
gemNew.setAttribute(attrMap);
// 增加抽卡次数
setDayLotteryCount(user.getId(), libraryId, 1);
user.getPlayerInfoManager().addGemDrawCount(libraryId, 1);
ItemUtil.drop(user, gemNew, drop, BIReason.GEM_NEW_LOTTERY_REWARD);
}
public void getGemNewInfo(ISession iSession) throws Exception {
User user = UserManager.getUser(iSession.getUid());
List<CommonProto.GemNew> gemNews = CBean2Proto.toBeanGemNew(user);
PlayerInfoProto.GemNewInfoResponse.Builder builder = PlayerInfoProto.GemNewInfoResponse.newBuilder().addAllGems(gemNews);
MessageUtil.sendMessage(iSession, 1, MessageTypeProto.MessageType.GemNewInfoRequest_VALUE, builder.build(), true);
}
public void sendGemNewIndication(ISession iSession) throws Exception {
User user = UserManager.getUser(iSession.getUid());
List<CommonProto.GemNew> gemNews = CBean2Proto.toBeanGemNew(user);
PlayerInfoProto.GemNewInfoResponse.Builder builder = PlayerInfoProto.GemNewInfoResponse.newBuilder().addAllGems(gemNews);
MessageUtil.sendIndicationMessage(iSession, 1, MessageTypeProto.MessageType.GemNewInfoIndication_VALUE, builder.build(), true);
}
public String getDayLotteryKey(int uid){
return RedisUtil.getInstence().getKey2(RedisKey.GEM_DRAW_COUNT_DAY, String.valueOf(uid));
}
public void setDayLotteryCount(int uid, int libraryId, int count){
String key = getDayLotteryKey(uid);
RedisUtil.getInstence().putMapEntry2(key, String.valueOf(libraryId), count);
RedisUtil.getInstence().expireMills(key, TimeUtils.getToTomorrowTimeS());
}
public int getDayLotteryCount(int uid, int libraryId){
return RedisUtil.getInstence().getMapValue2(getDayLotteryKey(uid), String.valueOf(libraryId), Integer.class);
}
}

View File

@ -314,7 +314,7 @@ public class HelpHeroLogic {
RedisUtil.getInstence().putMapEntry2(key, String.valueOf(type), helpHero);
long time = TimeUtils.getTomorrowZero() - TimeUtils.now();
RedisUtil.getInstence().expire2(key, time);
RedisUtil.getInstence().expireMills(key, time);
}
/**

View File

@ -45,6 +45,7 @@ import com.ljsd.jieling.logic.redpacket.WelfareRedPacketType;
import com.ljsd.jieling.logic.store.BuyGoodsNewLogic;
import com.ljsd.jieling.logic.store.newRechargeInfo.PushRechargeType;
import com.ljsd.jieling.network.session.ISession;
import com.ljsd.jieling.tools.Utils;
import com.ljsd.jieling.util.CBean2Proto;
import com.ljsd.jieling.util.ItemUtil;
import com.ljsd.jieling.util.MessageUtil;
@ -2810,16 +2811,21 @@ public class HeroLogic {
}
// 命格
for (Map.Entry<Integer, Map<Integer, Integer>> lifeGridMapEntry : heroManager.getLifeGridMap().entrySet()) {
for (Map.Entry<Integer, Integer> entry : lifeGridMapEntry.getValue().entrySet()) {
int lifeStoneId = entry.getValue();
if (lifeStoneId <= 0){
continue;
}
SGemConfig sGemConfig=STableManager.getConfig(SGemConfig.class).get(lifeStoneId);
combinedAttribute(sGemConfig.getProperty(), heroAllAttribute);
}
Map<Integer, GemNew> gemNewMap = user.getEquipManager().getGemNewMap();
for (GemNew value : gemNewMap.values()) {
int[][] property = Utils.getTwoArrayInt(value.getAttribute());
combinedAttribute(property, heroAllAttribute);
}
// for (Map.Entry<Integer, Map<Integer, Integer>> lifeGridMapEntry : heroManager.getLifeGridMap().entrySet()) {
// for (Map.Entry<Integer, Integer> entry : lifeGridMapEntry.getValue().entrySet()) {
// int lifeStoneId = entry.getValue();
// if (lifeStoneId <= 0){
// continue;
// }
// SGemConfig sGemConfig=STableManager.getConfig(SGemConfig.class).get(lifeStoneId);
// combinedAttribute(sGemConfig.getProperty(), heroAllAttribute);
// }
// }
}
private void applyFourQuadrantAttribute(Map<Integer, Long> heroAllAttribute, int heroTempId, User user){

View File

@ -19,7 +19,6 @@ import com.ljsd.jieling.util.ItemUtil;
import com.ljsd.jieling.util.MessageUtil;
import config.SHomeLand;
import config.SHomeLandLevel;
import config.SPrivilegeTypeConfig;
import config.SSpecialConfig;
import manager.STableManager;
import org.slf4j.Logger;
@ -118,7 +117,7 @@ public class HomeLogic {
}
costList.add(new int[]{intValues[1], count});
// 类型转换
int[][] arrayObject = Utils.getTwoArrayObject(costList);
int[][] arrayObject = Utils.getTwoArrayInt(costList);
boolean itemCost = ItemUtil.itemCost(user, arrayObject, BIReason.ARCHITECTURE_UP_LEVEL, 0);
if (!itemCost){
throw new ErrorCodeException(ErrorCode.ITEM_NOT_ENOUGH, "浮生门建筑立即升级建筑levelId"+info.getId()+",道具:"+Arrays.toString(arrayObject));

View File

@ -345,7 +345,7 @@ public class MailLogic {
String timeKey = String.valueOf(TimeUtils.now());
RedisUtil.getInstence().putMapEntry2(key,timeKey,mail);
// 有新邮件就增加30天的有效时间
RedisUtil.getInstence().expire2(key, TimeUtils.ONE_DAY*30);
RedisUtil.getInstence().expireMills(key, TimeUtils.ONE_DAY*30);
LOGGER.info("redis邮件标记key:{}, time:{}, mail{}",key,timeKey,mail);
}

View File

@ -60,6 +60,7 @@ import util.TimeUtils;
import java.util.*;
import java.util.stream.Collectors;
@SuppressWarnings("unchecked")
public class PlayerLogic {
private static final Logger LOGGER = LoggerFactory.getLogger(PlayerLogic.class);
private PlayerLogic(){
@ -166,7 +167,7 @@ public class PlayerLogic {
/**
*
* @param name
* @param name
* @param type 1: 2: 3
*/
public void resetUserName(ISession iSession, String name, int type,int teamPosId,int sex) throws Exception {
@ -175,7 +176,7 @@ public class PlayerLogic {
User user = UserManager.getUser(uid);
PlayerManager playerInfoManager = user.getPlayerInfoManager();
TeamPosManager teamPosManager = user.getTeamPosManager();
if (checkName(iSession, name, msgId)){
if (checkName(iSession, name)){
return;
}
if (type == 1||type == 3) {
@ -224,7 +225,7 @@ public class PlayerLogic {
MessageUtil.sendMessage(iSession,1,msgId,null,true);
}
private boolean checkName(ISession iSession, String name, int msgId) throws Exception {
private boolean checkName(ISession iSession, String name) throws Exception {
int length = getStrLength(name);
if (length == -1) {
throw new ErrorCodeException(ErrorCode.NAME_ILLEGAL);
@ -247,10 +248,8 @@ public class PlayerLogic {
/**
*
*
* @param value
* @return
*/
@SuppressWarnings("UnnecessaryUnicodeEscape")
private int getStrLength(String value) {
int valueLength = 0;
String chinese = "[\u0391-\uFFE5]";
@ -597,9 +596,11 @@ public class PlayerLogic {
//四象心法
teamInfo.addAllSixiangxinfaInfo(GetPlayerInfoHandler.getSixiangxinfaInfos(user.getHeroManager()));
//命格
teamInfo.addAllLifeGridInfo(GetPlayerInfoHandler.getLifeGridInfos(user.getHeroManager()));
// teamInfo.addAllLifeGridInfo(GetPlayerInfoHandler.getLifeGridInfos(user.getHeroManager()));
//坐骑
teamInfo.addAllUserMountInfo(CBean2Proto.getUserMountList(user));
// 命格新
teamInfo.addAllGemNews(CBean2Proto.toBeanGemNew(user));
int guildId = user.getPlayerInfoManager().getGuildId();
if(guildId!=0){
GuildInfo guildInfo = GuilidManager.getGuildInfo(guildId);
@ -800,7 +801,7 @@ public class PlayerLogic {
// teamOneTeamInfo.addPokemonInfos(CBean2Proto.getSimpleTeamInfoByPokeMon(pokemon, entry.getKey()));
// }
//LOGGER.info("=====================跨服获取阵容:{}",teamId);
Integer integer = HeroLogic.getInstance().calTeamTotalForce(user, teamId, false);
int integer = HeroLogic.getInstance().calTeamTotalForce(user, teamId, false);
teamOneTeamInfo.setTotalForce(integer);
// for(Map.Entry<Integer, PurpleMansionSeal> entry:user.getHeroManager().getPurpleMansionSeal().entrySet()){
@ -877,7 +878,7 @@ public class PlayerLogic {
// teamOneTeamInfo.addPokemonInfos(CBean2Proto.getSimpleTeamInfoByPokeMon(pokemon, entry.getKey()));
// }
//LOGGER.info("=====================跨服获取阵容:{}",teamId);
Integer integer = HeroLogic.getInstance().calTeamTotalForce(user, teamId, false);
int integer = HeroLogic.getInstance().calTeamTotalForce(user, teamId, false);
teamOneTeamInfo.setTotalForce(integer);
// for(Map.Entry<Integer, PurpleMansionSeal> entry:user.getHeroManager().getPurpleMansionSeal().entrySet()){
@ -906,8 +907,6 @@ public class PlayerLogic {
/**
* 使
* @param csPlayer
* @return
*/
public CrossArenaManager getCrossArenaManagerData(CSPlayer csPlayer){
@ -933,13 +932,12 @@ public class PlayerLogic {
rPCClient = ClientAdapterPo.getClientAdapterPo(sb.toString());
crossArenaManager = rPCClient.getClient().getHeroManagerInfo(uid);
}catch (Exception e) {
LOGGER.error("callback=>{}", e);
LOGGER.error("callback=>{}", e.getMessage(), e);
} finally {
if(rPCClient != null){
rPCClient.returnObject(sb.toString());
}else{
LOGGER.info("callback=> rPCClient is null ");
return null;
}
}
return crossArenaManager;
@ -963,18 +961,17 @@ public class PlayerLogic {
.append(ip).append("|")
.append(port);
ClientAdapterPo<RPCRequestIFace.Client> rPCClient = null;
boolean isSuccess =false;
boolean isSuccess = false;
try{
rPCClient = ClientAdapterPo.getClientAdapterPo(sb.toString());
isSuccess = rPCClient.getClient().sendCrossLingmaiHongdian(uid);
}catch (Exception e) {
LOGGER.error("callback=>{}", e);
LOGGER.error("callback=>{}", e.getMessage(), e);
} finally {
if(rPCClient != null){
rPCClient.returnObject(sb.toString());
}else{
LOGGER.info("callback=> rPCClient is null ");
return isSuccess;
}
}
return isSuccess;
@ -1057,7 +1054,7 @@ public class PlayerLogic {
//builder.setTeam(teamOneTeamInfo.build());
builder.addCrossTeam(teamOneTeamInfo.build());
}
PlayerInfoProto.GetPlayerCrossYxldOneTeamInfoResponse.Builder playerTeamInfo = PlayerInfoProto.GetPlayerCrossYxldOneTeamInfoResponse.newBuilder().setTeamInfo(builder.build());
// PlayerInfoProto.GetPlayerCrossYxldOneTeamInfoResponse.Builder playerTeamInfo = PlayerInfoProto.GetPlayerCrossYxldOneTeamInfoResponse.newBuilder().setTeamInfo(builder.build());
return builder.build();
}
@ -1155,8 +1152,6 @@ public class PlayerLogic {
}
/**
*
* @param
* @return
*/
public static List<CommonProto.TransformationCardInfo> getTransformationInfoListFromRpc( List<TransformationCardInfo> listRpc){
List<CommonProto.TransformationCardInfo> list = new ArrayList<>();
@ -1171,7 +1166,6 @@ public class PlayerLogic {
/**
*
* @return
*/
public static List<CommonProto.UserMountInfo> getUserMountList(List<com.ljsd.jieling.thrift.idl.UserMountInfo> userMountInfo) {
List<CommonProto.UserMountInfo> userMountLists = new ArrayList<>();
@ -1184,7 +1178,6 @@ public class PlayerLogic {
}
/**
*
* @return
*/
public static List<CommonProto.LifeGridInfo>RpcData2LifeGridInfos( CrossArenaManager crossArenaManager ){
List<LifeGridInfo> rpcdata = crossArenaManager.getLifeGridInfos();
@ -1217,7 +1210,7 @@ public class PlayerLogic {
return info;
}
public void viewRobotHeroInfo(ISession session, SArenaRobotConfig sArenaRobotConfig,String robotHeroId,int teamId) throws Exception {
public void viewRobotHeroInfo(ISession session, SArenaRobotConfig sArenaRobotConfig,String robotHeroId,int teamId) {
PlayerInfoProto.ViewHeroInfoResponse.Builder builder = PlayerInfoProto.ViewHeroInfoResponse.newBuilder();
int[] differDemonsId = sArenaRobotConfig.getDifferDemonsId();
@ -1264,7 +1257,7 @@ public class PlayerLogic {
// 宝器
for(String equipId : hero.getJewelInfo()){
PropertyItem propertyItem = equipMap.get(equipId);
Jewel jewel = null;
Jewel jewel;
if (propertyItem instanceof Jewel){
jewel = (Jewel) propertyItem;
}else {
@ -1352,7 +1345,7 @@ public class PlayerLogic {
}
}
/**
/*
* redis
* time 2023-02-23
*/
@ -1397,10 +1390,6 @@ public class PlayerLogic {
/**
*
* @param user
* @param privilegeTypeId
* @param checkNum
* @return
*/
public boolean check(User user, int privilegeTypeId, int checkNum){
return originCheck(user,privilegeTypeId,checkNum,0);
@ -1408,10 +1397,6 @@ public class PlayerLogic {
/**
*
* @param user
* @param privilegeTypeId
* @param updateNum
* @return
*/
public boolean checkAndUpdate(User user, int privilegeTypeId, int updateNum){
return originCheck(user,privilegeTypeId,updateNum,1);
@ -1419,11 +1404,7 @@ public class PlayerLogic {
/**
*
* @param user
* @param privilegeTypeId
* @param updateNum
* @param operate 0 1
* @return
*/
private boolean originCheck(User user, int privilegeTypeId, int updateNum, int operate){
if(privilegeTypeId == 0){
@ -1457,11 +1438,7 @@ public class PlayerLogic {
/**
* id
* @param user
* @param privilegeId
* @param updateNum
* @param operate 0 1
* @return
*/
public boolean checkOrUpPrivilegeId(User user, int privilegeId, int updateNum, int operate){
if(privilegeId == 0){
@ -1490,9 +1467,6 @@ public class PlayerLogic {
/**
*
* @param user
* @param privilegeTypeId
* @return
*/
public int checkAndConsumeAllPrivilegeTimes(User user, int privilegeTypeId){
Map<Integer, VipInfo> vipInfo = user.getPlayerInfoManager().getVipInfo();
@ -1528,9 +1502,6 @@ public class PlayerLogic {
/**
*
* @param user
* @param privilegeType
* @return
*/
public int getMaxCountByPrivilegeType(User user ,int privilegeType){
List<SPrivilegeTypeConfig> sPrivilegeTypeConfigs = SPrivilegeTypeConfig.privilegeByType.get(privilegeType);
@ -1548,9 +1519,6 @@ public class PlayerLogic {
/**
* id
* @param user
* @param privilegeId
* @return
*/
public int getMaxCountByPrivilege(User user,int privilegeId){
SPrivilegeTypeConfig sPrivilegeTypeConfig = SPrivilegeTypeConfig.getsPrivilegeTypeConfigMap().get(privilegeId);
@ -1607,8 +1575,6 @@ public class PlayerLogic {
/**
*
* @param user
* @return
*/
public List<CommonProto.MonthCardInfo> getMonthCardInfo(User user) {
List<CommonProto.MonthCardInfo> cardInfos = new LinkedList<>();
@ -1635,12 +1601,10 @@ public class PlayerLogic {
return cardInfos;
}
/**
/*
*
* @param user
* @throws Exception
*/
public void checkOldMonthCard(User user) throws Exception {
// public void checkOldMonthCard(User user) throws Exception {
// PlayerManager playerInfoManager = user.getPlayerInfoManager();
// if (playerInfoManager.getOldMonthCardMark() == 1){
// return;
@ -1674,84 +1638,79 @@ public class PlayerLogic {
// }
// }
// playerInfoManager.setOldMonthCardMark(1);
}
// }
/**
/*
*
* @param user
*/
public void checkOldHeadFrame(User user){
// 已经处理过,不再执行
int oldHeadFrame = user.getPlayerInfoManager().getOldHeadFrame();
if (oldHeadFrame == 1){
return;
}
// 获取玩家道具新
ItemManager itemManager = user.getItemManager();
// 头像框到期时间
Map<Integer, Long> validTime = user.getPlayerInfoManager().getHeadFrameValidTime();
// 获取头像框表
Map<Integer, SPlayerHeadIcon> headIconMap = SPlayerHeadIcon.getHeadIconMapByType().get(SPlayerHeadIcon.HeadFrameType);
if (headIconMap == null || headIconMap.isEmpty()){
return;
}
// 当前时间,秒
long now = TimeUtils.now() / 1000;
headIconMap.forEach((k,v)->{
// 是否有道具
Item item = itemManager.getItem(k);
if (item != null){
// 是否使用
Long time = validTime.get(k);
if (time == null){
// 0永久其他到期时间
if (v.getTime() == 0){
validTime.putIfAbsent(k,0L);
}else {
validTime.putIfAbsent(k,now+v.getTime());
}
}
}
});
// public void checkOldHeadFrame(User user){
// // 已经处理过,不再执行
// int oldHeadFrame = user.getPlayerInfoManager().getOldHeadFrame();
// if (oldHeadFrame == 1){
// return;
// }
// // 获取玩家道具新
// ItemManager itemManager = user.getItemManager();
// // 头像框到期时间
// Map<Integer, Long> validTime = user.getPlayerInfoManager().getHeadFrameValidTime();
// // 获取头像框表
// Map<Integer, SPlayerHeadIcon> headIconMap = SPlayerHeadIcon.getHeadIconMapByType().get(SPlayerHeadIcon.HeadFrameType);
// if (headIconMap == null || headIconMap.isEmpty()){
// return;
// }
// // 当前时间,秒
// long now = TimeUtils.now() / 1000;
// headIconMap.forEach((k,v)->{
// // 是否有道具
// Item item = itemManager.getItem(k);
// if (item != null){
// // 是否使用
// Long time = validTime.get(k);
// if (time == null){
// // 0永久其他到期时间
// if (v.getTime() == 0){
// validTime.putIfAbsent(k,0L);
// }else {
// validTime.putIfAbsent(k,now+v.getTime());
// }
// }
// }
// });
//
// // 更新玩家数据
// user.getPlayerInfoManager().setHeadFrameValidTime(validTime);
// user.getPlayerInfoManager().setOldHeadFrame(1);
// }
// 更新玩家数据
user.getPlayerInfoManager().setHeadFrameValidTime(validTime);
user.getPlayerInfoManager().setOldHeadFrame(1);
}
/**
/*
*
* @param user
*/
public void soulPrintHandBookDispose(User user){
// 魂印图鉴列表
Set<Integer> equipList = user.getEquipManager().getEquipList();
// 道具背包
Map<Integer, Item> itemMap = user.getItemManager().getItemMap();
// 道具背包
for (Item item : itemMap.values()) {
// 读表,获取道具详细信息
SItem sItem = SItem.getsItemMap().get(item.getItemId());
// 道具不为空,且类型为6魂印,添加到图鉴中,set集合不需要重复验证
if (sItem != null && sItem.getItemBaseType() == 6){
equipList.add(sItem.getId());
}
}
// 英雄装备中的
Collection<Hero> heroes = user.getHeroManager().getHeroMap().values();
for (Hero hero : heroes) {
if (hero.getSoulEquipByPositionMap() != null){
equipList.addAll(hero.getSoulEquipByPositionMap().values());
}
}
}
// public void soulPrintHandBookDispose(User user){
// // 魂印图鉴列表
// Set<Integer> equipList = user.getEquipManager().getEquipList();
// // 道具背包
// Map<Integer, Item> itemMap = user.getItemManager().getItemMap();
//
// // 道具背包
// for (Item item : itemMap.values()) {
// // 读表,获取道具详细信息
// SItem sItem = SItem.getsItemMap().get(item.getItemId());
// // 道具不为空,且类型为6魂印,添加到图鉴中,set集合不需要重复验证
// if (sItem != null && sItem.getItemBaseType() == 6){
// equipList.add(sItem.getId());
// }
// }
// // 英雄装备中的
// Collection<Hero> heroes = user.getHeroManager().getHeroMap().values();
// for (Hero hero : heroes) {
// if (hero.getSoulEquipByPositionMap() != null){
// equipList.addAll(hero.getSoulEquipByPositionMap().values());
// }
// }
// }
/**
* RPC user
* @param uid
* @return
* @throws Exception
*/
public User getUserByRpc(int uid) {
int serverId = AreaManager.getInstance().getServerIdByUid(uid);
@ -1764,7 +1723,7 @@ public class PlayerLogic {
LOGGER.info("getUserByRpc uid={} serverId={}",uid,serverId);
return UserManager.getUser(uid, true);
} catch (Exception e) {
LOGGER.info("getUserByRpc Exception uid={} e={}", uid, e);
LOGGER.info("getUserByRpc Exception uid={} e={}", uid, e.getMessage(), e);
return null;
}
}
@ -1849,13 +1808,8 @@ public class PlayerLogic {
/**
*
* @param uid
* @param heroId
* @param teamId
* @return
* @throws Exception
*/
public PlayerInfoProto.ViewHeroInfoResponse viewYuxuHeroInfo(int uid,String heroId,int teamId) throws Exception {
public PlayerInfoProto.ViewHeroInfoResponse viewYuxuHeroInfo(int uid,String heroId) throws Exception {
User userInMem = UserManager.getUserNotCache(uid);
if(userInMem == null){
throw new ErrorCodeException(ErrorCode.FRIENDS_USER_NULL);
@ -1890,18 +1844,14 @@ public class PlayerLogic {
/**
*
* @param uid
* @param heroId
* @return
* @throws Exception
*/
public PlayerInfoProto.ViewHeroInfoResponse viewCrossYuxuHeroInfo(int uid,String heroId,int teamId) throws Exception {
public PlayerInfoProto.ViewHeroInfoResponse viewCrossYuxuHeroInfo(int uid,String heroId) throws Exception {
CSPlayer csPlayer = CrossServiceLogic.getPlayerByRedis(uid);
if (csPlayer == null){
throw new ErrorCodeException(ErrorCode.newDefineCode("该玩家没有跨服数据"));
}
if(GameApplication.serverId == csPlayer.getServerId()){
return viewYuxuHeroInfo(uid,heroId,teamId);
return viewYuxuHeroInfo(uid,heroId);
}
//其他服玩家rpc 数据调用
CrossArenaManager crossArenaManager = PlayerLogic.getInstance().getCrossArenaManagerData(csPlayer);
@ -1967,8 +1917,6 @@ public class PlayerLogic {
/**
*
* @param user
* @return
*/
public int getGodPrivilegeLv(User user){
Map<Integer, SPrestigeConfig> typeMap = SPrestigeConfig.getTypeMap(SPrestigeConfig.godPrivilege);
@ -1995,8 +1943,6 @@ public class PlayerLogic {
/**
*
* @param user
* @return
*/
public int getRenownPrivilegeLv(User user){
Map<Integer, SPrestigeConfig> typeMap = SPrestigeConfig.getTypeMap(SPrestigeConfig.renownPrivilege);
@ -2022,8 +1968,7 @@ public class PlayerLogic {
}
//获取跨服非玉虚玩家队伍信息
@Deprecated
public PlayerInfoProto.GetPlayerOneTeamInfoResponse getCrossOneTeamInfo(int id,int teamId) throws Exception {
// public PlayerInfoProto.GetPlayerOneTeamInfoResponse getCrossOneTeamInfo(int id,int teamId) throws Exception {
// CSPlayer csPlayer = CrossServiceLogic.getPlayerByRedis(id);
// if(csPlayer==null){
// throw new ErrorCodeException(ErrorCode.SERVER_SELF_DEFINE);
@ -2111,6 +2056,6 @@ public class PlayerLogic {
// oneTeamInfo.setTeam(teamOneTeamInfo);
// PlayerInfoProto.GetPlayerOneTeamInfoResponse.Builder playerTeamInfo = PlayerInfoProto.GetPlayerOneTeamInfoResponse.newBuilder().setTeamInfo(oneTeamInfo);
// return playerTeamInfo.build();
return null;
}
// return null;
// }
}

View File

@ -327,7 +327,7 @@ public class RidingSwardLogic{
putRecordList(uid,String.valueOf(round),records);
}
// 奖励计算
int[][] changeList = Utils.getTwoArrayObject(result);
int[][] changeList = Utils.getTwoArrayInt(result);
CommonProto.Drop.Builder drop = ItemUtil.drop(user, changeList, BIReason.RIDING_SWARD_REWARD);
return ActivityProto.RidingSwardRewardResponse.newBuilder().setDrop(drop).build();
}

View File

@ -1450,4 +1450,23 @@ public class CBean2Proto {
builder.setPoint(magicSoldier.getPoint());
return builder.build();
}
public static List<CommonProto.GemNew> toBeanGemNew(User user){
ArrayList<CommonProto.GemNew> result = new ArrayList<>();
Map<Integer, GemNew> gemNewMap = user.getEquipManager().getGemNewMap();
if (gemNewMap == null || gemNewMap.isEmpty()){
return result;
}
for (GemNew gemNew : gemNewMap.values()) {
CommonProto.GemNew.Builder gemNewBuilder = CommonProto.GemNew.newBuilder();
gemNewBuilder.setId(gemNew.getId());
for (Map.Entry<Integer, Integer> entry : gemNew.getAttribute().entrySet()) {
CommonProto.Attribute.Builder attr = CommonProto.Attribute.newBuilder();
attr.setId(entry.getKey()).setValue(entry.getValue());
gemNewBuilder.addAttr(attr.build());
}
result.add(gemNewBuilder.build());
}
return result;
}
}

View File

@ -1,5 +1,7 @@
package com.ljsd.jieling.util;
import com.ljsd.jieling.logic.dao.GemNew;
import java.util.HashMap;
import java.util.Map;
@ -15,6 +17,7 @@ public class ItemMap {
private Map<Integer, Integer> cardMap;
private Map<Integer,Integer> equipMap;
private Map<Integer,Integer> magicSoldierMap;
private Map<Integer, GemNew> gemNewMap;
public Map<Integer, Integer> getSpecialMonsterMap() {
return specialMonsterMap;
@ -24,6 +27,13 @@ public class ItemMap {
this.specialMonsterMap = specialMonsterMap;
}
public Map<Integer, GemNew> getGemNewMap() {
return gemNewMap;
}
public void setGemNewMap(Map<Integer, GemNew> gemNewMap) {
this.gemNewMap = gemNewMap;
}
public Map<Integer, Long> getItemMap() {
return itemMap;

View File

@ -93,6 +93,7 @@ public class ItemUtil {
addEquip(user, itemObj.getEquipMap(), dropBuilder,reason);
addSpecialMonster(user,itemObj,dropBuilder,reason);
addMagicSoldier(user,itemObj.getMagicSoldierMap(),dropBuilder);
addGemNew(user,itemObj.getGemNewMap(),dropBuilder);
}
@ -105,6 +106,12 @@ public class ItemUtil {
return dropBuilder;
}
public static void drop(User user, GemNew gemNew, CommonProto.Drop.Builder dropBuilder, int reason) throws Exception {
ItemMap itemObj = new ItemMap();
itemObj.getGemNewMap().put(gemNew.getId(), gemNew);
mapToAdd(user,itemObj,dropBuilder,reason);
}
/**
*
*/
@ -1971,6 +1978,34 @@ public class ItemUtil {
}
}
/**
*
*/
private static void addGemNew(User user, Map<Integer, GemNew> gemNewMap, CommonProto.Drop.Builder dropBuilder) {
if(gemNewMap == null || gemNewMap.isEmpty()){
return;
}
for (GemNew dropGemNew : gemNewMap.values()) {
SGemConfigNew gemConfigNew = SGemConfigNew.map.get(dropGemNew.getId());
EquipManager equipManager = user.getEquipManager();
int type = gemConfigNew.getType();
GemNew gemNew = equipManager.getGemNewMap().get(type);
int propertyId = gemConfigNew.getProperty();
int dropProperty = dropGemNew.getAttribute().getOrDefault(propertyId, 0);
int property = gemNew.getAttribute().getOrDefault(propertyId, 0);
if (dropProperty > property){
equipManager.putGemNewMap(type, dropGemNew);
property = dropProperty;
}
CommonProto.Attribute.Builder attrBuilder = CommonProto.Attribute.newBuilder().setId(propertyId).setValue(property);
CommonProto.GemNew.Builder gemNewBuilder = CommonProto.GemNew.newBuilder().setId(dropGemNew.getId()).addAttr(attrBuilder);
dropBuilder.addGemNew(gemNewBuilder);
}
}
public static long getMapById(int id,ItemMap itemObj){
if(itemObj.getItemMap().containsKey(id)){
return itemObj.getItemMap().get(id);

View File

@ -0,0 +1,78 @@
package config;
import manager.STableManager;
import manager.Table;
import java.util.HashMap;
import java.util.Map;
@Table(name ="GemConfigNew")
public class SGemConfigNew implements BaseConfig {
private int id;
private int level;
private int quality;
private int type;
private int property;
private int[][] propertyNumber;
private int[] proportion;
private int[] reward;
public static Map<Integer, Map<Integer, SGemConfigNew>> typeMap = new HashMap<>();
public static Map<Integer, SGemConfigNew> map = new HashMap<>();
@Override
public void init() throws Exception {
map = STableManager.getConfig(SGemConfigNew.class);
Map<Integer, Map<Integer, SGemConfigNew>> cloneMap = new HashMap<>();
for (SGemConfigNew value : map.values()) {
Map<Integer, SGemConfigNew> map1 = cloneMap.getOrDefault(value.getType(), new HashMap<>());
map1.put(value.getLevel(), value);
cloneMap.put(value.getType(), map1);
}
typeMap = cloneMap;
}
public int getId() {
return id;
}
public int getLevel() {
return level;
}
public int getQuality() {
return quality;
}
public int getType() {
return type;
}
public int getProperty() {
return property;
}
public int[][] getPropertyNumber() {
return propertyNumber;
}
public int[] getProportion() {
return proportion;
}
public int[] getReward() {
return reward;
}
}

View File

@ -0,0 +1,88 @@
package config;
import manager.STableManager;
import manager.Table;
import java.util.HashMap;
import java.util.Map;
@Table(name ="GemLotteryConfig")
public class SGemLotteryConfig implements BaseConfig {
private int id;
private int level;
private int libraryNumber;
private int library;
private int[] gemType;
private int[] gemTypeProbability;
private int[] gemLevel;
private int[][] qualityProbability;
private int[] dailyNumber;
private int[] quality;
public static Map<Integer, Map<Integer, SGemLotteryConfig>> libraryMap = new HashMap<>();
@Override
public void init() throws Exception {
Map<Integer, SGemLotteryConfig> config = STableManager.getConfig(SGemLotteryConfig.class);
Map<Integer, Map<Integer, SGemLotteryConfig>> map = new HashMap<>();
for (SGemLotteryConfig value : config.values()) {
Map<Integer, SGemLotteryConfig> map1 = map.getOrDefault(value.getLibrary(), new HashMap<>());
map1.put(value.getLevel(), value);
map.put(value.getLibrary(), map1);
}
libraryMap = map;
}
public int getId() {
return id;
}
public int getLevel() {
return level;
}
public int getLibraryNumber() {
return libraryNumber;
}
public int getLibrary() {
return library;
}
public int[] getGemType() {
return gemType;
}
public int[] getGemTypeProbability() {
return gemTypeProbability;
}
public int[] getGemLevel() {
return gemLevel;
}
public int[][] getQualityProbability() {
return qualityProbability;
}
public int[] getDailyNumber() {
return dailyNumber;
}
public int[] getQuality() {
return quality;
}
}

View File

@ -139,6 +139,12 @@ public class SSpecialConfig implements BaseConfig {
public static final String Duoduita_accumulation_time = "Duoduita_accumulation_time";//多队塔累积奖励时长 (分钟)
public static final String DUoduita_mop_time = "DUoduita_mop_time";//多队塔扫荡奖励时长 (分钟)
public static final String Gem_Lottery = "Gem_Lottery";//宝石单抽所需道具
public static final String Gem_Lottery10 = "Gem_Lottery10";//宝石十连所需道具
public static final String Gem_Senior_Lottery = "Gem_Senior_Lottery";//高级宝石单抽所需道具
public static final String Gem_Senior_Lottery10 = "Gem_Senior_Lottery10";//高级宝石十连所需道具
@Override
public void init() throws Exception {