-
Notifications
You must be signed in to change notification settings - Fork 24
add:TrCDK #992
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
Draft
THEXN
wants to merge
27
commits into
UnrealMultiple:master
Choose a base branch
from
THEXN:master
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Draft
add:TrCDK #992
Changes from 10 commits
Commits
Show all changes
27 commits
Select commit
Hold shift + click to select a range
b9ce36e
update:TPallow默认允许
THEXN d85cb33
add:TrCDK
THEXN b77b025
doc
THEXN c2645a5
doc:en
THEXN dfa44f5
fix:补药灌注我
THEXN 0b8532a
fix:waring
THEXN f11d46d
重构
Controllerdestiny 74ed183
LazyAPI命令系统支持可选参数
Controllerdestiny 91cd490
docs(TrCDK): 修正更新日志格式
ACaiCat deb410b
refactor(EssentialsPlus): 用`REPLACE`替代`INSERT OR REPLACE`以兼容MySQL
ACaiCat c5a0a34
Merge branch 'UnrealMultiple:master' into master
THEXN e1420a5
Merge branch 'UnrealMultiple:master' into master
THEXN 62b10ba
docs(TrCDK): 删除多余日志
ACaiCat 8b72411
自动更新子模块 [skip ci]
actions-user 1c19f73
自动更新子模块 [skip ci]
actions-user 7c7c89b
Merge branch 'UnrealMultiple:master' into master
THEXN 7987f58
update:作为基础插件,不再依赖LazyAPI
THEXN 86786e1
Merge branch 'master' into master
ACaiCat d36efa7
feat(LazyAPI): add `HelpText` support
ACaiCat b102e4a
fix(LazyAPI): remove method target for `HelpTextAttribute`
ACaiCat 89ee85a
feat(LazyAPI): add `UsageAttribute` to set custom usage
ACaiCat c3aaff2
Merge branch 'UnrealMultiple:master' into master
THEXN c065ae0
chore: 自动更新子模块
actions-user d2530c0
chore: 自动更新子模块
actions-user 3bf350e
chore: 自动更新子模块
actions-user b30626f
Merge branch 'UnrealMultiple:master' into master
THEXN 2ab5eff
Merge branch 'UnrealMultiple:master' into master
THEXN File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -75,6 +75,8 @@ | |
| ``` | ||
|
|
||
| ## 更新日志 | ||
| ### v1.1.0 | ||
| - Tpallow默认允许传送 | ||
| ### v1.0.9 | ||
| - 数据库记录玩家tpallow状态 | ||
| ### v1.0.7 | ||
|
|
||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,166 @@ | ||
| using LazyAPI.Attributes; | ||
| using LazyAPI.Extensions; | ||
| using System; | ||
| using System.Collections.Generic; | ||
| using System.Linq; | ||
| using System.Text; | ||
| using System.Threading.Tasks; | ||
| using TShockAPI; | ||
|
|
||
| namespace TrCDK; | ||
|
|
||
| [Command("cdk")] | ||
| [Permissions("cdk.use")] | ||
| public class Command | ||
| { | ||
| [Alias("give")] | ||
| [Permissions("cdk.give")] | ||
| public static void Give(CommandArgs args, TSPlayer? player, string cmd) | ||
| { | ||
| if(player == null) | ||
| { | ||
| args.Player.SendErrorMessage(GetString("[c/ffd700:玩家不存在]")); | ||
| return; | ||
| } | ||
| var cmds = cmd.Split(','); | ||
| if (cmds.Length > 0) | ||
| { | ||
| args.Player.ExecCommand(cmds); | ||
| args.Player.SendSuccessMessage(GetString($"[c/ffd700:已给予玩家 {player.Name} CDK奖励]")); | ||
| } | ||
| else | ||
| { | ||
| args.Player.SendErrorMessage(GetString("[c/ffd700:指令不能为空]")); | ||
| } | ||
| } | ||
|
|
||
| [Alias("update")] | ||
| [Flexible] | ||
| [Permissions("cdk.update")] | ||
| public static void Update(CommandArgs args, string cdkname, int usetime, long utiltime, string grouplimit = "", string playerlimit = "", string cmds = "") | ||
| { | ||
| var cdkData = CDK.GetData(cdkname); | ||
| if (cdkData == null) | ||
| { | ||
| args.Player.SendErrorMessage(GetString("[c/ffd700:CDK不存在]")); | ||
| return; | ||
| } | ||
| CDK.Update(cdkname, usetime, utiltime, grouplimit, playerlimit, cdkData.Used, cmds); | ||
| args.Player.SendSuccessMessage(GetString("[c/ffd700:CDK更新成功]")); | ||
| } | ||
|
|
||
| [Alias("del")] | ||
| [Permissions("cdk.del")] | ||
| public static void Delete(CommandArgs args, string cdkname) | ||
| { | ||
| if (CDK.GetData(cdkname) == null) | ||
| { | ||
| args.Player.SendErrorMessage(GetString("[c/ffd700:CDK不存在]")); | ||
| return; | ||
| } | ||
| CDK.DelCDK(cdkname); | ||
| args.Player.SendSuccessMessage(GetString("[c/ffd700:CDK删除成功]")); | ||
| } | ||
|
|
||
| [Alias("add")] | ||
| [Flexible] | ||
| [Permissions("cdk.add")] | ||
| public static void Add(CommandArgs args, string cdkname, int usetime, long utiltime, string cmds, string grouplimit = "", string playerlimit = "") | ||
| { | ||
| if (CDK.Insert(cdkname, usetime, utiltime, grouplimit, playerlimit, cmds)) | ||
| { | ||
| args.Player.SendSuccessMessage(GetString("[c/ffd700:CDK添加成功]")); | ||
| } | ||
| else | ||
| { | ||
| args.Player.SendErrorMessage(GetString("[c/ffd700:CDK添加失败]")); | ||
| } | ||
| } | ||
|
|
||
| [Alias("list")] | ||
| [Permissions("cdk.list")] | ||
| public static void List(CommandArgs args) | ||
| { | ||
| var cdkList = CDK.GetAllData(); | ||
| if (cdkList.Length == 0) | ||
| { | ||
| args.Player.SendInfoMessage(GetString("[c/ffd700:没有可用的CDK]")); | ||
| return; | ||
| } | ||
| var sb = new StringBuilder(); | ||
| sb.AppendLine(GetString("[c/ffd700:当前可用的CDK列表]")); | ||
| foreach (var cdk in cdkList) | ||
| { | ||
| sb.Append(GetString($"[c/ffd700:{cdk.Name}] [c/00FF00:剩余使用次数: {cdk.Usetime}] [c/ffd700:过期时间: {new DateTime(cdk.Utiltime).ToLocalTime()}] ")); | ||
| if(cdk.Playerlimit != "") | ||
| { | ||
| sb.Append(GetString($"[c/ffd700:玩家限制: {cdk.Playerlimit}] ")); | ||
| } | ||
| if(cdk.Grouplimit != "") | ||
| { | ||
| sb.Append(GetString($"[c/ffd700:组限制: {cdk.Grouplimit}] ")); | ||
| } | ||
| if(cdk.Cmds != "") | ||
| { | ||
| sb.Append(GetString($"[c/ffd700:指令: {cdk.Cmds}] ")); | ||
| } | ||
| if(cdk.Used != "") | ||
| { | ||
| sb.Append(GetString($"[c/ffd700:已使用玩家: {cdk.Used}] ")); | ||
| } | ||
| sb.AppendLine(); | ||
| } | ||
| args.Player.SendInfoMessage(sb.ToString().Trim()); | ||
| } | ||
|
|
||
| [Alias("use")] | ||
| [RealPlayer] | ||
| public static void Use(CommandArgs args, string cdk) | ||
| { | ||
| var cdkData = CDK.GetData(cdk); | ||
| if (cdkData == null) | ||
| { | ||
| args.Player.SendInfoMessage(GetString("[c/ffd700:CDK不存在或已失效]")); | ||
| return; | ||
| } | ||
|
|
||
| if (cdkData.Playerlimit != "") | ||
| { | ||
| if (!cdkData.Playerlimit.Contains(args.Player.Name)) | ||
| { | ||
| args.Player.SendInfoMessage(GetString("[c/ffd700:你不在该CDK的领取名单中]")); | ||
| return; | ||
| } | ||
| } | ||
| if (cdkData.Grouplimit != "") | ||
| { | ||
| if (!cdkData.Grouplimit.Contains(args.Player.Group.Name)) | ||
| { | ||
| args.Player.SendInfoMessage(GetString("[c/ffd700:你所在的组不能领取该CDK]")); | ||
| return; | ||
| } | ||
| } | ||
| if (cdkData.Usetime < 1) | ||
| { | ||
| args.Player.SendInfoMessage(GetString("[c/ffd700:你手慢了, 该CDK已经被领完]")); | ||
| return; | ||
| } | ||
| var time2 = Convert.ToDateTime(DateTime.Now.ToString()).Ticks; | ||
| var min = (cdkData.Utiltime - time2) / 10000000; | ||
| if (min <= 0) | ||
| { | ||
| args.Player.SendInfoMessage(GetString("[c/ffd700:你来晚了, 该CDK已经过期了]")); | ||
| return; | ||
| } | ||
| if (cdkData.Used.Contains(args.Player.Name)) | ||
| { | ||
| args.Player.SendInfoMessage(GetString("[c/ffd700:已经领取过了,不能太贪心哦]")); | ||
| return; | ||
| } | ||
| var strcmd = cdkData.Cmds.Replace("[plr]", args.Player.Name); | ||
| var cmds = strcmd.Split(','); | ||
| args.Player.ExecCommand(cmds); | ||
| CDK.Update(cdkData.Name, cdkData.Usetime - 1, cdkData.Utiltime, cdkData.Grouplimit, cdkData.Playerlimit, (cdkData.Used == "") ? args.Player.Name : cdkData.Used + "," + args.Player.Name, cdkData.Cmds); | ||
| args.Player.SendSuccessMessage(GetString("[c/ffd700:CDK兑换成功!]")); | ||
| } | ||
| } |
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.