Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Next Next commit
fix:VeinMiner的多项问题
  • Loading branch information
THEXN committed Oct 4, 2024
commit d856a6c3fb9e6b707f21d61167efee1ef659a8b3
18 changes: 16 additions & 2 deletions src/VeinMiner/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,10 @@
## 更新日志

```
v1.6.0.6
修复:背包满的时候去挖达到可获得奖励数量的矿,只会挖掉一个矿,但却会给予一个奖励物品,然后就可以用这个刷奖励
完善消息提示逻辑

v1.6.0.5
修复刷矿,添加英文翻译

Expand Down Expand Up @@ -68,12 +72,17 @@ v1.6.0.3
67,
68
],
"当矿石上方有这些物品时,该处矿石不被挖掘": [
21,
26,
88
],
"兑换规则": [
{
"仅给予物品": false,
"最小尺寸": 0,
"类型": 0,
"物品": null
"类型": 0, // 矿石物块id
"物品": null // 奖励物品
}
]
}
Expand Down Expand Up @@ -117,6 +126,11 @@ v1.6.0.3
67,
68
],
"当矿石上方有这些物品时,该处矿石不被挖掘": [
21,
26,
88
],
"兑换规则": [
{
"仅给予物品": true,
Expand Down
10 changes: 10 additions & 0 deletions src/VeinMiner/README_EN.md
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,11 @@
168,
8
],
"当矿石上方有这些物品时,该处矿石不被挖掘": [
21,
26,
88
],
"兑换规则": [ //Exchange rules
{
"仅给予物品": false, //Only give item
Expand All @@ -55,6 +60,11 @@
9,
168
],
"当矿石上方有这些物品时,该处矿石不被挖掘": [ //When these items are above the ore, the ore will not be mined.
21,
26,
88
],
"兑换规则": [ //Exchange rules
{
"仅给予物品": true, //Item
Expand Down
32 changes: 19 additions & 13 deletions src/VeinMiner/VeinMiner.cs
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ namespace VeinMiner;
public class VeinMiner : TerrariaPlugin
{
public override string Name => "VeinMiner";
public override Version Version => new Version(1, 6, 0, 5);
public override Version Version => new Version(1, 6, 0, 6);
public override string Author => "Megghy|YSpoof|Maxthegreat99|肝帝熙恩";
public override string Description => "VeinMiner by Megghy 适用于 TShock 5.2 支持!";

Expand Down Expand Up @@ -112,17 +112,24 @@ void Mine(TSPlayer plr, int x, int y, int type)
{
if (e.Item.Count <= plr.GetBlankSlot())
{
e.Item.ForEach(ex => plr.GiveItem(ex.Key, ex.Value));
if (e.OnlyGiveItem)
if (plr.IsSpaceEnough(item.netID, mineCount))
{
mineCount = KillTileAndSend(list, true);
e.Item.ForEach(ex => plr.GiveItem(ex.Key, ex.Value));
if (e.OnlyGiveItem)
{
mineCount = KillTileAndSend(list, true);
plr.SendInfoMessage(GetString($"[c/95CFA6:<VeinMiner>] 已给予奖励物品"));
}
else
{
GiveItem();
plr.SendInfoMessage(GetString($"[c/95CFA6:<VeinMiner>] 已给予奖励物品"));
}
}
else
{
GiveItem();
GiveItem();
}

plr.SendMessage(GetString($"[c/95CFA6:<VeinMiner>] 挖掘了 [c/95CFA6: {mineCount} {(item.type == 0 ? GetString("未知") : item.Name)}]."), Color.White);
return;
}

Expand All @@ -134,15 +141,19 @@ void Mine(TSPlayer plr, int x, int y, int type)
{
GiveItem();
}

void GiveItem()
{
if (plr.GetData<VMStatus>("VeinMiner").EnableBroadcast && Config.Broadcast && mineCount > 1)
{
plr.SendMessage(GetString($"[c/95CFA6:<VeinMiner>] 正在挖掘 [c/95CFA6:{mineCount} {(item.type == 0 ? "未知" : item.Name)}]."), Color.White);
}
if (Config.PutInInventory)
{
if (plr.IsSpaceEnough(item.netID, mineCount))
{
mineCount = KillTileAndSend(list, true);
plr.GiveItem(item.netID, mineCount);
plr.SendMessage(GetString($"[c/95CFA6:<VeinMiner>] 挖掘了 [c/95CFA6: {mineCount} {(item.type == 0 ? GetString("未知") : item.Name)}]."), Color.White);

}
else
Expand All @@ -155,11 +166,6 @@ void GiveItem()
{
mineCount = KillTileAndSend(list, false);
}

if (plr.GetData<VMStatus>("VeinMiner").EnableBroadcast && Config.Broadcast && mineCount > 1)
{
plr.SendMessage(GetString($"[c/95CFA6:<VeinMiner>] 正在挖掘 [c/95CFA6:{mineCount} {(item.type == 0 ? "未知" : item.Name)}]."), Color.White);
}
}
}
else if (count > 0)
Expand Down