本文整理汇总了C#中DOL.GS.PacketHandler.GSTCPPacketOut.WriteInt方法的典型用法代码示例。如果您正苦于以下问题:C# GSTCPPacketOut.WriteInt方法的具体用法?C# GSTCPPacketOut.WriteInt怎么用?C# GSTCPPacketOut.WriteInt使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类DOL.GS.PacketHandler.GSTCPPacketOut
的用法示例。
在下文中一共展示了GSTCPPacketOut.WriteInt方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: 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);
}
}
示例2: 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);
}
示例3: 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);
}
示例4: SendKeepComponentInfo
public override void SendKeepComponentInfo(IGameKeepComponent keepComponent)
{
using (GSTCPPacketOut pak = new GSTCPPacketOut(GetPacketCode(eServerPackets.KeepComponentInfo)))
{
pak.WriteShort((ushort)keepComponent.Keep.KeepID);
pak.WriteShort((ushort)keepComponent.ID);
pak.WriteInt((uint)keepComponent.ObjectID);
pak.WriteByte((byte)keepComponent.Skin);
pak.WriteByte((byte)(keepComponent.ComponentX));//relative to keep
pak.WriteByte((byte)(keepComponent.ComponentY));//relative to keep
pak.WriteByte((byte)keepComponent.ComponentHeading);
pak.WriteByte((byte)keepComponent.Height);
pak.WriteByte(keepComponent.HealthPercent);
byte flag = keepComponent.Status;
if (keepComponent.IsRaized) // Only for towers
flag |= 0x04;
if (flag == 0x00 && keepComponent.Climbing)
flag = 0x02;
pak.WriteByte(flag);
pak.WriteByte(0x00); //unk
SendTCP(pak);
}
}
示例5: WriteGroupMemberUpdate
protected override void WriteGroupMemberUpdate(GSTCPPacketOut pak, bool updateIcons, GameLiving living)
{
pak.WriteByte((byte)(living.GroupIndex + 1)); // From 1 to 8
bool sameRegion = living.CurrentRegion == m_gameClient.Player.CurrentRegion;
GamePlayer player = null;
if (sameRegion)
{
player = living as GamePlayer;
if (player != null)
pak.WriteByte(player.CharacterClass.HealthPercentGroupWindow);
else
pak.WriteByte(living.HealthPercent);
pak.WriteByte(living.ManaPercent);
pak.WriteByte(living.EndurancePercent); // new in 1.69
byte playerStatus = 0;
if (!living.IsAlive)
playerStatus |= 0x01;
if (living.IsMezzed)
playerStatus |= 0x02;
if (living.IsDiseased)
playerStatus |= 0x04;
if (SpellHandler.FindEffectOnTarget(living, "DamageOverTime") != null)
playerStatus |= 0x08;
if (living is GamePlayer)
{
if ((living as GamePlayer).Client.ClientState == GameClient.eClientState.Linkdead)
playerStatus |= 0x10;
}
if (!sameRegion)
playerStatus |= 0x20;
if (living.DebuffCategory[(int)eProperty.SpellRange] != 0 || living.DebuffCategory[(int)eProperty.ArcheryRange] != 0)
playerStatus |= 0x40;
pak.WriteByte(playerStatus);
// 0x00 = Normal , 0x01 = Dead , 0x02 = Mezzed , 0x04 = Diseased ,
// 0x08 = Poisoned , 0x10 = Link Dead , 0x20 = In Another Region, 0x40 - NS
if (updateIcons)
{
pak.WriteByte((byte)(0x80 | living.GroupIndex));
lock (living.EffectList)
{
byte i = 0;
foreach (IGameEffect effect in living.EffectList)
if (effect is GameSpellEffect)
i++;
pak.WriteByte(i);
foreach (IGameEffect effect in living.EffectList)
if (effect is GameSpellEffect)
{
pak.WriteByte(0);
pak.WriteShort(effect.Icon);
}
}
}
WriteGroupMemberMapUpdate(pak, living);
}
else
{
pak.WriteInt(0x20);
if (updateIcons)
{
pak.WriteByte((byte)(0x80 | living.GroupIndex));
pak.WriteByte(0);
}
}
}
示例6: SendRvRGuildBanner
public override void SendRvRGuildBanner(GamePlayer player, bool show)
{
if (player == null) return;
//cannot show banners for players that have no guild.
if (show && player.Guild == null)
return;
GSTCPPacketOut pak = new GSTCPPacketOut((byte)eServerPackets.VisualEffect);
pak.WriteShort((ushort)player.ObjectID);
pak.WriteByte(0xC); // show Banner
pak.WriteByte((byte)((show) ? 0 : 1)); // 0-enable, 1-disable
int newEmblemBitMask = ((player.Guild.Emblem & 0x010000) << 8) | (player.Guild.Emblem & 0xFFFF);
pak.WriteInt((uint)newEmblemBitMask);
SendTCP(pak);
}
示例7: SendPlayerJump
public virtual void SendPlayerJump(bool headingOnly)
{
if (m_gameClient.Player == null)
return;
using (var pak = new GSTCPPacketOut(GetPacketCode(eServerPackets.CharacterJump)))
{
pak.WriteInt((uint) (headingOnly ? 0 : m_gameClient.Player.X));
pak.WriteInt((uint) (headingOnly ? 0 : m_gameClient.Player.Y));
pak.WriteShort((ushort) m_gameClient.Player.ObjectID);
pak.WriteShort((ushort) (headingOnly ? 0 : m_gameClient.Player.Z));
pak.WriteShort(m_gameClient.Player.Heading);
if (m_gameClient.Player.InHouse == false || m_gameClient.Player.CurrentHouse == null)
{
pak.WriteShort(0);
}
else
{
pak.WriteShort((ushort) m_gameClient.Player.CurrentHouse.HouseNumber);
}
SendTCP(pak);
}
}
示例8: SendPlayerTitleUpdate
public override void SendPlayerTitleUpdate(GamePlayer player)
{
using (GSTCPPacketOut pak = new GSTCPPacketOut(GetPacketCode(eServerPackets.VisualEffect)))
{
pak.WriteShort((ushort)player.ObjectID);
pak.WriteByte(0x0B); // subcode
IPlayerTitle title = player.CurrentTitle;
if (title == PlayerTitleMgr.ClearTitle)
{
pak.WriteByte(0); // flag
pak.WriteInt(0); // unk1 + str len
}
else
{
pak.WriteByte(1); // flag
string val = GameServer.ServerRules.GetPlayerTitle(m_gameClient.Player, player);
pak.WriteShort((ushort) val.Length);
pak.WriteShort(0); // unk1
pak.WriteStringBytes(val);
}
SendTCP(pak);
}
}
示例9: GSTCPPacketOut
/*
* public override void SendPlayerBanner(GamePlayer player, int GuildEmblem)
{
if (player == null) return;
GSTCPPacketOut pak = new GSTCPPacketOut(GetPacketCode(eServerPackets.VisualEffect));
pak.WriteShort((ushort) player.ObjectID);
pak.WriteByte(12);
if (GuildEmblem == 0)
{
pak.WriteByte(1);
}
else
{
pak.WriteByte(0);
}
int newEmblemBitMask = ((GuildEmblem & 0x010000) << 8) | (GuildEmblem & 0xFFFF);
pak.WriteInt((uint)newEmblemBitMask);
SendTCP(pak);
}
*/
public override void SendHouse(House house)
{
GSTCPPacketOut pak = new GSTCPPacketOut(GetPacketCode(eServerPackets.HouseCreate));
pak.WriteShort((ushort)house.HouseNumber);
pak.WriteShort((ushort)house.Z);
pak.WriteInt((uint)house.X);
pak.WriteInt((uint)house.Y);
pak.WriteShort((ushort)house.Heading);
pak.WriteShort((ushort)house.PorchRoofColor);
pak.WriteShort((ushort)(house.GetPorchAndGuildEmblemFlags() | (house.Emblem & 0x010000) >> 13));//new Guild Emblem
pak.WriteShort((ushort)house.Emblem);
pak.WriteByte((byte)house.Model);
pak.WriteByte((byte)house.RoofMaterial);
pak.WriteByte((byte)house.WallMaterial);
pak.WriteByte((byte)house.DoorMaterial);
pak.WriteByte((byte)house.TrussMaterial);
pak.WriteByte((byte)house.PorchMaterial);
pak.WriteByte((byte)house.WindowMaterial);
pak.WriteByte(0x03);
pak.WritePascalString(house.Name);
SendTCP(pak);
}
示例10: SendTime
public virtual void SendTime()
{
using (var pak = new GSTCPPacketOut(GetPacketCode(eServerPackets.Time)))
{
if (m_gameClient != null && m_gameClient.Player != null)
{
pak.WriteInt(WorldMgr.GetCurrentGameTime(m_gameClient.Player));
pak.WriteInt(WorldMgr.GetDayIncrement(m_gameClient.Player));
}
else
{
pak.WriteInt(WorldMgr.GetCurrentGameTime());
pak.WriteInt(WorldMgr.GetDayIncrement());
}
SendTCP(pak);
}
}
示例11: SendObjectCreate
public virtual void SendObjectCreate(GameObject obj)
{
if (obj == null)
return;
if (obj.IsVisibleTo(m_gameClient.Player) == false)
return;
using (var 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 &&
(obj as GameStaticItemTimed).IsOwner(m_gameClient.Player))
flag |= 0x04;
pak.WriteShort((ushort) flag);
pak.WritePascalString(obj.Name);
if (obj is IDoor)
{
pak.WriteByte(4);
pak.WriteInt((uint) (obj as IDoor).DoorID);
}
else pak.WriteByte(0x00);
SendTCP(pak);
}
}
示例12: 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);
SendTCP(pak);
}
示例13: SendHouse
public override void SendHouse(House house)
{
using (GSTCPPacketOut pak = new GSTCPPacketOut(GetPacketCode(eServerPackets.HouseCreate)))
{
pak.WriteShort((ushort)house.HouseNumber);
pak.WriteShort((ushort)house.Z);
pak.WriteInt((uint)house.X);
pak.WriteInt((uint)house.Y);
pak.WriteShort((ushort)house.Heading);
pak.WriteShort((ushort)house.PorchRoofColor);
int flagPorchAndGuildEmblem = (house.Emblem & 0x010000) >> 13;//new Guild Emblem
if (house.Porch)
flagPorchAndGuildEmblem |= 1;
if (house.OutdoorGuildBanner)
flagPorchAndGuildEmblem |= 2;
if (house.OutdoorGuildShield)
flagPorchAndGuildEmblem |= 4;
pak.WriteShort((ushort)flagPorchAndGuildEmblem);
pak.WriteShort((ushort)house.Emblem);
pak.WriteShort(0); // new in 1.89b+ (scheduled for resposession XXX hourses ago)
pak.WriteByte((byte)house.Model);
pak.WriteByte((byte)house.RoofMaterial);
pak.WriteByte((byte)house.WallMaterial);
pak.WriteByte((byte)house.DoorMaterial);
pak.WriteByte((byte)house.TrussMaterial);
pak.WriteByte((byte)house.PorchMaterial);
pak.WriteByte((byte)house.WindowMaterial);
pak.WriteByte(0);
pak.WriteShort(0); // new in 1.89b+
pak.WritePascalString(house.Name);
SendTCP(pak);
}
// Update cache
m_gameClient.HouseUpdateArray[new Tuple<ushort, ushort>(house.RegionID, (ushort)house.HouseNumber)] = GameTimer.GetTickCount();
}
示例14: SendQuestWindow
const ushort MAX_STORY_LENGTH = 1000; // Via trial and error, 1.108 client.
// Often will cut off text around 990 but longer strings do not result in any errors. -Tolakram
protected override void SendQuestWindow(GameNPC questNPC, GamePlayer player, DataQuest quest, bool offer)
{
using (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 or client will crash !
}
else
{
pak.WritePascalString(personalizedSummary);
}
if (offer)
{
String personalizedStory = BehaviourUtils.GetPersonalizedMessage(quest.Story, player);
if (personalizedStory.Length > MAX_STORY_LENGTH)
{
pak.WriteShort(MAX_STORY_LENGTH);
pak.WriteStringBytes(personalizedStory.Substring(0, MAX_STORY_LENGTH));
}
else
{
pak.WriteShort((ushort)personalizedStory.Length);
pak.WriteStringBytes(personalizedStory);
}
}
else
{
if (quest.FinishText.Length > MAX_STORY_LENGTH)
{
pak.WriteShort(MAX_STORY_LENGTH);
pak.WriteStringBytes(quest.FinishText.Substring(0, MAX_STORY_LENGTH));
}
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)
{
string t = text;
// Need to protect for any text length > 255. It does not crash client but corrupts RewardQuest display -Tolakram
if (text.Length > 253)
{
t = text.Substring(0, 253);
}
pak.WritePascalString(String.Format("{0}\r", t));
}
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);
}
}
示例15: SendNPCCreate
public virtual void SendNPCCreate(GameNPC npc)
{
if (m_gameClient.Player == null || npc.IsVisibleTo(m_gameClient.Player) == false)
return;
if (npc is GameMovingObject)
{
SendMovingObjectCreate(npc as GameMovingObject);
return;
}
using (var pak = new GSTCPPacketOut(GetPacketCode(eServerPackets.NPCCreate)))
{
int speed = 0;
ushort speedZ = 0;
if (npc.IsMoving && !npc.IsAtTargetPosition)
{
speed = npc.CurrentSpeed;
speedZ = (ushort) npc.TickSpeedZ;
}
pak.WriteShort((ushort) npc.ObjectID);
pak.WriteShort((ushort) speed);
pak.WriteShort(npc.Heading);
pak.WriteShort((ushort) npc.Z);
pak.WriteInt((uint) npc.X);
pak.WriteInt((uint) npc.Y);
pak.WriteShort(speedZ);
pak.WriteShort(npc.Model);
pak.WriteByte(npc.Size);
pak.WriteByte(npc.GetDisplayLevel(m_gameClient.Player));
var flags = (byte) (GameServer.ServerRules.GetLivingRealm(m_gameClient.Player, npc) << 6);
if ((npc.Flags & GameNPC.eFlags.GHOST) != 0) flags |= 0x01;
if (npc.Inventory != null)
flags |= 0x02; //If mob has equipment, then only show it after the client gets the 0xBD packet
if ((npc.Flags & GameNPC.eFlags.PEACE) != 0) flags |= 0x10;
if ((npc.Flags & GameNPC.eFlags.FLYING) != 0) flags |= 0x20;
pak.WriteByte(flags);
pak.WriteByte(0x20); //TODO this is the default maxstick distance
string add = "";
if (m_gameClient.Account.PrivLevel > 1)
{
if ((npc.Flags & GameNPC.eFlags.CANTTARGET) != 0)
add += "-DOR"; // indicates DOR flag for GMs
if ((npc.Flags & GameNPC.eFlags.DONTSHOWNAME) != 0)
add += "-NON"; // indicates NON flag for GMs
}
DBLanguageNPC translation = npc.GetTranslation(m_gameClient);
string name = translation.Name;/*npc.Name;*/
if (name.Length + add.Length + 2 > 47) // clients crash with too long names
name = name.Substring(0, 47 - add.Length - 2);
if (add.Length > 0)
name = string.Format("[{0}]{1}", name, add);
pak.WritePascalString(name);
//if (npc.GuildName.Length > 47)
// pak.WritePascalString(npc.GuildName.Substring(0, 47));
//else pak.WritePascalString(npc.GuildName);
string guildName = translation.GuildName;
if (guildName.Length > 47)
guildName = guildName.Substring(0, 47);
pak.WritePascalString(guildName);
pak.WriteByte(0x00);
SendTCP(pak);
}
}