-
Notifications
You must be signed in to change notification settings - Fork 64
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 #601 from caioavidal/build
Fix threading blocking test attribute
- Loading branch information
Showing
106 changed files
with
574 additions
and
591 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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,59 +1,58 @@ | ||
using NeoServer.Game.Combat.Spells; | ||
using System; | ||
using System.Text.RegularExpressions; | ||
using NeoServer.Game.Combat.Spells; | ||
using NeoServer.Game.Common; | ||
using NeoServer.Game.Common.Contracts.Creatures; | ||
using NeoServer.Networking.Packets.Outgoing; | ||
using NeoServer.Server.Common.Contracts; | ||
using NeoServer.Server.Helpers; | ||
|
||
using System; | ||
using System.Text.RegularExpressions; | ||
namespace NeoServer.Extensions.Spells.Commands; | ||
|
||
namespace NeoServer.Extensions.Spells.Commands | ||
public class BroadcastCommand : CommandSpell | ||
{ | ||
public class BroadcastCommand : CommandSpell | ||
public override bool OnCast(ICombatActor actor, string words, out InvalidOperation error) | ||
{ | ||
public override bool OnCast(ICombatActor actor, string words, out InvalidOperation error) | ||
var ctx = IoC.GetInstance<IGameCreatureManager>(); | ||
|
||
if (Params.Length > 0) | ||
{ | ||
var ctx = IoC.GetInstance<IGameCreatureManager>(); | ||
|
||
if (Params.Length > 0) | ||
var regex = new Regex("^(\\w+).\"(.+)\"$", RegexOptions.Compiled, TimeSpan.FromSeconds(1)); | ||
var match = regex.Match(Params[0].ToString()); | ||
|
||
if (match.Groups.Count == 3) | ||
{ | ||
var regex = new Regex("^(\\w+).\"(.+)\"$", RegexOptions.Compiled, TimeSpan.FromSeconds(1)); | ||
var match = regex.Match(Params[0].ToString()); | ||
var (color, message) = (match.Groups[1].Value, match.Groups[2].Value); | ||
|
||
if (match.Groups.Count == 3) | ||
foreach (var player in ctx.GetAllLoggedPlayers()) | ||
{ | ||
var (color, message) = (match.Groups[1].Value, match.Groups[2].Value); | ||
if (player is null) | ||
continue; | ||
|
||
foreach (var player in ctx.GetAllLoggedPlayers()) | ||
{ | ||
if (player is null) | ||
continue; | ||
if (ctx.GetPlayerConnection(player.CreatureId, out var connection) is false) continue; | ||
|
||
if (ctx.GetPlayerConnection(player.CreatureId, out var connection) is false) continue; | ||
|
||
connection.OutgoingPackets.Enqueue(new TextMessagePacket(message, GetTextMessageOutgoingTypeFromColor(color))); | ||
connection.Send(); | ||
} | ||
|
||
error = InvalidOperation.None; | ||
return true; | ||
connection.OutgoingPackets.Enqueue(new TextMessagePacket(message, | ||
GetTextMessageOutgoingTypeFromColor(color))); | ||
connection.Send(); | ||
} | ||
} | ||
|
||
error = InvalidOperation.NotPossible; | ||
return false; | ||
error = InvalidOperation.None; | ||
return true; | ||
} | ||
} | ||
|
||
private TextMessageOutgoingType GetTextMessageOutgoingTypeFromColor(string color) | ||
error = InvalidOperation.NotPossible; | ||
return false; | ||
} | ||
|
||
private TextMessageOutgoingType GetTextMessageOutgoingTypeFromColor(string color) | ||
{ | ||
return color switch | ||
{ | ||
return color switch | ||
{ | ||
"white" => TextMessageOutgoingType.MESSAGE_EVENT_LEVEL_CHANGE, | ||
"red" => TextMessageOutgoingType.MESSAGE_STATUS_WARNING, | ||
"green" => TextMessageOutgoingType.Description, | ||
_ => TextMessageOutgoingType.Description | ||
}; | ||
} | ||
"white" => TextMessageOutgoingType.MESSAGE_EVENT_LEVEL_CHANGE, | ||
"red" => TextMessageOutgoingType.MESSAGE_STATUS_WARNING, | ||
"green" => TextMessageOutgoingType.Description, | ||
_ => TextMessageOutgoingType.Description | ||
}; | ||
} | ||
} | ||
} |
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
2 changes: 1 addition & 1 deletion
2
src/ApplicationServer/NeoServer.Server.Contracts/NeoServer.Server.Common.csproj
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
2 changes: 1 addition & 1 deletion
2
src/ApplicationServer/NeoServer.Server.Events/NeoServer.Server.Events.csproj
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.