Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

更新:告示牌登录 v1.0.4 #293

Merged
merged 3 commits into from
Jul 13, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
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
27 changes: 20 additions & 7 deletions SignInSign/Command.cs
Original file line number Diff line number Diff line change
Expand Up @@ -23,16 +23,26 @@ internal static void SetupCmd(CommandArgs args)
switch (args.Parameters[0].ToLower())
{
case "r":
case "reset":
case "reload":
ReloadCmd(args);
if (args.Player.HasPermission("signinsign.setup"))
{
ReloadCmd(args);
if (SignInSign.Config.Teleport_X > 0 && SignInSign.Config.Teleport_Y > 0)
{
SignInSign.Config.Teleport_X = 0;
SignInSign.Config.Teleport_Y = 0;
SignInSign.Config.Write(Configuration.ConfigPath);
}
}
return;
case "s":
case "set":
if (args.Parameters.Count != 1)
{
args.Player.SendMessage("[告示牌登录]设置传送点命令无需额外参数,将会使用你当前位置。", Microsoft.Xna.Framework.Color.Yellow);
}
else
else if (args.Parameters.Count == 1 && (args.Player.HasPermission("signinsign.tp") || args.Player.HasPermission("signinsign.setup"))) //加个玩家设置TP的权限
{
SignInSign.Config.Teleport_X = x;
SignInSign.Config.Teleport_Y = y;
Expand All @@ -55,11 +65,14 @@ private static void ReloadCmd(CommandArgs args)
//清掉原有的图格
WorldGen.KillTile(Main.spawnTileX, Main.spawnTileY - 3);

//设置墙壁和图格
Main.tile[Main.spawnTileX, Main.spawnTileY - 3].wall = WallID.EchoWall;
Main.tile[Main.spawnTileX, Main.spawnTileY - 2].wall = WallID.EchoWall;
Main.tile[Main.spawnTileX + 1, Main.spawnTileY - 3].wall = WallID.EchoWall;
Main.tile[Main.spawnTileX + 1, Main.spawnTileY - 2].wall = WallID.EchoWall;
//检查墙壁是否为空,空则放置回声墙
if (Main.tile[Main.spawnTileX, Main.spawnTileY - 3].wall == WallID.None)
{
Main.tile[Main.spawnTileX, Main.spawnTileY - 3].wall = WallID.EchoWall;
Main.tile[Main.spawnTileX, Main.spawnTileY - 2].wall = WallID.EchoWall;
Main.tile[Main.spawnTileX + 1, Main.spawnTileY - 3].wall = WallID.EchoWall;
Main.tile[Main.spawnTileX + 1, Main.spawnTileY - 2].wall = WallID.EchoWall;
}

Main.tile[Main.spawnTileX, Main.spawnTileY - 3].active(false);
Main.tile[Main.spawnTileX, Main.spawnTileY - 2].active(false);
Expand Down
4 changes: 2 additions & 2 deletions SignInSign/Configuration.cs
Original file line number Diff line number Diff line change
Expand Up @@ -22,13 +22,13 @@ public class Configuration
public bool SignEnable3 = false;

[JsonProperty("鍒涘缓鍛婄ず鐗岀殑鍐呭,閲嶈鎸囦护:/gs r")]
public string SignText = "娆㈣繋鏉ュ埌寮�鑽掓湇\n鏈湇鏀寔杩為攣鎸栫熆,鏇村鏅跺鏀剧疆浣跨敤\nNPC鍞崠鏇村鐗╁搧,鏇村鏉愭枡寰厜杞崲\n鏇存湁RPG鑱屼笟鍟嗗簵涓庨瓟鏀笲OSS绛変綘浣撻獙锛乗n骞堕厤澶囦簡鍦ㄧ嚎绀煎寘,杩涘害绀煎寘绛夌鍒╁姪浣犲揩閫熸垚闀縗n闇�瀵煎嚭鏈湇瑙掕壊/鍦板浘鍙姞缇よ仈绯绘湇涓籠n鏈嶅姟鍣ㄧ兢锛�123456\n\n缂栬緫姝ゅ杈撳叆瀵嗙爜锛堜繚瀛�2娆★級鍙揩閫熸敞鍐岀櫥褰曪細\n";
public string SignText = "娆㈣繋鏉ュ埌寮�鑽掓湇锛侊紒\n鏈湇鏀寔PE/PC璺ㄥ钩鍙拌仈鏈烘父鐜‐n姣�25鍒嗛挓娓呯悊涓栫晫涓嶣oss鎴樻帓鍚嶇粺璁n鏇村鎸囦护鏁欏璇疯緭鍏�/help\n鐐瑰嚮鍛婄ず鐗屽彲杩涜浼犻�乗n\nTShock瀹樻柟缇わ細816771079\n";
[JsonProperty("鐐瑰嚮鍛婄ず鐗岀殑骞挎挱/浠呬娇鐢ㄨ�呭彲瑙�")]
public string SignText2 = "鍦ㄦ湰鍛婄ず鐗屼緷搴忚緭鍏�2娆★細\n[c/F7CCF0:123456] 杩涜娉ㄥ唽鐧诲綍銆�";
[JsonProperty("璇曞浘鐮村潖鍛婄ず鐗岀殑骞挎挱")]
public string SignText3 = "姝ゅ憡绀虹墝涓嶅彲琚慨鏀�!";
[JsonProperty("鐐瑰嚮鍛婄ず鐗屾墽琛屼粈涔堟寚浠�")]
public string[] CommandsOnSignRead { get; set; } = new string[0];
public string[] CmdList { get; set; } = new string[0];
[JsonProperty("鐐瑰嚮鍛婄ず鐗岀粰浠�涔圔UFF")]
public int[] BuffID { get; set; } = new int[] { };
[JsonProperty("鐐瑰嚮鍛婄ず鐗孊UFF鏃堕暱/鍒嗛挓")]
Expand Down
13 changes: 10 additions & 3 deletions SignInSign/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,17 @@
+ 濡傞渶鏇存敼鍛婄ず鐗屽唴瀹癸細
+ 1.鍦ㄦ湇鍔″櫒閲屼娇鐢ㄥ凡鐧诲綍瑙掕壊鎸栨帀鍛婄ず鐗�
+ 2.淇敼銆愬憡绀虹墝鐧诲綍.json銆戦厤缃枃浠朵腑鐨勨�滃垱寤哄憡绀虹墝鐨勫唴瀹光��
+ 3.杈撳叆鎸囦护锛�/gs r
+ 3.杈撳叆鎸囦护锛�/gs r [鏉冮檺锛歴igninsign.setup]

## 鏇存柊鏃ュ織
```
1.0.4
鍔犲叆浜嗗鏀剧疆鍖哄煙澧欏鏄惁涓虹┖鐨勫垽瀹�
闄嶄綆鎻掍欢鏀剧疆鍛婄ず鐗岀殑浼樺厛绾э紙閬胯CreateSpawn鎻掍欢锛�
缁�/gs s鎸囦护鍔犱釜鏉冮檺鏂逛究鐜╁鑷敤
鎶婄偣鍑诲憡绀虹墝鎵ц鍛戒护鐨勮韩浠芥敼涓虹帺瀹舵湰浜猴紙涓存椂瓒呯缁勶級
浣跨敤/gs r浼氭竻绌轰紶閫佸潗鏍� 閬垮厤閲嶇疆鏈嶅姟鍣ㄦ部鐢�

1.0.3
灏戝徃鍛戒慨澶嶄簡澶氫汉杩涙湇鍛婄ず鐗屼笉寮圭獥闂锛屽姞鍏ヤ簡闃绘鐮村潖淇敼鍛婄ず鐗屽浘鏍�
缇藉浼樺寲浜嗘寚浠わ紝浣跨敤/gs s鍙揩閫熻缃綋鍓嶄綅缃负浼犻�佺偣锛屼娇鐢�/gs r 鍙噸璁惧憡绀虹墝锛堣嚜鍔ㄦ墽琛�/reload锛�
Expand All @@ -28,7 +35,7 @@
| 璇硶 | 鏉冮檺 | 璇存槑 |
| -------------- | :-----------------: | :------: |
| /gs r | signinsign.setup | 閲嶈鍛婄ず鐗� |
| /gs s | signinsign.setup |璁剧疆鍛婄ず鐗屼紶閫佺偣骞惰嚜鍔ㄥ啓鍏ラ厤缃枃浠秥
| /gs s | signinsign.tp |璁剧疆鍛婄ず鐗屼紶閫佺偣骞惰嚜鍔ㄥ啓鍏ラ厤缃枃浠秥
| 鏃� | sign.edit |鍏佽鐮村潖鍛婄ず鐗屾潈闄恷


Expand All @@ -41,7 +48,7 @@
"瀵圭櫥褰曠帺瀹舵樉绀哄憡绀虹墝": true,
"鏄惁鍏佽鐐瑰嚮鍛婄ず鐗�": true,
"鐐瑰嚮鍛婄ず鐗屾槸鍚﹀彂骞挎挱": false,
"鍒涘缓鍛婄ず鐗岀殑鍐呭,閲嶈鎸囦护:/gs r": "娆㈣繋鏉ュ埌寮�鑽掓湇\n鏈湇鏀寔杩為攣鎸栫熆,鏇村鏅跺鏀剧疆浣跨敤\nNPC鍞崠鏇村鐗╁搧,鏇村鏉愭枡寰厜杞崲\n鏇存湁RPG鑱屼笟鍟嗗簵涓庨瓟鏀笲OSS绛変綘浣撻獙锛乗n骞堕厤澶囦簡鍦ㄧ嚎绀煎寘,杩涘害绀煎寘绛夌鍒╁姪浣犲揩閫熸垚闀縗n闇�瀵煎嚭鏈湇瑙掕壊/鍦板浘鍙姞缇よ仈绯绘湇涓籠n鏈嶅姟鍣ㄧ兢锛�123456\n\n缂栬緫姝ゅ杈撳叆瀵嗙爜锛堜繚瀛�2娆★級鍙揩閫熸敞鍐岀櫥褰曪細\n",
"鍒涘缓鍛婄ず鐗岀殑鍐呭,閲嶈鎸囦护:/gs r": "娆㈣繋鏉ュ埌寮�鑽掓湇锛侊紒\n鏈湇鏀寔PE/PC璺ㄥ钩鍙拌仈鏈烘父鐜‐n姣�25鍒嗛挓娓呯悊涓栫晫涓嶣oss鎴樻帓鍚嶇粺璁n鏇村鎸囦护鏁欏璇疯緭鍏�/help\n鐐瑰嚮鍛婄ず鐗屽彲杩涜浼犻�乗n\nTShock瀹樻柟缇わ細816771079\n",
"鐐瑰嚮鍛婄ず鐗岀殑骞挎挱/浠呬娇鐢ㄨ�呭彲瑙�": "鍦ㄦ湰鍛婄ず鐗屼緷搴忚緭鍏�2娆★細\n[c/F7CCF0:123456] 杩涜娉ㄥ唽鐧诲綍銆�",
"璇曞浘鐮村潖鍛婄ず鐗岀殑骞挎挱": "姝ゅ憡绀虹墝涓嶅彲琚慨鏀�!",
"鐐瑰嚮鍛婄ず鐗屾墽琛屼粈涔堟寚浠�": [],
Expand Down
46 changes: 30 additions & 16 deletions SignInSign/SignInSign.cs
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ public class SignInSign : TerrariaPlugin
public override string Name => "鍛婄ず鐗岀櫥褰� SignInSign";
public override string Description => "鍛婄ず鐗岀櫥褰曚氦浜掓彃浠� 鏀寔杩涙湇寮圭獥锛�";
public override string Author => "Soofa 缇藉 灏戝徃鍛�";
public override Version Version => new(1, 0, 3);
public override Version Version => new(1, 0, 4);

#endregion

Expand All @@ -27,9 +27,9 @@ public SignInSign(Main game) : base(game) { }
public override void Initialize()
{
LoadConfig();
TShockAPI.Commands.ChatCommands.Add(new TShockAPI.Command("signinsign.setup", Command.SetupCmd, "setupsign", "gs", "鍛婄ず"));
TShockAPI.Commands.ChatCommands.Add(new TShockAPI.Command(Command.SetupCmd, "setupsign", "gs", "鍛婄ず"));
ServerApi.Hooks.NetGreetPlayer.Register(this, OnNetGreetPlayer);
ServerApi.Hooks.GamePostInitialize.Register(this, OnGamePostInitialize);
ServerApi.Hooks.GamePostInitialize.Register(this, OnGamePostInitialize,-100); //浼樺厛绾т负鍊掓暟100 閬垮厤鍜孋reateSpawn銆丼pawnInfra鍐茬獊
GetDataHandlers.TileEdit.Register(OnEdit);
GetDataHandlers.Sign.Register(OnSignChange);
GetDataHandlers.SignRead.Register(OnSignRead);
Expand Down Expand Up @@ -159,45 +159,59 @@ public static void OnSignChange(object? sender, GetDataHandlers.SignEventArgs ar
public static void OnSignRead(object? sender, GetDataHandlers.SignReadEventArgs args)
{
//褰撴槸鍚﹀厑璁哥偣鍑诲憡绀虹墝涓篺alse锛屽垯杩斿洖涓嶅仛浠讳綍澶勭悊
if (args.Player == null || Config.SignEnable2 == false) { args.Handled = true; }
if (args.Player == null || Config.SignEnable2 == false || !args.Player.IsLoggedIn) args.Handled = true;

//鍚﹀垯
else
{
if (Config.SignEnable3 == true)
{
args.Player!.SendMessage($"{Config.SignText2}", color: Microsoft.Xna.Framework.Color.Yellow);
}

// 浠庨厤缃腑璇诲彇CommandsOnSignRead鍒楄〃锛屽苟渚濇鎵ц姣忎釜鍛戒护
foreach (var command in Config.CommandsOnSignRead)
{
// 鎵ц鍛戒护锛岃繖閲屼娇鐢═SPlayer.Server鎵ц鍛戒护鎰忓懗鐫�鐢辨湇鍔″櫒鎵ц
Commands.HandleCommand(TSPlayer.Server, command);
}
//鎵ц鎸囦护鏂规硶
Cmd(args.Player);

//閬嶅巻閰嶇疆鏂囦欢涓殑BUFFID锛岀偣鍑昏缃瓸UFF
foreach (var BuffID in Config.BuffID)
{
args.Player.SetBuff(BuffID, Config.BuffTime * 3600, false);
}

//閬嶅巻閰嶇疆鏂囦欢涓殑鐗╁搧ID锛岀偣鍑荤粰浜堢墿鍝�
foreach (var ItemID in Config.ItemID)
{
args.Player.GiveItem(ItemID, Config.ItemStack, 0);
}

//褰撶偣鍑诲憡绀虹墝鏄惁浼犻�佷负true,灏嗙帺瀹朵紶閫佸埌鎸囧畾鍧愭爣锛堜粎瀵瑰凡鐧诲綍鐜╁鏈夋晥锛�
if (Config.Teleport == true || args.Player.IsLoggedIn)
if (Config.Teleport == true)
{
if (Config.Teleport_X <= 0 || Config.Teleport_Y <= 0)
{
args.Player!.SendMessage($"[鍛婄ず鐗岀櫥褰昡璇蜂娇鐢� [c/F25E61:/gs s] 璁剧疆浼犻�佸潗鏍囷紝褰撳墠鍧愭爣涓猴細{Config.Teleport_X},{Config.Teleport_Y}", color: Microsoft.Xna.Framework.Color.Yellow);
args.Player!.SendMessage($"[鍛婄ず鐗岀櫥褰昡璇蜂娇鐢� [c/F25E61:/gs s] 璁剧疆浼犻�佸潗鏍囷紝褰撳墠鍧愭爣涓猴細{Config.Teleport_X},{Config.Teleport_Y} \n" +
$"鎸囦护 [c/F25E61:/gs s] 鐨勬潈闄愬悕涓猴細signinsign.tp", color: Microsoft.Xna.Framework.Color.Yellow);
}
else { args.Player.Teleport(x: Config.Teleport_X * 16, y: Config.Teleport_Y * 16, style: Config.Style); }
else args.Player.Teleport(x: Config.Teleport_X * 16, y: Config.Teleport_Y * 16, style: Config.Style);
}
}
}
#endregion

#region 鐢ㄨ秴绠$粍韬唤甯帺瀹舵墽琛屾寚浠ゆ柟娉�
private static void Cmd(TSPlayer plr)
{
Group group = plr.Group;
try
{
plr.Group = new SuperAdminGroup();
foreach (var cmd in Config.CmdList)
{
Commands.HandleCommand(plr, cmd);
}
}
finally
{
plr.Group = group;
}
}
#endregion

}
11 changes: 7 additions & 4 deletions SignInSign/Utils.cs
Original file line number Diff line number Diff line change
Expand Up @@ -22,10 +22,13 @@ public static int GetSignIdByPos(int tileX, int tileY)
public static int SpawnSign(int x, int y)
{
WorldGen.KillTile(x, y);
Main.tile[Main.spawnTileX, Main.spawnTileY - 3].wall = WallID.EchoWall;
Main.tile[Main.spawnTileX, Main.spawnTileY - 2].wall = WallID.EchoWall;
Main.tile[Main.spawnTileX + 1, Main.spawnTileY - 3].wall = WallID.EchoWall;
Main.tile[Main.spawnTileX + 1, Main.spawnTileY - 2].wall = WallID.EchoWall;
if (Main.tile[x, y].wall == WallID.None) //检查墙壁是否为空,空则放置隐形墙
{
Main.tile[Main.spawnTileX, Main.spawnTileY - 3].wall = WallID.EchoWall;
Main.tile[Main.spawnTileX, Main.spawnTileY - 2].wall = WallID.EchoWall;
Main.tile[Main.spawnTileX + 1, Main.spawnTileY - 3].wall = WallID.EchoWall;
Main.tile[Main.spawnTileX + 1, Main.spawnTileY - 2].wall = WallID.EchoWall;
}

Main.tile[Main.spawnTileX, Main.spawnTileY - 3].active(false);
Main.tile[Main.spawnTileX, Main.spawnTileY - 2].active(false);
Expand Down
2 changes: 1 addition & 1 deletion SpawnInfra/Plugin.cs
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ public override void Initialize()
{
LoadConfig();
GeneralHooks.ReloadEvent += (_) => LoadConfig();
ServerApi.Hooks.GamePostInitialize.Register(this, OnGamePostInitialize);
ServerApi.Hooks.GamePostInitialize.Register(this, OnGamePostInitialize,20);//鎻愰珮浼樺厛绾ч伩鍏嶈鐩朇reateSpawn鎻掍欢
Commands.ChatCommands.Add(new Command("room.use", Comds.Comd, "rm", "鍩哄缓")
{
HelpText = "鐢熸垚鍩虹寤鸿"
Expand Down
2 changes: 1 addition & 1 deletion SpawnInfra/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ v1.4.0
淇浜嗗埛鎬満涓績鐐逛负鍑虹敓鐐筙杞�
淇浜嗗埛鎬満姣斾緥缂╂斁
缁欏埛鎬満鏀句釜鑺卞洯渚忓剴

鎻愰珮鏀剧疆浼樺厛绾ч伩鍏嶈鐩朇reateSpawn鎻掍欢鐢熸垚鐨勫缓绛�

v1.3.0
鍔犲叆浜嗗井鍏夋箹鐩撮�氳溅
Expand Down
Loading