本文整理汇总了C#中ServerEngine.PacketEngine.Packet类的典型用法代码示例。如果您正苦于以下问题:C# Packet类的具体用法?C# Packet怎么用?C# Packet使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
Packet类属于ServerEngine.PacketEngine命名空间,在下文中一共展示了Packet类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: RecvAddStatRequest
public static AddStatInfo RecvAddStatRequest(Packet p)
{
p.Skip(2);
byte stat = p.ReadByte();
byte amount = p.ReadByte();
AddStatInfo asi = new AddStatInfo
{
Stat = stat,
Amount = amount
};
return asi;
}
示例2: RecvAddItemToShop
public static AddItemToShopInfo RecvAddItemToShop(Packet p)
{
p.Skip(2);
byte frombag = p.ReadByte();
byte fromslot = p.ReadByte();
int itemid = p.ReadInt();
byte slot = p.ReadByte();
int price = p.ReadInt();
AddItemToShopInfo i = new AddItemToShopInfo
{
FromBag = frombag,
FromSlot = fromslot,
ItemID = itemid,
Slot = slot,
Price = price
};
return i;
}
示例3: RecvBuyItem
public static BuyItemInfo RecvBuyItem(Packet p)
{
p.Skip(2);
int npcid = p.ReadInt();
short wref = p.ReadShort();
p.Skip(2);
short amount = p.ReadShort();
p.Skip(2);
byte bag = p.ReadByte();
BuyItemInfo i = new BuyItemInfo
{
NpcID = npcid,
ReferenceID = wref,
Amount = amount,
Bag = bag
};
return i;
}
示例4: Decrypt
/// <summary>
/// Decrypts the given packet
/// </summary>
/// <param name="p">The packet to decrypt</param>
public static Packet Decrypt(Packet p, int key)
{
byte[] data = p.GetBuffer();
int packetLength = data.Length - 4;
string value;
int Lenght;
byte BL, DL, CL;
long AL;
value = data[3].ToString("x2");
value += data[2].ToString("x2");
Lenght = Int32.Parse(value, NumberStyles.HexNumber);
BL = (byte)key;
CL = data[0];
AL = Lenght + 4;
DL = CL;
DL = (byte)(DL - AL);
DL = (byte)(DL - BL);
data[0] = DL;
DL = data[1];
BL = DL;
BL = (byte)(BL - AL);
BL = (byte)(BL - CL);
BL = (byte)(BL - key);
data[1] = BL;
for (int a = 0; a < Lenght; a++)
{
BL = data[a + 4];
BL = (byte)(BL - AL);
BL = (byte)(BL - DL);
BL = (byte)(BL - key);
DL = data[a + 4];
data[a + 4] = BL;
}
return new Packet(data);
}
示例5: RecvAcceptImbueItem
public static AcceptImbueItem RecvAcceptImbueItem(Packet p)
{
p.Skip(2);
int NpcID = p.ReadInt();
int toImbueID = p.ReadInt();
byte toImbueBag = p.ReadByte();
byte toImbueSlot = p.ReadByte();
int imbueItem1ID = p.ReadInt();
byte imbueItem1Bag = p.ReadByte();
byte imbueItem1Slot = p.ReadByte();
int imbueItem2ID = p.ReadInt();
byte imbueItem2Bag = p.ReadByte();
byte imbueItem2Slot = p.ReadByte();
int imbueItem3ID = p.ReadInt();
byte imbueItem3Bag = p.ReadByte();
byte imbueItem3Slot = p.ReadByte();
AcceptImbueItem i = new AcceptImbueItem
{
NpcID = NpcID,
ToImbueItemID = toImbueID,
ToImbueItemBag = toImbueBag,
ToImbueItemSlot = toImbueSlot,
ImbueItem1ID = imbueItem1ID,
ImbueItem1Bag = imbueItem1Bag,
ImbueItem1Slot = imbueItem1Slot,
ImbueItem2ID = imbueItem2ID,
ImbueItem2Bag = imbueItem2Bag,
ImbueItem2Slot = imbueItem2Slot,
ImbueItem3ID = imbueItem3ID,
ImbueItem3Bag = imbueItem3Bag,
ImbueItem3Slot = imbueItem3Slot
};
return i;
}
示例6: RecvAddItemToWarehouse
public static AddItemToWarehouseInfo RecvAddItemToWarehouse(Packet p)
{
p.Skip(2);
int charid = p.ReadInt();
int itemid = p.ReadInt();
byte frombag = p.ReadByte();
byte fromslot = p.ReadByte();
byte toslot = p.ReadByte();
byte tobag = p.ReadByte();
AddItemToWarehouseInfo i = new AddItemToWarehouseInfo
{
CharacterID = charid,
ItemID = itemid,
FromBag = frombag,
FromSlot = fromslot,
ToBag = tobag,
ToSlot = toslot
};
return i;
}
示例7: SendBagItems
public static byte[] SendBagItems(List<BaseItem> items, int bag)
{
Packet p = new Packet(200);
// p.WriteHexString("18 31 A4 00 00 02 00 73 83 D0 00 2A 4E 01 02 B0 04 00 00 00 00 00 00 02 00 00 04 00 05 00 06 00 07 00 08 00 C0 C8 00 C8 00 05 00 06 00 07 00 08 00 09 00 0A 00 0B 00 0C 00 0D 00 0E 00 0F 08 00 00 00 04 00 05 00 07 00 0A 00 0B 00 0C 00 0D 00 00 00 00 01 01 01 02 02 74 83 D0 00 35 4E 02 01 34 08 00 00 00 00 00 00 02 01 00 01 00 00 00 00 00 01 00 00 00 C8 64 00 64 00 00 00 03 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00");
p.WriteByte(bag);
p.WriteByte(items.Count);
foreach (BaseItem i in items)
{
p.WriteByte(i.Slot);
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.WriteByte(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.WriteByte(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);
p.WriteByte(e.MappedData);
if (!(e is Ring) && !(e is Necklace) && !(e is Cape))
p.WriteByte(e.ForceSlot);
p.WriteHexString("00 00"); // unknown
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.WriteByte(e.RebirthHole);
p.WriteByte(e.RebirthHoleItem);
p.WriteShort(e.RebirthHoleStat);
}
}
if (i is ImbueItem)
{
ImbueItem im = i as ImbueItem;
p.WriteByte(im.RequiredClass);
p.WriteShort(i.Amount);
p.WriteHexString("00"); // imbuestat, eg dec level, increase value etc
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");
//.........这里部分代码省略.........
示例8: SendHardSkillList
public static byte[] SendHardSkillList()
{
Packet p = new Packet(200);
p.WriteHexString("1D 31 01 00 00");
return p.GetWrittenBuffer();
}
示例9: SendCreateCharacter
/// <summary>
/// Create character
/// </summary>
/// <param name="ms">State of character making</param>
/// <param name="playerid">ID of character that was made</param>
/// <returns></returns>
public static byte[] SendCreateCharacter(CharCreationState ms, int playerid)
{
Packet p = new Packet(500);
p.WriteByte((byte)ms);
if (ms == CharCreationState.Success)
p.WriteInt(playerid);
else
p.WriteHexString("00 00 00 00");
return p.GetWrittenBuffer(PacketIds.SendCreateCharacter);
}
示例10: SendChannelChange
public static byte[] SendChannelChange(int something, int something2)
{
Packet p = new Packet(200);
p.WriteByte(0);
p.WriteByte(something);
p.WriteByte(something2);
return p.GetWrittenBuffer(PacketIds.SendChannelChange);
}
示例11: RecvUnitLogin
/// <summary>
/// Generates the unit server login information from packet
/// </summary>
/// <param name="p"></param>
/// <returns></returns>
public static UnitLogin RecvUnitLogin(Packet p)
{
p.Skip(2);
string account = p.ReadString();
int hash = p.ReadShort();
int map = p.ReadShort();
int channel = p.ReadByte();
p.Skip(6);
int characterID = p.ReadInt();
UnitLogin u = new UnitLogin()
{
Account = account,
AccountID = hash,
Channel = channel,
CharacterID = characterID
};
return u;
}
示例12: RecvStopMoving
public static MovementInfo RecvStopMoving(Packet p)
{
p.Skip(2);
int charid = p.ReadInt();
short from_x = p.ReadShort();
short from_y = p.ReadShort();
byte from_z = p.ReadByte();
MovementInfo mi = new MovementInfo
{
PacketID = 3,
CharacterID = charid,
FromX = from_x,
FromY = from_y,
FromZ = from_z,
};
return mi;
}
示例13: RecvStatRequest
public static StatRequestInfo RecvStatRequest(Packet p)
{
p.Skip(2);
int charid = p.ReadInt();
int mapid = p.ReadInt();
StatRequestInfo sr = new StatRequestInfo
{
CharacterID = charid,
MapID = mapid
};
return sr;
}
示例14: RecvStartMoving
public static MovementInfo RecvStartMoving(Packet p)
{
p.Skip(2);
int charid = p.ReadInt();
short from_x = p.ReadShort();
short from_y = p.ReadShort();
byte from_z = p.ReadByte();
short to_x = p.ReadShort();
short to_y = p.ReadShort();
byte to_z = p.ReadByte();
short direction = p.ReadShort();
MovementInfo mi = new MovementInfo
{
PacketID = 1,
CharacterID = charid,
FromX = from_x,
FromY = from_y,
FromZ = from_z,
ToX = to_x,
ToY = to_y,
ToZ = to_z,
Rotation = direction
};
return mi;
}
示例15: RecvSpawnOtherPlayerRequest
public static SpawnRequestInfo RecvSpawnOtherPlayerRequest(Packet p)
{
p.Skip(2);
int charid = p.ReadInt();
int mapid = p.ReadInt();
SpawnRequestInfo sr = new SpawnRequestInfo
{
CharacterID = charid,
MapID = mapid
};
return sr;
}