This commit is contained in:
lenheart
2025-04-05 22:03:40 +08:00
parent 4d65103501
commit eeb773e723
53 changed files with 2348 additions and 505 deletions

View File

@@ -0,0 +1,11 @@
{
"ProjectName": "跨界石",
"ProjectDescribe": "通过指定ID的道具将装备背包第一格的装备跨界。\n配置中修改NoCrossIdArr可增加不可跨界的ID。",
"ProjectAuthor": "倾泪寒",
"ProjectVersion": 1.2,
"ProjectConfig": "跨界石_Lenheart.json",
"ProjectFiles": [
"跨界石.nut"
],
"ProjectRunFunc": "_Dps_CrossBorderStones_Main_"
}

View File

@@ -0,0 +1,57 @@
function _Dps_CrossBorderStones_Main_() {
local Cofig = GlobalConfig.Get("跨界石_Lenheart.json");
Cb_Use_Item_Sp_Func[Cofig.CrossoverId.tointeger()] <- function(SUser, ItemId) {
//获取账号金库对象
local CargoObj = SUser.GetAccountCargo();
//获取账号金库中的一个空格子
local EmptySlot = CargoObj.GetEmptySlot();
//如果没有空格子
if (EmptySlot == -1) {
SUser.SendNotiPacketMessage(Cofig.CrossoverStr2, 8);
//不扣除道具
SUser.GiveItem(ItemId, 1);
return;
}
//获取角色背包
local InvenObj = SUser.GetInven();
//获取需要转移的装备 这里默认写的装备栏第一个格子
local ItemObj = InvenObj.GetSlot(Inven.INVENTORY_TYPE_ITEM, 9);
//获取装备ID
local EquipId = ItemObj.GetIndex();
//获取装备名字
local ItemName = PvfItem.GetNameById(EquipId);
//获取配置中不可跨界的ID数组
local NoCrossId = Cofig.NoCrossIdArr;
//如果这个装备不可跨界
if (NoCrossId.find(EquipId) != null) {
SUser.SendNotiPacketMessage(format(Cofig.CrossoverStr5, ItemName), 7);
//不扣除道具
SUser.GiveItem(ItemId, 1);
return;
}
//如果没找到这个格子的装备
if (!ItemName) {
SUser.SendNotiPacketMessage(Cofig.CrossoverStr1, 8);
//不扣除道具
SUser.GiveItem(ItemId, 1);
return;
}
//跨界
local Flag = CargoObj.InsertItem(ItemObj, EmptySlot);
if (Flag == -1) {
SUser.SendNotiPacketMessage(Cofig.CrossoverStr3, 8);
//不扣除道具
SUser.GiveItem(ItemId, 1);
} else {
//销毁背包中的道具
ItemObj.Delete();
//刷新玩家背包列表
SUser.SendUpdateItemList(1, 0, 9);
//刷新账号金库列表
CargoObj.SendItemList();
SUser.SendNotiPacketMessage(format(Cofig.CrossoverStr4, ItemName), 7);
}
}
}