diff --git a/conf/server/EventPointConfig.txt b/conf/server/EventPointConfig.txt index cd6baf1f9..c24b4b0eb 100644 --- a/conf/server/EventPointConfig.txt +++ b/conf/server/EventPointConfig.txt @@ -13,9 +13,9 @@ int mut,int#int,1 100011 100013 100012 100014 100013 null -100014 100015#100016#100017#100018 -100015 100019#100020#100035#100036 -100016 null +100014 100015#100016 +100015 100017#100018 +100016 100019 100017 null 100018 null 100019 100021 @@ -32,6 +32,14 @@ int mut,int#int,1 100030 100032 100031 100033 100032 100034 +100033 100035#100036 +100034 100037#100038 +100035 100039#100040#100041#100042 +100036 100043#100044#100045#100046 +100037 100047#100048 +100038 100049#100050 +100039 100051 +0 null 101001 10101 101002 10102 101003 10103 diff --git a/conf/server/OptionConfig.txt b/conf/server/OptionConfig.txt index 1aa50cacf..c5722347d 100644 --- a/conf/server/OptionConfig.txt +++ b/conf/server/OptionConfig.txt @@ -14,12 +14,12 @@ int int int mut,int#int,2 mut,int#int,1 int mut,int#int,2 100012 0 1 10001 null 1 100011 100013 0 13 1 null 1 100012 100014 0 15 100004 null 4 null -100015 0 32 10101#100005|101#14#12#100006 null 4 null -100016 0 34 3#100005 null 4 null -100017 0 30 100#5#18#100006 null 4 null +100015 0 0 null null 1 100033 +100016 0 0 null null 5 100035 +100017 0 0 null null 4 null 100018 0 0 null null 4 null -100019 0 20 10101#100006 null 4 null -100020 0 33 10101#100006|100#14#13#100005 null 4 null +100019 0 15 100006 null 4 null +100020 0 0 null null 4 null 100021 0 0 null null 1 100020 100022 0 0 null null 5 100021 100023 0 0 null null 5 100022 @@ -34,10 +34,24 @@ int int int mut,int#int,2 mut,int#int,1 int mut,int#int,2 100032 0 0 null null 4 null 100033 0 0 null null 1 null 100034 0 0 null null 4 null -100035 0 30 100#5#17#100005 null 4 null -100036 0 0 null null 4 null -100037 0 0 null null 0 null -100038 0 0 null null 0 null +100035 0 0 null null 1 100034 +100036 0 0 null null 5 100035 +100037 0 0 null null 5 100035 +100038 0 0 null null 5 100035 +100039 0 1 10110 null 1 100036 +100040 0 6 2 null 1 100036 +100041 1 2 1503#1 null 1 100036 +100042 0 0 null null 1 100036 +100043 0 0 null 700001 5 100037 +100044 0 30 101#14#13#100006 null 5 100037 +100045 0 13 2 null 5 100037 +100046 0 0 null null 5 100014 +100047 0 0 null null 1 100038 +100048 0 15 100005 null 4 null +100049 0 0 null null 1 100039 +100050 0 15 100005 null 4 null +100051 0 15 100005 null 4 null +0 0 0 null null 0 null 101001 0 18 2#10110#101007 null 4 null 101002 0 0 null null 4 null 101003 0 0 null null 1 101009 diff --git a/conf/server/SkillConfig.txt b/conf/server/SkillConfig.txt index 854196ac1..738c283cf 100644 --- a/conf/server/SkillConfig.txt +++ b/conf/server/SkillConfig.txt @@ -1,622 +1,622 @@ -Id -int -1000111 -1000112 -1000113 -1000114 -1000115 -1000121 -1000122 -1000123 -1000124 -1000125 -1000211 -1000212 -1000213 -1000214 -1000215 -1000221 -1000222 -1000223 -1000224 -1000225 -1000311 -1000312 -1000313 -1000314 -1000315 -1000321 -1000322 -1000323 -1000324 -1000325 -1000411 -1000412 -1000413 -1000414 -1000415 -1000421 -1000422 -1000423 -1000424 -1000425 -1000511 -1000512 -1000513 -1000514 -1000515 -1000521 -1000522 -1000523 -1000524 -1000525 -1000611 -1000612 -1000613 -1000614 -1000615 -1000621 -1000622 -1000623 -1000624 -1000625 -1000711 -1000712 -1000713 -1000714 -1000715 -1000721 -1000722 -1000723 -1000724 -1000725 -1000811 -1000812 -1000813 -1000814 -1000815 -1000821 -1000822 -1000823 -1000824 -1000825 -1000911 -1000912 -1000913 -1000914 -1000915 -1000921 -1000922 -1000923 -1000924 -1000925 -1001011 -1001012 -1001013 -1001014 -1001015 -1001021 -1001022 -1001023 -1001024 -1001025 -1001111 -1001112 -1001113 -1001114 -1001115 -1001121 -1001122 -1001123 -1001124 -1001125 -1001211 -1001212 -1001213 -1001214 -1001215 -1001221 -1001222 -1001223 -1001224 -1001225 -1001311 -1001312 -1001313 -1001314 -1001315 -1001321 -1001322 -1001323 -1001324 -1001325 -1001411 -1001412 -1001413 -1001414 -1001415 -1001421 -1001422 -1001423 -1001424 -1001425 -1001511 -1001512 -1001513 -1001514 -1001515 -1001521 -1001522 -1001523 -1001524 -1001525 -1001611 -1001612 -1001613 -1001614 -1001615 -1001621 -1001622 -1001623 -1001624 -1001625 -1001711 -1001712 -1001713 -1001714 -1001715 -1001721 -1001722 -1001723 -1001724 -1001725 -1001811 -1001812 -1001813 -1001814 -1001815 -1001821 -1001822 -1001823 -1001824 -1001825 -1001911 -1001912 -1001913 -1001914 -1001915 -1001921 -1001922 -1001923 -1001924 -1001925 -1002011 -1002012 -1002013 -1002014 -1002015 -1002021 -1002022 -1002023 -1002024 -1002025 -1002111 -1002112 -1002113 -1002114 -1002115 -1002121 -1002122 -1002123 -1002124 -1002125 -1002211 -1002212 -1002213 -1002214 -1002215 -1002221 -1002222 -1002223 -1002224 -1002225 -1002311 -1002312 -1002313 -1002314 -1002315 -1002321 -1002322 -1002323 -1002324 -1002325 -1002411 -1002412 -1002413 -1002414 -1002415 -1002421 -1002422 -1002423 -1002424 -1002425 -1002511 -1002512 -1002513 -1002514 -1002515 -1002521 -1002522 -1002523 -1002524 -1002525 -1002611 -1002612 -1002613 -1002614 -1002615 -1002621 -1002622 -1002623 -1002624 -1002625 -1002711 -1002712 -1002713 -1002714 -1002715 -1002721 -1002722 -1002723 -1002724 -1002725 -1002811 -1002812 -1002813 -1002814 -1002815 -1002821 -1002822 -1002823 -1002824 -1002825 -1002911 -1002912 -1002913 -1002914 -1002915 -1002921 -1002922 -1002923 -1002924 -1002925 -1003011 -1003012 -1003013 -1003014 -1003015 -1003021 -1003022 -1003023 -1003024 -1003025 -1003111 -1003112 -1003113 -1003114 -1003115 -1003121 -1003122 -1003123 -1003124 -1003125 -1003211 -1003212 -1003213 -1003214 -1003215 -1003221 -1003222 -1003223 -1003224 -1003225 -1003311 -1003312 -1003313 -1003314 -1003315 -1003321 -1003322 -1003323 -1003324 -1003325 -1003411 -1003412 -1003413 -1003414 -1003415 -1003421 -1003422 -1003423 -1003424 -1003425 -1003511 -1003512 -1003513 -1003514 -1003515 -1003521 -1003522 -1003523 -1003524 -1003525 -1003611 -1003612 -1003613 -1003614 -1003615 -1003621 -1003622 -1003623 -1003624 -1003625 -1003711 -1003712 -1003713 -1003714 -1003715 -1003721 -1003722 -1003723 -1003724 -1003725 -1003811 -1003812 -1003813 -1003814 -1003815 -1003821 -1003822 -1003823 -1003824 -1003825 -1003911 -1003912 -1003913 -1003914 -1003915 -1003921 -1003922 -1003923 -1003924 -1003925 -1004011 -1004012 -1004013 -1004014 -1004015 -1004021 -1004022 -1004023 -1004024 -1004025 -1004111 -1004112 -1004113 -1004114 -1004115 -1004121 -1004122 -1004123 -1004124 -1004125 -1004211 -1004212 -1004213 -1004214 -1004215 -1004221 -1004222 -1004223 -1004224 -1004225 -1004311 -1004312 -1004313 -1004314 -1004315 -1004321 -1004322 -1004323 -1004324 -1004325 -1004411 -1004412 -1004413 -1004414 -1004415 -1004421 -1004422 -1004423 -1004424 -1004425 -1004511 -1004512 -1004513 -1004514 -1004515 -1004521 -1004522 -1004523 -1004524 -1004525 -1004611 -1004612 -1004613 -1004614 -1004615 -1004621 -1004622 -1004623 -1004624 -1004625 -1004711 -1004712 -1004713 -1004714 -1004715 -1004721 -1004722 -1004723 -1004724 -1004725 -1004811 -1004812 -1004813 -1004814 -1004815 -1004821 -1004822 -1004823 -1004824 -1004825 -1004911 -1004912 -1004913 -1004914 -1004915 -1004921 -1004922 -1004923 -1004924 -1004925 -1005011 -1005012 -1005013 -1005014 -1005015 -1005021 -1005022 -1005023 -1005024 -1005025 -1005111 -1005112 -1005113 -1005114 -1005115 -1005121 -1005122 -1005123 -1005124 -1005125 -1005211 -1005212 -1005213 -1005214 -1005215 -1005221 -1005222 -1005223 -1005224 -1005225 -500101 -500102 -500103 -500104 -500105 -500106 -500107 -500108 -500109 -500110 -500201 -500202 -500203 -500204 -500205 -500206 -500207 -500208 -500209 -500210 -500301 -500302 -500303 -500304 -500305 -500306 -500307 -500308 -500309 -500310 -500401 -500402 -500403 -500404 -500405 -500406 -500407 -500408 -500409 -500410 -500501 -500502 -500503 -500504 -500505 -500506 -500507 -500508 -500509 -500510 -500601 -500602 -500603 -500604 -500605 -500606 -500607 -500608 -500609 -500610 -500701 -500702 -500703 -500704 -500705 -500706 -500707 -500708 -500709 -500710 -500801 -500802 -500803 -500804 -500805 -500806 -500807 -500808 -500809 -500810 -500901 -500902 -500903 -500904 -500905 -500906 -500907 -500908 -500909 -500910 -501001 -501002 -501003 -501004 -501005 -501006 -501007 -501008 -501009 -501010 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/conf/server/StoreTypeConfig.txt b/conf/server/StoreTypeConfig.txt index a3db1426a..bac3ee296 100644 --- a/conf/server/StoreTypeConfig.txt +++ b/conf/server/StoreTypeConfig.txt @@ -1,5 +1,5 @@ -Id Number RefreshItem RefreshType StoreOpenRule StartTime EndTime -int int mut,int#int,2 mut,int#int,1 int string string -1 3 14|0#0#0#10000 2#5 1 0 0 -2 3 14|0#0#0#10000 3#2 1 0 0 -3 3 14|0#0#0#10000 1#0 2 0 30 +Id Number RefreshItem RefreshType IfManualRefresh StoreOpenRule StartTime EndTime +int int mut,int#int,2 mut,int#int,1 int int string string +1 3 14|0#0#0#10000 2#5 1 1 0 0 +2 3 14|0#0#0#10000 3#2 1 1 0 0 +3 3 14|0#0#0#10000 1#0 1 2 0 30 diff --git a/luafight/Modules/Battle/Logic/Base/Buff.lua b/luafight/Modules/Battle/Logic/Base/Buff.lua index 4a03f4df2..e6f1b87e4 100644 --- a/luafight/Modules/Battle/Logic/Base/Buff.lua +++ b/luafight/Modules/Battle/Logic/Base/Buff.lua @@ -87,6 +87,7 @@ function BuffManager:AddBuff(target, buff) --end buff.frameInterval = floor(buff.interval * BattleLogic.GameFrameRate) + buff.caster.Event:DispatchEvent(BattleEventName.BuffCaster, buff) end function BuffManager:HasBuff(target, type, checkFunc) diff --git a/luafight/Modules/Battle/Logic/Base/Passivity.lua b/luafight/Modules/Battle/Logic/Base/Passivity.lua index 6d6a123c5..512be413a 100644 --- a/luafight/Modules/Battle/Logic/Base/Passivity.lua +++ b/luafight/Modules/Battle/Logic/Base/Passivity.lua @@ -121,7 +121,7 @@ local passivityList = { for i=1, skill.effectList.size do duration = max(duration, skill.effectList.buffer[i].duration) end - role:AddPropertyTransfer(propertyList[pro1], f2, propertyList[pro2], duration) + role:AddPropertyTransfer(propertyList[pro1], f2, propertyList[pro2], duration + BattleLogic.GameDeltaTime * 2) end) end role.Event:AddEvent(BattleEventName.SkillCast, OnSkillCast) @@ -187,7 +187,7 @@ local passivityList = { local OnSkillCastEnd = function(skill) BattleUtil.RandomAction(f1, function () - local arr = chooseTarget(role, 10111) + local arr = chooseTarget(role, 10321) if arr[1] then arr[1]:AddBuff(Buff.Create(role, BuffName.HOT, f3, 1, floor(role:GetRoleData(propertyList[pro]) * f2))) end @@ -302,7 +302,7 @@ local passivityList = { damagingFunc(floor(role:GetRoleData(propertyList[pro]) * f2)) end) end - role.Event:AddEvent(BattleEventName.PassiveDamaging, OnPassiveDamaging) + role.Event:AddEvent(BattleEventName.PassiveBeDamaging, OnPassiveDamaging) end, --受击后,有[a]的概率对敌方全体造成攻击*[c]的[d]伤害 @@ -351,7 +351,7 @@ local passivityList = { BattleUtil.RandomAction(f1, function () local arr = chooseTarget(role, 20001) if arr[1] then - BattleUtil.ApplyDamage(role, atkRole, floor(role:GetRoleData(propertyList[pro]) * f2)) + BattleUtil.ApplyDamage(role, arr[1], floor(role:GetRoleData(propertyList[pro]) * f2)) end end) lastTrigger = 0 @@ -521,7 +521,7 @@ local passivityList = { [22] = function(role, args) local f1 = args[1] local f2 = args[2] - local f3 = args[2] + local f3 = args[3] local triggerCount = 0 local OnDamaged = function(atkRole) @@ -634,12 +634,12 @@ local passivityList = { local f1 = args[1] local f2 = args[2] - local OnRoleDamageBefore = function(defRole, factorFunc) + local OnPassiveDamaging = function(damagingFunc, defRole, damage) if BattleUtil.GetHPPencent(defRole) > f1 then - factorFunc(f2) + damagingFunc(-floor(f2 * damage)) end end - role.Event:AddEvent(BattleEventName.RoleDamageBefore, OnRoleDamageBefore) + role.Event:AddEvent(BattleEventName.PassiveDamaging, OnPassiveDamaging) end, --对血量低于[a]的敌人伤害提高[b]。 @@ -648,12 +648,12 @@ local passivityList = { local f1 = args[1] local f2 = args[2] - local OnRoleDamageBefore = function(defRole, factorFunc) + local OnPassiveDamaging = function(damagingFunc, defRole, damage) if BattleUtil.GetHPPencent(defRole) < f1 then - factorFunc(f2) + damagingFunc(-floor(f2 * damage)) end end - role.Event:AddEvent(BattleEventName.RoleDamageBefore, OnRoleDamageBefore) + role.Event:AddEvent(BattleEventName.PassiveDamaging, OnPassiveDamaging) end, --发动技能后,[d]改变敌方全体[a]属性[b],持续[c]秒 @@ -725,7 +725,7 @@ local passivityList = { local OnPassiveDamaging = function(damagingFunc) damagingFunc(-f1) end - role.Event:AddEvent(BattleEventName.PassiveDamaging, OnPassiveDamaging) + role.Event:AddEvent(BattleEventName.PassiveBeDamaging, OnPassiveDamaging) end, --进入战斗[a]秒后,造成的伤害提升[b],持续[c]秒 @@ -825,10 +825,10 @@ local passivityList = { [41] = function(role, args) local f1 = args[1] - local OnDamaged = function(atkRole, damage, bCrit, finalDmg) + local OnDamage = function(defRole, damage, bCrit, finalDmg) BattleUtil.CalTreat(role, role, floor(f1 * finalDmg)) end - role.Event:AddEvent(BattleEventName.RoleBeDamaged, OnDamaged) + role.Event:AddEvent(BattleEventName.RoleDamage, OnDamage) end, --造成暴击伤害时,有[a]的概率造成[b]的暴击伤害。 diff --git a/luafight/Modules/Battle/Logic/Misc/BattleDefine.lua b/luafight/Modules/Battle/Logic/Misc/BattleDefine.lua index eecd3f590..18a251523 100644 --- a/luafight/Modules/Battle/Logic/Misc/BattleDefine.lua +++ b/luafight/Modules/Battle/Logic/Misc/BattleDefine.lua @@ -35,6 +35,7 @@ BattleEventName = { SkillCastEnd = indexAdd(), PassiveTreating = indexAdd(), + PassiveBeDamaging = indexAdd(), PassiveDamaging = indexAdd(), PassiveCriting = indexAdd(), diff --git a/luafight/Modules/Battle/Logic/Misc/BattleUtil.lua b/luafight/Modules/Battle/Logic/Misc/BattleUtil.lua index 9db98899f..b242cec23 100644 --- a/luafight/Modules/Battle/Logic/Misc/BattleUtil.lua +++ b/luafight/Modules/Battle/Logic/Misc/BattleUtil.lua @@ -75,20 +75,12 @@ function BattleUtil.ApplyDamage(atkRole, defRole, damage, bCrit, damageType) --加入被动效果 local damagingFunc = function(dmgDeduction) damage = damage - dmgDeduction end - defRole.Event:DispatchEvent(BattleEventName.PassiveDamaging, damagingFunc) + atkRole.Event:DispatchEvent(BattleEventName.PassiveDamaging, damagingFunc, defRole, damage) + defRole.Event:DispatchEvent(BattleEventName.PassiveBeDamaging, damagingFunc, atkRole, damage) if damage > 0 then local finalDmg = defRole.data:SubValue(RoleDataName.Hp, damage) if finalDmg > 0 then - if atkRole then - atkRole.Event:DispatchEvent(BattleEventName.RoleDamage, defRole, damage, bCrit, finalDmg, damageType) - end - defRole.Event:DispatchEvent(BattleEventName.RoleBeDamaged, atkRole, damage, bCrit, finalDmg, damageType) - if bCrit then - atkRole.Event:DispatchEvent(BattleEventName.RoleCrit, defRole) - defRole.Event:DispatchEvent(BattleEventName.RoleBeCrit, atkRole) - end - if defRole:GetRoleData(RoleDataName.Hp) <= 0 then defRole.isDead = true BattleLogic.BuffMgr:ClearBuff(defRole) @@ -100,6 +92,15 @@ function BattleUtil.ApplyDamage(atkRole, defRole, damage, bCrit, damageType) end) end end + + if atkRole then + atkRole.Event:DispatchEvent(BattleEventName.RoleDamage, defRole, damage, bCrit, finalDmg, damageType) + end + defRole.Event:DispatchEvent(BattleEventName.RoleBeDamaged, atkRole, damage, bCrit, finalDmg, damageType) + if bCrit then + atkRole.Event:DispatchEvent(BattleEventName.RoleCrit, defRole) + defRole.Event:DispatchEvent(BattleEventName.RoleBeCrit, atkRole) + end end return finalDmg else @@ -190,8 +191,8 @@ function BattleUtil.ApplyTreat(castRole, targetRole, value, baseFactor) baseFactor = baseFactor or 1 local maxHp = targetRole:GetRoleData(RoleDataName.MaxHp) local hp = targetRole:GetRoleData(RoleDataName.Hp) - local factor = castRole:GetRoleData(RoleDataName.TreatFacter) + 1 - local factor2 = targetRole:GetRoleData(RoleDataName.CureFacter) + 1 + local factor = castRole:GetRoleData(RoleDataName.TreatFacter) + local factor2 = targetRole:GetRoleData(RoleDataName.CureFacter) local baseTreat = floor(value * baseFactor * factor * factor2 + 0.5) --加入被动效果 diff --git a/luafight/Modules/Battle/Logic/RoleLogic.lua b/luafight/Modules/Battle/Logic/RoleLogic.lua index 18750f0da..2944543ab 100644 --- a/luafight/Modules/Battle/Logic/RoleLogic.lua +++ b/luafight/Modules/Battle/Logic/RoleLogic.lua @@ -154,7 +154,6 @@ function RoleLogic:AddBuff(buff) return end end - buff.caster.Event:DispatchEvent(BattleEventName.BuffCaster, buff) BattleLogic.BuffMgr:AddBuff(self, buff) end diff --git a/serverlogic/src/main/java/com/ljsd/jieling/config/SStoreTypeConfig.java b/serverlogic/src/main/java/com/ljsd/jieling/config/SStoreTypeConfig.java index 5998688c6..05a7e7f82 100644 --- a/serverlogic/src/main/java/com/ljsd/jieling/config/SStoreTypeConfig.java +++ b/serverlogic/src/main/java/com/ljsd/jieling/config/SStoreTypeConfig.java @@ -20,17 +20,18 @@ public class SStoreTypeConfig implements BaseConfig { private String endTime; + private int ifManualRefresh; @Override public void init() throws Exception { sStoreTypeConfigMap = STableManager.getConfig(SStoreTypeConfig.class); } - public static Map getSstoreTypeConfigMap (){ + public static Map getsStoreTypeConfigMap() { return sStoreTypeConfigMap; } - public int getId() { + public int getId() { return id; } @@ -57,4 +58,7 @@ public class SStoreTypeConfig implements BaseConfig { public int getNumber() { return number; } + public int getIfManualRefresh() { + return ifManualRefresh; + } } \ No newline at end of file diff --git a/serverlogic/src/main/java/com/ljsd/jieling/handler/GetPlayerInfoHandler.java b/serverlogic/src/main/java/com/ljsd/jieling/handler/GetPlayerInfoHandler.java index 7aa668cd5..e5d39f2f3 100644 --- a/serverlogic/src/main/java/com/ljsd/jieling/handler/GetPlayerInfoHandler.java +++ b/serverlogic/src/main/java/com/ljsd/jieling/handler/GetPlayerInfoHandler.java @@ -5,6 +5,7 @@ import com.ljsd.jieling.logic.activity.ActivityLogic; import com.ljsd.jieling.logic.activity.ActivityType; import com.ljsd.jieling.logic.dao.UserManager; import com.ljsd.jieling.logic.dao.root.User; +import com.ljsd.jieling.logic.store.StoreLogic; import com.ljsd.jieling.netty.cocdex.PacketNetData; import com.ljsd.jieling.network.session.ISession; import com.ljsd.jieling.protocols.CommonProto; @@ -50,6 +51,8 @@ public class GetPlayerInfoHandler extends BaseHandler{ MapLogic.getInstance().resetDayInfo(user); //活动刷新 ActivityLogic.getInstance().flushEveryDay(user); + //商店刷新次数重置 + StoreLogic.resetStoreRefreshNum(userId); } user.getPlayerInfoManager().setLoginTime(TimeUtils.now()); Map guidePoints = user.getPlayerInfoManager().getGuidePoints(); diff --git a/serverlogic/src/main/java/com/ljsd/jieling/handler/store/BuyStoreItemHandler.java b/serverlogic/src/main/java/com/ljsd/jieling/handler/store/BuyStoreItemHandler.java new file mode 100644 index 000000000..87871ab93 --- /dev/null +++ b/serverlogic/src/main/java/com/ljsd/jieling/handler/store/BuyStoreItemHandler.java @@ -0,0 +1,25 @@ +package com.ljsd.jieling.handler.store; + +import com.ljsd.jieling.handler.BaseHandler; +import com.ljsd.jieling.logic.store.StoreLogic; +import com.ljsd.jieling.netty.cocdex.PacketNetData; +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 BuyStoreItemHandler extends BaseHandler { + + @Override + public MessageTypeProto.MessageType getMessageCode() { + return MessageTypeProto.MessageType.BUY_STORE_ITEM_REQUEST; + } + + @Override + public void process(ISession iSession, PacketNetData netData) throws Exception { + PlayerInfoProto.BuyStoreItemRequest buyStoreItemRequest + = PlayerInfoProto.BuyStoreItemRequest.parseFrom(netData.parseClientProtoNetData()); + StoreLogic.buyStoreItem(iSession,buyStoreItemRequest.getStoreId(),buyStoreItemRequest.getItemId(),buyStoreItemRequest.getItemNum()); + } +} diff --git a/serverlogic/src/main/java/com/ljsd/jieling/handler/store/StoreRefreItemHandler.java b/serverlogic/src/main/java/com/ljsd/jieling/handler/store/StoreRefreItemHandler.java new file mode 100644 index 000000000..8b8a08af8 --- /dev/null +++ b/serverlogic/src/main/java/com/ljsd/jieling/handler/store/StoreRefreItemHandler.java @@ -0,0 +1,31 @@ +package com.ljsd.jieling.handler.store; + +import com.ljsd.jieling.handler.BaseHandler; +import com.ljsd.jieling.logic.store.StoreLogic; +import com.ljsd.jieling.netty.cocdex.PacketNetData; +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 StoreRefreItemHandler extends BaseHandler { + + @Override + public MessageTypeProto.MessageType getMessageCode() { + return MessageTypeProto.MessageType.BUY_STORE_ITEM_REQUEST; + } + + @Override + public void process(ISession iSession, PacketNetData netData) throws Exception { + PlayerInfoProto.StoreGoodsRefreshRequest buyStoreItemRequest + = PlayerInfoProto.StoreGoodsRefreshRequest.parseFrom(netData.parseClientProtoNetData()); + int type = buyStoreItemRequest.getType(); + int storeId = buyStoreItemRequest.getStoreId(); + if (type ==0){ + StoreLogic.handRefreStore(iSession,storeId); + }else if (type ==1){ + StoreLogic.automaticRefreStore(iSession,storeId); + } + } +} diff --git a/serverlogic/src/main/java/com/ljsd/jieling/logic/dao/StoreInfo.java b/serverlogic/src/main/java/com/ljsd/jieling/logic/dao/StoreInfo.java index 4c050be6d..00c1aa6ff 100644 --- a/serverlogic/src/main/java/com/ljsd/jieling/logic/dao/StoreInfo.java +++ b/serverlogic/src/main/java/com/ljsd/jieling/logic/dao/StoreInfo.java @@ -2,6 +2,7 @@ package com.ljsd.jieling.logic.dao; import com.ljsd.common.mogodb.MongoBase; +import java.util.List; import java.util.Map; public class StoreInfo extends MongoBase { @@ -38,6 +39,7 @@ public class StoreInfo extends MongoBase { } public void setItemNumMap(Map itemNumMap) { + updateString("itemNumMap", itemNumMap); this.itemNumMap = itemNumMap; } diff --git a/serverlogic/src/main/java/com/ljsd/jieling/logic/mail/MailLogic.java b/serverlogic/src/main/java/com/ljsd/jieling/logic/mail/MailLogic.java index 6e8b8e822..11f8ebbc1 100644 --- a/serverlogic/src/main/java/com/ljsd/jieling/logic/mail/MailLogic.java +++ b/serverlogic/src/main/java/com/ljsd/jieling/logic/mail/MailLogic.java @@ -254,5 +254,6 @@ public class MailLogic { User user = UserManager.getUser(uid); Mail mail = new Mail(uid,title,content,reward,sendTime, mailEffectiveTime,"system",Global.MAIL_TYPE_SYS); user.getMailManager().addMail(mail); + LOGGER.info("sendMail==>uid={},title={},reward:{}",uid,title,reward); } } diff --git a/serverlogic/src/main/java/com/ljsd/jieling/logic/store/StoreLogic.java b/serverlogic/src/main/java/com/ljsd/jieling/logic/store/StoreLogic.java index 54eed30e0..6c47e1d85 100644 --- a/serverlogic/src/main/java/com/ljsd/jieling/logic/store/StoreLogic.java +++ b/serverlogic/src/main/java/com/ljsd/jieling/logic/store/StoreLogic.java @@ -3,7 +3,7 @@ package com.ljsd.jieling.logic.store; import ch.qos.logback.core.util.TimeUtil; import com.ljsd.jieling.config.SStoreConfig; import com.ljsd.jieling.config.SStoreTypeConfig; -import com.ljsd.jieling.handler.store.GetAllStoreHandler; +import com.ljsd.jieling.logic.dao.PlayerManager; import com.ljsd.jieling.logic.dao.StoreInfo; import com.ljsd.jieling.logic.dao.StoreManager; import com.ljsd.jieling.logic.dao.UserManager; @@ -12,7 +12,9 @@ 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.ItemUtil; import com.ljsd.jieling.util.MessageUtil; +import com.ljsd.jieling.util.StringUtil; import com.ljsd.jieling.util.TimeUtils; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -33,42 +35,62 @@ public class StoreLogic { User user = UserManager.getUser(uid); StoreManager storeManager = user.getStoreManager(); if (storeManager.getStoreInfoMap().size() == 0){ - initStoreInfo(storeManager); + initStoreInfo(user,storeManager); } - PlayerInfoProto.GetStoreInfos.Builder builder = PlayerInfoProto.GetStoreInfos.newBuilder(); + PlayerInfoProto.GetStoreInfosResponse.Builder builder = PlayerInfoProto.GetStoreInfosResponse.newBuilder(); Map storeInfoMap = storeManager.getStoreInfoMap(); + checkStoreRefresh(storeManager,storeInfoMap); List storeInfos = new CopyOnWriteArrayList<>(); for (Map.Entry entry: storeInfoMap.entrySet()){ - CommonProto.StoreInfo.Builder storeBuilder = CommonProto.StoreInfo.newBuilder(); - StoreInfo storeInfo = entry.getValue(); - storeBuilder.setId(storeInfo.getId()); - storeBuilder.setLastRefreshTime(storeInfo.getLastRefreshTime()); - storeBuilder.setRefreshNum(storeInfo.getRefreshNum()); - storeBuilder.setStartTime(storeInfo.getStartTime()); - storeBuilder.setEndTime(storeInfo.getEndTime()); - Map itemNumMap = storeInfo.getItemNumMap(); - List builderList = new CopyOnWriteArrayList<>(); - for (Map.Entry entry1: itemNumMap.entrySet()){ - int itemId = entry1.getKey(); - int buyNum = entry1.getValue(); - CommonProto.StoreItem.Builder storeItemBuilder = CommonProto.StoreItem.newBuilder(); - storeItemBuilder.setId(itemId); - storeItemBuilder.setBuyNum(buyNum); - builderList.add(storeItemBuilder.build()); - } - storeBuilder.addAllStoreItem(builderList); + CommonProto.StoreInfo.Builder storeBuilder = getBuilder(entry.getValue()); storeInfos.add(storeBuilder.build()); } builder.addAllStoreInfo(storeInfos); MessageUtil.sendMessage(iSession, 1,msgId, builder.build(), true); } + + private static CommonProto.StoreInfo.Builder getBuilder(StoreInfo storeInfo) { + CommonProto.StoreInfo.Builder storeBuilder = CommonProto.StoreInfo.newBuilder(); + storeBuilder.setId(storeInfo.getId()); + storeBuilder.setLastRefreshTime(storeInfo.getLastRefreshTime()); + storeBuilder.setRefreshNum(storeInfo.getRefreshNum()); + storeBuilder.setStartTime(storeInfo.getStartTime()); + storeBuilder.setEndTime(storeInfo.getEndTime()); + Map itemNumMap = storeInfo.getItemNumMap(); + List builderList = new CopyOnWriteArrayList<>(); + for (Map.Entry entry1: itemNumMap.entrySet()){ + int itemId = entry1.getKey(); + int buyNum = entry1.getValue(); + CommonProto.StoreItem.Builder storeItemBuilder = CommonProto.StoreItem.newBuilder(); + storeItemBuilder.setId(itemId); + storeItemBuilder.setBuyNum(buyNum); + builderList.add(storeItemBuilder.build()); + } + storeBuilder.addAllStoreItem(builderList); + return storeBuilder; + } + + //检测商店刷新 + private static void checkStoreRefresh(StoreManager storeManager,Map storeInfoMap) { + long nowTime = System.currentTimeMillis(); + for (Map.Entry entry:storeInfoMap.entrySet()){ + StoreInfo storeInfo = entry.getValue(); + SStoreTypeConfig sStoreTypeConfig = SStoreTypeConfig.getsStoreTypeConfigMap().get(storeInfo.getId()); + if (sStoreTypeConfig.getStoreOpenRule() ==2){ + if ((nowTime - storeInfo.getEndTime()) > Integer.parseInt(sStoreTypeConfig.getEndTime()) * 60 *1000){ + storeManager.removeStoreInfo(storeInfo.getId()); + } + } + } + } + //初始化商店 - private static void initStoreInfo(StoreManager storeManager) throws Exception { - Map sstoreTypeConfigMap = SStoreTypeConfig.getSstoreTypeConfigMap(); + private static void initStoreInfo(User user,StoreManager storeManager) throws Exception { + Map sstoreTypeConfigMap = SStoreTypeConfig.getsStoreTypeConfigMap(); for ( Map.Entry entry :sstoreTypeConfigMap.entrySet()){ SStoreTypeConfig sStoreTypeConfig = entry.getValue(); if (sStoreTypeConfig.getStoreOpenRule() == 1){ //固定商店 - Map itemNumMap = getStoreItem(sStoreTypeConfig.getId(),sStoreTypeConfig.getNumber()); + Map itemNumMap = getStoreItem(sStoreTypeConfig.getId(),sStoreTypeConfig,user); long startTime = 0; long endTime = 0; if (!sStoreTypeConfig.getStartTime().equals("0")){ @@ -85,16 +107,17 @@ public class StoreLogic { /** * 随机获得商店物品 */ - private static Map getStoreItem(int storeId,int itemNum) { + private static Map getStoreItem(int storeId, SStoreTypeConfig sStoreTypeConfig ,User user) { Map itemNumMap = new ConcurrentHashMap<>(); - for (int i = 1; i <= itemNum; i ++){ - int rewardId = getRewardId(storeId,i); + for (int i = 1; i <= sStoreTypeConfig.getNumber(); i ++){ + int rewardId = getRewardId(storeId,i,user); itemNumMap.put(rewardId, 0); } return itemNumMap; } - private static int getRewardId(int storeId,int sort) { + private static int getRewardId(int storeId,int sort,User user) { + PlayerManager playerInfoManager = user.getPlayerInfoManager(); List sstoreConfigBuyStore = SStoreConfig.getSstoreConfigBuyStore(storeId); List randomSstoreConfigList = new CopyOnWriteArrayList<>(); int totalWeight = 0; @@ -102,8 +125,12 @@ public class StoreLogic { if (sort != sStoreConfig.getSort()){ continue; } - totalWeight += sStoreConfig.getWeight(); - randomSstoreConfigList.add(sStoreConfig); + int minLv = sStoreConfig.getOpenLv()[0]; + int maxLv = sStoreConfig.getOpenLv()[1]; + if (minLv <= playerInfoManager.getLevel() && maxLv >= playerInfoManager.getLevel()){ + totalWeight += sStoreConfig.getWeight(); + randomSstoreConfigList.add(sStoreConfig); + } } int weight = 0; int rewardId = 0; @@ -118,4 +145,156 @@ public class StoreLogic { } return rewardId; } + + /** + * 购买商店物品 + * @param iSession + * @param storeId + * @param itemId + * @throws Exception + */ + public static void buyStoreItem(ISession iSession,int storeId, int itemId,int itemNum) throws Exception { + int msgId = MessageTypeProto.MessageType.BUY_STORE_ITEM_RESPONSE_VALUE; + int uid = iSession.getUid(); + if (itemNum < 0|| itemNum >999){ + LOGGER.info("buyStoreItem==> uid={},itemNum={}",uid,itemNum); + MessageUtil.sendErrorResponse(iSession,0,msgId,""); + return; + } + User user = UserManager.getUser(uid); + Map storeInfoMap = user.getStoreManager().getStoreInfoMap(); + if (!storeInfoMap.containsKey(storeId)){ + LOGGER.info("buyStoreItem==> uid={},storeId={}",uid,storeId); + MessageUtil.sendErrorResponse(iSession,0,msgId,""); + return; + } + StoreInfo storeInfo = storeInfoMap.get(storeId); + Map itemNumMap =storeInfo.getItemNumMap(); + if (!itemNumMap.containsKey(itemId)){ + LOGGER.info("buyStoreItem==> uid={},itemId={}",uid,itemId); + MessageUtil.sendErrorResponse(iSession,0,msgId,""); + return; + } + int buyTimes = itemNumMap.get(itemId); + SStoreConfig sStoreConfig = SStoreConfig.getSstoreConfigMap().get(itemId); + String cost = getCost(buyTimes,sStoreConfig.getCost()); + boolean result = ItemUtil.itemCost(user, StringUtil.parseFiledInt2(cost)); + if (!result){ + MessageUtil.sendErrorResponse(iSession,0,msgId,"道具不足"); + return; + } + itemNumMap.put(itemId,buyTimes +1); + storeInfo.setItemNumMap(itemNumMap); + int goodsId = sStoreConfig.getGoods()[0]; + int goodsNum = sStoreConfig.getGoods()[0]*itemNum; + String reward = goodsId +"#"+goodsNum; + CommonProto.Drop.Builder drop = ItemUtil.drop(user, StringUtil.parseFiledInt2(reward)); + PlayerInfoProto.BuyStoreItemResponse builder = PlayerInfoProto.BuyStoreItemResponse.newBuilder().setDrop(drop).build(); + MessageUtil.sendMessage(iSession, 1,msgId, builder, true); + } + + private static String getCost(int buyTimes, int[][] costs) { + int costItemId = costs[0][0]; + int[] ints = costs[1]; + int costNum = (int) (Math.ceil(Math.pow(ints[0], 3)) *buyTimes) + (int) (Math.ceil(Math.pow(ints[1], 2)) *buyTimes) +(int) (Math.ceil(Math.pow(ints[2], 1)) *buyTimes) + ints[3]; + String cost = costItemId +"#"+costNum; + return cost; + } + + //手动刷新商店 + public static void handRefreStore(ISession iSession,int storeId) throws Exception { + int msgId = MessageTypeProto.MessageType.STORE_GOODS_REFRESH_RESPONSE_VALUE; + int uid = iSession.getUid(); + User user = UserManager.getUser(uid); + StoreManager storeManager = user.getStoreManager(); + Map storeInfoMap = storeManager.getStoreInfoMap(); + if (!storeInfoMap.containsKey(storeId)){ + LOGGER.info("handRefreStore==> uid={},storeId={}",uid,storeId); + MessageUtil.sendErrorResponse(iSession,0,msgId,""); + return; + } + StoreInfo storeInfo = storeInfoMap.get(storeId); + SStoreTypeConfig sStoreTypeConfig = SStoreTypeConfig.getsStoreTypeConfigMap().get(storeId); + if (sStoreTypeConfig.getIfManualRefresh() != 1){ + LOGGER.info("handRefreStore==> uid={},storeId={},ifManualRefresh={}",uid,storeId,sStoreTypeConfig.getIfManualRefresh()); + MessageUtil.sendErrorResponse(iSession,0,msgId,""); + return; + } + int refreshNum = storeInfo.getRefreshNum(); + String cost = getCost(refreshNum, sStoreTypeConfig.getRefreshItem()); + boolean result = ItemUtil.itemCost(user, StringUtil.parseFiledInt2(cost)); + if (!result){ + MessageUtil.sendErrorResponse(iSession,0,msgId,"道具不足"); + return; + } + Map itemNumMap = getStoreItem(sStoreTypeConfig.getId(),sStoreTypeConfig,user); + storeInfo.setRefreshNum(storeInfo.getRefreshNum() +1); + storeInfo.setItemNumMap(itemNumMap); + CommonProto.StoreInfo.Builder storeBuilder = getBuilder(storeInfo); + PlayerInfoProto.StoreGoodsRefreshResponse builder = PlayerInfoProto.StoreGoodsRefreshResponse.newBuilder().setStoreInfo(storeBuilder).build(); + MessageUtil.sendMessage(iSession, 1,msgId, builder, true); + } + //自动刷新商店 + public static void automaticRefreStore(ISession iSession,int storeId) throws Exception { + int msgId = MessageTypeProto.MessageType.STORE_GOODS_REFRESH_RESPONSE_VALUE; + int uid = iSession.getUid(); + User user = UserManager.getUser(uid); + StoreManager storeManager = user.getStoreManager(); + Map storeInfoMap = storeManager.getStoreInfoMap(); + if (!storeInfoMap.containsKey(storeId)){ + LOGGER.info("handRefreStore==> uid={},storeId={}",uid,storeId); + MessageUtil.sendErrorResponse(iSession,0,msgId,""); + return; + } + StoreInfo storeInfo = storeInfoMap.get(storeId); + SStoreTypeConfig sStoreTypeConfig = SStoreTypeConfig.getsStoreTypeConfigMap().get(storeId); + int type = sStoreTypeConfig.getRefreshType()[0]; + if (type == 1){ + MessageUtil.sendErrorResponse(iSession,0,msgId,""); + LOGGER.info("automaticRefreStore==>uid={},storeid={},type={}",uid,storeId,type); + return; + } + Map itemNumMap = null; + long nowTime = System.currentTimeMillis(); + switch (type){ + case 2: + boolean overTime = TimeUtils.isOverTime(5, storeInfo.getLastRefreshTime()); + if (overTime){ + itemNumMap = getStoreItem(sStoreTypeConfig.getId(),sStoreTypeConfig,user); + } + break; + case 3: + if ((nowTime - storeInfo.getEndTime()) > Integer.parseInt(sStoreTypeConfig.getEndTime()) *60 *1000){ + itemNumMap = getStoreItem(sStoreTypeConfig.getId(),sStoreTypeConfig,user); + } + break; + } + if (itemNumMap == null){ + MessageUtil.sendErrorResponse(iSession,0,msgId,""); + LOGGER.info("automaticRefreStore==>uid={},storeid={},type={}",uid,storeId,type); + return; + } + storeInfo.setItemNumMap(itemNumMap); + storeInfo.setLastRefreshTime(nowTime); + storeInfo.setRefreshNum(storeInfo.getRefreshNum() +1); + CommonProto.StoreInfo.Builder storeBuilder = getBuilder(storeInfo); + PlayerInfoProto.StoreGoodsRefreshResponse builder = PlayerInfoProto.StoreGoodsRefreshResponse.newBuilder().setStoreInfo(storeBuilder).build(); + MessageUtil.sendMessage(iSession, 1,msgId, builder, true); + } + + /** + * 重置商店刷新次数 + * @param uid + * @throws Exception + */ + public static void resetStoreRefreshNum(int uid) throws Exception { + User user = UserManager.getUser(uid); + StoreManager storeManager = user.getStoreManager(); + Map storeInfoMap = storeManager.getStoreInfoMap(); + for (Map.Entry entry: storeInfoMap.entrySet()){ + StoreInfo storeInfo = entry.getValue(); + storeInfo.setRefreshNum(0); + } + } } + diff --git a/serverlogic/src/main/java/com/ljsd/jieling/util/ItemUtil.java b/serverlogic/src/main/java/com/ljsd/jieling/util/ItemUtil.java index 3926bdf3f..83b782d17 100644 --- a/serverlogic/src/main/java/com/ljsd/jieling/util/ItemUtil.java +++ b/serverlogic/src/main/java/com/ljsd/jieling/util/ItemUtil.java @@ -537,7 +537,7 @@ public class ItemUtil { for (Map.Entry entry : equipMap.entrySet()) { int count = entry.getValue(); for (int i = 0; i < count; i++) { - if (user.getEquipManager().getEquipMap().size() > gameSetting.getEquipNumlimit()) { + if (user.getEquipManager().getEquipMap().size() >= gameSetting.getEquipNumlimit()) { if (reward.length() == 0){ reward = new StringBuilder(entry.getKey() + "#1"); }else{ @@ -587,13 +587,36 @@ public class ItemUtil { if (cardMap.isEmpty()) { return; } + SGameSetting gameSetting = SGameSetting.getGameSetting(); + int hasHeroNum = user.getHeroManager().getHeroMap().size(); + String title = SErrorCodeEerverConfig.getI18NMessage("card_bag_limit_title"); + String content = SErrorCodeEerverConfig.getI18NMessage("card_bag_limit_txt"); + if (hasHeroNum >= gameSetting.getHeroNumlimit()){ + String reward = getLimitReward(cardMap); + int nowTime =(int) (TimeUtils.now()/1000); + MailLogic.getInstance().sendMail(Integer.parseInt(user.getId()),title,content,reward,nowTime,Global.MAIL_EFFECTIVE_TIME); + return; + } List heroList = new CopyOnWriteArrayList<>(); + StringBuilder reward = new StringBuilder(); for (Map.Entry entry : cardMap.entrySet()) { int count = entry.getValue(); for (int i = 0; i < count; i++) { + if (user.getHeroManager().getHeroMap().size() >= gameSetting.getHeroNumlimit()) { + if (reward.length() == 0){ + reward = new StringBuilder(entry.getKey() + "#1"); + }else{ + reward.append("|").append(entry.getKey()).append("#1"); + } + continue; + } addCard(user, entry.getKey(),heroList); } } + if (reward.length() > 0) { + int nowTime = (int) (TimeUtils.now() / 1000); + MailLogic.getInstance().sendMail(Integer.parseInt(user.getId()), title, content, reward.toString(), nowTime, Global.MAIL_EFFECTIVE_TIME); + } dropBuilder.addAllHero(heroList); } diff --git a/serverlogic/src/main/resources/application.properties b/serverlogic/src/main/resources/application.properties index d4e884493..05ea1a735 100644 --- a/serverlogic/src/main/resources/application.properties +++ b/serverlogic/src/main/resources/application.properties @@ -1,12 +1,12 @@ #server info -server.id = 10215 +server.id = 10212 server.openTime = 20190101000101 server.num = 1 # redis config # RedisݿĬΪ0 -spring.redis.database=0 +spring.redis.database=1 # Redisַ spring.redis.host=60.1.1.14 # RedisӶ˿ @@ -30,7 +30,7 @@ spring.redis.expireTime = -1 #spring.data.mongodb.uri = mongodb://mongouser:ysj#2017#ljsd@111.231.54.96:27017/ysj_wx_1 #spring.data.mongodb2.uri = mongodb://mongouser:ysj#2017#ljsd@111.231.54.96:27017/develop_ysj_wx_1 #mongodb2 develop -spring.data.mongodb.uri = mongodb://60.1.1.14:27017/jieling_10215 +spring.data.mongodb.uri = mongodb://60.1.1.14:27017/jieling_10212 mongodb.options.maxWaitTime = 120000 mongodb.options.connectTimeout = 1000 mongodb.options.socketTimeout = 0