本文整理汇总了C#中DOL.GS.PacketHandler.GSTCPPacketOut.Seek方法的典型用法代码示例。如果您正苦于以下问题:C# GSTCPPacketOut.Seek方法的具体用法?C# GSTCPPacketOut.Seek怎么用?C# GSTCPPacketOut.Seek使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类DOL.GS.PacketHandler.GSTCPPacketOut
的用法示例。
在下文中一共展示了GSTCPPacketOut.Seek方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: SendUpdateIcons
//.........这里部分代码省略.........
pak.WriteByte(0); // unknown
pak.WriteByte(Icons); // unknown
pak.WriteByte(0); // unknown
foreach (IGameEffect effect in m_gameClient.Player.EffectList)
{
if (effect.Icon != 0)
{
fxcount++;
if (changedEffects != null && !changedEffects.Contains(effect))
{
continue;
}
// store tooltip update for gamespelleffect.
if (ForceTooltipUpdate && (effect is GameSpellEffect))
{
Spell spell = ((GameSpellEffect)effect).Spell;
tooltipids.Add(spell.InternalID);
}
// log.DebugFormat("adding [{0}] '{1}'", fxcount-1, effect.Name);
pak.WriteByte((byte)(fxcount - 1)); // icon index
pak.WriteByte((effect is GameSpellEffect || effect.Icon > 5000) ? (byte)(fxcount - 1) : (byte)0xff);
byte ImmunByte = 0;
if (effect is GameSpellEffect)
{
//if (((GameSpellEffect)effect).ImmunityState)
if (effect is GameSpellAndImmunityEffect && ((GameSpellAndImmunityEffect)effect).ImmunityState)
{
ImmunByte = 1;
}
}
pak.WriteByte(ImmunByte);
// bit 0x08 adds "more..." to right click info
pak.WriteShort(effect.Icon);
//pak.WriteShort(effect.IsFading ? (ushort)1 : (ushort)(effect.RemainingTime / 1000));
pak.WriteShort((ushort)(effect.RemainingTime / 1000));
if (effect is GameSpellEffect)
pak.WriteShort((ushort)((GameSpellEffect)effect).Spell.InternalID); //v1.110+ send the spell ID for delve info in active icon
else
pak.WriteShort(0);//don't override existing tooltip ids
byte flagNegativeEffect = 0;
if (effect is StaticEffect)
{
if (((StaticEffect)effect).HasNegativeEffect)
{
flagNegativeEffect = 1;
}
}
else if (effect is GameSpellEffect)
{
if (!((GameSpellEffect)effect).SpellHandler.HasPositiveEffect)
{
flagNegativeEffect = 1;
}
}
pak.WriteByte(flagNegativeEffect);
pak.WritePascalString(effect.Name);
entriesCount++;
}
}
int oldCount = lastUpdateEffectsCount;
lastUpdateEffectsCount = fxcount;
while (oldCount > fxcount)
{
pak.WriteByte((byte)(fxcount++));
pak.Fill(0, 10);
entriesCount++;
// log.DebugFormat("adding [{0}] (empty)", fxcount-1);
}
if (changedEffects != null)
{
changedEffects.Clear();
}
if (entriesCount == 0)
{
return; // nothing changed - no update is needed
}
pak.Position = initPos;
pak.WriteByte((byte)entriesCount);
pak.Seek(0, SeekOrigin.End);
SendTCP(pak);
}
// force tooltips update
foreach (int entry in tooltipids)
{
if (m_gameClient.CanSendTooltip(24, entry))
SendDelveInfo(DOL.GS.PacketHandler.Client.v168.DetailDisplayHandler.DelveSpell(m_gameClient, entry));
}
}
示例2: SendTrainerWindow
//.........这里部分代码省略.........
paksub.WriteShort((ushort)sp.ID);
}
SendTCP(pak);
}
}
else //styles and other
{
paksub.WriteByte((byte)skillindex);
skillindex++;
List<Style> lst = SkillBase.GetStyleList(spc.KeyName, m_gameClient.Player.CharacterClass.ID);
if (lst != null && lst.Count > 0) //styles
{
using (var pak = new GSTCPPacketOut(GetPacketCode(eServerPackets.TrainerWindow)))
{
pak.WriteByte((byte)lst.Count);
pak.WriteByte((byte)m_gameClient.Player.SkillSpecialtyPoints);
pak.WriteByte(4);
pak.WriteByte(0);
pak.WriteByte(count);
count += (byte)lst.Count;
paksub.WriteByte((byte)lst.Count);
if(autotrains.Contains(spc.KeyName))
paksub.WriteByte((byte)Math.Floor((double)m_gameClient.Player.BaseLevel / 4));
else paksub.WriteByte(0);
foreach (var st in lst)
{
pak.WritePascalString(st.Name);
paksub.WriteByte((byte)Math.Min(50, st.Level));
paksub.WriteShort((ushort)st.Icon);
paksub.WriteByte((byte)st.SkillType);
paksub.WriteByte((byte)st.OpeningRequirementType);
paksub.WriteByte((byte)st.OpeningRequirementValue);
paksub.WriteShort((ushort)st.ID);
}
SendTCP(pak);
}
}
else //other
{
using (var pak = new GSTCPPacketOut(GetPacketCode(eServerPackets.TrainerWindow)))
{
pak.WriteByte(0);
pak.WriteByte((byte)m_gameClient.Player.SkillSpecialtyPoints);
pak.WriteByte(4);
pak.WriteByte(0);
pak.WriteByte(count);
SendTCP(pak);
}
paksub.WriteByte(0);
if (autotrains.Contains(spc.KeyName))
paksub.WriteByte((byte)Math.Floor((double)m_gameClient.Player.BaseLevel / 4));
else paksub.WriteByte(0);
}
}
}
paksub.Seek(pos, System.IO.SeekOrigin.Begin);
paksub.WriteByte((byte)skillindex); //fix size
paksub.Seek(0, System.IO.SeekOrigin.End);
SendTCP(paksub);
// type 5 (realm abilities)
List<RealmAbility> ras = SkillBase.GetClassRealmAbilities(m_gameClient.Player.CharacterClass.ID);
using (var pak = new GSTCPPacketOut(GetPacketCode(eServerPackets.TrainerWindow)))
{
pak.WriteByte((byte)ras.Count);
pak.WriteByte((byte)m_gameClient.Player.RealmSpecialtyPoints);
pak.WriteByte(5);
pak.WriteByte(0);
foreach (RealmAbility ra in ras)
{
if (ra is RR5RealmAbility)
continue;
RealmAbility playerRA = (RealmAbility) m_gameClient.Player.GetAbility(ra.KeyName);
if (playerRA != null)
pak.WriteByte((byte)(playerRA.Level));
else
pak.WriteByte(0);
pak.WriteByte(0);
pak.WriteByte((byte)ra.MaxLevel);
for (int i = 0; i < ra.MaxLevel; i++)
pak.WriteByte((byte)ra.CostForUpgrade(i));
if (ra.CheckRequirement(m_gameClient.Player))
pak.WritePascalString(ra.KeyName);
else
pak.WritePascalString("[" + ra.Name + "]");
}
SendTCP(pak);
}
}
示例3: SendUpdateIcons
public override void SendUpdateIcons(IList changedEffects, ref int lastUpdateEffectsCount)
{
if (m_gameClient.Player == null)
return;
using (GSTCPPacketOut pak = new GSTCPPacketOut(GetPacketCode(eServerPackets.UpdateIcons)))
{
long initPos = pak.Position;
int fxcount = 0;
int entriesCount = 0;
lock (m_gameClient.Player.EffectList)
{
pak.WriteByte(0); // effects count set in the end
pak.WriteByte(0); // unknown
pak.WriteByte(0); // unknown
pak.WriteByte(0); // unknown
foreach (IGameEffect effect in m_gameClient.Player.EffectList)
{
if (effect.Icon != 0)
{
fxcount++;
if (changedEffects != null && !changedEffects.Contains(effect))
continue;
// Log.DebugFormat("adding [{0}] '{1}'", fxcount-1, effect.Name);
pak.WriteByte((byte)(fxcount - 1)); // icon index
pak.WriteByte((effect is GameSpellEffect) ? (byte)(fxcount - 1) : (byte)0xff);
byte ImmunByte = 0;
var gsp = effect as GameSpellEffect;
if (gsp != null && gsp.IsDisabled)
ImmunByte = 1;
pak.WriteByte(ImmunByte); // new in 1.73; if non zero says "protected by" on right click
// bit 0x08 adds "more..." to right click info
pak.WriteShort(effect.Icon);
//pak.WriteShort(effect.IsFading ? (ushort)1 : (ushort)(effect.RemainingTime / 1000));
pak.WriteShort((ushort)(effect.RemainingTime / 1000));
pak.WriteShort(effect.InternalID); // reference for shift+i or cancel spell
pak.WritePascalString(effect.Name);
entriesCount++;
}
}
int oldCount = lastUpdateEffectsCount;
lastUpdateEffectsCount = fxcount;
while (oldCount > fxcount)
{
pak.WriteByte((byte)(fxcount++));
pak.Fill(0, 9);
entriesCount++;
// Log.DebugFormat("adding [{0}] (empty)", fxcount-1);
}
if (changedEffects != null)
changedEffects.Clear();
if (entriesCount == 0)
return; // nothing changed - no update is needed
pak.Position = initPos;
pak.WriteByte((byte)entriesCount);
pak.Seek(0, SeekOrigin.End);
SendTCP(pak);
// Log.Debug("packet sent.");
}
}
}
示例4: SendUpdateIcons
public override void SendUpdateIcons(IList changedEffects, ref int lastUpdateEffectsCount)
{
if (m_gameClient.Player == null)
{
return;
}
GSTCPPacketOut pak = new GSTCPPacketOut(GetPacketCode(eServerPackets.UpdateIcons));
long initPos = pak.Position;
int fxcount = 0;
int entriesCount = 0;
pak.WriteByte(0); // effects count set in the end
pak.WriteByte(0); // unknown
pak.WriteByte(Icons); // unknown
pak.WriteByte(0); // unknown
foreach (IGameEffect effect in m_gameClient.Player.EffectList)
{
if (effect.Icon != 0)
{
fxcount++;
if (changedEffects != null && !changedEffects.Contains(effect))
{
continue;
}
// log.DebugFormat("adding [{0}] '{1}'", fxcount-1, effect.Name);
pak.WriteByte((byte)(fxcount - 1)); // icon index
pak.WriteByte((effect is GameSpellEffect || effect.Icon > 5000) ? (byte)(fxcount - 1) : (byte)0xff);
byte ImmunByte = 0;
if (effect is GameSpellAndImmunityEffect)
{
GameSpellAndImmunityEffect immunity = (GameSpellAndImmunityEffect)effect;
if (immunity.ImmunityState)
{
ImmunByte = 1;
}
}
pak.WriteByte(ImmunByte);
// bit 0x08 adds "more..." to right click info
pak.WriteShort(effect.Icon);
pak.WriteShort((ushort)(effect.RemainingTime / 1000));
if (effect is GameSpellEffect)
pak.WriteShort(((GameSpellEffect)effect).Spell.ID); //v1.110+ send the spell ID for delve info in active icon
else
pak.WriteShort(effect.InternalID);//old method
byte flagNegativeEffect = 0;
if (effect is StaticEffect)
{
if (((StaticEffect)effect).HasNegativeEffect)
{
flagNegativeEffect = 1;
}
}
else if (effect is GameSpellEffect)
{
if (!((GameSpellEffect)effect).SpellHandler.HasPositiveEffect)
{
flagNegativeEffect = 1;
}
}
pak.WriteByte(flagNegativeEffect);
pak.WritePascalString(effect.Name);
entriesCount++;
}
}
int oldCount = lastUpdateEffectsCount;
lastUpdateEffectsCount = fxcount;
while (oldCount > fxcount)
{
pak.WriteByte((byte)(fxcount++));
pak.Fill(0, 10);
entriesCount++;
// log.DebugFormat("adding [{0}] (empty)", fxcount-1);
}
if (changedEffects != null)
{
changedEffects.Clear();
}
if (entriesCount == 0)
{
return; // nothing changed - no update is needed
}
pak.Position = initPos;
pak.WriteByte((byte)entriesCount);
pak.Seek(0, SeekOrigin.End);
SendTCP(pak);
// log.Debug("packet sent.");
return;
}