public string ReadUnicodeString() { if (m_Reader.ReadByte() != 2) { return(""); } int length = m_Reader.ReadUInt16(); return(m_Reader.ReadUnicodeString(length)); }
public static void ChatAction( NetState state, PacketReader pvSrc ) { if ( !m_Enabled ) return; try { Mobile from = state.Mobile; ChatUser user = ChatUser.GetChatUser( from ); if ( user == null ) return; /*string lang = */pvSrc.ReadStringSafe( 4 ); int actionID = pvSrc.ReadInt16(); string param = pvSrc.ReadUnicodeString(); ChatActionHandler handler = ChatActionHandlers.GetHandler( actionID ); if ( handler != null ) { Channel channel = user.CurrentChannel; if ( handler.RequireConference && channel == null ) { user.SendMessage( 31 ); /* You must be in a conference to do this. * To join a conference, select one from the Conference menu. */ } else if ( handler.RequireModerator && !user.IsModerator ) { user.SendMessage( 29 ); // You must have operator status to do this. } else { handler.Callback( user, channel, param ); } } else { log.Warn(String.Format("Client: {0}: Unknown chat action 0x{1:X}: {2}", state, actionID, param)); } } catch ( Exception e ) { log.Error( e ); } }
public static void ChatAction( NetState state, PacketReader pvSrc ) { if ( !Enabled ) return; try { Mobile from = state.Mobile; ChatUser user = ChatUser.GetChatUser( from ); if ( user == null ) return; string lang = pvSrc.ReadStringSafe( 4 ); int actionId = pvSrc.ReadInt16(); string param = pvSrc.ReadUnicodeString(); ChatActionHandler handler = ChatActionHandlers.GetHandler( actionId ); if ( handler != null ) { Channel channel = user.CurrentChannel; if ( handler.RequireConference && channel == null ) { /* You must be in a conference to do this. * To join a conference, select one from the Conference menu. */ user.SendMessage( 31 ); } else { handler.Callback( user, channel, param ); } } else { Console.WriteLine( "Client: {0}: Unknown chat action 0x{1:X}: {2}", state, actionId, param ); } } catch ( Exception e ) { Console.WriteLine(e.ToString()); } }
public static void ProfileReq( NetState state, PacketReader pvSrc ) { int type = pvSrc.ReadByte(); Serial serial = pvSrc.ReadInt32(); Mobile beholder = state.Mobile; Mobile beheld = World.FindMobile( serial ); if ( beheld == null ) return; switch ( type ) { case 0x00: // display request { EventSink.InvokeProfileRequest( new ProfileRequestEventArgs( beholder, beheld ) ); break; } case 0x01: // edit request { pvSrc.ReadInt16(); // Skip int length = pvSrc.ReadUInt16(); if ( length > 511 ) return; string text = pvSrc.ReadUnicodeString( length ); EventSink.InvokeChangeProfileRequest( new ChangeProfileRequestEventArgs( beholder, beheld, text ) ); break; } } }
// UOSA public static void DisplayWaipoint3D(NetState state, PacketReader pvSrc) { int size = pvSrc.ReadInt16(); int obj_serial = pvSrc.ReadInt32(); int x = pvSrc.ReadInt16(); int y = pvSrc.ReadInt16(); int z = pvSrc.ReadSByte(); int mapID = pvSrc.ReadByte(); int obj_type = pvSrc.ReadInt16(); int ignore_obj_type = pvSrc.ReadByte(); int obj_cliloc = pvSrc.ReadInt32(); string obj_cliloc_args = pvSrc.ReadUnicodeString(); int unk1 = pvSrc.ReadInt16(); //no complete if (ignore_obj_type == 1) { } }
public static void ChatAction(NetState state, PacketReader pvSrc) { /*if ( !m_Enabled ) return; */ if (state == null || state.Mobile == null || state.Account == null) return; try { /* ChatUser user = ChatUser.GetChatUser( from ); if ( user == null ) return; */ string lang = pvSrc.ReadStringSafe(4); int actionID = pvSrc.ReadInt16(); string param = pvSrc.ReadUnicodeString(); /* ChatActionHandler handler = ChatActionHandlers.GetHandler( actionID ); if ( handler != null ) { Channel channel = user.CurrentChannel; if ( handler.RequireConference && channel == null ) { user.SendMessage( 31 ); // You must be in a conference to do this. // To join a conference, select one from the Conference menu. } else if ( handler.RequireModerator && !user.IsModerator ) { user.SendMessage( 29 ); // You must have operator status to do this. } else { handler.Callback( user, channel, param ); } } else { Console.WriteLine( "Client: {0}: Unknown chat action 0x{1:X}: {2}", state, actionID, param ); }*/ // CUSTOM CODE for uoforever--Chat b/w mobs with the same teamflags Mobile from = state.Mobile; List<XmlTeam> fromTeams = XmlAttach.GetTeams(from); if (fromTeams != null) { List<NetState> states = NetState.Instances; foreach (NetState nextstate in states) { if (nextstate.Mobile == null) continue; if (nextstate.Mobile.AccessLevel >= AccessLevel.GameMaster) { // just get the first team nextstate.Mobile.SendMessage(101, "[" + fromTeams[0].TeamVal + "] " + from.Name + ": " + param); } else { if (nextstate.Mobile.CustomTeam) { List<XmlTeam> toTeams = XmlAttach.GetTeams(nextstate.Mobile); if (XmlTeam.SameTeam(fromTeams, toTeams)) { nextstate.Mobile.SendMessage(101, from.Name + ": " + param); } } } } } else if (from.AccessLevel >= AccessLevel.Counselor || CreaturePossession.HasAnyPossessPermissions(from)) { List<NetState> states = NetState.Instances; Mobile sourceMobile = from; if (from is BaseCreature) { sourceMobile = state.Account.GetPseudoSeerLastCharacter(); } if (sourceMobile != null) { foreach (NetState nextstate in states) { if (nextstate.Mobile == null) continue; if (nextstate.Mobile.AccessLevel >= AccessLevel.Counselor || CreaturePossession.HasAnyPossessPermissions(nextstate.Mobile)) { // just get the first team nextstate.Mobile.SendMessage(101, sourceMobile.Name + ": " + param); } else if (nextstate.Mobile is BaseCreature) { if (nextstate.Account == null) continue; Mobile controllingMobile = nextstate.Account.GetPseudoSeerLastCharacter(); if (controllingMobile == null) continue; nextstate.Mobile.SendMessage(101, sourceMobile.Name + ": " + param); } } } } else if (from is BaseCreature) { List<NetState> states = NetState.Instances; Mobile controllingMobile = state.Account.GetPseudoSeerLastCharacter(); if (controllingMobile != null) { foreach (NetState nextstate in states) { if (nextstate.Mobile == null) continue; if (nextstate.Mobile.AccessLevel >= AccessLevel.Counselor || CreaturePossession.HasAnyPossessPermissions(nextstate.Mobile)) { // just get the first team nextstate.Mobile.SendMessage(101, controllingMobile.Name + ": " + param); } else if (nextstate.Mobile is BaseCreature) { nextstate.Mobile.SendMessage(101, controllingMobile.Name + ": " + param); } } } } else { from.SendMessage("You are not on a team!"); } } catch (Exception e) { Console.WriteLine(e); } }