/// <summary> /// Occurs when a user speaks in general to the given channel /// </summary> /// <param name="cpkt"></param> private void CM_SENDCHAT(CMSG_SENDCHAT cpkt) { //Check if gm level is set prior to on checking if it's a gm command if (this.character.chatmute > 0) { CommonFunctions.Broadcast(this.character, this.character, "You've been muted"); } else if (this.character.GmLevel >= 0 && ConsoleCommands.IsGMCommand(cpkt.Message)) { ConsoleCommands.ParseGMCommand(cpkt.Message, this.character); } else { SMSG_SENDCHAT spkt = new SMSG_SENDCHAT(); spkt.Message = cpkt.Message; spkt.Name = this.character.Name; spkt.MessageType = cpkt.MessageType; spkt.SessionId = this.character.id; switch (spkt.MessageType) { case SMSG_SENDCHAT.MESSAGE_TYPE.CHANEL: foreach (Character characterTarget in LifeCycle.Characters) { if (characterTarget.client.isloaded == false) { continue; } spkt.SessionId = characterTarget.id; characterTarget.client.Send((byte[])spkt); } break; case SMSG_SENDCHAT.MESSAGE_TYPE.NORMAL: foreach (MapObject myObject in this.character.currentzone.GetCharactersInSightRange(this.character)) { Character characterTarget = (Character)myObject; if (characterTarget.client.isloaded == false) { continue; } spkt.SessionId = characterTarget.id; characterTarget.client.Send((byte[])spkt); } break; case SMSG_SENDCHAT.MESSAGE_TYPE.PARTY: if (this.character.sessionParty != null) { foreach (Character myObject in this.character.sessionParty.GetCharacters()) { spkt.SessionId = myObject.id; myObject.client.Send((byte[])spkt); } } else { spkt.MessageType2 = 0xFF; spkt.SessionId = this.character.id; this.Send((byte[])spkt); } break; case SMSG_SENDCHAT.MESSAGE_TYPE.YELL: foreach (MapObject myObject in this.character.currentzone.Regiontree.SearchActors(this.character, SearchFlags.Characters)) { Character characterTarget = (Character)myObject; if (characterTarget.client.isloaded == false) { continue; } spkt.SessionId = characterTarget.id; characterTarget.client.Send((byte[])spkt); } break; default: Trace.TraceError("Message type not found {0}", cpkt.MessageType); spkt.MessageType2 = 0xFF; spkt.SessionId = this.character.id; this.Send((byte[])spkt); break; } } }