本文整理汇总了C#中Packet.Skip方法的典型用法代码示例。如果您正苦于以下问题:C# Packet.Skip方法的具体用法?C# Packet.Skip怎么用?C# Packet.Skip使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Packet
的用法示例。
在下文中一共展示了Packet.Skip方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: _handleBankOpen
private void _handleBankOpen(Packet pkt)
{
int bankGold = pkt.GetInt();
pkt.Skip(3); /*Session token - eoserv always sets 0*/
int lockerUpgrades = pkt.GetChar(); //number of locker upgrades that have been done
if (OnBankOpen != null)
OnBankOpen(bankGold, lockerUpgrades);
}
示例2: HandlePlayerDamage
public static void HandlePlayerDamage(Client pClient, Packet pPacket)
{
pPacket.Skip(4);
pPacket.ReadInt(); // Tick.
sbyte Type = pPacket.ReadSByte();
pPacket.Skip(1);
int Damage = pPacket.ReadInt();
pPacket.Skip(2);
int MobId = 0;
if (Type != -2 && Type != -3 && Type != -4)
MobId = pPacket.ReadInt();
pClient.Character.ModifyHP((short)-Damage);
}
示例3: HandleMigration
public static void HandleMigration(Client pClient, Packet pPacket)
{
int CharacterId = pPacket.ReadInt();
pPacket.Skip(18);
long SessionId = pPacket.ReadLong();
if (Master.Instance.Worlds[pClient.World].EligableMigration(CharacterId, SessionId, false))
{
pClient.SessionId = SessionId;
pClient.Character = Master.Instance.Accessor.GetCharacter(CharacterId);
pClient.Account = Master.Instance.Accessor.GetAccount(pClient.Character.AccountId);
if (pClient.Character.Id != CharacterId)
{
pClient.Session.Disconnect();
return;
}
pClient.Character.Client = pClient;
if (pClient.Account.LoggedIn == 2)
{
pClient.Session.Disconnect();
return;
}
pClient.Account.LoggedIn = 2;
if (Master.Instance.Worlds[pClient.World].CashShopMigration(pClient.Character.Id))
{
CashShopHandler.HandleEnter(pClient, pPacket);
}
else
{
pClient.SendPacket(MapPacket.EnterFieldNew(pClient.Character));
Master.Instance.Worlds[pClient.World].Channels[pClient.Channel].Maps[pClient.Character.MapId].AddPlayer(pClient.Character);
}
}
else
{
Console.WriteLine("[{0}] Migration failed.", pClient.Session.IP);
}
}
示例4: _handlePlayersAgree
// Handles PLAYERS_AGREE packet which is sent when a player enters a map by warp or upon spawning
private void _handlePlayersAgree(Packet pkt)
{
if (pkt.GetByte() != 255 || OnPlayerEnterMap == null)
return;
CharacterData newGuy = new CharacterData(pkt);
byte nextByte = pkt.GetByte();
WarpAnimation anim = WarpAnimation.None;
if (nextByte != 255) //next byte was the warp animation: sent on Map::Enter in eoserv
{
pkt.Skip(-1);
anim = (WarpAnimation)pkt.GetChar();
if (pkt.GetByte() != 255) //the 255 still needs to be read...
return;
}
//else... //next byte was a 255. proceed normally.
if (pkt.GetChar() == 1) //0 for NPC, 1 for player. In eoserv it is never 0.
OnPlayerEnterMap(newGuy, anim);
}
示例5: CharacterData
internal CharacterData(Packet pkt)
{
m_name = pkt.GetBreakString();
if (m_name.Length > 1)
m_name = char.ToUpper(m_name[0]) + m_name.Substring(1);
m_id = pkt.GetShort();
m_map = pkt.GetShort();
m_x = pkt.GetShort();
m_y = pkt.GetShort();
m_facing = (EODirection)pkt.GetChar();
pkt.GetChar(); //value is always 6? unknown
m_guildTag = pkt.GetFixedString(3);
m_level = pkt.GetChar();
m_gender = pkt.GetChar();
m_hairstyle = pkt.GetChar();
m_haircolor = pkt.GetChar();
m_race = pkt.GetChar();
m_maxhp = pkt.GetShort();
m_hp = pkt.GetShort();
m_maxtp = pkt.GetShort();
m_tp = pkt.GetShort();
m_boots = pkt.GetShort();
pkt.Skip(3 * sizeof(short)); //other paperdoll data is 0'd out
m_armor = pkt.GetShort();
pkt.Skip(sizeof(short));
m_hat = pkt.GetShort();
m_shield = pkt.GetShort();
m_weapon = pkt.GetShort();
m_sit = (SitState)pkt.GetChar();
m_hidden = pkt.GetChar() != 0;
}
示例6: _handlePaperdollRemove
//this is only ever sent to MainPlayer (avatar handles other players)
private void _handlePaperdollRemove(Packet pkt)
{
if (OnPlayerPaperdollChange == null) return;
//the $strip command does this wrong (adding 0's in), somehow the original client is smart enough to figure it out
//normally would put this block in the _handleAvatarAgree
short playerID = pkt.GetShort();
AvatarSlot slot = (AvatarSlot) pkt.GetChar();
bool sound = pkt.GetChar() == 0; //sound : 0
short boots = pkt.GetShort();
if (pkt.Length != 45) pkt.Skip(sizeof(short) * 3); //three 0s
short armor = pkt.GetShort();
if (pkt.Length != 45) pkt.Skip(sizeof(short)); // one 0
short hat = pkt.GetShort();
short shield, weapon;
if (pkt.Length != 45)
{
shield = pkt.GetShort();
weapon = pkt.GetShort();
}
else
{
weapon = pkt.GetShort();
shield = pkt.GetShort();
}
AvatarData renderData = new AvatarData(playerID, slot, sound, boots, armor, hat, weapon, shield);
if (OnPlayerAvatarChange != null)
OnPlayerAvatarChange(renderData);
PaperdollEquipData data = new PaperdollEquipData(pkt, true);
OnPlayerPaperdollChange(data);
}
示例7: HandleWorldSelect
public static void HandleWorldSelect(Client pClient, Packet pPacket)
{
if (pClient.Account.LoggedIn != 1) return;
pPacket.Skip(1);
pClient.World = pPacket.ReadByte();
pClient.Channel = pPacket.ReadByte();
pClient.Account.WorldId = pClient.World;
pClient.Account.ChannelId = pClient.Channel;
if (Master.Instance.Worlds[pClient.World] == null || Master.Instance.Worlds[pClient.World].Channels[pClient.Channel] == null)
{
pClient.Session.Disconnect();
return;
}
if (pClient.Account.Characters.Count == 0)
{
pClient.Account.LoadCharacters();
foreach (Character Character in pClient.Account.Characters)
{
if (!Character.Loaded)
Character.Load();
}
}
pClient.SendPacket(LoginPacket.WorldSelectResult(pClient));
}
示例8: OnCreateCharacter
public static void OnCreateCharacter(Packet packet, CharacterSession session)
{
var nameLength = packet.GetBits<int>(6);
var useTemplateSet = packet.GetBit();
var raceId = packet.Read<Race>();
var classId = packet.Read<Class>();
var sexId = packet.Read<byte>();
var skinId = packet.Read<byte>();
var faceId = packet.Read<byte>();
var hairStyleId = packet.Read<byte>();
var hairColorId = packet.Read<byte>();
var facialHairStyleId = packet.Read<byte>();
packet.Skip(1);
var name = packet.Read<string>(nameLength).ToLowerEnd();
var createChar = new Packet(ServerMessage.CreateChar);
if (!ClientDB.ChrRaces.Any(c => c.Id == raceId) || !ClientDB.ChrClasses.Any(c => c.Id == classId))
{
createChar.Write(CharCreateCode.Failed);
session.Send(createChar);
return;
}
if (!ClientDB.CharBaseInfo.Any(c => c.RaceId == raceId && c.ClassId == classId))
{
createChar.Write(CharCreateCode.Failed);
session.Send(createChar);
return;
}
if (DB.Character.Any<Character>(c => c.Name == name))
{
createChar.Write(CharCreateCode.NameInUse);
session.Send(createChar);
return;
}
if (useTemplateSet)
{
var templateSetId = packet.Read<int>();
var accTemplate = session.GameAccount.GameAccountCharacterTemplates.Any(t => t.SetId == templateSetId);
var realmTemplate = session.Realm.RealmCharacterTemplates.Any(t => t.SetId == templateSetId);
if (accTemplate || realmTemplate)
{
var template = DB.Character.Single<CharacterTemplateSet>(s => s.Id == templateSetId);
// Implement...
}
else
createChar.Write(CharCreateCode.Failed);
}
else
{
var creationData = DB.Character.Single<CharacterCreationData>(d => d.Race == raceId && d.Class == classId);
var creationData2 = DB.Character.Select<CharacterCreationData>();
if (creationData != null)
{
var newChar = new Character
{
Name = name,
GameAccountId = session.GameAccount.Id,
RealmId = session.Realm.Id,
Race = raceId,
Class = classId,
Sex = sexId,
Skin = skinId,
Face = faceId,
HairStyle = hairStyleId,
HairColor = hairColorId,
FacialHairStyle = facialHairStyleId,
Level = 1,
Map = creationData.Map,
X = creationData.X,
Y = creationData.Y,
Z = creationData.Z,
O = creationData.O,
CharacterFlags = CharacterFlags.Decline,
FirstLogin = true
};
if (DB.Character.Add(newChar))
{
createChar.Write(CharCreateCode.Success);
Manager.Character.LearnStartAbilities(newChar);
}
else
createChar.Write(CharCreateCode.Failed);
}
else
createChar.Write(CharCreateCode.Failed);
//.........这里部分代码省略.........
示例9: AddCreatureInfo
private void AddCreatureInfo(Packet packet)
{
var id = packet.GetLong();
var type = packet.GetByte();
// Public
if (type != 5)
return;
var creature = new Creature();
creature.EntityId = id;
creature.Type = type;
creature.Name = packet.GetString();
packet.GetString();
packet.GetString();
creature.Race = packet.GetInt();
creature.SkinColor = packet.GetByte();
// [180600, NA187 (25.06.2014)] Changed from byte to short
if (packet.NextIs(PacketElementType.Byte))
creature.EyeType = packet.GetByte();
else if (packet.NextIs(PacketElementType.Short))
creature.EyeType = packet.GetShort();
creature.EyeColor = packet.GetByte();
creature.MouthType = packet.GetByte();
creature.State = packet.GetUInt();
creature.StateEx = packet.GetUInt();
// Public only
if (packet.NextIs(PacketElementType.Int))
{
creature.StateEx2 = packet.GetUInt();
// [180300, NA166 (18.09.2013)]
if (packet.NextIs(PacketElementType.Int))
packet.GetUInt();
}
creature.Height = packet.GetFloat();
creature.Weight = packet.GetFloat();
creature.Upper = packet.GetFloat();
creature.Lower = packet.GetFloat();
creature.Region = packet.GetInt();
creature.X = packet.GetInt();
creature.Y = packet.GetInt();
creature.Direction = packet.GetByte();
creature.BattleState = packet.GetInt();
creature.WeaponSet = packet.GetByte();
creature.Color1 = packet.GetUInt();
creature.Color2 = packet.GetUInt();
creature.Color3 = packet.GetUInt();
creature.CombatPower = packet.GetFloat();
creature.StandStyle = packet.GetString();
creature.LifeRaw = packet.GetFloat();
creature.LifeMaxBase = packet.GetFloat();
creature.LifeMaxMod = packet.GetFloat();
creature.LifeInjured = packet.GetFloat();
// [180800, NA196 (14.10.2014)] ?
if (packet.NextIs(PacketElementType.Short))
packet.GetShort(); // ?
var regenCount = packet.GetInt();
for (int i = 0; i < regenCount; ++i)
packet.Skip(6);
var unkCount = packet.GetInt();
for (int i = 0; i < unkCount; ++i)
packet.Skip(6);
creature.Title = packet.GetUShort();
creature.TitleApplied = packet.GetDate();
creature.OptionTitle = packet.GetUShort();
creature.MateName = packet.GetString();
creature.Destiny = packet.GetByte();
var itemCount = packet.GetInt();
for (int i = 0; i < itemCount; ++i)
{
var itemOId = packet.GetLong();
var itemInfo = packet.GetObj<ItemInfo>();
if (packet.NextIs(PacketElementType.String))
packet.GetString(); // Extra Item Info
creature.Items.Add(itemOId, itemInfo);
}
AddEntity(creature);
}
示例10: _handleCharacterPlayer
//handler function for when server sends CHARACTER_PLAYER (in response to CHARACTER_TAKE)
private void _handleCharacterPlayer(Packet pkt)
{
pkt.Skip(2);
m_character_takeID = pkt.GetInt();
m_character_responseEvent.Set();
}
示例11: HandlePlayerMovement
public static void HandlePlayerMovement(Client pClient, Packet pPacket)
{
Character Character = pClient.Character;
pPacket.Skip(14);
pPacket.ReadInt();
pPacket.ReadInt();
Pos StartPos = Character.Position;
if (Character == null)
return;
List<LifeMovementFragment> Res = new List<LifeMovementFragment>();
try
{
Res = MovementParse.ParseMovement(pPacket, 1);
}
catch
{
Console.WriteLine("AIOBE Type: 1\r\n" + pPacket.ToString());
return;
}
//Character.CurrentMap.SendPacket(MapPacket.PlayerMove(Character.Id, Res, StartPos));
MovementParse.UpdatePosition(Res, Character, 0);
Pos Pos = Character.Position;
//Character.CurrentMap.MovePlayer(Character, Pos);
}
示例12: _sharedTradeDataProcess
private void _sharedTradeDataProcess(Packet pkt, TradeUpdateEvent handler)
{
if (handler == null) return;
short player1ID = pkt.GetShort();
List<InventoryItem> player1Items = new List<InventoryItem>();
while (pkt.PeekByte() != 255)
{
player1Items.Add(new InventoryItem { id = pkt.GetShort(), amount = pkt.GetInt() });
}
pkt.Skip(1);
short player2ID = pkt.GetShort();
List<InventoryItem> player2Items = new List<InventoryItem>();
while (pkt.PeekByte() != 255)
{
player2Items.Add(new InventoryItem { id = pkt.GetShort(), amount = pkt.GetInt() });
}
pkt.Skip(1);
handler(player1ID, player1Items, player2ID, player2Items);
}
示例13: _handleTradeRequest
private void _handleTradeRequest(Packet pkt)
{
pkt.Skip(1); //something - will always be 123 from this client
short playerID = pkt.GetShort();
string name = pkt.GetEndString();
if (OnTradeRequested != null)
OnTradeRequested(playerID, name);
}
示例14: ParseMovementData
public static bool ParseMovementData(MovableLife pLife, Packet pPacket)
{
byte amount = pPacket.ReadByte();
byte type, Stance = pLife.Stance;
short Foothold = pLife.Foothold, X = pLife.Position.X, Y = pLife.Position.Y;
short startX = pLife.Position.X;
short startY = pLife.Position.Y;
bool toRet = true;
bool needCheck = true;
for (byte i = 0; i < amount; i++)
{
type = pPacket.ReadByte();
switch (type)
{
case 0x00: //normal move
case 0x05:
{
pLife.Position.X = pPacket.ReadShort();
pLife.Position.Y = pPacket.ReadShort();
pLife.Wobble.X = pPacket.ReadShort();
pLife.Wobble.Y = pPacket.ReadShort();
pLife.Foothold = pPacket.ReadShort();
pLife.Stance = pPacket.ReadByte();
if (Stance < 5)
pLife.Jumps = 0;
if (pLife.GetType() == typeof(Character) && Stance < 14 && Stance != 6 && Stance != 7)
{
float Speed = 100 / 100.0f;
toRet = CheatInspector.CheckSpeed(pLife.Wobble, (Speed));
}
else if (pLife.GetType() == typeof(Mob) && pLife.Wobble.Y != 0)
{
if (Stance == 7 || Stance == 6)
needCheck = false;
toRet = CheatInspector.CheckSpeed(pLife.Wobble, ((Mob)pLife).AllowedSpeed);
}
pPacket.Skip(2);
break;
}
case 0x01: //jump, here we check for jumpingshit
{
if (pLife.Jumps > 5) toRet = false;
X = pPacket.ReadShort();
Y = pPacket.ReadShort();
Stance = pPacket.ReadByte();
Foothold = pPacket.ReadShort();
pLife.Jumps++;
break;
}
case 0x02:
case 0x06:
{
X = pPacket.ReadShort();
Y = pPacket.ReadShort();
Stance = pPacket.ReadByte();
Foothold = pPacket.ReadShort();
break;
}
case 0x03:
case 0x04: //tele
case 0x07: //assaulter
{
X = pPacket.ReadShort();
Y = pPacket.ReadShort();
pLife.Wobble.X = pPacket.ReadShort();
pLife.Wobble.Y = pPacket.ReadShort();
Stance = pPacket.ReadByte();
if (type == 0x03 && pLife.GetType() == typeof(Character) && Stance != 7 && Stance != 6)
{
float Speed = 100 / 100.0f;
toRet = CheatInspector.CheckSpeed(pLife.Wobble, Speed);
}
break;
}
case 0x08:
{
pPacket.Skip(1);
break;
}
default:
{
Stance = pPacket.ReadByte();
//packet.Skip(2);
Foothold = pPacket.ReadShort();
break;
}
}
}
/*
if (!toRet) {
//.........这里部分代码省略.........
示例15: WelcomeRequestData
internal WelcomeRequestData(Packet pkt)
{
PlayerID = pkt.GetShort();
ActiveCharacterID = pkt.GetInt();
MapID = pkt.GetShort();
MapRID = pkt.GetBytes(4);
MapLen = pkt.GetThree();
MapIsPK = MapRID[0] == 0xFF && MapRID[1] == 0x01;
EifRid = Packet.DecodeNumber(pkt.GetBytes(4));
EifLen = (short)Packet.DecodeNumber(pkt.GetBytes(2));
EnfRid = Packet.DecodeNumber(pkt.GetBytes(4));
EnfLen = (short)Packet.DecodeNumber(pkt.GetBytes(2));
EsfRid = Packet.DecodeNumber(pkt.GetBytes(4));
EsfLen = (short)Packet.DecodeNumber(pkt.GetBytes(2));
EcfRid = Packet.DecodeNumber(pkt.GetBytes(4));
EcfLen = (short)Packet.DecodeNumber(pkt.GetBytes(2));
Name = pkt.GetBreakString();
Title = pkt.GetBreakString();
GuildName = pkt.GetBreakString();
GuildRankStr = pkt.GetBreakString();
ClassID = pkt.GetChar();
PaddedGuildTag = pkt.GetFixedString(3); //padded guild tag is 3 characters
AdminLevel = (AdminLevel)pkt.GetChar();
Level = pkt.GetChar();
Exp = pkt.GetInt();
Usage = pkt.GetInt();
HP = pkt.GetShort();
MaxHP = pkt.GetShort();
TP = pkt.GetShort();
MaxTP = pkt.GetShort();
MaxSP = pkt.GetShort();
StatPoints = pkt.GetShort();
SkillPoints = pkt.GetShort();
Karma = pkt.GetShort();
MinDam = pkt.GetShort();
MaxDam = pkt.GetShort();
Accuracy = pkt.GetShort();
Evade = pkt.GetShort();
Armor = pkt.GetShort();
DispStr = pkt.GetShort();
DispInt = pkt.GetShort();
DispWis = pkt.GetShort();
DispAgi = pkt.GetShort();
DispCon = pkt.GetShort();
DispCha = pkt.GetShort();
PaperDoll = new short[(int)EquipLocation.PAPERDOLL_MAX];
for (int i = 0; i < (int)EquipLocation.PAPERDOLL_MAX; ++i)
{
PaperDoll[i] = pkt.GetShort();
}
GuildRankNum = pkt.GetChar();
JailMap = pkt.GetShort();
pkt.Skip(12); //i think these can safely be skipped for the moment
FirstTimePlayer = pkt.GetChar() == 2; //signal that the player should see the "first timer" message
}