Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions Library/RSBot.Core/Client/ReferenceManager.cs
Original file line number Diff line number Diff line change
Expand Up @@ -23,11 +23,11 @@ public class ReferenceManager
public Dictionary<string, RefText> TextData { get; } = new(70000);
public Dictionary<uint, RefObjChar> CharacterData { get; } = new(20000);
public Dictionary<uint, RefObjItem> ItemData { get; } = new(30000);
public Dictionary<byte, RefLevel> LevelData { get; } = new(128);
public Dictionary<byte, RefLevel> LevelData { get; } = new(150);
public Dictionary<uint, RefQuest> QuestData { get; } = new(2048);
public Dictionary<uint, RefSkill> SkillData { get; } = new(40000);
public Dictionary<uint, RefSkillMastery> SkillMasteryData { get; } = new(32);
public Dictionary<int, RefAbilityByItemOptLevel> AbilityItemByOptLevel { get; } = new(512);
public Dictionary<int, RefAbilityByItemOptLevel> AbilityItemByOptLevel { get; } = new(1024);
public List<RefSkillByItemOptLevel> SkillByItemOptLevels { get; } = new(1024);
public List<RefExtraAbilityByEquipItemOptLevel> ExtraAbilityByEquipItemOptLevel { get; } = new(50000);
public Dictionary<string, RefShop> Shops { get; } = new(128);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ public void Invoke(Packet packet)
{
Packet = new Packet(0x3019),
Type = packet.ReadByte(),
Amount = packet.ReadUShort(),
Amount = Game.ClientType >= GameClientType.Chinese ? packet.ReadULong() : packet.ReadUShort(),
};
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ public void Invoke(Packet packet)
packet = Game.SpawnInfo.Packet;
packet.Lock();

for (var i = 0; i < Game.SpawnInfo.Amount; i++)
for (var i = 0UL; i < Game.SpawnInfo.Amount; i++)
try
{
switch (Game.SpawnInfo.Type)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ internal class EntitySingleSpawnResponse : IPacketHandler
/// <param name="packet">The packet.</param>
public void Invoke(Packet packet)
{
SpawnManager.Parse(packet);
// 0x3015 contains exactly one entity and includes the single-spawn trailer.
SpawnManager.Parse(packet, isGroup: false);
}
}
106 changes: 85 additions & 21 deletions Library/RSBot.Core/Objects/NpcTalk.cs
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,26 @@ public class NpcTalk
/// </value>
public byte[] Options { get; set; }

/// <summary>
/// Gets or sets the custom talk name.
/// </summary>
public string CustomName { get; set; }

/// <summary>
/// Gets or sets the talk option flags used by supported client formats.
/// </summary>
public ulong OptionFlags { get; set; }

/// <summary>
/// Gets or sets the custom talk data type.
/// </summary>
public byte CustomType { get; set; }

/// <summary>
/// Gets or sets the custom talk data identifier.
/// </summary>
public uint CustomId { get; set; }

/// <summary>
/// Deserialize from the packet
/// </summary>
Expand All @@ -28,29 +48,73 @@ public void Deserialize(Packet packet)
{
Flag = packet.ReadByte();

if ((Flag & 2) > 0)
if (Game.ClientType <= GameClientType.Thailand)
{
if ((Flag & 1) != 0)
CustomName = packet.ReadString();

if ((Flag & 2) != 0)
Options = packet.ReadBytes(4);

return;
}

if (Game.ClientType >= GameClientType.Vietnam && Game.ClientType <= GameClientType.Chinese)
{
var count = 4;
if (Game.ClientType > GameClientType.Thailand)
count = packet.ReadByte();

if (
Game.ClientType == GameClientType.Global
|| Game.ClientType == GameClientType.Turkey
|| Game.ClientType == GameClientType.VTC_Game
|| Game.ClientType == GameClientType.RuSro
|| Game.ClientType == GameClientType.Korean
|| Game.ClientType == GameClientType.Japanese
|| Game.ClientType == GameClientType.Taiwan
)
count = 7;

Options = packet.ReadBytes(count);
if ((Flag & 1) != 0)
CustomName = packet.ReadString();

if ((Flag & 2) != 0)
{
var count = packet.ReadByte();
Options = packet.ReadBytes(count);
}

if ((Flag & 4) != 0)
{
CustomType = packet.ReadByte();
CustomId = packet.ReadUInt();
}

return;
}

// pandora box, after spawned mobs
if (Flag == 6)
if (packet.ReadByte() == 1) // maybe
packet.ReadUInt();
if (
Game.ClientType == GameClientType.Turkey
|| Game.ClientType == GameClientType.VTC_Game
|| Game.ClientType == GameClientType.Taiwan
|| Game.ClientType == GameClientType.Japanese
|| Game.ClientType == GameClientType.RuSro
|| Game.ClientType == GameClientType.Rigid
)
{
if ((Flag & 1) != 0)
CustomName = packet.ReadString();

if ((Flag & 2) != 0)
OptionFlags = packet.ReadULong();

if ((Flag & 4) != 0)
{
CustomType = packet.ReadByte();
CustomId = packet.ReadUInt();
}

return;
}

if (Game.ClientType == GameClientType.Global || Game.ClientType == GameClientType.Korean)
{
if ((Flag & 1) != 0)
OptionFlags = packet.ReadULong();

if ((Flag & 2) != 0)
{
CustomType = packet.ReadByte();
CustomId = packet.ReadUInt();
}

return;
}
}
}
2 changes: 1 addition & 1 deletion Library/RSBot.Core/Objects/Spawn/SpawnPacketInfo.cs
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ internal class SpawnPacketInfo
/// <value>
/// The amount.
/// </value>
public ushort Amount { get; set; }
public ulong Amount { get; set; }

/// <summary>
/// Gets or sets the packet.
Expand Down
Loading