Merge branch 'master' of 60.1.1.230:backend/jieling_server

# Conflicts:
#	serverlogic/src/main/java/com/ljsd/jieling/logic/activity/ActivityType.java
#	serverlogic/src/main/java/com/ljsd/jieling/logic/activity/ActivityTypeEnum.java
back_recharge
wangyuan 2019-12-28 15:34:58 +08:00
commit b9a4f03c7a
38 changed files with 426 additions and 89 deletions

View File

@ -1,5 +1,4 @@
Buff = {}
local floor = math.floor
local buffPoolList = {}
@ -50,7 +49,7 @@ BuffManager = {}
BuffManager.__index = BuffManager
function BuffManager.New()
local instance = {owner=0, buffQueue = BattleQueue.New(), buffList = BattleDictionary.New()}
local instance = {owner=0, buffQueue = BattleQueue.New(), buffDic = BattleDictionary.New()}
setmetatable(instance, BuffManager)
return instance
end
@ -59,15 +58,15 @@ function BuffManager:Init()
while self.buffQueue.size > 0 do
putBuff(self.buffQueue:Dequeue())
end
for i = 1, self.buffList.size do
local list = self.buffList.vList[i]
for i = 1, self.buffDic.size do
local list = self.buffDic.vList[i]
for j=1, list.size do
putBuff(list.buffer[j])
end
list:Clear()
buffListPool:Put(list)
end
self.buffList:Clear()
self.buffDic:Clear()
end
function BuffManager:AddBuff(target, buff)
@ -89,8 +88,8 @@ function BuffManager:AddBuff(target, buff)
end
function BuffManager:QueryBuff(target, checkFunc)
for i=1, self.buffList.size do
local list = self.buffList.vList[i]
for i=1, self.buffDic.size do
local list = self.buffDic.vList[i]
for j=1, list.size do
local buff = list.buffer[j]
if buff.target == target then
@ -103,8 +102,8 @@ function BuffManager:QueryBuff(target, checkFunc)
end
function BuffManager:HasBuff(target, type, checkFunc)
if self.buffList.kvList[type] then
local buffList = self.buffList.kvList[type]
if self.buffDic.kvList[type] then
local buffList = self.buffDic.kvList[type]
for i=1, buffList.size do
local v = buffList.buffer[i]
if v.target == target then
@ -119,8 +118,8 @@ end
--func为nil时无条件清除否则判定clear值执行func
function BuffManager:ClearBuff(target, func)
for i = 1, self.buffList.size do
local list = self.buffList.vList[i]
for i = 1, self.buffDic.size do
local list = self.buffDic.vList[i]
if list.size > 0 then
local idx = 1
while idx <= list.size do
@ -143,8 +142,8 @@ function BuffManager:PutBuff(buff)
end
function BuffManager:GetBuffCount(type)
if self.buffList[type] then
return self.buffList[type].size
if self.buffDic[type] then
return self.buffDic[type].size
end
return 0
end
@ -153,11 +152,11 @@ function BuffManager:Update()
while self.buffQueue.size > 0 do
local buff = self.buffQueue:Dequeue()
local buffList
if not self.buffList.kvList[buff.type] then
if not self.buffDic.kvList[buff.type] then
buffList = buffListPool:Get()
self.buffList:Add(buff.type, buffList)
self.buffDic:Add(buff.type, buffList)
else
buffList = self.buffList.kvList[buff.type]
buffList = self.buffDic.kvList[buff.type]
end
if buff.cover and buffList.size > 0 then
local isCovered = false
@ -186,8 +185,8 @@ function BuffManager:Update()
buff.target.Event:DispatchEvent(BattleEventName.BuffStart, buff)
end
end
for i=1, self.buffList.size do
local buffList = self.buffList.vList[i]
for i=1, self.buffDic.size do
local buffList = self.buffDic.vList[i]
if buffList.size > 0 then
local index = 1
while index <= buffList.size do

View File

@ -1505,11 +1505,17 @@ local effectList = {
local f1 = args[1]
local f2 = args[2]
BattleLogic.WaitForTrigger(interval, function ()
local lastTrigger = 0
local OnPassiveDamaging = function(damagingFunc, atkRole, damage)
lastTrigger = lastTrigger + 1
if lastTrigger > 1 then --加入限定避免循环触发
return
end
if not target.isDead then
damagingFunc(floor(damage * f1))
BattleUtil.ApplyDamage(atkRole, target, BattleUtil.CalShield(atkRole, target, floor(damage * f1)))
end
lastTrigger = 0
end
local list = BattleLogic.GetNeighbor(target, 1)
for i=1, #list do

View File

@ -1188,7 +1188,7 @@ local passivityList = {
if BattleLogic.BuffMgr:HasBuff(role, BuffName.Shield, function (buff) return true end) then
BattleUtil.RandomAction(f1, function ()
local val = floor(BattleUtil.FP_Mul(role:GetRoleData(propertyList[pro1]), f2))
BattleUtil.CalTreat(skill.owner, skill.owner, val)
BattleUtil.CalTreat(role, skill.owner, val)
end)
end
end
@ -1212,7 +1212,7 @@ local passivityList = {
local f2 = args[3]
BattleLogic.Event:AddEvent(BattleEventName.BattleRoleDead, function (defRole, atkRole)
if atkRole.isTeam then
if role.isDead or atkRole.isTeam then
return
end
if defRole.camp == role.camp then

View File

@ -12,7 +12,7 @@ local curFrame
local playerSkillUsable
local enemySkillUsable
BattleLogic.Type = 0 --1 故事副本 2 地图探索 3 竞技场 4 秘境boss 5 解锁秘境 6 公会战 7 血战 8 兽潮
BattleLogic.Type = 0 --1 故事副本 2 地图探索 3 竞技场 4 秘境boss 5 解锁秘境 6 公会战 7 血战 8 兽潮 9巅峰战
BattleLogic.IsEnd = false
BattleLogic.Result = -1
BattleLogic.Event = BattleEvent.New()

View File

@ -1,4 +1,3 @@
require("Modules/Battle/Logic/Base/Buff")
Aura = Buff:New()
--初始化Buff通过传入一些自定义参数控制成长相关的数值

View File

@ -1,4 +1,3 @@
require("Modules/Battle/Logic/Base/Buff")
Brand = Buff:New()
--初始化Buff通过传入一些自定义参数控制成长相关的数值

View File

@ -1,4 +1,3 @@
require("Modules/Battle/Logic/Base/Buff")
Control = Buff:New()
--初始化Buff通过传入一些自定义参数控制成长相关的数值

View File

@ -1,4 +1,3 @@
require("Modules/Battle/Logic/Base/Buff")
DOT = Buff:New()
--初始化Buff通过传入一些自定义参数控制成长相关的数值

View File

@ -1,4 +1,3 @@
require("Modules/Battle/Logic/Base/Buff")
HOT = Buff:New()
--初始化Buff通过传入一些自定义参数控制成长相关的数值

View File

@ -1,4 +1,3 @@
require("Modules/Battle/Logic/Base/Buff")
Immune = Buff:New()
local immune1 = function(buff)

View File

@ -1,4 +1,3 @@
require("Modules/Battle/Logic/Base/Buff")
PropertyChange = Buff:New()
--初始化Buff通过传入一些自定义参数控制成长相关的数值

View File

@ -1,4 +1,3 @@
require("Modules/Battle/Logic/Base/Buff")
Shield = Buff:New()
--初始化Buff通过传入一些自定义参数控制成长相关的数值

View File

@ -206,10 +206,12 @@ end
function RoleLogic:AddBuff(buff)
if self.isDead then
BattleLogic.BuffMgr:PutBuff(buff)
return
end
for i=1, self.buffFilter.size do
if self.buffFilter.buffer[i](buff) then
BattleLogic.BuffMgr:PutBuff(buff)
return
end
end

View File

@ -243,7 +243,8 @@ public class GMRequestHandler extends BaseHandler{
VipMissionIdsType vipMissionIdsType = cUser.getUserMissionManager().getVipMissionIdsType();
vipMissionIdsType.getFinishMissionIds().clear();
vipMissionIdsType.getDoingMissionIds().clear();
cUser.getPlayerInfoManager().updateVipInfo(cUser,prarm1);
cUser.getPlayerInfoManager().setVipLevel(prarm1);
cUser.getPlayerInfoManager().updateVipInfo(GlobalsDef.VIP_UNLOCK_PRIVILEGE,prarm1);
vipMissionIdsType.getFinishMissionIds().addAll(vipMissionIdsType.getDoingMissionIds());
vipMissionIdsType.getDoingMissionIds().clear();
cUser.getUserMissionManager().setVipMissionIdsType(vipMissionIdsType);

View File

@ -8,10 +8,7 @@ import com.ljsd.jieling.handler.map.MapLogic;
import com.ljsd.jieling.handler.map.MapManager;
import com.ljsd.jieling.logic.GlobalDataManaager;
import com.ljsd.jieling.logic.activity.ActivityLogic;
import com.ljsd.jieling.logic.dao.PlayerManager;
import com.ljsd.jieling.logic.dao.RechargeInfo;
import com.ljsd.jieling.logic.dao.ServerConfig;
import com.ljsd.jieling.logic.dao.UserManager;
import com.ljsd.jieling.logic.dao.*;
import com.ljsd.jieling.logic.dao.root.GlobalSystemControl;
import com.ljsd.jieling.logic.dao.root.User;
import com.ljsd.jieling.logic.player.PlayerLogic;
@ -70,7 +67,7 @@ public class GetPlayerInfoHandler extends BaseHandler{
GlobalDataManaager.checkNeedReFlush(iSession,user,null);
playerInfoManager.setLoginTime(TimeUtils.now());
Map<Integer, Integer> guidePoints = playerInfoManager.getGuidePoints();
Map<Integer, Integer> vipInfo = playerInfoManager.getVipInfo();
Map<Integer, VipInfo> vipInfo = playerInfoManager.getVipInfo();
List<CommonProto.NewPlayerGuidePoint> list = new ArrayList<>();
List<CommonProto.Privilege> privilegeList = new ArrayList<>();
for(Map.Entry<Integer,Integer> guideItem : guidePoints.entrySet()){
@ -79,10 +76,11 @@ public class GetPlayerInfoHandler extends BaseHandler{
. setId(guideItem.getValue())
.build());
}
for(Map.Entry<Integer,Integer> vipInfoItem : vipInfo.entrySet()){
for(Map.Entry<Integer,VipInfo> vipInfoItem : vipInfo.entrySet()){
privilegeList.add(CommonProto.Privilege.newBuilder()
.setId(vipInfoItem.getKey())
. setUsedTimes(vipInfoItem.getValue())
. setUsedTimes(vipInfoItem.getValue().getCount())
.setEffectTime(vipInfoItem.getValue().getEffectTime())
.build());
}
MapManager mapManager = user.getMapManager();

View File

@ -2,6 +2,7 @@ package com.ljsd.jieling.kefu;
import com.ljsd.jieling.db.mongo.MongoUtil;
import com.ljsd.jieling.logic.dao.VipInfo;
import com.ljsd.jieling.logic.dao.root.User;
import config.SStoreConfig;
@ -41,8 +42,8 @@ public class Cmd_fix_store extends GmAbstract {
for (User user :userList){
process++;
try {
for (Map.Entry<Integer, Integer> en:user.getPlayerInfoManager().getVipInfo().entrySet()){
if(en.getValue()!=0){
for (Map.Entry<Integer, VipInfo> en:user.getPlayerInfoManager().getVipInfo().entrySet()){
if(en.getValue().getCount()!=0){
Integer itemId = vip2itemid.get(en.getKey());
if(itemId == null ){
continue;
@ -50,7 +51,7 @@ public class Cmd_fix_store extends GmAbstract {
int storeid = SStoreConfig.getSstoreConfigMap().get(itemId).getStoreId();
Map<Integer, Integer> itemNumMap = user.getStoreManager().getStoreInfoMap().get(storeid).getItemNumMap();
if(itemNumMap.containsKey(itemId)){
itemNumMap.put(itemId,en.getValue());
itemNumMap.put(itemId,en.getValue().getCount());
}
user.getStoreManager().getStoreInfoMap().get(storeid).setItemNumMap(itemNumMap);
}

View File

@ -659,6 +659,7 @@ public class ActivityLogic implements IEventHandler{
PlayerInfoProto.SecretBoxRandomResponse build = PlayerInfoProto.SecretBoxRandomResponse.newBuilder().setDrop(drop).setExtrarReward(extraDrop).build();
MessageUtil.sendMessage(session, 1, MessageTypeProto.MessageType.SECRETBOX_RANDOM_RESPONSE_VALUE, build, true);
user.getUserMissionManager().onGameEvent(user, GameEvent.SECRETBOX, id, randCount);
Poster.getPoster().dispatchEvent(new SecretBoxEvent(uid,randCount));
}
private int[] getSecretBoxRewardByPool(int secretBoxRandomPool) {

View File

@ -49,9 +49,15 @@ public interface ActivityType {
int NEW_WELFARE = 42;//萌新福利
int LIMIT_RANDOM_CARD = 43;//限时抽卡
int MISSIONSEARCH_EXPERT = 46;//寻宝达人
int LUCKWHEEL_EXPERT = 47;//探宝达人
int HERORANDOM_EXPERT = 48;//征募达人
int SECURTBOX_EXPERT = 49;//秘宝达人
int LIMIT_UP_CARD = 50;//指定英雄进行升星
}

View File

@ -39,6 +39,11 @@ public enum ActivityTypeEnum {
NEW_WELFARE(ActivityType.NEW_WELFARE, NewWelfareActivity::new),
LIMIT_RANDOM_CARD(ActivityType.LIMIT_RANDOM_CARD,LimitRandomCardActivity::new),
LIMIT_UP_CARD(ActivityType.LIMIT_UP_CARD,LimitUpCardActivity::new),
MISSIONSEARCH_EXPERT(ActivityType.MISSIONSEARCH_EXPERT,MissSearchExpectRankActivity::new),
LUCKWHEEL_EXPERT(ActivityType.LUCKWHEEL_EXPERT,LuckWheelExpectRankActivity::new),
HERORANDOM_EXPERT(ActivityType.HERORANDOM_EXPERT,HeroRandomExpectRankActivity::new),
SECURTBOX_EXPERT(ActivityType.SECURTBOX_EXPERT,SecurtBoxExpectRankActivity::new),
;
private int type;
private Function<Integer, AbstractActivity> toActivityFunction;

View File

@ -2,6 +2,7 @@ package com.ljsd.jieling.logic.activity;
import com.ljsd.jieling.config.clazzStaticCfg.CommonStaticConfig;
import com.ljsd.jieling.core.GlobalsDef;
import com.ljsd.jieling.globals.BIReason;
import com.ljsd.jieling.logic.activity.event.FightMainEvent;
import com.ljsd.jieling.logic.activity.event.IEvent;
@ -35,6 +36,8 @@ public class FightMainEventHandler implements IEventHandler{
int uid = fightMainEvent.getUid();
User user = UserManager.getUser(uid);
//检测更新vip是否有新开
user.getPlayerInfoManager().updateVipInfo(GlobalsDef.MAIN_LEVEL_UNLOCK_PRIVILEGE,10_000_000 * (fightId % 10) + fightId);
for(SGlobalActivity sGlobalActivity : SGlobalActivity.getsGlobalActivityMap().values()){
int[] openRules = sGlobalActivity.getOpenRules();
if(openRules!=null && openRules.length>0 && openRules[0] == 1){

View File

@ -0,0 +1,27 @@
package com.ljsd.jieling.logic.activity;
import com.ljsd.jieling.logic.activity.event.HeroRandomEvent;
import com.ljsd.jieling.logic.activity.event.IEvent;
import com.ljsd.jieling.logic.activity.event.Poster;
import com.ljsd.jieling.logic.dao.UserManager;
/**
*
*/
class HeroRandomExpectRankActivity extends ExpectRankActivity {
public HeroRandomExpectRankActivity(int id) {
super(id);
Poster.getPoster().listenEvent(this, HeroRandomEvent.class);
}
@Override
public void onEvent(IEvent event) throws Exception {
if (!(event instanceof HeroRandomEvent))
return;
update(UserManager.getUser(((HeroRandomEvent) event).getUid()), ((HeroRandomEvent) event).getTime());
}
}

View File

@ -1,5 +1,6 @@
package com.ljsd.jieling.logic.activity;
import com.ljsd.jieling.core.GlobalsDef;
import com.ljsd.jieling.db.redis.RedisKey;
import com.ljsd.jieling.db.redis.RedisUtil;
import com.ljsd.jieling.logic.activity.event.IEvent;
@ -15,6 +16,7 @@ import com.ljsd.jieling.logic.rank.rankImpl.AbstractRank;
import com.ljsd.jieling.network.session.ISession;
import config.SActivityRewardConfig;
import config.SCHero;
import config.SSpecialConfig;
import util.TimeUtils;
import java.util.function.Consumer;
@ -55,6 +57,7 @@ public class LimitRandomCardActivity extends AbstractActivity {
Consumer<int[]> consumer = a->RankContext.getRankEnum(RankEnum.RANDOM_CARD_PERFECT_RANK.getType()).addRank(cardEvent.getUid(), TimeUtils.now()/1000,a[0]);
Stream.of(cardEvent.getHeros()).filter(pre).forEach(consumer);
update(UserManager.getUser(cardEvent.getUid()),cardEvent.getScore());
}
@Override
@ -65,6 +68,11 @@ public class LimitRandomCardActivity extends AbstractActivity {
@Override
void updateProgressWithUser(User user, ActivityMission activityMission, int count) {
activityMission.setValue(activityMission.getValue()+count);
//150分赠一次
int[] onceArrayValue = SSpecialConfig.getOnceArrayValue(SSpecialConfig.TIME_LIMIT_RECRUITMENT_FREEINTEGRAL);
if((activityMission.getValue()+count)/onceArrayValue[0]-activityMission.getValue()/onceArrayValue[0]>0){
user.getPlayerInfoManager().updateVipPrivilage(onceArrayValue[1],-1);
}
}
@Override

View File

@ -0,0 +1,29 @@
package com.ljsd.jieling.logic.activity;
import com.ljsd.jieling.logic.activity.event.IEvent;
import com.ljsd.jieling.logic.activity.event.LuckWheelAdvanceEvent;
import com.ljsd.jieling.logic.activity.event.LuckWheelEvent;
import com.ljsd.jieling.logic.activity.event.Poster;
import com.ljsd.jieling.logic.dao.UserManager;
/**
*
*/
class LuckWheelExpectRankActivity extends ExpectRankActivity {
public LuckWheelExpectRankActivity(int id) {
super(id);
Poster.getPoster().listenEvent(this, LuckWheelAdvanceEvent.class);
Poster.getPoster().listenEvent(this, LuckWheelEvent.class);
}
@Override
public void onEvent(IEvent event) throws Exception {
if (!(event instanceof LuckWheelEvent))
return;
update(UserManager.getUser(((LuckWheelEvent) event).getUid()), 1);
}
}

View File

@ -0,0 +1,63 @@
package com.ljsd.jieling.logic.activity;
import com.ljsd.jieling.logic.OnlineUserManager;
import com.ljsd.jieling.logic.activity.event.*;
import com.ljsd.jieling.logic.dao.ActivityMission;
import com.ljsd.jieling.logic.dao.ActivityProgressInfo;
import com.ljsd.jieling.logic.dao.UserManager;
import com.ljsd.jieling.logic.dao.root.User;
import com.ljsd.jieling.network.session.ISession;
import config.SActivityRewardConfig;
import config.SEquipConfig;
import manager.STableManager;
import java.util.Map;
/**
*
*/
class MissSearchExpectRankActivity extends ExpectRankActivity {
public MissSearchExpectRankActivity(int id) {
super(id);
Poster.getPoster().listenEvent(this, MissingRoomBestEvent.class);
}
@Override
public void onEvent(IEvent event) throws Exception {
if (!(event instanceof MissingRoomBestEvent))
return;
User user = UserManager.getUser(((MissingRoomBestEvent) event).getUid());
ActivityMission activityMission = user.getActivityManager().getActivityMissionMap().get(id);
Map<Integer, ActivityProgressInfo> activityProgressInfoMap = activityMission.getActivityProgressInfoMap();
for (SActivityRewardConfig sActivityRewardConfig : SActivityRewardConfig.getsActivityRewardConfigByActivityId(id)) {
if (((MissingRoomBestEvent) event).getTaskType() == sActivityRewardConfig.getValues()[0][0]) {
ActivityProgressInfo activityProgressInfo = activityProgressInfoMap.getOrDefault(sActivityRewardConfig.getId(), null);
if (null == activityProgressInfo)
continue;
activityProgressInfo.setProgrss(activityProgressInfo.getProgrss() + 1);
activityMission.updateProgressInfo(sActivityRewardConfig.getId(), activityProgressInfo);
}
}
//更新进度
ISession sessionByUid = OnlineUserManager.getSessionByUid(user.getId());
System.out.print(activityMission.toString());
sendActivityProgress(sessionByUid, activityMission, null);
}
@Override
boolean takeRewardsProcess(ISession session, SActivityRewardConfig sActivityRewardConfig, ActivityProgressInfo activityProgressInfo) throws Exception {
int[][] values = sActivityRewardConfig.getValues();
int missionProgress = activityProgressInfo.getProgrss();
if (missionProgress < values[1][0]) {
return false;
}
return true;
}
}

View File

@ -0,0 +1,27 @@
package com.ljsd.jieling.logic.activity;
import com.ljsd.jieling.logic.activity.event.IEvent;
import com.ljsd.jieling.logic.activity.event.Poster;
import com.ljsd.jieling.logic.activity.event.SecretBoxEvent;
import com.ljsd.jieling.logic.dao.UserManager;
/**
*
*/
class SecurtBoxExpectRankActivity extends ExpectRankActivity {
public SecurtBoxExpectRankActivity(int id) {
super(id);
Poster.getPoster().listenEvent(this, SecretBoxEvent.class);
}
@Override
public void onEvent(IEvent event) throws Exception {
if (!(event instanceof SecretBoxEvent))
return;
update(UserManager.getUser(((SecretBoxEvent) event).getUid()), ((SecretBoxEvent) event).getTime());
}
}

View File

@ -1,6 +1,7 @@
package com.ljsd.jieling.logic.activity;
import com.ljsd.jieling.config.clazzStaticCfg.CommonStaticConfig;
import com.ljsd.jieling.core.GlobalsDef;
import com.ljsd.jieling.globals.BIReason;
import com.ljsd.jieling.logic.activity.event.IEvent;
import com.ljsd.jieling.logic.activity.event.Poster;
@ -13,9 +14,11 @@ import com.ljsd.jieling.util.ToolsUtil;
import config.SGlobalActivity;
import config.SGlobalSystemConfig;
import config.SMainLevelConfig;
import config.SPrivilegeTypeConfig;
import manager.STableManager;
import java.util.List;
import java.util.Map;
public class UserLevelEventHandler implements IEventHandler{
@ -28,11 +31,11 @@ public class UserLevelEventHandler implements IEventHandler{
return;
UserLevelEvent userLevelEvent = (UserLevelEvent) event;
int level = userLevelEvent.getLevel();
List<SGlobalSystemConfig> sGlobalSystemConfigs = STableManager.getFigureConfig(CommonStaticConfig.class).getsGlobalSystemConfigMapByTypeAndConditionMap().get(2).get(level);
int uid = userLevelEvent.getUid();
User user = UserManager.getUser(uid);
user.getPlayerInfoManager().updateVipInfo(GlobalsDef.LEVEL_UNLOCK_PRIVILEGE,user.getPlayerInfoManager().getLevel());
int state = user.getMainLevelManager().getState();
if(state == -1 ){
int fightId = user.getMainLevelManager().getFightId();

View File

@ -0,0 +1,21 @@
package com.ljsd.jieling.logic.activity.event;
public class HeroRandomEvent implements IEvent {
private int uid;
private int time;
public HeroRandomEvent(int uid, int time) {
this.uid = uid;
this.time = time;
}
public int getTime() {
return time;
}
public int getUid() {
return uid;
}
}

View File

@ -8,6 +8,11 @@ package com.ljsd.jieling.logic.activity.event;
public class MissingRoomBestEvent implements IEvent{
private int taskType;
private int uid;
public int getUid() {
return uid;
}
public int getTaskType() {
return taskType;
@ -17,7 +22,8 @@ public class MissingRoomBestEvent implements IEvent{
this.taskType = taskType;
}
public MissingRoomBestEvent(int taskType) {
public MissingRoomBestEvent(int taskType, int uid) {
this.taskType = taskType;
this.uid = uid;
}
}

View File

@ -0,0 +1,23 @@
package com.ljsd.jieling.logic.activity.event;
/**
*
*/
public class SecretBoxEvent implements IEvent {
private int uid;
private int time;
public SecretBoxEvent(int uid, int time) {
this.uid = uid;
this.time = time;
}
public int getTime() {
return time;
}
public int getUid() {
return uid;
}
}

View File

@ -2,6 +2,7 @@ package com.ljsd.jieling.logic.dao;
import com.ljsd.common.mogodb.MongoBase;
import com.ljsd.jieling.core.GlobalsDef;
import com.ljsd.jieling.core.VipPrivilegeType;
import com.ljsd.jieling.globals.BIReason;
import com.ljsd.jieling.logic.dao.root.User;
@ -9,11 +10,9 @@ import com.ljsd.jieling.logic.mission.GameEvent;
import com.ljsd.jieling.logic.player.PlayerLogic;
import config.SPrivilegeTypeConfig;
import config.SVipLevelConfig;
import util.TimeUtils;
import java.util.HashMap;
import java.util.HashSet;
import java.util.Map;
import java.util.Set;
import java.util.*;
import java.util.concurrent.CopyOnWriteArraySet;
@ -63,7 +62,7 @@ public class PlayerManager extends MongoBase {
private Map<Integer,Integer> guidePoints = new HashMap<>();
private Map<Integer,Integer> vipInfo = new HashMap<>();
private Map<Integer,VipInfo> vipInfo = new HashMap<>();
private Set<Integer> vipGoodInfo = new HashSet<>();// 特权商品礼包
private Set<Integer> reds = new CopyOnWriteArraySet<>();
@ -167,6 +166,11 @@ public class PlayerManager extends MongoBase {
return vipLevel;
}
public void setVipLevel(int vipLevel) {
this.vipLevel = vipLevel;
updateString("vipLevel",vipLevel);
}
public int getHead() {
return head;
}
@ -239,51 +243,52 @@ public class PlayerManager extends MongoBase {
this.loginTime = loginTime;
}
public Map<Integer, Integer> getVipInfo() {
public Map<Integer, VipInfo> getVipInfo() {
return vipInfo;
}
public void updateVipInfo(User user,int vipLevel) throws Exception {
SVipLevelConfig sVipLevelConfig = SVipLevelConfig.getsVipLevelConfigMap().get(vipLevel);
if(sVipLevelConfig == null){
return;
}
Map<Integer, Integer> vip = new HashMap<>(sVipLevelConfig.getPrivilegeMap());
for(Integer privilageId : vip.keySet()){
if(!vipInfo.containsKey(privilageId)){
vipInfo.put(privilageId,0);
public void updateVipInfo(int unlockType,int condition) {
Map<Integer, Map<Integer, Integer>> conditionMap = SPrivilegeTypeConfig.conditionMap.get(unlockType);
for(Map.Entry<Integer, Map<Integer, Integer>> entry:conditionMap.entrySet()){
if(entry.getValue().containsKey(condition)){
if(!vipInfo.containsKey(entry.getKey())) {
vipInfo.put(entry.getKey(), new VipInfo());
}
}
}
updateString("vipInfo", vipInfo);
updateString("vipLevel", vipLevel);
this.vipLevel = vipLevel;
user.getUserMissionManager().onGameEvent(user,GameEvent.VIP_LEVLUP,vipLevel);
PlayerLogic.getInstance().sendVipDailyOrLevlUpReward(user, vipLevel, BIReason.VIP_LEVEL_REWARD);
}
public boolean check(int privilageId,int updateNum){
if(privilageId == 0){
return true;
}
SVipLevelConfig sVipLevelConfig = SVipLevelConfig.getsVipLevelConfigMap().get(vipLevel);
if(sVipLevelConfig == null ){
if(!vipInfo.containsKey(privilageId)){
return false;
}
Integer limitNum = sVipLevelConfig.getPrivilegeMap().get(privilageId);
if(limitNum == null){
VipInfo info = vipInfo.get(privilageId);
if(info.getEffectTime()!=0&&TimeUtils.now()/1000>info.getEffectTime()){
return false;
}
if(limitNum == -1){
SPrivilegeTypeConfig sPrivilegeTypeConfig = SPrivilegeTypeConfig.getsPrivilegeTypeConfigMap().get(privilageId);
Map<Integer, Map<Integer, Integer>> conditionMap = SPrivilegeTypeConfig.conditionMap.get(sPrivilegeTypeConfig.getUnlockType());
int maxCount = 0;
if(sPrivilegeTypeConfig.getUnlockType()!=GlobalsDef.RECHARGE_UNLOCK_PRIVILEGE){
TreeMap<Integer, Integer> condition = (TreeMap)conditionMap.get(privilageId);
maxCount = condition.floorEntry(level).getValue();
}
if(maxCount==-1){
return true;
}
if(!vipInfo.containsKey(privilageId)){
vipInfo.put(privilageId,0);
}
if(vipInfo.get(privilageId) + updateNum > limitNum){
if(info.getCount()+updateNum>maxCount|| (info.getEffectTime()!=0&&TimeUtils.now()/1000>info.getEffectTime())){
return false;
}
updateVipPrivilage(privilageId, updateNum);
return true;
}
public boolean checkFunctionIsAllowed(int privilageId){
@ -297,14 +302,16 @@ public class PlayerManager extends MongoBase {
if(!vipInfo.containsKey(privilageId)){
return 0;
}
return vipInfo.get(privilageId);
return vipInfo.get(privilageId).getCount();
}
public void updateVipPrivilage(int privilageId,int updateNum){
if(!vipInfo.containsKey(privilageId)){
return;
}
vipInfo.put(privilageId,vipInfo.get(privilageId)+updateNum);
VipInfo info = vipInfo.get(privilageId);
info.setCount(info.getCount()+updateNum);
vipInfo.put(privilageId, info);
updateString("vipInfo", vipInfo);
}
@ -328,6 +335,7 @@ public class PlayerManager extends MongoBase {
vipGoodInfo.add(vipLevel);
}
public int getHadTakeDailyBoxVip() {
return hadTakeDailyBoxVip;
}
@ -338,14 +346,17 @@ public class PlayerManager extends MongoBase {
}
public void vipFlush( Set<Integer> removePrivileges) {
if (vipInfo.isEmpty()){
return;
}
for(Integer id : vipInfo.keySet()){
SPrivilegeTypeConfig sPrivilegeTypeConfig = SPrivilegeTypeConfig.getsPrivilegeTypeConfigMap().get(id);
if(null == sPrivilegeTypeConfig){
continue;
}
int refreshType = sPrivilegeTypeConfig.getRefreshType()[0];
if(refreshType == 1){
vipInfo.put(id,0);
if(refreshType == 1&&vipInfo.get(id).getCount()>0){
vipInfo.put(id,new VipInfo());
}
}
for(Integer remove : removePrivileges){
@ -356,8 +367,18 @@ public class PlayerManager extends MongoBase {
}
public void addVipInfo(int privilageId){
vipInfo.put(privilageId,0);
updateString("vipInfo."+privilageId, 0);
SPrivilegeTypeConfig config = SPrivilegeTypeConfig.getsPrivilegeTypeConfigMap().get(privilageId);
if (config==null){
return;
}
int maxTime = 0;
if(vipInfo.containsKey(privilageId)){
maxTime = (int)(TimeUtils.now()/1000>vipInfo.get(privilageId).getEffectTime()?(TimeUtils.now()/1000):vipInfo.get(privilageId).getEffectTime());
}else {
maxTime = (int)(TimeUtils.now()/1000+config.getContinueTime());
}
vipInfo.put(privilageId,new VipInfo(0,maxTime+config.getContinueTime()));
updateString("vipInfo", vipInfo);
}
public void removeVipPriviliageId(int privilageId){

View File

@ -2,6 +2,7 @@ package com.ljsd.jieling.logic.dao;
import com.ljsd.jieling.config.clazzStaticCfg.CommonStaticConfig;
import com.ljsd.jieling.core.GlobalsDef;
import com.ljsd.jieling.db.mongo.MongoUtil;
import com.ljsd.jieling.globals.BIReason;
import com.ljsd.jieling.ktbeans.KtEventUtils;
@ -78,7 +79,8 @@ public class UserManager {
playerManager.setCreateTime(now);
playerManager.setLoginTime(now);
playerManager.setSendDays(1);
playerManager.updateVipInfo(user,0);
playerManager.updateVipInfo(GlobalsDef.LEVEL_UNLOCK_PRIVILEGE,1);
playerManager.updateVipInfo(GlobalsDef.VIP_UNLOCK_PRIVILEGE,0);
playerManager.setRechargeInfo(new RechargeInfo());
playerManager.setPhoneBindInfo(new PhoneBindInfo(""));
playerManager.setChannel(channel);

View File

@ -0,0 +1,35 @@
package com.ljsd.jieling.logic.dao;
/**
* @author lvxinran
* @date 2019/12/26
* @discribe
*/
public class VipInfo {
private int count;
private int effectTime;
public void setCount(int count) {
this.count = count;
}
public void setEffectTime(int effectTime) {
this.effectTime = effectTime;
}
public int getCount() {
return count;
}
public int getEffectTime() {
return effectTime;
}
public VipInfo(int count, int effectTime) {
this.count = count;
this.effectTime = effectTime;
}
public VipInfo() {
}
}

View File

@ -13,10 +13,7 @@ import com.ljsd.jieling.globals.BIReason;
import com.ljsd.jieling.globals.Global;
import com.ljsd.jieling.logic.activity.ActivityLogic;
import com.ljsd.jieling.logic.activity.event.HeroFiveStarGetEvent;
import com.ljsd.jieling.logic.activity.event.HeroUpStarEvent;
import com.ljsd.jieling.logic.activity.event.Poster;
import com.ljsd.jieling.logic.activity.event.RandomCardEvent;
import com.ljsd.jieling.logic.activity.event.*;
import com.ljsd.jieling.logic.activity.eventhandler.HeroFiveStarGetEventHandler;
import com.ljsd.jieling.logic.dao.*;
import com.ljsd.jieling.logic.dao.root.User;
@ -252,9 +249,10 @@ public class HeroLogic{
if(!enoughCost){
throw new ErrorCodeException(ErrorCode.ITEM_NOT_ENOUGH);
}
}else{
user.getPlayerInfoManager().updateVipPrivilage(privilege, 1);
}
// else{
// user.getPlayerInfoManager().updateVipPrivilage(privilege, 1);
// }
//额外获取
int length = perCount;
int[][] tenTimesMustGetItem = null;
@ -318,6 +316,8 @@ public class HeroLogic{
if( (alreadyCount + perCount)/lotterySecurityReward[0] > alreadyCount/lotterySecurityReward[0]){
builder.setExtraBox(ItemUtil.drop(user, new int[]{lotterySecurityReward[1]},1F,0,BIReason.HERO_RANDOM));
}
Poster.getPoster().dispatchEvent(new HeroRandomEvent(uid,perCount));
}
user.getUserMissionManager().onGameEvent(user,GameEvent.RANDOM_HERO,sLotterySetting.getLotteryType(),perCount);
heroManager.updateRandCount(type,randCount);

View File

@ -691,7 +691,7 @@ public class MissionLoigc {
User user = UserManager.getUser(session.getUid());
MissingRoomMissionType missingRoomMissionType = user.getUserMissionManager().getMissingRoomMissionType();
missingRoomMissionType.heroSend(user,hero,missionId);
Poster.getPoster().dispatchEvent(new MissingRoomBestEvent(SMazeTreasure.sMazeTreasureMap.get(missionId%10_000).getTaskType()));
Poster.getPoster().dispatchEvent(new MissingRoomBestEvent(SMazeTreasure.sMazeTreasureMap.get(missionId%10_000).getTaskType(),user.getId()));
user.getUserMissionManager().updateString("missingRoomMissionType",missingRoomMissionType);
MessageUtil.sendMessage(session,1,messageType.getNumber(),null,true);
}

View File

@ -138,6 +138,13 @@ public class PlayerLogic {
playerInfoManager.setNickName(name);
if(sex==0||sex==1){
playerInfoManager.setSex(sex);
int headID =SPlayerRole.getRolePic(sex);
if(headID==0){
LOGGER.error("Exception::sex pic null");
}else {
playerInfoManager.setHead(headID);
}
playerInfoUpdate(user);
}
String key = RedisKey.getKey(RedisKey.C_User_Name_Key, name, false);
RedisUtil.getInstence().set(key, String.valueOf(uid),RedisKey.REDIS_OVER_FOREVER);
@ -281,11 +288,12 @@ public class PlayerLogic {
sendVipDailyOrLevlUpReward(user, vipLevel,BIReason.VIP_DAY_REWARD);
if(fBuilder!=null){
List<CommonProto.Privilege> privilegeList = new ArrayList<>();
Map<Integer, Integer> vipInfo = playerInfoManager.getVipInfo();
for(Map.Entry<Integer,Integer> vipInfoItem : vipInfo.entrySet()){
Map<Integer, VipInfo> vipInfo = playerInfoManager.getVipInfo();
for(Map.Entry<Integer,VipInfo> vipInfoItem : vipInfo.entrySet()){
privilegeList.add(CommonProto.Privilege.newBuilder()
.setId(vipInfoItem.getKey())
. setUsedTimes(vipInfoItem.getValue())
. setUsedTimes(vipInfoItem.getValue().getCount())
.setEffectTime(vipInfoItem.getValue().getEffectTime())
.build());
}
fBuilder.setHadTakeDailyBox(playerInfoManager.getHadTakeDailyBoxVip()).addAllPrivilege(privilegeList);

View File

@ -1,6 +1,7 @@
package com.ljsd.jieling.logic.store;
import com.ljsd.jieling.config.clazzStaticCfg.CommonStaticConfig;
import com.ljsd.jieling.core.GlobalsDef;
import com.ljsd.jieling.db.mongo.MongoUtil;
import com.ljsd.jieling.exception.ErrorCode;
import com.ljsd.jieling.exception.ErrorCodeException;
@ -205,7 +206,9 @@ public class BuyGoodsLogic {
//vip 等级更新和推送
int newLeve= SVipLevelConfig.getsVipLevel(rechargeInfo.getSaveAmt());
if(user.getPlayerInfoManager().getVipLevel()!=newLeve){
user.getPlayerInfoManager().updateVipInfo(user,newLeve);
// user.getPlayerInfoManager().updateVipInfo(user,newLeve);
user.getPlayerInfoManager().setVipLevel(newLeve);
user.getPlayerInfoManager().updateVipInfo(GlobalsDef.VIP_UNLOCK_PRIVILEGE,newLeve);
CombatLogic.getInstance().getNewAdventureReward(user, true);
}
PlayerInfoProto.RefreshRechargeIndication.Builder builder = PlayerInfoProto.RefreshRechargeIndication.newBuilder();

View File

@ -422,6 +422,9 @@ public class StoreLogic {
int vipLeve = user.getPlayerInfoManager().getVipLevel();
user.getPlayerInfoManager().setHadTakeLevelBoxVip(vipLeve);
}
if(sStoreConfig.getOpenPrivilege()!=null){
Arrays.stream(sStoreConfig.getOpenPrivilege()).forEach(n->user.getPlayerInfoManager().addVipInfo(n));
}
PlayerInfoProto.BuyStoreItemResponse builder = PlayerInfoProto.BuyStoreItemResponse.newBuilder().setDrop(drop).build();
MessageUtil.sendMessage(iSession, 1,msgId, builder, true);

View File

@ -0,0 +1,44 @@
package config;
import manager.STableManager;
import manager.Table;
import java.util.HashMap;
import java.util.Map;
@Table(name ="PlayerRole")
public class SPlayerRole implements BaseConfig {
private int id;
private int role;
private int rolePic;
private static Map<Integer,Integer> roleMap;
@Override
public void init() throws Exception {
roleMap = new HashMap<>();
for (SPlayerRole entry:STableManager.getConfig(SPlayerRole.class).values()) {
roleMap.put(entry.getRole(),entry.getRolePic());
}
}
public int getId() {
return id;
}
public int getRole() {
return role;
}
public int getRolePic() {
return rolePic;
}
public static int getRolePic(Integer sex) {
return SPlayerRole.roleMap.getOrDefault(sex,0);
}
}