public static void ProcessClanInvite(string invitedPlayer, Socket connection) { Player thisPlayer = GetPlayer(connection); if (thisPlayer == null) { return; } if (thisPlayer.ClanId == 0) { return; } if (!thisPlayer.IsClanLeader) { return; } //find the player that we want to invite Player targetPlayer = Players.SingleOrDefault(x => x.Name == invitedPlayer); if (targetPlayer == null || targetPlayer == thisPlayer || targetPlayer.ClanId != 0) { return; } if (targetPlayer.PendingInvite != null) { return; // he's currently considering an invite, @TODO: send a message back saying it } CreatePendingInvite(targetPlayer, thisPlayer, true); string clanName = ClanNames.ContainsKey(thisPlayer.ClanId) ? ClanNames[thisPlayer.ClanId] : "Undefined"; byte[] message = MergeByteArrays(ToBytes(Command.ClanInvite), WriteMmoString(thisPlayer.Name), WriteMmoString(clanName)); targetPlayer.SendOrKick(message); //forward the Clan Invite message to the target player }