diff --git a/excel/cha.xlsx b/excel/cha.xlsx index 334054c..2ba024c 100644 Binary files a/excel/cha.xlsx and b/excel/cha.xlsx differ diff --git a/src/ServerStorage/Proxy/EquipmentProxy.luau b/src/ServerStorage/Proxy/EquipmentProxy.luau index 670f365..504ecc7 100644 --- a/src/ServerStorage/Proxy/EquipmentProxy.luau +++ b/src/ServerStorage/Proxy/EquipmentProxy.luau @@ -27,6 +27,7 @@ local JsonQualityEffect = require(ReplicatedStorage.Json.QualityEffect) local RE_PlayerTip = ReplicatedStorage.Events.RE_PlayerTip local RE_WearEquipment = ReplicatedStorage.Events.RE_WearEquipment local RE_RecycleEquipment = ReplicatedStorage.Events.RE_RecycleEquipment +local RE_AutoRecycleEquipment = ReplicatedStorage.Events.RE_AutoRecycleEquipment --> Constants local STORE_NAME = "Equipment" @@ -461,6 +462,26 @@ function EquipmentProxy:UnwearEquipment(Player: Player, EquipmentId: number) PlayerFightProxy:UpdatePlayerFightData(Player) end +-- 自动回收装备(低于当前最高品质,且无符文槽位) +function EquipmentProxy:AutoRecycleEquipment(Player: Player) + local EquipmentData = ArchiveProxy.pData[Player.UserId][STORE_NAME] + if not EquipmentData then return end + + -- 找到当前最高品质装备 + local highestQuality = 0 + for _, EquipmentData in EquipmentData do + if EquipmentData.quality > highestQuality then + highestQuality = EquipmentData.quality + end + end + + for _, EquipmentData in EquipmentData do + if EquipmentData.quality < highestQuality and EquipmentData.maxRuneNumber == 0 then + self:RecycleEquipment(Player, EquipmentData.id) + end + end +end + -- 获取穿戴中的装备UniqueId function EquipmentProxy:GetPlayerWearingEquipmentUniqueId(Player: Player) local wearingEquipmentUniqueId = {} @@ -556,6 +577,9 @@ end) RE_RecycleEquipment.OnServerEvent:Connect(function(Player: Player, EquipmentUniqueIds: table) EquipmentProxy:RecycleEquipmentList(Player, EquipmentUniqueIds) end) +RE_AutoRecycleEquipment.OnServerEvent:Connect(function(Player: Player) + EquipmentProxy:AutoRecycleEquipment(Player) +end) return EquipmentProxy \ No newline at end of file diff --git a/src/ServerStorage/Proxy/PlayerFightProxy/init.luau b/src/ServerStorage/Proxy/PlayerFightProxy/init.luau index 774db69..2542f5d 100644 --- a/src/ServerStorage/Proxy/PlayerFightProxy/init.luau +++ b/src/ServerStorage/Proxy/PlayerFightProxy/init.luau @@ -184,7 +184,6 @@ function PlayerFightProxy:UpdatePlayerFightData(Player: Player) end end - -- 根据技能添加玩家AI行为 local abilityIdList, behaviorNameList = AbilityProxy:GetPlayerWearingAbilityData(Player) local playerAI = PlayerFightProxy:GetPlayerAI(Player) diff --git a/src/StarterPlayerScripts/UI/Windows/AttributeLvupWindow/AttributeLvupShow.luau b/src/StarterPlayerScripts/UI/Windows/AttributeLvupWindow/AttributeLvupShow.luau index b5f339d..36673cb 100644 --- a/src/StarterPlayerScripts/UI/Windows/AttributeLvupWindow/AttributeLvupShow.luau +++ b/src/StarterPlayerScripts/UI/Windows/AttributeLvupWindow/AttributeLvupShow.luau @@ -25,6 +25,7 @@ function AttributeLvupShow:Init(data: table) ["_tmpBattleValueRequire"] = 0, ["_tmpValue"] = 0, ["_tmpLv"] = 0, + ["_tmpRed"] = 0, ["_btnUpgrade"] = 0, } self.Connections = {} @@ -61,7 +62,6 @@ function AttributeLvupShow:Refresh() self.Variables._imgIcon.Image = Localization:GetImageData(attributeData.iconId) self.Variables._tmpAttributeName.Text = Localization:GetLanguageData(attributeData.nameId) - local nowLv = self:GetNowLv() self.Variables._tmpLv.Text = "Lv." .. nowLv diff --git a/src/StarterPlayerScripts/UI/Windows/CreateWindow/init.luau b/src/StarterPlayerScripts/UI/Windows/CreateWindow/init.luau index acf2572..86201d8 100644 --- a/src/StarterPlayerScripts/UI/Windows/CreateWindow/init.luau +++ b/src/StarterPlayerScripts/UI/Windows/CreateWindow/init.luau @@ -19,6 +19,7 @@ local JsonForge = require(ReplicatedStorage.Json.Forge) --> Events local RE_Forge = ReplicatedStorage.Events.RE_Forge +local RE_AutoRecycleEquipment = ReplicatedStorage.Events.RE_AutoRecycleEquipment local LocalPlayer = game.Players.LocalPlayer @@ -165,10 +166,12 @@ function CreateWindow:SetShowForgeCost(nowForgeTime : number, moneyValue: number end end - function CreateWindow:OnOpenWindow() UIWindow.OnOpenWindow(self) + -- 自动打开回收 + self:OnToggleAutoRecycleClick() + -- 自己进行数据处理 local DataFolder = Utils:GetPlayerDataFolder(LocalPlayer):FindFirstChild("Book") local data = {} @@ -260,6 +263,9 @@ function CreateWindow:OnOpenWindow() end function CreateWindow:OnCloseWindow() + if self.AutoRecycle then + RE_AutoRecycleEquipment:FireServer() + end UIWindow.OnCloseWindow(self) end diff --git a/src/StarterPlayerScripts/UI/Windows/MainWindow/init.luau b/src/StarterPlayerScripts/UI/Windows/MainWindow/init.luau index adfc700..2ef428a 100644 --- a/src/StarterPlayerScripts/UI/Windows/MainWindow/init.luau +++ b/src/StarterPlayerScripts/UI/Windows/MainWindow/init.luau @@ -9,6 +9,7 @@ local Signal = require(ReplicatedStorage.Tools.Signal) --> Json local JsonLevel = require(ReplicatedStorage.Json.Level) local JsonForge = require(ReplicatedStorage.Json.Forge) +local JsonAttributesUpgrade = require(ReplicatedStorage.Json.AttributesUpgrade) local Utils = require(ReplicatedStorage.Tools.Utils) @@ -98,6 +99,7 @@ function MainWindow:Init(UIManager: table, Data: table?) -- 锻造临时红点 ["_tmpRedCreate"] = 0, + ["_tmpRedAttributeUpgrade"] = 0, } self.UIRootName = "ui_w_main" self.UIParentName = UIEnums.UIParent.UIRoot @@ -138,6 +140,43 @@ function MainWindow:SetShowForgeBar(nowForgeTime : number, moneyValue: number) end end +function MainWindow:CheckShowAttributeUpgradeRed(newValue) + -- 临时做一个(当没有成长和限制算) + if newValue < 150 then + self.Variables["_tmpRedAttributeUpgrade"].Visible = false + else + self.Variables["_tmpRedAttributeUpgrade"].Visible = true + end +end + +-- 设置当前加点红点 +function MainWindow:SetShowAttributeUpgradeRed() + -- 设置货币监听 + local CheckMoneyId = 1 + + local MoneyFolder = Utils:GetPlayerDataFolder(LocalPlayer):FindFirstChild("PlayerInfo"):FindFirstChild("Items") + if not MoneyFolder then warn("无法获取物品文件夹") return end + + local InstanceMoney = MoneyFolder:FindFirstChild(CheckMoneyId) + if not InstanceMoney then + self.Variables["_tmpRedAttributeUpgrade"].Visible = false + local connectionFolder + connectionFolder = MoneyFolder.ChildAdded:Connect(function(child) + if child.Name == tostring(CheckMoneyId) then + InstanceMoney = child + connectionFolder:Disconnect() + end + end) + else + local con = InstanceMoney.Changed:Connect(function(newValue) + self:CheckShowAttributeUpgradeRed(newValue) + end) + table.insert(self.Connections, con) + -- 初始化显示设置 + self:CheckShowAttributeUpgradeRed(InstanceMoney.Value) + end +end + function MainWindow:OnOpenWindow() UIWindow.OnOpenWindow(self)