Skip to content

Commit

Permalink
Merge pull request #512 from THEXN/master
Browse files Browse the repository at this point in the history
修复:VeinMiner的多项问题
  • Loading branch information
Controllerdestiny authored Oct 5, 2024
2 parents 85ee8b7 + 2361370 commit 031a01a
Show file tree
Hide file tree
Showing 6 changed files with 130 additions and 91 deletions.
10 changes: 5 additions & 5 deletions src/VeinMiner/Config.cs
Original file line number Diff line number Diff line change
Expand Up @@ -48,13 +48,13 @@ public static void Load(ReloadEventArgs args = null)
[JsonProperty("放入背包")]
public bool PutInInventory { get; set; } = true;

[JsonProperty("矿石类型")]
[JsonProperty("矿石物块ID")]
public List<int> Tile { get; set; } = new();

[JsonProperty("当矿石上方有这些物品时,该处矿石不被挖掘")]
[JsonProperty("忽略挖掘表面方块ID")]
public List<int> NotMine { get; set; } = new();

[JsonProperty("兑换规则")]
[JsonProperty("奖励规则")]
public List<Exchange> Exchange { get; set; } = new();
}

Expand All @@ -66,9 +66,9 @@ public struct Exchange
[JsonProperty("最小尺寸")]
public int MinSize;

[JsonProperty("类型")]
[JsonProperty("矿石物块ID")]
public int Type;

[JsonProperty("物品")]
[JsonProperty("奖励物品")]
public Dictionary<int, int> Item;
}
34 changes: 24 additions & 10 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 All @@ -35,7 +39,7 @@ v1.6.0.3
"启用": true,
"广播": true,
"放入背包": true,
"矿石类型": [
"矿石物块ID": [
7,
166,
6,
Expand Down Expand Up @@ -68,12 +72,17 @@ v1.6.0.3
67,
68
],
"兑换规则": [
"忽略挖掘表面方块ID": [
21,
26,
88
],
奖励规则": [
{
"仅给予物品": false,
"最小尺寸": 0,
"类型": 0,
"物品": null
"矿石物块ID": 0, // 矿石物块id
"奖励物品": null // 奖励物品
}
]
}
Expand All @@ -84,7 +93,7 @@ v1.6.0.3
"启用": true,
"广播": true,
"放入背包": true,
"矿石类型": [
"矿石物块ID": [
7,
166,
6,
Expand Down Expand Up @@ -117,21 +126,26 @@ v1.6.0.3
67,
68
],
"兑换规则": [
"忽略挖掘表面方块ID": [
21,
26,
88
],
"奖励规则": [
{
"仅给予物品": true,
"最小尺寸": 10,
"类型": 168,
"物品": {
"矿石物块ID": 168,
"奖励物品": {
"666": 1,
"669": 1
}
},
{
"仅给予物品": true,
"最小尺寸": 10,
"类型": 8,
"物品": {
"矿石物块ID": 8,
"奖励物品": {
"662": 5,
"219": 1
}
Expand Down
30 changes: 20 additions & 10 deletions src/VeinMiner/README_EN.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
"启用": true, //Enable
"广播": true, //Broadcast
"放入背包": true, //Put ores into player's inventory
"矿石类型": [ //TileID which will be mined by VeinMiner
"矿石物块ID": [ //TileID which will be mined by VeinMiner
7,
166,
6,
Expand All @@ -31,12 +31,17 @@
168,
8
],
"兑换规则": [ //Exchange rules
"忽略挖掘表面方块ID: [ // When these items are above the ore, the ore will not be mined.
21,
26,
88
],
"奖励规则"": [ //Exchange rules
{
"仅给予物品": false, //Only give item
"最小尺寸": 0, //Min size
"类型": 0, //Tile ID
"物品": null //Item
"矿石物块ID": 0, //Tile ID
"奖励物品": null //Item
}
]
}
Expand All @@ -47,29 +52,34 @@
"启用": true, //Enable
"广播": true, //Broadcast
"放入背包": true, //Put ores into player's inventory
"矿石类型": [ //TileID which will be mined by VeinMiner
"矿石物块ID": [ //TileID which will be mined by VeinMiner
7,
166,
6,
167,
9,
168
],
"兑换规则": [ //Exchange rules
"忽略挖掘表面方块ID": [
21,
26,
88
],
"奖励规则": [ //Exchange rules
{
"仅给予物品": true, //Item
"最小尺寸": 10, //Min size
"类型": 168, //Tile ID
"物品": {
"矿石物块ID": 168, //Tile ID
"奖励物品": {
"666": 1, //"ItemID": stack
"669": 1
}
},
{
"仅给予物品": true,
"最小尺寸": 10,
"类型": 8,
"物品": {
"矿石物块ID": 8,
"奖励物品": {
"662": 5,
"219": 1
}
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
62 changes: 33 additions & 29 deletions src/VeinMiner/i18n/en-US.po
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
msgid ""
msgstr ""
"Project-Id-Version: VeinMiner\n"
"POT-Creation-Date: 2024-09-07 18:09:14+0000\n"
"PO-Revision-Date: 2024-08-31 19:55+0800\n"
"POT-Creation-Date: 2024-10-05 00:08:05+0800\n"
"PO-Revision-Date: 2024-10-05 00:09+0800\n"
"Last-Translator: Cai\n"
"Language-Team: UnrealMultiple\n"
"Language: en_US\n"
Expand All @@ -11,67 +11,71 @@ msgstr ""
"Content-Transfer-Encoding: 8bit\n"
"X-Generator: Poedit 3.5\n"

#: ../../VeinMiner.cs:39
#: ..\..\VeinMiner.cs:34
#, csharp-format
msgid "[c/95CFA6:<VeinMiner> 挖矿消息已{0}]."
msgstr "[c/95CFA6:<VeinMiner> Mining Status {0}.]"

#: ..\..\VeinMiner.cs:39
#, csharp-format
msgid "[c/95CFA6:<VeinMiner> 已{0}.]"
msgstr "[c/95CFA6:<VeinMiner> {0} .]"

#: ../../VeinMiner.cs:34
#: ..\..\VeinMiner.cs:136
#, csharp-format
msgid "[c/95CFA6:<VeinMiner> 挖矿消息已{0}]."
msgstr "[c/95CFA6:<VeinMiner> Mining Status {0}.]"
msgid "[c/95CFA6:<VeinMiner>] 背包已满,还需空位:[c/95CFA6:{0}] ."
msgstr "[c/95CFA6:<VeinMiner>] Inventory full, space needed: [c/95CFA6:{0}] ."

#: ../../VeinMiner.cs:125
#: ..\..\VeinMiner.cs:162
#, csharp-format
msgid ""
"[c/95CFA6:<VeinMiner>] 背包已满,需额外空位:[c/95CFA6:{0}] 以放入 "
"[c/95CFA6:{1}] ."
msgstr ""
"[c/95CFA6:<VeinMiner>] Inventory full, space needed: [c/95CFA6:{0}] to "
"insert [c/95CFA6:{1}] ."

#: ..\..\VeinMiner.cs:156
#, csharp-format
msgid "[c/95CFA6:<VeinMiner>] 挖掘了 [c/95CFA6: {0} {1}]."
msgstr "[c/95CFA6:<VeinMiner>] Mined [c/95CFA6: {0} {1} ]."

#: ../../VeinMiner.cs:167
#: ..\..\VeinMiner.cs:173
msgid ""
"[c/95CFA6:<VeinMiner>] 无法挖取矿石,可能是因为矿石上方有不可破坏的物体."
msgstr ""
"[c/95CFA6:<VeinMiner>] Unable to mine ore, possibly because there is an "
"indestructible object above the ore."

#: ../../VeinMiner.cs:161
#: ..\..\VeinMiner.cs:121 ..\..\VeinMiner.cs:126
msgid "[c/95CFA6:<VeinMiner>] 已给予奖励物品"
msgstr "[c/95CFA6:<VeinMiner>] Reward items granted"

#: ..\..\VeinMiner.cs:148
#, csharp-format
msgid "[c/95CFA6:<VeinMiner>] 正在挖掘 [c/95CFA6:{0} {1}]."
msgstr "[c/95CFA6:<VeinMiner>] Mining [c/95CFA6: {0} {1} ]."

#: ../../VeinMiner.cs:129
#, csharp-format
msgid "[c/95CFA6:<VeinMiner>] 背包已满,还需空位:[c/95CFA6:{0}] ."
msgstr "[c/95CFA6:<VeinMiner>] Inventory full, space needed: [c/95CFA6:{0}] ."

#: ../../VeinMiner.cs:151
#, csharp-format
msgid ""
"[c/95CFA6:<VeinMiner>] 背包已满,需额外空位:[c/95CFA6:{0}] 以放入 [c/95CFA6:"
"{1}] ."
msgstr ""
"[c/95CFA6:<VeinMiner>] Inventory full, space needed: [c/95CFA6:{0}] to "
"insert [c/95CFA6:{1}] ."

#: ../../Config.cs:38
#: ..\..\Config.cs:38
msgid "<VeinMiner> 读取配置文件失败。"
msgstr "<VeinMiner> Failed to read config file."

#: ../../Config.cs:32
#: ..\..\Config.cs:32
msgid "<VeinMiner> 配置已重新加载。"
msgstr "<VeinMiner> Config reloaded."

#: ../../VeinMiner.cs:34
#: ..\..\VeinMiner.cs:34
msgid "关闭"
msgstr "Deactivated"

#: ../../VeinMiner.cs:39
#: ..\..\VeinMiner.cs:39
msgid "关闭! | 要仅关闭挖矿消息提示请输入:/vm {任意参数}"
msgstr "Deactivated! | To turn off only mining status messages use: /vm msg"

#: ../../VeinMiner.cs:34 ../../VeinMiner.cs:39
#: ..\..\VeinMiner.cs:34 ..\..\VeinMiner.cs:39
msgid "开启"
msgstr "Activated"

#: ../../VeinMiner.cs:125
#: ..\..\VeinMiner.cs:156
msgid "未知"
msgstr "Unknown"
Loading

0 comments on commit 031a01a

Please sign in to comment.