private static void CustomRunebookTravel(NetState state, PacketReader pvSrc) { int RuneBookSerial = pvSrc.ReadInt32(); byte recall = pvSrc.ReadByte(); var X = pvSrc.ReadInt16(); var Y = pvSrc.ReadInt16(); var mapbyte = Convert.ToInt16(pvSrc.ReadByte()); var runebook = World.FindItem(RuneBookSerial) as Runebook; var map = Map.Maps[mapbyte]; if (runebook != null && runebook.RootParentEntity == state.Mobile && runebook.Entries != null) { var findentry = runebook.Entries.FirstOrDefault(x => x.Location.X == X && x.Location.Y == Y); if (findentry != null) { var portentry = findentry.Location; var entry = new RunebookEntry(portentry, findentry.Map, "", null); if (recall == 0) { new RecallSpell(state.Mobile, null, entry, null).Cast(); } else { new GateTravelSpell(state.Mobile, null, entry).Cast(); } } } }
private static void BountyEntryResponse( NetState ns, PacketReader pvSrc ) { Mobile from = ns.Mobile; if ( from == null ) return; Mobile killer = World.FindMobile( (Serial)pvSrc.ReadInt32() ); byte typeid = pvSrc.ReadByte(); byte index = pvSrc.ReadByte(); bool cancel = pvSrc.ReadByte() == 0; short responseLen = pvSrc.ReadInt16(); string resp = pvSrc.ReadString(); if ( killer != null && !cancel ) { int bounty = Utility.ToInt32( resp ); if ( bounty > 5000 ) bounty = 5000; bounty = from.BankBox.ConsumeUpTo( typeof( Gold ), bounty, true ); killer.Kills++; if ( killer is PlayerMobile && bounty > 0 ) { PlayerMobile kpm = (PlayerMobile)killer; kpm.Bounty += bounty; killer.SendAsciiMessage( "{0} has placed a bounty of {1}gp on your head!", from.Name, bounty ); if ( kpm.Bounty >= 5000 && kpm.Kills > 1 && kpm.BankBox.Items.Count > 0 && kpm.Karma <= (int)Noto.Dark ) { killer.SayTo( killer, true, "A bounty hath been issued for thee, and thy worldly goods are hereby confiscated!" ); kpm.Bounty += EmptyAndGetGold( killer.BankBox.Items ); } } } SendNext( from ); }
public static void ChangeOption(MahjongGame game, NetState state, PacketReader pvSrc) { if (game == null || !game.Players.IsInGameDealer(state.Mobile)) return; pvSrc.ReadInt16(); pvSrc.ReadByte(); int options = pvSrc.ReadByte(); game.ShowScores = (options & 0x1) != 0; game.SpectatorVision = (options & 0x2) != 0; }
public static void BBClientRequest(NetState state, PacketReader pvSrc) { Mobile from = state.Mobile; int packetID = pvSrc.ReadByte(); BaseBulletinBoard board = World.FindItem(pvSrc.ReadInt32()) as BaseBulletinBoard; if (board == null || !board.CheckRange(from)) return; switch ( packetID ) { case 3: BBRequestContent(from, board, pvSrc); break; case 4: BBRequestHeader(from, board, pvSrc); break; case 5: BBPostMessage(from, board, pvSrc); break; case 6: BBRemoveMessage(from, board, pvSrc); break; } }
public static void OnReceive( GameClient state, PacketReader pvSrc ) { if ( pvSrc.ReadByte() == 0xFF ) state.Send( new UOGInfo( String.Format( ", Name={0}, Age={1}, Clients={2}, Items={3}, Chars={4}, Mem={5}K", Environment.Config.ServerName, (int) ( DateTime.Now - Server.Items.Clock.ServerStart ).TotalHours, GameServer.Instance.ClientCount, World.Instance.ItemCount, World.Instance.MobileCount, (int) ( System.GC.GetTotalMemory( false ) / 1024 ) ) ) ); state.Dispose(); }
public static void DecodeBundledPacket(NetState state, PacketReader pvSrc) { int packetID = pvSrc.ReadByte(); PacketHandler ph = GetHandler(packetID); if (ph != null) { if (ph.Ingame && state.Mobile == null) { Utility.PushColor(ConsoleColor.DarkRed); Console.WriteLine("Client: {0}: Sent ingame packet (0xF0x{1:X2}) before having been attached to a mobile", state, packetID); Utility.PopColor(); state.Dispose(); } else if (ph.Ingame && state.Mobile.Deleted) { state.Dispose(); } else { ph.OnReceive(state, pvSrc); } } }
public static void TargetResponse( NetState state, PacketReader pvSrc ) { int type = pvSrc.ReadByte(); int targetID = pvSrc.ReadInt32(); int flags = pvSrc.ReadByte(); Serial serial = pvSrc.ReadInt32(); int x = pvSrc.ReadInt16(), y = pvSrc.ReadInt16(); int z = pvSrc.ReadInt16(); int graphic = pvSrc.ReadInt16(); pvSrc.Seek( 1, System.IO.SeekOrigin.Begin ); Mobile from = state.Mobile; if ( from == null || from.Target == null ) return; if ( x == 0 && y == 0 && z == 0 && serial != from.Serial ) { bool ok = false; if ( serial.IsItem ) { Item i = World.FindItem( serial ); if ( i != null && i.Location == Point3D.Zero ) ok = true; } else if ( serial.IsMobile ) { Mobile m = World.FindMobile( serial ); if ( m != null && m.Location == Point3D.Zero ) ok = true; } object o = m_LastTarget[from]; if ( !ok && o != null && o is Serial && serial != (Serial)o ) { from.SendAsciiMessage( "This EasyUO target has been blocked." ); from.Target.Cancel( from, TargetCancelType.Canceled ); return; } } if ( from.Serial != serial ) m_LastTarget[from] = serial; m_Real6C.OnReceive( state, pvSrc ); }
public static void AssignDealer(MahjongGame game, NetState state, PacketReader pvSrc) { if (game == null || !game.Players.IsInGameDealer(state.Mobile)) return; int position = pvSrc.ReadByte(); game.Players.AssignDealer(position); }
public static void MultiMouseMovementRequest(NetState state, PacketReader reader) { Serial playerSerial = reader.ReadInt32(); Direction movement = (Direction)reader.ReadByte(); reader.ReadByte(); // movement direction duplicated int speed = reader.ReadByte(); Mobile mob = World.FindMobile(playerSerial); if (mob == null || mob.NetState == null || !mob.Mounted) return; IMount multi = mob.Mount; if (!(multi is BaseBoat)) return; BaseBoat boat = (BaseBoat)multi; boat.OnMousePilotCommand(mob, movement, speed); }
private static void AccountSearch(NetState state, PacketReader pvSrc) { AcctSearchType type = (AcctSearchType)pvSrc.ReadByte(); string term = pvSrc.ReadString(); if (type == AcctSearchType.IP && !Utility.IsValidIP(term)) { state.Send(new MessageBoxMessage("Invalid search term.\nThe IP sent was not valid.", "Invalid IP")); return; } else { term = term.ToUpper(); } ArrayList list = new ArrayList(); foreach (Account a in Accounts.GetAccounts()) { if (!CanAccessAccount(state.Account, a)) continue; switch ( type ) { case AcctSearchType.Username: { if (a.Username.ToUpper().IndexOf(term) != -1) list.Add(a); break; } case AcctSearchType.IP: { for (int i = 0; i < a.LoginIPs.Length; i++) { if (Utility.IPMatch(term, a.LoginIPs[i])) { list.Add(a); break; } } break; } } } if (list.Count > 0) { if (list.Count <= 25) state.Send(AdminNetwork.Compress(new AccountSearchResults(list))); else state.Send(new MessageBoxMessage("There were more than 25 matches to your search.\nNarrow the search parameters and try again.", "Too Many Results")); } else { state.Send(new MessageBoxMessage("There were no results to your search.\nPlease try again.", "No Matches")); } }
public static void GivePoints(MahjongGame game, NetState state, PacketReader pvSrc) { if (game == null || !game.Players.IsInGamePlayer(state.Mobile)) return; int to = pvSrc.ReadByte(); int amount = pvSrc.ReadInt32(); game.Players.TransferScore(state.Mobile, to, amount); }
public static void OnPacket( NetState state, PacketReader pvSrc ) { MahjongGame game = World.FindItem( pvSrc.ReadInt32() ) as MahjongGame; if ( game != null ) game.Players.CheckPlayers(); pvSrc.ReadByte(); int cmd = pvSrc.ReadByte(); OnMahjongPacketReceive onReceive = GetSubCommandDelegate( cmd ); if ( onReceive != null ) { onReceive( game, state, pvSrc ); } else { pvSrc.Trace( state ); } }
public static void TargetResponse(NetState state, PacketReader pvSrc) { Mobile from = state.Mobile; Target t = from.Target; if (t == null || IgnoreRegex.IsMatch(t.GetType().FullName)) { m_Target.OnReceive(state, pvSrc); return; } int type = pvSrc.ReadByte(); int targetID = pvSrc.ReadInt32(); int flags = pvSrc.ReadByte(); Serial serial = pvSrc.ReadInt32(); pvSrc.Seek(1, System.IO.SeekOrigin.Begin); if (targetID == unchecked((int)0xDEADBEEF)) return; Mobile target = null; if ( serial.IsMobile ) target = World.FindMobile(serial); if (target == null || target == from) { m_Target.OnReceive(state, pvSrc); return; } HandleTarget(new TargetInfo(from, target, t.GetType())); m_Target.OnReceive(state, pvSrc); }
private static void OnGuildTrack( NetState state, PacketReader pvSrc ) { Mobile from = state.Mobile; Guild guild = from.Guild as Guild; if ( guild != null ) { bool locations = pvSrc.ReadByte() != 0; Packets.GuildTrack packet = new Packets.GuildTrack( from, guild, locations ); if ( packet.UnderlyingStream.Length > ( locations ? 9 : 5 ) ) state.Send( packet ); } else state.Send( new Packets.GuildTrack() ); }
public static void AsciiSpeechChat3(NetState state, PacketReader pvSrc) { Mobile from = state.Mobile; MessageType type = (MessageType)pvSrc.ReadByte(); int hue = pvSrc.ReadInt16(); pvSrc.ReadInt16(); // font string text = pvSrc.ReadStringSafe().Trim(); if (text.Length <= 0 || text.Length > 128) return; if (!Enum.IsDefined(typeof(MessageType), type)) type = MessageType.Regular; Channel c = Channel.GetByType(typeof(Guild)); if (RUOVersion.GuildChat(type) && c != null) c.OnChat(from, text); else from.DoSpeech(text, c_EmptyInts, type, Utility.ClipDyedHue(hue)); }
public static void MobileQuery2(NetState state, PacketReader pvSrc) { Mobile from = state.Mobile; pvSrc.ReadInt32(); // 0xEDEDEDED int type = pvSrc.ReadByte(); Mobile m = World.FindMobile(pvSrc.ReadInt32()); if (m != null) { switch (type) { case 0x00: // Unknown, sent by godclient { if ( PacketHandlers.VerifyGC( state ) ) Console.WriteLine( "God Client: {0}: Query 0x{1:X2} on {2} '{3}'", state, type, m.Serial, m.Name ); break; } case 0x04: // Stats { m.OnStatsQuery( from ); break; } case 0x05: { m.SendGump( new TMSS.ParallelSkillsGump( m ) ); break; } default: { pvSrc.Trace( state ); break; } } } }
public static void DecodeBundledPacket( NetState state, PacketReader pvSrc ) { int packetID = pvSrc.ReadByte(); PacketHandler ph = GetHandler( packetID ); if ( ph != null ) { if ( ph.Ingame && state.Mobile == null ) { log.Warn(String.Format("Client: {0}: Sent ingame packet (0xF0x{1:X2}) before having been attached to a mobile", state, packetID)); state.Dispose(); } else if ( ph.Ingame && state.Mobile.Deleted ) { state.Dispose(); } else { ph.OnReceive( state, pvSrc ); } } }
public static void BBPostMessage( Mobile from, BaseBulletinBoard board, PacketReader pvSrc ) { BulletinMessage thread = World.FindItem( pvSrc.ReadInt32() ) as BulletinMessage; if ( thread != null && thread.Parent != board ) thread = null; int breakout = 0; while ( thread != null && thread.Thread != null && breakout++ < 10 ) thread = thread.Thread; DateTime lastPostTime = DateTime.MinValue; if ( board.GetLastPostTime( from, ( thread == null ), ref lastPostTime ) ) { if ( !CheckTime( lastPostTime, (thread == null ? ThreadCreateTime : ThreadReplyTime) ) ) { if ( thread == null ) from.SendMessage( "You must wait {0} before creating a new thread.", FormatTS( ThreadCreateTime ) ); else from.SendMessage( "You must wait {0} before replying to another thread.", FormatTS( ThreadReplyTime ) ); return; } } string subject = pvSrc.ReadUTF8StringSafe( pvSrc.ReadByte() ); if ( subject.Length == 0 ) return; string[] lines = new string[pvSrc.ReadByte()]; if ( lines.Length == 0 ) return; for ( int i = 0; i < lines.Length; ++i ) lines[i] = pvSrc.ReadUTF8StringSafe( pvSrc.ReadByte() ); board.PostMessage( from, thread, subject, lines ); }
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; } } }
public static void TextCommand( NetState state, PacketReader pvSrc ) { int type = pvSrc.ReadByte(); string command = pvSrc.ReadString(); Mobile m = state.Mobile; switch ( type ) { case 0x00: // Go { if ( VerifyGC( state ) ) { try { string[] split = command.Split( ' ' ); int x = Utility.ToInt32( split[0] ); int y = Utility.ToInt32( split[1] ); int z; if ( split.Length >= 3 ) z = Utility.ToInt32( split[2] ); else if ( m.Map != null ) z = m.Map.GetAverageZ( x, y ); else z = 0; m.Location = new Point3D( x, y, z ); } catch { } } break; } case 0xC7: // Animate { EventSink.InvokeAnimateRequest( new AnimateRequestEventArgs( m, command ) ); break; } case 0x24: // Use skill { int skillIndex; if ( !int.TryParse( command.Split( ' ' )[0], out skillIndex ) ) break; Skills.UseSkill( m, skillIndex ); break; } case 0x43: // Open spellbook { int booktype; if ( !int.TryParse( command, out booktype ) ) booktype = 1; EventSink.InvokeOpenSpellbookRequest( new OpenSpellbookRequestEventArgs( m, booktype ) ); break; } case 0x27: // Cast spell from book { string[] split = command.Split( ' ' ); if ( split.Length > 0 ) { int spellID = Utility.ToInt32( split[0] ) - 1; int serial = split.Length > 1 ? Utility.ToInt32( split[1] ) : -1; EventSink.InvokeCastSpellRequest( new CastSpellRequestEventArgs( m, spellID, World.FindItem( serial ) ) ); } break; } case 0x58: // Open door { EventSink.InvokeOpenDoorMacroUsed( new OpenDoorMacroEventArgs( m ) ); break; } case 0x56: // Cast spell from macro { int spellID = Utility.ToInt32( command ) - 1; EventSink.InvokeCastSpellRequest( new CastSpellRequestEventArgs( m, spellID, null ) ); break; } case 0xF4: // Invoke virtues from macro { int virtueID = Utility.ToInt32( command ) - 1; EventSink.InvokeVirtueMacroRequest( new VirtueMacroRequestEventArgs( m, virtueID ) ); break; } case 0x2F: // Old scroll double click { /* * This command is still sent for items 0xEF3 - 0xEF9 * * Command is one of three, depending on the item ID of the scroll: * - [scroll serial] * - [scroll serial] [target serial] * - [scroll serial] [x] [y] [z] */ break; } default: { Console.WriteLine( "Client: {0}: Unknown text-command type 0x{1:X2}: {2}", state, type, command ); break; } } }
public static void NewRegion( NetState state, PacketReader pvSrc ) { if ( VerifyGC( state ) ) { string name = pvSrc.ReadString( 40 ); int unk = pvSrc.ReadInt32(); int x = pvSrc.ReadInt16(); int y = pvSrc.ReadInt16(); int width = pvSrc.ReadInt16(); int height = pvSrc.ReadInt16(); int zStart = pvSrc.ReadInt16(); int zEnd = pvSrc.ReadInt16(); string desc = pvSrc.ReadString( 40 ); int soundFX = pvSrc.ReadInt16(); int music = pvSrc.ReadInt16(); int nightFX = pvSrc.ReadInt16(); int dungeon = pvSrc.ReadByte(); int light = pvSrc.ReadInt16(); Console.WriteLine( "God Client: {0}: New Region '{1}' ('{2}')", state, name, desc ); } }
public static void Edit( NetState state, PacketReader pvSrc ) { if ( VerifyGC( state ) ) { int type = pvSrc.ReadByte(); // 10 = static, 7 = npc, 4 = dynamic int x = pvSrc.ReadInt16(); int y = pvSrc.ReadInt16(); int id = pvSrc.ReadInt16(); int z = pvSrc.ReadSByte(); int hue = pvSrc.ReadUInt16(); Console.WriteLine( "God Client: {0}: Edit {6} ({1}, {2}, {3}) 0x{4:X} (0x{5:X})", state, x, y, z, id, hue, type ); } }
public static void SystemInfo( NetState state, PacketReader pvSrc ) { int v1 = pvSrc.ReadByte(); int v2 = pvSrc.ReadUInt16(); int v3 = pvSrc.ReadByte(); string s1 = pvSrc.ReadString( 32 ); string s2 = pvSrc.ReadString( 32 ); string s3 = pvSrc.ReadString( 32 ); string s4 = pvSrc.ReadString( 32 ); int v4 = pvSrc.ReadUInt16(); int v5 = pvSrc.ReadUInt16(); int v6 = pvSrc.ReadInt32(); int v7 = pvSrc.ReadInt32(); int v8 = pvSrc.ReadInt32(); }
public static void RequestScrollWindow( NetState state, PacketReader pvSrc ) { int lastTip = pvSrc.ReadInt16(); int type = pvSrc.ReadByte(); }
public static void ObjectHelpRequest( NetState state, PacketReader pvSrc ) { Mobile from = state.Mobile; Serial serial = pvSrc.ReadInt32(); int unk = pvSrc.ReadByte(); string lang = pvSrc.ReadString( 3 ); if ( serial.IsItem ) { Item item = World.FindItem( serial ); if ( item != null && from.Map == item.Map && Utility.InUpdateRange( item.GetWorldLocation(), from.Location ) && from.CanSee( item ) ) item.OnHelpRequest( from ); } else if ( serial.IsMobile ) { Mobile m = World.FindMobile( serial ); if ( m != null && from.Map == m.Map && Utility.InUpdateRange( m.Location, from.Location ) && from.CanSee( m ) ) m.OnHelpRequest( m ); } }
public static void GodviewQuery( NetState state, PacketReader pvSrc ) { if ( VerifyGC( state ) ) { Console.WriteLine( "God Client: {0}: Godview query 0x{1:X}", state, pvSrc.ReadByte() ); } }
public static void GameCentralMoniter( NetState state, PacketReader pvSrc ) { if ( VerifyGC( state ) ) { int type = pvSrc.ReadByte(); int num1 = pvSrc.ReadInt32(); Console.WriteLine( "God Client: {0}: Game central moniter", state ); Console.WriteLine( " - Type: {0}", type ); Console.WriteLine( " - Number: {0}", num1 ); pvSrc.Trace( state ); } }
public static void PingReq(NetState state, PacketReader pvSrc) { state.Send(PingAck.Instantiate(pvSrc.ReadByte())); }
private static void UpdateAccount( NetState state, PacketReader pvSrc ) { string username = pvSrc.ReadString(); string pass = pvSrc.ReadString(); Account a = Accounts.GetAccount( username ); if ( a == null ) a = Accounts.AddAccount( username, pass ); else if ( pass != "(hidden)" ) a.SetPassword( pass ); if ( a != state.Account ) { a.AccessLevel = (AccessLevel)pvSrc.ReadByte(); a.Banned = pvSrc.ReadBoolean(); } else { pvSrc.ReadInt16();//skip both state.Send( new MessageBoxMessage( "Warning: When editing your own account, account status and accesslevel cannot be changed.", "Editing Own Account" ) ); } ArrayList list = new ArrayList(); ushort length = pvSrc.ReadUInt16(); bool invalid = false; for (int i=0;i<length;i++) { string add = pvSrc.ReadString(); if ( Utility.IsValidIP( add ) ) list.Add( add ); else invalid = true; } if ( list.Count > 0 ) a.IPRestrictions = (string[])list.ToArray( typeof( string ) ); else a.IPRestrictions = new string[0]; if ( invalid ) state.Send( new MessageBoxMessage( "Warning: one or more of the IP Restrictions you specified was not valid.", "Invalid IP Restriction" ) ); state.Send( new MessageBoxMessage( "Account updated successfully.", "Account Updated" ) ); }
public static void OnReceive(NetState state, PacketReader pvSrc) { pvSrc.ReadByte(); // 1: <4.0.1a, 2>=4.0.1a HardwareInfo info = new HardwareInfo(); info.m_InstanceID = pvSrc.ReadInt32(); info.m_OSMajor = pvSrc.ReadInt32(); info.m_OSMinor = pvSrc.ReadInt32(); info.m_OSRevision = pvSrc.ReadInt32(); info.m_CpuManufacturer = pvSrc.ReadByte(); info.m_CpuFamily = pvSrc.ReadInt32(); info.m_CpuModel = pvSrc.ReadInt32(); info.m_CpuClockSpeed = pvSrc.ReadInt32(); info.m_CpuQuantity = pvSrc.ReadByte(); info.m_PhysicalMemory = pvSrc.ReadInt32(); info.m_ScreenWidth = pvSrc.ReadInt32(); info.m_ScreenHeight = pvSrc.ReadInt32(); info.m_ScreenDepth = pvSrc.ReadInt32(); info.m_DXMajor = pvSrc.ReadInt16(); info.m_DXMinor = pvSrc.ReadInt16(); info.m_VCDescription = pvSrc.ReadUnicodeStringLESafe(64); info.m_VCVendorID = pvSrc.ReadInt32(); info.m_VCDeviceID = pvSrc.ReadInt32(); info.m_VCMemory = pvSrc.ReadInt32(); info.m_Distribution = pvSrc.ReadByte(); info.m_ClientsRunning = pvSrc.ReadByte(); info.m_ClientsInstalled = pvSrc.ReadByte(); info.m_PartialInstalled = pvSrc.ReadByte(); info.m_Language = pvSrc.ReadUnicodeStringLESafe(4); info.m_Unknown = pvSrc.ReadStringSafe(64); info.m_TimeReceived = DateTime.Now; Account acct = state.Account as Account; if (acct != null) acct.HardwareInfo = info; }
public static void UTripTime( NetState state, PacketReader pvSrc ) { int unk1 = pvSrc.ReadByte(); int unk2 = pvSrc.ReadInt32(); state.Send( new UTripTimeResponse( unk1 ) ); }