本文整理汇总了C#中Zepheus.FiestaLib.Networking.Packet.Fill方法的典型用法代码示例。如果您正苦于以下问题:C# Packet.Fill方法的具体用法?C# Packet.Fill怎么用?C# Packet.Fill使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Zepheus.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);
}
示例3: WriteBasicCharInfo
public static void WriteBasicCharInfo(WorldCharacter wchar, Packet packet)
{
packet.WriteInt(wchar.Character.ID);
packet.WriteString(wchar.Character.Name, 16);
packet.WriteUShort(wchar.Character.CharLevel);
packet.WriteByte(wchar.Character.Slot);
MapInfo mapinfo;
if (!DataProvider.Instance.Maps.TryGetValue(wchar.Character.Map, out mapinfo))
{
Log.WriteLine(LogLevel.Warn, "{0} has an invalid MapID ({1})", wchar.Character.Name, wchar.Character.Map);
wchar.Character.Map = 0;//we reset
packet.WriteString("Rou", 12);
}
else
{
packet.WriteString(mapinfo.ShortName, 12);
}
packet.WriteByte(0); // UNK
packet.WriteInt(0x00000000); // Random seed
WriteLook(wchar, packet);
WriteEquipment(wchar, packet);
WriteRefinement(wchar, packet);
packet.Fill(4, 0xff); // UNK
packet.WriteString("Rou", 12); //TODO: load from mapinfo.shn
packet.WriteInt(0); // X, doesn't matter
packet.WriteInt(0); // Y, neither
packet.WriteInt(0x63dd45ca);
packet.WriteByte(0);
packet.WriteInt(100); // Test later!
packet.WriteByte(0);
wchar.Detach();
}
示例4: 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;
}
示例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: SendInterfaceClock
public static void SendInterfaceClock(WorldClient client)
{
DateTime dt = DateTime.Now;
using (var packet = new Packet(SH2Type.InterfaceClock))
{
packet.WriteInt(DateTime.Now.DayOfYear); //unk
packet.WriteInt(DateTime.Now.Minute);
packet.WriteInt(DateTime.Now.Hour);
packet.WriteInt(DateTime.Now.Day);
packet.WriteInt((DateTime.Now.Month - 1));
packet.WriteInt((DateTime.Now.Year - 1900));
packet.WriteInt((int)DateTime.Now.DayOfWeek);
packet.WriteInt((DateTime.Now.DayOfYear - 1));
packet.Fill(4, 0); //unk
packet.WriteSByte(Convert.ToSByte((DateTime.Now - DateTime.UtcNow).ToString().Split(':')[0])); //Timezone
client.SendPacket(packet);
}
}
示例8: 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);
}
示例9: 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);
}
示例10: 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;
}
}
}
}
}
}
}
}
示例11: On_GameClient_UpdateGuildMessage
public static void On_GameClient_UpdateGuildMessage(WorldClient Client, Packet Packet)
{
ushort length;
string message;
if (Client.Character.Guild == null
|| !Packet.TryReadUShort(out length)
|| !Packet.TryReadString(out message, length))
{
return;
}
//response packets
using (var packet = new Packet(SH29Type.UnkMessageChange))
{
packet.WriteHexAsBytes("68 1B 00 92 AD F8 4F 2E 00 00 00 2B 00 00 00 17 00 00 00 07 00 00 00 06 00 00 00 70 00 00 00 06 00 00 00 BC 00 00 00 01 00 00 00 00 00");
Client.SendPacket(packet);
}
using (var packet = new Packet(SH29Type.ClearGuildDetailsMessage))
{
packet.WriteUShort(3137);
packet.WriteLong(0);
Client.SendPacket(packet);
}
using (var packet = new Packet(SH29Type.UpdateGuildMessageResponse))
{
packet.WriteUShort(3137);
Client.SendPacket(packet);
}
//update guild
lock (Client.Character.Guild.ThreadLocker)
{
Client.Character.Guild.Message = message;
Client.Character.Guild.MessageCreater = Client.Character;
Client.Character.Guild.MessageCreateTime = Program.CurrentTime;
Client.Character.Guild.Save();
//broadcast packet to all guild members
using (var packet = new Packet(SH29Type.SendUpdateGuildDetails))
{
packet.Fill(4, 0x00);
packet.WriteInt(Client.Character.Guild.MessageCreateTime.Second);
packet.WriteInt(Client.Character.Guild.MessageCreateTime.Minute);
packet.WriteInt(Client.Character.Guild.MessageCreateTime.Hour);
packet.WriteInt(Client.Character.Guild.MessageCreateTime.Day);
packet.WriteInt(Client.Character.Guild.MessageCreateTime.Month - 1);
packet.WriteInt(Client.Character.Guild.MessageCreateTime.Year - 1900);
packet.WriteInt(0);
packet.WriteLong(0);
packet.WriteString(Client.Character.Character.Name, 16);
packet.WriteUShort(length);
packet.WriteString(message, length);
Client.Character.Guild.Broadcast(packet);
}
//send packet to zone that guild message changed
using (var packet = new InterPacket(InterHeader.ZONE_GuildMessageUpdate))
{
packet.WriteInt(Client.Character.Guild.ID);
packet.WriteInt(Client.Character.ID);
packet.WriteDateTime(Client.Character.Guild.MessageCreateTime);
packet.WriteUShort(length);
packet.WriteString(message, length);
ZoneManager.Instance.Broadcast(packet);
}
}
}
示例12: WriteInfo
public void WriteInfo(Packet packet)
{
packet.WriteString(Character.Character.Name, 16);
packet.Fill(65, 0x00);//unk
packet.WriteBool(Character.IsIngame);
packet.Fill(3, 0x00);//unk
packet.WriteByte(Character.Character.Job);//job
packet.WriteByte(Character.Character.CharLevel);//level
packet.WriteByte(0);// unk
packet.WriteString(DataProvider.GetMapname(Character.Character.PositionInfo.Map), 12);//mapName
packet.WriteByte((byte)RegisterDate.Month);//month
packet.WriteByte(184);//year fortmat unkown
packet.WriteByte((byte)RegisterDate.Day);//day
packet.WriteByte(0);//unk
packet.WriteByte(0); //unk
}
示例13: Testg
private void Testg(ZoneCharacter character, params string[] param)
{
//05 58 00 04 0A 7A 0F 00 90 2B
using (var pack = new Packet(SH38Type.AcademyMemberJoined))
{
pack.WriteString("invider", 16);
pack.WriteString("Create", 16);
pack.WriteByte(6);//rank
pack.WriteInt(0);//unk
pack.WriteUShort(9000);//korp
pack.Fill(64, 0x00);//unk
pack.WriteByte(95);// (this.isOnline ? (byte)0x95 : (byte)0x00);
pack.Fill(3, 0x00);//unk
pack.WriteByte(21);
pack.WriteByte(255);
pack.Fill(13, 0x00);//unk
character.Client.SendPacket(pack);
}
}
示例14: WriteSmallInfo
//this is used by the smaller writer (e.g. additem, unequip, equip)
public void WriteSmallInfo(Packet packet)
{
packet.WriteUShort(this.ItemID);
switch (SlotType)
{
case ItemSlot.Helm:
case ItemSlot.Armor:
case ItemSlot.Pants:
case ItemSlot.Boots:
case ItemSlot.Weapon2:
case ItemSlot.Weapon:
packet.WriteByte(Upgrades);
packet.Fill(6, 0);
packet.WriteUShort(ushort.MaxValue); //unk
packet.WriteUInt(GetExpiringTime());
packet.WriteUShort(ushort.MaxValue);
break;
default:
packet.WriteUInt(GetExpiringTime());
packet.WriteInt(0); //unk
break;
}
}
示例15: WriteDetailedInfoExtra
public void WriteDetailedInfoExtra(Packet packet, bool levelUP = false)
{
if (!levelUP)
{
packet.WriteUShort(this.MapObjectID);
}
packet.WriteLong(this.Exp);
packet.WriteULong(DataProvider.Instance.GetMaxExpForLevel(this.Level));
packet.WriteInt(BaseStats.Strength);
packet.WriteInt(BaseStats.Strength + GetExtraStr());
packet.WriteInt(BaseStats.Endurance);
packet.WriteInt(BaseStats.Endurance + GetExtraEnd());
packet.WriteInt(BaseStats.Dexterity);
packet.WriteInt(BaseStats.Dexterity + GetExtraDex());
packet.WriteInt(BaseStats.Intelligence);
packet.WriteInt(BaseStats.Intelligence + GetExtraInt());
packet.WriteInt(0); // Wizdom. It isn't set in the server so it can contain shit from old buffers... :D
packet.WriteInt(0); // I once had a name here :P
packet.WriteInt(BaseStats.Spirit);
packet.WriteInt(BaseStats.Spirit + GetExtraSpr());
packet.WriteInt(GetWeaponDamage()); //base damage
packet.WriteInt(GetWeaponDamage(true)); //increased damage (e.g. buffs)
packet.WriteInt(GetMagicDamage()); //magic dmg
packet.WriteInt(GetMagicDamage(true)); //inc magic dmg
packet.WriteInt(GetWeaponDefense()); //todo equip stats loading (weapondef)
packet.WriteInt(GetWeaponDefense(true)); //weapondef inc
packet.WriteInt(GetAim()); //TODO: basestats aim + dex?
packet.WriteInt(GetAim(true)); //aim inc (calcuate later based on dex)
packet.WriteInt(GetEvasion()); //evasion
packet.WriteInt(GetEvasion(true)); //evasion inc
packet.WriteInt(GetWeaponDamage()); //damage block again
packet.WriteInt(GetWeaponDamage(true));
packet.WriteInt(GetMagicDamage()); //magic damage
packet.WriteInt(GetMagicDamage(true));
packet.WriteInt(GetMagicDefense()); //magic def
packet.WriteInt(GetMagicDefense(true)); //magic def inc
packet.WriteInt(1);
packet.WriteInt(20);
packet.WriteInt(2);
packet.WriteInt(40);
packet.WriteUInt(BaseStats.MaxHP); //max HP
packet.WriteUInt(BaseStats.MaxSP); //max SP
if (character.Job == (int)Job.Crusader)
packet.WriteInt(100); // max LP
else
packet.WriteInt(0); // max LP
packet.WriteInt(0); // UNK
packet.WriteInt(BaseStats.MAXSoulHP); // Max HP Stones
packet.WriteInt(BaseStats.MAXSoulSP); // Max SP Stones
packet.Fill(64, 0);
if (!levelUP)
{
packet.WriteInt(this.Position.X);
packet.WriteInt(this.Position.Y);
}
}