-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #30 from 1249993110/dev
Dev
- Loading branch information
Showing
26 changed files
with
307 additions
and
106 deletions.
There are no files selected for viewing
This file contains 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,85 @@ | ||
using SdtdServerKit.Data.Entities; | ||
using SdtdServerKit.Data.IRepositories; | ||
|
||
namespace SdtdServerKit.Commands | ||
{ | ||
/// <summary> | ||
/// Represents a command to set player colored chat. | ||
/// </summary> | ||
public class SetPlayerColoredChat : ConsoleCmdBase | ||
{ | ||
/// <inheritdoc/> | ||
public override string getDescription() | ||
{ | ||
return "Set player colored chat."; | ||
} | ||
|
||
/// <inheritdoc/> | ||
public override string getHelp() | ||
{ | ||
return "Usage:\n" + | ||
" 1. ty-SetPlayerColoredChat {PlayerId/EntityId/PlayerName} {NameColor} {TextColor} {CustomName} {Description}\n" + | ||
" 2. ty-SetPlayerColoredChat {PlayerId/EntityId/PlayerName} {NameColor} {TextColor} {CustomName}\n" + | ||
" 3. ty-SetPlayerColoredChat {PlayerId/EntityId/PlayerName} {NameColor} {TextColor}\n" + | ||
" 4. ty-SetPlayerColoredChat {PlayerId/EntityId/PlayerName} {NameColor}\n" + | ||
"1. Set player colored chat with name color, text color, custom name and description.\n" + | ||
"2. Set player colored chat with name color, text color and custom name.\n" + | ||
"3. Set player colored chat with name color and text color.\n" + | ||
"4. Set player colored chat with name color."; | ||
} | ||
|
||
/// <inheritdoc/> | ||
public override string[] getCommands() | ||
{ | ||
return new string[] | ||
{ | ||
"ty-SetPlayerColoredChat", | ||
"ty-spcc" | ||
}; | ||
} | ||
|
||
/// <inheritdoc/> | ||
public override async void Execute(List<string> args, CommandSenderInfo _senderInfo) | ||
{ | ||
if (args.Count < 2) | ||
{ | ||
Log("Wrong number of arguments."); | ||
Log(getHelp()); | ||
return; | ||
} | ||
|
||
try | ||
{ | ||
var cInfo = ConsoleHelper.ParseParamIdOrName(args[0]); | ||
string? playerId = cInfo?.CrossplatformId.CombinedString ?? PlatformUserIdentifierAbs.FromCombinedString(args[0])?.CombinedString; | ||
|
||
if (playerId == null) | ||
{ | ||
Log("Unable to locate player '{0}' online or offline", args[0]); | ||
return; | ||
} | ||
|
||
var entity = new T_ColoredChat() | ||
{ | ||
Id = playerId, | ||
NameColor = args[1], | ||
TextColor = args[2], | ||
CustomName = args.Count > 3 ? args[3] : null, | ||
Description = args.Count > 4 ? args[4] : null, | ||
CreatedAt = DateTime.Now, | ||
}; | ||
|
||
var repository = ModApi.ServiceContainer.Resolve<IColoredChatRepository>(); | ||
bool result = repository.InsertOrReplace(entity) == 1; | ||
if (result == false) | ||
{ | ||
Log("Failed to set player '{0}' colored chat.", playerId); | ||
} | ||
} | ||
catch (Exception ex) | ||
{ | ||
Log("Error in SetPlayerColoredChat.Execute:" + ex.Message); | ||
} | ||
} | ||
} | ||
} |
This file contains 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,75 @@ | ||
namespace SdtdServerKit.Commands | ||
{ | ||
/// <summary> | ||
/// Set player custom var. | ||
/// </summary> | ||
public class SetPlayerCustomVar : ConsoleCmdBase | ||
{ | ||
/// <inheritdoc/> | ||
public override string getDescription() | ||
{ | ||
return "Set player custom var."; | ||
} | ||
|
||
/// <inheritdoc/> | ||
public override string getHelp() | ||
{ | ||
return "Usage:\n" + | ||
" 1. ty-setcvar {PlayerId/EntityId/PlayerName} {cvarName} {cvarValue}" + | ||
" 2. ty-setcvar {cvarName} {cvarValue}" + | ||
"1. Set player custom var." + | ||
"2. Set yourself custom var."; | ||
} | ||
|
||
/// <inheritdoc/> | ||
public override string[] getCommands() | ||
{ | ||
return new string[] | ||
{ | ||
"ty-SetPlayerCustomVar", | ||
"ty-spcv", | ||
"ty-setcvar" | ||
}; | ||
} | ||
|
||
/// <inheritdoc/> | ||
public override void Execute(List<string> args, CommandSenderInfo _senderInfo) | ||
{ | ||
ClientInfo cInfo; | ||
string name, value; | ||
if (args.Count == 2) | ||
{ | ||
cInfo = _senderInfo.RemoteClientInfo; | ||
name = args[0]; | ||
value = args[1]; | ||
} | ||
else if (args.Count == 3) | ||
{ | ||
cInfo = ConsoleHelper.ParseParamIdOrName(args[0]); | ||
if (cInfo == null) | ||
{ | ||
Log("Unable to locate player '{0}' online", args[0]); | ||
return; | ||
} | ||
name = args[1]; | ||
value = args[2]; | ||
} | ||
else | ||
{ | ||
Log("Wrong number of arguments."); | ||
Log(getHelp()); | ||
return; | ||
} | ||
|
||
int entityId = cInfo!.entityId; | ||
if (GameManager.Instance.World.Players.dict.TryGetValue(entityId, out var player)) | ||
{ | ||
player.Buffs.SetCustomVar(name, float.Parse(value)); | ||
} | ||
else | ||
{ | ||
Log("Unable to locate player entity id '{0}' online", entityId); | ||
} | ||
} | ||
} | ||
} |
This file contains 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,25 @@ | ||
using IceCoffee.SimpleCRUD.Dtos; | ||
|
||
namespace SdtdServerKit.Data.Dtos | ||
{ | ||
/// <summary> | ||
/// | ||
/// </summary> | ||
public class ChatRecordQueryDto : PaginationQueryDto<ChatRecordQueryOrder> | ||
{ | ||
/// <summary> | ||
/// Start Date Time | ||
/// </summary> | ||
public DateTime? StartDateTime { get; set; } | ||
|
||
/// <summary> | ||
/// End Date Time | ||
/// </summary> | ||
public DateTime? EndDateTime { get; set; } | ||
|
||
/// <summary> | ||
/// Chat Type | ||
/// </summary> | ||
public ChatType? ChatType { get; set; } | ||
} | ||
} |
This file was deleted.
Oops, something went wrong.
This file contains 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 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 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 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 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 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 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 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 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 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
Oops, something went wrong.