本文整理汇总了C#中Packet.GetThree方法的典型用法代码示例。如果您正苦于以下问题:C# Packet.GetThree方法的具体用法?C# Packet.GetThree怎么用?C# Packet.GetThree使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Packet
的用法示例。
在下文中一共展示了Packet.GetThree方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: ChestData
internal ChestData(Packet pkt, bool containsCoords)
{
x = containsCoords ? pkt.GetChar() : byte.MinValue;
y = containsCoords ? pkt.GetChar() : byte.MinValue;
int numRemaining = pkt.PeekEndString().Length / 5;
items = new List<Tuple<short, int>>(numRemaining);
for (int i = 0; i < numRemaining; ++i)
{
items.Add(new Tuple<short, int>(pkt.GetShort(), pkt.GetThree()));
}
}
示例2: HandleDrop
public static void HandleDrop(Packet packet, IClient client, bool fromQueue)
{
short id = packet.GetShort();
int amount = (packet.Length == 10 ? packet.GetThree() : packet.GetInt());
byte x = packet.GetChar();
byte y = packet.GetChar();
if (x == 254 && y == 254)
{
x = client.Character.X;
y = client.Character.Y;
}
client.Character.DropItem(id, amount, x, y);
}
示例3: WalkCommon
private static void WalkCommon(Packet packet, IClient client, bool fromQueue, WalkType walkType)
{
Direction direction = (Direction)packet.GetChar();
//TODO: SpeedTimestamp
//SpeedTimestamp timestamp = new SpeedTimestamp(packet.GetThree());
int timestamp = packet.GetThree();
byte x = packet.GetChar();
byte y = packet.GetChar();
client.Character.Walk(direction, walkType, true);
if (client.Character.X != x || client.Character.Y != y)
client.Character.Refresh();
}
示例4: _handleRefreshReply
private void _handleRefreshReply(Packet pkt)
{
if (OnWarpAgree == null)
return;
byte numOtherChars = pkt.GetChar();
if (pkt.GetByte() != 255)
return;
List<CharacterData> otherChars = new List<CharacterData>(numOtherChars);
for (int i = 0; i < numOtherChars; ++i)
{
CharacterData data = new CharacterData(pkt);
otherChars.Add(data);
if (pkt.GetByte() != 255)
return;
}
List<NPCData> otherNPCs = new List<NPCData>();
while (pkt.PeekByte() != 255)
{
NPCData newGuy = new NPCData(pkt);
otherNPCs.Add(newGuy);
}
pkt.GetByte();
List<MapItem> mapItems = new List<MapItem>();
while (pkt.ReadPos < pkt.Length)
{
mapItems.Add(new MapItem
{
uid = pkt.GetShort(),
id = pkt.GetShort(),
x = pkt.GetChar(),
y = pkt.GetChar(),
amount = pkt.GetThree(),
//turn off drop protection for items coming into view - server will validate
time = DateTime.Now.AddSeconds(-5),
npcDrop = false,
playerID = -1
});
}
OnWarpAgree(-1, WarpAnimation.None, otherChars, otherNPCs, mapItems);
}
示例5: _handleMainPlayerWalk
private void _handleMainPlayerWalk(Packet pkt)
{
if (pkt.GetByte() != 255 || pkt.GetByte() != 255 || OnMainPlayerWalk == null)
return;
//response contains the map items that are now in range
int numberOfMapItems = pkt.PeekEndString().Length / 9;
List<MapItem> items = new List<MapItem>(numberOfMapItems);
for (int i = 0; i < numberOfMapItems; ++i)
{
items.Add(new MapItem
{
uid = pkt.GetShort(),
id = pkt.GetShort(),
x = pkt.GetChar(),
y = pkt.GetChar(),
amount = pkt.GetThree()
});
}
OnMainPlayerWalk(items);
}
示例6: PaperdollEquipData
internal PaperdollEquipData(Packet pkt, bool itemUnequipped)
{
itemRemoved = itemUnequipped;
itemID = pkt.GetShort();
characterAmount = itemUnequipped ? 1 : pkt.GetThree();
subLoc = pkt.GetChar();
maxhp = pkt.GetShort();
maxtp = pkt.GetShort();
disp_str = pkt.GetShort();
disp_int = pkt.GetShort();
disp_wis = pkt.GetShort();
disp_agi = pkt.GetShort();
disp_con = pkt.GetShort();
disp_cha = pkt.GetShort();
mindam = pkt.GetShort();
maxdam = pkt.GetShort();
accuracy = pkt.GetShort();
evade = pkt.GetShort();
armor = pkt.GetShort();
}
示例7: _handleWarpRequest
private void _handleWarpRequest(Packet pkt)
{
WarpReply warpType = (WarpReply)pkt.GetChar();
switch (warpType)
{
case WarpReply.WarpSameMap: _warpAccept(pkt.GetShort()); break; //pkt.GetChar() x2 for x,y coords
case WarpReply.WarpNewMap:
if (OnWarpRequestNewMap == null)
return;
short mapID = pkt.GetShort();
byte[] mapRid = pkt.GetBytes(4);
int fileSize = pkt.GetThree();
if (!OnWarpRequestNewMap(mapID, mapRid, fileSize)) //file check failed if return value is false
{
//does WARP_TAKE (which downloads a new map) if we need it
if (!RequestWarpMap(mapID))
return;
}
_warpAccept(mapID); //WarpAgree response packet will make sure everything is dandy
break;
}
}
示例8: _handleLockerOpen
/// <summary>
/// Handles LOCKER_OPEN from server for opening a locker
/// </summary>
private void _handleLockerOpen(Packet pkt)
{
if (OnLockerOpen == null) return;
byte x = pkt.GetChar();
byte y = pkt.GetChar();
List<InventoryItem> items = new List<InventoryItem>();
while (pkt.ReadPos != pkt.Length)
{
items.Add(new InventoryItem { id = pkt.GetShort(), amount = pkt.GetThree() });
}
OnLockerOpen(x, y, items);
}
示例9: _handleNPCReply
/// <summary>
/// Handler for NPC_REPLY packet, when NPC takes damage from an attack (spell cast or weapon) but is still alive
/// </summary>
private void _handleNPCReply(Packet pkt)
{
if (OnNPCTakeDamage == null) return;
short fromPlayerID = pkt.GetShort();
EODirection fromDirection = (EODirection)pkt.GetChar();
short npcIndex = pkt.GetShort();
int damageToNPC = pkt.GetThree();
int npcPctHealth = pkt.GetShort();
if (pkt.GetChar() != 1)
return;
OnNPCTakeDamage((byte)npcIndex, fromPlayerID, fromDirection, damageToNPC, npcPctHealth);
}
示例10: _handleChestGet
/// <summary>
/// Handler for CHEST_GET packet, sent as confirmation to character that item is being taken
/// </summary>
private void _handleChestGet(Packet pkt)
{
if (OnChestGetItem == null) return;
short takenID = pkt.GetShort();
int takenAmount = pkt.GetThree();
byte characterWeight = pkt.GetChar();
byte characterMaxWeight = pkt.GetChar();
ChestData data = new ChestData(pkt, false);
OnChestGetItem(takenID, takenAmount, characterWeight, characterMaxWeight, data);
}
示例11: _handleItemKick
private void _handleItemKick(Packet pkt)
{
if (OnItemChange == null) return;
short id = pkt.GetShort();
int amount = pkt.GetThree();
byte weight = pkt.GetChar();
OnItemChange(false, id, amount, weight);
}
示例12: _handleNPCReply
/// <summary>
/// Handler for NPC_REPLY packet, when NPC takes damage from an attack (spell cast or weapon) but is still alive
/// </summary>
private void _handleNPCReply(Packet pkt)
{
if (OnNPCTakeDamage == null) return;
short spellID = -1;
if (pkt.Family == PacketFamily.Cast)
spellID = pkt.GetShort();
short fromPlayerID = pkt.GetShort();
EODirection fromDirection = (EODirection)pkt.GetChar();
short npcIndex = pkt.GetShort();
int damageToNPC = pkt.GetThree();
int npcPctHealth = pkt.GetShort();
short fromTP = -1;
if (pkt.Family == PacketFamily.Cast)
fromTP = pkt.GetShort();
else if (pkt.GetChar() != 1) //some constant 1 in EOSERV
return;
OnNPCTakeDamage((byte)npcIndex, fromPlayerID, fromDirection, damageToNPC, npcPctHealth, spellID, fromTP);
}
示例13: _handleItemJunk
private void _handleItemJunk(Packet pkt)
{
short id = pkt.GetShort();
int amountRemoved = pkt.GetThree();//don't really care - just math it
int amountRemaining = pkt.GetInt();
byte weight = pkt.GetChar();
byte maxWeight = pkt.GetChar();
if (OnJunkItem != null)
OnJunkItem(id, amountRemoved, amountRemaining, weight, maxWeight);
}
示例14: _handleItemDrop
private void _handleItemDrop(Packet pkt)
{
if (OnDropItem == null) return;
short _id = pkt.GetShort();
int _amount = pkt.GetThree();
int characterAmount = pkt.GetInt(); //amount remaining for the character
MapItem item = new MapItem
{
id = _id,
amount = _amount,
uid = pkt.GetShort(),
x = pkt.GetChar(),
y = pkt.GetChar(),
//turn off drop protection since main player dropped it
time = DateTime.Now.AddSeconds(-5),
npcDrop = false,
playerID = 0 //id of 0 means the currently logged in player owns it
};
byte characterWeight = pkt.GetChar(), characterMaxWeight = pkt.GetChar(); //character adjusted weights
OnDropItem(characterAmount, characterWeight, characterMaxWeight, item);
}
示例15: _handleWarpAgree
private void _handleWarpAgree(Packet pkt)
{
if (pkt.GetChar() != 2 || OnWarpAgree == null) return;
short mapID = pkt.GetShort();
WarpAnimation anim = (WarpAnimation)pkt.GetChar();
int numOtherCharacters = pkt.GetChar();
if (pkt.GetByte() != 255) return;
List<CharacterData> otherCharacters = new List<CharacterData>(numOtherCharacters - 1);
for (int i = 0; i < numOtherCharacters; ++i)
{
CharacterData newChar = new CharacterData(pkt);
otherCharacters.Add(newChar);
if (pkt.GetByte() != 255) return;
}
List<NPCData> otherNPCs = new List<NPCData>();
while (pkt.PeekByte() != 255)
{
otherNPCs.Add(new NPCData(pkt));
}
if (pkt.GetByte() != 255) return;
List<MapItem> otherItems = new List<MapItem>();
while (pkt.ReadPos < pkt.Length)
{
otherItems.Add(new MapItem
{
uid = pkt.GetShort(),
id = pkt.GetShort(),
x = pkt.GetChar(),
y = pkt.GetChar(),
amount = pkt.GetThree(),
//turn off drop protection for items coming into view - server will validate
time = DateTime.Now.AddSeconds(-5),
npcDrop = false,
playerID = -1
});
}
OnWarpAgree(mapID, anim, otherCharacters, otherNPCs, otherItems);
}