• 注册后才能下载/购买插件!快来注册吧,注册即可免费下载 精翻插件 !【点我注册
  • RustSB.COM向广大野生Rust插件作者发出入驻邀请!详情请见[原创作者条约]
Player DLC API - 玩家DLC API

汉化 Player DLC API - 玩家DLC API 1.2.0

提供API接口,用于通过内容ID或创意工坊ID验证玩家是否拥有某DLC物品或皮肤的权限

创意工坊ID即Steam所见标识(例如 Steam Workshop::AK47 | Red Shine),皮肤插件基本均采用此类D

内容ID则是Rust游戏内部用于标识付费内容的专属编号

C#:
// 筛选创意工坊皮肤ID列表,仅保留玩家拥有或未审核通过的免费皮肤
// 若皮肤定义未初始化则返回false
bool FilterOwnedOrFreeSkins(BasePlayer player, List<ulong> workshopIds)

// 使用示例:
List<ulong> workshopIds = new List<ulong>
{
    491265826,
    491250135,
    491272870,
    491151877
};

bool result = PluginDLCAPI.Call<bool>("FilterOwnedOrFreeSkins", player, workshopIds);
if (result)
{
    // 此时列表仅包含玩家有权使用的皮肤ID
}
//-------------------------------------------------------

// 检查指定皮肤是否为玩家拥有或未审核的免费皮肤
// 若皮肤定义未初始化或玩家未拥有该皮肤则返回false
bool IsOwnedOrFreeSkin(BasePlayer player, ulong workshopId)

// 使用示例:
bool result = PluginDLCAPI.Call<bool>("IsOwnedOrFreeSkin", player, 491265826);
if (result)
{
    // 玩家有权使用此创意工坊皮肤
}
//-------------------------------------------------------

// 筛选内容ID列表,仅保留玩家拥有的付费内容
// 若皮肤定义未初始化则返回false
bool FilterContentOwnership(BasePlayer player, List<int> contentIds)

// 使用示例:
List<int> contentIds = new List<int>();
foreach (ConstructionGrade grade in grade.grades)
{
    contentIds.Add((int)grade.gradeBase.skin) // 添加建筑等级/皮肤的ID
}

bool result = PluginDLCAPI.Call<bool>("FilterContentOwnership", player, contentIds);
if (result)
{
    // 列表仅包含玩家有权使用的建筑等级/皮肤ID
}
//-------------------------------------------------------

// Rust原生CheckSkinOwnership方法的高效非分配内存实现
// 适用于所有DLC物品的权限校验
bool CheckContentOwnership(BasePlayer player, int contentId)

// 使用示例:
int railroadPlanterContentId = 10298; // 铁轨种植箱内容ID
bool result = PluginDLCAPI.Call<bool>("CheckContentOwnership", player, railroadPlanterContentId);
if (result)
{
    // 玩家有权使用铁轨种植箱
}
//-------------------------------------------------------

// 检查指定创意工坊皮肤ID是否为付费皮肤
bool IsPaidSkin(ulong workshopId)

//-------------------------------------------------------

// 从创意工坊皮肤ID列表中移除所有付费皮肤
bool FilterPaidSkins(List<ulong> workshopIds)

//-------------------------------------------------------

// 检查物品短名称或ID是否为重定向皮肤
bool IsRedirectedSkin(string shortname)
bool IsRedirectedSkin(int itemId)

//-------------------------------------------------------

// 将重定向物品短名称转换回原始定义短名称(例:hazmatsuit.spacesuit -> hazmatsuit)
string GetRedirectedShortname(string shortname)

//-------------------------------------------------------

// 将物品ID转换回原始定义ID
int GetRedirectedItemId(int itemId)

//-------------------------------------------------------

// 检查玩家是否有权使用重定向物品简称
// 若有权限则返回重定向短名称,否则返回基础物品短名称
string GetRedirectedShortnameIfNotOwned(BasePlayer player, string shortname)

//-------------------------------------------------------

// 检查玩家是否有权使用重定向物品ID
// 若有权限则返回重定向ID,否则返回基础物品ID
int GetRedirectedItemIdIfNotOwned(BasePlayer player, int itemId)
作者
对味儿
下载
0
查看
24
文件类型
cs
文件大小
11.9 KB
文件Hash
ad6a77fc4c4be561f173ff2009e3679e
首次发布
最后更新
评分
0.00 星 0评价

来自对味儿的更多资源

分享资源

标签