36 lines
1.2 KiB
Plaintext
36 lines
1.2 KiB
Plaintext
-- 道具代理
|
|
local ItemProxy = {}
|
|
|
|
--> Services
|
|
local ReplicatedStorage = game:GetService("ReplicatedStorage")
|
|
local ServerStorage = game:GetService("ServerStorage")
|
|
|
|
--> Json
|
|
local JsonItem = require(ReplicatedStorage.Json.ItemProp)
|
|
|
|
--> Variables
|
|
local Utils = require(ReplicatedStorage.Tools.Utils)
|
|
-- local ArchiveProxy = require(ReplicatedStorage.Modules.ArchiveProxy)
|
|
local PlayerInfoProxy = require(ServerStorage.Proxy.PlayerInfoProxy)
|
|
|
|
--------------------------------------------------------------------------------
|
|
|
|
function ItemProxy:AddItem(Player: Player, ItemId: number, ItemCount: number)
|
|
local pData = Utils:GetPlayerDataFolder(Player)
|
|
if not pData then return end
|
|
|
|
local ItemData = Utils:GetIdDataFromJson(JsonItem, ItemId)
|
|
if not ItemData then return end
|
|
|
|
if ItemData.type == 2 then
|
|
local EquipmentProxy = require(script.Parent.EquipmentProxy)
|
|
EquipmentProxy:AddEquipment(Player, ItemId, ItemCount)
|
|
elseif ItemData.type == 3 then
|
|
local BookProxy = require(script.Parent.BookProxy)
|
|
BookProxy:UnlockBook(Player, ItemId - 10000)
|
|
else
|
|
PlayerInfoProxy:ChangeItemCount(Player, ItemId, ItemCount)
|
|
end
|
|
end
|
|
|
|
return ItemProxy |