本文整理汇总了C#中Packet.GetChar方法的典型用法代码示例。如果您正苦于以下问题:C# Packet.GetChar方法的具体用法?C# Packet.GetChar怎么用?C# Packet.GetChar使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Packet
的用法示例。
在下文中一共展示了Packet.GetChar方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: NPCData
internal NPCData(Packet pkt)
{
m_index = pkt.GetChar();
m_id = pkt.GetShort();
m_x = pkt.GetChar();
m_y = pkt.GetChar();
m_dir = (EODirection)pkt.GetChar();
}
示例2: _handleOtherPlayerWalk
private void _handleOtherPlayerWalk(Packet pkt)
{
if (OnOtherPlayerWalk == null) return;
short playerID = pkt.GetShort();
EODirection dir = (EODirection) pkt.GetChar();
byte x = pkt.GetChar();
byte y = pkt.GetChar();
OnOtherPlayerWalk(playerID, dir, x, y);
}
示例3: 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()));
}
}
示例4: ItemUseData
internal ItemUseData(Packet pkt)
{
type = (ItemType)pkt.GetChar();
itemID = pkt.GetShort();
characterAmount = pkt.GetInt();
weight = pkt.GetChar();
maxWeight = pkt.GetChar();
hpGain = hp = tp = 0;
hairColor = 0;
effect = 0;
curecurse_stats = null;
expreward_stats = null;
//format differs based on item type
//(keeping this in order with how eoserv ITEM_USE handler is ordered
switch (type)
{
case ItemType.Teleport: /*Warp packet handles the rest!*/ break;
case ItemType.Heal:
{
hpGain = pkt.GetInt();
hp = pkt.GetShort();
tp = pkt.GetShort();
}
break;
case ItemType.HairDye:
{
hairColor = pkt.GetChar();
}
break;
case ItemType.Beer: /*No additional data*/ break;
case ItemType.EffectPotion:
{
effect = pkt.GetShort();
}
break;
case ItemType.CureCurse:
{
curecurse_stats = new CureCurseStats(pkt);
}
break;
case ItemType.EXPReward:
{
//note: server packets may be incorrect at this point (src/handlers/Item.cpp) because of unused builder in eoserv
//note: server also sends an ITEM_ACCEPT packet to surrounding players on level-up?
expreward_stats = new LevelUpStats(pkt, true);
}
break;
}
}
示例5: 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);
}
示例6: 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();
}
示例7: _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);
}
示例8: _handleAttackPlayer
/// <summary>
/// Sent when another player attacks (not main player)
/// </summary>
private void _handleAttackPlayer(Packet pkt)
{
if (OnOtherPlayerAttack == null) return;
short playerId = pkt.GetShort();
EODirection dir = (EODirection)pkt.GetChar();
OnOtherPlayerAttack(playerId, dir);
}
示例9: _handleEffectSpec
//sent to the player taking spike damage and map TP drains
private void _handleEffectSpec(Packet pkt)
{
//1 in eoserv Map::TimedDrains - tp
//2 in eoserv Character::SpikeDamage
EffectDamageType damageType = (EffectDamageType) pkt.GetChar();
switch (damageType)
{
case EffectDamageType.TimedDrainTP:
{
short amount = pkt.GetShort();
short tp = pkt.GetShort();
short maxtp = pkt.GetShort();
if (OnTimedMapDrainTP != null)
OnTimedMapDrainTP(amount, tp, maxtp);
}
break;
case EffectDamageType.SpikeDamage:
{
short damage = pkt.GetShort();
short hp = pkt.GetShort();
short maxhp = pkt.GetShort();
if (OnPlayerTakeSpikeDamage != null)
OnPlayerTakeSpikeDamage(damage, hp, maxhp);
}
break;
default:
throw new ArgumentOutOfRangeException();
}
}
示例10: HandleReport
public static void HandleReport(Packet packet, IClient client, bool fromQueue)
{
Emote emote = (Emote)packet.GetChar();
if ((emote >= (Emote)0 && emote <= Emote.Embarassed) || emote == Emote.Trade || emote == Emote.Playful)
{
client.Character.Emote(emote, false);
}
}
示例11: _handleFacePlayer
private void _handleFacePlayer(Packet pkt)
{
short playerId = pkt.GetShort();
EODirection dir = (EODirection)pkt.GetChar();
if (OnPlayerFace != null)
OnPlayerFace(playerId, dir);
}
示例12: _handleEmotePlayer
private void _handleEmotePlayer(Packet pkt)
{
short playerID = pkt.GetShort();
Emote emote = (Emote)pkt.GetChar();
if(OnOtherPlayerEmote != null)
OnOtherPlayerEmote(playerID, emote);
}
示例13: _handleDoorOpen
//also a DOOR_OPEN packet
private void _handleDoorOpen(Packet pkt)
{
if (OnDoorOpen == null) return;
//returns: x, y (char, short) of door location -
// but the short (y) is expanded from a byte server-side so no loss of data
OnDoorOpen(pkt.GetChar(), (byte)pkt.GetShort());
}
示例14: _handleAvatarRemove
// Remove a player from view (sent by server when someone is out of range)
private void _handleAvatarRemove(Packet pkt)
{
if (OnPlayerAvatarRemove == null) return;
short id = pkt.GetShort();
WarpAnimation anim = (WarpAnimation)(pkt.Length > pkt.ReadPos ? pkt.GetChar() : 0);
OnPlayerAvatarRemove(id, anim);
}
示例15: _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);
}