本文整理汇总了C#中Packet.GetShort方法的典型用法代码示例。如果您正苦于以下问题:C# Packet.GetShort方法的具体用法?C# Packet.GetShort怎么用?C# Packet.GetShort使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Packet
的用法示例。
在下文中一共展示了Packet.GetShort方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: LevelUpStats
internal LevelUpStats(Packet pkt, bool includeExp)
{
//includeExp will be false when leveling up from NPC, true from EXPReward
//NPC handler happens slightly differently
exp = includeExp ? pkt.GetInt() : 0;
level = pkt.GetChar();
stat = pkt.GetShort();
skill = pkt.GetShort();
maxhp = pkt.GetShort();
maxtp = pkt.GetShort();
maxsp = pkt.GetShort();
}
示例2: 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;
}
}
示例3: _handleAdminShow
private void _handleAdminShow(Packet pkt)
{
if (OnAdminHiddenChange == null) return;
short id = pkt.GetShort();
OnAdminHiddenChange(id, false);
}
示例4: _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);
}
示例5: _handleFacePlayer
private void _handleFacePlayer(Packet pkt)
{
short playerId = pkt.GetShort();
EODirection dir = (EODirection)pkt.GetChar();
if (OnPlayerFace != null)
OnPlayerFace(playerId, dir);
}
示例6: SkillmasterData
internal SkillmasterData(Packet pkt)
{
m_id = pkt.GetShort();
m_title = pkt.GetBreakString();
m_skills = new List<Skill>();
while(pkt.ReadPos < pkt.Length)
m_skills.Add(new Skill(pkt));
}
示例7: _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);
}
示例8: _handleEmotePlayer
private void _handleEmotePlayer(Packet pkt)
{
short playerID = pkt.GetShort();
Emote emote = (Emote)pkt.GetChar();
if(OnOtherPlayerEmote != null)
OnOtherPlayerEmote(playerID, emote);
}
示例9: 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();
}
示例10: _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());
}
示例11: _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);
}
示例12: _handleConnectionPlayer
private void _handleConnectionPlayer(Packet pkt)
{
short seq_1 = pkt.GetShort();
byte seq_2 = pkt.GetChar();
m_client.UpdateSequence(seq_1 - seq_2);
Packet reply = new Packet(PacketFamily.Connection, PacketAction.Ping);
m_client.SendPacket(reply);
}
示例13: _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);
}
示例14: 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()));
}
}
示例15: _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();
}
}