本文整理汇总了C#中DOL.GS.PacketHandler.GSTCPPacketOut.WriteShortLowEndian方法的典型用法代码示例。如果您正苦于以下问题:C# GSTCPPacketOut.WriteShortLowEndian方法的具体用法?C# GSTCPPacketOut.WriteShortLowEndian怎么用?C# GSTCPPacketOut.WriteShortLowEndian使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类DOL.GS.PacketHandler.GSTCPPacketOut
的用法示例。
在下文中一共展示了GSTCPPacketOut.WriteShortLowEndian方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: SendQuestPacket
protected override void SendQuestPacket(AbstractQuest q, int index)
{
if (q == null || !(q is RewardQuest))
{
base.SendQuestPacket(q, index);
return;
}
RewardQuest quest = q as RewardQuest;
GSTCPPacketOut pak = new GSTCPPacketOut(GetPacketCode(eServerPackets.QuestEntry));
pak.WriteByte((byte)index);
pak.WriteByte((byte)quest.Name.Length);
pak.WriteShort(0x00); // unknown
pak.WriteByte((byte)quest.Goals.Count);
pak.WriteByte((byte)quest.Level);
pak.WriteStringBytes(quest.Name);
pak.WritePascalString(quest.Description);
foreach (RewardQuest.QuestGoal goal in quest.Goals)
{
String goalDesc = String.Format("{0}\r", goal.Description);
pak.WriteShortLowEndian((ushort)goalDesc.Length);
pak.WriteStringBytes(goalDesc);
pak.WriteShortLowEndian((ushort)goal.ZoneID2);
pak.WriteShortLowEndian((ushort)goal.XOffset2);
pak.WriteShortLowEndian((ushort)goal.YOffset2);
pak.WriteShortLowEndian(0x00); // unknown
pak.WriteShortLowEndian((ushort)goal.Type);
pak.WriteShortLowEndian(0x00); // unknown
pak.WriteShortLowEndian((ushort)goal.ZoneID1);
pak.WriteShortLowEndian((ushort)goal.XOffset1);
pak.WriteShortLowEndian((ushort)goal.YOffset1);
pak.WriteByte((byte)((goal.IsAchieved) ? 0x01 : 0x00));
if (goal.QuestItem == null)
pak.WriteByte(0x00);
else
{
pak.WriteByte(0x01);
WriteTemplateData(pak, goal.QuestItem, 1);
}
}
SendTCP(pak);
}
示例2: SendCharacterOverview
//.........这里部分代码省略.........
if ((zone = region.GetZone(c.Xpos, c.Ypos)) != null)
{
IList areas = zone.GetAreasOfSpot(c.Xpos, c.Ypos, c.Zpos);
foreach (AbstractArea area in areas)
{
if (!area.DisplayMessage)
continue;
locationDescription = area.Description;
break;
}
if (locationDescription == "")
{
locationDescription = zone.Description;
}
}
}
pak.FillString(locationDescription, 24);
string classname = "";
if (c.Class != 0)
classname = ((eCharacterClass)c.Class).ToString();
pak.FillString(classname, 24);
string racename = GamePlayer.RACENAMES(m_gameClient, c.Race, c.Gender);
pak.FillString(racename, 24);
pak.WriteByte((byte)c.Level);
pak.WriteByte((byte)c.Class);
pak.WriteByte((byte)c.Realm);
pak.WriteByte((byte)((((c.Race & 0x10) << 2) + (c.Race & 0x0F)) | (c.Gender << 4))); // race max value can be 0x1F
pak.WriteShortLowEndian((ushort)c.CurrentModel);
pak.WriteByte((byte)c.Region);
if (region == null || (int)m_gameClient.ClientType > region.Expansion)
pak.WriteByte(0x00);
else
pak.WriteByte((byte)(region.Expansion + 1)); //0x04-Cata zone, 0x05 - DR zone
pak.WriteInt(0x0); // Internal database ID
pak.WriteByte((byte)c.Strength);
pak.WriteByte((byte)c.Dexterity);
pak.WriteByte((byte)c.Constitution);
pak.WriteByte((byte)c.Quickness);
pak.WriteByte((byte)c.Intelligence);
pak.WriteByte((byte)c.Piety);
pak.WriteByte((byte)c.Empathy);
pak.WriteByte((byte)c.Charisma);
InventoryItem rightHandWeapon = null;
charItems.TryGetValue(eInventorySlot.RightHandWeapon, out rightHandWeapon);
InventoryItem leftHandWeapon = null;
charItems.TryGetValue(eInventorySlot.LeftHandWeapon, out leftHandWeapon);
InventoryItem twoHandWeapon = null;
charItems.TryGetValue(eInventorySlot.TwoHandWeapon, out twoHandWeapon);
InventoryItem distanceWeapon = null;
charItems.TryGetValue(eInventorySlot.DistanceWeapon, out distanceWeapon);
InventoryItem helmet = null;
charItems.TryGetValue(eInventorySlot.HeadArmor, out helmet);
InventoryItem gloves = null;
charItems.TryGetValue(eInventorySlot.HandsArmor, out gloves);
InventoryItem boots = null;
charItems.TryGetValue(eInventorySlot.FeetArmor, out boots);
InventoryItem torso = null;
charItems.TryGetValue(eInventorySlot.TorsoArmor, out torso);
示例3: SendTaskInfo
protected override void SendTaskInfo()
{
string name = BuildTaskString();
using (GSTCPPacketOut pak = new GSTCPPacketOut(GetPacketCode(eServerPackets.QuestEntry)))
{
pak.WriteByte(0); //index
pak.WriteShortLowEndian((ushort)name.Length);
pak.WriteByte((byte)0);
pak.WriteStringBytes(name); //Write Quest Name without trailing 0
pak.WriteStringBytes(""); //Write Quest Description without trailing 0
SendTCP(pak);
}
}
示例4: SendCharacterOverview
//.........这里部分代码省略.........
if (description == "")
{
description = zon.Description;
LanguageDataObject translation = LanguageMgr.GetTranslation(m_gameClient, zon);
if (translation != null)
{
if (!Util.IsEmpty(((DBLanguageZone)translation).ScreenDescription)) // Thats correct!
description = ((DBLanguageZone)translation).ScreenDescription;
}
}
pak.FillString(description, 24);
}
else
{
pak.Fill(0x0, 24); //No known location
}
if (characters[j].Class == 0)
{
pak.FillString("", 24); //Class name
}
else
{
pak.FillString(((eCharacterClass)characters[j].Class).ToString(), 24); //Class name
}
//pak.FillString(GamePlayer.RACENAMES[characters[j].Race], 24);
pak.FillString(GamePlayer.RACENAMES(m_gameClient, characters[j].Race, characters[j].Gender), 24);
pak.WriteByte((byte)characters[j].Level);
pak.WriteByte((byte)characters[j].Class);
pak.WriteByte((byte)characters[j].Realm);
pak.WriteByte((byte)((((characters[j].Race & 0x10) << 2) + (characters[j].Race & 0x0F)) | (characters[j].Gender << 4))); // race max value can be 0x1F
pak.WriteShortLowEndian((ushort)characters[j].CurrentModel);
pak.WriteByte((byte)characters[j].Region);
if (reg == null || (int)m_gameClient.ClientType > reg.Expansion)
pak.WriteByte(0x00);
else
pak.WriteByte((byte)(reg.Expansion + 1)); //0x04-Cata zone, 0x05 - DR zone
pak.WriteInt(0x0); // Internal database ID
pak.WriteByte((byte)characters[j].Strength);
pak.WriteByte((byte)characters[j].Dexterity);
pak.WriteByte((byte)characters[j].Constitution);
pak.WriteByte((byte)characters[j].Quickness);
pak.WriteByte((byte)characters[j].Intelligence);
pak.WriteByte((byte)characters[j].Piety);
pak.WriteByte((byte)characters[j].Empathy);
pak.WriteByte((byte)characters[j].Charisma);
int found = 0;
//16 bytes: armor model
for (int k = 0x15; k < 0x1D; k++)
{
found = 0;
foreach (InventoryItem item in items)
{
if (item.SlotPosition == k && found == 0)
{
pak.WriteShortLowEndian((ushort)item.Model);
found = 1;
}
}
if (found == 0)
pak.WriteShort(0x00);
}
//16 bytes: armor color
示例5: SendCharacterOverview
public override void SendCharacterOverview(eRealm realm)
{
int firstAccountSlot;
switch (realm)
{
case eRealm.Albion: firstAccountSlot = 100; break;
case eRealm.Midgard: firstAccountSlot = 200; break;
case eRealm.Hibernia: firstAccountSlot = 300; break;
default: throw new Exception("CharacterOverview requested for unknown realm " + realm);
}
using (GSTCPPacketOut pak = new GSTCPPacketOut(GetPacketCode(eServerPackets.CharacterOverview)))
{
pak.FillString(m_gameClient.Account.Name, 24);
IList<InventoryItem> items;
DOLCharacters[] characters = m_gameClient.Account.Characters;
if (characters == null)
{
pak.Fill(0x0, 1840);
}
else
{
for (int i = firstAccountSlot; i < firstAccountSlot + 10; i++)
{
bool written = false;
for (int j = 0; j < characters.Length && written == false; j++)
if (characters[j].AccountSlot == i)
{
pak.FillString(characters[j].Name, 24);
items = GameServer.Database.SelectObjects<InventoryItem>("`OwnerID` = @OwnerID AND `SlotPosition` >= @SlotPositionMin AND `SlotPosition` <= @SlotPositionMax",
new[] { new QueryParameter("@OwnerID", characters[j].ObjectId), new QueryParameter("@SlotPositionMin", 10), new QueryParameter("@SlotPositionMax", 37) });
byte ExtensionTorso = 0;
byte ExtensionGloves = 0;
byte ExtensionBoots = 0;
foreach (InventoryItem item in items)
{
switch (item.SlotPosition)
{
case 22:
ExtensionGloves = item.Extension;
break;
case 23:
ExtensionBoots = item.Extension;
break;
case 25:
ExtensionTorso = item.Extension;
break;
default:
break;
}
}
pak.WriteByte(0x01);
pak.WriteByte((byte)characters[j].EyeSize);
pak.WriteByte((byte)characters[j].LipSize);
pak.WriteByte((byte)characters[j].EyeColor);
pak.WriteByte((byte)characters[j].HairColor);
pak.WriteByte((byte)characters[j].FaceType);
pak.WriteByte((byte)characters[j].HairStyle);
pak.WriteByte((byte)((ExtensionBoots << 4) | ExtensionGloves));
pak.WriteByte((byte)((ExtensionTorso << 4) | (characters[j].IsCloakHoodUp ? 0x1 : 0x0)));
pak.WriteByte((byte)characters[j].CustomisationStep); //1 = auto generate config, 2= config ended by player, 3= enable config to player
pak.Fill(0x0, 14); //0 String
Region reg = WorldMgr.GetRegion((ushort)characters[j].Region);
if (reg != null)
{
var description = m_gameClient.GetTranslatedSpotDescription(reg, characters[j].Xpos, characters[j].Ypos, characters[j].Zpos);
pak.FillString(description, 24);
}
else
pak.Fill(0x0, 24); //No known location
if (characters[j].Class == 0)
pak.FillString("", 24); //Class name
else
pak.FillString(((eCharacterClass)characters[j].Class).ToString(), 24); //Class name
//pak.FillString(GamePlayer.RACENAMES[characters[j].Race], 24);
pak.FillString(m_gameClient.RaceToTranslatedName(characters[j].Race, characters[j].Gender), 24);
pak.WriteByte((byte)characters[j].Level);
pak.WriteByte((byte)characters[j].Class);
pak.WriteByte((byte)characters[j].Realm);
pak.WriteByte((byte)((((characters[j].Race & 0x10) << 2) + (characters[j].Race & 0x0F)) | (characters[j].Gender << 4))); // race max value can be 0x1F
pak.WriteShortLowEndian((ushort)characters[j].CurrentModel);
pak.WriteByte((byte)characters[j].Region);
if (reg == null || (int)m_gameClient.ClientType > reg.Expansion)
pak.WriteByte(0x00);
else
pak.WriteByte((byte)(reg.Expansion + 1)); //0x04-Cata zone, 0x05 - DR zone
pak.WriteInt(0x0); // Internal database ID
pak.WriteByte((byte)characters[j].Strength);
pak.WriteByte((byte)characters[j].Dexterity);
pak.WriteByte((byte)characters[j].Constitution);
pak.WriteByte((byte)characters[j].Quickness);
pak.WriteByte((byte)characters[j].Intelligence);
pak.WriteByte((byte)characters[j].Piety);
pak.WriteByte((byte)characters[j].Empathy);
pak.WriteByte((byte)characters[j].Charisma);
//.........这里部分代码省略.........
示例6: SendQuestPacket
protected override void SendQuestPacket(AbstractQuest quest, int index)
{
using (GSTCPPacketOut pak = new GSTCPPacketOut(GetPacketCode(eServerPackets.QuestEntry)))
{
pak.WriteByte((byte)index);
if (quest.Step <= 0)
{
pak.WriteByte(0);
pak.WriteByte(0);
pak.WriteByte(0);
}
else
{
string name = quest.Name;
string desc = quest.Description;
if (name.Length > byte.MaxValue)
{
if (log.IsWarnEnabled) log.Warn(quest.GetType().ToString() + ": name is too long for 1.71 clients (" + name.Length + ") '" + name + "'");
name = name.Substring(0, byte.MaxValue);
}
if (desc.Length > ushort.MaxValue)
{
if (log.IsWarnEnabled) log.Warn(quest.GetType().ToString() + ": description is too long for 1.71 clients (" + desc.Length + ") '" + desc + "'");
desc = desc.Substring(0, ushort.MaxValue);
}
if (name.Length + desc.Length > 2048 - 10)
{
if (log.IsWarnEnabled) log.Warn(quest.GetType().ToString() + ": name + description length is too long and would have crashed the client.\nName (" + name.Length + "): '" + name + "'\nDesc (" + desc.Length + "): '" + desc + "'");
name = name.Substring(0, 32);
desc = desc.Substring(0, 2048 - 10 - name.Length); // all that's left
}
pak.WriteByte((byte)name.Length);
pak.WriteShortLowEndian((ushort)desc.Length);
pak.WriteStringBytes(name); //Write Quest Name without trailing 0
pak.WriteStringBytes(desc); //Write Quest Description without trailing 0
}
SendTCP(pak);
}
}
示例7: SendChampionTrainerWindow
public virtual void SendChampionTrainerWindow(int type)
{
using (var pak = new GSTCPPacketOut(GetPacketCode(eServerPackets.TrainerWindow)))
{
pak.WriteByte((byte) type);
pak.WriteByte((byte) m_gameClient.Player.ChampionSpecialtyPoints);
pak.WriteByte(2);
pak.WriteByte(0);
pak.WriteByte(6);
for (int skillIndex = 1; skillIndex < 7; skillIndex++)
{
IList specs = ChampSpecMgr.GetAbilityForIndex(type, skillIndex);
pak.WriteByte((byte) skillIndex);
pak.WriteByte((byte) specs.Count);
foreach (ChampSpec spec in specs)
{
Spell spell = SkillBase.GetSpellByID(spec.SpellID);
pak.WriteByte((byte)spec.Index);
if (spell != null)
{
if (spell.SpellType == "StyleHandler")
{
pak.WriteByte(1);
}
else
{
pak.WriteByte(3);
}
pak.WriteShortLowEndian(spell.Icon); // Icon should be style icon + 3352
pak.WritePascalString(spell.Name);
if (m_gameClient.Player.HasChampionSpell(spec.SpellID))
{
pak.WriteByte(1);
}
else if (m_gameClient.Player.CanTrainChampionSpell(type, skillIndex, spec.Index))
{
pak.WriteByte(2);
}
else
{
pak.WriteByte(0);
}
pak.WriteByte(0);
}
else
{
log.ErrorFormat("Missing champion spell ID: {0} for ID line: {1}, SpecIndex {2}, SkillIndex {3}", spec.SpellID, spec.IdLine, spec.Index, skillIndex);
ChatUtil.SendDebugMessage(m_gameClient, string.Format("Missing champion spell ID: {0} for ID line: {1}, SpecIndex {2}, SkillIndex {3}", spec.SpellID, spec.IdLine, spec.Index, skillIndex));
pak.WriteByte(3);
pak.WriteShortLowEndian(0);
pak.WritePascalString("Missing Spell " + spec.SpellID);
pak.WriteByte(0);
pak.WriteByte(0);
}
}
}
SendTCP(pak);
}
}
示例8: SendPlayerCreate
public override void SendPlayerCreate(GamePlayer playerToCreate)
{
if (playerToCreate == null)
{
if (log.IsErrorEnabled)
log.Error("SendPlayerCreate: playerToCreate == null");
return;
}
if (m_gameClient.Player == null)
{
if (log.IsErrorEnabled)
log.Error("SendPlayerCreate: m_gameClient.Player == null");
return;
}
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 (playerToCreate.IsVisibleTo(m_gameClient.Player) == false)
return;
using (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 - send out the 'fake' zone ID to the client for positioning purposes.
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.MoodType)); //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;
if (playerToCreate.CharacterClass.ID == (int)eCharacterClass.Vampiir) flags |= 0x40; //Vamp fly
pak.WriteByte((byte)flags);
pak.WriteByte(0x00); // new in 1.74
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));
//RR 12 / 13
pak.WritePascalString(GameServer.ServerRules.GetPlayerPrefixName(m_gameClient.Player, playerToCreate));
pak.WritePascalString(GameServer.ServerRules.GetPlayerTitle(m_gameClient.Player, playerToCreate)); // new in 1.74, NewTitle
if (playerToCreate.IsOnHorse)
{
pak.WriteByte(playerToCreate.ActiveHorse.ID);
if (playerToCreate.ActiveHorse.BardingColor == 0 && playerToCreate.ActiveHorse.Barding != 0 && playerToCreate.Guild != null)
{
int newGuildBitMask = (playerToCreate.Guild.Emblem & 0x010000) >> 9;
pak.WriteByte((byte)(playerToCreate.ActiveHorse.Barding | newGuildBitMask));
pak.WriteShortLowEndian((ushort)playerToCreate.Guild.Emblem);
}
else
{
pak.WriteByte(playerToCreate.ActiveHorse.Barding);
pak.WriteShort(playerToCreate.ActiveHorse.BardingColor);
}
pak.WriteByte(playerToCreate.ActiveHorse.Saddle);
pak.WriteByte(playerToCreate.ActiveHorse.SaddleColor);
}
else
{
pak.WriteByte(0); // trailing zero
}
SendTCP(pak);
}
// Update Cache
m_gameClient.GameObjectUpdateArray[new Tuple<ushort, ushort>(playerToCreate.CurrentRegionID, (ushort)playerToCreate.ObjectID)] = GameTimer.GetTickCount();
//.........这里部分代码省略.........
示例9: SendSessionID
public virtual void SendSessionID()
{
using (var pak = new GSTCPPacketOut(GetPacketCode(eServerPackets.SessionID)))
{
pak.WriteShortLowEndian((ushort) m_gameClient.SessionID);
SendTCP(pak);
}
}
示例10: SendCharacterOverview
public virtual void SendCharacterOverview(eRealm realm)
{
int firstAccountSlot;
switch (realm)
{
case eRealm.Albion:
firstAccountSlot = 100;
break;
case eRealm.Midgard:
firstAccountSlot = 200;
break;
case eRealm.Hibernia:
firstAccountSlot = 300;
break;
default:
throw new Exception("CharacterOverview requested for unknown realm " + realm);
}
using (var pak = new GSTCPPacketOut(GetPacketCode(eServerPackets.CharacterOverview)))
{
pak.FillString(m_gameClient.Account.Name, 24);
DOLCharacters[] characters = m_gameClient.Account.Characters;
if (characters == null)
{
pak.Fill(0x0, 1848);
}
else
{
for (int i = firstAccountSlot; i < firstAccountSlot + 8; i++)
{
bool written = false;
for (int j = 0; j < characters.Length && written == false; j++)
if (characters[j].AccountSlot == i)
{
pak.FillString(characters[j].Name, 24);
pak.Fill(0x0, 24); //0 String
Region reg = WorldMgr.GetRegion((ushort) characters[j].Region);
Zone zon = null;
if (reg != null)
zon = reg.GetZone(characters[j].Xpos, characters[j].Ypos);
if (zon != null)
{
IList areas = zon.GetAreasOfSpot(characters[j].Xpos, characters[j].Ypos, characters[j].Zpos);
string description = "";
foreach (AbstractArea area in areas)
{
if (!area.DisplayMessage)
continue;
description = area.Description;
break;
}
if (description == "")
description = zon.Description;
pak.FillString(description, 24);
}
else
pak.Fill(0x0, 24); //No known location
pak.FillString("", 24); //Class name
//pak.FillString(GamePlayer.RACENAMES[characters[j].Race], 24);
pak.FillString(GamePlayer.RACENAMES(m_gameClient, characters[j].Race, characters[j].Gender), 24);
pak.WriteByte((byte) characters[j].Level);
pak.WriteByte((byte) characters[j].Class);
pak.WriteByte((byte) characters[j].Realm);
pak.WriteByte(
(byte) ((((characters[j].Race & 0x10) << 2) + (characters[j].Race & 0x0F)) | (characters[j].Gender << 4)));
// race max value can be 0x1F
pak.WriteShortLowEndian((ushort) characters[j].CurrentModel);
pak.WriteByte((byte) characters[j].Region);
if (reg == null || (int) m_gameClient.ClientType > reg.Expansion)
pak.WriteByte(0x00);
else
pak.WriteByte((byte) (reg.Expansion + 1)); //0x04-Cata zone, 0x05 - DR zone
pak.WriteInt(0x0); // Internal database ID
pak.WriteByte((byte) characters[j].Strength);
pak.WriteByte((byte) characters[j].Dexterity);
pak.WriteByte((byte) characters[j].Constitution);
pak.WriteByte((byte) characters[j].Quickness);
pak.WriteByte((byte) characters[j].Intelligence);
pak.WriteByte((byte) characters[j].Piety);
pak.WriteByte((byte) characters[j].Empathy);
pak.WriteByte((byte) characters[j].Charisma);
var items = GameServer.Database.SelectObjects<InventoryItem>("OwnerID = '" + GameServer.Database.Escape(characters[j].ObjectId) +
"' AND SlotPosition >='10' AND SlotPosition <= '29'");
int found = 0;
//16 bytes: armor model
for (int k = 0x15; k < 0x1D; k++)
{
found = 0;
foreach (InventoryItem item in items)
{
if (item.SlotPosition == k && found == 0)
//.........这里部分代码省略.........
示例11: SendQuestPacket
protected override void SendQuestPacket(AbstractQuest quest, int index)
{
using (GSTCPPacketOut pak = new GSTCPPacketOut(GetPacketCode(eServerPackets.QuestEntry)))
{
pak.WriteByte((byte) index);
if (quest == null)
{
pak.WriteByte(0);
pak.WriteByte(0);
pak.WriteByte(0);
pak.WriteByte(0);
pak.WriteByte(0);
}
else
{
string name = string.Format("{0} (Level {1})", quest.Name, quest.Level);
string desc = string.Format("[Step #{0}]: {1}", quest.Step, quest.Description);
if (name.Length > byte.MaxValue)
{
if (log.IsWarnEnabled) log.Warn(quest.GetType().ToString() + ": name is too long for 1.68+ clients (" + name.Length + ") '" + name + "'");
name = name.Substring(0, byte.MaxValue);
}
if (desc.Length > byte.MaxValue)
{
if (log.IsWarnEnabled) log.Warn(quest.GetType().ToString() + ": description is too long for 1.68+ clients (" + desc.Length + ") '" + desc + "'");
desc = desc.Substring(0, byte.MaxValue);
}
pak.WriteByte((byte)name.Length);
pak.WriteShortLowEndian((ushort)desc.Length);
pak.WriteByte(0); // Quest Zone ID ?
pak.WriteByte(0);
pak.WriteStringBytes(name); //Write Quest Name without trailing 0
pak.WriteStringBytes(desc); //Write Quest Description without trailing 0
}
SendTCP(pak);
}
}
示例12: SendChampionTrainerWindow
public virtual void SendChampionTrainerWindow(int type)
{
if (m_gameClient.Player == null)
return;
GamePlayer player = m_gameClient.Player;
using (var pak = new GSTCPPacketOut(GetPacketCode(eServerPackets.TrainerWindow)))
{
// Get Player CL Spec
var clspec = player.GetSpecList().Where(sp => sp is LiveChampionsSpecialization).Cast<LiveChampionsSpecialization>().FirstOrDefault();
// check if the tree can be used
List<Tuple<MiniLineSpecialization, List<Tuple<Skill, byte>>>> tree = null;
if (clspec != null)
{
tree = clspec.GetTrainerTreeDisplay(player, clspec.RetrieveTypeForIndex(type));
}
if (tree != null && tree.Count > 0)
{
pak.WriteByte((byte) type); // index for Champion Line ID (returned for training request)
pak.WriteByte((byte) player.ChampionSpecialtyPoints); // Spec points available for this player.
pak.WriteByte(2); // Champion Window Type
pak.WriteByte(0);
pak.WriteByte((byte)tree.Count); // Count of sublines
for (int skillIndex = 0; skillIndex < tree.Count; skillIndex++)
{
pak.WriteByte((byte) (skillIndex + 1));
pak.WriteByte((byte) tree[skillIndex].Item2.Where(t => t.Item1 != null).Count()); // Count of item for this line
for (int itemIndex = 0; itemIndex < tree[skillIndex].Item2.Count; itemIndex++)
{
Skill sk = tree[skillIndex].Item2[itemIndex].Item1;
if (sk != null)
{
pak.WriteByte((byte)(itemIndex + 1));
if (sk is Style)
{
pak.WriteByte(2);
}
else if (sk is Spell)
{
pak.WriteByte(3);
}
else
{
pak.WriteByte(1);
}
pak.WriteShortLowEndian(sk.Icon); // Icon should be style icon + 3352 ???
pak.WritePascalString(sk.Name);
// Skill Status
pak.WriteByte(clspec.GetSkillStatus(tree, skillIndex, itemIndex).Item1); // 0 = disable, 1 = trained, 2 = can train
// Attached Skill
if (tree[skillIndex].Item2[itemIndex].Item2 == 2)
{
pak.WriteByte(2); // count of attached skills
pak.WriteByte((byte)(skillIndex << 8 + itemIndex));
pak.WriteByte((byte)((skillIndex + 2) << 8 + itemIndex));
}
else if(tree[skillIndex].Item2[itemIndex].Item2 == 3)
{
pak.WriteByte(3); // count of attached skills
pak.WriteByte((byte)(skillIndex << 8 + itemIndex));
pak.WriteByte((byte)((skillIndex + 1) << 8 + itemIndex));
pak.WriteByte((byte)((skillIndex + 2) << 8 + itemIndex));
}
else
{
// doesn't support other count
pak.WriteByte(0);
}
}
}
}
SendTCP(pak);
}
}
}
示例13: SendCustomTrainerWindow
public virtual void SendCustomTrainerWindow(int type, List<Tuple<Specialization, List<Tuple<Skill, byte>>>> tree)
{
if (m_gameClient.Player == null)
return;
GamePlayer player = m_gameClient.Player;
using (var pak = new GSTCPPacketOut(GetPacketCode(eServerPackets.TrainerWindow)))
{
if (tree != null && tree.Count > 0)
{
pak.WriteByte((byte) type); // index for Champion Line ID (returned for training request)
pak.WriteByte((byte) 0); // Spec points available for this player.
pak.WriteByte(2); // Champion Window Type
pak.WriteByte(0);
pak.WriteByte((byte)tree.Count); // Count of sublines
for (int skillIndex = 0; skillIndex < tree.Count; skillIndex++)
{
pak.WriteByte((byte) (skillIndex + 1));
pak.WriteByte((byte) tree[skillIndex].Item2.Where(t => t.Item1 != null).Count()); // Count of item for this line
for (int itemIndex = 0; itemIndex < tree[skillIndex].Item2.Count; itemIndex++)
{
Skill sk = tree[skillIndex].Item2[itemIndex].Item1;
if (sk != null)
{
pak.WriteByte((byte)(itemIndex + 1));
if (sk is Style)
{
pak.WriteByte(2);
}
else if (sk is Spell)
{
pak.WriteByte(3);
}
else
{
pak.WriteByte(4);
}
pak.WriteShortLowEndian(sk.Icon); // Icon should be style icon + 3352 ???
pak.WritePascalString(sk.Name);
// Skill Status
pak.WriteByte(1); // 0 = disable, 1 = trained, 2 = can train
// Attached Skill
if (tree[skillIndex].Item2[itemIndex].Item2 == 2)
{
pak.WriteByte(2); // count of attached skills
pak.WriteByte((byte)(skillIndex << 8 + itemIndex));
pak.WriteByte((byte)((skillIndex + 2) << 8 + itemIndex));
}
else if(tree[skillIndex].Item2[itemIndex].Item2 == 3)
{
pak.WriteByte(3); // count of attached skills
pak.WriteByte((byte)(skillIndex << 8 + itemIndex));
pak.WriteByte((byte)((skillIndex + 1) << 8 + itemIndex));
pak.WriteByte((byte)((skillIndex + 2) << 8 + itemIndex));
}
else
{
// doesn't support other count
pak.WriteByte(0);
}
}
}
}
SendTCP(pak);
}
}
}
示例14: SendCombatAnimation
public override void SendCombatAnimation(GameObject attacker, GameObject defender, ushort weaponID, ushort shieldID, int style, byte stance, byte result, byte targetHealthPercent)
{
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 (defender is GameLiving)
{
targetHealthPercent = (defender as GameLiving).HealthPercent;
}
pak.WriteByte(targetHealthPercent);
pak.WriteByte(0);//unk
SendTCP(pak);
}
示例15: SendNonHybridSpellLines
/// <summary>
/// Send non hybrid and advanced spell lines
/// </summary>
public override void SendNonHybridSpellLines()
{
GamePlayer player = m_gameClient.Player;
if (player == null)
return;
List<Tuple<SpellLine, List<Skill>>> spellsXLines = player.GetAllUsableListSpells(true);
int lineIndex = 0;
foreach (var spXsl in spellsXLines)
{
// Prepare packet
using(var pak = new GSTCPPacketOut(GetPacketCode(eServerPackets.VariousUpdate)))
{
// Add Line Header
pak.WriteByte(0x02); //subcode
pak.WriteByte((byte)(spXsl.Item2.Count + 1)); //number of entry
pak.WriteByte(0x02); //subtype
pak.WriteByte((byte)lineIndex); //number of line
pak.WriteShortLowEndian(0); // level, not used when spell line
pak.WriteShort((ushort)spXsl.Item1.InternalID); //new 1.112
pak.WriteShort(0); // icon, not used when spell line
pak.WritePascalString(spXsl.Item1.Name);
// Add All Spells...
foreach (Skill sk in spXsl.Item2)
{
if (sk is Spell)
{
Spell sp = (Spell)sk;
pak.WriteShortLowEndian((byte)sp.Level);
pak.WriteShort((ushort)sp.InternalID); //new 1.112
pak.WriteShort(sp.Icon);
pak.WritePascalString(sp.Name);
}
else
{
int reqLevel = 1;
if (sk is Style)
reqLevel = ((Style)sk).SpecLevelRequirement;
else if (sk is Ability)
reqLevel = ((Ability)sk).SpecLevelRequirement;
pak.WriteShortLowEndian((ushort)((byte)reqLevel + (sk is Style ? 512 : 256)));
pak.WriteShort((ushort)sk.InternalID); //new 1.112
pak.WriteShort(sk.Icon);
pak.WritePascalString(sk.Name);
}
}
// Send
SendTCP(pak);
}
lineIndex++;
}
// Footer packet
using (GSTCPPacketOut pak3 = new GSTCPPacketOut(GetPacketCode(eServerPackets.VariousUpdate)))
{
pak3.WriteByte(0x02); //subcode
pak3.WriteByte(0x00);
pak3.WriteByte(99); //subtype (new subtype 99 in 1.80e)
pak3.WriteByte(0x00);
SendTCP(pak3);
}
if (ForceTooltipUpdate)
SendForceTooltipUpdate(spellsXLines.SelectMany(e => e.Item2));
}