private void GameRolePlayPlayerFightFriendlyRequestedMessageHandler(DofusClient client, GameRolePlayPlayerFightFriendlyRequestedMessage message) { client.Logger.Log($"Le joueur id: {message.SourceId} vous défi.", LogMessageType.Info); Randomize.RunBetween( () => client.Send(new GameRolePlayPlayerFightFriendlyAnswerMessage(message.FightId, false)), 2000, 4000); }
public static void HandleChallengeRequest(GameRolePlayPlayerFightRequestMessage message, WorldClient client) { if (client.Character.Map != null && client.Character.Map.HaveZaap) { client.Character.Reply("Action impossible sur cette carte."); return; } WorldClient target = WorldServer.Instance.GetOnlineClient((int)message.targetId); if (target.Character.Busy) { client.Character.Reply("Impossible car le joueur est occupé."); return; } if (message.friendly) { FightDual fight = FightProvider.Instance.CreateDualFight(client.Character.Map, client.Character.Record.CellId, message.targetCellId); fight.InitiatorId = client.Character.Id; fight.AcceptorId = target.Character.Id; Message sMessage = new GameRolePlayPlayerFightFriendlyRequestedMessage(fight.Id, (uint)client.Character.Id, message.targetId); client.Send(sMessage); target.Send(sMessage); } }
public static void HandleChallengeRequest(GameRolePlayPlayerFightRequestMessage message, WorldClient client) { if (client.Character.Map != null && client.Character.Map.HaveZaap) { client.Character.Reply("Action impossible sur cette carte."); return; } WorldClient target = WorldServer.Instance.GetOnlineClient((int)message.targetId); if (target.Character.Busy) { client.Character.Reply("Impossible car le joueur est occupé."); return; } if (message.friendly) { FightDual fight = FightProvider.Instance.CreateDualFight(client.Character.Map, client.Character.Record.CellId, message.targetCellId); fight.InitiatorId = client.Character.Id; fight.AcceptorId = target.Character.Id; Message sMessage = new GameRolePlayPlayerFightFriendlyRequestedMessage(fight.Id, (uint)client.Character.Id, message.targetId); client.Send(sMessage); target.Send(sMessage); } }
private Task HandleGameRolePlayPlayerFightFriendlyRequestedMessage(Account account, GameRolePlayPlayerFightFriendlyRequestedMessage message) => Task.Run(async() => { if (message.TargetId != account.Game.Character.Id) { return; } await Task.Delay(1000); var player = account.Game.Map.GetPlayer((int)message.SourceId); if (player != null) { await account.Network.SendMessageAsync(new GameRolePlayPlayerFightFriendlyAnswerMessage((int)message.FightId)); _account.Network.SendMessage(new IgnoredAddRequestMessage(player.Name, true)); _account.Network.SendMessage(new LeaveDialogRequestMessage()); account.Logger.LogWarning(LanguageManager.Translate("553"), LanguageManager.Translate("554")); } });