Skip to content
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
1 change: 1 addition & 0 deletions Maple2.Server.Core/Network/Session.cs
Original file line number Diff line number Diff line change
Expand Up @@ -281,6 +281,7 @@ private void LogSend(byte[] packet, int length) {
case SendOp.RequestHeartbeat:
case SendOp.FurnishingInventory:
case SendOp.FurnishingStorage:
case SendOp.Vibrate:
break;
default:
Logger.Verbose("{Mode} ({Name} - {OpCode}): {Packet}", "SEND".ColorRed(), opcode, $"0x{op:X4}", packet.ToHexString(length, ' '));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,6 @@
using Maple2.Tools.DotRecast;
using Maple2.Tools.Extensions;
using Maple2.Tools.Scheduler;
using Maple2.Tools.VectorMath;
using Serilog;

namespace Maple2.Server.Game.Manager.Field;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -69,13 +69,13 @@ public void Update(long tickCount) {
actor.AppendDebugMessage($"Lost target '{GetTargetName()}'\n");

Target = null;
if (actor is FieldPet pet && pet.OwnerId == 0) {
if (actor is FieldPet { OwnerId: 0 } pet) {
actor.Field.Broadcast(PetPacket.SyncTaming(0, pet));
}
}

if (CanBattle && TargetId == 0 && nextTargetSearchTick <= tickCount) {
if (actor is FieldPet pet && pet.OwnerId == 0 && pet.TamingPoint <= 0) {
if (actor is FieldPet { OwnerId: 0, TamingPoint: <= 0 }) {
return;
}
FindNewTarget();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ namespace Maple2.Server.Game.Model.ActorStateComponent;

public partial class MovementState {
private SkillRecord? castSkill = null;
private NpcTask? castTask = null;
public NpcTask? CastTask { get; private set; } = null;
private Vector3 castMoveOffset;
private string castMoveStartKeyframe;
private string castMoveEndKeyframe;
Expand All @@ -16,7 +16,7 @@ public partial class MovementState {

public void StateSkillEvent(string keyName) {
if (castSkill is null) {
castTask?.Cancel();
CastTask?.Cancel();

return;
}
Expand Down Expand Up @@ -55,13 +55,12 @@ public void StateSkillEvent(string keyName) {
int motionCount = castSkill.Metadata.Data.Motions.Length;
byte motion = castSkill.MotionPoint;

if (castTask is NpcSkillCastTask task && motion + 1 < motionCount) {
if (CastTask is NpcSkillCastTask task && motion + 1 < motionCount) {
SkillCast(task, castSkill!.SkillId, castSkill!.Level, 0, (byte) (motion + 1));

return;
}

castTask?.Completed();
CastTask?.Completed();

break;
case "move0":
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
namespace Maple2.Server.Game.Model.ActorStateComponent;

public partial class MovementState {
class NpcSkillCastTask : NpcTask {
public class NpcSkillCastTask : NpcTask {
private readonly MovementState movement;

public SkillRecord? Cast;
Expand All @@ -33,7 +33,7 @@ protected override void TaskResumed() {

protected override void TaskFinished(bool isCompleted) {
movement.castSkill = null;
movement.castTask = null;
movement.CastTask = null;
movement.Idle();
movement.actor.AppendDebugMessage((isCompleted ? "Finished" : "Canceled") + " cast\n");
}
Expand Down Expand Up @@ -77,8 +77,8 @@ private void SkillCastFaceTarget(SkillRecord cast, IActor target, int faceTarget
}

private void SkillCast(NpcSkillCastTask task, int id, short level, long uid, byte motion) {
if (castTask != task) {
castTask?.Cancel();
if (CastTask != task) {
CastTask?.Cancel();
}

if (!CanTransitionToState(ActorState.PcSkill)) {
Expand Down Expand Up @@ -109,7 +109,7 @@ private void SkillCast(NpcSkillCastTask task, int id, short level, long uid, byt
SkillCastFaceTarget(cast, actor.BattleState.Target, task.FaceTarget);
}

castTask = task;
CastTask = task;
castSkill = cast;
task.Cast = cast;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ public class TaskState {
public TaskState(FieldNpc actor) {
Actor = actor;

var comparer = Comparer<NpcTaskPriority>.Create((NpcTaskPriority item1, NpcTaskPriority item2) => item2.CompareTo(item1));
var comparer = Comparer<NpcTaskPriority>.Create((item1, item2) => item2.CompareTo(item1));

taskQueue = new PriorityQueue<NpcTask, NpcTaskPriority>(comparer);
runningTasks = new NpcTask?[(int) NpcTaskPriority.Count];
Expand All @@ -28,7 +28,7 @@ private NpcTaskStatus QueueTask(NpcTask task) {

queued?.Cancel();

if (taskQueue.TryPeek(out NpcTask? currentTask, out NpcTaskPriority priority) && currentTask.PriorityValue < task.PriorityValue) {
if (taskQueue.TryPeek(out NpcTask? currentTask, out _) && currentTask.PriorityValue < task.PriorityValue) {
if (currentTask.CancelOnInterrupt) {
currentTask.Cancel();
} else {
Expand Down
4 changes: 2 additions & 2 deletions Maple2.Server.Game/Model/Field/Actor/FieldNpc.cs
Original file line number Diff line number Diff line change
Expand Up @@ -199,7 +199,7 @@ private void DoIdleBehavior(long tickCount) {
return;
}

if (hasBeenBattling && idleTask is null) {
if (hasBeenBattling && idleTask is null && MovementState.CastTask is null) {
Vector3 spawnPoint = Navigation?.GetRandomPatrolPoint() ?? Origin;

idleTask = MovementState.TryMoveTo(spawnPoint, false);
Expand Down Expand Up @@ -330,7 +330,7 @@ public virtual void Animate(string sequenceName, float duration = -1f) {
return;
}

bool isIdle = sequenceName.Contains("idle", StringComparison.OrdinalIgnoreCase);
bool isIdle = sequenceName.Contains("idle", StringComparison.OrdinalIgnoreCase) || sequenceName.Contains("sit", StringComparison.OrdinalIgnoreCase);

idleTask = MovementState.TryEmote(sequence.Name, isIdle, duration);
}
Expand Down
1 change: 0 additions & 1 deletion Maple2.Server.Game/Service/ChannelService.Heartbeat.cs
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
using Grpc.Core;
using Maple2.Server.Core.Packets;
using Maple2.Server.Game.Session;
using Serilog;

namespace Maple2.Server.Game.Service;

Expand Down
2 changes: 1 addition & 1 deletion Maple2.Server.Game/Trigger/TriggerContext.Cinematic.cs
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ public void SetOnetimeEffect(int id, bool enabled, string path) {
}

public void SetCinematicUi(int type, string script, bool arg3) {
WarnLog("[SetCinematicUI] type:{Type}, script:{Script}, arg3:{Arg3}", type, script, arg3);
DebugLog("[SetCinematicUI] type:{Type}, script:{Script}, arg3:{Arg3}", type, script, arg3);
switch (type) {
case 0:
Broadcast(CinematicPacket.ToggleUi(false));
Expand Down
Loading