Merge branch 'master' of http://60.1.1.230/backend/jieling_server
commit
3f6971c071
|
|
@ -33,13 +33,6 @@ local function buffRandomAction(random, caster, target, buffType, duration, ...)
|
|||
end
|
||||
end
|
||||
|
||||
local function casterBulletEffect(caster, target, interval)
|
||||
caster.Event:DispatchEvent(BattleEventName.RoleViewBullet, interval, target)
|
||||
if caster.camp == 0 and target.camp == 1 then
|
||||
BattleLogic.Event:DispatchEvent(BattleEventName.ZoomChange, target, interval)
|
||||
end
|
||||
end
|
||||
|
||||
local function calBuffHit(caster, target, baseRandom)
|
||||
if caster.isTeam then --异妖不走效果命中公式
|
||||
return baseRandom
|
||||
|
|
@ -55,7 +48,7 @@ local effectList = {
|
|||
[1] = function(caster, target, args, interval)
|
||||
local f1 = args[1]
|
||||
local dt = args[2]
|
||||
casterBulletEffect(caster, target, interval)
|
||||
caster.Event:DispatchEvent(BattleEventName.RoleViewBullet, interval, target)
|
||||
BattleLogic.WaitForTrigger(interval, function ()
|
||||
BattleUtil.CalDamage(caster, target, dt, f1)
|
||||
end)
|
||||
|
|
@ -114,9 +107,6 @@ local effectList = {
|
|||
|
||||
local count = Random.RangeInt(i1, i2)
|
||||
local d = interval / count
|
||||
if caster.camp == 0 and target.camp == 1 then
|
||||
BattleLogic.Event:DispatchEvent(BattleEventName.ZoomChange, target, d)
|
||||
end
|
||||
for i=1, count do
|
||||
BattleLogic.WaitForTrigger(d * (i-1), function ()
|
||||
caster.Event:DispatchEvent(BattleEventName.RoleViewBullet, d, target)
|
||||
|
|
@ -173,7 +163,7 @@ local effectList = {
|
|||
local f1 = args[1]
|
||||
local dt = args[2]
|
||||
local f2 = args[3]
|
||||
casterBulletEffect(caster, target, interval)
|
||||
caster.Event:DispatchEvent(BattleEventName.RoleViewBullet, interval, target)
|
||||
BattleLogic.WaitForTrigger(interval, function ()
|
||||
local dmg = BattleUtil.CalDamage(caster, target, dt, f1)
|
||||
BattleUtil.CalTreat(caster, caster, floor(dmg * f2))
|
||||
|
|
@ -186,7 +176,7 @@ local effectList = {
|
|||
local dt = args[2]
|
||||
local i1 = args[3]
|
||||
local f2 = args[4]
|
||||
casterBulletEffect(caster, target, interval)
|
||||
caster.Event:DispatchEvent(BattleEventName.RoleViewBullet, interval, target)
|
||||
BattleLogic.WaitForTrigger(interval, function ()
|
||||
if target.roleData.professionId == i1 then
|
||||
f1 = f1 + f2
|
||||
|
|
@ -224,7 +214,7 @@ local effectList = {
|
|||
local rid = args[4]
|
||||
local f3 = args[5]
|
||||
local i1 = args[6]
|
||||
casterBulletEffect(caster, target, interval)
|
||||
caster.Event:DispatchEvent(BattleEventName.RoleViewBullet, interval, target)
|
||||
BattleLogic.WaitForTrigger(interval, function ()
|
||||
local layer
|
||||
if BattleLogic.BuffMgr:HasBuff(target, BuffName.Brand, function (buff)
|
||||
|
|
@ -247,7 +237,7 @@ local effectList = {
|
|||
local f1 = args[1]
|
||||
local dt = args[2]
|
||||
local f2 = args[3]
|
||||
casterBulletEffect(caster, target, interval)
|
||||
caster.Event:DispatchEvent(BattleEventName.RoleViewBullet, interval, target)
|
||||
BattleLogic.WaitForTrigger(interval, function ()
|
||||
local dmg, crit = BattleUtil.CalDamage(caster, target, dt, f1)
|
||||
if target.isDead then
|
||||
|
|
@ -286,7 +276,7 @@ local effectList = {
|
|||
local dt = args[2]
|
||||
local i1 = args[3]
|
||||
local f2 = calBuffHit(caster, target, args[4])
|
||||
casterBulletEffect(caster, target, interval)
|
||||
caster.Event:DispatchEvent(BattleEventName.RoleViewBullet, interval, target)
|
||||
BattleLogic.WaitForTrigger(interval, function ()
|
||||
local dmg = floor(caster:GetRoleData(propertyList[dt]) * f1)
|
||||
if target.roleData.professionId == i1 then
|
||||
|
|
@ -306,7 +296,7 @@ local effectList = {
|
|||
local f1 = args[1]
|
||||
local dt = args[2]
|
||||
local f2 = args[3]
|
||||
casterBulletEffect(caster, target, interval)
|
||||
caster.Event:DispatchEvent(BattleEventName.RoleViewBullet, interval, target)
|
||||
BattleLogic.WaitForTrigger(interval, function ()
|
||||
local d, crit = BattleUtil.CalDamage(caster, target, dt, f1)
|
||||
if crit then
|
||||
|
|
@ -332,9 +322,6 @@ local effectList = {
|
|||
count = count + 1
|
||||
end
|
||||
local d = interval / count
|
||||
if caster.camp == 0 and target.camp == 1 then
|
||||
BattleLogic.Event:DispatchEvent(BattleEventName.ZoomChange, target, d)
|
||||
end
|
||||
for i=1, count do
|
||||
BattleLogic.WaitForTrigger(d * (i-1), function ()
|
||||
caster.Event:DispatchEvent(BattleEventName.RoleViewBullet, d, target)
|
||||
|
|
@ -351,7 +338,7 @@ local effectList = {
|
|||
local dt = args[2]
|
||||
local i1 = args[3]
|
||||
local f2 = args[4]
|
||||
casterBulletEffect(caster, target, interval)
|
||||
caster.Event:DispatchEvent(BattleEventName.RoleViewBullet, interval, target)
|
||||
BattleLogic.WaitForTrigger(interval, function ()
|
||||
if BattleLogic.BuffMgr:HasBuff(target, BuffName.Control, function (buff) return i1 == 0 or buff.ctrlType == i1 end) then
|
||||
f1 = f1 + f2
|
||||
|
|
@ -396,7 +383,7 @@ local effectList = {
|
|||
local dt = args[2]
|
||||
local ht = args[3]
|
||||
local f2 = args[4]
|
||||
casterBulletEffect(caster, target, interval)
|
||||
caster.Event:DispatchEvent(BattleEventName.RoleViewBullet, interval, target)
|
||||
BattleLogic.WaitForTrigger(interval, function ()
|
||||
if BattleLogic.BuffMgr:HasBuff(target, BuffName.HOT, function (buff) return true end) then
|
||||
f1 = f1 + f2
|
||||
|
|
@ -465,7 +452,7 @@ local effectList = {
|
|||
local dt = args[2]
|
||||
local dot = args[3]
|
||||
local f2 = args[4]
|
||||
casterBulletEffect(caster, target, interval)
|
||||
caster.Event:DispatchEvent(BattleEventName.RoleViewBullet, interval, target)
|
||||
BattleLogic.WaitForTrigger(interval, function ()
|
||||
if BattleLogic.BuffMgr:HasBuff(target, BuffName.DOT, function (buff) return dot == 0 or buff.damageType == dot end) then
|
||||
f1 = f1 + f2
|
||||
|
|
@ -485,9 +472,6 @@ local effectList = {
|
|||
|
||||
local count = Random.RangeInt(i1, i2)
|
||||
local d = interval / count
|
||||
if caster.camp == 0 and target.camp == 1 then
|
||||
BattleLogic.Event:DispatchEvent(BattleEventName.ZoomChange, target, d)
|
||||
end
|
||||
for i=1, count do
|
||||
BattleLogic.WaitForTrigger(d * (i-1), function ()
|
||||
caster.Event:DispatchEvent(BattleEventName.RoleViewBullet, d, target)
|
||||
|
|
@ -507,7 +491,7 @@ local effectList = {
|
|||
local dt = args[2]
|
||||
local ct = args[3]
|
||||
local f2 = args[4]
|
||||
casterBulletEffect(caster, target, interval)
|
||||
caster.Event:DispatchEvent(BattleEventName.RoleViewBullet, interval, target)
|
||||
BattleLogic.WaitForTrigger(interval, function ()
|
||||
if BattleLogic.BuffMgr:HasBuff(target, BuffName.Control, function (buff) return ct == 0 or buff.ctrlType == ct end) then
|
||||
BattleUtil.CalDamage(caster, target, dt, f1, f2)
|
||||
|
|
@ -647,7 +631,7 @@ local effectList = {
|
|||
--a[int]
|
||||
[38] = function(caster, target, args, interval)
|
||||
local d = args[1]
|
||||
casterBulletEffect(caster, target, interval)
|
||||
caster.Event:DispatchEvent(BattleEventName.RoleViewBullet, interval, target)
|
||||
BattleLogic.WaitForTrigger(interval, function ()
|
||||
if not target.isDead then
|
||||
BattleUtil.ApplyDamage(caster, target, d)
|
||||
|
|
@ -659,7 +643,7 @@ local effectList = {
|
|||
[39] = function(caster, target, args, interval)
|
||||
local d1 = args[1]
|
||||
local d2 = args[2]
|
||||
casterBulletEffect(caster, target, interval)
|
||||
caster.Event:DispatchEvent(BattleEventName.RoleViewBullet, interval, target)
|
||||
BattleLogic.WaitForTrigger(interval, function ()
|
||||
target:AddBuff(Buff.Create(caster, BuffName.DOT, d2, 1, 0, d1, 1))
|
||||
end)
|
||||
|
|
@ -682,7 +666,7 @@ local effectList = {
|
|||
local f2 = calBuffHit(caster, target, args[3])
|
||||
local f3 = args[4]
|
||||
local f4 = calBuffHit(caster, target, args[5])
|
||||
casterBulletEffect(caster, target, interval)
|
||||
caster.Event:DispatchEvent(BattleEventName.RoleViewBullet, interval, target)
|
||||
BattleLogic.WaitForTrigger(interval, function ()
|
||||
BattleUtil.RandomAction(f2, function ()
|
||||
f1 = f1 + f3
|
||||
|
|
@ -740,7 +724,7 @@ local effectList = {
|
|||
local pro2 = args[7]
|
||||
local ct2 = args[8]
|
||||
|
||||
casterBulletEffect(caster, target, interval)
|
||||
caster.Event:DispatchEvent(BattleEventName.RoleViewBullet, interval, target)
|
||||
BattleLogic.WaitForTrigger(interval, function ()
|
||||
local proTran1 = {proName = propertyList[pro1], tranProName = propertyList[pro1], tranFactor = f2, changeType = ct1}
|
||||
local proTran2 = {proName = propertyList[pro2], tranProName = propertyList[pro2], tranFactor = f3, changeType = ct2}
|
||||
|
|
@ -771,7 +755,7 @@ local effectList = {
|
|||
local f2 = args[3]
|
||||
local pro1 = args[4]
|
||||
local i1 = args[5]
|
||||
casterBulletEffect(caster, target, interval)
|
||||
caster.Event:DispatchEvent(BattleEventName.RoleViewBullet, interval, target)
|
||||
BattleLogic.WaitForTrigger(interval, function ()
|
||||
local dmg, crit = BattleUtil.CalDamage(caster, target, dt, f1)
|
||||
if target.isDead then
|
||||
|
|
@ -790,7 +774,7 @@ local effectList = {
|
|||
local pt = args[3]
|
||||
local f2 = args[4]
|
||||
local f3 = args[5]
|
||||
casterBulletEffect(caster, target, interval)
|
||||
caster.Event:DispatchEvent(BattleEventName.RoleViewBullet, interval, target)
|
||||
BattleLogic.WaitForTrigger(interval, function ()
|
||||
if target.roleData.professionId == pt then
|
||||
BattleUtil.CalDamage(caster, target, dt, f1+f3, f2)
|
||||
|
|
@ -804,7 +788,7 @@ local effectList = {
|
|||
[48] = function(caster, target, args, interval)
|
||||
local pro = args[1]
|
||||
local d = args[2]
|
||||
casterBulletEffect(caster, target, interval)
|
||||
caster.Event:DispatchEvent(BattleEventName.RoleViewBullet, interval, target)
|
||||
BattleLogic.WaitForTrigger(interval, function ()
|
||||
BattleUtil.ApplyDamage(caster, target, floor(caster:GetRoleData(propertyList[pro]) * d))
|
||||
end)
|
||||
|
|
@ -815,7 +799,7 @@ local effectList = {
|
|||
local f1 = args[1]
|
||||
local dt = args[2]
|
||||
local f2 = args[3]
|
||||
casterBulletEffect(caster, target, interval)
|
||||
caster.Event:DispatchEvent(BattleEventName.RoleViewBullet, interval, target)
|
||||
BattleLogic.WaitForTrigger(interval, function ()
|
||||
BattleUtil.CalDamage(caster, target, dt, f1)
|
||||
local OnPassiveDamaging = function(damagingFunc, defRole, damage)
|
||||
|
|
@ -842,7 +826,7 @@ local effectList = {
|
|||
local f1 = args[1]
|
||||
local dt = args[2]
|
||||
local f2 = args[3]
|
||||
casterBulletEffect(caster, target, interval)
|
||||
caster.Event:DispatchEvent(BattleEventName.RoleViewBullet, interval, target)
|
||||
BattleLogic.WaitForTrigger(interval, function ()
|
||||
if BattleUtil.GetHPPencent(target) < f2 then
|
||||
BattleUtil.ApplyDamage(caster, target, target:GetRoleData(RoleDataName.Hp))
|
||||
|
|
@ -900,7 +884,7 @@ local effectList = {
|
|||
local f1 = args[1]
|
||||
local dt = args[2]
|
||||
local f2 = args[3]
|
||||
casterBulletEffect(caster, target, interval)
|
||||
caster.Event:DispatchEvent(BattleEventName.RoleViewBullet, interval, target)
|
||||
local flag = "fuling"..caster.uid
|
||||
BattleLogic.WaitForTrigger(interval, function ()
|
||||
BattleUtil.CalDamage(caster, target, dt, f1)
|
||||
|
|
@ -982,7 +966,7 @@ local effectList = {
|
|||
[56] = function(caster, target, args, interval)
|
||||
local f1 = args[1]
|
||||
local i1 = args[2]
|
||||
casterBulletEffect(caster, target, interval)
|
||||
caster.Event:DispatchEvent(BattleEventName.RoleViewBullet, interval, target)
|
||||
BattleLogic.WaitForTrigger(interval, function ()
|
||||
local damage = BattleUtil.ApplyDamage(caster, target, floor(target:GetRoleData(RoleDataName.Hp) * f1))
|
||||
local arr = BattleUtil.ChooseTarget(caster, 10110)
|
||||
|
|
|
|||
|
|
@ -22,8 +22,18 @@ function Skill:New()
|
|||
return o
|
||||
end
|
||||
|
||||
function Skill:Init(role, effectData, isTeamSkill)
|
||||
self.cd = isTeamSkill and effectData[1] % 100 or effectData[1] --异妖技能的cd数据为:类型*100 + cd
|
||||
function Skill:Init(role, effectData, type) --type 0 异妖 1 点技 2 滑技
|
||||
local isTeamSkill = type == 0
|
||||
if type == 0 then --异妖
|
||||
self.cd = effectData[1] % 100 --异妖技能的cd数据为:类型*100 + cd
|
||||
self.randomInStage2 = 0
|
||||
elseif type == 1 then --点技
|
||||
self.cd = 0 --点技 cd为0
|
||||
self.randomInStage2 = 0
|
||||
elseif type == 2 then --滑技
|
||||
self.cd = effectData[1] % 100 --上滑技的cd数据为:中期上滑概率*100000 + cd
|
||||
self.randomInStage2 = (effectData[1] - self.cd) / 100000
|
||||
end
|
||||
|
||||
--skill = {cd, {目标id1, 效果时间, 效果1, 效果2, ...},{目标id2, 效果时间, 效果3, 效果4, ...}, ...}
|
||||
--效果 = {效果类型id, 效果参数1, 效果参数2, ...}
|
||||
|
|
@ -93,12 +103,6 @@ function Skill:Cast()
|
|||
if count == 0 then
|
||||
count = #arr
|
||||
end
|
||||
if self.owner.camp == 0 and nn == 2 then --我方释放效果开始切镜头
|
||||
BattleLogic.Event:DispatchEvent(BattleEventName.ZoomIn, 0.3)
|
||||
BattleLogic.WaitForTrigger(duration, function()
|
||||
BattleLogic.Event:DispatchEvent(BattleEventName.ZoomOut, 0.3)
|
||||
end)
|
||||
end
|
||||
if chooseId == 10000 or chooseId == 20000 then --10000 我方aoe 20000 敌方aoe
|
||||
local camp = chooseId == 10000 and self.owner.camp or 1 - self.owner.camp
|
||||
self.owner.Event:DispatchEvent(BattleEventName.AOE, camp)
|
||||
|
|
@ -139,7 +143,6 @@ function Skill:Cast()
|
|||
end
|
||||
end
|
||||
|
||||
BattleLogic.SetAggro(self.owner)
|
||||
if not self.isTeamSkill then
|
||||
local time = max(8-self.owner:GetRoleData(RoleDataName.Speed)/(8*(self.owner:GetRoleData(RoleDataName.Level)+10)), 1.5)
|
||||
time = BattleUtil.ErrorCorrection(time)
|
||||
|
|
|
|||
|
|
@ -12,9 +12,6 @@ local curFrame
|
|||
local playerMP
|
||||
local enemyMP
|
||||
|
||||
local playerAggro
|
||||
local enemyAggro
|
||||
|
||||
local playerSkillUsable
|
||||
local enemySkillUsable
|
||||
|
||||
|
|
@ -48,6 +45,15 @@ BattleLogic.TotalOrder = 0
|
|||
--当前波次
|
||||
BattleLogic.CurOrder = 0
|
||||
|
||||
local stage --战场分割阶段
|
||||
local stageFrame1 = 25 * BattleLogic.GameFrameRate --前期转中期的时间点
|
||||
local stageFrame2 = 40 * BattleLogic.GameFrameRate --中期转后期的时间点
|
||||
|
||||
local teamSkillCastTime = {15 * BattleLogic.GameFrameRate,
|
||||
35 * BattleLogic.GameFrameRate,
|
||||
55 * BattleLogic.GameFrameRate}
|
||||
local teamSkillCastIndex
|
||||
|
||||
local maxFrame --战斗最大用时,超时判负
|
||||
|
||||
local actionPool = BattleObjectPool.New(function ()
|
||||
|
|
@ -87,13 +93,11 @@ function BattleLogic.Init(maxTime, data, optionData)
|
|||
|
||||
playerMP = 0
|
||||
enemyMP = 0
|
||||
stage = 0
|
||||
|
||||
playerTeamDummyRole.isDebug = false
|
||||
enemyTeamDummyRole.isDebug = false
|
||||
|
||||
playerTeamSkillIndex = 1
|
||||
enemyTeamSkillIndex = 1
|
||||
|
||||
playerSkillUsable = true
|
||||
enemySkillUsable = true
|
||||
|
||||
|
|
@ -107,13 +111,20 @@ end
|
|||
|
||||
function BattleLogic.StartOrder()
|
||||
BattleLogic.CurOrder = BattleLogic.CurOrder + 1
|
||||
stage = 1
|
||||
teamSkillCastIndex = 1
|
||||
playerTeamSkillIndex = 1
|
||||
enemyTeamSkillIndex = 1
|
||||
|
||||
curFrame = 0
|
||||
BattleLogic.Event:DispatchEvent(BattleEventName.BattleStageChange, stage)
|
||||
|
||||
if BattleLogic.CurOrder == 1 then
|
||||
for i=1, #fightData.playerData do
|
||||
BattleLogic.AddRole(fightData.playerData[i])
|
||||
|
||||
BattleLogic.AddRole(fightData.playerData[i], i)
|
||||
end
|
||||
for i=1, #fightData.enemyData[BattleLogic.CurOrder] do
|
||||
BattleLogic.AddRole(fightData.enemyData[BattleLogic.CurOrder][i])
|
||||
BattleLogic.AddRole(fightData.enemyData[BattleLogic.CurOrder][i], i)
|
||||
end
|
||||
|
||||
for i=1, #playerTeamSkillList do
|
||||
|
|
@ -122,7 +133,7 @@ function BattleLogic.StartOrder()
|
|||
end
|
||||
for i=1, #fightData.playerData.teamSkill do
|
||||
playerTeamSkillList[i] = skillPool:Get()
|
||||
playerTeamSkillList[i]:Init(playerTeamDummyRole, fightData.playerData.teamSkill[i], true)
|
||||
playerTeamSkillList[i]:Init(playerTeamDummyRole, fightData.playerData.teamSkill[i], 0)
|
||||
end
|
||||
for i=1, #fightData.playerData.teamPassive do
|
||||
for j=1, #fightData.playerData.teamPassive[i] do
|
||||
|
|
@ -142,7 +153,7 @@ function BattleLogic.StartOrder()
|
|||
end
|
||||
for i=1, #fightData.enemyData[BattleLogic.CurOrder].teamSkill do
|
||||
enemyTeamSkillList[i] = skillPool:Get()
|
||||
enemyTeamSkillList[i]:Init(enemyTeamDummyRole, fightData.enemyData[BattleLogic.CurOrder].teamSkill[i], true)
|
||||
enemyTeamSkillList[i]:Init(enemyTeamDummyRole, fightData.enemyData[BattleLogic.CurOrder].teamSkill[i], 0)
|
||||
end
|
||||
for i=1, #fightData.enemyData[BattleLogic.CurOrder].teamPassive do
|
||||
for j=1, #fightData.enemyData[BattleLogic.CurOrder].teamPassive[i] do
|
||||
|
|
@ -158,7 +169,7 @@ function BattleLogic.StartOrder()
|
|||
else
|
||||
BattleLogic.ClearOrder()
|
||||
for i=1, #fightData.enemyData[BattleLogic.CurOrder] do
|
||||
BattleLogic.AddRole(fightData.enemyData[BattleLogic.CurOrder][i])
|
||||
BattleLogic.AddRole(fightData.enemyData[BattleLogic.CurOrder][i], i)
|
||||
end
|
||||
|
||||
for i=1, #enemyTeamSkillList do
|
||||
|
|
@ -167,7 +178,7 @@ function BattleLogic.StartOrder()
|
|||
end
|
||||
for i=1, #fightData.enemyData[BattleLogic.CurOrder].teamSkill do
|
||||
enemyTeamSkillList[i] = skillPool:Get()
|
||||
enemyTeamSkillList[i]:Init(enemyTeamDummyRole, fightData.enemyData[BattleLogic.CurOrder].teamSkill[i], true)
|
||||
enemyTeamSkillList[i]:Init(enemyTeamDummyRole, fightData.enemyData[BattleLogic.CurOrder].teamSkill[i], 0)
|
||||
end
|
||||
for i=1, #fightData.enemyData[BattleLogic.CurOrder].teamPassive do
|
||||
for j=1, #fightData.enemyData[BattleLogic.CurOrder].teamPassive[i] do
|
||||
|
|
@ -181,19 +192,18 @@ function BattleLogic.StartOrder()
|
|||
end
|
||||
end
|
||||
end
|
||||
BattleLogic.InitAggro()
|
||||
end
|
||||
|
||||
function BattleLogic.AddMP(camp, mp)
|
||||
if camp == 0 then
|
||||
if #playerTeamSkillList > 0 then
|
||||
playerMP = min(playerMP + mp, 100)
|
||||
end
|
||||
else
|
||||
if #enemyTeamSkillList > 0 then
|
||||
enemyMP = min(enemyMP + mp, 100)
|
||||
end
|
||||
end
|
||||
--if camp == 0 then
|
||||
-- if #playerTeamSkillList > 0 then
|
||||
-- playerMP = min(playerMP + mp, 100)
|
||||
-- end
|
||||
--else
|
||||
-- if #enemyTeamSkillList > 0 then
|
||||
-- enemyMP = min(enemyMP + mp, 100)
|
||||
-- end
|
||||
--end
|
||||
end
|
||||
|
||||
function BattleLogic.GetMP(camp)
|
||||
|
|
@ -202,15 +212,14 @@ end
|
|||
|
||||
function BattleLogic.CanManualTeamSkill()
|
||||
local teamSkill = playerTeamSkillList[playerTeamSkillIndex]
|
||||
return not isAuto and playerMP == 100 and teamSkill and teamSkill.sp >= teamSkill.spPass
|
||||
return not isAuto and teamSkill
|
||||
end
|
||||
|
||||
function BattleLogic.GetTeamSkillCDPass()
|
||||
local teamSkill = playerTeamSkillList[playerTeamSkillIndex]
|
||||
if not teamSkill then
|
||||
return 1
|
||||
function BattleLogic.GetTeamSkillCastTime()
|
||||
if teamSkillCastIndex > #playerTeamSkillList then
|
||||
return -1
|
||||
end
|
||||
return teamSkill.sp / teamSkill.spPass
|
||||
return teamSkillCastTime[teamSkillCastIndex] - curFrame
|
||||
end
|
||||
|
||||
function BattleLogic.GenerateBuffId()
|
||||
|
|
@ -218,70 +227,16 @@ function BattleLogic.GenerateBuffId()
|
|||
return curBuffId
|
||||
end
|
||||
|
||||
function BattleLogic.AddRole(roleData)
|
||||
function BattleLogic.AddRole(roleData, position)
|
||||
curUid = curUid + 1
|
||||
local role = rolePool:Get()
|
||||
role:Init(curUid, roleData)
|
||||
role:Init(curUid, roleData, position)
|
||||
objList:Add(curUid, role)
|
||||
if not role.isDead then
|
||||
BattleLogic.Event:DispatchEvent(BattleEventName.AddRole, role)
|
||||
end
|
||||
end
|
||||
|
||||
function BattleLogic.InitAggro()
|
||||
for i=1, objList.size do
|
||||
if objList.vList[i].camp == 1 then
|
||||
playerAggro = objList.vList[i]
|
||||
break
|
||||
end
|
||||
end
|
||||
for i=1, objList.size do
|
||||
if objList.vList[i].camp == 0 then
|
||||
enemyAggro = objList.vList[i]
|
||||
break
|
||||
end
|
||||
end
|
||||
BattleLogic.Event:DispatchEvent(BattleEventName.ZoomChange, playerAggro, 1)
|
||||
end
|
||||
|
||||
function BattleLogic.SetAggro(role)
|
||||
if role.isTeam then
|
||||
return
|
||||
end
|
||||
if role.camp == 1 then
|
||||
playerAggro = role
|
||||
BattleLogic.Event:DispatchEvent(BattleEventName.ZoomChange, role, 1)
|
||||
else
|
||||
enemyAggro = role
|
||||
end
|
||||
end
|
||||
|
||||
function BattleLogic.GetAggro(camp)
|
||||
if camp == 0 then
|
||||
if not playerAggro or playerAggro.isDead then
|
||||
for i=1, objList.size do
|
||||
if objList.vList[i].camp == 1 and not objList.vList[i].isDead then
|
||||
playerAggro = objList.vList[i]
|
||||
BattleLogic.SetAggro(playerAggro)
|
||||
break
|
||||
end
|
||||
end
|
||||
end
|
||||
return playerAggro
|
||||
else
|
||||
if not enemyAggro or enemyAggro.isDead then
|
||||
for i=1, objList.size do
|
||||
if objList.vList[i].camp == 0 and not objList.vList[i].isDead then
|
||||
enemyAggro = objList.vList[i]
|
||||
BattleLogic.SetAggro(enemyAggro)
|
||||
break
|
||||
end
|
||||
end
|
||||
end
|
||||
return enemyAggro
|
||||
end
|
||||
end
|
||||
|
||||
function BattleLogic.SetSkillUsable(camp, value)
|
||||
if camp == 0 then
|
||||
playerSkillUsable = value
|
||||
|
|
@ -368,6 +323,20 @@ function BattleLogic.CurFrame()
|
|||
return curFrame
|
||||
end
|
||||
|
||||
function BattleLogic.CurStage()
|
||||
return stage
|
||||
end
|
||||
|
||||
function BattleLogic.CurStageTime()
|
||||
local time = 0
|
||||
if stage == 1 then
|
||||
time = stageFrame1 - curFrame
|
||||
elseif stage == 2 then
|
||||
time = stageFrame2 - curFrame
|
||||
end
|
||||
return time
|
||||
end
|
||||
|
||||
function BattleLogic.Query(func, inCludeDeadRole)
|
||||
local list = {}
|
||||
local index = 1
|
||||
|
|
@ -421,6 +390,32 @@ end
|
|||
|
||||
function BattleLogic.Update()
|
||||
curFrame = curFrame + 1
|
||||
if curFrame > stageFrame1 and stage == 1 then
|
||||
stage = 2
|
||||
BattleLogic.Event:DispatchEvent(BattleEventName.BattleStageChange, stage)
|
||||
end
|
||||
if curFrame > stageFrame2 and stage == 2 then
|
||||
stage = 3
|
||||
BattleLogic.Event:DispatchEvent(BattleEventName.BattleStageChange, stage)
|
||||
end
|
||||
|
||||
if curFrame > teamSkillCastTime[teamSkillCastIndex] then
|
||||
if playerTeamSkillIndex == teamSkillCastIndex and playerSkillUsable then
|
||||
if playerTeamSkillList[teamSkillCastIndex] then
|
||||
playerTeamSkillList[teamSkillCastIndex]:Cast()
|
||||
playerTeamSkillIndex = playerTeamSkillIndex + 1
|
||||
end
|
||||
|
||||
end
|
||||
if enemyTeamSkillIndex == teamSkillCastIndex and enemySkillUsable then
|
||||
if enemyTeamSkillList[teamSkillCastIndex] then
|
||||
enemyTeamSkillList[teamSkillCastIndex]:Cast()
|
||||
enemyTeamSkillIndex = enemyTeamSkillIndex + 1
|
||||
end
|
||||
end
|
||||
teamSkillCastIndex = min(teamSkillCastIndex + 1, #teamSkillCastTime)
|
||||
end
|
||||
|
||||
if curFrame > maxFrame then
|
||||
BattleLogic.BattleEnd(0)
|
||||
return
|
||||
|
|
@ -448,27 +443,27 @@ function BattleLogic.Update()
|
|||
end
|
||||
end
|
||||
|
||||
for i=1, #playerTeamSkillList do
|
||||
playerTeamSkillList[i].sp = min(playerTeamSkillList[i].sp + 1, playerTeamSkillList[i].spPass)
|
||||
end
|
||||
|
||||
for i=1, #enemyTeamSkillList do
|
||||
enemyTeamSkillList[i].sp = min(enemyTeamSkillList[i].sp + 1, enemyTeamSkillList[i].spPass)
|
||||
end
|
||||
|
||||
if playerMP == 100 and playerSkillUsable and isAuto then
|
||||
local teamSkill = playerTeamSkillList[playerTeamSkillIndex]
|
||||
if teamSkill.sp >= teamSkill.spPass then
|
||||
BattleLogic.CastTeamSkill(0)
|
||||
end
|
||||
end
|
||||
|
||||
if enemyMP == 100 and enemySkillUsable then
|
||||
local teamSkill = enemyTeamSkillList[enemyTeamSkillIndex]
|
||||
if teamSkill.sp >= teamSkill.spPass then
|
||||
BattleLogic.CastTeamSkill(1)
|
||||
end
|
||||
end
|
||||
--for i=1, #playerTeamSkillList do
|
||||
-- playerTeamSkillList[i].sp = min(playerTeamSkillList[i].sp + 1, playerTeamSkillList[i].spPass)
|
||||
--end
|
||||
--
|
||||
--for i=1, #enemyTeamSkillList do
|
||||
-- enemyTeamSkillList[i].sp = min(enemyTeamSkillList[i].sp + 1, enemyTeamSkillList[i].spPass)
|
||||
--end
|
||||
--
|
||||
--if playerMP == 100 and playerSkillUsable and isAuto then
|
||||
-- local teamSkill = playerTeamSkillList[playerTeamSkillIndex]
|
||||
-- if teamSkill.sp >= teamSkill.spPass then
|
||||
-- BattleLogic.CastTeamSkill(0)
|
||||
-- end
|
||||
--end
|
||||
--
|
||||
--if enemyMP == 100 and enemySkillUsable then
|
||||
-- local teamSkill = enemyTeamSkillList[enemyTeamSkillIndex]
|
||||
-- if teamSkill.sp >= teamSkill.spPass then
|
||||
-- BattleLogic.CastTeamSkill(1)
|
||||
-- end
|
||||
--end
|
||||
|
||||
BattleLogic.BuffMgr:Update()
|
||||
|
||||
|
|
@ -498,6 +493,34 @@ function BattleLogic.Update()
|
|||
end
|
||||
end
|
||||
|
||||
local posDic = {3,2,4,1,5}
|
||||
--对位规则: 1敌方相同对位 2若死亡或不存在,选取相邻阵位最近且阵位索引最小的
|
||||
function BattleLogic.GetAggro(camp, position)
|
||||
local minNeighbor = 100
|
||||
local index = 100
|
||||
local target
|
||||
local enemyCamp = camp == 0 and 1 or 0
|
||||
for i=1, objList.size do
|
||||
if objList.vList[i].camp == enemyCamp and not objList.vList[i].isDead then
|
||||
if position == objList.vList[i].position then
|
||||
return objList.vList[i]
|
||||
else
|
||||
local neighbor = math.abs(posDic[position] - posDic[objList.vList[i].position])
|
||||
if neighbor < minNeighbor then
|
||||
minNeighbor = neighbor
|
||||
index = objList.vList[i].position
|
||||
target = objList.vList[i]
|
||||
elseif neighbor == minNeighbor and objList.vList[i].position < index then
|
||||
minNeighbor = neighbor
|
||||
index = objList.vList[i].position
|
||||
target = objList.vList[i]
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
return target
|
||||
end
|
||||
|
||||
function BattleLogic.ResetTeamSkillCD(camp)
|
||||
local skill = camp == 0 and playerTeamDummyRole.curSkill or enemyTeamDummyRole.curSkill
|
||||
if skill then
|
||||
|
|
|
|||
|
|
@ -6,6 +6,7 @@ end
|
|||
|
||||
BattleEventName = {
|
||||
BattleOrderChange = indexAdd(),
|
||||
BattleStageChange = indexAdd(),
|
||||
BattleEnd = indexAdd(),
|
||||
AddRole = indexAdd(),
|
||||
RemoveRole = indexAdd(),
|
||||
|
|
@ -42,10 +43,6 @@ BattleEventName = {
|
|||
PassiveDamaging = indexAdd(),
|
||||
PassiveCriting = indexAdd(),
|
||||
|
||||
ZoomIn = indexAdd(),
|
||||
ZoomChange = indexAdd(),
|
||||
ZoomOut = indexAdd(),
|
||||
|
||||
AOE = indexAdd(),
|
||||
|
||||
RoleViewBullet = indexAdd(), --弹道飞行击中表现
|
||||
|
|
|
|||
|
|
@ -62,7 +62,7 @@ function BattleUtil.ChooseTarget(role, chooseId)
|
|||
BattleUtil.RandomList(arr)
|
||||
return {arr[1]}
|
||||
end
|
||||
return {BattleLogic.GetAggro(role.camp)}
|
||||
return {BattleLogic.GetAggro(role.camp, role.position)}
|
||||
else
|
||||
arr = BattleLogic.Query()
|
||||
end
|
||||
|
|
@ -185,11 +185,6 @@ function BattleUtil.ApplyDamage(atkRole, defRole, damage, bCrit, damageType, isD
|
|||
BattleLogic.BuffMgr:ClearBuff(defRole)
|
||||
defRole.Event:DispatchEvent(BattleEventName.RoleDead)
|
||||
BattleLogic.Event:DispatchEvent(BattleEventName.BattleRoleDead, defRole)
|
||||
if defRole.camp == 1 then
|
||||
BattleLogic.WaitForTrigger(1, function ()
|
||||
BattleLogic.Event:DispatchEvent(BattleEventName.ZoomChange, BattleLogic.GetAggro(0), 1)
|
||||
end)
|
||||
end
|
||||
end
|
||||
|
||||
atkRole.Event:DispatchEvent(BattleEventName.RoleDamage, defRole, damage, bCrit, finalDmg, damageType, isDot)
|
||||
|
|
|
|||
|
|
@ -10,7 +10,14 @@ local min = math.min
|
|||
|
||||
local aiList = {
|
||||
[0] = function(skill, superSkill) --默认75%释放点击技、25%释放上滑技
|
||||
return Random.Range01() <= 0.75
|
||||
local stage = BattleLogic.CurStage()
|
||||
if stage == 1 then
|
||||
return true
|
||||
elseif stage == 2 then
|
||||
return Random.Range01() > superSkill.randomInStage2
|
||||
elseif stage == 3 then
|
||||
return false
|
||||
end
|
||||
end,
|
||||
[1] = function(skill, superSkill) --只放点技
|
||||
return true
|
||||
|
|
@ -34,7 +41,7 @@ local skillPool = BattleObjectPool.New(function ()
|
|||
end)
|
||||
|
||||
function RoleLogic.New()
|
||||
local instance = {uid=0,roleData=0,data=RoleData.New(),camp=0,name=0,roleType=0,aiIndex = 1,
|
||||
local instance = {uid=0,roleData=0,data=RoleData.New(),camp=0,name=0,roleType=0,aiIndex=1,position=0,
|
||||
shield=BattleList.New(),
|
||||
exCalDmgList=BattleList.New(),
|
||||
proTranList=BattleList.New(),
|
||||
|
|
@ -44,8 +51,9 @@ function RoleLogic.New()
|
|||
return instance
|
||||
end
|
||||
|
||||
function RoleLogic:Init(uid, data)
|
||||
function RoleLogic:Init(uid, data, position)
|
||||
self.uid = uid
|
||||
self.position = position
|
||||
self.roleData = data
|
||||
|
||||
self.data:Init(self, data.property)
|
||||
|
|
@ -65,14 +73,14 @@ function RoleLogic:Init(uid, data)
|
|||
self.passiveList = {}
|
||||
if data.skill and #data.skill > 0 then
|
||||
self.skill = skillPool:Get()
|
||||
self.skill:Init(self, data.skill, false)
|
||||
self.skill:Init(self, data.skill, 1)
|
||||
self.skill.sp = 0
|
||||
local time = max(8-self:GetRoleData(RoleDataName.Speed)/(8*(self:GetRoleData(RoleDataName.Level)+10)), 1.5)
|
||||
self.skill.spPass = floor( BattleUtil.ErrorCorrection(time) * BattleLogic.GameFrameRate)
|
||||
end
|
||||
if data.superSkill and #data.superSkill > 0 then
|
||||
self.superSkill = skillPool:Get()
|
||||
self.superSkill:Init(self, data.superSkill, false)
|
||||
self.superSkill:Init(self, data.superSkill, 2)
|
||||
self.superSkill.spPass = floor(self.superSkill.cd * BattleLogic.GameFrameRate)
|
||||
self.superSkill.sp = self.superSkill.spPass
|
||||
end
|
||||
|
|
|
|||
|
|
@ -43,10 +43,10 @@ public class SSpecialConfig implements BaseConfig {
|
|||
public static final String lamp_lottery_equiptalisman_content_parm = "lamp_lottery_equiptalisman_content_parm";//5及以上——系统消息
|
||||
public static final String lamp_rankup_equipsign_content_parm = "lamp_rankup_equipsign_content_parm";//5级及以上——系统消息
|
||||
public static final String lamp_rankup_equiptalisman_content_parm = "lamp_rankup_equiptalisman_content_parm";//8星及以上——系统消息
|
||||
|
||||
|
||||
|
||||
|
||||
public static final String SUNLONG_DAILYTASKS = "Sunlong_DailyTasks";//孙龙的宝藏每日、每周、每月任务个数
|
||||
public static final String SUNLONG_COST = "Sunlong_Cost";//孙龙的宝藏购买等级
|
||||
public static final String SUNLONG_INTEGRAL ="Sunlong_Integral";//孙龙的宝藏每日积分礼包
|
||||
public static final String SUNLONG_REWARD = "Sunlong_Reward";//孙龙的宝藏礼包
|
||||
@Override
|
||||
public void init() throws Exception {
|
||||
|
||||
|
|
@ -72,6 +72,29 @@ public class SSpecialConfig implements BaseConfig {
|
|||
}
|
||||
return Integer.valueOf(value);
|
||||
}
|
||||
public static int[] getOnceArrayValue(String key){
|
||||
String value = enumers.get(key);
|
||||
String[] array = value.split("\\#");
|
||||
int[] arrayNum = new int[array.length];
|
||||
for (int i = 0 ; i < array.length;i++) {
|
||||
arrayNum[i] = Integer.parseInt(array[i]);
|
||||
}
|
||||
return arrayNum;
|
||||
}
|
||||
public static int[][] getTwiceArrayValue(String key){
|
||||
String value = enumers.get(key);
|
||||
String[] array = value.split("\\|");
|
||||
int[][] arrayNum = new int[array.length][];
|
||||
for (int i = 0 ; i < array.length;i++) {
|
||||
String[] temp = array[i].split("\\#");
|
||||
int[] tempNum = new int[temp.length];
|
||||
for (int j = 0 ; j < tempNum.length;j++) {
|
||||
tempNum[j] = Integer.parseInt(temp[j]);
|
||||
}
|
||||
arrayNum[i] = tempNum;
|
||||
}
|
||||
return arrayNum;
|
||||
}
|
||||
|
||||
public static int[] getIntegerArrayValue(String key) {
|
||||
String value = enumers.get(key);
|
||||
|
|
@ -91,5 +114,4 @@ public class SSpecialConfig implements BaseConfig {
|
|||
return value;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,73 @@
|
|||
package com.ljsd.jieling.config;
|
||||
|
||||
import com.ljsd.jieling.logic.STableManager;
|
||||
import com.ljsd.jieling.logic.Table;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
@Table(name ="TreasureSunlongConfig")
|
||||
public class STreasureSunlongConfig implements BaseConfig {
|
||||
|
||||
private int id;
|
||||
|
||||
private int activityId;
|
||||
|
||||
private int type;
|
||||
|
||||
private int level;
|
||||
|
||||
private int[][] integral;
|
||||
|
||||
private int[][] reward;
|
||||
|
||||
private int[][] treasureReward;
|
||||
|
||||
public static Map<Integer,STreasureSunlongConfig> treasureSunlongConfigMap;
|
||||
|
||||
public static Map<Integer,STreasureSunlongConfig> levelTreasureConfigMap;
|
||||
@Override
|
||||
public void init() throws Exception {
|
||||
treasureSunlongConfigMap=STableManager.getConfig(STreasureSunlongConfig.class);
|
||||
levelTreasureConfigMap= new HashMap<>(treasureSunlongConfigMap.size());
|
||||
for(Map.Entry<Integer,STreasureSunlongConfig> entry:treasureSunlongConfigMap.entrySet()){
|
||||
STreasureSunlongConfig config = entry.getValue();
|
||||
if(config.getActivityId()!=40){
|
||||
continue;
|
||||
}
|
||||
levelTreasureConfigMap.put(config.getLevel(), config);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
public int getId() {
|
||||
return id;
|
||||
}
|
||||
|
||||
public int getActivityId() {
|
||||
return activityId;
|
||||
}
|
||||
|
||||
public int getType() {
|
||||
return type;
|
||||
}
|
||||
|
||||
public int getLevel() {
|
||||
return level;
|
||||
}
|
||||
|
||||
public int[][] getIntegral() {
|
||||
return integral;
|
||||
}
|
||||
|
||||
public int[][] getReward() {
|
||||
return reward;
|
||||
}
|
||||
|
||||
public int[][] getTreasureReward() {
|
||||
return treasureReward;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,81 @@
|
|||
package com.ljsd.jieling.config;
|
||||
|
||||
import com.ljsd.jieling.logic.STableManager;
|
||||
import com.ljsd.jieling.logic.Table;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
@Table(name ="TreasureSunlongTaskConfig")
|
||||
public class STreasureSunlongTaskConfig implements BaseConfig {
|
||||
|
||||
private int id;
|
||||
|
||||
private int activityId;
|
||||
|
||||
private int type;
|
||||
|
||||
private int taskType;
|
||||
|
||||
private int[][] taskValue;
|
||||
|
||||
private int[][] integral;
|
||||
|
||||
private int weight;
|
||||
|
||||
public static Map<Integer,STreasureSunlongTaskConfig> treasureTaskConfig;
|
||||
|
||||
public static Map<Integer, List<Integer>> taskTypeMap;
|
||||
|
||||
public static Map<Integer,List<STreasureSunlongTaskConfig>> sTreasureTaskConfigListByTypeMapTmp;
|
||||
@Override
|
||||
public void init() throws Exception {
|
||||
treasureTaskConfig = STableManager.getConfig(STreasureSunlongTaskConfig.class);
|
||||
taskTypeMap = new HashMap<>();
|
||||
sTreasureTaskConfigListByTypeMapTmp = new HashMap<>();
|
||||
for(Map.Entry<Integer,STreasureSunlongTaskConfig> entry:treasureTaskConfig.entrySet()){
|
||||
STreasureSunlongTaskConfig entryValue = entry.getValue();
|
||||
if(!taskTypeMap.containsKey(entryValue.getType())){
|
||||
taskTypeMap.put(entryValue.getType(),new ArrayList<>());
|
||||
}
|
||||
if(!sTreasureTaskConfigListByTypeMapTmp.containsKey(entryValue.getTaskType())){
|
||||
sTreasureTaskConfigListByTypeMapTmp.put(entryValue.getTaskType(),new ArrayList<>());
|
||||
}
|
||||
sTreasureTaskConfigListByTypeMapTmp.get(entryValue.getTaskType()).add(entryValue);
|
||||
taskTypeMap.get(entryValue.getType()).add(entry.getKey());
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public int getId() {
|
||||
return id;
|
||||
}
|
||||
|
||||
public int getActivityId() {
|
||||
return activityId;
|
||||
}
|
||||
|
||||
public int getType() {
|
||||
return type;
|
||||
}
|
||||
|
||||
public int getTaskType() {
|
||||
return taskType;
|
||||
}
|
||||
|
||||
public int[][] getTaskValue() {
|
||||
return taskValue;
|
||||
}
|
||||
|
||||
public int[][] getIntegral() {
|
||||
return integral;
|
||||
}
|
||||
|
||||
public int getWeight() {
|
||||
return weight;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
|
@ -45,11 +45,8 @@ public class STreasureTaskConfig implements BaseConfig {
|
|||
if(!treasureTaskConfigByActivityMap.containsKey(activityId)){
|
||||
treasureTaskConfigByActivityMap.put(activityId,new ArrayList<>());
|
||||
}
|
||||
if(!sTreasureTaskConfigListByTypeMapTmp.containsKey(sTreasureTaskConfig.getTaskType())){
|
||||
sTreasureTaskConfigListByTypeMapTmp.put(sTreasureTaskConfig.getTaskType(),new ArrayList<>());
|
||||
}
|
||||
|
||||
treasureTaskConfigByActivityMap.get(activityId).add(sTreasureTaskConfig);
|
||||
sTreasureTaskConfigListByTypeMapTmp.get(sTreasureTaskConfig.getTaskType()).add(sTreasureTaskConfig);
|
||||
if(sTreasureTaskConfig.getTaskType() == MissionType.SENVER_HAPPY.getMissionTypeValue()){
|
||||
sTreasureSevenTaskConfigByActivityMapTmp.put(sTreasureTaskConfig.getActivityId(),sTreasureTaskConfig);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -83,6 +83,7 @@ public interface BIReason {
|
|||
int RANDOM_SOULEQUIP = 51;//占星
|
||||
|
||||
int DIRECT_BUY = 52; // 直购
|
||||
int TREASURE_SCORE = 53;//孙龙宝藏获得积分
|
||||
|
||||
int MAIN_LEVEL_STATE_REWARD = 53; // 关卡挂机奖励
|
||||
|
||||
|
|
@ -158,6 +159,7 @@ public interface BIReason {
|
|||
|
||||
int FAMILY_SET_ICON = 1037;//工会修改图腾
|
||||
|
||||
|
||||
int EXCHANGE_ACTIVITY_CLOSE = 1038;//限时兑换删除道具
|
||||
int LUCK_WHEEL = 1039; //幸运转盘消耗
|
||||
int LUCK_WHEEL_ADVANCE = 1040; //高级幸运转盘消耗
|
||||
|
|
@ -165,4 +167,9 @@ public interface BIReason {
|
|||
int HERO_BACK_CONSUME = 1041; // 英雄回溯消耗
|
||||
|
||||
|
||||
int TREASURE_LEVEL_UP_CONCUME = 1042;//孙龙宝藏等级提升消耗
|
||||
|
||||
int TREASURE_BUY_LEVEL_CONSUME = 1043;//孙龙宝藏等级快速购买
|
||||
|
||||
|
||||
}
|
||||
|
|
@ -336,7 +336,7 @@ public class GMRequestHandler extends BaseHandler{
|
|||
}
|
||||
public void treasureScore(ISession session,int score) throws Exception {
|
||||
User user = UserManager.getUser(session.getUid());
|
||||
user.getPlayerInfoManager().setTreasureScore(score);
|
||||
user.getPlayerInfoManager().setTreasureLevel(score);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -150,7 +150,7 @@ public class GetPlayerInfoHandler extends BaseHandler{
|
|||
.addAllTowerReceivedReward(towerFloorReceivedReward)
|
||||
.addAllGoodsTypeDuration(goodsTypeDurations)
|
||||
.setHadBuyTreasure(playerInfoManager.getHadBuyTreasure())
|
||||
// .setTreasureScore(playerInfoManager.getTreasureScore())
|
||||
.setTreasureLevel(playerInfoManager.getTreasureLevel())
|
||||
.setSignInInfo(CommonProto.SignInInfo.newBuilder().setDays(playerInfoManager.getSign()+1).setState(playerInfoManager.getSignTotay()).build())
|
||||
.setMonsterAttackTime(user.getMapManager().getLastMonsterAttack())
|
||||
.setFirstTenth(user.getHeroManager().getFirstTenth())
|
||||
|
|
|
|||
|
|
@ -1,13 +1,26 @@
|
|||
package com.ljsd.jieling.handler;
|
||||
|
||||
import com.ljsd.jieling.config.SErrorCodeEerverConfig;
|
||||
import com.ljsd.jieling.config.SGlobalActivity;
|
||||
import com.ljsd.jieling.config.SSpecialConfig;
|
||||
import com.ljsd.jieling.globals.Global;
|
||||
import com.ljsd.jieling.logic.activity.ActivityLogic;
|
||||
import com.ljsd.jieling.logic.activity.ActivityType;
|
||||
import com.ljsd.jieling.logic.dao.ActivityManager;
|
||||
import com.ljsd.jieling.logic.dao.ActivityMission;
|
||||
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.player.PlayerLogic;
|
||||
import com.ljsd.jieling.netty.cocdex.PacketNetData;
|
||||
import com.ljsd.jieling.network.session.ISession;
|
||||
import com.ljsd.jieling.protocols.CommonProto;
|
||||
import com.ljsd.jieling.protocols.MessageTypeProto;
|
||||
import com.ljsd.jieling.util.TimeUtils;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import java.util.Map;
|
||||
|
||||
@Component
|
||||
public class ServerZeroHandler extends BaseHandler {
|
||||
@Override
|
||||
|
|
@ -17,6 +30,18 @@ public class ServerZeroHandler extends BaseHandler {
|
|||
|
||||
@Override
|
||||
public void process(ISession iSession, PacketNetData netData) throws Exception {
|
||||
PlayerLogic.getInstance().sendDayilyMail(UserManager.getUser(iSession.getUid()),-1);
|
||||
User user = UserManager.getUser(iSession.getUid());
|
||||
PlayerLogic.getInstance().sendDayilyMail(user,-1);
|
||||
//发送每日孙龙邮件
|
||||
if(user.getPlayerInfoManager().getHadBuyTreasure()!=0){
|
||||
Map<Integer, ActivityMission> activityMissionMap = user.getActivityManager().getActivityMissionMap();
|
||||
for(Map.Entry<Integer, ActivityMission> entry:activityMissionMap.entrySet()){
|
||||
if(SGlobalActivity.getsGlobalActivityMap().get(entry).getType()== ActivityType.TREASURE){
|
||||
MailLogic.getInstance().sendMail(iSession.getUid(), SErrorCodeEerverConfig.getI18NMessage("secret_daily_title"),SErrorCodeEerverConfig.getI18NMessage("secret_daily_txt"), SSpecialConfig.getStringValue(SSpecialConfig.SUNLONG_INTEGRAL),(int)(TimeUtils.now()/1000), Global.MAIL_EFFECTIVE_TIME);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -0,0 +1,23 @@
|
|||
package com.ljsd.jieling.handler.activity;
|
||||
|
||||
import com.ljsd.jieling.handler.BaseHandler;
|
||||
import com.ljsd.jieling.logic.activity.ActivityLogic;
|
||||
import com.ljsd.jieling.network.session.ISession;
|
||||
import com.ljsd.jieling.protocols.MessageTypeProto;
|
||||
import com.ljsd.jieling.protocols.PlayerInfoProto;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
@Component
|
||||
public class TreasureQuickBuyLevel extends BaseHandler<PlayerInfoProto.QuickBuyTreasureLevelRequest> {
|
||||
@Override
|
||||
public MessageTypeProto.MessageType getMessageCode() {
|
||||
return MessageTypeProto.MessageType.BUY_TREASURE_LEVEL_REQUEST;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void processWithProto(ISession iSession, PlayerInfoProto.QuickBuyTreasureLevelRequest proto) throws Exception {
|
||||
int level = proto.getLevel();
|
||||
ActivityLogic.getInstance().treasureBuyLevel(iSession,level,MessageTypeProto.MessageType.BUY_TREASURE_LEVEL_RESPONSE);
|
||||
|
||||
}
|
||||
}
|
||||
|
|
@ -52,6 +52,7 @@ public class UpSoulEquipQuiickHandler extends BaseHandler<HeroInfoProto.UpQuickS
|
|||
int nextNeedExp = SEquipSign.getEquipExpMap().get(sEcfg.getId());
|
||||
int sumExp = soulEquip.getExp();
|
||||
int leve = soulEquip.getLevel();
|
||||
int oldLevel = leve;
|
||||
boolean full = false;
|
||||
for (String equipId : upQuickSoulEquipRequest.getSoulEquipIdsList()) {
|
||||
if (full) {
|
||||
|
|
@ -96,7 +97,7 @@ public class UpSoulEquipQuiickHandler extends BaseHandler<HeroInfoProto.UpQuickS
|
|||
builder.addAllSoulEquipIds(consumIds);
|
||||
builder.setEquipId(upQuickSoulEquipRequest.getEquipId());
|
||||
MessageUtil.sendMessage(iSession, 1, MessageTypeProto.MessageType.UP_SOUL_EQUIP_RESPONSE_VALUE, builder.build(), true);
|
||||
if(soulEquip.getLevel()>= SSpecialConfig.getIntegerValue(SSpecialConfig.lamp_rankup_equipsign_content_parm)){
|
||||
if(oldLevel!=leve && soulEquip.getLevel()>= SSpecialConfig.getIntegerValue(SSpecialConfig.lamp_rankup_equipsign_content_parm)){
|
||||
SItem sItem = SItem.getsItemMap().get(soulEquip.getEquipId());
|
||||
String message = SErrorCodeEerverConfig.getI18NMessage("lamp_rankup_equipsign_content", new Object[]{user.getPlayerInfoManager().getNickName(), sItem.getName(),soulEquip.getLevel()});
|
||||
ChatLogic.getInstance().sendSysChatMessage(message, Global.DILIGENT,sItem.getId(),0,0,0,0,0);
|
||||
|
|
|
|||
|
|
@ -2111,6 +2111,7 @@ public class MapLogic {
|
|||
int uid = session.getUid();
|
||||
User user = UserManager.getUser(uid);
|
||||
MainLevelManager mainLevelManager = user.getMainLevelManager();
|
||||
LOGGER.info("the uid={},play fightId={}",uid,fightId);
|
||||
int mineFightId = mainLevelManager.getFightId();
|
||||
if (mineFightId != fightId || mainLevelManager.getState()!=1) {
|
||||
LOGGER.info("startMainLevelFight==> uid={},fightId={}, levelDifficulty is not allow ", uid, fightId);
|
||||
|
|
@ -2135,6 +2136,7 @@ public class MapLogic {
|
|||
FightInfoProto.FightStartResponse.Builder fightStartResponse = FightInfoProto.FightStartResponse.newBuilder();
|
||||
BehaviorUtil.getLevelDifficultyifficuFightInfo(user, sMainLevelConfig.getMonsterGroup(), teamId, sMainLevelConfig.getRankTime(), fightStartResponse, RedisKey.LEVE_DIFFICULTY_FIGHT);
|
||||
MessageUtil.sendMessage(session, 1, messageType.getNumber(), fightStartResponse.build(), true);
|
||||
|
||||
}
|
||||
|
||||
public void endMainLevelFight(ISession session, String frames, int fightId, MessageTypeProto.MessageType messageType) throws Exception {
|
||||
|
|
|
|||
|
|
@ -294,7 +294,7 @@ public class MapManager extends MongoBase {
|
|||
if (addValue != 0) {
|
||||
int curEnergy = MathUtils.setBetweenWithMax(itemNum + addValue, 0, playerInfoManager.getMaxStamina());
|
||||
item.setItemNum(curEnergy > playerInfoManager.getMaxStamina() ? playerInfoManager.getMaxStamina() : curEnergy);
|
||||
KtEventUtils.onKtEvent(user, ParamEventBean.UserItemEvent, BIReason.TIME_REWARD,GlobalsDef.subReason,item.getItemId(),addValue,item.getItemNum());
|
||||
KtEventUtils.onKtEvent(user, ParamEventBean.UserItemEvent, BIReason.TIME_REWARD,GlobalsDef.addReason,item.getItemId(),addValue,item.getItemNum());
|
||||
}
|
||||
setLastUpdateEnergyTime(item, updateTime, lastUpdateEnergyTime);
|
||||
} else {
|
||||
|
|
|
|||
|
|
@ -294,6 +294,7 @@ public class GlobalDataManaager {
|
|||
PlayerLogic.getInstance().vipflushEveryDay(user,fBuilder);
|
||||
PlayerLogic.getInstance().flushUserdataEvery(user,fBuilder);
|
||||
user.getUserMissionManager().onGameEvent(user, GameEvent.DAILY_REFRESH,0);
|
||||
user.getUserMissionManager().onGameEvent(user, GameEvent.TREASH_REFRESH,0);
|
||||
user.getUserMissionManager().onGameEvent(user, GameEvent.BLOODY_REFRESH,0);
|
||||
FriendLogic.getInstance().refreshState(session);
|
||||
|
||||
|
|
|
|||
|
|
@ -1125,4 +1125,35 @@ public class ActivityLogic {
|
|||
// }
|
||||
MessageUtil.sendMessage(session,1,messageType.getNumber(),null,true);
|
||||
}
|
||||
|
||||
/**
|
||||
* 戒灵秘宝直接购买等级
|
||||
* @param session
|
||||
* @param messageType
|
||||
* @throws Exception
|
||||
*/
|
||||
public void treasureBuyLevel(ISession session,int level,MessageTypeProto.MessageType messageType) throws Exception {
|
||||
User user = UserManager.getUser(session.getUid());
|
||||
int treasureLevel = user.getPlayerInfoManager().getTreasureLevel();
|
||||
if(level<=treasureLevel){
|
||||
MessageUtil.sendErrorResponse(session,0,messageType.getNumber(),"等级错误");
|
||||
return;
|
||||
}
|
||||
int num = 0;
|
||||
int[][] cost= SSpecialConfig.getTwiceArrayValue(SSpecialConfig.SUNLONG_COST);
|
||||
for(int i = level;i>treasureLevel;i--){
|
||||
num+=MathUtils.calABX(i,cost[1]);
|
||||
}
|
||||
int[][] costItems = new int[1][];
|
||||
int[] costTemp = {cost[0][0],num};
|
||||
costItems[0]=costTemp;
|
||||
boolean result = ItemUtil.itemCost(user,costItems,BIReason.TREASURE_BUY_LEVEL_CONSUME,1);
|
||||
if(result) {
|
||||
user.getPlayerInfoManager().setTreasureLevel(level);
|
||||
}else{
|
||||
MessageUtil.sendErrorResponse(session,0,messageType.getNumber(),"消耗道具不足");
|
||||
return;
|
||||
}
|
||||
MessageUtil.sendMessage(session,1,messageType.getNumber(),null,true);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -2,6 +2,7 @@ package com.ljsd.jieling.logic.activity;
|
|||
|
||||
import com.ljsd.jieling.config.SGlobalActivity;
|
||||
import com.ljsd.jieling.config.STreasureConfig;
|
||||
import com.ljsd.jieling.config.STreasureSunlongConfig;
|
||||
import com.ljsd.jieling.globals.BIReason;
|
||||
import com.ljsd.jieling.ktbeans.KtEventUtils;
|
||||
import com.ljsd.jieling.ktbeans.parmsBean.ParamEventBean;
|
||||
|
|
@ -18,10 +19,7 @@ import com.ljsd.jieling.protocols.PlayerInfoProto;
|
|||
import com.ljsd.jieling.util.ItemUtil;
|
||||
import com.ljsd.jieling.util.MessageUtil;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.*;
|
||||
|
||||
public class TreasureActivity extends AbstractActivity {
|
||||
|
||||
|
|
@ -31,15 +29,16 @@ public class TreasureActivity extends AbstractActivity {
|
|||
|
||||
@Override
|
||||
public void initActivity(User user) throws Exception {
|
||||
user.getPlayerInfoManager().setHadBuyTreasure(0);
|
||||
LOGGER.info("戒灵秘宝初始化...");
|
||||
SGlobalActivity sGlobalActivity = SGlobalActivity.getsGlobalActivityMap().get(id);
|
||||
user.getUserMissionManager().onGameEvent(user, GameEvent.TREASH_REFRESH, sGlobalActivity.getId());
|
||||
user.getUserMissionManager().onGameEvent(user, GameEvent.TREASH_MONTH_REFRESH, sGlobalActivity.getId());
|
||||
ActivityMission activityMission = new ActivityMission();
|
||||
List<STreasureConfig> sTreasureConfigs = STreasureConfig.configByActivityIdMap.get(sGlobalActivity.getId());
|
||||
List<Integer> misionIds = new ArrayList<>(sTreasureConfigs.size());
|
||||
for (STreasureConfig sTreasureConfig : sTreasureConfigs) {
|
||||
misionIds.add(sTreasureConfig.getId());
|
||||
List<Integer> levels = new ArrayList<>(STreasureSunlongConfig.levelTreasureConfigMap.keySet());
|
||||
if(levels.contains(0)){
|
||||
levels.remove(0);
|
||||
}
|
||||
activityMission.initOtherMission(misionIds);
|
||||
activityMission.initOtherMission(levels);
|
||||
long endTime = sGlobalActivity.getTimeLong(user.getPlayerInfoManager().getCreateTime(), 2) - 24 * 3600 * 1000;
|
||||
user.getActivityManager().setTrsendTime(endTime);
|
||||
user.getActivityManager().addActivity(sGlobalActivity.getId(), activityMission);
|
||||
|
|
@ -67,93 +66,135 @@ public class TreasureActivity extends AbstractActivity {
|
|||
if (hadBuyTreasure == 1) {
|
||||
changeState = ActivityType.FINISH_TAKED;
|
||||
}
|
||||
int treasureScore = playerInfoManager.getTreasureScore();
|
||||
CommonProto.Drop.Builder drop = null;
|
||||
if (missionId == -1) {
|
||||
List<int[][]> dropList = new ArrayList<>(10);
|
||||
boolean canTakeFinalReward = true;
|
||||
STreasureConfig finalSTreasureConfig = null;
|
||||
Map<Integer, ActivityProgressInfo> willUpdateAcP = new HashMap<>();
|
||||
for (Map.Entry<Integer, ActivityProgressInfo> activityProgressInfoItem : activityMission.getActivityProgressInfoMap().entrySet()) {
|
||||
Integer mineMision = activityProgressInfoItem.getKey();
|
||||
STreasureConfig sTreasureConfig = STreasureConfig.configMap.get(mineMision);
|
||||
if (sTreasureConfig.getType() == 2) {
|
||||
finalSTreasureConfig = sTreasureConfig;
|
||||
List<int[][]> dropList = new ArrayList<>(2);
|
||||
Set<Integer> missionIds = new HashSet<>();
|
||||
if(missionId==-1){
|
||||
for(int i = 1 ; i<=user.getPlayerInfoManager().getTreasureLevel();i++){
|
||||
Map<Integer, ActivityProgressInfo> progressInfoMap = activityMission.getActivityProgressInfoMap();
|
||||
int state =progressInfoMap.get(i).getState();
|
||||
if(state==changeState||state==ActivityType.FINISH_TAKED) {
|
||||
continue;
|
||||
}
|
||||
ActivityProgressInfo value = activityProgressInfoItem.getValue();
|
||||
int stateTmp = value.getState();
|
||||
if (treasureScore >= sTreasureConfig.getPoints()) {
|
||||
if (changeState != stateTmp) {
|
||||
STreasureConfig sTreasureConfigTmp = STreasureConfig.configMap.get(mineMision);
|
||||
if (stateTmp == ActivityType.WILL_TAKE) {
|
||||
dropList.add(sTreasureConfigTmp.getReward());
|
||||
}
|
||||
if (changeState == ActivityType.FINISH_TAKED) {
|
||||
dropList.add(sTreasureConfigTmp.getTreasureReward());
|
||||
}
|
||||
willUpdateAcP.put(mineMision, value);
|
||||
}
|
||||
} else {
|
||||
canTakeFinalReward = false;
|
||||
}
|
||||
}
|
||||
for (Map.Entry<Integer, ActivityProgressInfo> item : willUpdateAcP.entrySet()) {
|
||||
ActivityProgressInfo value = item.getValue();
|
||||
value.setState(changeState);
|
||||
activityMission.updateProgressInfo(item.getKey(), value);
|
||||
KtEventUtils.onKtEvent(user, ParamEventBean.UserActivityEvent, activityId, item.getKey());
|
||||
}
|
||||
if (canTakeFinalReward && finalSTreasureConfig != null) {
|
||||
ActivityProgressInfo activityProgressInfo = activityMission.getActivityProgressInfoMap().get(finalSTreasureConfig.getId());
|
||||
int stateTmp = activityProgressInfo.getState();
|
||||
if (changeState != stateTmp) {
|
||||
if (stateTmp == ActivityType.WILL_TAKE) {
|
||||
dropList.add(finalSTreasureConfig.getReward());
|
||||
}
|
||||
if (changeState == ActivityType.FINISH_TAKED) {
|
||||
dropList.add(finalSTreasureConfig.getTreasureReward());
|
||||
}
|
||||
activityProgressInfo.setState(changeState);
|
||||
activityMission.updateProgressInfo(finalSTreasureConfig.getId(), activityProgressInfo);
|
||||
KtEventUtils.onKtEvent(user, ParamEventBean.UserActivityEvent, activityId, finalSTreasureConfig.getId());
|
||||
}
|
||||
}
|
||||
if (dropList.isEmpty()) {
|
||||
MessageUtil.sendErrorResponse(session, 0, rewardResponseValue, "no one can take");
|
||||
return;
|
||||
}
|
||||
drop = ItemUtil.drop(user, dropList, BIReason.TAKE_ACTIVITY_REWARD);
|
||||
} else {
|
||||
STreasureConfig sTreasureConfig = STreasureConfig.configMap.get(missionId);
|
||||
int type = sTreasureConfig.getType();
|
||||
ActivityProgressInfo activityProgressInfo = activityMission.getActivityProgressInfoMap().get(missionId);
|
||||
int state = activityProgressInfo.getState();
|
||||
if (state == changeState) {
|
||||
MessageUtil.sendErrorResponse(session, 0, rewardResponseValue, "had taked");
|
||||
return;
|
||||
}
|
||||
if (type == 1) {
|
||||
List<int[][]> dropList = new ArrayList<>(2);
|
||||
if (treasureScore < sTreasureConfig.getPoints()) {
|
||||
MessageUtil.sendErrorResponse(session, 0, rewardResponseValue, "not finish");
|
||||
return;
|
||||
}
|
||||
if (state == ActivityType.WILL_TAKE) {
|
||||
dropList.add(sTreasureConfig.getReward());
|
||||
}
|
||||
if (changeState == ActivityType.FINISH_TAKED) {
|
||||
dropList.add(sTreasureConfig.getTreasureReward());
|
||||
}
|
||||
drop = ItemUtil.drop(user, dropList, BIReason.TAKE_ACTIVITY_REWARD);
|
||||
activityProgressInfo.setState(changeState);
|
||||
activityMission.updateProgressInfo(missionId, activityProgressInfo);
|
||||
KtEventUtils.onKtEvent(user, ParamEventBean.UserActivityEvent, activityId, missionId);
|
||||
}
|
||||
}
|
||||
missionIds.add(i);
|
||||
dropByState(dropList,state,changeState,i);
|
||||
ActivityProgressInfo progressInfo = new ActivityProgressInfo(0,changeState);
|
||||
activityMission.updateProgressInfo(i, progressInfo);
|
||||
|
||||
}
|
||||
|
||||
}else{
|
||||
int state = activityMission.getActivityProgressInfoMap().get(missionId).getState();
|
||||
if(state==changeState||state==ActivityType.FINISH_TAKED){
|
||||
MessageUtil.sendErrorResponse(session,0,rewardResponseValue,"该奖励已领取过");
|
||||
return;
|
||||
}
|
||||
dropByState(dropList,state,changeState,missionId);
|
||||
ActivityProgressInfo progressInfo = new ActivityProgressInfo(0,changeState);
|
||||
activityMission.updateProgressInfo(missionId, progressInfo);
|
||||
missionIds.add(missionId);
|
||||
}
|
||||
// sendActivityProgress(session,activityMission,missionIds);
|
||||
|
||||
|
||||
|
||||
// if (missionId == -1) {
|
||||
// List<int[][]> dropList = new ArrayList<>(10);
|
||||
// boolean canTakeFinalReward = true;
|
||||
// STreasureConfig finalSTreasureConfig = null;
|
||||
// Map<Integer, ActivityProgressInfo> willUpdateAcP = new HashMap<>();
|
||||
// for (Map.Entry<Integer, ActivityProgressInfo> activityProgressInfoItem : activityMission.getActivityProgressInfoMap().entrySet()) {
|
||||
// Integer mineMision = activityProgressInfoItem.getKey();
|
||||
// STreasureConfig sTreasureConfig = STreasureConfig.configMap.get(mineMision);
|
||||
// if (sTreasureConfig.getType() == 2) {
|
||||
// finalSTreasureConfig = sTreasureConfig;
|
||||
// continue;
|
||||
// }
|
||||
// ActivityProgressInfo value = activityProgressInfoItem.getValue();
|
||||
// int stateTmp = value.getState();
|
||||
// if (treasureScore >= sTreasureConfig.getPoints()) {
|
||||
// if (changeState != stateTmp) {
|
||||
// STreasureConfig sTreasureConfigTmp = STreasureConfig.configMap.get(mineMision);
|
||||
// if (stateTmp == ActivityType.WILL_TAKE) {
|
||||
// dropList.add(sTreasureConfigTmp.getReward());
|
||||
// }
|
||||
// if (changeState == ActivityType.FINISH_TAKED) {
|
||||
// dropList.add(sTreasureConfigTmp.getTreasureReward());
|
||||
// }
|
||||
// willUpdateAcP.put(mineMision, value);
|
||||
// }
|
||||
// } else {
|
||||
// canTakeFinalReward = false;
|
||||
// }
|
||||
// }
|
||||
// for (Map.Entry<Integer, ActivityProgressInfo> item : willUpdateAcP.entrySet()) {
|
||||
// ActivityProgressInfo value = item.getValue();
|
||||
// value.setState(changeState);
|
||||
// activityMission.updateProgressInfo(item.getKey(), value);
|
||||
// KtEventUtils.onKtEvent(user, ParamEventBean.UserActivityEvent, activityId, item.getKey());
|
||||
// }
|
||||
// if (canTakeFinalReward && finalSTreasureConfig != null) {
|
||||
// ActivityProgressInfo activityProgressInfo = activityMission.getActivityProgressInfoMap().get(finalSTreasureConfig.getId());
|
||||
// int stateTmp = activityProgressInfo.getState();
|
||||
// if (changeState != stateTmp) {
|
||||
// if (stateTmp == ActivityType.WILL_TAKE) {
|
||||
// dropList.add(finalSTreasureConfig.getReward());
|
||||
// }
|
||||
// if (changeState == ActivityType.FINISH_TAKED) {
|
||||
// dropList.add(finalSTreasureConfig.getTreasureReward());
|
||||
// }
|
||||
// activityProgressInfo.setState(changeState);
|
||||
// activityMission.updateProgressInfo(finalSTreasureConfig.getId(), activityProgressInfo);
|
||||
// KtEventUtils.onKtEvent(user, ParamEventBean.UserActivityEvent, activityId, finalSTreasureConfig.getId());
|
||||
// }
|
||||
// }
|
||||
// if (dropList.isEmpty()) {
|
||||
// MessageUtil.sendErrorResponse(session, 0, rewardResponseValue, "no one can take");
|
||||
// return;
|
||||
// }
|
||||
// drop = ItemUtil.drop(user, dropList, BIReason.TAKE_ACTIVITY_REWARD);
|
||||
// } else {
|
||||
// STreasureConfig sTreasureConfig = STreasureConfig.configMap.get(missionId);
|
||||
// int type = sTreasureConfig.getType();
|
||||
// ActivityProgressInfo activityProgressInfo = activityMission.getActivityProgressInfoMap().get(missionId);
|
||||
// int state = activityProgressInfo.getState();
|
||||
// if (state == changeState) {
|
||||
// MessageUtil.sendErrorResponse(session, 0, rewardResponseValue, "had taked");
|
||||
// return;
|
||||
// }
|
||||
// if (type == 1) {
|
||||
// List<int[][]> dropList = new ArrayList<>(2);
|
||||
// if (treasureScore < sTreasureConfig.getPoints()) {
|
||||
// MessageUtil.sendErrorResponse(session, 0, rewardResponseValue, "not finish");
|
||||
// return;
|
||||
// }
|
||||
// if (state == ActivityType.WILL_TAKE) {
|
||||
// dropList.add(sTreasureConfig.getReward());
|
||||
// }
|
||||
// if (changeState == ActivityType.FINISH_TAKED) {
|
||||
// dropList.add(sTreasureConfig.getTreasureReward());
|
||||
// }
|
||||
// activityProgressInfo.setState(changeState);
|
||||
// activityMission.updateProgressInfo(missionId, activityProgressInfo);
|
||||
// KtEventUtils.onKtEvent(user, ParamEventBean.UserActivityEvent, activityId, missionId);
|
||||
// }
|
||||
// }
|
||||
|
||||
CommonProto.Drop.Builder drop = ItemUtil.drop(user, dropList, BIReason.TAKE_ACTIVITY_REWARD);
|
||||
PlayerInfoProto.TakeActivityRewardResponse build = PlayerInfoProto.TakeActivityRewardResponse.newBuilder().setDrop(drop).build();
|
||||
MessageUtil.sendMessage(session, 1, rewardResponseValue, build, true);
|
||||
}
|
||||
private void dropByState(List<int[][]> dropList,int curState,int targetState,int missionId){
|
||||
STreasureSunlongConfig rewardConfig = STreasureSunlongConfig.levelTreasureConfigMap.get(missionId);
|
||||
if(curState==ActivityType.WILL_TAKE){
|
||||
dropList.add(rewardConfig.getReward());
|
||||
if(targetState == ActivityType.FINISH_TAKED){
|
||||
dropList.add(rewardConfig.getTreasureReward());
|
||||
}
|
||||
}else if(curState==ActivityType.HAD_TAKED){
|
||||
if(targetState == ActivityType.FINISH_TAKED){
|
||||
dropList.add(rewardConfig.getTreasureReward());
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -62,7 +62,7 @@ public class PlayerManager extends MongoBase {
|
|||
|
||||
private int headFrame;
|
||||
|
||||
private int treasureScore; //孙龙的宝藏分数
|
||||
private int treasureLevel; //孙龙的宝藏等级
|
||||
|
||||
private int hadBuyTreasure; //是否已购
|
||||
|
||||
|
|
@ -94,18 +94,18 @@ public class PlayerManager extends MongoBase {
|
|||
this.setRootCollection(User._COLLECTION_NAME);
|
||||
}
|
||||
|
||||
public int getTreasureScore() {
|
||||
return treasureScore;
|
||||
public int getTreasureLevel() {
|
||||
return treasureLevel;
|
||||
}
|
||||
|
||||
public void addTreasureScore(int treasureScore) {
|
||||
this.treasureScore += treasureScore;
|
||||
setTreasureScore(this.treasureScore);
|
||||
public void addTreasureLevel() {
|
||||
this.treasureLevel++;
|
||||
setTreasureLevel(this.treasureLevel);
|
||||
}
|
||||
|
||||
public void setTreasureScore(int treasureScore){
|
||||
this.treasureScore = treasureScore;
|
||||
updateString("treasureScore", treasureScore);
|
||||
public void setTreasureLevel(int treasureLevel){
|
||||
this.treasureLevel = treasureLevel;
|
||||
updateString("treasureLevel", treasureLevel);
|
||||
}
|
||||
|
||||
public int getHadBuyTreasure() {
|
||||
|
|
|
|||
|
|
@ -2,11 +2,19 @@ package com.ljsd.jieling.logic.dao;
|
|||
|
||||
import com.ljsd.common.mogodb.MongoBase;
|
||||
import com.ljsd.jieling.config.*;
|
||||
import com.ljsd.jieling.logic.OnlineUserManager;
|
||||
import com.ljsd.jieling.logic.dao.root.User;
|
||||
import com.ljsd.jieling.logic.mission.*;
|
||||
import com.ljsd.jieling.logic.mission.event.MissionEventDistributor;
|
||||
import com.ljsd.jieling.logic.mission.main.*;
|
||||
import com.ljsd.jieling.network.session.ISession;
|
||||
import com.ljsd.jieling.protocols.CommonProto;
|
||||
import com.ljsd.jieling.protocols.MessageTypeProto;
|
||||
import com.ljsd.jieling.protocols.PlayerInfoProto;
|
||||
import com.ljsd.jieling.util.MathUtils;
|
||||
import com.ljsd.jieling.util.MessageUtil;
|
||||
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
|
|
@ -26,9 +34,12 @@ public class UserMissionManager extends MongoBase {
|
|||
private CumulationData beginCumulationData = new CumulationData();
|
||||
|
||||
private CumulationData treasureCumulationData = new CumulationData();
|
||||
private CumulationData treasureWeekCumulationData = new CumulationData();
|
||||
private CumulationData treasureMonthCumulationData = new CumulationData();
|
||||
private CumulationData sevenHappyCumulationData = new CumulationData();
|
||||
|
||||
public void openMission(User user,GameEvent event,Map<GameMisionType, List<MissionStateChangeInfo>> missionTypeEnumListMap, Object... parm){
|
||||
ISession session= OnlineUserManager.getSessionByUid(user.getId());
|
||||
switch (event){
|
||||
case VIP_LEVLUP:{
|
||||
int vipLevle= (int)parm[0];
|
||||
|
|
@ -54,24 +65,53 @@ public class UserMissionManager extends MongoBase {
|
|||
updateString("dailyMissionIdsType",dailyMissionIdsType);
|
||||
break;
|
||||
case TREASH_REFRESH:
|
||||
List<STreasureTaskConfig> sTreasureTaskConfigs = STreasureTaskConfig.sTreasureTaskConfigListByActivityMap.get((int) parm[0]);
|
||||
treasureMissionIdsType.getDoingMissionIds().clear();
|
||||
treasureMissionIdsType.getFinishMissionIds().clear();
|
||||
treasureMissionIdsType.getRewardedMissionIds().clear();
|
||||
treasureMissionIdsType.getTakeTimes().clear();
|
||||
List<MissionStateChangeInfo> missionStateChangeInfos = missionTypeEnumListMap.get(GameMisionType.TREASUREMISSION);
|
||||
for(STreasureTaskConfig sTreasureTaskConfig : sTreasureTaskConfigs){
|
||||
treasureMissionIdsType.getDoingMissionIds().add(sTreasureTaskConfig.getId());
|
||||
missionStateChangeInfos.add(new MissionStateChangeInfo(sTreasureTaskConfig.getId(), MissionState.DOING,0));
|
||||
}
|
||||
user.getPlayerInfoManager().setTreasureScore(0);
|
||||
treasureCumulationData= new CumulationData();
|
||||
updateString("treasureMissionIdsType",treasureMissionIdsType);
|
||||
updateString("treasureCumulationData",treasureCumulationData);
|
||||
break;
|
||||
|
||||
// List<STreasureTaskConfig> sTreasureTaskConfigs = STreasureTaskConfig.sTreasureTaskConfigListByActivityMap.get((int) parm[0]);
|
||||
// treasureMissionIdsType.getDoingMissionIds().clear();
|
||||
// treasureMissionIdsType.getFinishMissionIds().clear();
|
||||
// treasureMissionIdsType.getRewardedMissionIds().clear();
|
||||
// treasureMissionIdsType.getTakeTimes().clear();
|
||||
// List<MissionStateChangeInfo> missionStateChangeInfos = missionTypeEnumListMap.get(GameMisionType.TREASUREMISSION);
|
||||
// for(STreasureTaskConfig sTreasureTaskConfig : sTreasureTaskConfigs){
|
||||
// treasureMissionIdsType.getDoingMissionIds().add(sTreasureTaskConfig.getId());
|
||||
// missionStateChangeInfos.add(new MissionStateChangeInfo(sTreasureTaskConfig.getId(), MissionState.DOING,0));
|
||||
// }
|
||||
// user.getPlayerInfoManager().setTreasureScore(0);
|
||||
// treasureCumulationData= new CumulationData();
|
||||
// updateString("treasureMissionIdsType",treasureMissionIdsType);
|
||||
// updateString("treasureCumulationData",treasureCumulationData);
|
||||
|
||||
int[] refreshIds =resetTreasureTaskInfo(1,missionTypeEnumListMap,treasureCumulationData);
|
||||
CommonProto.RefreshTask.Builder task = treasureIndicationBuild(1, refreshIds);
|
||||
PlayerInfoProto.TreasureRefreshIndication indication1 = PlayerInfoProto.TreasureRefreshIndication.newBuilder().addTasks(task.build()).build();
|
||||
MessageUtil.sendIndicationMessage(session,1, MessageTypeProto.MessageType.TREASURE_REFRESH_INDICATION_VALUE,indication1,true);
|
||||
break;
|
||||
case TREASH_WEEK_REFRESH:
|
||||
int[] dailyRefreshIds = resetTreasureTaskInfo(1,missionTypeEnumListMap,treasureCumulationData);
|
||||
int[] weekRefreshIds = resetTreasureTaskInfo(2,missionTypeEnumListMap,treasureWeekCumulationData);
|
||||
CommonProto.RefreshTask.Builder task1 = treasureIndicationBuild(1, dailyRefreshIds);
|
||||
CommonProto.RefreshTask.Builder task2 = treasureIndicationBuild(2, weekRefreshIds);
|
||||
PlayerInfoProto.TreasureRefreshIndication indication2 = PlayerInfoProto.TreasureRefreshIndication.newBuilder().addTasks(task1.build()).addTasks(task2.build()).build();
|
||||
MessageUtil.sendIndicationMessage(session,1, MessageTypeProto.MessageType.TREASURE_REFRESH_INDICATION_VALUE,indication2,true);
|
||||
|
||||
break;
|
||||
case TREASH_MONTH_REFRESH:
|
||||
System.out.println("戒灵秘宝月任务初始化");
|
||||
int[] dailyRefreshIds1 = resetTreasureTaskInfo(1,missionTypeEnumListMap,treasureCumulationData);
|
||||
int[] weekRefreshIds1 = resetTreasureTaskInfo(2,missionTypeEnumListMap,treasureWeekCumulationData);
|
||||
int[] monthRefreshIds1 = resetTreasureTaskInfo(3,missionTypeEnumListMap,treasureMonthCumulationData);
|
||||
|
||||
CommonProto.RefreshTask.Builder task3 = treasureIndicationBuild(1, dailyRefreshIds1);
|
||||
CommonProto.RefreshTask.Builder task4 = treasureIndicationBuild(2, weekRefreshIds1);
|
||||
CommonProto.RefreshTask.Builder task5 = treasureIndicationBuild(3, monthRefreshIds1);
|
||||
PlayerInfoProto.TreasureRefreshIndication indication3 = PlayerInfoProto.TreasureRefreshIndication.newBuilder().addTasks(task3.build()).addTasks(task4.build()).addTasks(task5.build()).build();
|
||||
MessageUtil.sendIndicationMessage(session,1, MessageTypeProto.MessageType.TREASURE_REFRESH_INDICATION_VALUE,indication3,true);
|
||||
|
||||
// openMission(user,GameEvent.TREASH_WEEK_REFRESH,missionTypeEnumListMap,parm);
|
||||
break;
|
||||
case SERVENHAPPY_REFRESH:
|
||||
sTreasureTaskConfigs = STreasureTaskConfig.sTreasureTaskConfigListByActivityMap.get((int) parm[0]);
|
||||
List<STreasureTaskConfig> sTreasureTaskConfigs = null;
|
||||
sTreasureTaskConfigs = STreasureTaskConfig.sTreasureTaskConfigListByActivityMap.get((int) parm[0]);
|
||||
sevenHappyMissionType.getDoingMissionIds().clear();
|
||||
sevenHappyMissionType.getFinishMissionIds().clear();
|
||||
sevenHappyMissionType.getRewardedMissionIds().clear();
|
||||
|
|
@ -188,14 +228,29 @@ public class UserMissionManager extends MongoBase {
|
|||
}
|
||||
}
|
||||
if(!treasureMissionIdsType.getDoingMissionIds().isEmpty() ){
|
||||
List<STreasureTaskConfig> sTreasureTaskConfigs = STreasureTaskConfig.sTreasureTaskConfigListByTypeMap.get(missionType.getMissionTypeValue());
|
||||
List<STreasureSunlongTaskConfig> sTreasureTaskConfigs = STreasureSunlongTaskConfig.sTreasureTaskConfigListByTypeMapTmp.get(missionType.getMissionTypeValue());
|
||||
if(sTreasureTaskConfigs!=null && user.getActivityManager().getTrsendTime()>System.currentTimeMillis()){
|
||||
CumulationData.Result result = treasureCumulationData.updateData(missionType, parm);
|
||||
CumulationData.Result weekResult = treasureWeekCumulationData.updateData(missionType, parm);
|
||||
CumulationData.Result monthResult = treasureMonthCumulationData.updateData(missionType, parm);
|
||||
|
||||
if(result!=null){
|
||||
treasureMissionIdsType.calCumulationDataResult(user,result,missionTypeEnumListMap.get(GameMisionType.TREASUREMISSION),treasureCumulationData);
|
||||
updateString("treasureCumulationData",treasureCumulationData);
|
||||
updateString("treasureMissionIdsType",treasureMissionIdsType);
|
||||
}
|
||||
if(weekResult!=null){
|
||||
treasureMissionIdsType.calCumulationDataResult(user,weekResult,missionTypeEnumListMap.get(GameMisionType.TREASUREMISSION),treasureWeekCumulationData);
|
||||
updateString("treasureWeekCumulationData",treasureWeekCumulationData);
|
||||
updateString("treasureMissionIdsType",treasureMissionIdsType);
|
||||
}
|
||||
if(monthResult!=null){
|
||||
treasureMissionIdsType.calCumulationDataResult(user,monthResult,missionTypeEnumListMap.get(GameMisionType.TREASUREMISSION),treasureMonthCumulationData);
|
||||
|
||||
updateString("treasureMonthCumulationData",treasureMonthCumulationData);
|
||||
updateString("treasureMissionIdsType",treasureMissionIdsType);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -219,6 +274,47 @@ public class UserMissionManager extends MongoBase {
|
|||
}
|
||||
}
|
||||
|
||||
|
||||
private int[] resetTreasureTaskInfo(int type,Map<GameMisionType, List<MissionStateChangeInfo>> missionTypeEnumListMap,CumulationData treasureCumulationData){
|
||||
int[] typeMissionNum = SSpecialConfig.getOnceArrayValue(SSpecialConfig.SUNLONG_DAILYTASKS);
|
||||
List<Integer> taskTypeMap = STreasureSunlongTaskConfig.taskTypeMap.get(type);
|
||||
for(Integer treasure:taskTypeMap){
|
||||
if(treasureMissionIdsType.getDoingMissionIds().contains(treasure)){
|
||||
treasureMissionIdsType.getDoingMissionIds().remove(treasure);
|
||||
}
|
||||
if(treasureMissionIdsType.getFinishMissionIds().contains(treasure)){
|
||||
treasureMissionIdsType.getFinishMissionIds().remove(treasure);
|
||||
}
|
||||
if(treasureMissionIdsType.getRewardedMissionIds().get(treasure)){
|
||||
treasureMissionIdsType.getRewardedMissionIds().clear(treasure);
|
||||
}
|
||||
}
|
||||
int[][] randomTask = new int[taskTypeMap.size()][];
|
||||
for(int i = 0 ; i<randomTask.length;i++){
|
||||
int [] temp=new int[2];
|
||||
temp[0] = taskTypeMap.get(i);
|
||||
temp[1] = STreasureSunlongTaskConfig.treasureTaskConfig.get(taskTypeMap.get(i)).getWeight();
|
||||
randomTask[i] = temp;
|
||||
}
|
||||
int[] tasks= MathUtils.randomFromWeightWithTaking(randomTask,5);// typeMissionNum[type-1]
|
||||
List<MissionStateChangeInfo> missionStateChangeInfos = missionTypeEnumListMap.get(GameMisionType.TREASUREMISSION);
|
||||
for(Integer task:tasks){
|
||||
treasureMissionIdsType.getDoingMissionIds().add(task);
|
||||
missionStateChangeInfos.add(new MissionStateChangeInfo(task, MissionState.DOING,0));
|
||||
}
|
||||
treasureCumulationData.reset();
|
||||
updateString("treasureMissionIdsType",treasureMissionIdsType);
|
||||
updateString("treasureCumulationData",treasureCumulationData);
|
||||
return tasks;
|
||||
}
|
||||
private CommonProto.RefreshTask.Builder treasureIndicationBuild(int type,int[] refreshIds){
|
||||
CommonProto.RefreshTask.Builder task = CommonProto.RefreshTask.newBuilder().setType(type);
|
||||
for(int i = 0;i<refreshIds.length;i++){
|
||||
CommonProto.UserMissionInfo tempTask = CommonProto.UserMissionInfo.newBuilder().setMissionId(refreshIds[i]).build();
|
||||
task.addTasks(tempTask).build();
|
||||
}
|
||||
return task;
|
||||
}
|
||||
public void setVipMissionIdsType(VipMissionIdsType vipMissionIdsType) {
|
||||
updateString("vipMissionIdsType",vipMissionIdsType);
|
||||
this.vipMissionIdsType = vipMissionIdsType;
|
||||
|
|
@ -274,4 +370,12 @@ public class UserMissionManager extends MongoBase {
|
|||
public BloodyMissionIdsType getBloodyMissionIdsType() {
|
||||
return bloodyMissionIdsType;
|
||||
}
|
||||
|
||||
public CumulationData getTreasureWeekCumulationData() {
|
||||
return treasureWeekCumulationData;
|
||||
}
|
||||
|
||||
public CumulationData getTreasureMonthCumulationData() {
|
||||
return treasureMonthCumulationData;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -5,6 +5,8 @@ public enum GameEvent {
|
|||
DAILY_REFRESH,//日常任务刷新
|
||||
BLOODY_REFRESH,//血战任务刷新
|
||||
TREASH_REFRESH,//孙龙的宝藏
|
||||
TREASH_WEEK_REFRESH,//孙龙的宝藏周任务
|
||||
TREASH_MONTH_REFRESH,//孙龙的宝藏月任务
|
||||
SERVENHAPPY_REFRESH,//七日狂欢
|
||||
BEGINNER,//新手
|
||||
|
||||
|
|
|
|||
|
|
@ -143,54 +143,41 @@ public class MissionLoigc {
|
|||
}
|
||||
TreasureMissionType treasureMissionIdsType = user.getUserMissionManager().getTreasureMissionIdsType();
|
||||
CumulationData treasureCumulationData = user.getUserMissionManager().getTreasureCumulationData();
|
||||
CumulationData treasureWeekCumulationData = user.getUserMissionManager().getTreasureWeekCumulationData();
|
||||
CumulationData treasureMonthCumulationData = user.getUserMissionManager().getTreasureMonthCumulationData();
|
||||
|
||||
int treasuremissionType = GameMisionType.TREASUREMISSION.getType();
|
||||
if(activityType == ActivityType.SERVERHAPPY){
|
||||
getServenMision(user,treasureActivityId,missionList);
|
||||
return;
|
||||
}
|
||||
BitSet rewardedMissionIds = treasureMissionIdsType.getRewardedMissionIds();
|
||||
Map<Integer, Integer> takeTimesMap = treasureMissionIdsType.getTakeTimes();
|
||||
List<STreasureTaskConfig> sTreasureTaskConfigs = STreasureTaskConfig.sTreasureTaskConfigListByActivityMap.get(treasureActivityId);
|
||||
for(STreasureTaskConfig sTreasureTaskConfig:sTreasureTaskConfigs){
|
||||
int state = 2;
|
||||
int missionId = sTreasureTaskConfig.getId();
|
||||
int sendProgress =0;
|
||||
Integer takeTimes = null;
|
||||
if(!rewardedMissionIds.get(missionId)){
|
||||
takeTimes = takeTimesMap.get(missionId);
|
||||
if(takeTimes == null){
|
||||
takeTimes=0;
|
||||
}
|
||||
int finishParm = sTreasureTaskConfig.getTaskValue()[1][0];
|
||||
int doingProgress = getDoingProgress(user,treasureCumulationData,sTreasureTaskConfig.getTaskType(),sTreasureTaskConfig.getTaskValue()[0]);
|
||||
if(doingProgress!=0 && finishParm<0 && doingProgress>finishParm){
|
||||
sendProgress =1;
|
||||
}else{
|
||||
sendProgress = (doingProgress - takeTimes * finishParm) / finishParm;
|
||||
}
|
||||
int times = sTreasureTaskConfig.getTimes();
|
||||
if( (sendProgress + takeTimes)>times){
|
||||
sendProgress =times-takeTimes;
|
||||
}
|
||||
if(sendProgress>0){
|
||||
state=1;
|
||||
}else{
|
||||
state=0;
|
||||
}
|
||||
if(sTreasureTaskConfig.getTaskType() == MissionType.SENVER_HAPPY.getMissionTypeValue()){
|
||||
sendProgress = doingProgress;
|
||||
}
|
||||
|
||||
}else{
|
||||
takeTimes = takeTimesMap.get(missionId);
|
||||
for(Integer id:treasureMissionIdsType.getDoingMissionIds()){
|
||||
STreasureSunlongTaskConfig config = STreasureSunlongTaskConfig.treasureTaskConfig.get(id);
|
||||
int progress = config.getTaskValue()[1][0];
|
||||
switch (config.getType()){
|
||||
case 1:
|
||||
progress = getDoingProgress(user,treasureCumulationData,config.getTaskType(),config.getTaskValue()[0]);
|
||||
break;
|
||||
case 2:
|
||||
progress = getDoingProgress(user,treasureWeekCumulationData,config.getTaskType(),config.getTaskValue()[0]);
|
||||
break;
|
||||
case 3:
|
||||
progress = getDoingProgress(user,treasureMonthCumulationData,config.getTaskType(),config.getTaskValue()[0]);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
if(takeTimes == null){
|
||||
takeTimes=0;
|
||||
missionList.add(CommonProto.UserMissionInfo.newBuilder().setMissionId(id).setState(0).setType(treasuremissionType).setProgress(progress).setTakeTimes(0).build());
|
||||
}
|
||||
for(Integer id:treasureMissionIdsType.getFinishMissionIds()){
|
||||
STreasureSunlongTaskConfig config = STreasureSunlongTaskConfig.treasureTaskConfig.get(id);
|
||||
int progress = config.getTaskValue()[1][0];
|
||||
missionList.add(CommonProto.UserMissionInfo.newBuilder().setMissionId(id).setState(1).setType(treasuremissionType).setProgress(progress).setTakeTimes(0).build());
|
||||
}
|
||||
for(Map.Entry<Integer,STreasureSunlongTaskConfig> taskId:STreasureSunlongTaskConfig.treasureTaskConfig.entrySet()){
|
||||
if(treasureMissionIdsType.getRewardedMissionIds().get(taskId.getKey())){
|
||||
missionList.add(CommonProto.UserMissionInfo.newBuilder().setMissionId(taskId.getKey()).setState(2).setType(treasuremissionType).setProgress(taskId.getValue().getTaskValue()[1][0]).setTakeTimes(0).build());
|
||||
}
|
||||
|
||||
|
||||
missionList.add(CommonProto.UserMissionInfo.newBuilder().setMissionId(missionId).setState(state).setType(treasuremissionType).setProgress(sendProgress).setTakeTimes(takeTimes).build());
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -362,13 +349,18 @@ public class MissionLoigc {
|
|||
Map<GameMisionType, List<MissionStateChangeInfo>> gameMisionTypeListMap = userMissionManager.onGameEvent(user, GameEvent.TREASURE_MISSION_REWARD, missionId);
|
||||
missionStateChangeInfos = gameMisionTypeListMap.get(GameMisionType.TREASUREMISSION);
|
||||
if(missionStateChangeInfos!=null && !missionStateChangeInfos.isEmpty()){
|
||||
int takeTimes = missionStateChangeInfos.get(0).getProgress();
|
||||
missionStateChangeInfos.get(0).setProgress(0);
|
||||
int score = STreasureTaskConfig.sTreasureTaskConfigMap.get(missionId).getPoints() * takeTimes;
|
||||
user.getPlayerInfoManager().addTreasureScore(score);
|
||||
|
||||
// ItemUtil.drop(user,STreasureSunlongTaskConfig.treasureTaskConfig.get(missionId).getIntegral(),BIReason.TREASURE_SCORE);
|
||||
KtEventUtils.onKtEvent(user, ParamEventBean.UserTaskEvent,type,missionId);
|
||||
Repot37EventUtil.onKtEvent(user, Repot37EventUtil.Report37EventType.TASK_FINISH_EVEMT,missionId,"");
|
||||
PlayerInfoProto.TakeMissionRewardResponse build = PlayerInfoProto.TakeMissionRewardResponse.newBuilder().setTreasureScore(user.getPlayerInfoManager().getTreasureScore()).build();
|
||||
CommonProto.Drop.Builder drop = ItemUtil.drop(user, missionStateChangeInfos.get(0).getRewwardGroups(), BIReason.TAKE_MISSION_REWARD);
|
||||
|
||||
STreasureSunlongConfig levelConfig = STreasureSunlongConfig.levelTreasureConfigMap.get(user.getPlayerInfoManager().getTreasureLevel());
|
||||
while(ItemUtil.itemCost(user,levelConfig.getIntegral(), BIReason.TREASURE_LEVEL_UP_CONCUME,1)){
|
||||
user.getPlayerInfoManager().addTreasureLevel();
|
||||
levelConfig = STreasureSunlongConfig.levelTreasureConfigMap.get(user.getPlayerInfoManager().getTreasureLevel());
|
||||
}
|
||||
PlayerInfoProto.TakeMissionRewardResponse build = PlayerInfoProto.TakeMissionRewardResponse.newBuilder().setDrop(drop).setTreasureScore(user.getPlayerInfoManager().getTreasureLevel()).build();
|
||||
MessageUtil.sendMessage(session,1, MessageTypeProto.MessageType.TAKE_MISSION_REWARD_RESPONSE_VALUE,build,true);
|
||||
return;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -34,7 +34,7 @@ public class MissionEventDistributor {
|
|||
|
||||
eventProcessor.put(GameEvent.DAILY_REFRESH,new DailyRefreshEventProcess());
|
||||
eventProcessor.put(GameEvent.BLOODY_REFRESH,new DailyRefreshEventProcess());
|
||||
eventProcessor.put(GameEvent.TREASH_REFRESH,new TreasureRefreshEventProcess());
|
||||
eventProcessor.put(GameEvent.TREASH_MONTH_REFRESH,new TreasureRefreshEventProcess());
|
||||
eventProcessor.put(GameEvent.SERVENHAPPY_REFRESH,new TreasureRefreshEventProcess());
|
||||
eventProcessor.put(GameEvent.BEGINNER,new BeginneRefreshEventProcessor());
|
||||
|
||||
|
|
|
|||
|
|
@ -50,7 +50,7 @@ public abstract class AbstractMissionType {
|
|||
}
|
||||
|
||||
public Set<Integer> getDoingMissionIds() {
|
||||
return doingMissionIds;
|
||||
return doingMissionIds;
|
||||
}
|
||||
|
||||
public void addFinishMissionId(int missionId) {
|
||||
|
|
|
|||
|
|
@ -1,11 +1,15 @@
|
|||
package com.ljsd.jieling.logic.mission.main;
|
||||
|
||||
import com.ljsd.jieling.config.STreasureSunlongConfig;
|
||||
import com.ljsd.jieling.config.STreasureSunlongTaskConfig;
|
||||
import com.ljsd.jieling.config.STreasureTaskConfig;
|
||||
import com.ljsd.jieling.globals.BIReason;
|
||||
import com.ljsd.jieling.logic.dao.CumulationData;
|
||||
import com.ljsd.jieling.logic.dao.root.User;
|
||||
import com.ljsd.jieling.logic.mission.MissionLoigc;
|
||||
import com.ljsd.jieling.logic.mission.MissionState;
|
||||
import com.ljsd.jieling.logic.mission.MissionType;
|
||||
import com.ljsd.jieling.util.ItemUtil;
|
||||
import com.ljsd.jieling.util.MathUtils;
|
||||
|
||||
import java.util.HashMap;
|
||||
|
|
@ -22,57 +26,22 @@ public class TreasureMissionType extends AbstractMissionType{
|
|||
}
|
||||
|
||||
|
||||
public void rewardMission(User user,int missionId, List<MissionStateChangeInfo> missionTypeEnumListMap, CumulationData cumulationData){
|
||||
STreasureTaskConfig sTreasureTaskConfig = STreasureTaskConfig.sTreasureTaskConfigMap.get(missionId);
|
||||
if(sTreasureTaskConfig == null){return;}
|
||||
int doingProgress = MissionLoigc.getDoingProgress(user,cumulationData, sTreasureTaskConfig.getTaskType(), sTreasureTaskConfig.getTaskValue()[0]);
|
||||
public void rewardMission(User user,int missionId, List<MissionStateChangeInfo> missionTypeEnumListMap, CumulationData cumulationData) throws Exception {
|
||||
STreasureSunlongTaskConfig taskConfig = STreasureSunlongTaskConfig.treasureTaskConfig.get(missionId);
|
||||
if(taskConfig == null){return;}
|
||||
// int doingProgress = MissionLoigc.getDoingProgress(user,cumulationData, taskConfig.getTaskType(), taskConfig.getTaskValue()[0]);
|
||||
//完成
|
||||
int finishParm = sTreasureTaskConfig.getTaskValue()[1][0];
|
||||
Integer takeTimes = this.takeTimes.get(missionId);
|
||||
if(takeTimes == null){
|
||||
takeTimes = 0;
|
||||
}
|
||||
int reallyTakeTimes = (doingProgress - takeTimes * finishParm) / finishParm;
|
||||
if(doingProgress!=0 && finishParm<0 && doingProgress>finishParm){
|
||||
reallyTakeTimes =1;
|
||||
}
|
||||
if(reallyTakeTimes>0){
|
||||
if(sTreasureTaskConfig.getTimes()>0){
|
||||
reallyTakeTimes = MathUtils.setBetweenWithMax(reallyTakeTimes,0,sTreasureTaskConfig.getTimes() - takeTimes);
|
||||
}
|
||||
int hadTakes = takeTimes + reallyTakeTimes;
|
||||
if(sTreasureTaskConfig.getTimes()>0 && hadTakes>=sTreasureTaskConfig.getTimes()){
|
||||
hadTakes = sTreasureTaskConfig.getTimes();
|
||||
}
|
||||
int[][] rewward = sTreasureTaskConfig.getRewward();
|
||||
int[][] rewardFinal = new int[rewward.length][];
|
||||
if(rewward.length>0){
|
||||
for(int i=0;i<rewward.length;i++){
|
||||
rewardFinal[i] = new int[2];
|
||||
rewardFinal[i][0] = rewward[i][0];
|
||||
rewardFinal[i][1] = rewward[i][1] * reallyTakeTimes;
|
||||
}
|
||||
}
|
||||
this.takeTimes.put(missionId,hadTakes);
|
||||
if(sTreasureTaskConfig.getTimes()>0 && this.takeTimes.get(missionId)>=sTreasureTaskConfig.getTimes()){
|
||||
getRewardedMissionIds().set(missionId);
|
||||
getDoingMissionIds().remove(missionId);
|
||||
getFinishMissionIds().remove(missionId);
|
||||
MissionStateChangeInfo stateChangeInfo = new MissionStateChangeInfo(missionId, MissionState.REWARD,reallyTakeTimes,hadTakes);
|
||||
if(rewward.length>0){
|
||||
stateChangeInfo.setRewwards(rewardFinal);
|
||||
}
|
||||
missionTypeEnumListMap.add(stateChangeInfo);
|
||||
return;
|
||||
}else{
|
||||
MissionStateChangeInfo stateChangeInfo = new MissionStateChangeInfo(missionId, MissionState.DOING,reallyTakeTimes,hadTakes);
|
||||
if(rewward.length>0){
|
||||
stateChangeInfo.setRewwards(rewardFinal);
|
||||
}
|
||||
missionTypeEnumListMap.add(stateChangeInfo);
|
||||
|
||||
}
|
||||
// int finishParm = taskConfig.getTaskValue()[1][0];
|
||||
// if(doingProgress<finishParm){
|
||||
// return;
|
||||
// }
|
||||
if (!getFinishMissionIds().contains(missionId)) {
|
||||
return ;
|
||||
}
|
||||
MissionStateChangeInfo stateChangeInfo = new MissionStateChangeInfo(missionId, MissionState.REWARD,taskConfig.getIntegral());
|
||||
missionTypeEnumListMap.add(stateChangeInfo);
|
||||
getFinishMissionIds().remove(missionId);
|
||||
getRewardedMissionIds().set(missionId);
|
||||
}
|
||||
|
||||
|
||||
|
|
@ -84,27 +53,22 @@ public class TreasureMissionType extends AbstractMissionType{
|
|||
@Override
|
||||
public void calCumulationDataResult(User user, CumulationData.Result result, List<MissionStateChangeInfo> missionStateChangeInfos, CumulationData cumulationData) {
|
||||
Set<Integer> doingMissionIds = getDoingMissionIds();
|
||||
List<STreasureTaskConfig> sTreasureTaskConfigs = STreasureTaskConfig.sTreasureTaskConfigListByTypeMap.get(result.subType.getMissionTypeValue());
|
||||
List<STreasureSunlongTaskConfig> sTreasureTaskConfigs = STreasureSunlongTaskConfig.sTreasureTaskConfigListByTypeMapTmp.get(result.subType.getMissionTypeValue());
|
||||
if(sTreasureTaskConfigs == null){
|
||||
return;
|
||||
}
|
||||
for(STreasureTaskConfig sTreasureTaskConfig : sTreasureTaskConfigs){
|
||||
for(STreasureSunlongTaskConfig sTreasureTaskConfig : sTreasureTaskConfigs){
|
||||
int id = sTreasureTaskConfig.getId();
|
||||
if(!doingMissionIds.contains(sTreasureTaskConfig.getId())){
|
||||
continue;
|
||||
}
|
||||
int doingProgress = MissionLoigc.getDoingProgress(user, cumulationData, sTreasureTaskConfig.getTaskType(), sTreasureTaskConfig.getTaskValue()[0]);
|
||||
int times = sTreasureTaskConfig.getTimes();
|
||||
//完成
|
||||
int finishParm = sTreasureTaskConfig.getTaskValue()[1][0];
|
||||
Integer takeTimes = this.takeTimes.get(id);
|
||||
if(takeTimes == null){
|
||||
takeTimes = 0;
|
||||
}
|
||||
if(times!=0 && (finishParm>0 && (takeTimes + doingProgress)/finishParm>=times || (doingProgress!=0 && finishParm<0 && (-takeTimes + doingProgress)>=finishParm) )){
|
||||
if( doingProgress>=finishParm){
|
||||
doingMissionIds.remove(id);
|
||||
getFinishMissionIds().add(id);
|
||||
MissionStateChangeInfo missionStateChangeInfo = new MissionStateChangeInfo(id, MissionState.FINISH,times-takeTimes,takeTimes);
|
||||
MissionStateChangeInfo missionStateChangeInfo = new MissionStateChangeInfo(id, MissionState.FINISH,doingProgress,0);
|
||||
missionStateChangeInfos.add(missionStateChangeInfo);
|
||||
continue;
|
||||
}
|
||||
|
|
@ -112,18 +76,19 @@ public class TreasureMissionType extends AbstractMissionType{
|
|||
continue;
|
||||
}
|
||||
|
||||
int sendProgress = (doingProgress - takeTimes * finishParm) / finishParm;
|
||||
int sendProgress = doingProgress;
|
||||
if(sTreasureTaskConfig.getTaskType() == MissionType.SENVER_HAPPY.getMissionTypeValue()){
|
||||
sendProgress = doingProgress;
|
||||
}
|
||||
if(sendProgress>=finishParm){
|
||||
MissionStateChangeInfo missionStateChangeInfo = new MissionStateChangeInfo(id, MissionState.FINISH,sendProgress,takeTimes);
|
||||
MissionStateChangeInfo missionStateChangeInfo = new MissionStateChangeInfo(id, MissionState.FINISH,sendProgress,0);
|
||||
missionStateChangeInfos.add(missionStateChangeInfo);
|
||||
}else{
|
||||
MissionStateChangeInfo missionStateChangeInfo = new MissionStateChangeInfo(id, MissionState.DOING,sendProgress,takeTimes);
|
||||
MissionStateChangeInfo missionStateChangeInfo = new MissionStateChangeInfo(id, MissionState.DOING,sendProgress,0);
|
||||
missionStateChangeInfos.add(missionStateChangeInfo);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public Map<Integer, Integer> getTakeTimes() {
|
||||
|
|
|
|||
|
|
@ -4,6 +4,7 @@ import com.ljsd.jieling.config.*;
|
|||
import com.ljsd.jieling.core.HandlerLogicThread;
|
||||
import com.ljsd.jieling.db.mongo.MongoUtil;
|
||||
import com.ljsd.jieling.globals.BIReason;
|
||||
import com.ljsd.jieling.globals.Global;
|
||||
import com.ljsd.jieling.ktbeans.KtEventUtils;
|
||||
import com.ljsd.jieling.ktbeans.parmsBean.ParamEventBean;
|
||||
import com.ljsd.jieling.logic.OnlineUserManager;
|
||||
|
|
@ -14,6 +15,7 @@ import com.ljsd.jieling.logic.dao.StoreInfo;
|
|||
import com.ljsd.jieling.logic.dao.StoreManager;
|
||||
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.mission.GameEvent;
|
||||
import com.ljsd.jieling.logic.mission.event.MissionEventDistributor;
|
||||
import com.ljsd.jieling.network.server.ProtocolsManager;
|
||||
|
|
@ -551,6 +553,10 @@ public class StoreLogic {
|
|||
return;
|
||||
}
|
||||
user.getPlayerInfoManager().setHadBuyTreasure(1);
|
||||
|
||||
MailLogic.getInstance().sendMail(session.getUid(),SErrorCodeEerverConfig.getI18NMessage("secret_extra_title"),SErrorCodeEerverConfig.getI18NMessage("secret_extra_txt"),SSpecialConfig.getStringValue(SSpecialConfig.SUNLONG_REWARD),(int)(TimeUtils.now()/1000), Global.MAIL_EFFECTIVE_TIME);
|
||||
MailLogic.getInstance().sendMail(session.getUid(),SErrorCodeEerverConfig.getI18NMessage("secret_daily_title"),SErrorCodeEerverConfig.getI18NMessage("secret_daily_txt"),SSpecialConfig.getStringValue(SSpecialConfig.SUNLONG_INTEGRAL),(int)(TimeUtils.now()/1000), Global.MAIL_EFFECTIVE_TIME);
|
||||
|
||||
MessageUtil.sendMessage(session, 1,msgId, null, true);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue