Merge branch 'master' of 60.1.1.230:backend/jieling_server
commit
b5976884de
|
|
@ -43,6 +43,24 @@ local function calBuffHit(caster, target, baseRandom)
|
|||
return baseRandom
|
||||
end
|
||||
|
||||
local function clearBuffPredicate(buff, type)
|
||||
local flag = false
|
||||
if type == 1 then --持续恢复
|
||||
flag = buff.type == BuffName.HOT
|
||||
elseif type == 2 then --护盾
|
||||
flag = buff.type == BuffName.Shield
|
||||
elseif type == 3 then --增益状态
|
||||
flag = buff.isBuff == true
|
||||
elseif type == 4 then --减益状态
|
||||
flag = buff.isDeBuff == true
|
||||
elseif type == 5 then --持续伤害
|
||||
flag = buff.type == BuffName.DOT
|
||||
elseif type == 6 then --负面状态(控制状态、减益状态和持续伤害状态)
|
||||
flag = buff.type == BuffName.Control or buff.isDeBuff or buff.type == BuffName.DOT
|
||||
end
|
||||
return flag
|
||||
end
|
||||
|
||||
--效果表
|
||||
local effectList = {
|
||||
--造成[a]%的[b]伤害
|
||||
|
|
@ -946,27 +964,9 @@ local effectList = {
|
|||
[55] = function(caster, target, args, interval)
|
||||
local ct = args[1]
|
||||
BattleLogic.WaitForTrigger(interval, function ()
|
||||
if ct == 1 then --持续恢复
|
||||
BattleLogic.BuffMgr:ClearBuff(target, function (buff)
|
||||
return buff.type == BuffName.HOT
|
||||
end)
|
||||
elseif ct == 2 then --护盾
|
||||
BattleLogic.BuffMgr:ClearBuff(target, function (buff)
|
||||
return buff.type == BuffName.Shield
|
||||
end)
|
||||
elseif ct == 3 then --增益状态
|
||||
BattleLogic.BuffMgr:ClearBuff(target, function (buff)
|
||||
return buff.isBuff == true
|
||||
end)
|
||||
elseif ct == 4 then --减益状态
|
||||
BattleLogic.BuffMgr:ClearBuff(target, function (buff)
|
||||
return buff.isDeBuff == true
|
||||
end)
|
||||
elseif ct == 5 then --持续伤害
|
||||
BattleLogic.BuffMgr:ClearBuff(target, function (buff)
|
||||
return buff.type == BuffName.DOT
|
||||
end)
|
||||
end
|
||||
BattleLogic.BuffMgr:ClearBuff(target, function (buff)
|
||||
return clearBuffPredicate(buff, ct)
|
||||
end)
|
||||
end)
|
||||
end,
|
||||
--造成目标当前生命[a]%的真实伤害,为我方角色回复此技能所有由此效果带来的伤害,平均分配给我方生命最低的[b]个角色。
|
||||
|
|
@ -1162,7 +1162,7 @@ local effectList = {
|
|||
end
|
||||
end)
|
||||
end,
|
||||
--造成[a]%的[b]伤害,[c]的概率附加一层增伤印记,最大[d]层。目标身上每层印记增加此技能[e]%的伤害。【aoe】
|
||||
--造成[a]%的[b]伤害,[c]的概率附加一层增伤印记,最大[d]层。目标身上每层印记增加此技能[e]%的伤害。(减益印记,不可驱散)
|
||||
--a[float],b[伤害类型],c[float],d[int],e[float]
|
||||
[66] = function(caster, target, args, interval)
|
||||
local f1 = args[1]
|
||||
|
|
@ -1170,6 +1170,7 @@ local effectList = {
|
|||
local f2 = args[3]
|
||||
local i1 = args[4]
|
||||
local f3 = args[5]
|
||||
caster.Event:DispatchEvent(BattleEventName.RoleViewBullet, interval, target)
|
||||
BattleLogic.WaitForTrigger(interval, function ()
|
||||
local brand = Buff.Create(caster, BuffName.Brand, 0, "zengshang")
|
||||
brand.maxLayer = i1
|
||||
|
|
@ -1543,18 +1544,7 @@ local effectList = {
|
|||
BattleUtil.RandomAction(f1, function ()
|
||||
local count = 0
|
||||
BattleLogic.BuffMgr:ClearBuff(target, function (buff)
|
||||
local flag = false
|
||||
if ct == 1 then --持续恢复
|
||||
flag = buff.type == BuffName.HOT
|
||||
elseif ct == 2 then --护盾
|
||||
flag = buff.type == BuffName.Shield
|
||||
elseif ct == 3 then --增益状态
|
||||
flag = buff.isBuff == true
|
||||
elseif ct == 4 then --减益状态
|
||||
flag = buff.isDeBuff == true
|
||||
elseif ct == 5 then --持续伤害
|
||||
flag = buff.type == BuffName.DOT
|
||||
end
|
||||
local flag = clearBuffPredicate(buff, ct)
|
||||
if flag then
|
||||
count = count + 1
|
||||
end
|
||||
|
|
@ -1563,7 +1553,7 @@ local effectList = {
|
|||
end)
|
||||
end)
|
||||
end,
|
||||
--施加[a]的[b]%护盾,持续[c]秒。护盾被击破时,对敌方全体造成最大生命值[d]%的伤害。(目标最大生命值伤害总上限为施法者2.5倍攻击)
|
||||
--施加[a]的[b]%护盾,持续[c]秒。护盾被击破时,对击破者造成自身最大生命值[d]%的伤害。
|
||||
--a[属性],b[float],c[int],d[float]
|
||||
[84] = function(caster, target, args, interval)
|
||||
local pro1 = args[1]
|
||||
|
|
@ -1575,11 +1565,8 @@ local effectList = {
|
|||
local shield = Buff.Create(caster, BuffName.Shield, f2, val, 0)
|
||||
local OnBuffEnd = function(buff)
|
||||
if buff == shield and buff.framePass < buff.frameDuration then --护盾被击破
|
||||
local arr = BattleUtil.ChooseTarget(target, 20000)
|
||||
for i=1, #arr do
|
||||
local v1 = BattleUtil.FP_Mul(arr[i]:GetRoleData(RoleDataName.MaxHp), f3)
|
||||
local v2 = BattleUtil.FP_Mul(caster:GetRoleData(RoleDataName.Attack),2.5)
|
||||
BattleUtil.ApplyDamage(target, arr[i], floor(min(v1, v2)))
|
||||
if buff.atk and not buff.atk.isTeam then
|
||||
BattleUtil.ApplyDamage(target, buff.atk, BattleUtil.FP_Mul(target:GetRoleData(RoleDataName.MaxHp), f3))
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
@ -1777,18 +1764,7 @@ local effectList = {
|
|||
BattleUtil.RandomAction(f2, function ()
|
||||
local count = 0
|
||||
BattleLogic.BuffMgr:ClearBuff(target, function (buff)
|
||||
local flag = false
|
||||
if ct == 1 then --持续恢复
|
||||
flag = buff.type == BuffName.HOT
|
||||
elseif ct == 2 then --护盾
|
||||
flag = buff.type == BuffName.Shield
|
||||
elseif ct == 3 then --增益状态
|
||||
flag = buff.isBuff == true
|
||||
elseif ct == 4 then --减益状态
|
||||
flag = buff.isDeBuff == true
|
||||
elseif ct == 5 then --持续伤害
|
||||
flag = buff.type == BuffName.DOT
|
||||
end
|
||||
local flag = clearBuffPredicate(buff, ct)
|
||||
if flag then
|
||||
count = count + 1
|
||||
end
|
||||
|
|
@ -1797,7 +1773,79 @@ local effectList = {
|
|||
end)
|
||||
end
|
||||
end)
|
||||
end
|
||||
end,
|
||||
--造成[a]%的[b]伤害,为自己施加一层印记,最大[c]层。(增益印记,不可驱散)(与95使用同一个印记)
|
||||
--a[float],b[伤害类型],c[int]
|
||||
[94] = function(caster, target, args, interval)
|
||||
local f1 = args[1]
|
||||
local dt = args[2]
|
||||
local i1 = args[3]
|
||||
caster.Event:DispatchEvent(BattleEventName.RoleViewBullet, interval, target)
|
||||
BattleLogic.WaitForTrigger(interval, function ()
|
||||
BattleUtil.CalDamage(caster, target, dt, f1)
|
||||
local brand = Buff.Create(caster, BuffName.Brand, 0, "zengyi")
|
||||
brand.maxLayer = i1
|
||||
brand.clear = false
|
||||
brand.isBuff = true
|
||||
caster:AddBuff(brand)
|
||||
end)
|
||||
end,
|
||||
--造成[a]%的[b]伤害,自身每层印记增加此技能[c]%的伤害。(增益印记,不可驱散)(与94使用同一个印记)
|
||||
--a[float],b[伤害类型],c[float]
|
||||
[95] = function(caster, target, args, interval)
|
||||
local f1 = args[1]
|
||||
local dt = args[2]
|
||||
local f2 = args[3]
|
||||
caster.Event:DispatchEvent(BattleEventName.RoleViewBullet, interval, target)
|
||||
BattleLogic.WaitForTrigger(interval, function ()
|
||||
local layer = 0
|
||||
if BattleLogic.BuffMgr:HasBuff(caster, BuffName.Brand, function (buff)
|
||||
local b = buff.flag == "zengyi"
|
||||
if b then
|
||||
layer = buff.layer
|
||||
end
|
||||
return b
|
||||
end) then
|
||||
local OnPassiveDamaging = function(damagingFunc, defRole, damage)
|
||||
damagingFunc(-floor(BattleUtil.FP_Mul(f2, layer, damage)))
|
||||
end
|
||||
caster.Event:AddEvent(BattleEventName.PassiveDamaging, OnPassiveDamaging)
|
||||
BattleUtil.CalDamage(caster, target, dt, f1)
|
||||
caster.Event:RemoveEvent(BattleEventName.PassiveDamaging, OnPassiveDamaging)
|
||||
else
|
||||
BattleUtil.CalDamage(caster, target, dt, f1)
|
||||
end
|
||||
end)
|
||||
end,
|
||||
--[b]概率造成[c],每次造成[d]的真实伤害,在[e]秒内造成[f]次伤害。(91,异妖用)(减益,不可驱散)
|
||||
--b[float],c[持续伤害状态].d[float],e[int],f[int]
|
||||
[96] = function(caster, target, args, interval)
|
||||
local f4 = args[1]
|
||||
local d1 = args[2]
|
||||
local f1 = args[3]
|
||||
local f2 = args[4]
|
||||
local f3 = args[5]
|
||||
BattleLogic.WaitForTrigger(interval, function ()
|
||||
local DOT = Buff.Create(caster, BuffName.DOT, f2, f2/f3, d1, 0, f1)
|
||||
DOT.clear = false
|
||||
DOT.isDeBuff = true
|
||||
buffRandomAction(f4, target, DOT)
|
||||
end)
|
||||
end,
|
||||
--[a]概率在[c]秒里总共回复[d]次生命,每次恢复[b]生命。(89,异妖用)(增益,不可驱散)
|
||||
--a[float],b[float],c[int],d[int]
|
||||
[97] = function(caster, target, args, interval)
|
||||
local f4 = args[1]
|
||||
local i1 = args[2]
|
||||
local f2 = args[3]
|
||||
local f3 = args[4]
|
||||
BattleLogic.WaitForTrigger(interval, function ()
|
||||
local HOT = Buff.Create(caster, BuffName.HOT, f2, f2/f3, i1)
|
||||
HOT.clear = false
|
||||
HOT.isBuff = true
|
||||
buffRandomAction(f4, target, HOT)
|
||||
end)
|
||||
end,
|
||||
}
|
||||
|
||||
return effectList
|
||||
|
|
@ -1352,5 +1352,46 @@ local passivityList = {
|
|||
end
|
||||
role.Event:AddEvent(BattleEventName.PassiveCriting, OnPassiveCriting)
|
||||
end,
|
||||
--释放技能时,自己损失[a]%当前生命值,为此次技能增加等量伤害。
|
||||
--a[float]
|
||||
[73] = function(role, args)
|
||||
local f1 = args[1]
|
||||
|
||||
local hp=0
|
||||
local OnPassiveDamaging = function(damagingFunc, defRole, damage)
|
||||
damagingFunc(-hp)
|
||||
end
|
||||
local OnSkillCast, OnSkillCastEnd
|
||||
OnSkillCast = function(skill)
|
||||
hp = floor(BattleUtil.FP_Mul(role:GetRoleData(RoleDataName.Hp), f1))
|
||||
role.data:SubValue(RoleDataName.Hp, hp)
|
||||
|
||||
role.Event:RemoveEvent(BattleEventName.SkillCast, OnSkillCast)
|
||||
role.Event:AddEvent(BattleEventName.SkillCastEnd, OnSkillCastEnd)
|
||||
role.Event:AddEvent(BattleEventName.PassiveDamaging, OnPassiveDamaging)
|
||||
end
|
||||
OnSkillCastEnd = function(skill)
|
||||
BattleLogic.WaitForTrigger(BattleLogic.GameDeltaTime, function () --延迟一帧移除事件,防止触发帧和结束帧为同一帧时,被动未移除
|
||||
role.Event:RemoveEvent(BattleEventName.SkillCastEnd, OnSkillCastEnd)
|
||||
role.Event:RemoveEvent(BattleEventName.PassiveDamaging, OnPassiveDamaging)
|
||||
end)
|
||||
end
|
||||
role.Event:AddEvent(BattleEventName.SkillCast, OnSkillCast)
|
||||
end,
|
||||
--死亡时,为所有我方角色增加[a]%的[b]属性,持续[c]秒。
|
||||
--a[float],b[属性],c[int]
|
||||
[74] = function(role, args)
|
||||
local f1 = args[1]
|
||||
local pro = args[2]
|
||||
local f2 = args[3]
|
||||
|
||||
local OnDead = function(atkRole)
|
||||
local arr = BattleUtil.ChooseTarget(role, 10000)
|
||||
for i=1, #arr do
|
||||
arr[i]:AddBuff(Buff.Create(role, BuffName.PropertyChange, f2, propertyList[pro], f1, 2))
|
||||
end
|
||||
end
|
||||
role.Event:AddEvent(BattleEventName.RoleDead, OnDead)
|
||||
end,
|
||||
}
|
||||
return passivityList
|
||||
|
|
@ -1,5 +1,8 @@
|
|||
Immune = Buff:New()
|
||||
|
||||
local immune0 = function(buff)
|
||||
return buff.type == BuffName.Control or buff.isDeBuff or buff.type == BuffName.DOT
|
||||
end
|
||||
local immune1 = function(buff)
|
||||
return buff.type == BuffName.Control
|
||||
end
|
||||
|
|
@ -17,7 +20,9 @@ end
|
|||
--初始化后调用一次
|
||||
function Immune:OnStart()
|
||||
--log("Immune:OnStart")
|
||||
if self.immuneType == 1 then --免疫控制状态
|
||||
if self.immuneType == 0 then --免疫负面状态(控制状态、减益状态和持续伤害状态)
|
||||
self.target.buffFilter:Add(immune0)
|
||||
elseif self.immuneType == 1 then --免疫控制状态
|
||||
self.target.buffFilter:Add(immune1)
|
||||
elseif self.immuneType == 2 then --免疫dot
|
||||
self.target.buffFilter:Add(immune2)
|
||||
|
|
@ -34,7 +39,9 @@ end
|
|||
function Immune:OnEnd()
|
||||
--log("Immune:OnEnd")
|
||||
local immune
|
||||
if self.immuneType == 1 then --免疫控制状态
|
||||
if self.immuneType == 0 then --免疫负面状态(控制状态、减益状态和持续伤害状态)
|
||||
immune = immune0
|
||||
elseif self.immuneType == 1 then --免疫控制状态
|
||||
immune = immune1
|
||||
elseif self.immuneType == 2 then --免疫dot
|
||||
immune = immune2
|
||||
|
|
|
|||
|
|
@ -7,6 +7,7 @@ function Shield:SetData(...)
|
|||
self.dmgReboundFactor = ... --伤害反弹系数
|
||||
self.damageSum = 0 --记录承受的伤害
|
||||
self.isBuff = true
|
||||
self.atk=nil --每次扣除护盾时,记录破盾的对象
|
||||
end
|
||||
|
||||
--初始化后调用一次
|
||||
|
|
|
|||
|
|
@ -152,6 +152,7 @@ end
|
|||
function BattleUtil.CalShield(atkRole, defRole, damage)
|
||||
for i=1, defRole.shield.size do
|
||||
local buff = defRole.shield.buffer[i]
|
||||
buff.atk = atkRole
|
||||
if damage < buff.shieldValue then
|
||||
buff.shieldValue = buff.shieldValue - damage
|
||||
buff.damageSum = buff.damageSum + damage
|
||||
|
|
|
|||
|
|
@ -328,5 +328,15 @@ public abstract class AbstractActivity implements IActivity, IEventHandler {
|
|||
}
|
||||
|
||||
}
|
||||
protected Set<Integer> getRankSet(int start, int end) {
|
||||
Set<Integer> set = new HashSet<>();
|
||||
if (start > end) {
|
||||
return set;
|
||||
}
|
||||
for (int i = start; i <= end; i++) {
|
||||
set.add(i);
|
||||
}
|
||||
return set;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -255,6 +255,12 @@ public class ActivityLogic implements IEventHandler{
|
|||
for (SGlobalActivity sGlobalActivity : sGlobalActivityMap.values()) {
|
||||
int activityId = sGlobalActivity.getId();
|
||||
if (openActivityIds.contains(activityId)) {
|
||||
if(sGlobalActivity.getGapTime()>0){
|
||||
long endTime = ToolsUtil.getEndTimeLong(sGlobalActivity.getStartTimeLong(),sGlobalActivity.getEndTimeLong(),sGlobalActivity.getTime(),userCreateTime, sGlobalActivity.getGapTime());
|
||||
if(TimeUtils.now()>=endTime){
|
||||
goRewardActivity(user,activityId,builder,false);
|
||||
}
|
||||
}
|
||||
int[] ifOpen = sGlobalActivity.getIfOpen();
|
||||
if(ifOpen!=null && ifOpen.length>0){
|
||||
if(ifOpen[0]==1){ //创角
|
||||
|
|
@ -274,19 +280,20 @@ public class ActivityLogic implements IEventHandler{
|
|||
continue;
|
||||
}
|
||||
if (endTime != 0 && now > endTime) {
|
||||
ActivityMission activityMission = activityMissionMap.get(activityId);
|
||||
if (activityMission != null) {
|
||||
AbstractActivity abstractActivity = ActivityTypeEnum.getActicityType(sGlobalActivity.getId());
|
||||
if (null==abstractActivity) {
|
||||
continue;
|
||||
}
|
||||
abstractActivity .onActivityEndSelfWithDealReward(user);
|
||||
activityManager.removeActivity(activityId);
|
||||
LOGGER.info("the uid={},remove the activity id ={}", user.getId(), activityId);
|
||||
if (builder != null) {
|
||||
builder.addCloseActivityId(activityId);
|
||||
}
|
||||
}
|
||||
// ActivityMission activityMission = activityMissionMap.get(activityId);
|
||||
// if (activityMission != null) {
|
||||
// AbstractActivity abstractActivity = ActivityTypeEnum.getActicityType(sGlobalActivity.getId());
|
||||
// if (null==abstractActivity) {
|
||||
// continue;
|
||||
// }
|
||||
// abstractActivity .onActivityEndSelfWithDealReward(user);
|
||||
// activityManager.removeActivity(activityId);
|
||||
// LOGGER.info("the uid={},remove the activity id ={}", user.getId(), activityId);
|
||||
// if (builder != null) {
|
||||
// builder.addCloseActivityId(activityId);
|
||||
// }
|
||||
// }
|
||||
goRewardActivity(user,activityId,builder,true);
|
||||
continue;
|
||||
}
|
||||
ActivityMission activityMission = activityMissionMap.get(activityId);
|
||||
|
|
@ -309,24 +316,29 @@ public class ActivityLogic implements IEventHandler{
|
|||
openNewActivityIds.add(activityId);
|
||||
checkNeedOpenStore(user,sGlobalActivity.getShopId(),startTime,endTime);
|
||||
} else {
|
||||
ActivityMission activityMission = activityMissionMap.get(activityId);
|
||||
if (activityMission != null) {
|
||||
AbstractActivity abstractActivity = ActivityTypeEnum.getActicityType(sGlobalActivity.getId());
|
||||
if (null==abstractActivity) {
|
||||
continue;
|
||||
}
|
||||
abstractActivity.onActivityEndSelfWithDealReward(user);
|
||||
activityManager.removeActivity(activityId);
|
||||
LOGGER.info("the uid={},remove the activity id ={}", user.getId(), activityId);
|
||||
if (builder != null) {
|
||||
builder.addCloseActivityId(activityId);
|
||||
}
|
||||
}
|
||||
goRewardActivity(user,activityId,builder,true);
|
||||
}
|
||||
}
|
||||
return openNewActivityIds;
|
||||
|
||||
}
|
||||
private static void goRewardActivity(User user,int activityId,PlayerInfoProto.ActivityUpateIndication.Builder builder,boolean isRemoveInfo) throws Exception {
|
||||
ActivityMission activityMission = user.getActivityManager().getActivityMissionMap().get(activityId);
|
||||
if (activityMission != null) {
|
||||
AbstractActivity abstractActivity = ActivityTypeEnum.getActicityType(activityId);
|
||||
if (null==abstractActivity) {
|
||||
return;
|
||||
}
|
||||
abstractActivity.onActivityEndSelfWithDealReward(user);
|
||||
if(isRemoveInfo){
|
||||
user.getActivityManager().removeActivity(activityId);
|
||||
LOGGER.info("the uid={},remove the activity id ={}", user.getId(), activityId);
|
||||
if (builder != null) {
|
||||
builder.addCloseActivityId(activityId);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public static ActivityLogic getInstance() {
|
||||
|
|
|
|||
|
|
@ -119,14 +119,4 @@ class ExpectRankActivity extends AbstractActivity {
|
|||
}
|
||||
}
|
||||
|
||||
private Set<Integer> getRankSet(int start, int end) {
|
||||
Set<Integer> set = new HashSet<>();
|
||||
if (start > end) {
|
||||
return set;
|
||||
}
|
||||
for (int i = start; i <= end; i++) {
|
||||
set.add(i);
|
||||
}
|
||||
return set;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -117,16 +117,16 @@ class ForceRankActivity extends AbstractActivity {
|
|||
|
||||
}
|
||||
|
||||
private Set<Integer> getRankSet(int start, int end) {
|
||||
Set<Integer> set = new HashSet<>();
|
||||
if (start > end) {
|
||||
return set;
|
||||
}
|
||||
for (int i = start; i <= end; i++) {
|
||||
set.add(i);
|
||||
}
|
||||
return set;
|
||||
}
|
||||
// private Set<Integer> getRankSet(int start, int end) {
|
||||
// Set<Integer> set = new HashSet<>();
|
||||
// if (start > end) {
|
||||
// return set;
|
||||
// }
|
||||
// for (int i = start; i <= end; i++) {
|
||||
// set.add(i);
|
||||
// }
|
||||
// return set;
|
||||
// }
|
||||
|
||||
@Override
|
||||
public void onActivityEndDealReward(User user) throws Exception {
|
||||
|
|
|
|||
|
|
@ -3,6 +3,7 @@ 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.globals.Global;
|
||||
import com.ljsd.jieling.logic.activity.event.IEvent;
|
||||
import com.ljsd.jieling.logic.activity.event.Poster;
|
||||
import com.ljsd.jieling.logic.activity.event.RandomCardEvent;
|
||||
|
|
@ -10,15 +11,20 @@ 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.logic.mail.MailLogic;
|
||||
import com.ljsd.jieling.logic.rank.RankContext;
|
||||
import com.ljsd.jieling.logic.rank.RankEnum;
|
||||
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 com.ljsd.jieling.util.ItemUtil;
|
||||
import config.*;
|
||||
import org.springframework.data.redis.core.ZSetOperations;
|
||||
import util.TimeUtils;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
import java.util.function.Consumer;
|
||||
import java.util.function.Predicate;
|
||||
import java.util.stream.Stream;
|
||||
|
|
@ -62,7 +68,70 @@ public class LimitRandomCardActivity extends AbstractActivity {
|
|||
|
||||
@Override
|
||||
public void onActivityEnd() throws Exception {
|
||||
RedisUtil.getInstence().del(RedisKey.RANDOM_CARD_RANK);
|
||||
SGlobalActivity sGlobalActivity = SGlobalActivity.getsGlobalActivityMap().get(id);
|
||||
if(sGlobalActivity.getOpenRanking()==0){
|
||||
return;
|
||||
}
|
||||
List<SActivityRankingReward> sActivityRankingReward = SActivityRankingReward.getsActivityRankingRewardMapByActivityId(id);
|
||||
if(null==sActivityRankingReward)
|
||||
return;
|
||||
int maxRank = 0;
|
||||
int maxRewardId = 0;
|
||||
Map<Integer, Integer> rank2miss = new HashMap<>();
|
||||
for (SActivityRankingReward sActivityRankingReward1 : sActivityRankingReward) {
|
||||
if(sActivityRankingReward1.getMaxRank()==-1){
|
||||
maxRank =-1;
|
||||
maxRewardId = sActivityRankingReward1.getId();
|
||||
continue;
|
||||
}
|
||||
|
||||
if(maxRank!=-1)
|
||||
{
|
||||
maxRank = Math.max(maxRank, sActivityRankingReward1.getMaxRank());
|
||||
}
|
||||
|
||||
for (Integer rank : getRankSet(sActivityRankingReward1.getMinRank(), sActivityRankingReward1.getMaxRank())) {
|
||||
rank2miss.put(rank, sActivityRankingReward1.getId());
|
||||
}
|
||||
}
|
||||
|
||||
Set<ZSetOperations.TypedTuple<String>> rankInfo = RedisUtil.getInstence().getZsetreverseRangeWithScores(RedisKey.RANDOM_CARD_RANK, Integer.toString(id), 0, (maxRank==-1?0:maxRank) - 1);
|
||||
int rank = 1;
|
||||
int nowTime = (int) (TimeUtils.now() / 1000);
|
||||
for (ZSetOperations.TypedTuple<String> item : rankInfo) {
|
||||
String value = item.getValue();
|
||||
int uid = Integer.parseInt(value);
|
||||
User user = UserManager.getUser(uid, true);
|
||||
if (null == user) {
|
||||
continue;
|
||||
}
|
||||
ActivityMission activityMission = user.getActivityManager().getActivityMissionMap().get(id);
|
||||
if (activityMission == null || activityMission.getOpenType() == 0) {
|
||||
continue;
|
||||
}
|
||||
int missionId;
|
||||
if (rank2miss.containsKey(rank)) {
|
||||
missionId = rank2miss.get(rank);
|
||||
} else {
|
||||
if (maxRank == -1) {
|
||||
missionId = maxRewardId;
|
||||
} else {
|
||||
continue;
|
||||
}
|
||||
}
|
||||
|
||||
//check value
|
||||
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 mailReward = ItemUtil.getMailReward(sActivityRankingReward1.getRankingReward());
|
||||
MailLogic.getInstance().sendMail(uid, title, content, mailReward, nowTime, Global.MAIL_EFFECTIVE_TIME);
|
||||
RedisUtil.getInstence().del(RedisKey.getKey(RedisKey.RANDOM_CARD_PERFECT_RANK,"",false));
|
||||
RedisUtil.getInstence().del(RedisKey.getKey(RedisKey.RANDOM_CARD_RANK,"",false));
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
|||
|
|
@ -222,21 +222,18 @@ public class HeroLogic{
|
|||
//检验消耗
|
||||
boolean allowFree = false;
|
||||
int privilege = 0;
|
||||
if(perCount == 1){
|
||||
switch (sLotterySetting.getLotteryType()){
|
||||
case 1:
|
||||
privilege = VipPrivilegeType.FREE_HERO_RANDOM;
|
||||
switch (sLotterySetting.getLotteryType()){
|
||||
case 1:
|
||||
privilege = VipPrivilegeType.FREE_HERO_RANDOM;
|
||||
break;
|
||||
case 3:
|
||||
privilege = VipPrivilegeType.TIME_RANDOM_FREE;
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
case 3:
|
||||
privilege = VipPrivilegeType.TIME_RANDOM_FREE;
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
if(privilege!=0){
|
||||
allowFree = PlayerLogic.getInstance().check(user,privilege, 1);
|
||||
}
|
||||
|
||||
}
|
||||
if(privilege!=0){
|
||||
allowFree = PlayerLogic.getInstance().check(user,privilege, perCount);
|
||||
}
|
||||
if(!allowFree){
|
||||
boolean enoughCost = false;
|
||||
|
|
|
|||
Loading…
Reference in New Issue