public static byte[] SendTradeAddItem(TradeAddItemInfo info, BaseItem i) { Packet p = new Packet(20); p.WriteHexString("00"); p.WriteInt(i.OwnerID); p.WriteByte(info.FromBag); p.WriteByte(info.FromSlot); p.WriteByte(info.ToBag); p.WriteByte(i.TradeSlot); p.WriteInt(info.ItemID); p.WriteShort(info.Amount); p.WriteHexString("00 00"); p.WriteInt(i.ItemID); p.WriteShort(i.ReferenceID); p.WriteByte(i.bType); p.WriteByte(i.bKind); p.WriteShort(i.VisualID); p.WriteInt(i.Price); p.WriteHexString("00 00"); if (i is Equipment) { Equipment e = i as Equipment; p.WriteByte(e.RequiredClass); p.WriteShort(e.Amount); p.WriteShort(e.RequiredLevel); p.WriteShort(e.RequiredDexterity); p.WriteShort(e.RequiredStrength); p.WriteShort(e.RequiredStamina); p.WriteShort(e.RequiredEnergy); p.WriteShort(e.MaxImbueTries); p.WriteShort(e.Durability); p.WriteShort(e.MaxDurability); p.WriteShort(e.Damage); p.WriteShort(e.Defence); p.WriteShort(e.AttackRating); p.WriteShort(e.AttackSpeed); p.WriteShort(e.AttackRange); p.WriteShort(e.IncMaxLife); p.WriteShort(e.IncMaxMana); p.WriteShort(e.IncLifeRegen); p.WriteShort(e.IncManaRegen); p.WriteShort(e.Critical); p.WriteByte(e.Plus); p.WriteByte(e.Slvl); p.WriteHexString("00"); // unknown p.WriteShort(e.ImbueTries); p.WriteHexString("00"); // unknown p.WriteShort(e.DragonSuccessImbueTries); p.WriteByte(e.DiscountRepairFee); p.WriteShort(e.TotalDragonImbueTries); p.WriteShort(e.DragonDamage); p.WriteShort(e.DragonDefence); p.WriteShort(e.DragonAttackRating); p.WriteShort(e.DragonLife); if (e is Mirror) { Mirror m = e as Mirror; p.WriteInt(m.PetID); p.WriteShort(m.LifeAbsorb); p.WriteShort(m.DamageAbsorb); p.WriteShort(m.DefenseAbsorb); p.WriteShort(m.AttackRatingAbsorb); p.WriteHexString("00 00 00 00 00 00 00 00 00 00"); // pet skill stuff yo } else { p.WriteByte(e.MappedData); if (!(e is Ring) && !(e is Necklace) && !(e is Cape)) { p.WriteByte(e.ForceSlot); p.WriteHexString("00 00"); // otherslots } else p.WriteHexString("00 00"); if (e is Cape) { Cape c = e as Cape; p.WriteHexString("00 00"); // required guild position p.WriteHexString("00 00 00 00 00 00 00"); p.WriteHexString("01 00"); // decrease times of durability p.WriteByte(c.PolishImbueTries); // polish imbue tries p.WriteShort(c.MaxPolishImbueTries); // polish max tries p.WriteShort(c.VigiStat1); // stat1 p.WriteShort(c.VigiStat2); // stat2 p.WriteShort(c.VigiStat3); // stat3 p.WriteShort(c.VigiStat4); // stat4 p.WriteHexString("00 00"); // stat5 p.WriteShort(c.VigiStatAdd1); // stat1 increase p.WriteShort(c.VigiStatAdd2); // stat2 increase p.WriteShort(c.VigiStatAdd3); // stat3 increase p.WriteShort(c.VigiStatAdd4); // stat4 increase p.WriteHexString("00 00"); // stat5 increase p.WriteHexString("00 00"); // unknown } if (!(e is Ring) && !(e is Necklace) && !(e is Cape)) { p.WriteShort(e.RebirthHole); p.WriteShort(e.RebirthHoleStat); } } } if (i is ImbueItem) { ImbueItem im = i as ImbueItem; p.WriteByte(im.RequiredClass); p.WriteShort(i.Amount); if (i is RbHoleItem) { p.WriteByte(0); p.WriteInt(im.ImbueChance); p.WriteInt(im.IncreaseValue); p.WriteHexString("00 00"); } else { p.WriteByte(im.ImbueData); p.WriteShort(im.ImbueChance); p.WriteShort(im.IncreaseValue); p.WriteHexString("00 00"); // could be lowest lvl who knows p.WriteHexString("00 00"); // maxlevel of usage, for dragon stones p.WriteHexString("00 00"); // unknown } } if (i is PotionItem) { PotionItem pot = i as PotionItem; p.WriteByte(pot.RequiredClass); p.WriteShort(pot.Amount); p.WriteHexString("00 00 00 00"); p.WriteShort(pot.HealHp); p.WriteShort(pot.HealMana); p.WriteHexString("00 20 4E 00 00 00 00"); } if (i is BookItem) { BookItem book = i as BookItem; p.WriteByte(book.RequiredClass); p.WriteShort(book.Amount); p.WriteShort(book.RequiredLevel); p.WriteInt(book.SkillID); p.WriteByte(book.SkillLevel); p.WriteInt(book.SkillData); } if (i is BeadItem) { BeadItem bead = i as BeadItem; p.WriteByte(bead.RequiredClass); p.WriteShort(bead.Amount); p.WriteInt(bead.ToMapID); p.WriteHexString("01 00 00 00 00 00 00"); } if (i is StoreTag) { StoreTag tag = i as StoreTag; p.WriteByte(tag.RequiredClass); p.WriteShort(tag.Amount); p.WriteHexString("00 00"); p.WriteShort(tag.TimeLeft); p.WriteShort(tag.TimeMax); p.WriteHexString("00 00 00 00 00 00"); } if (i is PetItem) { PetItem pet = i as PetItem; p.WriteByte(pet.RequiredClass); p.WriteShort(pet.Amount); p.WriteByte(pet.TameChance); p.WriteHexString("00 00 00 00"); // unknown p.WriteByte(pet.DecreaseWildness); p.WriteInt(pet.HealLife); } if (i is RebirthPill) { RebirthPill pill = i as RebirthPill; p.WriteHexString("00"); p.WriteShort(pill.Amount); p.WriteShort(pill.RequiredRebirth); p.WriteHexString("00"); p.WriteShort(pill.RequiredLevel); p.WriteHexString("00 00"); } return p.GetWrittenBuffer(PacketIds.SendTradeAddItem); }
public ClientTradeAddItemEventArgs(TradeAddItemInfo i) { info = i; }
public static TradeAddItemInfo RecvTradeAdditem(Packet p) { p.Skip(2); byte frombag = p.ReadByte(); byte fromslot = p.ReadByte(); byte tobag = p.ReadByte(); byte toslot = p.ReadByte(); int itemid = p.ReadInt(); short amount = p.ReadShort(); p.Skip(2); int charid = p.ReadInt(); TradeAddItemInfo i = new TradeAddItemInfo { FromBag = frombag, FromSlot = fromslot, ToBag = tobag, ToSlot = toslot, ItemID = itemid, Amount = amount, PlayerID = charid }; return i; }