private void HandlePartyUpdateMessage(IAccount account, PartyUpdateMessage message) { if (PartyMembers.ContainsKey(message.MemberInformations.Id)) { PartyMembers[message.MemberInformations.Id] = message.MemberInformations; } else { Logger.Default.Log($"Player <{message.MemberInformations.Name}> can't be updated. Could not find player in your party.", LogMessageType.Error); } }
private void HandlePartyNewMemberMessage(IAccount account, PartyNewMemberMessage message) { if (message.MemberInformations.Id == account.Character.Id) { return; } if (PartyMembers.ContainsKey(message.MemberInformations.Id)) { Logger.Default.Log($"Player <{message.MemberInformations.Name}> is already listed in your party.", LogMessageType.Error); PartyNewMemberEvent?.Invoke(account, false); } else { PartyMembers.Add(message.MemberInformations.Id, message.MemberInformations); Logger.Default.Log($"Player <{message.MemberInformations.Name}> is a new member of your party.", LogMessageType.Party); PartyNewMemberEvent?.Invoke(account, true); } }
private void HandlePartyJoinMessage(IAccount account, PartyJoinMessage message) { PartyId = message.PartyId; if (message.PartyLeaderId == account.Character.Id) { IsLeader = true; } else { IsLeader = false; } foreach (var member in message.Members) { if (!PartyMembers.ContainsKey(member.Id)) { PartyMembers.Add(member.Id, member); } } }
private void HandlePartyMemberRemoveMessage(IAccount account, PartyMemberRemoveMessage message) { if (PartyMembers.ContainsKey(message.LeavingPlayerId)) { Logger.Default.Log($"Player <{PartyMembers[message.LeavingPlayerId].Name}> was removed from your party.", LogMessageType.Party); PartyMembers.Remove(message.LeavingPlayerId); if (PartyMembers.Count == 1) { Logger.Default.Log($"Your party has been disbanded.", LogMessageType.Party); PartyMembers.Clear(); } else { Logger.Default.Log($"Your party has now {PartyMembers.Count} members", LogMessageType.Party); } } else { Logger.Default.Log($"Player <{message.LeavingPlayerId}> is not a member of your party. It can't be removed.", LogMessageType.Party); } }