本文整理汇总了C#中DOL.GS.PacketHandler.GSTCPPacketOut.WritePascalString方法的典型用法代码示例。如果您正苦于以下问题:C# GSTCPPacketOut.WritePascalString方法的具体用法?C# GSTCPPacketOut.WritePascalString怎么用?C# GSTCPPacketOut.WritePascalString使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类DOL.GS.PacketHandler.GSTCPPacketOut
的用法示例。
在下文中一共展示了GSTCPPacketOut.WritePascalString方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: SendPlayerTitles
public override void SendPlayerTitles()
{
IList titles = m_gameClient.Player.Titles;
GSTCPPacketOut pak = new GSTCPPacketOut(GetPacketCode(eServerPackets.DetailWindow));
pak.WriteByte(1); // new in 1.75
pak.WritePascalString("Player Statistics"); //window caption
byte line = 1;
foreach (string str in m_gameClient.Player.FormatStatistics())
{
pak.WriteByte(line++);
pak.WritePascalString(str);
}
pak.WriteByte(200);
long titlesCountPos = pak.Position;
pak.WriteByte(0); // length of all titles part
pak.WriteByte((byte)titles.Count);
line = 0;
foreach (IPlayerTitle title in titles)
{
pak.WriteByte(line++);
pak.WritePascalString(title.GetDescription(m_gameClient.Player));
}
long titlesLen = (pak.Position - titlesCountPos - 1); // include titles count
if (titlesLen > byte.MaxValue)
log.WarnFormat("Titles block is too long! {0} (player: {1})", titlesLen, m_gameClient.Player);
//Trailing Zero!
pak.WriteByte(0);
//Set titles length
pak.Position = titlesCountPos;
pak.WriteByte((byte)titlesLen); // length of all titles part
SendTCP(pak);
}
示例2: 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);
}
示例3: SendLoginGranted
public override void SendLoginGranted(byte color)
{
GSTCPPacketOut pak = new GSTCPPacketOut(GetPacketCode(eServerPackets.LoginGranted));
pak.WritePascalString(m_gameClient.Account.Name);
pak.WritePascalString(GameServer.Instance.Configuration.ServerNameShort); //server name
pak.WriteByte(0x0C); //Server ID
pak.WriteByte(color);
pak.WriteByte(0x00);
pak.WriteByte(0x00);
SendTCP(pak);
}
示例4: 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);
}
示例5: SendQuestWindow
protected override void SendQuestWindow(GameNPC questNPC, GamePlayer player, RewardQuest quest, bool offer)
{
GSTCPPacketOut pak = new GSTCPPacketOut(GetPacketCode(eServerPackets.Dialog));
ushort QuestID = QuestMgr.GetIDForQuestType(quest.GetType());
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);
if (quest.Summary.Length > 255)
pak.WritePascalString(quest.Summary.Substring(0,255));
else
pak.WritePascalString(quest.Summary);
if (offer)
{
pak.WriteShort((ushort)quest.Story.Length);
pak.WriteStringBytes(quest.Story);
}
else
{
pak.WriteShort((ushort)quest.Conclusion.Length);
pak.WriteStringBytes(quest.Conclusion);
}
pak.WriteShort(QuestID);
pak.WriteByte((byte)quest.Goals.Count); // #goals count
foreach (RewardQuest.QuestGoal goal in quest.Goals)
{
pak.WritePascalString(String.Format("{0}\r", goal.Description));
}
pak.WriteByte((byte)quest.Level);
pak.WriteByte((byte)quest.Rewards.MoneyPercent);
pak.WriteByte((byte)quest.Rewards.ExperiencePercent(player));
pak.WriteByte((byte)quest.Rewards.BasicItems.Count);
foreach (ItemTemplate reward in quest.Rewards.BasicItems)
WriteTemplateData(pak, reward, 1);
pak.WriteByte((byte)quest.Rewards.ChoiceOf);
pak.WriteByte((byte)quest.Rewards.OptionalItems.Count);
foreach (ItemTemplate reward in quest.Rewards.OptionalItems)
WriteTemplateData(pak, reward, 1);
SendTCP(pak);
}
示例6: 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);
}
}
示例7: SendCustomTextWindow
public override void SendCustomTextWindow(string caption, IList<string> text)
{
if (text == null)
return;
GSTCPPacketOut pak = new GSTCPPacketOut(GetPacketCode(eServerPackets.DetailWindow));
pak.WriteByte(0); // new in 1.75
if (caption == null)
caption = "";
if (caption.Length > byte.MaxValue)
caption = caption.Substring(0, byte.MaxValue);
pak.WritePascalString(caption); //window caption
WriteCustomTextWindowData(pak, text);
//Trailing Zero!
pak.WriteByte(0);
SendTCP(pak);
}
示例8: SendUpdatePlayer
public override void SendUpdatePlayer()
{
GamePlayer player = m_gameClient.Player;
if (player == null)
return;
using (GSTCPPacketOut pak = new GSTCPPacketOut(GetPacketCode(eServerPackets.VariousUpdate)))
{
pak.WriteByte(0x03); //subcode
pak.WriteByte(0x0e); //number of entry
pak.WriteByte(0x00); //subtype
pak.WriteByte(0x00); //unk
//entry :
pak.WriteByte(player.GetDisplayLevel(m_gameClient.Player)); //level
pak.WritePascalString(player.Name);
pak.WriteByte((byte) (player.MaxHealth >> 8)); // maxhealth high byte ?
pak.WritePascalString(player.CharacterClass.Name); // class name
pak.WriteByte((byte) (player.MaxHealth & 0xFF)); // maxhealth low byte ?
pak.WritePascalString( /*"The "+*/player.CharacterClass.Profession); // Profession
pak.WriteByte(0x00); //unk
pak.WritePascalString(player.CharacterClass.GetTitle(player, player.Level));
//todo make function to calcule realm rank
//client.Player.RealmPoints
//todo i think it s realmpoint percent not realrank
pak.WriteByte((byte) player.RealmLevel); //urealm rank
pak.WritePascalString(player.RealmRankTitle(player.Client.Account.Language));
pak.WriteByte((byte) player.RealmSpecialtyPoints); // realm skill points
pak.WritePascalString(player.CharacterClass.BaseName); // base class
pak.WriteByte((byte)(HouseMgr.GetHouseNumberByPlayer(player) >> 8)); // personal house high byte
pak.WritePascalString(player.GuildName);
pak.WriteByte((byte)(HouseMgr.GetHouseNumberByPlayer(player) & 0xFF)); // personal house low byte
pak.WritePascalString(player.LastName);
pak.WriteByte(0x0); // ML Level
pak.WritePascalString(player.RaceName);
pak.WriteByte(0x0);
if (player.GuildRank != null)
pak.WritePascalString(player.GuildRank.Title);
else
pak.WritePascalString("");
pak.WriteByte(0x0);
AbstractCraftingSkill skill = CraftingMgr.getSkillbyEnum(player.CraftingPrimarySkill);
if (skill != null)
pak.WritePascalString(skill.Name); //crafter guilde: alchemist
else
pak.WritePascalString("None"); //no craft skill at start
pak.WriteByte(0x0);
pak.WritePascalString(player.CraftTitle); //crafter title: legendary alchemist
pak.WriteByte(0x0);
pak.WritePascalString("None"); //ML title
// new in 1.75
pak.WriteByte(0x0);
string title = "None";
if (player.CurrentTitle != PlayerTitleMgr.ClearTitle)
title = GameServer.ServerRules.GetPlayerTitle(player, player);
pak.WritePascalString(title); // new in 1.74
SendTCP(pak);
}
}
示例9: SendUpdateIcons
public override void SendUpdateIcons(IList changedEffects, ref int lastUpdateEffectsCount)
{
if (m_gameClient.Player == null)
{
return;
}
IList<int> tooltipids = new List<int>();
using (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;
}
// 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)
{
//.........这里部分代码省略.........
示例10: SendWarmapUpdate
//.........这里部分代码省略.........
{
albStr=(byte)relic.Realm;
}
if(relic.RelicType==eRelicType.Magic)
{
albMagic=(byte)relic.Realm;
}
break;
case eRealm.Hibernia:
if(relic.RelicType==eRelicType.Strength)
{
hibStr=(byte)relic.Realm;
}
if(relic.RelicType==eRelicType.Magic)
{
hibMagic=(byte)relic.Realm;
}
break;
case eRealm.Midgard:
if(relic.RelicType==eRelicType.Strength)
{
midStr=(byte)relic.Realm;
}
if(relic.RelicType==eRelicType.Magic)
{
midMagic=(byte)relic.Realm;
}
break;
}
}
pak.WriteByte(albStr);
pak.WriteByte(midStr);
pak.WriteByte(hibStr);
pak.WriteByte(albMagic);
pak.WriteByte(midMagic);
pak.WriteByte(hibMagic);
foreach (AbstractGameKeep keep in list)
{
int keepId = keep.KeepID;
if (ServerProperties.Properties.USE_NEW_KEEPS == 1 || ServerProperties.Properties.USE_NEW_KEEPS == 2)
{
keepId -= 12;
if ((keep.KeepID > 74 && keep.KeepID < 114) || (keep.KeepID > 330 && keep.KeepID < 370) || (keep.KeepID > 586 && keep.KeepID < 626)
|| (keep.KeepID > 842 && keep.KeepID < 882) || (keep.KeepID > 1098 && keep.KeepID < 1138))
keepId += 5;
}
int id = keepId & 0xFF;
int tower = keep.KeepID >> 8;
int map = (id / 25) - 1;
int index = id - (map * 25 + 25);
// Special Agramon zone
if ((keep.KeepID & 0xFF) > 150)
index = keep.KeepID - 151;
int flag = (byte)keep.Realm; // 3 bits
Guild guild = keep.Guild;
string name = "";
// map is now 0 indexed
pak.WriteByte((byte)(((map - 1) << 6) | (index << 3) | tower));
if (guild != null)
{
flag |= (byte)eRealmWarmapKeepFlags.Claimed;
name = guild.Name;
}
//Teleport
if (m_gameClient.Account.PrivLevel > (int)ePrivLevel.Player)
{
flag |= (byte)eRealmWarmapKeepFlags.Teleportable;
}
else
{
if (GameServer.KeepManager.FrontierRegionsList.Contains(m_gameClient.Player.CurrentRegionID) && m_gameClient.Player.Realm == keep.Realm)
{
GameKeep theKeep = keep as GameKeep;
if (theKeep != null)
{
if (theKeep.OwnsAllTowers && !theKeep.InCombat)
{
flag |= (byte)eRealmWarmapKeepFlags.Teleportable;
}
}
}
}
if (keep.InCombat)
{
flag |= (byte)eRealmWarmapKeepFlags.UnderSiege;
}
pak.WriteByte((byte)flag);
pak.WritePascalString(name);
}
SendTCP(pak);
}
}
示例11: 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
}
示例12: SendTradeWindow
public override void SendTradeWindow()
{
if (m_gameClient.Player == null)
return;
if (m_gameClient.Player.TradeWindow == null)
return;
GSTCPPacketOut pak = new GSTCPPacketOut(GetPacketCode(eServerPackets.TradeWindow));
lock (m_gameClient.Player.TradeWindow.Sync)
{
foreach (InventoryItem item in m_gameClient.Player.TradeWindow.TradeItems)
{
pak.WriteByte((byte)item.SlotPosition);
}
pak.Fill(0x00, 10 - m_gameClient.Player.TradeWindow.TradeItems.Count);
pak.WriteShort(0x0000);
pak.WriteShort((ushort)Money.GetMithril(m_gameClient.Player.TradeWindow.TradeMoney));
pak.WriteShort((ushort)Money.GetPlatinum(m_gameClient.Player.TradeWindow.TradeMoney));
pak.WriteShort((ushort)Money.GetGold(m_gameClient.Player.TradeWindow.TradeMoney));
pak.WriteShort((ushort)Money.GetSilver(m_gameClient.Player.TradeWindow.TradeMoney));
pak.WriteShort((ushort)Money.GetCopper(m_gameClient.Player.TradeWindow.TradeMoney));
pak.WriteShort(0x0000);
pak.WriteShort((ushort)Money.GetMithril(m_gameClient.Player.TradeWindow.PartnerTradeMoney));
pak.WriteShort((ushort)Money.GetPlatinum(m_gameClient.Player.TradeWindow.PartnerTradeMoney));
pak.WriteShort((ushort)Money.GetGold(m_gameClient.Player.TradeWindow.PartnerTradeMoney));
pak.WriteShort((ushort)Money.GetSilver(m_gameClient.Player.TradeWindow.PartnerTradeMoney));
pak.WriteShort((ushort)Money.GetCopper(m_gameClient.Player.TradeWindow.PartnerTradeMoney));
pak.WriteShort(0x0000);
ArrayList items = m_gameClient.Player.TradeWindow.PartnerTradeItems;
if (items != null)
{
pak.WriteByte((byte)items.Count);
pak.WriteByte(0x01);
}
else
{
pak.WriteShort(0x0000);
}
pak.WriteByte((byte)(m_gameClient.Player.TradeWindow.Repairing ? 0x01 : 0x00));
pak.WriteByte((byte)(m_gameClient.Player.TradeWindow.Combine ? 0x01 : 0x00));
if (items != null)
{
foreach (InventoryItem item in items)
{
pak.WriteByte((byte)item.SlotPosition);
pak.WriteByte((byte)item.Level);
pak.WriteByte((byte)item.DPS_AF); // dps_af
pak.WriteByte((byte)item.SPD_ABS); //spd_abs
pak.WriteByte((byte)(item.Hand << 6));
pak.WriteByte((byte)((item.Type_Damage > 3 ? 0 : item.Type_Damage << 6) | item.Object_Type));
pak.WriteShort((ushort)item.Weight); // weight
pak.WriteByte(item.ConditionPercent); // con %
pak.WriteByte(item.DurabilityPercent); // dur %
pak.WriteByte((byte)item.Quality); // qua %
pak.WriteByte((byte)item.Bonus); // bon %
pak.WriteShort((ushort)item.Model); //model
if (item.SlotPosition > Slot.RANGED || item.SlotPosition < Slot.RIGHTHAND)
pak.WriteByte((byte)item.Extension);
pak.WriteShort((ushort)item.Color); //color
pak.WriteShort((ushort)item.Effect); //weaponproc
if (item.Count > 1)
pak.WritePascalString(item.Count + " " + item.Name);
else
pak.WritePascalString(item.Name); //size and name item
}
}
if (m_gameClient.Player.TradeWindow.Partner != null)
pak.WritePascalString("Trading with " + m_gameClient.Player.GetName(m_gameClient.Player.TradeWindow.Partner)); // transaction with ...
else
pak.WritePascalString("Selfcrafting"); // transaction with ...
SendTCP(pak);
}
}
示例13: SendObjectCreate
public override void SendObjectCreate(GameObject obj)
{
if (obj == null || m_gameClient.Player == null)
return;
if (obj.IsVisibleTo(m_gameClient.Player) == false)
return;
using (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
string name = obj.Name;
LanguageDataObject translation = null;
if (obj is GameStaticItem)
{
translation = LanguageMgr.GetTranslation(m_gameClient, (GameStaticItem)obj);
if (translation != null)
{
if (obj is WorldInventoryItem)
{
//if (!Util.IsEmpty(((DBLanguageItem)translation).Name))
// name = ((DBLanguageItem)translation).Name;
}
else
{
if (!Util.IsEmpty(((DBLanguageGameObject)translation).Name))
name = ((DBLanguageGameObject)translation).Name;
}
}
}
pak.WritePascalString(name);
if (obj is IDoor)
{
pak.WriteByte(4);
pak.WriteInt((uint)(obj as IDoor).DoorID);
}
else pak.WriteByte(0x00);
SendTCP(pak);
}
// Update Object Cache
m_gameClient.GameObjectUpdateArray[new Tuple<ushort, ushort>(obj.CurrentRegionID, (ushort)obj.ObjectID)] = GameTimer.GetTickCount();
}
示例14: SendGroupWindowUpdate
public override void SendGroupWindowUpdate()
{
if (m_gameClient.Player == null) return;
GSTCPPacketOut pak = new GSTCPPacketOut(GetPacketCode(eServerPackets.VariousUpdate));
pak.WriteByte(0x06);
Group group = m_gameClient.Player.Group;
if (group == null)
{
pak.WriteByte(0x00);
}
else
{
pak.WriteByte((byte)group.MemberCount);
}
pak.WriteByte(0x01);
pak.WriteByte(0x00);
if (group != null)
{
foreach (GameLiving living in group.GetMembersInTheGroup())
{
bool sameRegion = living.CurrentRegion == m_gameClient.Player.CurrentRegion;
pak.WriteByte(living.Level);
if (sameRegion)
{
pak.WriteByte(living.HealthPercentGroupWindow);
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 && ((GamePlayer)living).Client.ClientState == GameClient.eClientState.Linkdead)
playerStatus |= 0x10;
if (living.CurrentRegion != m_gameClient.Player.CurrentRegion)
playerStatus |= 0x20;
pak.WriteByte(playerStatus);
// 0x00 = Normal , 0x01 = Dead , 0x02 = Mezzed , 0x04 = Diseased ,
// 0x08 = Poisoned , 0x10 = Link Dead , 0x20 = In Another Region
pak.WriteShort((ushort)living.ObjectID);//or session id?
}
else
{
pak.WriteInt(0x20);
pak.WriteShort(0);
}
pak.WritePascalString(living.Name);
pak.WritePascalString(living is GamePlayer ? ((GamePlayer)living).CharacterClass.Name : "NPC");//classname
}
}
SendTCP(pak);
}
示例15: 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);
}