本文整理汇总了C#中DOL.GS.PacketHandler.GSTCPPacketOut.WriteShort方法的典型用法代码示例。如果您正苦于以下问题:C# GSTCPPacketOut.WriteShort方法的具体用法?C# GSTCPPacketOut.WriteShort怎么用?C# GSTCPPacketOut.WriteShort使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类DOL.GS.PacketHandler.GSTCPPacketOut
的用法示例。
在下文中一共展示了GSTCPPacketOut.WriteShort方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: SendSetControlledHorse
public override void SendSetControlledHorse(GamePlayer player)
{
if (player == null || player.ObjectState != GameObject.eObjectState.Active)
return;
GSTCPPacketOut pak = new GSTCPPacketOut(GetPacketCode(eServerPackets.ControlledHorse));
if (player.HasHorse)
{
pak.WriteShort(0); // for set self horse OID must be zero
pak.WriteByte(player.ActiveHorse.ID);
if (player.ActiveHorse.BardingColor == 0 && player.ActiveHorse.Barding != 0 && player.Guild != null)
{
int newGuildBitMask = (player.Guild.Emblem & 0x010000) >> 9;
pak.WriteByte((byte)(player.ActiveHorse.Barding | newGuildBitMask));
pak.WriteShort((ushort)player.Guild.Emblem);
}
else
{
pak.WriteByte(player.ActiveHorse.Barding);
pak.WriteShort(player.ActiveHorse.BardingColor);
}
pak.WriteByte(player.ActiveHorse.Saddle);
pak.WriteByte(player.ActiveHorse.SaddleColor);
pak.WriteByte(player.ActiveHorse.Slots);
pak.WriteByte(player.ActiveHorse.Armor);
pak.WritePascalString(player.ActiveHorse.Name == null ? "" : player.ActiveHorse.Name);
}
else
{
pak.Fill(0x00, 8);
}
SendTCP(pak);
}
示例2: SendCombatAnimation
public override void SendCombatAnimation(GameObject attacker, GameObject defender, ushort weaponID, ushort shieldID, int style, byte stance, byte result, byte targetHealthPercent)
{
using (GSTCPPacketOut pak = new GSTCPPacketOut(GetPacketCode(eServerPackets.CombatAnimation)))
{
if (attacker != null)
pak.WriteShort((ushort)attacker.ObjectID);
else
pak.WriteShort(0x00);
if (defender != null)
pak.WriteShort((ushort)defender.ObjectID);
else
pak.WriteShort(0x00);
pak.WriteShort(weaponID);
pak.WriteShort(shieldID);
pak.WriteShortLowEndian((ushort)style);
pak.WriteByte(stance);
pak.WriteByte(result);
// If Health Percent is invalid get the living Health.
if (defender is GameLiving && targetHealthPercent > 100)
{
targetHealthPercent = (defender as GameLiving).HealthPercent;
}
pak.WriteByte(targetHealthPercent);
pak.WriteByte(0);//unk
SendTCP(pak);
}
}
示例3: SendLivingEquipmentUpdate
public override void SendLivingEquipmentUpdate(GameLiving living)
{
using (GSTCPPacketOut pak = new GSTCPPacketOut(GetPacketCode(eServerPackets.EquipmentUpdate)))
{
ICollection<InventoryItem> items = null;
if (living.Inventory != null)
items = living.Inventory.VisibleItems;
pak.WriteShort((ushort)living.ObjectID);
pak.WriteByte((byte)living.VisibleActiveWeaponSlots);
pak.WriteByte((byte)living.CurrentSpeed); // new in 189b+, speed
pak.WriteByte((byte)((living.IsCloakInvisible ? 0x01 : 0x00) | (living.IsHelmInvisible ? 0x02 : 0x00))); // new in 189b+, cloack/helm visibility
pak.WriteByte((byte)((living.IsCloakHoodUp ? 0x01 : 0x00) | (int)living.ActiveQuiverSlot)); //bit0 is hood up bit4 to 7 is active quiver
if (items != null)
{
pak.WriteByte((byte)items.Count);
foreach (InventoryItem item in items)
{
ushort model = (ushort)(item.Model & 0x1FFF);
int slot = item.SlotPosition;
//model = GetModifiedModel(model);
int texture = item.Emblem != 0 ? item.Emblem : item.Color;
if (item.SlotPosition == Slot.LEFTHAND || item.SlotPosition == Slot.CLOAK) // for test only cloack and shield
slot = slot | ((texture & 0x010000) >> 9); // slot & 0x80 if new emblem
pak.WriteByte((byte)slot);
if ((texture & ~0xFF) != 0)
model |= 0x8000;
else if ((texture & 0xFF) != 0)
model |= 0x4000;
if (item.Effect != 0)
model |= 0x2000;
pak.WriteShort(model);
if (item.SlotPosition > Slot.RANGED || item.SlotPosition < Slot.RIGHTHAND)
pak.WriteByte((byte)item.Extension);
if ((texture & ~0xFF) != 0)
pak.WriteShort((ushort)texture);
else if ((texture & 0xFF) != 0)
pak.WriteByte((byte)texture);
if (item.Effect != 0)
pak.WriteByte((byte)item.Effect);
}
}
else
{
pak.WriteByte(0x00);
}
SendTCP(pak);
}
}
示例4: SendPlayerCreate
public override void SendPlayerCreate(GamePlayer playerToCreate)
{
Region playerRegion = playerToCreate.CurrentRegion;
if (playerRegion == null)
{
if (log.IsWarnEnabled)
log.Warn("SendPlayerCreate: playerRegion == null");
return;
}
Zone playerZone = playerToCreate.CurrentZone;
if (playerZone == null)
{
if (log.IsWarnEnabled)
log.Warn("SendPlayerCreate: playerZone == null");
return;
}
if (m_gameClient.Player == null || playerToCreate.IsVisibleTo(m_gameClient.Player) == false)
return;
GSTCPPacketOut pak = new GSTCPPacketOut(GetPacketCode(eServerPackets.PlayerCreate172));
pak.WriteShort((ushort)playerToCreate.Client.SessionID);
pak.WriteShort((ushort)playerToCreate.ObjectID);
pak.WriteShort(playerToCreate.Model);
pak.WriteShort((ushort)playerToCreate.Z);
//Dinberg:Instances - Zoneskin ID for clientside positioning 'bluff'.
pak.WriteShort(playerZone.ZoneSkinID);
pak.WriteShort((ushort)playerRegion.GetXOffInZone(playerToCreate.X, playerToCreate.Y));
pak.WriteShort((ushort)playerRegion.GetYOffInZone(playerToCreate.X, playerToCreate.Y));
pak.WriteShort(playerToCreate.Heading);
pak.WriteByte(playerToCreate.GetFaceAttribute(eCharFacePart.EyeSize)); //1-4 = Eye Size / 5-8 = Nose Size
pak.WriteByte(playerToCreate.GetFaceAttribute(eCharFacePart.LipSize)); //1-4 = Ear size / 5-8 = Kin size
pak.WriteByte(playerToCreate.GetFaceAttribute(eCharFacePart.EyeColor)); //1-4 = Skin Color / 5-8 = Eye Color
pak.WriteByte(playerToCreate.GetDisplayLevel(m_gameClient.Player));
pak.WriteByte(playerToCreate.GetFaceAttribute(eCharFacePart.HairColor)); //Hair: 1-4 = Color / 5-8 = unknown
pak.WriteByte(playerToCreate.GetFaceAttribute(eCharFacePart.FaceType)); //1-4 = Unknown / 5-8 = Face type
pak.WriteByte(playerToCreate.GetFaceAttribute(eCharFacePart.HairStyle)); //1-4 = Unknown / 5-8 = Hair Style
int flags = (GameServer.ServerRules.GetLivingRealm(m_gameClient.Player, playerToCreate) & 0x03) << 2;
if (playerToCreate.IsAlive == false)
flags |= 0x01;
if (playerToCreate.IsUnderwater)
flags |= 0x02; //swimming
if (playerToCreate.IsStealthed)
flags |= 0x10;
if (playerToCreate.IsWireframe)
flags |= 0x20;
pak.WriteByte((byte)flags);
pak.WritePascalString(GameServer.ServerRules.GetPlayerName(m_gameClient.Player, playerToCreate));
pak.WritePascalString(GameServer.ServerRules.GetPlayerGuildName(m_gameClient.Player, playerToCreate));
pak.WritePascalString(GameServer.ServerRules.GetPlayerLastName(m_gameClient.Player, playerToCreate));
pak.WriteByte(0x00); //Trialing 0 ... needed!
SendTCP(pak);
//if (GameServer.ServerRules.GetColorHandling(m_gameClient) == 1) // PvP
SendObjectGuildID(playerToCreate, playerToCreate.Guild); //used for nearest friendly/enemy object buttons and name colors on PvP server
}
示例5: SendKeepRemove
public override void SendKeepRemove(AbstractGameKeep keep)
{
GSTCPPacketOut pak = new GSTCPPacketOut(GetPacketCode(eServerPackets.KeepRemove));
pak.WriteShort((ushort)keep.KeepID);
SendTCP(pak);
}
示例6: SendKeepInfo
public override void SendKeepInfo(AbstractGameKeep keep)
{
GSTCPPacketOut pak = new GSTCPPacketOut(GetPacketCode(eServerPackets.KeepInfo));
pak.WriteShort((ushort)keep.KeepID);
pak.WriteShort(0);//zone id not sure
pak.WriteInt((uint)keep.X);
pak.WriteInt((uint)keep.Y);
pak.WriteShort((ushort)keep.Heading);
pak.WriteByte((byte)keep.Realm);
pak.WriteByte((byte)keep.Level);//level(not sure)
pak.WriteShort(0);//unk
pak.WriteByte(0x57);//model= 5-8Bit =lvl 1-4bit = Keep Type //uncertain
pak.WriteByte(0xB7);//unk
SendTCP(pak);
}
示例7: SendUpdatePoints
public override void SendUpdatePoints()
{
if (m_gameClient.Player == null)
return;
GSTCPPacketOut pak = new GSTCPPacketOut(GetPacketCode(eServerPackets.CharacterPointsUpdate));
pak.WriteInt((uint)m_gameClient.Player.RealmPoints);
pak.WriteShort(m_gameClient.Player.LevelPermill);
pak.WriteShort((ushort)m_gameClient.Player.SkillSpecialtyPoints);
pak.WriteInt((uint)m_gameClient.Player.BountyPoints);
pak.WriteShort((ushort)m_gameClient.Player.RealmSpecialtyPoints);
pak.WriteShort(m_gameClient.Player.ChampionLevelPermill);
pak.WriteLongLowEndian((ulong)m_gameClient.Player.Experience);
pak.WriteLongLowEndian((ulong)m_gameClient.Player.ExperienceForNextLevel);
pak.WriteLongLowEndian(0);//champExp
pak.WriteLongLowEndian(0);//champExpNextLevel
SendTCP(pak);
}
示例8: SendFindGroupWindowUpdate
public override void SendFindGroupWindowUpdate(GamePlayer[] list)
{
if (m_gameClient.Player==null)
return;
using (GSTCPPacketOut pak = new GSTCPPacketOut(GetPacketCode(eServerPackets.FindGroupUpdate)))
{
if (list!=null)
{
pak.WriteByte((byte)list.Length);
byte nbleader=0;
byte nbsolo=0x1E;
foreach(GamePlayer player in list)
{
if (player.Group!=null)
{
pak.WriteByte(nbleader++);
}
else
{
pak.WriteByte(nbsolo++);
}
pak.WriteByte(player.Level);
pak.WritePascalString(player.Name);
pak.WriteString(player.CharacterClass.Name, 4);
//Dinberg:Instances - We use ZoneSkinID to bluff our way to victory and
//trick the client for positioning objects (as IDs are hard coded).
if(player.CurrentZone != null)
pak.WriteShort(player.CurrentZone.ZoneSkinID);
else
pak.WriteShort(0); // ?
pak.WriteByte(0); // duration
pak.WriteByte(0); // objective
pak.WriteByte(0);
pak.WriteByte(0);
pak.WriteByte((byte) (player.Group!=null ? 1 : 0));
pak.WriteByte(0);
}
}
else
{
pak.WriteByte(0);
}
SendTCP(pak);
}
}
示例9: SendPlayerPositionAndObjectID
public override void SendPlayerPositionAndObjectID()
{
if (m_gameClient.Player == null) return;
using (GSTCPPacketOut pak = new GSTCPPacketOut(GetPacketCode(eServerPackets.PositionAndObjectID)))
{
pak.WriteShort((ushort)m_gameClient.Player.ObjectID); //This is the player's objectid not Sessionid!!!
pak.WriteShort((ushort)m_gameClient.Player.Z);
pak.WriteInt((uint)m_gameClient.Player.X);
pak.WriteInt((uint)m_gameClient.Player.Y);
pak.WriteShort(m_gameClient.Player.Heading);
int flags = 0;
if (m_gameClient.Player.CurrentZone.IsDivingEnabled)
flags = 0x80 | (m_gameClient.Player.IsUnderwater ? 0x01 : 0x00);
pak.WriteByte((byte)(flags));
pak.WriteByte(0x00); //TODO Unknown
Zone zone = m_gameClient.Player.CurrentZone;
if (zone == null) return;
pak.WriteShort((ushort)(zone.XOffset / 0x2000));
pak.WriteShort((ushort)(zone.YOffset / 0x2000));
//Dinberg - Changing to allow instances...
pak.WriteShort(m_gameClient.Player.CurrentRegion.Skin);
pak.WriteShort(0x00); //TODO: unknown, new in 1.71
SendTCP(pak);
}
}
示例10: SendKeepRealmUpdate
public override void SendKeepRealmUpdate(AbstractGameKeep keep)
{
GSTCPPacketOut pak = new GSTCPPacketOut(GetPacketCode(eServerPackets.KeepRealmUpdate));
pak.WriteShort((ushort)keep.KeepID);
pak.WriteByte((byte)keep.Realm);
pak.WriteByte((byte)keep.Level);
SendTCP(pak);
}
示例11: SendXFireInfo
public override void SendXFireInfo(byte flag)
{
if (m_gameClient == null || m_gameClient.Player == null)
return;
GSTCPPacketOut pak = new GSTCPPacketOut((byte)eServerPackets.XFire);
pak.WriteShort((ushort)m_gameClient.Player.ObjectID);
pak.WriteByte(flag);
pak.WriteByte(0x00);
SendTCP(pak);
}
示例12: SendBlinkPanel
public override void SendBlinkPanel(byte flag)
{
GSTCPPacketOut pak = new GSTCPPacketOut(GetPacketCode(eServerPackets.VisualEffect));
GamePlayer player = base.m_gameClient.Player;
pak.WriteShort((ushort)player.ObjectID);
pak.WriteByte((byte)8);
pak.WriteByte((byte)flag);
pak.WriteByte((byte)0);
SendTCP(pak);
}
示例13: SendQuestWindow
protected override void SendQuestWindow(GameNPC questNPC, GamePlayer player, DataQuest quest, bool offer)
{
GSTCPPacketOut pak = new GSTCPPacketOut(GetPacketCode(eServerPackets.Dialog));
ushort QuestID = quest.ClientQuestID;
pak.WriteShort((offer) ? (byte)0x22 : (byte)0x21); // Dialog
pak.WriteShort(QuestID);
pak.WriteShort((ushort)questNPC.ObjectID);
pak.WriteByte(0x00); // unknown
pak.WriteByte(0x00); // unknown
pak.WriteByte(0x00); // unknown
pak.WriteByte(0x00); // unknown
pak.WriteByte((offer) ? (byte)0x02 : (byte)0x01); // Accept/Decline or Finish/Not Yet
pak.WriteByte(0x01); // Wrap
pak.WritePascalString(quest.Name);
String personalizedSummary = BehaviourUtils.GetPersonalizedMessage(quest.Description, player);
if (personalizedSummary.Length > 255)
{
pak.WritePascalString(personalizedSummary.Substring(0, 255)); // Summary is max 255 bytes !
}
else
{
pak.WritePascalString(personalizedSummary);
}
if (offer)
{
//String personalizedStory = BehaviourUtils.GetPersonalizedMessage(quest.Story, player);
pak.WriteShort((ushort)quest.Story.Length);
pak.WriteStringBytes(quest.Story);
}
else
{
pak.WriteShort((ushort)quest.FinishText.Length);
pak.WriteStringBytes(quest.FinishText);
}
pak.WriteShort(QuestID);
pak.WriteByte((byte)quest.StepTexts.Count); // #goals count
foreach (string text in quest.StepTexts)
{
pak.WritePascalString(String.Format("{0}\r", text));
}
pak.WriteInt((uint)(0));
pak.WriteByte((byte)0);
pak.WriteByte((byte)quest.FinalRewards.Count);
foreach (ItemTemplate reward in quest.FinalRewards)
{
WriteItemData(pak, GameInventoryItem.Create<ItemTemplate>(reward));
}
pak.WriteByte((byte)quest.NumOptionalRewardsChoice);
pak.WriteByte((byte)quest.OptionalRewards.Count);
foreach (ItemTemplate reward in quest.OptionalRewards)
{
WriteItemData(pak, GameInventoryItem.Create<ItemTemplate>(reward));
}
SendTCP(pak);
}
示例14: SendObjectCreate
public override void SendObjectCreate(GameObject obj)
{
if (obj == null || m_gameClient.Player == null)
return;
if (obj.IsVisibleTo(m_gameClient.Player) == false)
return;
GSTCPPacketOut pak = new GSTCPPacketOut(GetPacketCode(eServerPackets.ObjectCreate));
pak.WriteShort((ushort)obj.ObjectID);
if (obj is GameStaticItem)
pak.WriteShort((ushort)(obj as GameStaticItem).Emblem);
else pak.WriteShort(0);
pak.WriteShort(obj.Heading);
pak.WriteShort((ushort)obj.Z);
pak.WriteInt((uint)obj.X);
pak.WriteInt((uint)obj.Y);
int flag = ((byte)obj.Realm & 3) << 4;
ushort model = obj.Model;
if (obj.IsUnderwater)
{
if (obj is GameNPC)
model |= 0x8000;
else
flag |= 0x01; // Underwater
}
pak.WriteShort(model);
if (obj is GameKeepBanner)
flag |= 0x08;
if (obj is GameStaticItemTimed && m_gameClient.Player != null && ((GameStaticItemTimed)obj).IsOwner(m_gameClient.Player))
flag |= 0x04;
pak.WriteShort((ushort)flag);
pak.WriteInt(0x0); //TODO: unknown, new in 1.71
pak.WritePascalString(obj.Name);
if (obj is IDoor)
{
pak.WriteByte(4);
pak.WriteInt((uint)(obj as IDoor).DoorID);
}
else pak.WriteByte(0x00);
SendTCP(pak);
}
示例15: SendStatusUpdate
public override void SendStatusUpdate(byte sittingFlag)
{
if (m_gameClient.Player == null)
return;
GSTCPPacketOut pak = new GSTCPPacketOut(GetPacketCode(eServerPackets.CharacterStatusUpdate));
pak.WriteByte(m_gameClient.Player.HealthPercent);
pak.WriteByte(m_gameClient.Player.ManaPercent);
pak.WriteByte(sittingFlag);
pak.WriteByte(m_gameClient.Player.EndurancePercent);
pak.WriteByte(m_gameClient.Player.ConcentrationPercent);
// pak.WriteShort((byte) (m_gameClient.Player.IsAlive ? 0x00 : 0x0f)); // 0x0F if dead ??? where it now ?
pak.WriteByte(0);// unk
pak.WriteShort((ushort)m_gameClient.Player.MaxMana);
pak.WriteShort((ushort)m_gameClient.Player.MaxEndurance);
pak.WriteShort((ushort)m_gameClient.Player.MaxConcentration);
pak.WriteShort((ushort)m_gameClient.Player.MaxHealth);
pak.WriteShort((ushort)m_gameClient.Player.Health);
pak.WriteShort((ushort)m_gameClient.Player.Endurance);
pak.WriteShort((ushort)m_gameClient.Player.Mana);
pak.WriteShort((ushort)m_gameClient.Player.Concentration);
SendTCP(pak);
}