本文整理汇总了C#中Estrella.FiestaLib.Networking.Packet.Fill方法的典型用法代码示例。如果您正苦于以下问题:C# Packet.Fill方法的具体用法?C# Packet.Fill怎么用?C# Packet.Fill使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Estrella.FiestaLib.Networking.Packet
的用法示例。
在下文中一共展示了Packet.Fill方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: ChangeFromGuildAcademyToResponse
public static void ChangeFromGuildAcademyToResponse(WorldClient client, Packet packet)
{
string GuildName;
string RequestName;
bool answer;
if (!packet.TryReadString(out GuildName, 16) || !packet.TryReadString(out RequestName, 16)|| (!packet.TryReadBool(out answer) || !client.Character.IsInGuildAcademy))
return;
if (answer)
{
GuildAcademyMember pMember = client.Character.GuildAcademy.Members.Find(m => m.Character.Character.Name == RequestName);
if (pMember == null)
return;
pMember.Character.IsInGuildAcademy = false;
pMember.Academy.RemoveMember(pMember);
pMember.Character.GuildAcademy.Guild.AddMember(pMember.Character, GuildRank.Member, Program.DatabaseManager.GetClient().GetConnection(), true, true);
pMember.Character.Guild = pMember.Character.GuildAcademy.Guild;
pMember.Character.IsInGuild = true;
using (var pack = new Packet(SH38Type.SendJoinGuildFromAcademy))
{
//this packet remove character from academy List and added to GuildList
pack.WriteString(RequestName, 16);
pack.WriteString(client.Character.Character.Name, 16);
pack.WriteByte(6);//rank
pack.WriteInt(0);//unk
pack.WriteUShort(0);//korp
pack.Fill(64, 0x00);//unk
pack.WriteByte(true ? (byte)0x95 : (byte)0x00);// (this.isOnline ? (byte)0x95 : (byte)0x00);
pack.Fill(3, 0x00);//unk
pack.WriteByte(pMember.Character.Character.Job);
pack.WriteByte(pMember.Character.Character.CharLevel);
pack.Fill(13, 0x00);//unk
client.Character.GuildAcademy.Guild.Broadcast(pack);
client.Character.GuildAcademy.Broadcast(pack);
}
}
using (var p2 = new Packet(SH4Type.CharacterGuildinfo))
{
client.Character.Guild.WriteGuildInfo(packet);
client.SendPacket(p2);
}
using (var pack = new Packet(SH29Type.GuildMemberJoined))
{
pack.WriteString(client.Character.Character.Name, 16);
client.Character.GuildAcademy.Guild.Broadcast(pack);
client.Character.GuildAcademy.Broadcast(pack);
}
using (var pack = new Packet(SH29Type.ChangeResponse))
{
pack.WriteUShort(3137);//unk
pack.WriteByte(3);
pack.Fill(2, 0x00);//unk
client.SendPacket(pack);
}
}
示例2: WritePacket
public void WritePacket(Packet pPacket)
{
pPacket.WriteUShort(ItemID);
if (this.Type != HouseType.Resting)
{
pPacket.Fill(10, 0xFF); // Unknown
pPacket.WriteString(this.Name, 30);
}
else
{
pPacket.WriteHexAsBytes("BE 02 FA 01 F8 01");
pPacket.Fill(34, 0xFF); // No idea!?
}
pPacket.WriteByte(0xFF);
pPacket.WriteByte(0);//unk
}
示例3: BeginDisplayRest
public static Packet BeginDisplayRest(ZoneCharacter character)
{
Packet packet = new Packet(SH8Type.BeginDisplayRest);
packet.WriteUShort(character.MapObjectID);
packet.WriteUShort(character.House.ItemID);
packet.Fill(10, 0xff);
return packet;
}
示例4: BackToWorldSelect
public static void BackToWorldSelect(WorldClient client, Packet packet)
{
using (Packet pack = new Packet(SH3Type.BackToWorldListFromChar))
{
pack.WriteHexAsBytes("58 1E");//responsecode
pack.Fill(32, 0);
client.SendPacket(pack);
}
}
示例5: Equip
public static Packet Equip(ZoneCharacter character, Item equip)
{
//B2 00 - AB 38 - 07 - 0D 00 04
Packet packet = new Packet(SH7Type.ShowEquip);
packet.WriteUShort(character.MapObjectID);
packet.WriteUShort(equip.ID);
packet.WriteByte(equip.UpgradeStats.Upgrades);
packet.Fill(3, 0xff);
return packet;
}
示例6: WriteEquipment
public static void WriteEquipment(WorldCharacter wchar, Packet packet)
{
packet.WriteUShort(wchar.GetEquipBySlot(ItemSlot.Helm));
packet.WriteUShort(Settings.Instance.ShowEquips ? wchar.GetEquipBySlot(ItemSlot.Weapon) : (ushort)0xffff);
packet.WriteUShort(wchar.GetEquipBySlot(ItemSlot.Armor));
packet.WriteUShort(Settings.Instance.ShowEquips ? wchar.GetEquipBySlot(ItemSlot.Weapon2) : (ushort)0xffff);
packet.WriteUShort(wchar.GetEquipBySlot(ItemSlot.Pants));
packet.WriteUShort(wchar.GetEquipBySlot(ItemSlot.Boots));
packet.WriteUShort(wchar.GetEquipBySlot(ItemSlot.CostumeBoots));
packet.WriteUShort(wchar.GetEquipBySlot(ItemSlot.CostumePants));
packet.WriteUShort(wchar.GetEquipBySlot(ItemSlot.CostumeArmor));
packet.Fill(6, 0xff); // UNK
packet.WriteUShort(wchar.GetEquipBySlot(ItemSlot.Glasses));
packet.WriteUShort(wchar.GetEquipBySlot(ItemSlot.CostumeHelm));
packet.Fill(2, 0xff); // UNK
packet.WriteUShort(wchar.GetEquipBySlot(ItemSlot.CostumeWeapon));
packet.WriteUShort(wchar.GetEquipBySlot(ItemSlot.Wing));
packet.Fill(2, 0xff); // UNK
packet.WriteUShort(wchar.GetEquipBySlot(ItemSlot.Tail));
packet.WriteUShort(wchar.GetEquipBySlot(ItemSlot.Pet));
}
示例7: WriteBasicCharInfo
public static void WriteBasicCharInfo(WorldCharacter wchar, Packet packet)
{
packet.WriteInt(wchar.Character.ID); //charid
packet.FillPadding(wchar.Character.Name, 0x10);
packet.WriteInt(0);//unk
packet.WriteShort((short)wchar.Character.CharLevel); //level
packet.WriteByte(wchar.Character.Slot);
MapInfo mapinfo;
if (!DataProvider.Instance.Maps.TryGetValue(wchar.Character.PositionInfo.Map, out mapinfo))
{
Log.WriteLine(LogLevel.Warn, "{0} has an invalid MapID ({1})", wchar.Character.Name, wchar.Character.PositionInfo.Map);
wchar.Character.PositionInfo.Map = 0;
packet.FillPadding(mapinfo.ShortName, 0x0D); //townname
}
else
{
packet.FillPadding(mapinfo.ShortName, 0x0D); //townname
}
//packet.WriteByte(0); // UNK
packet.WriteInt(0); // Random seed
WriteLook(wchar,packet);
WriteEquipment(wchar,packet);
WriteRefinement(wchar,packet);
packet.WriteByte(0);
packet.WriteByte(0xF0);
packet.WriteByte(0xFF);//unk
packet.WriteByte(0xFF);
packet.FillPadding(mapinfo.ShortName, 0x0c);
packet.WriteInt(0); //pos
packet.WriteInt(0); //pos
packet.WriteUShort(0xdb78);
packet.WriteUShort(4910);//unk
packet.WriteUShort(25600);
packet.Fill(4, 0);
}
示例8: WriteDetailedInfo
public void WriteDetailedInfo(Packet pPacket)
{
pPacket.WriteInt(ID);
pPacket.WriteString(this.Name, 16);
pPacket.WriteByte(this.Slot);
pPacket.WriteByte(this.Level);
pPacket.WriteLong(this.Exp);
pPacket.WriteInt(12345678); // UNK
pPacket.WriteShort(this.StonesHP);
pPacket.WriteShort(this.StonesSP);
pPacket.WriteUInt(this.HP);
pPacket.WriteUInt(this.SP);
pPacket.WriteInt(this.Fame);
pPacket.WriteLong(this.Inventory.Money);
pPacket.WriteString(this.Map.MapInfo.ShortName, 12);
pPacket.WriteInt(this.Position.X);
pPacket.WriteInt(this.Position.Y);
pPacket.WriteByte(this.Rotation);
pPacket.WriteByte(this.Str);// -.
pPacket.WriteByte(this.End);// |
pPacket.WriteByte(this.Dex);// | Boni
pPacket.WriteByte(this.Int);// |
pPacket.WriteByte(this.Spr);// -'
pPacket.WriteShort(0); // UNK
pPacket.WriteUInt(0); // Killpoints (TODO)
pPacket.Fill(7, 0); // UNK
}
示例9: WriteCharacterDisplay
public void WriteCharacterDisplay(Packet packet)
{
packet.WriteUShort(MapObjectID);
packet.WriteString(Name, 16);
packet.WriteInt(Position.X);
packet.WriteInt(Position.Y);
packet.WriteByte(Rotation); // Rotation
packet.WriteByte((byte)State); // Player State (1,2 - Player, 3 - Dead, 4 - Resting, 5 - Vendor, 6 - On Mount)
packet.WriteByte((byte)Job);
if (State != PlayerState.Resting && State != PlayerState.Vendor && this.House == null)
{
WriteLook(packet);
WriteEquipment(packet);
}
else
{
this.House.WritePacket(packet);
}
WriteRefinement(packet);
//(IsMale ? 1 : 0)
int mount = (this.Mount != null) ? (int) this.Mount.Handle : (int)0xffff;
packet.WriteUShort((ushort)mount); // Mount Handle
packet.WriteUShort(0xffff);
packet.WriteByte(0xff); // Emote (0xff = nothing)
packet.WriteUShort(0xffff);
packet.WriteShort(0);
packet.WriteUShort(0); // Mob ID (title = 10)
packet.Fill(55, 0); // Buff Bits? Something like that
if (this.Character.GuildID > 1)
{
packet.WriteInt(this.Guild.ID);
}
else if (this.Character.AcademyID > 0)
{
packet.WriteInt(this.Character.AcademyID);
}
else
{
packet.WriteInt(0);
}
packet.WriteByte(0x02); // UNK (0x02)
packet.WriteBool(this.IsInaAcademy); // In Guild Academy (0 - No, 1 - Yes)
packet.WriteBool(true); // Pet AutoPickup (0 - Off, 1 - On)
packet.WriteByte(this.Level);
}
示例10: Write
public void Write(Packet packet)
{
packet.WriteUShort(this.MapObjectID);
packet.WriteByte(2);
packet.WriteUShort(ID);
packet.WriteInt(this.Position.X);
packet.WriteInt(this.Position.Y);
packet.WriteByte(this.Rotation);
packet.Fill(55, 0);
}
示例11: WriteInfo
public void WriteInfo(Packet Packet)
{
Packet.WriteInt(Guild.ID);
Packet.WriteByte(1);//unk
Packet.WriteString(Guild.Master.Character.Character.Name, 16);
Packet.WriteUShort((ushort)Members.Count);//membercount
Packet.WriteUShort(MaxMembers);//maxmembercount
Packet.WriteInt(Guild.ID);//academyid
Packet.WriteInt((int)Guild.CreateTime.DayOfWeek);//weeks //Todo Calculate Weeks
Packet.WriteInt((int)GuildBuffKeepTime.TotalSeconds); //time in sek (buff?)
Packet.Fill(128, 1);//GuildAcademyBUff
Packet.WriteString(Message, 512);
}
示例12: On_CharacterManager_CharacterLogin
private static void On_CharacterManager_CharacterLogin(WorldCharacter Character)
{
if (Character.IsInGuild)
{
var guild = Character.Guild;
//send guild info to client
using (var packet = new Packet(SH4Type.CharacterGuildinfo))
{
guild.WriteGuildInfo(packet);
Character.Client.SendPacket(packet);
}
//send member list to client
guild.SendMemberList(Character.Client);
GuildMember member;
if (guild.GetMember(Character.Character.Name, out member))
{
//send guild member logged in to other guild members
using (var packet = new Packet(SH29Type.GuildMemberLoggedIn))
{
packet.WriteString(Character.Character.Name, 16);
Character.Guild.Broadcast(packet, member);
}
}
//send packet to zone that guild member logged in
using (var packet = new InterPacket(InterHeader.ZONE_GuildMemberLogin))
{
packet.WriteInt(guild.ID);
packet.WriteInt(Character.ID);
ZoneManager.Instance.Broadcast(packet);
}
}
else
{
using (var packet = new Packet(SH4Type.CharacterGuildinfo))
{
packet.WriteInt(0);
Character.Client.SendPacket(packet);
}
}
//academy
var academy = Character.GuildAcademy;
if (academy != null)
{
if (Character.IsInGuildAcademy)
{
using (var packet = new Packet(SH4Type.CharacterGuildacademyinfo))
{
academy.WriteInfo(packet);
Character.Client.SendPacket(packet);
}
academy.SendMemberList(Character.Client);
}
else
{
using (var packet = new Packet(SH4Type.CharacterGuildacademyinfo))
{
packet.Fill(5, 0);
Character.Client.SendPacket(packet);
}
}
}
else
{
using (var packet = new Packet(SH4Type.CharacterGuildacademyinfo))
{
packet.Fill(5, 0);
Character.Client.SendPacket(packet);
}
}
}
示例13: On_GameClient_GetGuildList
public static void On_GameClient_GetGuildList(WorldClient Client, Packet Packet)
{
if (Client.Character == null)
{
return;
}
var now = Program.CurrentTime;
if (now.Subtract(Client.Character.LastGuildListRefresh).TotalSeconds >= 60)
{
Client.Character.LastGuildListRefresh = now;
const int GuildsPerPacket = 100;
lock (ThreadLocker)
{
using (var con = Program.DatabaseManager.GetClient().GetConnection())
{
//get guild count
int guildCount;
using (var cmd = con.CreateCommand())
{
cmd.CommandText = "SELECT COUNT(*) FROM Guilds";
guildCount = Convert.ToInt32(cmd.ExecuteScalar());
}
using (var cmd = con.CreateCommand())
{
cmd.CommandText = "SELECT ID FROM Guilds";
Packet listPacket = null;
var count = 0;
var globalCount = 0;
using (var reader = cmd.ExecuteReader())
{
while (reader.Read())
{
if (listPacket == null)
{
listPacket = new Packet(SH29Type.SendGuildList);
listPacket.WriteUShort(3137);
listPacket.WriteByte(1);
listPacket.WriteUShort((ushort)guildCount);
listPacket.WriteUShort((ushort)Math.Min(GuildsPerPacket, guildCount - globalCount));
}
Guild guild;
if (GuildManager.GetGuildByID(reader.GetInt32(0), out guild))
{
//write packet
listPacket.WriteInt(guild.ID);
listPacket.WriteString(guild.Name, 16);
listPacket.WriteString(guild.Master.Character.Character.Name, 16);
listPacket.WriteBool(guild.AllowGuildWar);
listPacket.WriteByte(1); // unk
listPacket.WriteUShort((ushort)guild.Members.Count);
listPacket.WriteUShort(100); // unk
}
else
{
Packet.Fill(42, 0); // guild get error
}
globalCount++;
count++;
if (count >= Math.Min(GuildsPerPacket, guildCount - globalCount))
{
//send packet
Client.SendPacket(listPacket);
listPacket.Dispose();
listPacket = null;
//reset
count = 0;
}
}
}
}
}
}
}
}
示例14: On_GameClient_GetAcademyList
public static void On_GameClient_GetAcademyList(WorldClient Client, Packet pPacket)
{
if (Client.Character == null)
{
return;
}
const int GuildsPerPacket = 54;
lock (GuildManager.ThreadLocker)
{
using (var con = Program.DatabaseManager.GetClient().GetConnection())
{
//get guild count
int guildCount;
using (var cmd = con.CreateCommand())
{
cmd.CommandText = "SELECT COUNT(*) FROM Guilds";
guildCount = Convert.ToInt32(cmd.ExecuteScalar());
}
using (var cmd = con.CreateCommand())
{
cmd.CommandText = "SELECT ID FROM Guilds";
Packet listPacket = null;
var count = 0;
var globalCount = 0;
using (var reader = cmd.ExecuteReader())
{
while (reader.Read())
{
if (listPacket == null)
{
listPacket = new Packet(SH38Type.SendAcademyList);
listPacket.WriteUShort(6312);
listPacket.WriteByte(1);
listPacket.WriteUShort((ushort)guildCount);
listPacket.WriteUShort(0);
listPacket.WriteUShort((ushort)Math.Min(GuildsPerPacket, guildCount - globalCount));
listPacket.WriteUShort(0);
}
Guild guild;
if (GuildManager.GetGuildByID(reader.GetInt32("ID"), out guild))
{
//write packet
listPacket.WriteString(guild.Name, 16);
listPacket.WriteString(guild.Master.Character.Character.Name, 16);
listPacket.WriteUShort((ushort)guild.Members.Count);
listPacket.WriteUShort((ushort)guild.Academy.Members.Count);
listPacket.WriteUShort(guild.Academy.Points); // Graduates
}
else
{
pPacket.Fill(38, 0); // guild get error
}
globalCount++;
count++;
if (count >= Math.Min(GuildsPerPacket, guildCount - globalCount))
{
//send packet
Client.SendPacket(listPacket);
listPacket.Dispose();
listPacket = null;
//reset
count = 0;
}
}
}
}
}
}
}
示例15: InventoryMessage
public static Packet InventoryMessage(ushort pMessage, ushort pID = ushort.MaxValue, ushort pCount = (ushort) 1)
{
/* 0x0341 Item Obtained
0x0342 Failed to obtain
0x0346 Inventory Full */
Packet pack = new Packet();
pack.WriteUShort(0x300a);
pack.WriteUShort(pID);
pack.WriteInt(pCount);
pack.WriteUShort(pMessage);
pack.Fill(2, 0xff);
return pack;
}