private static void GetSerial(string[] param) { if (PacketPlayer.Playing) { ClientCommunication.ForceSendToClient(new UnicodeMessage(0xFFFFFFFF, -1, MessageType.Regular, 0x25, 3, Language.CliLocName, "System", "Target a player to get their serial number.")); ClientCommunication.ForceSendToClient(new Target(Targeting.LocalTargID, false)); } }
private static void DoLogin(PlayerData player) { PlayerData.ExternalZ = false; ClientCommunication.ForceSendToClient(new LoginConfirm(player)); ClientCommunication.ForceSendToClient(new MapChange(player.Map)); ClientCommunication.ForceSendToClient(new MapPatches(player.MapPatches)); ClientCommunication.ForceSendToClient(new SeasonChange(player.Season, true)); ClientCommunication.ForceSendToClient(new SupportedFeatures(player.Features)); ClientCommunication.ForceSendToClient(new MobileUpdate(player)); ClientCommunication.ForceSendToClient(new MobileUpdate(player)); ClientCommunication.ForceSendToClient(new GlobalLightLevel(player.GlobalLightLevel)); ClientCommunication.ForceSendToClient(new PersonalLightLevel(player)); ClientCommunication.ForceSendToClient(new MobileUpdate(player)); ClientCommunication.ForceSendToClient(new MobileIncoming(player)); ClientCommunication.ForceSendToClient(new MobileAttributes(player)); ClientCommunication.ForceSendToClient(new SetWarMode(player.Warmode)); foreach (Item i in World.Items.Values) { if (i.Container == null) { ClientCommunication.ForceSendToClient(new WorldItem(i)); if (i.HouseRevision != 0) { ClientCommunication.ForceSendToClient(new DesignStateGeneral(i)); } } } foreach (Mobile m in World.Mobiles.Values) { ClientCommunication.ForceSendToClient(new MobileIncoming(m)); } ClientCommunication.ForceSendToClient(new SupportedFeatures(player.Features)); ClientCommunication.ForceSendToClient(new MobileUpdate(player)); ClientCommunication.ForceSendToClient(new MobileIncoming(player)); ClientCommunication.ForceSendToClient(new MobileAttributes(player)); ClientCommunication.ForceSendToClient(new SetWarMode(player.Warmode)); ClientCommunication.ForceSendToClient(new MobileIncoming(player)); ClientCommunication.ForceSendToClient(new LoginComplete()); ClientCommunication.ForceSendToClient(new CurrentTime()); ClientCommunication.ForceSendToClient(new SeasonChange(player.Season, true)); ClientCommunication.ForceSendToClient(new MapChange(player.Map)); ClientCommunication.ForceSendToClient(new MobileUpdate(player)); ClientCommunication.ForceSendToClient(new MobileIncoming(player)); PacketHandlers.PlayCharTime = DateTime.UtcNow; ClientCommunication.BeginCalibratePosition(); }
private static void GetRPVInfo(string[] param) { if (PacketPlayer.CurrentOpenedInfo == null || PacketPlayer.CurrentOpenedInfo == "") { return; } ClientCommunication.ForceSendToClient(new UnicodeMessage(0xFFFFFFFF, -1, MessageType.Regular, 0x25, 3, Language.CliLocName, "System", "Current PacketVideo File Information:")); ClientCommunication.ForceSendToClient(new UnicodeMessage(0xFFFFFFFF, -1, MessageType.Regular, 0x25, 3, Language.CliLocName, "System", PacketPlayer.CurrentOpenedInfo)); }
public static void Stop() { if (m_Recording) { byte[] hash; // the final timestamp m_GZOut.Compressed.Write((int)((DateTime.UtcNow - m_LastTime).TotalMilliseconds)); m_GZOut.Compressed.Write((byte)0xFF); m_GZOut.ForceFlush(); m_GZOut.BufferAll = true; m_GZOut.RawStream.Seek(1 + 16 + 8, SeekOrigin.Begin); m_GZOut.Raw.Write((int)((DateTime.UtcNow - m_StartTime).TotalMilliseconds)); m_GZOut.RawStream.Seek(1 + 16, SeekOrigin.Begin); using (MD5 md5 = MD5.Create()) hash = md5.ComputeHash(m_GZOut.RawStream); m_GZOut.RawStream.Seek(1, SeekOrigin.Begin); m_GZOut.Raw.Write(hash); m_GZOut.RawStream.Flush(); m_GZOut.Close(); m_GZOut = null; m_Recording = false; btnRec.Text = "Record PacketVideo"; btnPlay.Enabled = btnStop.Enabled = true; } else if (Playing) { //ClientCommunication.SetDeathMsg( Language.GetString( LocString.PacketPlayerStop + Utility.Random( 10 ) ) ); ClientCommunication.ForceSendToClient(new DeathStatus(true)); RemoveAll(); if (m_PlayTimer != null && m_PlayTimer.Running) { m_PlayTimer.Stop(); } if (m_ScrollTimer != null) { m_ScrollTimer.Stop(); } m_PlayTimer = Timer.DelayedCallback(FadeDelay, m_EndPlay); m_PlayTimer.Start(); btnPlay.Text = "Play"; btnClose.Enabled = tbPos.Enabled = btnPlay.Enabled = btnStop.Enabled = false; } }
public static void Play() { if (m_Recording || Playing || m_GZIn == null) { return; } if (World.Player == null) { MessageBox.Show(Engine.MainWindow, "You must be logged in to ANY shard to play a packet video.", "Must Log in", MessageBoxButtons.OK, MessageBoxIcon.Information); return; } btnPlay.Enabled = btnStop.Enabled = btnClose.Enabled = btnRec.Enabled = false; btnPlay.Text = "Pause"; // save the real player data m_TempWriter = new BinaryWriter(new MemoryStream()); World.Player.SaveState(m_TempWriter); //m_InStream = new BinaryReader( new FileStream( fileName, FileMode.Open, FileAccess.Read, FileShare.Read ) ); m_Playing = true; ClientCommunication.SetAllowDisconn(false); ClientCommunication.BringToFront(ClientCommunication.FindUOWindow()); //ClientCommunication.SetDeathMsg( "Playing..." ); ClientCommunication.ForceSendToClient(new DeathStatus(true)); RemoveAll(); m_GZIn.Seek(m_StartPos, SeekOrigin.Begin); LoadWorldState(); m_PlayTimer = Timer.DelayedCallback(FadeDelay, m_BeginPlay); m_PlayTimer.Start(); tbPos.Value = tbPos.Minimum; m_Elapsed = TimeSpan.Zero; UpdateTimeText(); ClientCommunication.RequestTitlebarUpdate(); }
public static void OnScroll() { bool wasRunning = m_PlayTimer.Running; TimeSpan delay = TimeSpan.Zero; TimeSpan target = TimeSpan.FromSeconds(tbPos.Value); try { if (!Playing) { tbPos.Value = tbPos.Minimum; return; } else if (target <= m_Elapsed) { tbPos.Value = (int)m_Elapsed.TotalSeconds; return; } } catch { return; } if (wasRunning) { m_PlayTimer.Stop(); } PlayerData.ExternalZ = false; int sleepCount = 0; while (m_Elapsed < target && !m_GZIn.EndOfFile) { // peek ahead 1 byte... and no, BinaryReader doesnt have a peek function. byte peek = m_GZIn.Compressed.ReadByte(); if (peek == 0xFF) { break; } m_GZIn.Seek(-1, SeekOrigin.Current); ClientCommunication.ProcessPlaybackData(m_GZIn.Compressed); if (!m_GZIn.EndOfFile) { delay = TimeSpan.FromMilliseconds(m_GZIn.Compressed.ReadInt32()); m_Elapsed += delay; if (((++sleepCount) % 5) == 0) { tbPos.Value = (int)m_Elapsed.TotalSeconds; Application.DoEvents(); System.Threading.Thread.Sleep(TimeSpan.FromMilliseconds(1)); } } } try { tbPos.Value = (int)m_Elapsed.TotalSeconds; } catch { } UpdateTimeText(); ClientCommunication.ForceSendToClient(new MobileUpdate(World.Player)); ClientCommunication.ForceSendToClient(new MobileIncoming(World.Player)); if (wasRunning) // paused? { if (!m_GZIn.EndOfFile) { m_PlayTimer = Timer.DelayedCallback(delay, m_SendNext); m_PlayTimer.Start(); } else { Stop(); } } ClientCommunication.BeginCalibratePosition(); }
public static bool ClientPacket(Packet p) { if (Playing) { if (p == null || World.Player == null) { return(false); } switch (p.PacketID) { case 0x02: // Movement Req { Direction dir = (Direction)p.ReadByte(); byte seq = p.ReadByte(); ClientCommunication.ForceSendToClient(new MoveReject(seq, World.Player)); World.Player.Resync(); break; } case 0x06: // Double Click { Serial s = p.ReadUInt32(); Mobile m; if ((s.Value & 0x80000000) != 0 || s == World.Player.Serial) { m = World.Player; } else { m = World.FindMobile(s); } if (m != null) { string name = m.Name; if (name == null || name == "") { name = "<No Data>"; } ClientCommunication.ForceSendToClient(new DisplayPaperdoll(m, name)); } break; } case 0x07: // Lift Req { ClientCommunication.ForceSendToClient(new LiftRej(5)); //inspecific break; } case 0x09: // single click { Serial s = p.ReadUInt32(); if (s.IsMobile) { Mobile m = World.FindMobile(s); if (m != null && m.Name != null && m.Name != "") { int hue; switch (m.Notoriety) { case 1: hue = 0x059; break; case 2: hue = 0x03F; break; case 3: case 4: hue = 0x3B2; break; case 5: hue = 0x090; break; case 6: hue = 0x022; break; case 7: hue = 0x035; break; default: hue = 0x481; break; } ClientCommunication.ForceSendToClient(new UnicodeMessage(s, m.Body, MessageType.Label, hue, 3, "ENU", "", m.Name)); } } else if (s.IsItem) { Item i = World.FindItem(s); if (i != null && i.Name != null && i.Name != "") { ClientCommunication.ForceSendToClient(new UnicodeMessage(s, i.ItemID, MessageType.Label, 0x3B2, 3, "ENU", "", i.Name)); } } break; } case 0x34: // Mobile Info Query { p.ReadInt32(); // 0xEDEDEDED int type = p.ReadByte(); Mobile m = World.FindMobile(p.ReadUInt32()); if (m == null) { break; } switch (type) { case 0x04: // Stats { if (m == World.Player) { ClientCommunication.ForceSendToClient(new MobileStatusExtended(World.Player)); ClientCommunication.ForceSendToClient(new StatLockInfo(World.Player)); } else { if (m.Hits == 0 && (m.HitsMax == 0 || m.HitsMax == 1)) { m.HitsMax = 1; if (m.Name == null || m.Name == "") { m.Name = "<No Data>"; } } else if (m.Name == null || m.Name == "" || m.Name == "<No Data>") { m.Name = "<No Name>"; } ClientCommunication.ForceSendToClient(new MobileStatusCompact(m)); } break; } case 0x05: { ClientCommunication.ForceSendToClient(new SkillsList()); break; } } break; } case 0x6C: // target { p.ReadByte(); // type uint tid = p.ReadUInt32(); p.ReadByte(); // flags Serial s = p.ReadUInt32(); if (tid == Targeting.LocalTargID) { ClientCommunication.ForceSendToClient(new UnicodeMessage(0xFFFFFFFF, -1, MessageType.Regular, 0x25, 3, Language.CliLocName, "System", String.Format("Serial Number is {0}", s))); } break; } case 0xAD: // speech { p.MoveToData(); Command.OnSpeech(p, new PacketHandlerEventArgs()); break; } case 0xBF: // Extended Packet { ushort subType = p.ReadUInt16(); switch (subType) { case 0x1E: // QueryDesignDetails (custom house) { Item i = World.FindItem(p.ReadUInt32()); if (i != null && i.HousePacket != null) { ClientCommunication.ForceSendToClient(new Packet(i.HousePacket, i.HousePacket.Length, true)); } break; } } break; } } return(false); } else if (m_Recording) { if (p == null) { return(true); } switch (p.PacketID) { case 0xB1: // gump response p.ReadInt32(); // skip serial WritePacket(new CloseGump(p.ReadUInt32())); break; } return(true); } else { return(true); } }
private static void HideItem(string[] param) { ClientCommunication.ForceSendToClient(new UnicodeMessage(0xFFFFFFFF, -1, MessageType.Regular, 0x25, 3, Language.CliLocName, "System", "Target a item to hide.")); Targeting.OneTimeTarget(new Targeting.TargetResponseCallback(HideItem_Callback)); }
private static void GetInfo(string[] param) { ClientCommunication.ForceSendToClient(new UnicodeMessage(0xFFFFFFFF, -1, MessageType.Regular, 0x25, 3, Language.CliLocName, "System", "Target a player or item to open object inspect.")); Targeting.OneTimeTarget(new Targeting.TargetResponseCallback(GetInfoTarget_Callback)); }
private static void GetSerialTarget_Callback(bool loc, Assistant.Serial serial, Assistant.Point3D pt, ushort itemid) { ClientCommunication.ForceSendToClient(new UnicodeMessage(0xFFFFFFFF, -1, MessageType.Regular, 0x25, 3, Language.CliLocName, "System", "Serial: 0x" + serial.Value.ToString("X8"))); }
private static void GetSerial(string[] param) { ClientCommunication.ForceSendToClient(new UnicodeMessage(0xFFFFFFFF, -1, MessageType.Regular, 0x25, 3, Language.CliLocName, "System", "Target a player or item to get their serial number.")); Targeting.OneTimeTarget(new Targeting.TargetResponseCallback(GetSerialTarget_Callback)); }