This commit is contained in:
gechangfu 2025-08-05 20:04:06 +08:00
parent 1c3ea56ee0
commit 5f7d2f28e8
13 changed files with 41 additions and 19 deletions

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

View File

@ -2,7 +2,7 @@
{"id":1,"key":"quality_bonus","intValue":null,"stringValue":null,"intArray":[100,125,150,200,275,375]}, {"id":1,"key":"quality_bonus","intValue":null,"stringValue":null,"intArray":[100,125,150,200,275,375]},
{"id":2,"key":"level_get_bonus","intValue":null,"stringValue":null,"intArray":[5,0]}, {"id":2,"key":"level_get_bonus","intValue":null,"stringValue":null,"intArray":[5,0]},
{"id":3,"key":"mob_died_get","intValue":null,"stringValue":null,"intArray":[2,4]}, {"id":3,"key":"mob_died_get","intValue":null,"stringValue":null,"intArray":[2,4]},
{"id":4,"key":"default_weapon","intValue":null,"stringValue":"Sword","intArray":[]}, {"id":4,"key":"default_weapon","intValue":null,"stringValue":null,"intArray":[]},
{"id":5,"key":"quality_show","intValue":null,"stringValue":null,"intArray":[101,102,103,104,105,106,107,108]}, {"id":5,"key":"quality_show","intValue":null,"stringValue":null,"intArray":[101,102,103,104,105,106,107,108]},
{"id":6,"key":"new_player_book_rewards","intValue":null,"stringValue":null,"intArray":[50000,1]}, {"id":6,"key":"new_player_book_rewards","intValue":null,"stringValue":null,"intArray":[50000,1]},
{"id":7,"key":"new_player_item_rewards","intValue":null,"stringValue":null,"intArray":[2,10]} {"id":7,"key":"new_player_item_rewards","intValue":null,"stringValue":null,"intArray":[2,10]}

View File

@ -28,14 +28,16 @@ function Character.new(Player: Player, CharacterModel: Model, CharacterData: tab
self.TargetPlayerUserID = Player.UserId self.TargetPlayerUserID = Player.UserId
self.Connections = {} self.Connections = {}
self.Stats = {} self.Stats = {}
self.Character = CharacterModel
-- 生成实例身上的配置数据 -- 生成实例身上的配置数据
local Attributes = Instance.new("Configuration") local Attributes = Instance.new("Configuration")
Attributes.Name = "Attributes" Attributes.Name = "Attributes"
Attributes.Parent = self.Instance Attributes.Parent = self.Instance
local ExceptAttributes = {"id", "name"}
for attributeKey, attributeValue in self.Config do for attributeKey, attributeValue in self.Config do
-- 只设置非表类型的属性值 -- 只设置非表类型的属性值
if type(attributeValue) ~= "table" then if type(attributeValue) ~= "table" and not table.find(ExceptAttributes, attributeKey) then
Attributes:SetAttribute(attributeKey, attributeValue) Attributes:SetAttribute(attributeKey, attributeValue)
-- 设置限制值 -- 设置限制值
if table.find(LIMIT_ATTRIBUTE, attributeKey) then if table.find(LIMIT_ATTRIBUTE, attributeKey) then
@ -44,6 +46,7 @@ function Character.new(Player: Player, CharacterModel: Model, CharacterData: tab
end end
end end
end end
self.Attributes = Attributes
-- 通过函数调用了,不绑定事件了 -- 通过函数调用了,不绑定事件了
-- local conAttribute = Attributes.AttributeChanged:Connect(function(attributeKey: string, attributeValue: number) -- local conAttribute = Attributes.AttributeChanged:Connect(function(attributeKey: string, attributeValue: number)

View File

@ -53,6 +53,7 @@ function BookProxy:InitPlayer(Player: Player)
Utils:CreateDataInstance(Player, BookId, BookData, BookFolder) Utils:CreateDataInstance(Player, BookId, BookData, BookFolder)
end end
-- 新玩家默认添加图鉴
if isNew then if isNew then
local ItemProxy = require(ServerStorage.Proxy.ItemProxy) local ItemProxy = require(ServerStorage.Proxy.ItemProxy)
local newData = Utils:GetIdDataFromJson(JsonParam, 6) local newData = Utils:GetIdDataFromJson(JsonParam, 6)

View File

@ -98,10 +98,10 @@ function MobsProxy:CreateMob(Player: Player, MobId: number, Position: Vector3, A
local Mob = Mob.new(Player, MobId, Position, OnMobDied) local Mob = Mob.new(Player, MobId, Position, OnMobDied)
AI:StartTracking(Mob) AI:StartTracking(Mob)
-- 关卡系数 -- 关卡系数
if AtkBonus then Mob:ChangeAttributeValue("attack", math.floor(Mob.Config.attack * (AtkBonus / 1000))) end if AtkBonus then Mob:ChangeAttributeValue("attack", math.floor(Mob.Config.attack * (AtkBonus / 100))) end
if HpBonus then if HpBonus then
Mob:ChangeAttributeValue("hp", math.floor(Mob.Config.hp * (HpBonus / 1000))) Mob:ChangeAttributeValue("hp", math.floor(Mob.Config.hp * (HpBonus / 100)))
Mob:ChangeAttributeValue("maxhp", math.floor(Mob.Config.maxhp * (HpBonus / 1000))) Mob:ChangeAttributeValue("maxhp", math.floor(Mob.Config.maxhp * (HpBonus / 100)))
end end
MobsProxy.pData[Player.UserId][Mob.Instance] = Mob MobsProxy.pData[Player.UserId][Mob.Instance] = Mob
return Mob return Mob

View File

@ -46,12 +46,12 @@ function PlayerRole.new(Player: Player, CharacterId: number)
local CharacterData = Utils:GetIdDataFromJson(JsonCharacter, CharacterId) local CharacterData = Utils:GetIdDataFromJson(JsonCharacter, CharacterId)
if not CharacterData then warn("CharacterId Data not found", CharacterId) return end if not CharacterData then warn("CharacterId Data not found", CharacterId) return end
-- 补充默认没设置的属性,暂时不添加特殊属性,因为特殊属性是系统调用的,添加也没啥用 -- 补充默认没设置的属性,暂时不添加特殊属性,因为特殊属性是系统调用的,添加也没啥用 (忘了有啥用,暂时不管,可能是留属性填充口子)
for _, AttributeData in JsonCharacter do -- for _, AttributeData in JsonCharacter do
if AttributeData.id < 50 then -- if AttributeData.id < 50 then
if not CharacterData[AttributeData.name] then CharacterData[AttributeData.name] = 0 end -- if not CharacterData[AttributeData.name] then CharacterData[AttributeData.name] = 0 end
end -- end
end -- end
-- 调用父类Character的new方法初始化通用属性 -- 调用父类Character的new方法初始化通用属性
@ -133,16 +133,19 @@ function PlayerFightProxy:UpdatePlayerFightData(Player: Player)
if PlayerInfoAttributes.UpgradeAttributes then if PlayerInfoAttributes.UpgradeAttributes then
Utils:TableSafeAddTableValue(AttributesData, PlayerInfoAttributes.UpgradeAttributes) Utils:TableSafeAddTableValue(AttributesData, PlayerInfoAttributes.UpgradeAttributes)
end end
-- print("PlayerInfoAttributes", AttributesData)
local EquipmentAttributes = EquipmentProxy:GetPlayerAttributes(Player) local EquipmentAttributes = EquipmentProxy:GetPlayerAttributes(Player)
if EquipmentAttributes then if EquipmentAttributes then
Utils:TableSafeAddTableValue(AttributesData, EquipmentAttributes) Utils:TableSafeAddTableValue(AttributesData, EquipmentAttributes)
end end
-- print("EquipmentAttributes", AttributesData)
local GemAttributes = GemProxy:GetPlayerAttributes(Player) local GemAttributes = GemProxy:GetPlayerAttributes(Player)
if GemAttributes.GemWearingAttributes then if GemAttributes.GemWearingAttributes then
Utils:TableSafeAddTableValue(AttributesData, GemAttributes.GemWearingAttributes) Utils:TableSafeAddTableValue(AttributesData, GemAttributes.GemWearingAttributes)
end end
-- print("GemAttributes", AttributesData)
-- 角色基础数据 -- 角色基础数据
local PlayerRole = self:GetPlayerRole(Player) local PlayerRole = self:GetPlayerRole(Player)
@ -153,10 +156,11 @@ function PlayerFightProxy:UpdatePlayerFightData(Player: Player)
if AttributesData.atkSpeed then table.insert(ExceptAttributes, "atkSpeed") end if AttributesData.atkSpeed then table.insert(ExceptAttributes, "atkSpeed") end
for AttributeName, AttributeValue in CharacterData do for AttributeName, AttributeValue in CharacterData do
if not table.find(ExceptAttributes, AttributeName) then if not table.find(ExceptAttributes, AttributeName) then
Utils:TableSafeAddValue(AttributesData, AttributeName, AttributeValue) Utils:TableSafeAddValue(AttributesData, AttributeName, AttributeValue)
end end
end end
-- print("CharacterData", AttributesData)
-- 根据汇总更新玩家属性——————实际生效计算部分 -- 根据汇总更新玩家属性——————实际生效计算部分
local PlayerRole = self:GetPlayerRole(Player) local PlayerRole = self:GetPlayerRole(Player)
@ -164,13 +168,24 @@ function PlayerFightProxy:UpdatePlayerFightData(Player: Player)
-- 针对百分比特殊属性直接进行计算修改 -- 针对百分比特殊属性直接进行计算修改
if AttributesData["hpRate"] then if AttributesData["hpRate"] then
AttributesData["hp"] = math.floor(AttributesData["hp"] * (1 + AttributesData["hpRate"] / 100)) AttributesData["hp"] = math.floor(AttributesData["hp"] * (1 + AttributesData["hpRate"] / 100))
AttributesData["maxhp"] = AttributesData["hp"]
end end
AttributesData["maxhp"] = AttributesData["hp"]
if AttributesData["attackRate"] then if AttributesData["attackRate"] then
AttributesData["attack"] = math.floor(AttributesData["attack"] * (1 + AttributesData["attackRate"] / 100)) AttributesData["attack"] = math.floor(AttributesData["attack"] * (1 + AttributesData["attackRate"] / 100))
end end
-- 获取原玩家属性,把不存在新属性列表的内容排除掉
local ConfigAttributes = PlayerRole.Attributes:GetAttributes()
-- print("ConfigAttributes", ConfigAttributes)
for oldName, oldValue in ConfigAttributes do
if not AttributesData[oldName] then
AttributesData[oldName] = 0
end
end
-- 更新玩家属性 -- 更新玩家属性
-- print(AttributesData)
for AttributeName, AttributeValue in AttributesData do for AttributeName, AttributeValue in AttributesData do
-- TODO这里可能涉及到战斗时更换装备的属性处理还需要再函数内部再根据剩余百分比数值变化 -- TODO这里可能涉及到战斗时更换装备的属性处理还需要再函数内部再根据剩余百分比数值变化
PlayerRole:ChangeAttributeValue(AttributeName, AttributeValue) PlayerRole:ChangeAttributeValue(AttributeName, AttributeValue)

View File

@ -119,6 +119,7 @@ function PlayerInfoProxy:InitPlayer(Player: Player)
end end
CreateInfoInstance(Player, PlayerInfoFolder, "Forge", ENUM_STATE_TYPE.Number, ArchiveProxy.pData[Player.UserId][STORE_NAME].Forge) CreateInfoInstance(Player, PlayerInfoFolder, "Forge", ENUM_STATE_TYPE.Number, ArchiveProxy.pData[Player.UserId][STORE_NAME].Forge)
-- 新玩家默认添加货币
if isNew then if isNew then
local newData = Utils:GetIdDataFromJson(JsonParam, 7) local newData = Utils:GetIdDataFromJson(JsonParam, 7)
for i = 1, #newData.intArray, 2 do for i = 1, #newData.intArray, 2 do

View File

@ -40,6 +40,7 @@ end
function WeaponModel:SetDefaultWeaponModel() function WeaponModel:SetDefaultWeaponModel()
local modelName = Utils:GetIdDataFromJson(JsonParam, 4).stringValue local modelName = Utils:GetIdDataFromJson(JsonParam, 4).stringValue
if not modelName then return end
local WeaponModel = FolderPrefabEquipments:FindFirstChild(modelName) local WeaponModel = FolderPrefabEquipments:FindFirstChild(modelName)
if not WeaponModel then warn("DefaultWeaponModel not found") return end if not WeaponModel then warn("DefaultWeaponModel not found") return end
@ -78,6 +79,13 @@ RE_WearEquipment.OnClientEvent:Connect(function(IsWear: boolean, EquipmentId: nu
for _, child in FolderBackpack:GetChildren() do for _, child in FolderBackpack:GetChildren() do
if child.Name == oldWeaponName then if child.Name == oldWeaponName then
child:Destroy() child:Destroy()
return
end
end
for _, child in LocalPlayer.Character:GetChildren() do
if child:IsA("Tool") and child.Name == oldWeaponName then
child:Destroy()
return
end end
end end
end) end)

View File

@ -19,7 +19,6 @@ local RE_ChallengeLevel = ReplicatedStorage.Events.RE_ChallengeLevel
--> Local --> Local
local LocalPlayer = game:GetService("Players").LocalPlayer local LocalPlayer = game:GetService("Players").LocalPlayer
local forgeRedPointSignal = Signal.new(Signal.ENUM.FORGE_RED_POINT)
local challengeLevelEndSignal = Signal.new(Signal.ENUM.CHALLENGE_LEVEL_END) local challengeLevelEndSignal = Signal.new(Signal.ENUM.CHALLENGE_LEVEL_END)
-------------------------------------------------------------------------------- --------------------------------------------------------------------------------
@ -157,11 +156,6 @@ function MainWindow:OnOpenWindow()
table.insert(self.Connections, attributeUpgradeCon) table.insert(self.Connections, attributeUpgradeCon)
table.insert(self.Connections, startChallengeCon) table.insert(self.Connections, startChallengeCon)
local forgeRedPointCon = forgeRedPointSignal:Connect(function(show: boolean)
self.Variables["_tmpRedCreate"].Visible = show
end)
table.insert(self.Connections, forgeRedPointCon)
local challengeLevelEndCon = challengeLevelEndSignal:Connect(function(result: boolean) local challengeLevelEndCon = challengeLevelEndSignal:Connect(function(result: boolean)
self.Variables["_btnStartChallenge"].Visible = true self.Variables["_btnStartChallenge"].Visible = true
end) end)