/// <summary> /// Cancels the exchange. /// </summary> public void CancelExchange() { var trader = Exchange.Trader; var exchangeA = Exchange; var exchangeB = trader.Exchange; var itemsA = exchangeA.Items.ToArray(); var itemsB = exchangeB.Items.ToArray(); var goldA = exchangeA.Gold; var goldB = exchangeB.Gold; Exchange = null; trader.Exchange = null; foreach (var item in itemsB) { if (item.GiveTo(trader)) { } } foreach (var item in itemsA) { if (item.GiveTo(this)) { } } GoldPoints += goldA; trader.GoldPoints += goldB; if (trader.GoldPoints > ServerContext.Config.MaxCarryGold) { trader.GoldPoints = ServerContext.Config.MaxCarryGold; } if (GoldPoints > ServerContext.Config.MaxCarryGold) { GoldPoints = ServerContext.Config.MaxCarryGold; } trader.Client.SendStats(StatusFlags.StructC); Client.SendStats(StatusFlags.StructC); var packet = new NetworkPacketWriter(); packet.Write((byte)0x42); packet.Write((byte)0x00); packet.Write((byte)0x04); packet.Write((byte)0x00); packet.WriteStringA("Trade was aborted."); Client.Send(packet); packet = new NetworkPacketWriter(); packet.Write((byte)0x42); packet.Write((byte)0x00); packet.Write((byte)0x04); packet.Write((byte)0x01); packet.WriteStringA("Trade was aborted."); trader.Client.Send(packet); }
public override void Serialize(NetworkPacketWriter writer) { writer.Write(Slot); }
public override void Serialize(NetworkPacketWriter writer) { writer.Write((byte)ActionType); writer.Write((byte)(Close ? 1 : 0)); writer.WriteStringA(Message); }
public override void Serialize(NetworkPacketWriter writer) { writer.Write(Shade); writer.Write(Unknown); }
public override void Serialize(NetworkPacketWriter writer) { writer.Write((byte)Pane); writer.Write((byte)Slot); writer.Write((int)Time); }
public override void Serialize(NetworkPacketWriter packet) { packet.Write(Aisling.Nation); packet.WriteStringA(Aisling.ClanRank); packet.Write((byte)0x07); packet.Write((byte)0x0); packet.Write((byte)0x0); packet.Write((byte)0x0); packet.Write((byte)0x0); packet.Write((byte)0x0); packet.Write((byte)0x0); packet.Write((byte)0x0); var isGrouped = Aisling.GroupParty.LengthExcludingSelf > 0; if (!isGrouped) { packet.WriteStringA("no group"); } else { var partyMessage = "Group members\n"; foreach (var member in Aisling.GroupParty.Members) { partyMessage += string.Format("{0}{1}\n", Aisling.Username.Equals(member.GroupParty.Creator.Username, StringComparison.OrdinalIgnoreCase) ? " * " : " ", member.Username); } partyMessage += string.Format("{0} total", Aisling.GroupParty.Length); packet.WriteStringA(partyMessage); } packet.Write((byte)Aisling.PartyStatus); packet.Write((byte)0x00); packet.Write((byte)Aisling.ClassID); packet.Write((byte)Aisling.Nation); packet.Write((byte)0x01); packet.WriteStringA(Convert.ToString(Aisling.Stage != ClassStage.Class ? Aisling.Stage.ToString() : Aisling.Path.ToString())); packet.WriteStringA(Aisling.Clan); packet.Write((byte)Aisling.LegendBook.LegendMarks.Count); foreach (var legend in Aisling.LegendBook.LegendMarks) { packet.Write(legend.Icon); packet.Write(legend.Color); packet.WriteStringA(legend.Category); packet.WriteStringA(legend.Value + string.Format(" - {0}", DateTime.UtcNow.ToShortDateString())); } packet.Write((byte)0x00); packet.Write((ushort)Aisling.Display); packet.Write((byte)0x02); packet.Write((uint)0x00); packet.Write((byte)0x00); }
public override void Serialize(NetworkPacketWriter writer) { Ping = DateTime.UtcNow; writer.Write((ushort)0x0001); }
public override void Serialize(NetworkPacketWriter writer) { writer.Write(Serial); writer.Write(Health); writer.Write(Sound); }
public override void Serialize(NetworkPacketWriter writer) { writer.Write(Flags); if ((Flags & 0x20) != 0) { writer.Write((byte)1); writer.Write((byte)0); writer.Write((byte)0); writer.Write((byte)Aisling.ExpLevel); writer.Write((byte)Aisling.AbpLevel); writer.Write((uint)Aisling.MaximumHp); writer.Write((uint)Aisling.MaximumMp); writer.Write(Aisling.Str); writer.Write(Aisling.Int); writer.Write(Aisling.Wis); writer.Write(Aisling.Con); writer.Write(Aisling.Dex); if (Aisling.StatPoints > 0) { writer.Write((byte)1); writer.Write((byte)Aisling.StatPoints); } else { writer.Write((byte)0); writer.Write((byte)0); } writer.Write((ushort)Aisling.MaximumWeight); writer.Write((ushort)Aisling.CurrentWeight); writer.Write(uint.MinValue); } if ((Flags & 0x10) != 0) { writer.Write((uint)Aisling.CurrentHp); writer.Write((uint)Aisling.CurrentMp); } if ((Flags & 0x08) != 0) { writer.Write((uint)Aisling.ExpTotal); writer.Write((uint)Aisling.ExpNext); writer.Write((uint)Aisling.AbpTotal); writer.Write((uint)Aisling.AbpNext); writer.Write((uint)Aisling.GamePoints); writer.Write((uint)Aisling.GoldPoints); } if ((Flags & 0x04) != 0) { writer.Write(uint.MinValue); writer.Write(Aisling.Blind); writer.Write((byte)0x10); writer.Write((byte)Aisling.OffenseElement); // element off writer.Write((byte)Aisling.DefenseElement); // element def writer.Write((byte)(Aisling.Mr / 10)); writer.Write(byte.MinValue); writer.Write((sbyte)Aisling.Ac); writer.Write(Aisling.Dmg); writer.Write(Aisling.Hit); } }
public override void Serialize(NetworkPacketWriter writer) { writer.Write(Serial); writer.Write(Direction); }
private void BuildEquipment(NetworkPacketWriter writer) { //1 if (Aisling.EquipmentManager.Weapon != null) { writer.Write(Aisling.EquipmentManager.Weapon.Item.DisplayImage); writer.Write(Aisling.EquipmentManager.Weapon.Item.Color); } else { writer.Write(ushort.MinValue); writer.Write((byte)0x00); } //2 if (Aisling.EquipmentManager.Armor != null) { writer.Write(Aisling.EquipmentManager.Armor.Item.DisplayImage); writer.Write(Aisling.EquipmentManager.Armor.Item.Color); } else { writer.Write(ushort.MinValue); writer.Write((byte)0x00); } //3 if (Aisling.EquipmentManager.Shield != null) { writer.Write(Aisling.EquipmentManager.Shield.Item.DisplayImage); writer.Write(Aisling.EquipmentManager.Shield.Item.Color); } else { writer.Write(ushort.MinValue); writer.Write((byte)0x00); } //4 if (Aisling.EquipmentManager.DisplayHelm != null) { writer.Write(Aisling.EquipmentManager.DisplayHelm.Item.DisplayImage); writer.Write(Aisling.EquipmentManager.DisplayHelm.Item.Color); } else { writer.Write(ushort.MinValue); writer.Write((byte)0x00); } //5 if (Aisling.EquipmentManager.Earring != null) { writer.Write(Aisling.EquipmentManager.Earring.Item.DisplayImage); writer.Write(Aisling.EquipmentManager.Earring.Item.Color); } else { writer.Write(ushort.MinValue); writer.Write((byte)0x00); } //6 if (Aisling.EquipmentManager.Necklace != null) { writer.Write(Aisling.EquipmentManager.Necklace.Item.DisplayImage); writer.Write(Aisling.EquipmentManager.Necklace.Item.Color); } else { writer.Write(ushort.MinValue); writer.Write((byte)0x00); } //7 if (Aisling.EquipmentManager.LRing != null) { writer.Write(Aisling.EquipmentManager.LRing.Item.DisplayImage); writer.Write(Aisling.EquipmentManager.LRing.Item.Color); } else { writer.Write(ushort.MinValue); writer.Write((byte)0x00); } //8 if (Aisling.EquipmentManager.RRing != null) { writer.Write(Aisling.EquipmentManager.RRing.Item.DisplayImage); writer.Write(Aisling.EquipmentManager.RRing.Item.Color); } else { writer.Write(ushort.MinValue); writer.Write((byte)0x00); } //9 if (Aisling.EquipmentManager.LGauntlet != null) { writer.Write(Aisling.EquipmentManager.LGauntlet.Item.DisplayImage); writer.Write(Aisling.EquipmentManager.LGauntlet.Item.Color); } else { writer.Write(ushort.MinValue); writer.Write((byte)0x00); } //10 if (Aisling.EquipmentManager.RGauntlet != null) { writer.Write(Aisling.EquipmentManager.RGauntlet.Item.DisplayImage); writer.Write(Aisling.EquipmentManager.RGauntlet.Item.Color); } else { writer.Write(ushort.MinValue); writer.Write((byte)0x00); } //11 if (Aisling.EquipmentManager.Belt != null) { writer.Write(Aisling.EquipmentManager.Belt.Item.DisplayImage); writer.Write(Aisling.EquipmentManager.Belt.Item.Color); } else { writer.Write(ushort.MinValue); writer.Write((byte)0x00); } //12 if (Aisling.EquipmentManager.Greaves != null) { writer.Write(Aisling.EquipmentManager.Greaves.Item.DisplayImage); writer.Write(Aisling.EquipmentManager.Greaves.Item.Color); } else { writer.Write(ushort.MinValue); writer.Write((byte)0x00); } //13 if (Aisling.EquipmentManager.FirstAcc != null) { writer.Write(Aisling.EquipmentManager.FirstAcc.Item.DisplayImage); writer.Write(Aisling.EquipmentManager.FirstAcc.Item.Color); } else { writer.Write(ushort.MinValue); writer.Write((byte)0x00); } if (Aisling.EquipmentManager.Boots != null) { writer.Write(Aisling.EquipmentManager.Boots.Item.DisplayImage); writer.Write(Aisling.EquipmentManager.Boots.Item.Color); } else { writer.Write(ushort.MinValue); writer.Write((byte)0x00); } //15 if (Aisling.EquipmentManager.Overcoat != null) { writer.Write(Aisling.EquipmentManager.Overcoat.Item.DisplayImage); writer.Write(Aisling.EquipmentManager.Overcoat.Item.Color); } else { writer.Write(ushort.MinValue); writer.Write((byte)0x00); } //16 if (Aisling.EquipmentManager.Helmet != null) { writer.Write(Aisling.EquipmentManager.Helmet.Item.DisplayImage); writer.Write(Aisling.EquipmentManager.Helmet.Item.Color); } else { writer.Write(ushort.MinValue); writer.Write((byte)0x00); } //17 if (Aisling.EquipmentManager.SecondAcc != null) { writer.Write(Aisling.EquipmentManager.SecondAcc.Item.DisplayImage); writer.Write(Aisling.EquipmentManager.SecondAcc.Item.Color); } else { writer.Write(ushort.MinValue); writer.Write((byte)0x00); } }
public override void Serialize(NetworkPacketWriter writer) { writer.Write(Slot); writer.Write(Icon); writer.WriteStringA(Text); }
public override void Serialize(NetworkPacketWriter writer) { if (Sprites.Count > 0) { writer.Write((ushort)Sprites.Count); foreach (var sprite in Sprites) { if (sprite is Money || sprite is Item) { if (sprite is Money) { writer.Write((ushort)sprite.XPos); writer.Write((ushort)sprite.YPos); writer.Write((uint)sprite.Serial); writer.Write((sprite as Money).Image); writer.Write(byte.MinValue); writer.Write(byte.MinValue); writer.Write(byte.MinValue); } if (sprite is Item) { writer.Write((ushort)sprite.XPos); writer.Write((ushort)sprite.YPos); writer.Write((uint)sprite.Serial); writer.Write((sprite as Item).DisplayImage); writer.Write(byte.MinValue); writer.Write(byte.MinValue); writer.Write(byte.MinValue); } } if (sprite is Monster) { writer.Write((ushort)sprite.XPos); writer.Write((ushort)sprite.YPos); writer.Write((uint)sprite.Serial); writer.Write((sprite as Monster).Image); writer.Write((uint)0x0); // NFI writer.Write(sprite.Direction); writer.Write(byte.MinValue); // NFI writer.Write(byte.MinValue); // Tint } if (sprite is Mundane) { writer.Write((ushort)sprite.XPos); writer.Write((ushort)sprite.YPos); writer.Write((uint)sprite.Serial); writer.Write((ushort)(sprite as Mundane).Template.Image); writer.Write(uint.MinValue); // NFI writer.Write(sprite.Direction); writer.Write(byte.MinValue); // NFI writer.Write((byte)0x02); // Type writer.WriteStringA((sprite as Mundane).Template.Name); } } } }
public abstract void Serialize(NetworkPacketWriter writer);
public override void Serialize(NetworkPacketWriter writer) { writer.Write(byte.MinValue); }
public override void Serialize(NetworkPacketWriter packet) { packet.Write(Slot); }
public override void Serialize(NetworkPacketWriter writer) { writer.Write((byte)0x00); writer.Write((ushort)Number); }
public void Serialize(NetworkPacketWriter writer) { writer.Write(Step); }
public override void Serialize(NetworkPacketWriter writer) { }
public override void Serialize(NetworkPacketWriter writer) { writer.Write(Type); writer.WriteString(Text); }
public override void Serialize(NetworkPacketWriter packet) { packet.Write(Aisling.Nation); packet.WriteStringA(Aisling.ClanRank); packet.Write((byte)0x07); packet.Write((byte)0x0); packet.Write((byte)0x0); packet.Write((byte)0x0); packet.Write((byte)0x0); packet.Write((byte)0x0); packet.Write((byte)0x0); packet.Write((byte)0x0); var isGrouped = Aisling.GroupParty != null && Aisling.GroupParty.PartyMembers != null && Aisling.GroupParty != null && Aisling.GroupParty.PartyMembers.Count(i => i.Serial != Aisling.Serial) > 0; if (!isGrouped) { packet.WriteStringA("no group"); } else { var partyMessage = Aisling.GroupParty.PartyMembers.Aggregate( "Group members\n", (current, member) => current + $"{(Aisling.Username.Equals(member.GroupParty.LeaderName, StringComparison.OrdinalIgnoreCase) ? " * " : " ")}{member.Username}\n"); partyMessage += $"{Aisling.GroupParty.PartyMembers.Count} total"; packet.WriteStringA(partyMessage); } packet.Write((byte)Aisling.PartyStatus); packet.Write((byte)0x00); packet.Write((byte)Aisling.Path); packet.Write(Aisling.Nation); packet.Write((byte)0x01); packet.WriteStringA(Convert.ToString(Aisling.Stage != ClassStage.Class ? Aisling.Stage.ToString() : Aisling.Path.ToString())); packet.WriteStringA(Aisling.Clan); var legendSubjects = from subject in Aisling.LegendBook.LegendMarks group subject by subject into g let count = g.Count() orderby count descending select new { Value = Aisling.LegendBook.LegendMarks.Find(i => i.Value == g.Key.Value), Count = Aisling.LegendBook.LegendMarks.Count(i => i.Value == g.Key.Value) }; var exactCount = legendSubjects.Distinct().Count(); packet.Write((byte)exactCount); foreach (var obj in legendSubjects.Distinct().ToList()) { var legend = obj.Value; packet.Write(legend.Icon); packet.Write(legend.Color); packet.WriteStringA(legend.Category); packet.WriteStringA($"{legend.Value} {(obj.Count > 1 ? "(" + obj.Count + ")" : "")}"); } packet.Write((byte)0x00); packet.Write((ushort)Aisling.Display); packet.Write((byte)0x02); packet.Write((uint)0x00); packet.Write((byte)0x00); }
public override void Serialize(NetworkPacketWriter writer) { writer.Write(Line); writer.Write(Data); }