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(); } } } }
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; } }
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 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 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 BandageRequest( NetState state, PacketReader pvSrc ) { Mobile from = state.Mobile; if ( from.AccessLevel >= AccessLevel.Counselor || DateTime.Now >= from.NextActionTime ) { Serial use = pvSrc.ReadInt32(); Serial targ = pvSrc.ReadInt32(); Bandage bandage = World.FindItem( use ) as Bandage; if( bandage != null && from.InRange( bandage.GetWorldLocation(), Core.AOS ? 2 : 1 ) ) { from.RevealingAction(); Mobile to = World.FindMobile(targ); if ( to != null ) { if ( from.InRange( bandage.GetWorldLocation(), Core.AOS ? 2 : 1 ) ) { if ( BandageContext.BeginHeal( from, to ) != null ) bandage.Consume(); } else { from.SendLocalizedMessage( 500295 ); // You are too far away to do that. } } else { from.SendLocalizedMessage( 500970 ); // Bandages can not be used on that. } from.NextActionTime = DateTime.Now + TimeSpan.FromSeconds( 0.5 ); } } else { from.SendActionMessage(); } }
public static void BandageRequest( NetState state, PacketReader pvSrc ) { Mobile from = state.Mobile; if ( from.Alive ) { if ( from.AccessLevel >= AccessLevel.Counselor || DateTime.UtcNow >= from.NextActionTime ) { Serial use = pvSrc.ReadInt32(); Serial targ = pvSrc.ReadInt32(); Bandage bandage = World.FindItem( use ) as Bandage; if ( bandage != null && !bandage.Deleted ) { if ( from.InRange( bandage.GetWorldLocation(), 2 ) ) { //from.RevealingAction(); Mobile to = World.FindMobile( targ ); if ( to != null ) { if ( BandageContext.BeginHeal( from, to ) != null ) bandage.Consume(); } else from.SendLocalizedMessage( 500970 ); // Bandages can not be used on that. } else from.SendLocalizedMessage( 500295 ); // You are too far away to do that. from.NextActionTime = DateTime.UtcNow + Mobile.ServerWideObjectDelay; } } else from.SendActionMessage(); } else from.SendLocalizedMessage( 500949 ); // You can't do that when you're dead. }
public static void LoginServerSeed(NetState state, PacketReader pvSrc) { int seed = pvSrc.ReadInt32(); // Seed int clientMaj = pvSrc.ReadInt32(); int clientMin = pvSrc.ReadInt32(); int clientRev = pvSrc.ReadInt32(); int clientPat = pvSrc.ReadInt32(); if ((seed == 0) && (clientMaj == 0) && (clientMin == 0) && (clientPat == 0) && (clientRev == 0)) { state.SentFirstPacket = true; // This is UOExt. Cheers! state.Send(m_UOExtSupport); state.Flush(); return; } // Enroute to old EF handler pvSrc.Seek(0, System.IO.SeekOrigin.Begin); m_OldEFHandler.OnReceive(state, pvSrc); }
private static void CustomRunebook(NetState state, PacketReader pvSrc) { int RuneBookSerial = pvSrc.ReadInt32(); var runebook = World.FindItem(RuneBookSerial) as Runebook; if (runebook != null) { Packets.SallosRunebook packet = new Packets.SallosRunebook(runebook); if (packet.UnderlyingStream.Length > 7) state.Send(packet); } }
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 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); }
public static void RemoveHighlightKRUIElement( GameClient state, PacketReader pvSrc ) { Mobile m = World.Instance.FindMobile( (Serial) pvSrc.ReadInt32() ); int elementID = pvSrc.ReadInt16(); PlayerMobile pm = m as PlayerMobile; if ( pm != null ) { if ( elementID == 0x791F ) pm.CheckKRStartingQuestStep( 15 ); if ( elementID == 0x7919 ) pm.CheckKRStartingQuestStep( 6 ); } }
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); }
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 ReportUseKRHotbarIcon( GameClient state, PacketReader pvSrc ) { pvSrc.ReadInt32(); // 0x00010006 /* * Types: * 0x1 - Spell * 0x2 - Weapon Ability * 0x3 - Skill * 0x4 - Item * 0x5 - Scroll * * As per RUOSI packet guide: * "Sometimes between 2.48.0.3 and 2.59.0.2 they changed it again: now type is always 0x06." */ int type = pvSrc.ReadByte(); pvSrc.ReadByte(); // 0x00 int objectID = pvSrc.ReadByte(); objectID |= pvSrc.ReadByte() << 8; objectID |= pvSrc.ReadByte() << 16; objectID |= pvSrc.ReadByte() << 24; #region KR Starting Quest Item item = World.Instance.FindItem( (Serial) objectID ); if ( type == 6 && item != null && item is MagicArrowScroll ) { PlayerMobile pm = state.Mobile as PlayerMobile; if ( pm != null ) pm.CheckKRStartingQuestStep( 23 ); } #endregion }
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 BBRequestHeader( Mobile from, BaseBulletinBoard board, PacketReader pvSrc ) { BulletinMessage msg = World.FindItem( pvSrc.ReadInt32() ) as BulletinMessage; if ( msg == null || msg.Parent != board ) return; from.Send( new BBMessageHeader( board, msg ) ); }
public static void BBRemoveMessage( Mobile from, BaseBulletinBoard board, PacketReader pvSrc ) { BulletinMessage msg = World.FindItem( pvSrc.ReadInt32() ) as BulletinMessage; if ( msg == null || msg.Parent != board ) return; if ( from.AccessLevel < AccessLevel.GameMaster && msg.Poster != from ) return; msg.Delete(); }
public static void EquipReq( NetState state, PacketReader pvSrc ) { Mobile from = state.Mobile; Item item = from.Holding; bool valid = ( item != null && item.HeldBy == from && item.Map == Map.Internal ); from.Holding = null; if ( !valid ) { return; } pvSrc.Seek( 5, SeekOrigin.Current ); Mobile to = World.FindMobile( pvSrc.ReadInt32() ); if ( to == null ) to = from; if ( !to.AllowEquipFrom( from ) || !to.EquipItem( item ) ) item.Bounce( from ); item.ClearBounce(); }
public static void LiftReq( NetState state, PacketReader pvSrc ) { Serial serial = pvSrc.ReadInt32(); int amount = pvSrc.ReadUInt16(); Item item = World.FindItem( serial ); bool rejected; LRReason reject; state.Mobile.Lift( item, amount, out rejected, out reject ); }
public static void Disconnect( NetState state, PacketReader pvSrc ) { int minusOne = pvSrc.ReadInt32(); }
public static void MenuResponse( NetState state, PacketReader pvSrc ) { int serial = pvSrc.ReadInt32(); int menuID = pvSrc.ReadInt16(); // unused in our implementation int index = pvSrc.ReadInt16(); int itemID = pvSrc.ReadInt16(); int hue = pvSrc.ReadInt16(); index -= 1; // convert from 1-based to 0-based foreach ( IMenu menu in state.Menus ) { if ( menu.Serial == serial ) { state.RemoveMenu( menu ); if ( index >= 0 && index < menu.EntryLength ) { menu.OnResponse( state, index ); } else { menu.OnCancel( state ); } break; } } }
public static void UnicodePromptResponse( NetState state, PacketReader pvSrc ) { int serial = pvSrc.ReadInt32(); int prompt = pvSrc.ReadInt32(); int type = pvSrc.ReadInt32(); string lang = pvSrc.ReadString( 4 ); string text = pvSrc.ReadUnicodeStringLESafe(); if ( text.Length > 128 ) return; Mobile from = state.Mobile; Prompt p = from.Prompt; if ( p != null && p.Serial == serial && p.Serial == prompt ) { from.Prompt = null; if ( type == 0 ) p.OnCancel( from ); else p.OnResponse( from, text ); } }
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 DisplayGumpResponse(NetState state, PacketReader pvSrc) { int serial = pvSrc.ReadInt32(); int typeID = pvSrc.ReadInt32(); int buttonID = pvSrc.ReadInt32(); List<Gump> gumps = state.Gumps; for (int i = 0; i < gumps.Count; ++i) { Gump gump = gumps[i]; if (gump.Serial == serial && gump.TypeID == typeID) { int switchCount = pvSrc.ReadInt32(); if (switchCount < 0) { Console.WriteLine("Client: {0}: Invalid gump response, disconnecting...", state); state.Dispose(); return; } int[] switches = new int[switchCount]; for (int j = 0; j < switches.Length; ++j) switches[j] = pvSrc.ReadInt32(); int textCount = pvSrc.ReadInt32(); if (textCount < 0) { Console.WriteLine("Client: {0}: Invalid gump response, disconnecting...", state); state.Dispose(); return; } TextRelay[] textEntries = new TextRelay[textCount]; for (int j = 0; j < textEntries.Length; ++j) { int entryID = pvSrc.ReadUInt16(); int textLength = pvSrc.ReadUInt16(); if (textLength > 239) return; string text = pvSrc.ReadUnicodeStringSafe(textLength); textEntries[j] = new TextRelay(entryID, text); } state.RemoveGump(i); if (!CheckResponse(gump, state.Mobile, buttonID)) return; gump.OnResponse(state, new RelayInfo(buttonID, switches, textEntries)); return; } } if (typeID == 461) // Virtue gump { int switchCount = pvSrc.ReadInt32(); if (buttonID == 1 && switchCount > 0) { Mobile beheld = World.FindMobile(pvSrc.ReadInt32()); if (beheld != null) EventSink.InvokeVirtueGumpRequest(new VirtueGumpRequestEventArgs(state.Mobile, beheld)); } else { Mobile beheld = World.FindMobile(serial); if (beheld != null) EventSink.InvokeVirtueItemRequest(new VirtueItemRequestEventArgs(state.Mobile, beheld, buttonID)); } } }
public static string[] DecodePropertyList(this ObjectPropertyList list, ClilocLNG lng) { if (lng == ClilocLNG.NULL) { lng = DefaultLanguage; } int length; var data = list.Compile(false, out length); var msgs = new List<string>(); var reader = new PacketReader(data, length, false); reader.Seek(15, SeekOrigin.Begin); for (int i = 15; i < data.Length - 4;) { int index = reader.ReadInt32(); int paramLength = reader.ReadInt16() / 2; string param = String.Empty; if (paramLength > 0) { param = reader.ReadUnicodeStringLE(paramLength); } msgs.Add(GetString(lng, index, param)); i += (6 + paramLength); } return msgs.ToArray(); }
public static void QueryDesignDetails( NetState state, PacketReader pvSrc ) { Mobile from = state.Mobile; DesignContext context = DesignContext.Find( from ); HouseFoundation foundation = World.FindItem( pvSrc.ReadInt32() ) as HouseFoundation; if ( foundation != null && from.Map == foundation.Map && from.InRange( foundation.GetWorldLocation(), 24 ) && from.CanSee( foundation ) ) { DesignState stateToSend; if ( context != null && context.Foundation == foundation ) stateToSend = foundation.DesignState; else stateToSend = foundation.CurrentState; stateToSend.SendDetailedInfoTo( state ); } }
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 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 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(); }