public GuildResultInfo(GuildResult result, ulong guildId = 0ul, string referenceString = "", uint referenceId = 0u) { Result = result; GuildId = guildId; ReferenceString = referenceString; ReferenceId = referenceId; }
/// <summary> /// Check whether the given inviter may invite the given target /// Sends result to the inviter /// </summary> /// <param name="inviter">inviter's character, can be null. If null, sending result is suppressed</param> /// <param name="target">invitee's character, can be null</param> /// <param name="targetName">invitee character's name</param> /// <returs>result of invite</returs> public static GuildResult CheckInvite(Character inviter, Character target, string targetName = null) { GuildResult err = GuildResult.SUCCESS; var inviterMember = inviter.GuildMember; if (inviterMember == null) { err = GuildResult.PLAYER_NOT_IN_GUILD; } else if (target == null) { // target is offline or doesn't exist err = GuildResult.PLAYER_NOT_FOUND; } else if (inviter == target) { err = GuildResult.PERMISSIONS; } else if (target.GuildMember != null) { err = GuildResult.ALREADY_IN_GUILD; } else if (target.IsInvitedToGuild) { err = GuildResult.ALREADY_INVITED_TO_GUILD; } //else if (inviter.Asda2FactionId != target.Asda2FactionId) //{ // //Check if the inviter and invitee are from the same faction // err = GuildResult.NOT_ALLIED; //} else { if (!inviter.Role.IsStaff) { if (!inviterMember.HasRight(GuildPrivileges.InviteMembers)) { err = GuildResult.PERMISSIONS; } else if (target.IsIgnoring(inviter)) { err = GuildResult.PLAYER_IGNORING_YOU; } else { return(GuildResult.SUCCESS); } } else { return(GuildResult.SUCCESS); } } inviter.SendSystemMessage(string.Format("Unable to invite {1} cause : {0}.", err, targetName)); //GuildHandler.SendResult(inviter.Client, GuildCommandId.INVITE, targetName, err); return(err); }
public override async Task <GuildResult> Get(GuildQuery request, ServerCallContext context) { var result = await _database.GetGuildAsync(request.Id); if (!result.Success) { return(new GuildResult { Status = Status.Failed }); } var output = new GuildResult { Status = Status.Success }; if (result.Value is not null) { output.Data = JsonSerializer.Serialize(result.Value); } return(output); }
/// <summary> /// Sends result of actions connected with guilds /// </summary> /// <param name="client">the client to send to</param> /// <param name="commandId">command executed</param> /// <param name="resultCode">The <see cref="GuildResult"/> result code</param> public static void SendResult(IPacketReceiver client, GuildCommandId commandId, GuildResult resultCode) { SendResult(client, commandId, string.Empty, resultCode); }
/// <summary> /// Sends result of actions connected with guilds /// </summary> /// <param name="client">the client to send to</param> /// <param name="commandId">command executed</param> /// <param name="name">name of player event has happened to</param> /// <param name="resultCode">The <see cref="GuildResult"/> result code</param> public static void SendResult(IPacketReceiver client, GuildCommandId commandId, string name, GuildResult resultCode) { // TODO: change params to enums using (var packet = new RealmPacketOut(RealmServerOpCode.SMSG_GUILD_COMMAND_RESULT)) { packet.WriteUInt((uint)commandId); packet.WriteCString(name); packet.WriteUInt((uint)resultCode); client.Send(packet); } }