添加示例项目
This commit is contained in:
11
示例项目/跨界石/Proj.ifo
Normal file
11
示例项目/跨界石/Proj.ifo
Normal file
@@ -0,0 +1,11 @@
|
||||
{
|
||||
"ProjectName": "跨界石",
|
||||
"ProjectDescribe": "通过指定ID的道具,将装备背包第一格的装备跨界。\n配置中修改CrossoverId可修改跨界石的ID 修改NoCrossIdArr可增加不可跨界的ID。",
|
||||
"ProjectAuthor": "倾泪寒",
|
||||
"ProjectVersion": 1.4,
|
||||
"ProjectConfig": "跨界石_Lenheart.json",
|
||||
"ProjectFiles": [
|
||||
"跨界石.nut"
|
||||
],
|
||||
"ProjectRunFunc": "_Dps_CrossBorderStones_Main_"
|
||||
}
|
||||
92
示例项目/跨界石/跨界石.nut
Normal file
92
示例项目/跨界石/跨界石.nut
Normal file
@@ -0,0 +1,92 @@
|
||||
|
||||
|
||||
|
||||
function _Dps_CrossBorderStones_Logic_()
|
||||
{
|
||||
local Cofig = GlobalConfig.Get("跨界石_Lenheart.json");
|
||||
|
||||
Cb_Use_Item_Sp_Func[Cofig.CrossoverId.tointeger()] <- function(SUser, ItemId) {
|
||||
local Cofig = GlobalConfig.Get("跨界石_Lenheart.json");
|
||||
|
||||
//获取账号金库对象
|
||||
local CargoObj = SUser.GetAccountCargo();
|
||||
//获取账号金库中的一个空格子
|
||||
local EmptySlot = CargoObj.GetEmptySlot();
|
||||
|
||||
//如果没有空格子
|
||||
if (EmptySlot == -1) {
|
||||
SUser.SendNotiPacketMessage(Cofig.CrossoverStr2, 8);
|
||||
//不扣除道具
|
||||
Timer.SetTimeOut(function()
|
||||
{
|
||||
SUser.GiveItem(ItemId, 1);
|
||||
},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);
|
||||
//不扣除道具
|
||||
Timer.SetTimeOut(function()
|
||||
{
|
||||
SUser.GiveItem(ItemId, 1);
|
||||
},1);
|
||||
return;
|
||||
}
|
||||
//如果没找到这个格子的装备
|
||||
if (!ItemName) {
|
||||
SUser.SendNotiPacketMessage(Cofig.CrossoverStr1, 8);
|
||||
//不扣除道具
|
||||
Timer.SetTimeOut(function()
|
||||
{
|
||||
SUser.GiveItem(ItemId, 1);
|
||||
},1);
|
||||
return;
|
||||
}
|
||||
//跨界
|
||||
local Flag = CargoObj.InsertItem(ItemObj, EmptySlot);
|
||||
if (Flag == -1) {
|
||||
SUser.SendNotiPacketMessage(Cofig.CrossoverStr3, 8);
|
||||
//不扣除道具
|
||||
Timer.SetTimeOut(function()
|
||||
{
|
||||
SUser.GiveItem(ItemId, 1);
|
||||
},1);
|
||||
} else {
|
||||
//销毁背包中的道具
|
||||
ItemObj.Delete();
|
||||
//刷新玩家背包列表
|
||||
SUser.SendUpdateItemList(1, 0, 9);
|
||||
//刷新账号金库列表
|
||||
CargoObj.SendItemList();
|
||||
SUser.SendNotiPacketMessage(format(Cofig.CrossoverStr4, ItemName), 7);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
//加载入口
|
||||
function _Dps_CrossBorderStones_Main_() {
|
||||
_Dps_CrossBorderStones_Logic_();
|
||||
}
|
||||
|
||||
//重载入口
|
||||
function _Dps_CrossBorderStones_Main_Reload_(OldConfig) {
|
||||
//先销毁原来注册的
|
||||
Cb_Use_Item_Sp_Func.rawdelete(OldConfig.CrossoverId.tointeger());
|
||||
|
||||
//重新注册
|
||||
_Dps_CrossBorderStones_Logic_();
|
||||
}
|
||||
9
示例项目/跨界石/跨界石_Lenheart.json
Normal file
9
示例项目/跨界石/跨界石_Lenheart.json
Normal file
@@ -0,0 +1,9 @@
|
||||
{
|
||||
"CrossoverStr1": "装备栏1号位没有装备..",
|
||||
"CrossoverStr2": "跨界失败,请检查一下账号金库是否没有开启或者没有空位",
|
||||
"CrossoverStr3": "跨界失败",
|
||||
"CrossoverStr4": "跨界成功,已经装备栏第一格的 [%s] 转移至账号金库",
|
||||
"CrossoverStr5": "跨界失败, [%s] 不可以跨界",
|
||||
"CrossoverId": 17577,
|
||||
"NoCrossIdArr" : [26058]
|
||||
}
|
||||
Reference in New Issue
Block a user