public static MessagePacket Create(Enums.ChatType chattype, System.Drawing.Color color, string sender, string to, string message) { StringPacker msg = new StringPacker(sender, to, "", message); MessagePacket msgpacket = new MessagePacket(msg); msgpacket.Color = color; msgpacket.ChatType = chattype; return msgpacket; }
private void HandleCreateTopic(MessagePacket packet) { string topicName = packet.Data[0]; if (TopicManagerInstance.CreateTopic(ConnectionID, topicName)) { SendMessage(new MessagePacket(PacketTypes.PrintData, new string[] { $"Topic of name '{topicName}' has been successfully created." })); Console.WriteLine($"Publisher '{ConnectionID}' has created the topic '{topicName}'"); } else { SendMessage(new MessagePacket(PacketTypes.PrintData, new string[] { $"Topic of name '{topicName}' has failed to be created by the broker. Make sure that the topic doesn't already exist." })); Console.WriteLine($"Publisher '{ConnectionID}' has tried to create the topic '{topicName}' but the broker has failed."); } }
// Token: 0x06000112 RID: 274 RVA: 0x00012504 File Offset: 0x00010704 public void Recv_MSG_RESP_ALLIANCEWAR_MATCH_PLAYERDATA(MessagePacket MP) { this.m_AllianceWarHintData.bMain = false; this.m_AllianceWarHintData.Head = MP.ReadUShort(-1); for (int i = 0; i < 5; i++) { this.m_AllianceWarHintData.HeroData[i].ID = MP.ReadUShort(-1); this.m_AllianceWarHintData.HeroData[i].Rank = MP.ReadByte(-1); this.m_AllianceWarHintData.HeroData[i].Star = MP.ReadByte(-1); } this.m_AllianceWarHintData.bMain = (this.m_AllianceWarHintData.Head == this.m_AllianceWarHintData.HeroData[0].ID); for (int j = 0; j < 16; j++) { this.m_AllianceWarHintData.TroopData[j] = MP.ReadUInt(-1); } this.m_AllianceWarHintData.ArmyCoordIndex = MP.ReadByte(-1); this.m_AllianceWarHintData.ArmyCoordIndex = (byte)Mathf.Clamp((int)this.m_AllianceWarHintData.ArmyCoordIndex, 0, 5); GUIManager.Instance.UpdateUI(EGUIWindow.UI_AllianceWarBattle, 10, 0); }
private void HandleDeleteTopic(MessagePacket packet) { string topicName = packet.Data[0]; if (TopicManagerInstance.RemoveTopic(ConnectionID, topicName)) { SendMessage(new MessagePacket(PacketTypes.PrintData, new string[] { $"Topic of name '{topicName}' has been successfully deleted." })); Console.WriteLine($"Publisher '{ConnectionID}' has deleted the topic '{topicName}'"); } else { SendMessage(new MessagePacket(PacketTypes.PrintData, new string[] { $"Topic of name '{topicName}' could not be deleted. Either it doesn't exist or you do not own the topic." })); Console.WriteLine($"Publisher '{ConnectionID}' tried to delete the topic '{topicName}'. Either it doesn't exist or they do not own the topic."); } }
void ProcessClient(Bluetooth.BluetoothClient client) { var stream = client.GetStream(); while (true) { var buffer = new byte[Message.HeaderSize]; if (stream.Read(buffer, 0, Message.HeaderSize) > 0 && isRunning) { switch ((MessageType)(buffer[0] & Message.TypeMask)) { case MessageType.MoveScreen: break; case MessageType.MouseWheel: OnMouseWheelFromServer(buffer); break; case MessageType.MouseButton: OnMouseButtonFromServer(buffer); break; case MessageType.MouseMove: OnMouseMoveFromServer(buffer); break; case MessageType.KeyPress: OnKeyPressFromServer(buffer); break; case MessageType.Clipboard: OnClipboardFromServer(new ClipboardMessage(MessagePacket.Parse(new MessageInfo(buffer), stream))); break; case MessageType.CheckIn: CheckInMessage checkIn = new CheckInMessage(MessagePacket.Parse(new MessageInfo(buffer), stream)); ScreenConfig(stream); OnScreenConfig(checkIn.Screens); break; } } } }
public void SendMessage(string text) { try { if (_Client.Connected) { var packet = new MessagePacket() { NickName = NickName, Message = text }; byte[] buffer = Encoding.UTF8.GetBytes(packet.ToString()); _Client.Send(buffer); } } catch (Exception ex) { WriteLog.WriteLogger(ex.ToString()); } }
// Token: 0x06000214 RID: 532 RVA: 0x0001CFA4 File Offset: 0x0001B1A4 public void sendDelBookMark_Alliance(byte ID) { if (DataManager.Instance.RoleAlliance.Id == 0u || DataManager.Instance.RoleAlliance.Rank < AllianceRank.RANK4) { GUIManager.Instance.AddHUDMessage(DataManager.Instance.mStringTable.GetStringByID(4753u), 255, true); return; } if (!GUIManager.Instance.ShowUILock(EUILock.BookMark)) { return; } MessagePacket messagePacket = new MessagePacket(1024); messagePacket.Protocol = Protocol._MSG_REQUEST_ALLIANCE_REMOVEBOOKMARK; messagePacket.AddSeqId(); messagePacket.Add(0); messagePacket.Add(ID -= 1); messagePacket.Send(false); }
// Token: 0x06000208 RID: 520 RVA: 0x0001BF84 File Offset: 0x0001A184 public void RecvBookMarkList_Alliance(MessagePacket MP) { if (MP.ReadByte(-1) > 0) { return; } if (MP.ReadByte(-1) > 0) { return; } byte b = MP.ReadByte(-1); this.UpdateTimeAlliance = MP.ReadLong(-1); this.AllianceBookCount = 0; Array.Clear(this.AllianceIDIndex, 0, this.AllianceIDIndex.Length); for (byte b2 = 0; b2 < b; b2 += 1) { if (this.AllAllianceData.Length <= (int)b2) { break; } byte b3 = MP.ReadByte(-1); this.AllAllianceData[(int)b2].KingdomID = MP.ReadUShort(-1); this.AllAllianceData[(int)b2].KingdomPoint.zoneID = MP.ReadUShort(-1); this.AllAllianceData[(int)b2].KingdomPoint.pointID = MP.ReadByte(-1); this.AllAllianceData[(int)b2].MapID = 0; this.AllAllianceData[(int)b2].Type = 3; if (b3 > 0) { MP.ReadStringPlus((int)b3, this.AllAllianceData[(int)b2].Name, -1); this.AllAllianceData[(int)b2].ID = (ushort)(b2 + 1); this.AllianceIDIndex[(int)this.AllianceBookCount] = b2; this.AllianceBookCount += 1; } else { this.AllAllianceData[(int)b2].ID = 0; } } DataManager.Instance.RoleAlliance.BookmarkTime = this.UpdateTimeAlliance; GUIManager.Instance.HideUILock(EUILock.BookMark); GUIManager.Instance.UpdateUI(EGUIWindow.UI_BookMark, 0, 0); }
// Token: 0x060012DA RID: 4826 RVA: 0x0020E378 File Offset: 0x0020C578 public void Recv_MSG_RESP_KINGDOM_VS_TOPBOARD(MessagePacket MP) { LeaderBoardManager.Instance.KingdomBoardNextTime = DataManager.Instance.ServerTime + 43200L; if (this.KVSTopBoard == null) { this.KVSTopBoard = new KVSBoardTopBoard(); } this.KVSTopBoard.SortTime = MP.ReadLong(-1); if (this.KVSTopBoard.SortTime == 0L) { LeaderBoardManager.Instance.KingdomBoardNextTime = 0L; } this.KVSTopBoard.KVSTopKingdom = MP.ReadUShort(-1); this.KVSTopBoard.KVSTopAlliKingdomID = MP.ReadUShort(-1); this.KVSTopBoard.KVSTopAlliAllianceID = MP.ReadUInt(-1); MP.ReadStringPlus(3, this.KVSTopBoard.KVSTopAlliTag, -1); MP.ReadStringPlus(20, this.KVSTopBoard.KVSTopAlliName, -1); this.KVSTopBoard.KVSTopAlliScore = MP.ReadULong(-1); this.KVSTopBoard.KVSTopAlliEmblem = MP.ReadUShort(-1); MP.ReadStringPlus(3, this.KVSTopBoard.KVSTopPlayerTag, -1); MP.ReadStringPlus(13, this.KVSTopBoard.KVSTopPlayerName, -1); this.KVSTopBoard.KVSPlayerValue = MP.ReadULong(-1); this.KVSTopBoard.KVSTopPlayerKingdomID = MP.ReadUShort(-1); this.KVSTopBoard.KVSPlayerHead = MP.ReadUShort(-1); MP.ReadStringPlus(13, this.KVSTopBoard.KvKAlliTopPlayerName, -1); this.KVSTopBoard.KvKAlliTopPlayerValue = MP.ReadULong(-1); this.KVSTopBoard.KvKAlliTopPlayerHead = MP.ReadUShort(-1); this.KVSTopBoard.KVKTopKingdom = MP.ReadUShort(-1); this.KVSTopBoard.KvKTopAlliKingdomID = MP.ReadUShort(-1); this.KVSTopBoard.KvKTopAlliAllianceID = MP.ReadUInt(-1); MP.ReadStringPlus(3, this.KVSTopBoard.KvKTopAlliTag, -1); MP.ReadStringPlus(20, this.KVSTopBoard.KvKTopAlliName, -1); this.KVSTopBoard.KvKTopAlliScore = MP.ReadULong(-1); this.KVSTopBoard.KvKTopAlliEmblem = MP.ReadUShort(-1); MP.ReadStringPlus(3, this.KVSTopBoard.KvKTopPlayerTag, -1); MP.ReadStringPlus(13, this.KVSTopBoard.KvKTopPlayerName, -1); this.KVSTopBoard.KvKPlayerValue = MP.ReadULong(-1); this.KVSTopBoard.KvKTopPlayerKingdomID = MP.ReadUShort(-1); this.KVSTopBoard.KvKPlayerHead = MP.ReadUShort(-1); this.KVSTopBoard.KingdomEventRequireTime = MP.ReadUInt(-1); this.KVSTopBoard.AllianceID = (ulong)DataManager.Instance.RoleAlliance.Id; GUIManager.Instance.UpdateUI(EGUIWindow.UI_KingdomVSLBoard, 2, 0); }
// Token: 0x060016AD RID: 5805 RVA: 0x00271C24 File Offset: 0x0026FE24 public static void onFinish() { if (UIPetSkill.nowPetId > 0 && UIPetSkill.nowSkillId > 0) { ushort data; byte data2; GameConstants.MapIDToPointCode(UIPetSkill.nowMapPoint, out data, out data2); GUIManager.Instance.ShowUILock(EUILock.PetSkill); MessagePacket messagePacket = new MessagePacket(1024); messagePacket.Protocol = Protocol._MSG_REQUEST_PETSKILL_USE; messagePacket.AddSeqId(); messagePacket.Add(data); messagePacket.Add(data2); messagePacket.Add(UIPetSkill.nowPetId); messagePacket.Add(UIPetSkill.nowSkillId); messagePacket.Send(false); UIPetSkill.nowMapPoint = (int)(UIPetSkill.nowPetId = 0); } }
public void OnCantTrade(int otherID, int freeSlots) { GameClient other = _serverMap.FindGameClient(otherID); ServerCommand command = new ServerCommand(ServerCommand.CommandType.CantTrade); this.AddServerCommand(command); MessagePacket message = new MessagePacket("You only have " + freeSlots + " inventory slots."); this.RecieveMessage(message); if (other != null) { other.AddServerCommand(command); message = new MessagePacket(other.GetMapPlayer().Username + " only has " + freeSlots + " inventory slots."); other.RecieveMessage(message); } }
// Token: 0x060011B0 RID: 4528 RVA: 0x001EE4AC File Offset: 0x001EC6AC public void RecvFootballeKickPosition(MessagePacket MP) { this.bWaitingPos = 0; byte b = MP.ReadByte(-1); if (b > 0) { GUIManager.Instance.AddHUDMessage(DataManager.Instance.mStringTable.GetStringByID(14734u), 255, true); return; } this.FootballPosition.zoneID = MP.ReadUShort(-1); this.FootballPosition.pointID = MP.ReadByte(-1); Door door = GUIManager.Instance.FindMenu(EGUIWindow.Door) as Door; if (door) { door.GoToMapID(DataManager.MapDataController.OtherKingdomData.kingdomID, GameConstants.PointCodeToMapID(this.FootballPosition.zoneID, this.FootballPosition.pointID), 0, 1, true); } }
private void HandleUnsubFromTopic(MessagePacket packet) { string topicName = packet.Data[0]; if (TopicManagerInstance.UnsubscribeFromTopic(topicName, HandlerNetworkStream)) { SendMessage(new MessagePacket(PacketTypes.PrintData, new string[] { $"You have successfully unsubscribed from the topic '{topicName}'" })); Console.WriteLine($"Subscriber '{ConnectionID}' has unsubscribed from the topic '{topicName}'"); } else { SendMessage(new MessagePacket(PacketTypes.PrintData, new string[] { $"You have failed to unsubscribed from the topic '{topicName}'. This is because the topic doesn't exist." })); Console.WriteLine($"Subscriber '{ConnectionID}' tried to unsubscribed from the topic '{topicName}', but it didn't exist."); } }
// Token: 0x060010A3 RID: 4259 RVA: 0x001D8B5C File Offset: 0x001D6D5C public void RecvArena_Update_Single_target(MessagePacket MP) { byte b = MP.ReadByte(-1); b = (byte)Mathf.Clamp((int)b, 0, this.m_ArenaTarget.Length - 1); this.m_ArenaTarget[(int)b].Head = MP.ReadUShort(-1); this.m_ArenaTarget[(int)b].Name = MP.ReadString(13, -1); this.m_ArenaTarget[(int)b].AllianceTagTag = MP.ReadString(3, -1); this.m_ArenaTarget[(int)b].Place = MP.ReadUInt(-1); for (int i = 0; i < 5; i++) { this.m_ArenaTarget[(int)b].HeroData[i].ID = MP.ReadUShort(-1); this.m_ArenaTarget[(int)b].HeroData[i].Level = MP.ReadByte(-1); this.m_ArenaTarget[(int)b].HeroData[i].Rank = MP.ReadByte(-1); this.m_ArenaTarget[(int)b].HeroData[i].Star = MP.ReadByte(-1); this.m_ArenaTarget[(int)b].HeroData[i].Equip = MP.ReadByte(-1); } GUIManager.Instance.UpdateUI(EGUIWindow.UI_Arena, 8, (int)b); }
// Token: 0x060010A1 RID: 4257 RVA: 0x001D88D8 File Offset: 0x001D6AD8 public void RecvArena_Arena_GetPrize(MessagePacket MP) { GUIManager.Instance.HideUILock(EUILock.Arena); if (MP.ReadByte(-1) == 0) { this.m_ArenaCrystalPrize = 0u; uint num = MP.ReadUInt(-1); GUIManager.Instance.m_SpeciallyEffect.mDiamondValue = num - DataManager.Instance.RoleAttr.Diamond; GUIManager.Instance.SetRoleAttrDiamond(num, 0, eSpentCredits.eMax); GUIManager.Instance.CloseMenu(EGUIWindow.UI_TreasureBox); GUIManager.Instance.UIQueueLockRelease(EGUIQueueLock.UIQL_UI_notAllowPopUps); GameManager.OnRefresh(NetworkNews.Refresh, null); GUIManager.Instance.mStartV2 = new Vector2(GUIManager.Instance.m_SpeciallyEffect.mCanvasRT.sizeDelta.x / 2f, GUIManager.Instance.m_SpeciallyEffect.mCanvasRT.sizeDelta.y / 2f); GUIManager.Instance.m_SpeciallyEffect.AddIconShow(false, GUIManager.Instance.mStartV2, SpeciallyEffect_Kind.Diamond, 0, 0, true, 2f); GUIManager.Instance.BuildingData.UpdateBuildState(5, 255); GUIManager.Instance.UpdateUI(EGUIWindow.UI_Arena, 9, 0); AudioManager.Instance.PlayUISFX(UIKind.HUDTreasure); } }
// Token: 0x060008DD RID: 2269 RVA: 0x000B5F38 File Offset: 0x000B4138 public void Recv_MSG_RESP_GAMBLE_UPDATEINFO(MessagePacket MP) { uint sn = this.m_GambleEventSave.SN; this.m_GambleEventSave.SN = MP.ReadUInt(-1); this.m_GambleEventSave.State = (EActivityState)MP.ReadByte(-1); this.m_GambleEventSave.BeginTime = MP.ReadLong(-1); this.m_GambleEventSave.RequireTime = MP.ReadUInt(-1); this.m_GambleEventSave.GroupID = MP.ReadUShort(-1); this.m_GambleEventSave.MonsterID = MP.ReadUShort(-1); if (this.m_GambleEventSave.State != EActivityState.EAS_Run) { GUIManager.Instance.UpdateUI(EGUIWindow.UI_Battle_Gambling, 13, 0); } if (BattleController.IsGambleMode && sn != this.m_GambleEventSave.SN) { this.Send_MSG_REQUEST_GAMBLE_INFO(); } }
// Token: 0x06000207 RID: 519 RVA: 0x0001BDEC File Offset: 0x00019FEC public void RecvBookMarkList(MessagePacket MP) { ushort num = MP.ReadUShort(-1); this.NameSize = MP.ReadByte(-1); if (this.RecvDataCount > num) { this.RecvDataCount -= num; } else { this.RecvDataCount = 0; } for (ushort num2 = 0; num2 < num; num2 += 1) { ushort num3 = MP.ReadUShort(-1); num3 = (ushort)Mathf.Clamp((int)num3, 1, this.AllData.Length); BookMarkData[] allData = this.AllData; int num4 = (int)(num3 - 1); ushort num5 = num3; num3 = num5 - 1; allData[num4].ID = num5; this.AllData[(int)num3].Type = MP.ReadByte(-1); if (this.AllData[(int)num3].Type > 2) { this.AllData[(int)num3].Type = 0; } this.AllData[(int)num3].KingdomID = MP.ReadUShort(-1); this.AllData[(int)num3].KingdomPoint.zoneID = MP.ReadUShort(-1); this.AllData[(int)num3].KingdomPoint.pointID = MP.ReadByte(-1); MP.ReadStringPlus((int)this.NameSize, this.AllData[(int)num3].Name, -1); this.AddDataIndex(num3); if ((int)(num2 + this.RecvDataCount) < this.KindDataIDIndex[3].Length) { this.KindDataIDIndex[3][(int)(num2 + this.RecvDataCount)] = (byte)num3; } } if (this.RecvDataCount == 0) { GUIManager.Instance.HideUILock(EUILock.BookMark); GUIManager.Instance.UpdateUI(EGUIWindow.UI_BookMark, 0, 0); } }
// Token: 0x06000DFA RID: 3578 RVA: 0x0016406C File Offset: 0x0016226C public void Recv_MSG_UPDATE_ALLIANCE_MOBILIZATION_LEGEND_MISSION_DATA(MessagePacket MP) { this.AMGoldState = MP.ReadByte(-1); for (int i = 0; i < 3; i++) { this.AMGoldID[i] = MP.ReadUShort(-1); this.AMGoldRecord[i] = MP.ReadUInt(-1); } this.AMGoldHUD = (MP.ReadByte(-1) == 1); if (this.AMGoldHUD) { GUIManager.Instance.AddHUDMessage(DataManager.Instance.mStringTable.GetStringByID(17252u), 255, true); } if (GUIManager.Instance.FindMenu(EGUIWindow.UI_Alliance_Mobilization)) { GUIManager.Instance.UpdateUI(EGUIWindow.UI_Alliance_Mobilization, 12, 0); } ActivityManager.Instance.CheckAMShowHint(); }
public void FightButton() { MessagePacket packet = new MessagePacket( GameProtocol.ChallengePacketID(), Username.text + "|" + Singleton.Instance.Me.Username + " challenged you to a game!"); Singleton.Instance.Connection.SendPacket(packet.getData()); var list = SingletonUI.Instance.Helper.GetComponentsInChildren <ChallengeResultScript>(); //If is already a challange result from that user close it. foreach (ChallengeResultScript x in list) { if (x.Message.text.Split(' ')[0] == Username.text) { x.destroyMyself(); break; } } }
// Token: 0x0600133C RID: 4924 RVA: 0x0021AA5C File Offset: 0x00218C5C private void SubBoardChange(byte newSubID) { UIKVKLBoard.SubBoardID = newSubID; UIKVKLBoard.isTopBoard = false; if (UIKVKLBoard.SubBoardID == 7 && LeaderBoardManager.Instance.BoardUpdateTime[(int)UIKVKLBoard.SubBoardID] < DataManager.Instance.ServerTime) { UILeaderBoardBase.TopIndex[(int)UIKVKLBoard.SubBoardID] = 0; LeaderBoardManager.Instance.ClearBoard(7); LeaderBoardManager.Instance.MyRank[(int)UIKVKLBoard.SubBoardID] = 0; MessagePacket messagePacket = new MessagePacket(1024); messagePacket.AddSeqId(); messagePacket.Protocol = Protocol._MSG_REQUEST_ACTIVITY_AEVENT_PERSONAL_RANK; messagePacket.Send(false); } else if (UIKVKLBoard.SubBoardID >= 5 && LeaderBoardManager.Instance.BoardUpdateTime[(int)UIKVKLBoard.SubBoardID] < DataManager.Instance.ServerTime) { UILeaderBoardBase.TopIndex[(int)UIKVKLBoard.SubBoardID] = 0; MessagePacket messagePacket2 = new MessagePacket(1024); messagePacket2.AddSeqId(); messagePacket2.Protocol = Protocol._MSG_REQUEST_LEADERBOARD_CONTENT; ushort data; byte data2; GameConstants.MapIDToPointCode(DataManager.Instance.RoleAttr.CapitalPoint, out data, out data2); messagePacket2.Add(data); messagePacket2.Add(data2); messagePacket2.Add(UIKVKLBoard.SubBoardID); byte data3 = 0; messagePacket2.Add(data3); messagePacket2.Add(LeaderBoardManager.Instance.KvKTopBoard.SortTime); if (UIKVKLBoard.SubBoardID == 6) { messagePacket2.Add(DataManager.Instance.RoleAlliance.Id); } messagePacket2.Send(false); } else { this.CreateSubBoard(); base.SetOpenType(UILeaderBoardBase.e_OpenType.BoardContent); this.AGS_Panel2.AddNewDataHeight(this.SPHeight, true, true); this.AGS_Panel2.GoTo(UILeaderBoardBase.TopIndex[(int)UIKVKLBoard.SubBoardID]); } }
public void TestSerialization() { string input = @"-RAC- FROM:100.100.1.1:5000 TO:150.150.2.2:5001 CLS:s LEN:8 CNT: gc 1 i 5 -EOF-"; MessagePacket msg = new MessagePacket(input); string b2 = Encoding.Unicode.GetString(msg.Serialize()); Assert.Equal(msg.Serialize(), Encoding.Unicode.GetBytes(input)); }
private void HandleTopicMessage(MessagePacket packet) { string topicName = packet.Data[0]; string topicMessage = packet.Data[1]; if (TopicManagerInstance.SendMessage(ConnectionID, topicName, topicMessage)) { SendMessage(new MessagePacket(PacketTypes.PrintData, new string[] { $"You have published the message '{topicMessage}' to the topic '{topicName}'" })); Console.WriteLine($"Publisher '{ConnectionID}' has sent the message '{topicMessage}' to the topic '{topicName}'"); } else { SendMessage(new MessagePacket(PacketTypes.PrintData, new string[] { $"Could not send a message to the topic '{topicName}'. Either it doesn't exist or you do not own the topic." })); Console.WriteLine($"Publisher '{ConnectionID}' tried to send a message to '{topicName}', but it failed"); } }
internal void SendMessage <T>(MessagePacket message, Action <T> action) where T : IMessage <T>, new() { TaskCompletionSource <byte[]> taskCompletionSource = new TaskCompletionSource <byte[]>(); this.messageBag.TryAdd(message.MessageHeader.MessageID, taskCompletionSource); this.channel.WriteAndFlushAsync(message.ToByteBuffer(this.channel.Allocator.Buffer())); taskCompletionSource.Task.ContinueWith((bytes) => { MessageParser <T> messageParser = new MessageParser <T>(() => new T()); T t = messageParser.ParseFrom(bytes.Result); action(t); }); //if (!taskCompletionSource.Task.Wait(GloblParams.WaitReplyTimeoutInSecs)) //{ // this.messageBag.TryRemove(message.MessageHeader.MessageID, out taskCompletionSource); // throw new TimeoutException("timeout, cause by waiting for reply !"); //} //this.messageBag.TryRemove(message.MessageHeader.MessageID, out taskCompletionSource); //var taskCompletionSource.Task.Result; }
// Token: 0x06000DDD RID: 3549 RVA: 0x00163060 File Offset: 0x00161260 public void Recv_MSG_RESP_REDPOCKET_BUY(MessagePacket MP) { byte b = MP.ReadByte(-1); if (b == 0) { CString cstring = StringManager.Instance.StaticString1024(); cstring.AppendFormat(DataManager.Instance.mStringTable.GetStringByID(11207u)); GUIManager.Instance.AddHUDMessage(cstring.ToString(), 255, true); } else if (b == 1) { CString cstring2 = StringManager.Instance.StaticString1024(); cstring2.AppendFormat(DataManager.Instance.mStringTable.GetStringByID(11208u)); GUIManager.Instance.AddHUDMessage(cstring2.ToString(), 255, true); } AudioManager.Instance.PlayUISFX(UIKind.HUDTreasure); AudioManager.Instance.PlayUISFX(UIKind.ItemUse); GUIManager.Instance.HideUILock(EUILock.Mall); }
// Token: 0x060010A2 RID: 4258 RVA: 0x001D8A08 File Offset: 0x001D6C08 public void RecvArena_Update_Topic(MessagePacket MP) { this.m_NowArenaTopicID[0] = MP.ReadByte(-1); this.m_NowArenaTopicID[1] = MP.ReadByte(-1); this.m_NowArenaTopicEndTime = MP.ReadLong(-1); this.m_NowTopicEffect[0].Effect = MP.ReadUShort(-1); this.m_NowTopicEffect[0].Value = MP.ReadUShort(-1); this.m_NowTopicEffect[1].Effect = MP.ReadUShort(-1); this.m_NowTopicEffect[1].Value = MP.ReadUShort(-1); this.m_NextArenaTopicID[0] = MP.ReadByte(-1); this.m_NextArenaTopicID[1] = MP.ReadByte(-1); this.m_NextArenaTopicBeginTime = MP.ReadLong(-1); this.m_NextTopicEffect[0].Effect = MP.ReadUShort(-1); this.m_NextTopicEffect[0].Value = MP.ReadUShort(-1); this.m_NextTopicEffect[1].Effect = MP.ReadUShort(-1); this.m_NextTopicEffect[1].Value = MP.ReadUShort(-1); GUIManager.Instance.UpdateUI(EGUIWindow.UI_Arena, 10, 0); GUIManager.Instance.UpdateUI(EGUIWindow.UI_Arena_Info, 1, 0); DataManager.MissionDataManager.CheckChanged(eMissionKind.Record, 28, this.GetHeroAstrologyNum()); }
// Token: 0x06000215 RID: 533 RVA: 0x0001D04C File Offset: 0x0001B24C public void sendModifyBookMark(ushort ID, byte Type, string Name) { if (Type == 3) { this.sendModifyBookMark_Alliance((byte)ID, Name); return; } if (!GUIManager.Instance.ShowUILock(EUILock.BookMark)) { return; } MessagePacket messagePacket = new MessagePacket(1024); messagePacket.Protocol = Protocol._MSG_REQUEST_MODIFYBOOKMARK; messagePacket.AddSeqId(); messagePacket.Add(ID); messagePacket.Add(Type); messagePacket.Add(Encoding.UTF8.GetBytes(Name), 0, (int)this.NameSize); messagePacket.Send(false); }
// Token: 0x06000DDE RID: 3550 RVA: 0x0016312C File Offset: 0x0016132C public void RecvUpdate_EventInfo(MessagePacket MP) { this.ActivityGiftBeginTime = MP.ReadLong(-1); this.ActivityGiftEndTime = MP.ReadLong(-1); this.GroupID = MP.ReadByte(-1); for (int i = 0; i < DataManager.Instance.FastivalSpecialDataTable.TableCount; i++) { FastivalSpecialData recordByKey = DataManager.Instance.FastivalSpecialDataTable.GetRecordByKey((ushort)(i + 1)); if (this.GroupID == recordByKey.GroupID) { this.ParticleID = recordByKey.UB1; break; } } this.mLeaderRedPocketResetTime = MP.ReadLong(-1); ActivityGiftManager.Instance.bReSetMainGift = (ActivityGiftManager.Instance.mLeaderRedPocketResetTime > ActivityManager.Instance.ServerEventTime); GUIManager.Instance.UpdateUI(EGUIWindow.Door, 17, 0); GUIManager.Instance.UpdateUI(EGUIWindow.UI_Alliance_Info, 11, 0); GUIManager.Instance.UpdateUI(EGUIWindow.UI_Alliance_ActivityGift, 4, 0); }
// Token: 0x0600144C RID: 5196 RVA: 0x002394B0 File Offset: 0x002376B0 public void RecvFBGetReward(MessagePacket MP) { GUIManager.Instance.HideUILock(EUILock.Mission); byte b = MP.ReadByte(-1); if (b > 0) { CString cstring = StringManager.Instance.StaticString1024(); cstring.IntToFormat((long)b, 1, false); cstring.AppendFormat(DataManager.Instance.mStringTable.GetStringByID(12185u)); GUIManager.Instance.AddHUDMessage(cstring.ToString(), 255, true); return; } if (this.CurFBAwardData.AwardIndex == 11) { GUIManager.Instance.UpdateUI(EGUIWindow.UI_MissionFB, 1, 0); } GUIManager.Instance.UpdateUI(EGUIWindow.Door, 27, 1); AudioManager.Instance.PlayUISFX(UIKind.RewardReceive); }
// Token: 0x060024C1 RID: 9409 RVA: 0x004239B4 File Offset: 0x00421BB4 public void SendNobilityGift(long userid, ushort itemId, bool bGuest = false) { GUIManager.Instance.ShowUILock(EUILock.KingGift); MessagePacket messagePacket; if (bGuest) { messagePacket = MessagePacket.GetGuestMessagePack(); } else { messagePacket = new MessagePacket(1024); } messagePacket.Protocol = Protocol._MSG_REQUEST_FEDERAL_GIFT; messagePacket.AddSeqId(); messagePacket.Add(this.WonderID); messagePacket.Add(userid); messagePacket.Add(itemId); messagePacket.Send(false); }
// Token: 0x06001285 RID: 4741 RVA: 0x00209B04 File Offset: 0x00207D04 public void CheckIndemnifyResource(MessagePacket MP) { if (MP.ReadByte(-1) == 0) { DataManager.Instance.Resource[0].Stock = MP.ReadUInt(-1); DataManager.Instance.Resource[1].Stock = MP.ReadUInt(-1); DataManager.Instance.Resource[2].Stock = MP.ReadUInt(-1); DataManager.Instance.Resource[3].Stock = MP.ReadUInt(-1); GameManager.OnRefresh(NetworkNews.Refresh_Resource, null); Array.Clear(this.ResourceCache, 0, 4); this.AddResourceEffect(); GUIManager instance = GUIManager.Instance; instance.CloseMenu(EGUIWindow.UI_TreasureBox); instance.UIQueueLockRelease(EGUIQueueLock.UIQL_UI_notAllowPopUps); this.bTriggered = INDEMNIFY_STATE.None; GUIManager.Instance.UpdateUI(EGUIWindow.Door, 21, 0); Debug.LogWarning("CheckIndemnifyResource"); FBAdvanceManager.Instance.TriggerFbEvent(EFBEvent.COLLECT_EXTRA_SUPPLIES, 0L, 0UL); } }
// Token: 0x0600106F RID: 4207 RVA: 0x001D4F50 File Offset: 0x001D3150 public void SendAmbush(ushort[] Leader, uint[] TroopData) { if (GUIManager.Instance.ShowUILock(EUILock.Ambush)) { MessagePacket messagePacket = new MessagePacket(1024); messagePacket.Protocol = Protocol._MSG_REQUEST_SEND_AMBUSH; messagePacket.AddSeqId(); for (int i = 0; i < Leader.Length; i++) { messagePacket.Add(Leader[i]); } for (int j = 0; j < TroopData.Length; j++) { messagePacket.Add(TroopData[j]); } messagePacket.Add(this.ObjPoint.zoneID); messagePacket.Add(this.ObjPoint.pointID); messagePacket.Send(false); } }
//If the message applies to us this routine: //Adds the given message to the message collection. //Adds the message to the textbox. public void AddMessageToHistory(MessagePacket msg) { //this probably means a different type of message (like a "composing" event) //'but for the sake of this sample we don't need to handle it if (msg.BodiesByCulture.ContainsKey(String.Empty) && msg.Body.Length == 0) return; //*** Determine which languages this message has in it System.Globalization.CultureInfo defaultCulture = _SessionManager.Session.StreamCulture; foreach (string localizedLanguage in msg.BodiesByCulture.Keys) { string actualLanguage = localizedLanguage; string localizedBody = msg.BodiesByCulture[actualLanguage]; if (actualLanguage.Equals(String.Empty)) { if (msg.HasXMLLangAttribute() == true) { actualLanguage = msg.Culture.Name; } else { //*** The message body didn't have a language tag on it. The // Packet doesn't have a language tag on it, so we have // no idea what language this is in - assume it to be the // stream native language actualLanguage = defaultCulture.Name; } } if (localizedBody.EndsWith("\r\n")) { localizedBody = localizedBody.Substring(0, localizedBody.Length - "\r\n".Length); } RichTextBox rtb = GetTextBoxForLanguage(new System.Globalization.CultureInfo(actualLanguage)); System.Text.StringBuilder messageBuilder = new System.Text.StringBuilder(); messageBuilder.Append(msg.From.UserName.ToString()); if (msg.From.IsFullJID()) { messageBuilder.Append("/"); messageBuilder.Append(msg.From.Resource); } messageBuilder.Append(": "); if (rtb.Text.Length > 0) { messageBuilder.Insert(0, "\r\n"); } rtb.Text = messageBuilder.Insert(0, rtb.Text).Append(localizedBody).ToString(); //make sure the current text stays visible rtb.Select(rtb.TextLength - 1, 1); rtb.ScrollToCaret(); } }
public void PostMessage(MessagePacket p) { OnIncomingMessage(p); }
//Send the message in the MessageTextBox to the RemoteUser. private void DoSendMessage() { //If no local or remote user is initialized, don't do anything if (LocalUser == null || RemoteUser == null) return; //Create the message packet MessagePacket outgoingPacket; if (_subjectChanged) { _subjectChanged = false; outgoingPacket = new MessagePacket(RemoteUser, LocalUser, SubjectTextBox.Text, MessageTextBox.Text); } else { outgoingPacket = new MessagePacket(RemoteUser, LocalUser, MessageTextBox.Text); } //ensure this is a chat message so that current clients interpret it correctly outgoingPacket.Type = "chat"; outgoingPacket.Thread = this.MessageThreadID; //Display outgoing messages in history AddMessageToHistory(outgoingPacket); // Clear the message to send text box MessageTextBox.Text = string.Empty; try { Packet p = (Packet)outgoingPacket; _SessionManager.BeginSend(p); } catch (Exception ex) { MessageBox.Show( string.Format("The following exception occurred while sending a message:\n\n{0}", ex)); } }
private void DoSendMessage() { //Create the message packet MessagePacket outgoingPacket = null; outgoingPacket = new MessagePacket(m_remoteUserJabberId, AppController.Instance.CurrentUser, tbMessages.Text); outgoingPacket.Thread = MessageThreadID; outgoingPacket.Type = "chat"; // DON'T REMOVE THIS!!!! //Display outgoing messages in history AddMessageToHistory(outgoingPacket); // Clear the message to send text box tbMessages.Text = string.Empty; try { AppController.Instance.BeginSend((Packet) outgoingPacket); } catch (Exception ex) { MessageBox.Show( string.Format("The following exception occurred while sending a message:\n\n{0}", ex)); } }
private string GetUserFormatting(MessagePacket messagePacket) { string fromUser = messagePacket.From.UserName.ToString(); string userFormat = ""; if (fromUser == AppController.Instance.CurrentUser.UserName) { userFormat = string.Format(@"<span class='salutation-o'>{0}</span>", fromUser); } else { userFormat = string.Format(@"<span class='salutation-i'>{0}</span>", fromUser); } return userFormat; }
public MessageForm Show(JabberID RemoteUserJID, MessagePacket initialMessage) { return GetMessageWindow(RemoteUserJID, initialMessage); }
private MessageForm GetMessageWindow(JabberID JID, MessagePacket InitialMessage) { if (this.Contains(JID)) { try { MessageForm msgWindow = (MessageForm)this.Item(JID); msgWindow.Show(); return msgWindow; } catch { this.Remove(JID); return CreateNewWindow(JID, InitialMessage); } } else { foreach (string key in this.Keys) { JabberID keyJID = JabberID.Parse(key); if (keyJID.Equals(JID, JabberID.JabberIDCompareEnum.JabberIDCompareNoResource)) { MessageForm msgWindow = this.Item(keyJID); //'*** Add a key to the hashtable that has the full jid (user@server/resource) in it this.Add(JID, msgWindow); //'*** Remove the old user@server jid this.Remove(keyJID); msgWindow.Show(); return msgWindow; } } } return CreateNewWindow(JID, InitialMessage); }
private MessageForm CreateNewWindow(JabberID JID, MessagePacket initialMessage) { //Populate the window with the initial message if it //was provided. MessageForm newWindow; if (initialMessage == null) { MessageForm m = new MessageForm(_sessionManager, JID); m.MessageThreadID = System.Guid.NewGuid().ToString(); m.Show(); newWindow = m; } else { MessageForm m = new MessageForm(_sessionManager, _sessionManager.LocalUser, initialMessage.From); m.Show(); m.MessageThreadID = initialMessage.Thread; m.PostMessage(initialMessage); newWindow = m; } this.Add(JID, newWindow); newWindow.BringToFront(); return newWindow; }
private string GetAvatarFormatting(MessagePacket messagePacket) { string fromUser = messagePacket.From.UserName; bool drawAvatar = false; Contact contact = null; string iconStyle = ""; if (fromUser == AppController.Instance.CurrentUser.UserName) { contact = AppController.Instance.Contacts.Self; if (firstMessagefromSelf) { drawAvatar = true; iconStyle = "icon-o"; firstMessagefromSelf = false; } } else { contact = AppController.Instance.Contacts[fromUser]; if (firstMessageFromFriend) { drawAvatar = true; iconStyle = "icon-i"; firstMessageFromFriend = false; } } string avatarFormat = ""; if (drawAvatar) { string avatarImgPath = ""; if ((contact == null) || (string.IsNullOrEmpty(contact.AvatarImagePath))) { avatarImgPath = "user.png"; } else { avatarImgPath = contact.AvatarImagePath; } avatarFormat = string.Format(" <img class='{0}' src='{1}' height='36' width='36'>", iconStyle, avatarImgPath); } return avatarFormat; }
public void SendPrivateMessage(string msg) { MessagePacket msgPacket = new MessagePacket("chat"); msgPacket.Body = msg; msgPacket.To = _occupantJID; msgPacket.From = _sm.LocalUser; _sm.SendAndForget(msgPacket); _sm.MessageWindows.Show(_occupantJID); _sm.MessageWindows.Item(_occupantJID).AddMessageToHistory(msgPacket); }
public MessageForm Show(MessagePacket initialMessage) { return GetMessageWindow(initialMessage.From, initialMessage); }
public static void SendGlobalMessage(MessagePacket packet, params uint[] exclude) { int failed; if (!Core.Kernel.Clients.TryForeachAction((uid, client) => { if (!exclude.Contains(uid)) client.Send(packet); }, out failed)) { Console.WriteLine("{0} clients did not receive the message."); } }
public void AddMessageToHistory(MessagePacket messagePacket) { string encodedBody = HttpUtility.HtmlEncode(messagePacket.Body); StringBuilder messageBuilder = new StringBuilder(); messageBuilder.Append(@"<div class='chat in'><div class='msg'>") .Append(GetAvatarFormatting(messagePacket)) .Append(GetUserFormatting(messagePacket)) .Append(GetMessageFormatting(encodedBody)) //.Append(@"</div><div id='Div2'></div><div class='clear'></div></div><div class='break'></div>") .Append(@"</div><div id='Div2'></div></div>") .Append(@"<span id='placeholder'/>"); message = messageBuilder.ToString(); if (msgHistoryWindow.Document.Body != null) { HtmlElementCollection spanElements = msgHistoryWindow.Document.Body.GetElementsByTagName("span"); if (spanElements.Count == 0 || spanElements == null) return; foreach (HtmlElement spanElement in spanElements) { if (spanElement.Id == "placeholder") { spanElement.OuterHtml = message; } } foreach (HtmlElement spanElement in spanElements) { if (spanElement.Id == "placeholder") { spanElement.ScrollIntoView(false); } } tbMessages.Focus(); } }