提交示例代码
This commit is contained in:
27
物品和背包的完整代码/Server/Hotfix/Gate/ItemUseEffect/ItemUse_Drug.cs
Normal file
27
物品和背包的完整代码/Server/Hotfix/Gate/ItemUseEffect/ItemUse_Drug.cs
Normal file
@@ -0,0 +1,27 @@
|
||||
namespace Fantasy;
|
||||
|
||||
[ItemUse(ItemUseEffect.AddAttr)]
|
||||
public class ItemUse_Drug_AddAttr : IItemUse
|
||||
{
|
||||
public uint CanUse(Account account, ItemConfig config, ref int count)
|
||||
{
|
||||
if (config.Params.Length < 2)
|
||||
{
|
||||
Log.Error($"configId:{config.Id} config.Params.Length({config.Params.Length}) < 2");
|
||||
return 1;
|
||||
}
|
||||
|
||||
Log.Debug($"CanUse 使用了药品增加属性 configId:{config.Id} count:{count}");
|
||||
return 0;
|
||||
}
|
||||
|
||||
public void Use(Account account, ItemConfig config, ref int count)
|
||||
{
|
||||
for (int i = 0; i < config.Params.Length; i += 2)
|
||||
{
|
||||
var attrKey = config.Params[i];
|
||||
var attrValue = config.Params[i + 1];
|
||||
Log.Debug($"Use 使用了药品增加属性 configId:{config.Id} attrKey:{attrKey} attrValue:{attrValue}");
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user