1
0
mirror of https://github.com/oliverbooth/VpSharp synced 2024-11-22 23:58:47 +00:00

Use explicit type when not apparent

This commit is contained in:
Oliver Booth 2022-11-30 18:52:49 +00:00
parent b871b8e74c
commit 7e69bdce39
No known key found for this signature in database
GPG Key ID: 32A00B35503AF634
3 changed files with 8 additions and 7 deletions

View File

@ -1,6 +1,7 @@
using System.Reflection; using System.Reflection;
using VpSharp.ClientExtensions; using VpSharp.ClientExtensions;
using VpSharp.Commands.Attributes; using VpSharp.Commands.Attributes;
using VpSharp.Entities;
using VpSharp.EventData; using VpSharp.EventData;
namespace VpSharp.Commands; namespace VpSharp.Commands;
@ -133,7 +134,7 @@ public sealed class CommandsExtension : VirtualParadiseClientExtension
protected override Task OnMessageReceived(MessageReceivedEventArgs args) protected override Task OnMessageReceived(MessageReceivedEventArgs args)
{ {
ArgumentNullException.ThrowIfNull(args); ArgumentNullException.ThrowIfNull(args);
var message = args.Message; VirtualParadiseMessage message = args.Message;
if (message.Type != MessageType.ChatMessage) if (message.Type != MessageType.ChatMessage)
{ {

View File

@ -75,7 +75,7 @@ public sealed partial class VirtualParadiseClient
} }
VirtualParadiseAvatar? avatar = GetAvatar(session); VirtualParadiseAvatar? avatar = GetAvatar(session);
message = new VirtualParadiseMessage((MessageType) type, name, content, avatar, style, color); message = new VirtualParadiseMessage((MessageType)type, name, content, avatar, style, color);
} }
var args = new MessageReceivedEventArgs(message); var args = new MessageReceivedEventArgs(message);
@ -165,8 +165,8 @@ public sealed partial class VirtualParadiseClient
session = vp_int(sender, IntegerAttribute.AvatarSession); session = vp_int(sender, IntegerAttribute.AvatarSession);
} }
VirtualParadiseObject? virtualParadiseObject = await ExtractObjectAsync(sender).ConfigureAwait(false); VirtualParadiseObject virtualParadiseObject = await ExtractObjectAsync(sender).ConfigureAwait(false);
var cell = virtualParadiseObject.Location.Cell; Cell cell = virtualParadiseObject.Location.Cell;
virtualParadiseObject = AddOrUpdateObject(virtualParadiseObject); virtualParadiseObject = AddOrUpdateObject(virtualParadiseObject);
@ -268,7 +268,7 @@ public sealed partial class VirtualParadiseClient
} }
VirtualParadiseAvatar? avatar = GetAvatar(session); VirtualParadiseAvatar? avatar = GetAvatar(session);
var virtualParadiseObject = await GetObjectAsync(objectId).ConfigureAwait(false); VirtualParadiseObject virtualParadiseObject = await GetObjectAsync(objectId).ConfigureAwait(false);
var args = new ObjectClickedEventArgs(avatar, virtualParadiseObject, clickPoint); var args = new ObjectClickedEventArgs(avatar, virtualParadiseObject, clickPoint);
RaiseEvent(ObjectClicked, args); RaiseEvent(ObjectClicked, args);
} }
@ -281,7 +281,7 @@ public sealed partial class VirtualParadiseClient
{ {
string name = vp_string(sender, StringAttribute.WorldName); string name = vp_string(sender, StringAttribute.WorldName);
int avatarCount = vp_int(sender, IntegerAttribute.WorldUsers); int avatarCount = vp_int(sender, IntegerAttribute.WorldUsers);
var state = (WorldState) vp_int(sender, IntegerAttribute.WorldState); var state = (WorldState)vp_int(sender, IntegerAttribute.WorldState);
world = new VirtualParadiseWorld(this, name) world = new VirtualParadiseWorld(this, name)
{ {

View File

@ -574,7 +574,7 @@ public sealed partial class VirtualParadiseClient : IDisposable
} }
} }
var avatar = CurrentAvatar; VirtualParadiseAvatar? avatar = CurrentAvatar;
return Task.FromResult(new VirtualParadiseMessage( return Task.FromResult(new VirtualParadiseMessage(
MessageType.ChatMessage, MessageType.ChatMessage,
avatar!.Name, avatar!.Name,