public override void ExecuteCommand(Client client, Identity target, string[] args) { client.SendChatText( client.Character.Coordinates + " " + client.Character.PlayField + " " + client.Character.Heading.x.ToString() + " " + client.Character.Heading.y.ToString() + " " + client.Character.Heading.z.ToString() + " " + client.Character.Heading.w.ToString() + " " + client.Character.Heading.VectorRepresentation()); }
public override void ExecuteCommand(Client client, Identity target, string[] args) { // Fallback to self if no target is selected if (target.Instance == 0) { target.Type = client.Character.Type; target.Instance = client.Character.Id; } int statId = StatsList.GetStatId(args[1]); if (statId == 1234567890) { client.SendChatText("Unknown Stat name " + args[1]); return; } uint statNewValue = 1234567890; try { statNewValue = uint.Parse(args[2]); } catch { try { // For values >= 2^31 statNewValue = (uint.Parse(args[2])); } catch (FormatException) { } catch (OverflowException) { } } Character tempch = (Character)FindDynel.FindDynelById(target.Type, target.Instance); uint statOldValue; try { statOldValue = tempch.Stats.GetBaseValue(statId); tempch.Stats.SetStatValueByName(statId, statNewValue); if (tempch.Client != null) { tempch.Stats.Send(tempch.Client, statId); } } catch { client.SendChatText("Unknown StatId " + statId); return; } string response = "Character " + tempch.Name + " (" + target.Instance + "): Stat " + StatsList.GetStatName(statId) + " (" + statId + ") ="; response += " Old: " + statOldValue; response += " New: " + statNewValue; client.SendChatText(response); }
public override void ExecuteCommand(Client client, Identity target, string[] args) { Client targetClient = null; if ((targetClient = FindClient.FindClientByName(args[1])) != null) { targetClient.Server.DisconnectClient(targetClient); return; } client.SendChatText("Character '" + args[1] + "' not found."); }
public override void ExecuteCommand(Client client, Identity target, string[] args) { Client targetClient = null; if ((targetClient = FindClient.FindClientByName(args[1])) != null) { targetClient.Teleport( client.Character.Coordinates, client.Character.Heading, client.Character.PlayField); return; } client.SendChatText("Character '" + args[1] + "' not found."); }
public override void ExecuteCommand(Client client, Identity target, string[] args) { client.SendChatText("Looking up for statel in playfield " + client.Character.PlayField.ToString()); Statels.Statel o = null; foreach (Statels.Statel s in Statels.Statelppf[client.Character.PlayField]) { if (o == null) { o = s; } else { if (AOCoord.Distance2D(client.Character.Coordinates, s.Coordinates) < AOCoord.Distance2D(client.Character.Coordinates, o.Coordinates)) { o = s; } } } if (o == null) { client.SendChatText("No statel on this playfield... Very odd, where exactly are you???"); return; } client.SendChatText(o.Type + ":" + o.Instance); foreach (Statels.StatelEvent se in o.Events) { client.SendChatText( "Event: " + se.EventNumber.ToString() + " # of Functions: " + se.Functions.Count.ToString()); foreach (Statels.Statel_Function sf in se.Functions) { string Fargs = ""; foreach (string arg in sf.Arguments) { if (Fargs.Length > 0) { Fargs = Fargs + ", "; } Fargs = Fargs + arg; } client.SendChatText( " Fn: " + sf.FunctionNumber.ToString() + ", # of Args: " + sf.Arguments.Count.ToString()); client.SendChatText(" Args: " + Fargs); foreach (Statels.Statel_Function_Requirement sfr in sf.Requirements) { string req; req = "Attr: " + sfr.AttributeNumber.ToString() + " Value: " + sfr.AttributeValue.ToString() + " Target: " + sfr.Target.ToString() + " Op: " + sfr.Operator.ToString(); client.SendChatText(" Req: " + req); } } } }
public override void ExecuteCommand(Client client, Identity target, string[] args) { int id = int.Parse(args[1]); Dynel d = FindDynel.FindDynelById(50000, id); if (d == null) { client.SendChatText("Couldn't find Dynel " + id); } else { client.Teleport(d.Coordinates, d.Heading, d.PlayField); } }
public override void ExecuteCommand(Client client, Identity target, string[] args) { Client targetClient = null; if ((targetClient = FindClient.FindClientByName(args[1])) != null) { int firstfree = 64; firstfree = targetClient.Character.GetNextFreeInventory(104); if (firstfree <= 93) { InventoryEntries mi = new InventoryEntries(); AOItem it = ItemHandler.GetItemTemplate(Convert.ToInt32(args[2])); mi.Placement = firstfree; mi.Container = 104; mi.Item.LowID = Convert.ToInt32(args[2]); mi.Item.HighID = Convert.ToInt32(args[3]); mi.Item.Quality = Convert.ToInt32(args[4]); if (it.ItemType != 1) { mi.Item.MultipleCount = Math.Max(1, it.getItemAttribute(212)); } else { bool found = false; foreach (AOItemAttribute a in mi.Item.Stats) { if (a.Stat != 212) { continue; } found = true; a.Value = Math.Max(1, it.getItemAttribute(212)); break; } if (!found) { AOItemAttribute aoi = new AOItemAttribute(); aoi.Stat = 212; aoi.Value = Math.Max(1, it.getItemAttribute(212)); mi.Item.Stats.Add(aoi); } } targetClient.Character.Inventory.Add(mi); AddTemplate.Send(targetClient, mi); } else { client.SendChatText("Your Inventory is full"); } } }
public override void ExecuteCommand(Client client, Identity target, string[] args) { List<Type> check = new List<Type>(); check.Add(typeof(float)); check.Add(typeof(float)); check.Add(typeof(int)); AOCoord coord = new AOCoord(); int pf = client.Character.PlayField; if (CheckArgumentHelper(check, args)) { coord = new AOCoord( float.Parse(args[1], NumberStyles.Any, CultureInfo.InvariantCulture), client.Character.Coordinates.y, float.Parse(args[2], NumberStyles.Any, CultureInfo.InvariantCulture)); pf = int.Parse(args[3]); } check.Clear(); check.Add(typeof(float)); check.Add(typeof(float)); check.Add(typeof(string)); check.Add(typeof(float)); check.Add(typeof(int)); if (CheckArgumentHelper(check, args)) { coord = new AOCoord( float.Parse(args[1], NumberStyles.Any, CultureInfo.InvariantCulture), float.Parse(args[4], NumberStyles.Any, CultureInfo.InvariantCulture), float.Parse(args[2], NumberStyles.Any, CultureInfo.InvariantCulture)); pf = int.Parse(args[5]); } if (!Playfields.ValidPlayfield(pf)) { client.SendFeedback(110, 188845972); return; } Client mClient = null; if ((mClient = FindClient.FindClientById(target.Instance)) == null) { client.SendChatText("Target not found"); return; } mClient.Teleport(coord, mClient.Character.Heading, pf); }
public override void ExecuteCommand(Client client, Identity target, string[] args) { Client targetClient; if ((targetClient = FindClient.FindClientByName(args[1])) != null) { bool hasNano = (this.HasNano(Convert.ToInt32(args[2]), targetClient)); if (hasNano == false) { targetClient.Character.UploadNano(Convert.ToInt32(args[2])); UploadNanoupdate.Send(targetClient.Character, 53019, Convert.ToInt32(args[2])); return; } targetClient.SendChatText("The nano already exists in nano programs.."); } }
public override void ExecuteCommand(Client client, Identity target, string[] args) { Client targetClient; if ((targetClient = FindClient.FindClientByName(args[1])) != null) { bool itemExists = (this.ItemExists(Convert.ToInt32(args[2]), targetClient)); if (itemExists) { DeleteItem.Send(targetClient.Character, 104, Convert.ToInt32(args[2])); targetClient.Character.Inventory.Remove( targetClient.Character.GetInventoryAt(Convert.ToInt32(args[2]))); return; } targetClient.SendChatText("There exists no item in the slot you choose"); } }
public override void ExecuteCommand(Client client, Identity target, string[] args) { int itemid = Int32.Parse(args[1]); AOItem it = ItemHandler.GetItemTemplate(itemid); if (it == null) { client.SendChatText("No Item with id " + itemid + " found."); return; } client.SendChatText("Item Debug Info for Item " + itemid); client.SendChatText("Attack values:"); foreach (AOItemAttribute at in it.Attack) { client.SendChatText("Type: " + at.Stat + " Value: " + at.Value); } client.SendChatText("Defense values:"); foreach (AOItemAttribute at in it.Defend) { client.SendChatText("Type: " + at.Stat + " Value: " + at.Value); } client.SendChatText("Item Attributes:"); foreach (AOItemAttribute at in it.Stats) { client.SendChatText("Type: " + at.Stat + " Value: " + at.Value); } client.SendChatText("Events/Functions:"); foreach (AOEvents ev in it.Events) { client.SendChatText("Eventtype: " + ev.EventType); foreach (AOFunctions fu in ev.Functions) { client.SendChatText(" Functionnumber: " + fu.FunctionType); foreach (object arg in fu.Arguments) { client.SendChatText(" Argument: " + arg); } foreach (AORequirements aor in fu.Requirements) { client.SendChatText( " Reqs: " + aor.Statnumber + " " + aor.Operator + " " + aor.Value + " " + aor.ChildOperator); } } } }
public override void ExecuteCommand(Client client, Identity target, string[] args) { Client mClient = null; if (target.Type != 50000) { client.SendChatText("Target must be player"); return; } if ((mClient = FindClient.FindClientById(target.Instance)) != null) { mClient.Character.LastName = ""; mClient.Character.FirstName = ""; mClient.Character.WriteNames(); client.SendChatText(mClient.Character.Name + "'s names have been reset."); } }
/// <summary> /// The execute command. /// </summary> /// <param name="client"> /// The client. /// </param> /// <param name="target"> /// The target. /// </param> /// <param name="args"> /// The args. /// </param> public override void ExecuteCommand(Client client, Identity target, string[] args) { if (args.Length >= 2) { if (args[1].ToLower() == "list") { string filter = string.Empty; if (args.Length > 2) { for (int i = 2; i < args.Length; i++) { if (filter.Length > 0) { filter = filter + " AND "; } if (filter.Length == 0) { filter = "WHERE "; } filter = filter + "name like '%" + args[i] + "%' "; } } SqlWrapper sql = new SqlWrapper(); DataTable dt = sql.ReadDatatable("SELECT Hash, Name FROM mobtemplate " + filter + " order by Name ASC"); client.SendChatText("List of mobtemplates: "); foreach (DataRow row in dt.Rows) { client.SendChatText(row[0] + " " + row[1]); } return; } } if (args.Length == 3) { NonPlayerCharacterHandler.SpawnMonster(client, args[1], uint.Parse(args[2])); return; } this.CommandHelp(client); }
public override void ExecuteCommand(Client client, Identity target, string[] args) { // No check needed, its done by CheckCommandArguments int gfx = int.Parse(args[3]); //begin assembling packet here PacketWriter packet = new PacketWriter(); packet.PushByte(0xDF); packet.PushByte(0xDF); packet.PushShort(10); packet.PushShort(1); packet.PushShort(0); packet.PushInt(3086); packet.PushInt(client.Character.Id); packet.PushInt(0x4D450114); packet.PushIdentity(target); packet.PushByte(0); packet.Push3F1Count(1); // effects count // effect starts packet.PushIdentity(53030, 0); // effect ID (53030 = GfxEffect) packet.PushInt(4); // ? packet.PushInt(0); // Criterion count packet.PushInt(1); // Hits packet.PushInt(0); // Delay packet.PushInt(0); // packet.PushInt(0); // // effect args packet.PushInt(gfx); // Value packet.PushInt(0); // GfxLife packet.PushInt(0); // GfxSize packet.PushInt(0); // GfxRed packet.PushInt(0); // GfxGreen packet.PushInt(0); // GfxBlue packet.PushInt(0); // GfxFade // effect args end // effect ends packet.PushIdentity(50000, client.Character.Id); byte[] reply = packet.Finish(); //done creating the packet Announce.Playfield(client.Character.PlayField, reply); }
public override void ExecuteCommand(Client client, Identity target, string[] args) { client.SendChatText("Equipment page:"); List<AOMeshs> meshs = client.Character.MeshLayer.GetMeshs(); foreach (AOMeshs am in meshs) { int ov = am.OverrideTexture; int me = am.Mesh; int position = am.Position; int layer = am.Layer; client.SendChatText(position + ":" + me + ":" + ov + ":" + layer); } client.SendChatText(""); client.SendChatText("Social page:"); meshs = client.Character.SocialMeshLayer.GetMeshs(); foreach (AOMeshs am in meshs) { int ov = am.OverrideTexture; int me = am.Mesh; int position = am.Position; int layer = am.Layer; client.SendChatText(position + ":" + me + ":" + ov + ":" + layer); } client.SendChatText("Actual Output:"); bool socialonly = ((client.Character.Stats.VisualFlags.Value & 0x40) > 0); bool showsocial = ((client.Character.Stats.VisualFlags.Value & 0x20) > 0); meshs = MeshLayers.GetMeshs(client.Character, showsocial, socialonly); foreach (AOMeshs am in meshs) { int ov = am.OverrideTexture; int me = am.Mesh; int position = am.Position; int layer = am.Layer; client.SendChatText(position + ":" + me + ":" + ov + ":" + layer); } }
public bool FunctionExecute(Dynel Self, Dynel Caller, object Target, object[] Arguments) { Client cli = ((Character)Self).Client; Identity pfinstance = new Identity(); Identity R = new Identity(); Identity dest = new Identity(); int gs = 1; int sg = 0; if (Target is Statels.Statel) { pfinstance.Type = Int32.Parse((string)Arguments[0]); pfinstance.Instance = Int32.Parse((string)Arguments[1]); R.Type = Int32.Parse((string)Arguments[2]); R.Instance = Int32.Parse((string)Arguments[3]); dest.Type = Int32.Parse((string)Arguments[4]); dest.Instance = Int32.Parse((string)Arguments[5]); } else { pfinstance.Type = (Int32)Arguments[0]; pfinstance.Instance = (Int32)Arguments[1]; R.Type = (Int32)Arguments[2]; R.Instance = (Int32)Arguments[3]; dest.Type = (Int32)Arguments[4]; dest.Instance = (Int32)Arguments[5]; } int to_pf = (Int32)((UInt32)(dest.Instance & 0xffff)); int arg2 = (Int32)((UInt32)(dest.Instance >> 16)); CoordHeading a = this.FindEntry(to_pf, arg2); if (a.Coordinates.x != -1) { cli.TeleportProxy(a.Coordinates, a.Heading, to_pf, pfinstance, gs, sg, R, dest); return true; } return false; }
public override void ExecuteCommand(Client client, Identity target, string[] args) { lock (client.Character.Timers) { client.SendChatText("--------------------------------------------------"); client.SendChatText( "Timer Debug output Startup: " + client.Character.Starting.ToString() + " NOW: " + DateTime.Now.ToString()); foreach (AOTimers at in client.Character.Timers) { string func = " Function " + at.Function.FunctionType.ToString() + " Args: "; foreach (object d in at.Function.Arguments) { func = func + d + ", "; } func = func.Substring(0, func.Length - 2); client.SendChatText( "Strain:" + at.Strain.ToString() + " TI: " + at.Function.TickInterval.ToString() + " TC: " + at.Function.TickCount.ToString() + " NT: " + at.Timestamp.ToString() + func); } } }
public override void ExecuteCommand(Client client, Identity target, string[] args) { if ((args.Length == 2) && (args[1].ToLower() != "list")) { VendorHandler.SpawnVendor(client, args[1]); } else { if (args.Length >= 2) { string filter = ""; if (args.Length > 2) { for (int i = 2; i < args.Length; i++) { if (filter.Length > 0) { filter = filter + " AND "; } if (filter.Length == 0) { filter = "WHERE "; } filter = filter + "name like '%" + args[i] + "%' "; } } SqlWrapper sql = new SqlWrapper(); DataTable dt = sql.ReadDatatable("SELECT Hash, Name FROM vendortemplate " + filter + " order by Name ASC"); client.SendChatText("List of vendortemplates: "); foreach (DataRow row in dt.Rows) { client.SendChatText(row[0] + " " + row[1]); } } } }
public static void Send(Client client, int fromPage, int fromPlacement, Identity toIdentity, int toPlacement) { PacketWriter packetWriter = new PacketWriter(); // Send Switch place ACK packetWriter.PushByte(0xDF); packetWriter.PushByte(0xDF); packetWriter.PushShort(0x000a); packetWriter.PushShort(0x0001); packetWriter.PushShort(0); // LENGTH packetWriter.PushInt(3086); // Server ID packetWriter.PushInt(client.Character.Id); packetWriter.PushInt(0x47537a24); packetWriter.PushInt(50000); packetWriter.PushInt(client.Character.Id); packetWriter.PushByte(0); packetWriter.PushInt(fromPage); // Send Container ID packetWriter.PushInt(fromPlacement); packetWriter.PushInt(toIdentity.Type); packetWriter.PushInt(toIdentity.Instance); packetWriter.PushInt(toPlacement); // changed toplacement byte[] packet = packetWriter.Finish(); client.SendCompressed(packet); }
public bool PushIdentity(Identity _ident) { return(PushIdentity(_ident.Type, _ident.Instance)); }
public bool PushIdentity(Identity _ident) { return PushIdentity(_ident.Type, _ident.Instance); }
/// <summary> /// /// </summary> /// <param name="destination"></param> /// <param name="heading"></param> /// <param name="playfield"></param> /// <returns></returns> public bool TeleportProxy( AOCoord destination, Quaternion heading, int playfield, Identity pfinstance, int GS, int SG, Identity R, Identity dest) { PacketWriter writer = new PacketWriter(); // header starts writer.PushByte(0xDF); writer.PushByte(0xDF); writer.PushShort(10); writer.PushShort(1); writer.PushShort(0); writer.PushInt(3086); writer.PushInt(this.Character.Id); writer.PushInt(0x43197D22); writer.PushIdentity(50000, this.Character.Id); writer.PushByte(0); // Header ends writer.PushCoord(this.Character.RawCoord); writer.PushQuat(this.Character.RawHeading); writer.PushByte(97); writer.PushIdentity(pfinstance.Type, pfinstance.Instance); writer.PushInt(GS); writer.PushInt(SG); writer.PushIdentity(40016, playfield); // Dont know for sure if its correct to only transfer the playfield here writer.PushInt(0); writer.PushInt(0); writer.PushIdentity(dest.Type, dest.Instance); writer.PushInt(0); byte[] tpreply = writer.Finish(); this.Character.DoNotDoTimers = true; Despawn.DespawnPacket(this.Character.Id); this.SendCompressed(tpreply); this.Character.DoNotDoTimers = true; this.Character.Stats.LastConcretePlayfieldInstance.Value = this.Character.PlayField; this.Character.Stats.ExtenalDoorInstance.Value = SG; this.Character.StopMovement(); this.Character.RawCoord = destination; this.Character.RawHeading = heading; this.Character.PlayField = playfield; this.Character.Resource = 0x3c000; this.Character.Purge(); // Purge character information to DB before client reconnect IPAddress tempIP; if (IPAddress.TryParse(Config.Instance.CurrentConfig.ZoneIP, out tempIP) == false) { IPHostEntry zoneHost = Dns.GetHostEntry(Config.Instance.CurrentConfig.ZoneIP); foreach (IPAddress ip in zoneHost.AddressList) { if (ip.AddressFamily == AddressFamily.InterNetwork) { tempIP = ip; break; } } } int zoneIP = IPAddress.HostToNetworkOrder(BitConverter.ToInt32(tempIP.GetAddressBytes(), 0)); short zonePort = Convert.ToInt16(Config.Instance.CurrentConfig.ZonePort); Thread.Sleep(1000); PacketWriter writer2 = new PacketWriter(); writer2.PushByte(0xDF); writer2.PushByte(0xDF); writer2.PushShort(1); writer2.PushShort(1); writer2.PushShort(0); writer2.PushInt(3086); writer2.PushInt(this.Character.Id); writer2.PushInt(60); writer2.PushInt(zoneIP); writer2.PushShort(zonePort); byte[] connect = writer2.Finish(); this.SendCompressed(connect); return true; }
// Team Reply Packet 46312D2E : TeamMember public void TeamReplyPacketTeamMember( int destinationClient, Client sendingPlayer, Identity recievingPlayer, string charName) { PacketWriter packetWriter = new PacketWriter(); packetWriter.PushByte(0xDF); packetWriter.PushByte(0xDF); // Header packetWriter.PushShort(0xA); // Packet Type packetWriter.PushShort(1); // Unknown 1 packetWriter.PushShort(0); // Legnth packetWriter.PushInt(3086); // Sender switch (destinationClient) { case 0: packetWriter.PushInt(sendingPlayer.Character.Id); // Reciever packetWriter.PushInt(0x46312D2E); // Packet ID packetWriter.PushIdentity(50000, sendingPlayer.Character.Id); // TYPE / ID packetWriter.PushInt(0); packetWriter.PushIdentity(50000, sendingPlayer.Character.Id); packetWriter.PushInt(0xDEA9); // Team Window Information ?? packetWriter.PushInt(0x7); // team ID?????? packetWriter.PushByte(0xFF); packetWriter.PushByte(0xFF); packetWriter.PushByte(0xFF); packetWriter.PushByte(0xFF); packetWriter.PushInt(0x48); // ?? packetWriter.PushShort(0x5); // ??? packetWriter.PushInt(0x8); // Length of Team name? packetWriter.PushByte(0x4B); packetWriter.PushByte(0x61); packetWriter.PushByte(0x6C); packetWriter.PushByte(0x69); // name? packetWriter.PushByte(0x6E); packetWriter.PushByte(0x61); packetWriter.PushByte(0x6D); packetWriter.PushByte(0x61); // Name continued? packetWriter.PushShort(0); byte[] packet = packetWriter.Finish(); Client receiver = FindClient.FindClientById(recievingPlayer.Instance); if (receiver != null) { receiver.SendCompressed(packet); } break; case 1: packetWriter.PushInt(recievingPlayer.Instance); // Reciever packetWriter.PushInt(0x46312D2E); // Packet ID packetWriter.PushIdentity(50000, recievingPlayer.Instance); // TYPE / ID packetWriter.PushInt(0); packetWriter.PushIdentity(50000, recievingPlayer.Instance); packetWriter.PushInt(0xDEA9); // Team Window Information ?? packetWriter.PushInt(0x7); // team ID?????? packetWriter.PushByte(0xFF); packetWriter.PushByte(0xFF); packetWriter.PushByte(0xFF); packetWriter.PushByte(0xFF); packetWriter.PushInt(0x48); // ?? packetWriter.PushShort(0x5); // ?? packetWriter.PushInt(0x8); // Length of Team name? packetWriter.PushByte(0x4B); packetWriter.PushByte(0x61); packetWriter.PushByte(0x6C); packetWriter.PushByte(0x69); // name? packetWriter.PushByte(0x6E); packetWriter.PushByte(0x61); packetWriter.PushByte(0x6D); packetWriter.PushByte(0x61); // Name continued? packetWriter.PushShort(0); byte[] packet2 = packetWriter.Finish(); sendingPlayer.SendCompressed(packet2); break; } }
public static void Read(byte[] packet, Client client) { SqlWrapper mys = new SqlWrapper(); // Packet Reader Unknown Values are Returning 0 Integers, Unable to Store Needed Packet data To Reply. #region PacketReader PacketReader packetReader = new PacketReader(packet); Header m_header = packetReader.PopHeader(); // 0 - 28 byte unknown = packetReader.PopByte(); // 29 int actionNum = packetReader.PopInt(); // 30 - 33 int unknown1 = packetReader.PopInt(); // 34 - 37 Identity m_ident = packetReader.PopIdentity(); // 38 - 35 int unknown2 = packetReader.PopInt(); // 36 - 39 int unknown3 = packetReader.PopInt(); // 40 - 43 short unknown4 = packetReader.PopShort(); // 44 - 45 #endregion switch (actionNum) { #region Cast nano case 19: // Cast nano { // CastNanoSpell PacketWriter castNanoSpell = new PacketWriter(); castNanoSpell.PushByte(0xDF); castNanoSpell.PushByte(0xDF); castNanoSpell.PushShort(10); castNanoSpell.PushShort(1); castNanoSpell.PushShort(0); castNanoSpell.PushInt(3086); castNanoSpell.PushInt(client.Character.Id); castNanoSpell.PushInt(0x25314D6D); castNanoSpell.PushIdentity(50000, client.Character.Id); castNanoSpell.PushByte(0); castNanoSpell.PushInt(unknown3); // Nano ID castNanoSpell.PushIdentity(m_ident); // Target castNanoSpell.PushInt(0); castNanoSpell.PushIdentity(50000, client.Character.Id); // Caster byte[] castNanoSpellA = castNanoSpell.Finish(); Announce.Playfield(client.Character.PlayField, castNanoSpellA); // CharacterAction 107 PacketWriter characterAction107 = new PacketWriter(); characterAction107.PushByte(0xDF); characterAction107.PushByte(0xDF); characterAction107.PushShort(10); characterAction107.PushShort(1); characterAction107.PushShort(0); characterAction107.PushInt(3086); characterAction107.PushInt(client.Character.Id); characterAction107.PushInt(0x5E477770); characterAction107.PushIdentity(50000, client.Character.Id); characterAction107.PushByte(0); characterAction107.PushInt(107); characterAction107.PushInt(0); characterAction107.PushInt(0); characterAction107.PushInt(0); characterAction107.PushInt(1); characterAction107.PushInt(unknown3); characterAction107.PushShort(0); byte[] characterAction107A = characterAction107.Finish(); Announce.Playfield(client.Character.PlayField, characterAction107A); // CharacterAction 98 PacketWriter characterAction98 = new PacketWriter(); characterAction98.PushByte(0xDF); characterAction98.PushByte(0xDF); characterAction98.PushShort(10); characterAction98.PushShort(1); characterAction98.PushShort(0); characterAction98.PushInt(3086); characterAction98.PushInt(client.Character.Id); characterAction98.PushInt(0x5E477770); characterAction98.PushIdentity(m_ident); characterAction98.PushByte(0); characterAction98.PushInt(98); characterAction98.PushInt(0); characterAction98.PushInt(0xCF1B); characterAction98.PushInt(unknown3); characterAction98.PushInt(client.Character.Id); characterAction98.PushInt(0x249F0); // duration? characterAction98.PushShort(0); byte[] characterAction98A = characterAction98.Finish(); Announce.Playfield(client.Character.PlayField, characterAction98A); } break; #endregion #region search /* this is here to prevent server crash that is caused by * search action if server doesn't reply if something is * found or not */ case 66: // If action == search { /* Msg 110:136744723 = "No hidden objects found." */ client.SendFeedback(110, 136744723); } break; #endregion #region info case 105: // If action == Info Request { Client tPlayer = null; if ((tPlayer = FindClient.FindClientById(m_ident.Instance)) != null) { #region Titles uint LegacyScore = tPlayer.Character.Stats.PvpRating.StatBaseValue; string LegacyTitle = null; if (LegacyScore < 1400) { LegacyTitle = ""; } else if (LegacyScore < 1500) { LegacyTitle = "Freshman"; } else if (LegacyScore < 1600) { LegacyTitle = "Rookie"; } else if (LegacyScore < 1700) { LegacyTitle = "Apprentice"; } else if (LegacyScore < 1800) { LegacyTitle = "Novice"; } else if (LegacyScore < 1900) { LegacyTitle = "Neophyte"; } else if (LegacyScore < 2000) { LegacyTitle = "Experienced"; } else if (LegacyScore < 2100) { LegacyTitle = "Expert"; } else if (LegacyScore < 2300) { LegacyTitle = "Master"; } else if (LegacyScore < 2500) { LegacyTitle = "Champion"; } else { LegacyTitle = "Grand Master"; } #endregion int orgGoverningForm = 0; SqlWrapper ms = new SqlWrapper(); DataTable dt = ms.ReadDatatable( "SELECT `GovernmentForm` FROM organizations WHERE ID=" + tPlayer.Character.OrgId); if (dt.Rows.Count > 0) { orgGoverningForm = (Int32)dt.Rows[0][0]; } string orgRank = OrgClient.GetRank( orgGoverningForm, tPlayer.Character.Stats.ClanLevel.StatBaseValue); // Uses methods in ZoneEngine\PacketHandlers\OrgClient.cs /* Known packetFlags-- * 0x40 - No org | 0x41 - Org | 0x43 - Org and towers | 0x47 - Org, towers, player has personal towers | 0x50 - No pvp data shown * Bitflags-- * Bit0 = hasOrg, Bit1 = orgTowers, Bit2 = personalTowers, Bit3 = (Int32) time until supression changes (Byte) type of supression level?, Bit4 = noPvpDataShown, Bit5 = hasFaction, Bit6 = ?, Bit 7 = null. */ byte packetFlags = 0x40; // Player has no Org if (tPlayer.Character.OrgId != 0) { packetFlags = 0x41; // Player has Org, no towers } PacketWriter infoPacket = new PacketWriter(); // Start packet header infoPacket.PushByte(0xDF); infoPacket.PushByte(0xDF); infoPacket.PushShort(10); infoPacket.PushShort(1); infoPacket.PushShort(0); infoPacket.PushInt(3086); // sender (server ID) infoPacket.PushInt(client.Character.Id); // receiver infoPacket.PushInt(0x4D38242E); // packet ID infoPacket.PushIdentity(50000, tPlayer.Character.Id); // affected identity infoPacket.PushByte(0); // ? // End packet header infoPacket.PushByte(packetFlags); // Based on flags above infoPacket.PushByte(1); // esi_001? infoPacket.PushByte((byte)tPlayer.Character.Stats.Profession.Value); // Profession infoPacket.PushByte((byte)tPlayer.Character.Stats.Level.Value); // Level infoPacket.PushByte((byte)tPlayer.Character.Stats.TitleLevel.Value); // Titlelevel infoPacket.PushByte((byte)tPlayer.Character.Stats.VisualProfession.Value); // Visual Profession infoPacket.PushShort(0); // Side XP Bonus infoPacket.PushUInt(tPlayer.Character.Stats.Health.Value); // Current Health (Health) infoPacket.PushUInt(tPlayer.Character.Stats.Life.Value); // Max Health (Life) infoPacket.PushInt(0); // BreedHostility? infoPacket.PushUInt(tPlayer.Character.OrgId); // org ID infoPacket.PushShort((short)tPlayer.Character.FirstName.Length); infoPacket.PushBytes(Encoding.ASCII.GetBytes(tPlayer.Character.FirstName)); infoPacket.PushShort((short)tPlayer.Character.LastName.Length); infoPacket.PushBytes(Encoding.ASCII.GetBytes(tPlayer.Character.LastName)); infoPacket.PushShort((short)LegacyTitle.Length); infoPacket.PushBytes(Encoding.ASCII.GetBytes(LegacyTitle)); infoPacket.PushShort(0); // Title 2 // If receiver is in the same org as affected identity, whom is not orgless, send org rank and city playfield if ((client.Character.OrgId == tPlayer.Character.OrgId) && (tPlayer.Character.OrgId != 0)) { infoPacket.PushShort((short)orgRank.Length); infoPacket.PushBytes(Encoding.ASCII.GetBytes(orgRank)); infoPacket.PushInt(0); //infoPacket.PushIdentity(0, 0); // City (50201, Playfield) // Pushed 1 zero to much and screwed info for characters in orgs, but I´ll leave it for later just incase. } infoPacket.PushUInt(tPlayer.Character.Stats.InvadersKilled.Value); // Invaders Killed infoPacket.PushUInt(tPlayer.Character.Stats.KilledByInvaders.Value); // Killed by Invaders infoPacket.PushUInt(tPlayer.Character.Stats.AlienLevel.Value); // Alien Level infoPacket.PushUInt(tPlayer.Character.Stats.PvpDuelKills.Value); // Pvp Duel Kills infoPacket.PushUInt(tPlayer.Character.Stats.PvpDuelDeaths.Value); // Pvp Duel Deaths infoPacket.PushUInt(tPlayer.Character.Stats.PvpProfessionDuelDeaths.Value); // Pvp Profession Duel Kills infoPacket.PushUInt(tPlayer.Character.Stats.PvpRankedSoloKills.Value); // Pvp Solo Kills infoPacket.PushUInt(tPlayer.Character.Stats.PvpRankedSoloDeaths.Value); // Pvp Team Kills infoPacket.PushUInt(tPlayer.Character.Stats.PvpSoloScore.Value); // Pvp Solo Score infoPacket.PushUInt(tPlayer.Character.Stats.PvpTeamScore.Value); // Pvp Team Score infoPacket.PushUInt(tPlayer.Character.Stats.PvpDuelScore.Value); // Pvp Duel Score byte[] infoPacketA = infoPacket.Finish(); client.SendCompressed(infoPacketA); } else { NonPlayerCharacterClass npc = (NonPlayerCharacterClass)FindDynel.FindDynelById(m_ident.Type, m_ident.Instance); if (npc != null) { PacketWriter infoPacket = new PacketWriter(); // Start packet header infoPacket.PushByte(0xDF); infoPacket.PushByte(0xDF); infoPacket.PushShort(10); infoPacket.PushShort(1); infoPacket.PushShort(0); infoPacket.PushInt(3086); // sender (server ID) infoPacket.PushInt(client.Character.Id); // receiver infoPacket.PushInt(0x4D38242E); // packet ID infoPacket.PushIdentity(50000, npc.Id); // affected identity infoPacket.PushByte(0); // ? // End packet header infoPacket.PushByte(0x50); // npc's just have 0x50 infoPacket.PushByte(1); // esi_001? infoPacket.PushByte((byte)npc.Stats.Profession.Value); // Profession infoPacket.PushByte((byte)npc.Stats.Level.Value); // Level infoPacket.PushByte((byte)npc.Stats.TitleLevel.Value); // Titlelevel infoPacket.PushByte((byte)npc.Stats.VisualProfession.Value); // Visual Profession infoPacket.PushShort(0); // no idea for npc's infoPacket.PushUInt(npc.Stats.Health.Value); // Current Health (Health) infoPacket.PushUInt(npc.Stats.Life.Value); // Max Health (Life) infoPacket.PushInt(0); // BreedHostility? infoPacket.PushUInt(0); // org ID infoPacket.PushShort(0); infoPacket.PushShort(0); infoPacket.PushShort(0); infoPacket.PushShort(0); infoPacket.PushInt(0x499602d2); infoPacket.PushInt(0x499602d2); infoPacket.PushInt(0x499602d2); byte[] infoPacketA = infoPacket.Finish(); client.SendCompressed(infoPacketA); } } } break; #endregion #region logout case 120: // If action == Logout { //Start 30 second logout timer if client is not a GM (statid 215) if (client.Character.Stats.GMLevel.Value == 0) { client.startLogoutTimer(); } else // If client is a GM, disconnect without timer { client.Server.DisconnectClient(client); } } break; case 121: // If action == Stop Logout { //Stop current logout timer and send stop logout packet client.Character.UpdateMoveType((byte)client.Character.PreviousMoveMode); client.CancelLogOut(); } break; #endregion #region stand case 87: // If action == Stand { client.Character.UpdateMoveType(37); //Send stand up packet, and cancel timer/send stop logout packet if timer is enabled client.StandCancelLogout(); } break; #endregion #region Team case 22: //Kick Team Member { } break; case 24: //Leave Team { TeamClass team = new TeamClass(); team.LeaveTeam(client); } break; case 25: //Transfer Team Leadership { } break; case 26: //Team Join Request { // Send Team Invite Request To Target Player TeamClass team = new TeamClass(); team.SendTeamRequest(client, m_ident); } break; case 28: //Request Reply { // Check if positive or negative response // if positive TeamClass team = new TeamClass(); uint teamID = TeamClass.GenerateNewTeamId(client, m_ident); // Destination Client 0 = Sender, 1 = Reciever // Reciever Packets /////////////////// // CharAction 15 team.TeamRequestReply(client, m_ident); // CharAction 23 team.TeamRequestReplyCharacterAction23(client, m_ident); // TeamMember Packet team.TeamReplyPacketTeamMember(1, client, m_ident, "Member1"); // TeamMemberInfo Packet team.TeamReplyPacketTeamMemberInfo(1, client, m_ident); // TeamMember Packet team.TeamReplyPacketTeamMember(1, client, m_ident, "Member2"); // Sender Packets ///////////////// // TeamMember Packet team.TeamReplyPacketTeamMember(0, client, m_ident, "Member1"); // TeamMemberInfo Packet team.TeamReplyPacketTeamMemberInfo(0, client, m_ident); // TeamMember Packet team.TeamReplyPacketTeamMember(0, client, m_ident, "Member2"); } break; #endregion #region Delete Item case 0x70: mys.SqlDelete( "DELETE FROM " + client.Character.GetSqlTablefromDynelType() + "inventory WHERE placement=" + m_ident.Instance.ToString() + " AND container=" + m_ident.Type.ToString()); InventoryEntries i_del = client.Character.GetInventoryAt(m_ident.Instance); client.Character.Inventory.Remove(i_del); byte[] action2 = new byte[0x37]; Array.Copy(packet, action2, 0x37); action2[8] = 0x00; action2[9] = 0x00; action2[10] = 0x0C; action2[11] = 0x0E; client.SendCompressed(action2); break; #endregion #region Split item case 0x34: int nextid = client.Character.GetNextFreeInventory(m_ident.Type); InventoryEntries i = client.Character.GetInventoryAt(m_ident.Instance); i.Item.MultipleCount -= unknown3; InventoryEntries i2 = new InventoryEntries(); i2.Item = i.Item.ShallowCopy(); i2.Item.MultipleCount = unknown3; i2.Placement = nextid; client.Character.Inventory.Add(i2); client.Character.WriteInventoryToSql(); break; #endregion #region Join item case 0x35: InventoryEntries j1 = client.Character.GetInventoryAt(m_ident.Instance); InventoryEntries j2 = client.Character.GetInventoryAt(unknown3); j1.Item.MultipleCount += j2.Item.MultipleCount; client.Character.Inventory.Remove(j2); client.Character.WriteInventoryToSql(); byte[] joined = new byte[0x37]; Array.Copy(packet, joined, 0x37); joined[8] = 0x00; joined[9] = 0x00; joined[10] = 0x0C; joined[11] = 0x0E; client.SendCompressed(joined); break; #endregion #region Sneak Action // ################################################################################### // Spandexpants: This is all i have done so far as to make sneak turn on and off, // currently i cannot find a missing packet or link which tells the server the player // has stopped sneaking, hidden packet or something, will come back to later. // ################################################################################### // Sneak Packet Received case 163: { PacketWriter Sneak = new PacketWriter(); // TODO: IF SNEAKING IS ALLOWED RUN THIS CODE. // Send Action 162 : Enable Sneak Sneak.PushByte(0xDF); Sneak.PushByte(0xDF); Sneak.PushShort(0xA); Sneak.PushShort(1); Sneak.PushShort(0); Sneak.PushInt(3086); // Send Sneak.PushInt(client.Character.Id); // Reciever Sneak.PushInt(0x5e477770); // Packet ID Sneak.PushIdentity(50000, client.Character.Id); // TYPE / ID Sneak.PushInt(0); Sneak.PushByte(0xA2); // Action ID Sneak.PushInt(0); Sneak.PushInt(0); Sneak.PushInt(0); Sneak.PushInt(0); Sneak.PushInt(0); Sneak.PushShort(0); byte[] sneakpacket = Sneak.Finish(); client.SendCompressed(sneakpacket); // End of Enable sneak // TODO: IF SNEAKING IS NOT ALLOWED SEND REJECTION PACKET } break; #endregion #region Use Item on Item case 81: { Identity item1 = new Identity(); Identity item2 = new Identity(); item1.Type = m_ident.Type; item1.Instance = m_ident.Instance; item2.Type = unknown2; item2.Instance = unknown3; Tradeskill cts = new Tradeskill(client, item1.Instance, item2.Instance); cts.ClickBuild(); break; } #endregion #region Change Visual Flag case 166: { client.Character.Stats.VisualFlags.Set(unknown3); // client.SendChatText("Setting Visual Flag to "+unknown3.ToString()); AppearanceUpdate.AnnounceAppearanceUpdate(client.Character); break; } #endregion #region Tradeskill Source Changed case 0xdc: TradeSkillReceiver.TradeSkillSourceChanged(client, unknown2, unknown3); break; #endregion #region Tradeskill Target Changed case 0xdd: TradeSkillReceiver.TradeSkillTargetChanged(client, unknown2, unknown3); break; #endregion #region Tradeskill Build Pressed case 0xde: TradeSkillReceiver.TradeSkillBuildPressed(client, m_ident.Instance); break; #endregion #region default default: { byte[] action = new byte[0x37]; Array.Copy(packet, action, 0x37); action[8] = 0x00; action[9] = 0x00; action[10] = 0x0C; action[11] = 0x0E; Announce.Playfield(client.Character.PlayField, action); } break; #endregion } packetReader.Finish(); }
// Create a New Team ID and Return it to Call public static uint GenerateNewTeamId(Client sendingPlayer, Identity recievingPlayer) { // Generate TeamID // Check Current Available Team Number // Assign current Team Number // Apply To Variable in Core to be accessed uint newTeamId = 7; return newTeamId; }
public void CallChatCommand(string commandName, Client client, Identity target, string[] commandArguments) { Assembly assembly = Assembly.GetExecutingAssembly(); if (commandName.ToUpperInvariant() != "LISTCOMMANDS") { foreach (KeyValuePair<string, Type> kv in this.chatCommands) { if (kv.Key.Substring(kv.Key.IndexOf(":", StringComparison.Ordinal) + 1).ToUpperInvariant() == commandName.ToUpperInvariant()) { AOChatCommand aoc = (AOChatCommand) assembly.CreateInstance(kv.Key.Substring(0, kv.Key.IndexOf(":", StringComparison.Ordinal))); if (aoc != null) { // Check GM Level bitwise if ((client.Character.Stats.GMLevel.Value < aoc.GMLevelNeeded()) && (aoc.GMLevelNeeded() > 0)) { client.SendChatText( "You are not authorized to use this command!. This incident will be recorded."); // It is not yet :) return; } // Check if only one argument has been passed for "help" if (commandArguments.Length == 2) { if (commandArguments[1].ToUpperInvariant() == "HELP") { aoc.CommandHelp(client); return; } } // Execute the command with the given command arguments, if CheckCommandArguments is true else print command help if (aoc.CheckCommandArguments(commandArguments)) { aoc.ExecuteCommand(client, target, commandArguments); } else { aoc.CommandHelp(client); } } } } } else { client.SendChatText("Available Commands:"); string[] scriptNames = this.chatCommands.Keys.ToArray(); for (int i = 0; i < scriptNames.Length; i++) { scriptNames[i] = scriptNames[i].Substring(scriptNames[i].IndexOf(":", StringComparison.Ordinal) + 1) + ":" + scriptNames[i].Substring(0, scriptNames[i].IndexOf(":", StringComparison.Ordinal)); } Array.Sort(scriptNames); foreach (string scriptName in scriptNames) { string typename = scriptName.Substring(scriptName.IndexOf(":", StringComparison.Ordinal) + 1); AOChatCommand aoc = (AOChatCommand)assembly.CreateInstance(typename); if (aoc != null) { if (client.Character.Stats.GMLevel.Value >= aoc.GMLevelNeeded()) { client.SendChatText( scriptName.Substring(0, scriptName.IndexOf(":", StringComparison.Ordinal))); } } } } }
/// <summary> /// The read. /// </summary> /// <param name="packet"> /// The packet. /// </param> /// <param name="client"> /// The client. /// </param> /// <param name="dynel"> /// The dynel. /// </param> public static void Read(byte[] packet, Client client, Dynel dynel) { sender = client; PacketReader packetReader = new PacketReader(packet); packetReader.PopHeader(); packetReader.PopByte(); temp1 = packetReader.PopInt(); count = packetReader.PopInt(); // Count of commands sent action = packetReader.PopInt(); temp4 = packetReader.PopInt(); user = packetReader.PopIdentity(); target = packetReader.PopIdentity(); packetReader.Finish(); bool feedback = true; switch (action) { case 1: // Get break; case 2: // Drop break; case 3: // Use OnUse(); AOCoord newcoord = client.Character.Coordinates; feedback = false; if (Statels.StatelppfonUse.ContainsKey(client.Character.PlayField)) { foreach (Statels.Statel s in Statels.StatelppfonUse[client.Character.PlayField]) { if (s.onUse(client, target)) { return; } } } bool teleport = false; int playfield = 152; switch (target.Instance) { // Need to add feedback to the character // Are the Newer Grid points in this list??? // No newer Grid points in list, will be replaced by a check against a list of statels read from rdb anyway // - Algorithman case -1073605919: // Teleport Tower(noobisland)(right) if (client.Character.Stats.Side.Value != 2) { client.SendChatText("You need to be omni to use this teleporter!"); teleport = false; } else { newcoord.x = 202; newcoord.z = 878; newcoord.y = 16; playfield = 687; } break; case -1073736991: // Teleport Tower(noobisland)(left) if (client.Character.Stats.Side.Value != 1) { client.SendChatText("You need to be clan to use this teleporter!"); teleport = false; } else { newcoord.x = 390; newcoord.z = 340; newcoord.y = 0; playfield = 545; } break; case -1073671455: // Teleport Tower(noobisland)(middle) if (client.Character.Stats.Side.Value != 0) { client.SendChatText("You need to be neutral to use this teleporter!"); teleport = false; } else { newcoord.x = 685; newcoord.z = 480; newcoord.y = 73; playfield = 800; } break; case -1073741189: // 2ho -> Stret west if (client.Character.Stats.Cash.Value < 50) { // check if you got enough credits to use the ferry client.SendChatText("You need atleast 50 credits to board this ferry!"); teleport = false; } else { client.Character.Stats.Cash.Set(client.Character.Stats.Cash.Value - 50); newcoord.x = 1143; newcoord.z = 541; newcoord.y = 8; playfield = 790; } break; case -1073478890: // Stret West -> 2ho if (client.Character.Stats.Cash.Value < 50) { // check if you got enough credits to use the ferry client.SendChatText("You need atleast 50 credits to board this ferry!"); teleport = false; } else { client.Character.Stats.Cash.Set(client.Character.Stats.Cash.Value - 50); newcoord.x = 760; newcoord.z = 1982; newcoord.y = 7; playfield = 635; } break; case -1073216841: // Harry's -> Plesant Meadows if (client.Character.Stats.Cash.Value < 50) { // check if you got enough credits to use the ferry client.SendChatText("You need atleast 50 credits to board this ferry!"); teleport = false; } else { client.Character.Stats.Cash.Set(client.Character.Stats.Cash.Value - 50); newcoord.x = 370; newcoord.z = 1564; newcoord.y = 7; playfield = 630; } break; case -1073216906: // Plesant Meadows -> Harry's if (client.Character.Stats.Cash.Value < 50) { // check if you got enough credits to use the ferry client.SendChatText("You need atleast 50 credits to board this ferry!"); teleport = false; } else { client.Character.Stats.Cash.Set(client.Character.Stats.Cash.Value - 50); newcoord.x = 3196; newcoord.z = 3172; newcoord.y = 7; playfield = 695; } break; case -1073282442: // Pleasant Meadows -> Omni-Tek outpost in Lush Fields if (client.Character.Stats.Cash.Value < 50) { // check if you got enough credits to use the ferry client.SendChatText("You need atleast 50 credits to board this ferry!"); teleport = false; } else { client.Character.Stats.Cash.Set(client.Character.Stats.Cash.Value - 50); newcoord.x = 3389; newcoord.z = 800; newcoord.y = 8; playfield = 695; } break; case -1073413449: // Omni-Tek outpost in Lush Fields -> Pleasant Meadows if (client.Character.Stats.Cash.Value < 50) { // check if you got enough credits to use the ferry client.SendChatText("You need atleast 50 credits to board this ferry!"); teleport = false; } else { client.Character.Stats.Cash.Set(client.Character.Stats.Cash.Value - 50); newcoord.x = 370; newcoord.z = 1562; newcoord.y = 7; playfield = 630; } break; case -1073347913: // Harry's trading outpost -> Omni-1 Trade (free) newcoord.x = 3569; newcoord.z = 912; newcoord.y = 9; playfield = 695; break; case -1073282377: // Omni-1 Trade -> Harry's trading outpost (free) newcoord.x = 3290; newcoord.z = 2922; newcoord.y = 7; playfield = 695; break; default: feedback = true; teleport = false; break; } if (teleport) { client.Teleport(newcoord, client.Character.Heading, playfield); } // Use item in inventory if (target.Type == 104) { InventoryEntries ie = client.Character.GetInventoryAt(target.Instance); AOItem mi = ItemHandler.GetItemTemplate(ie.Item.LowID); // TODO mi.applyon(client.Character, ItemHandler.eventtype_onuse, true, false, ie.Placement); TemplateAction.Send(client.Character, ie); if (mi.isConsumable()) { ie.Item.MultipleCount--; if (ie.Item.MultipleCount <= 0) { client.Character.Inventory.Remove(ie); DeleteItem.Send(client.Character, ie.Container, ie.Placement); // Packets.Stat.Set(client, 0, client.Character.Stats.GetStat(0),false); } } foreach (AOEvents aoe in mi.Events) { if (aoe.EventType == Constants.EventtypeOnUse) { sender.Character.ExecuteEvent( sender.Character, sender.Character, aoe, true, false, 0, CheckReqs.doCheckReqs); SkillUpdate.SendStat(client, 0x209, client.Character.Stats.SocialStatus.Value, false); // Social Status return; } } int le = packet[7] + packet[6] * 256; byte[] reply = new byte[le]; Array.Copy(packet, reply, le); reply[0] = 0xdf; reply[1] = 0xdf; reply[8] = 0x00; reply[9] = 0x00; reply[10] = 0x0C; reply[11] = 0x0E; reply[12] = (byte)(client.Character.Id >> 24); reply[13] = (byte)(client.Character.Id >> 16); reply[14] = (byte)(client.Character.Id >> 8); reply[15] = (byte)client.Character.Id; reply[0x1c] = 0; reply[32] = 1; reply[36] = 3; PacketWriter pw = new PacketWriter(); pw.PushBytes(reply); byte[] rep = pw.Finish(); client.SendCompressed(rep); SkillUpdate.SendStat(client, 0x209, client.Character.Stats.SocialStatus.Value, false); // Social Status return; } else if (target.Type == 51035) { // Shops VendingMachine vm = VendorHandler.GetVendorById(target.Instance); ShopInventory.Send(client, vm); Trade.Send(client, client.Character, vm); Trade.Send(client, vm, client.Character); Trade.Send(client, vm, client.Character); int le = packet[7] + packet[6] * 256; byte[] reply = new byte[le]; Array.Copy(packet, reply, le); reply[0] = 0xdf; reply[1] = 0xdf; reply[8] = 0x00; reply[9] = 0x00; reply[10] = 0x0C; reply[11] = 0x0E; reply[12] = (byte)(client.Character.Id >> 24); reply[13] = (byte)(client.Character.Id >> 16); reply[14] = (byte)(client.Character.Id >> 8); reply[15] = (byte)client.Character.Id; reply[0x1c] = 0; reply[0x20] = 1; client.Character.LastTrade = target; PacketWriter pw = new PacketWriter(); pw.PushBytes(reply); byte[] rep = pw.Finish(); client.SendCompressed(rep); } else if (target.Type == 51050) { // Open corpse } break; case 4: // Repair break; case 5: // UseItemOnItem #if DEBUG Console.WriteLine("Use Item on Item not defined yet"); Console.WriteLine("Packet data:"); string line = string.Empty; int count2 = 0; foreach (byte packbyte in packet) { if ((count2 % 16) == 0) { Console.WriteLine(line); line = string.Empty; } line = line + packbyte.ToString("X2") + " "; count2++; } if (line != string.Empty) { Console.WriteLine(); } Console.WriteLine(line); #endif break; default: break; } if (feedback) { #if DEBUG string Feedback1 = string.Format("T1 {0}, Count {1}, Action {2}, T4 {3}", temp1, count, action, temp4); string Feedback2 = string.Format( "User {0}:{1}, Target {2}:{3} ({4}:{5})", user.Type, user.Instance, target.Type, (uint)target.Instance, target.Type.ToString("X4"), ((uint)target.Instance).ToString("X8")); Statels.Statel b = null; if (Statels.Statelppf.ContainsKey(client.Character.PlayField)) { foreach (Statels.Statel z in Statels.Statelppf[client.Character.PlayField]) { if ((z.Type == target.Type) && ((Int32)z.Instance == target.Instance)) { b = z; break; } } } if (b != null) { foreach (Statels.StatelEvent e in b.Events) { Console.WriteLine("DebugOutput: \r\n" + e); } Console.WriteLine(b.Coordinates.ToString()); } else { Console.WriteLine( "No Statel defined in database for #" + target.Type + ":" + (UInt32)target.Instance + " (" + target.Type.ToString("X4") + ":" + target.Instance.ToString("X8") + ")"); } client.SendChatText(Feedback1); client.SendChatText(Feedback2); #endif } }
// Team Request Reply : CharAction 23 public void TeamRequestReplyCharacterAction23(Client sendingPlayer, Identity recievingPlayer) { // Accept Team Request CharAction Hex:23 PacketWriter pktCharAction23 = new PacketWriter(); pktCharAction23.PushByte(0xDF); pktCharAction23.PushByte(0xDF); // Header pktCharAction23.PushShort(0xA); // Packet Type pktCharAction23.PushShort(1); // Unknown 1 pktCharAction23.PushShort(0); // Legnth pktCharAction23.PushInt(3086); // Sender pktCharAction23.PushInt(sendingPlayer.Character.Id); // Reciever pktCharAction23.PushInt(0x5e477770); // Packet ID pktCharAction23.PushIdentity(50000, sendingPlayer.Character.Id); // TYPE / ID pktCharAction23.PushByte(0); pktCharAction23.PushInt(0x23); // Action ID pktCharAction23.PushInt(0); pktCharAction23.PushInt(50000); pktCharAction23.PushInt(sendingPlayer.Character.Id); pktCharAction23.PushInt(0xDEA9); // Team Window Information ?? pktCharAction23.PushInt(0x2EA0022); // Team ID Variable Goes Here pktCharAction23.PushShort(0); byte[] packet = pktCharAction23.Finish(); // IF Statement Determining Destination Client to Send Packet To Client receiver = FindClient.FindClientById(sendingPlayer.Character.Id); if (receiver != null) { receiver.SendCompressed(packet); } }
/// <summary> /// Set target /// </summary> /// <param name="packet">ref to datapacket</param> public void setTarget(ref byte[] packet) { lock (this) { PacketReader pr = new PacketReader(ref packet); Header head = pr.PopHeader(); pr.PopByte(); Target = pr.PopIdentity(); pr.Finish(); } }
// Team Reply Packet 28784248 : TeamMemberInfo + health and nano????? public void TeamReplyPacketTeamMemberInfo(int destinationClient, Client sendingPlayer, Identity recievingPlayer) { PacketWriter packetWriter = new PacketWriter(); packetWriter.PushByte(0xDF); packetWriter.PushByte(0xDF); // Header packetWriter.PushShort(0xA); // Packet Type packetWriter.PushShort(1); // Unknown 1 packetWriter.PushShort(0); // Legnth packetWriter.PushInt(3086); // Sender switch (destinationClient) { case 0: packetWriter.PushInt(sendingPlayer.Character.Id); // Reciever packetWriter.PushInt(0x46312D2E); // Packet ID packetWriter.PushIdentity(50000, sendingPlayer.Character.Id); // TYPE / ID packetWriter.PushInt(0); packetWriter.PushIdentity(50000, sendingPlayer.Character.Id); // Team Member Information packetWriter.PushInt(0x05F4); // HP/NANO?? Actual/MAX??? packetWriter.PushInt(0x05F4); // HP/NANO?? Actual/MAX??? packetWriter.PushInt(0x02F4); // HP/NANO?? Actual/MAX??? packetWriter.PushInt(0x02F4); // HP/NANO?? Actual/MAX??? packetWriter.PushShort(0); byte[] packet = packetWriter.Finish(); Client receiver = FindClient.FindClientById(recievingPlayer.Instance); if (receiver != null) { receiver.SendCompressed(packet); } break; case 1: packetWriter.PushInt(recievingPlayer.Instance); // Reciever packetWriter.PushInt(0x46312D2E); // Packet ID packetWriter.PushIdentity(50000, recievingPlayer.Instance); // TYPE / ID packetWriter.PushInt(0); packetWriter.PushIdentity(50000, recievingPlayer.Instance); // Team Member Information packetWriter.PushInt(0x05F4); // HP/NANO?? Actual/MAX??? packetWriter.PushInt(0x05F4); // HP/NANO?? Actual/MAX??? packetWriter.PushInt(0x02F4); // HP/NANO?? Actual/MAX??? packetWriter.PushInt(0x02F4); // HP/NANO?? Actual/MAX??? packetWriter.PushShort(0); byte[] packet2 = packetWriter.Finish(); sendingPlayer.SendCompressed(packet2); break; } }
// Team Request Reply : CharAction 15 public void TeamRequestReply(Client sendingPlayer, Identity recievingPlayer) { // Accept Team Request CharAction Hex:15 PacketWriter pktCharAction15 = new PacketWriter(); pktCharAction15.PushByte(0xDF); pktCharAction15.PushByte(0xDF); // Header pktCharAction15.PushShort(0xA); // Packet Type pktCharAction15.PushShort(1); // Unknown 1 pktCharAction15.PushShort(0); // Legnth pktCharAction15.PushInt(3086); // Sender pktCharAction15.PushInt(sendingPlayer.Character.Id); // Reciever pktCharAction15.PushInt(0x5e477770); // Packet ID pktCharAction15.PushIdentity(50000, sendingPlayer.Character.Id); // TYPE / ID pktCharAction15.PushByte(0); pktCharAction15.PushInt(0x15); // Action ID pktCharAction15.PushInt(0); pktCharAction15.PushInt(0); pktCharAction15.PushInt(0); pktCharAction15.PushInt(0); pktCharAction15.PushInt(0x11); // ?? pktCharAction15.PushShort(0); byte[] characterAction15Packet = pktCharAction15.Finish(); // IF Statement Determining Destination Client to Send Packet To Client receiver = FindClient.FindClientById(sendingPlayer.Character.Id); if (receiver != null) { receiver.SendCompressed(characterAction15Packet); } }