public void DisplayEmail(MessageItem item) { UserReference r = null; switch (item.Type) { case 1: r = UserReference.Of(UserReferenceType.TSO); break; //vote case 2: r = UserReference.Of(UserReferenceType.TSO); break; //club case 3: r = UserReference.Of(UserReferenceType.MAXIS); break; case 4: r = UserReference.Of(UserReferenceType.TSO); break; case 5: r = UserReference.Of(UserReferenceType.TSO); break; //house case 6: r = UserReference.Of(UserReferenceType.TSO); break; //roommate } if (r == null) { DataService.Get <Avatar>(item.SenderID).ContinueWith(x => { GameThread.NextUpdate(y => { var msg = Chat.ReadLetter(UserReference.Wrap(x.Result), item); if (msg != null) { Chat.SetEmailMessage(msg, item); Chat.ShowWindow(msg); } }); }); } else { GameThread.NextUpdate(y => { var msg = Chat.ReadLetter(r, item); if (msg != null) { Chat.SetEmailMessage(msg, item); Chat.ShowWindow(msg); } }); } }
private void HandleInstantMessage(InstantMessage message) { var sendAck = message.Type == InstantMessageType.MESSAGE; if (message.Type == InstantMessageType.FAILURE_ACK) { switch (message.Reason) { case InstantMessageFailureReason.THEY_ARE_OFFLINE: message.Message = GameFacade.Strings.GetString("195", "5"); break; case InstantMessageFailureReason.MESSAGE_QUEUE_FULL: message.Message = GameFacade.Strings.GetString("225", "4"); break; case InstantMessageFailureReason.THEY_ARE_IGNORING_YOU: message.Message = GameFacade.Strings.GetString("195", "19"); break; case InstantMessageFailureReason.YOU_ARE_IGNORING_THEM: message.Message = GameFacade.Strings.GetString("195", "18"); break; default: message.Message = message.Message = GameFacade.Strings.GetString("195", "11"); break; } } var existing = GetMessageByUser(MessageType.Call, message.FromType, message.From); if (existing != null) { var window = GetWindow(existing); existing.Read = window.Visible; window.AddMessage(existing.User, message.Message, message.Color, IMEntryType.MESSAGE_IN); if (message.FromType == UserReferenceType.AVATAR && sendAck) { Network.CityClient.Write(new InstantMessage { Type = InstantMessageType.SUCCESS_ACK, AckID = message.AckID, To = message.From, FromType = UserReferenceType.AVATAR, From = Network.MyCharacter }); HIT.HITVM.Get().PlaySoundEvent("ui_call_rec_next"); } return; } //Need to create an IM window for this user var reference = UserReference.Of(message.FromType, message.From); var newMessage = Call(reference); if (newMessage == null) { if (message.FromType == UserReferenceType.AVATAR && sendAck) { Network.CityClient.Write(new InstantMessage { Type = InstantMessageType.FAILURE_ACK, AckID = message.AckID, To = message.From, FromType = UserReferenceType.AVATAR, From = Network.MyCharacter, Reason = InstantMessageFailureReason.MESSAGE_QUEUE_FULL }); } return; } var newWindow = GetWindow(newMessage); // in TSO, new message windows were received in the tray and had to be opened newMessage.Read = false; newWindow.Visible = false; UpdateTray(); newWindow.AddMessage(newMessage.User, message.Message, message.Color, IMEntryType.MESSAGE_IN); //We need to make sure we have their name and icon if (message.FromType == UserReferenceType.AVATAR) { if (sendAck) { Network.CityClient.Write(new InstantMessage { Type = InstantMessageType.SUCCESS_ACK, AckID = message.AckID, To = message.From, FromType = UserReferenceType.AVATAR, From = Network.MyCharacter }); HIT.HITVM.Get().PlaySoundEvent("ui_call_rec_first"); } DataService.Request(MaskedStruct.Messaging_Icon_Avatar, message.From); DataService.Request(MaskedStruct.Messaging_Message_Avatar, message.From).ContinueWith(x => { GameThread.NextUpdate(y => { if (newWindow != null) { newWindow.RenderMessages(); } }); }); } }