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

添加插件: HouseRegion 圈地插件 #115

Merged
merged 2 commits into from
May 14, 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
67 changes: 67 additions & 0 deletions HouseRegion/Config.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@
using Newtonsoft.Json;

namespace HouseRegion
{
public class Config
{
[JsonProperty("进出房屋提示")]
public bool HouseRegion = true;

[JsonProperty("房屋嘴大大小")]
public int HouseMaxSize = 1000;

[JsonProperty("房屋最小宽度")]
public int MinWidth = 30;

[JsonProperty("房屋最小高度")]
public int MinHeight = 30;

[JsonProperty("房屋最大数量")]
public int HouseMaxNumber = 1;

[JsonProperty("禁止锁房屋")]
public bool LimitLockHouse = false;

[JsonProperty("保护宝石锁")]
public bool ProtectiveGemstoneLock = false;

[JsonProperty("始终保护箱子")]
public bool ProtectiveChest = true;

[JsonProperty("冻结警告破坏者")]
public bool WarningSpoiler = true;

[JsonProperty("禁止分享所有者7")]
public bool ProhibitSharingOwner = false;

[JsonProperty("禁止分享使用者")]
public bool ProhibitSharingUser = false;

[JsonProperty("禁止所有者修改使用者")]
public bool ProhibitOwnerModifyingUser = true;

public static Config Read(string Path)//给定文件进行读
{
if (!File.Exists(Path)) return new Config();
using var fs = new FileStream(Path, FileMode.Open, FileAccess.Read, FileShare.Read);
return Read(fs);
}
public static Config Read(Stream stream)//给定流文件进行读取
{
using var sr = new StreamReader(stream);
var cf = JsonConvert.DeserializeObject<Config>(sr.ReadToEnd());
return cf ?? new();
}
public void Write(string Path)//给定路径进行写
{
using var fs = new FileStream(Path, FileMode.Create, FileAccess.Write, FileShare.Write);
Write(fs);
}
public void Write(Stream stream)//给定流文件写
{
var str = JsonConvert.SerializeObject(this, Formatting.Indented);
using var sw = new StreamWriter(stream);
sw.Write(str);
}
}
}
40 changes: 40 additions & 0 deletions HouseRegion/Customize.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
using Microsoft.Xna.Framework;

namespace HouseRegion
{
public class LPlayer//本地玩家类
{
public int Who { get; set; }
public int TileX { get; set; }//上次瓷砖X位置目的用来判定玩家是否步入房子,若上次瓷砖位置在房子内表示已在房子内
public int TileY { get; set; }//上次瓷砖Y位置
public bool Look { get; set; }

public LPlayer(int who, int lasttileX, int lasttileY)//类初始化时
{
Who = who;
TileX = lasttileX;
TileY = lasttileY;
Look = false;
}
}

public class House//本地房子类
{
public Rectangle HouseArea { get; set; }
public string Author { get; set; }
public List<string> Owners { get; set; }
public string Name { get; set; }
public bool Locked { get; set; }
public List<string> Users { get; set; }

public House(Rectangle housearea, string author, List<string> owners, string name, bool locked, List<string> users)//类初始化时
{
HouseArea = housearea;
Author = author;
Owners = owners;
Name = name;
Locked = locked;
Users = users;
}
}
}
4 changes: 4 additions & 0 deletions HouseRegion/HouseRegion.csproj
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
<Project Sdk="Microsoft.NET.Sdk">
<Import Project="..\template.targets" />
</Project>

323 changes: 323 additions & 0 deletions HouseRegion/PacketReceive.cs

Large diffs are not rendered by default.

598 changes: 598 additions & 0 deletions HouseRegion/Plugin.cs

Large diffs are not rendered by default.

54 changes: 54 additions & 0 deletions HouseRegion/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
# ShowArmors 发送装备

- 作者: GK
- 出处: 无
- 更好的圈地插件

## 更新日志

```
暂无
```

## 指令

| 语法 | 别名 | 权限 | 说明 |
| ----------------------------- | :--: | :-----------------------: | :------------: |
| /house set 1 | 无 | house.use | 敲击左上角 |
| /house set 2 | 无 | house.use | 敲击右下角 |
| /house clear | 无 | house.use | 重置临时敲击点 |
| /house allow [玩家] [房屋] | 无 | `house.use` `house.admin` | 添加所有者 |
| /house disallow [玩家] [房屋] | 无 | `house.use` `house.admin` | 移除所有者 |
| /house adduser [玩家] [房屋] | 无 | `house.use` `house.admin` | 添加使用者 |
| /house deluser [玩家] [房屋] | 无 | `house.use` `house.admin` | 删除使用者 |
| /house delete [屋名] | 无 | `house.use` `house.admin` | 删除房屋 |
| /house list [页码] | 无 | `house.use` `house.admin` | 查看房屋列表 |
| /house redefine [屋名] | 无 | `house.use` `house.admin` | 重新定义房屋 |
| /house info [屋名] | 无 | `house.use` `house.admin` | 房屋信息 |
| /house lock [屋名] | 无 | `house.use` `house.admin` | 房屋锁 |

## 配置

> HouseRegion.json

```json
{
"进出房屋提示": true,
"房屋嘴大大小": 1000,
"房屋最小宽度": 30,
"房屋最小高度": 30,
"房屋最大数量": 1,
"禁止锁房屋": false,
"保护宝石锁": false,
"始终保护箱子": false,
"冻结警告破坏者": true,
"禁止分享所有者7": false,
"禁止分享使用者": false,
"禁止所有者修改使用者": true
}
```

## 反馈

- 共同维护的插件库:https://github.com/Controllerdestiny/TShockPlugin
- 国内社区 trhub.cn 或 TShock 官方群等
Loading
Loading