diff --git a/Application/RSBot/Views/Controls/Entity.cs b/Application/RSBot/Views/Controls/Entity.cs
index 17ccc760..99b902a3 100644
--- a/Application/RSBot/Views/Controls/Entity.cs
+++ b/Application/RSBot/Views/Controls/Entity.cs
@@ -32,14 +32,15 @@ private void SubscribeEvents()
///
private void OnSelectEntity(SpawnedBionic entity)
{
+
+ var percent = 100;
+ lblType.Text = string.Empty;
+
if (entity is SpawnedPlayer player)
lblEntityName.Text = player.Name;
else
lblEntityName.Text = entity.Record.GetRealName();
- var percent = 0;
- lblType.Text = string.Empty;
-
if (entity is SpawnedMonster monster)
{
percent = (monster.Health * 100) / monster.MaxHealth;
diff --git a/Library/RSBot.Core/Network/Handler/Agent/Action/ActionSelectResponse.cs b/Library/RSBot.Core/Network/Handler/Agent/Action/ActionSelectResponse.cs
index 8ab3aa98..4096ca74 100644
--- a/Library/RSBot.Core/Network/Handler/Agent/Action/ActionSelectResponse.cs
+++ b/Library/RSBot.Core/Network/Handler/Agent/Action/ActionSelectResponse.cs
@@ -40,8 +40,6 @@ public void Invoke(Packet packet)
Core.Game.SelectedEntity = entity;
- EventManager.FireEvent("OnSelectEntity", entity);
-
if (entity is SpawnedMonster)
{
var hasHealth = packet.ReadBool();
@@ -68,6 +66,8 @@ public void Invoke(Packet packet)
entity.Talk.Deserialize(packet);
}
*/
+
+ EventManager.FireEvent("OnSelectEntity", entity);
}
}
}
\ No newline at end of file
diff --git a/Library/RSBot.Core/Network/Handler/Agent/Character/CharacterDataEndResponse.cs b/Library/RSBot.Core/Network/Handler/Agent/Character/CharacterDataEndResponse.cs
index 445cd9e8..2e7e06e1 100644
--- a/Library/RSBot.Core/Network/Handler/Agent/Character/CharacterDataEndResponse.cs
+++ b/Library/RSBot.Core/Network/Handler/Agent/Character/CharacterDataEndResponse.cs
@@ -49,8 +49,8 @@ public void Invoke(Packet packet)
character.StatPoints = packet.ReadUShort();
character.BerzerkPoints = packet.ReadByte();
character.ExperienceChunk = packet.ReadUInt();
- character.Health = packet.ReadUInt();
- character.Mana = packet.ReadUInt();
+ character.Health = packet.ReadInt();
+ character.Mana = packet.ReadInt();
character.AutoInverstExperience = (AutoInverstType)packet.ReadByte();
if (Core.Game.ClientType == GameClientType.Chinese)
diff --git a/Library/RSBot.Core/Network/Handler/Agent/Character/CharacterDataResponse.cs b/Library/RSBot.Core/Network/Handler/Agent/Character/CharacterDataResponse.cs
index 8f867c21..6eeb7b79 100644
--- a/Library/RSBot.Core/Network/Handler/Agent/Character/CharacterDataResponse.cs
+++ b/Library/RSBot.Core/Network/Handler/Agent/Character/CharacterDataResponse.cs
@@ -24,7 +24,8 @@ internal class CharacterDataResponse : IPacketHandler
/// The packet.
public void Invoke(Packet packet)
{
- if (Core.Game.CharacterPacket == null) return; //Something went wrong between start and stop!
+ if (Core.Game.CharacterPacket == null)
+ return;
Core.Game.CharacterPacket.WriteByteArray(packet.GetBytes());
}
diff --git a/Library/RSBot.Core/Network/Handler/Agent/Cos/CosDataResponse.cs b/Library/RSBot.Core/Network/Handler/Agent/Cos/CosDataResponse.cs
index f6d444a2..5eecbc1b 100644
--- a/Library/RSBot.Core/Network/Handler/Agent/Cos/CosDataResponse.cs
+++ b/Library/RSBot.Core/Network/Handler/Agent/Cos/CosDataResponse.cs
@@ -41,7 +41,9 @@ public void Invoke(Packet packet)
}
else if (objChar.TypeID2 == 2 && objChar.TypeID3 == 3 && objChar.TypeID4 == 1)
{
- Core.Game.Player.Vehicle = Vehicle.FromPacket(packet, uniqueId, objectId);
+ var health = packet.ReadInt();
+
+ Core.Game.Player.Vehicle = new Vehicle(uniqueId, objectId, health);
EventManager.FireEvent("OnSummonVehicle");
Log.Debug("Mount vehicle");
diff --git a/Library/RSBot.Core/Network/Handler/Agent/Entity/EntityUpdateStatusResponse.cs b/Library/RSBot.Core/Network/Handler/Agent/Entity/EntityUpdateStatusResponse.cs
index d3e13fea..04a2b6dd 100644
--- a/Library/RSBot.Core/Network/Handler/Agent/Entity/EntityUpdateStatusResponse.cs
+++ b/Library/RSBot.Core/Network/Handler/Agent/Entity/EntityUpdateStatusResponse.cs
@@ -48,13 +48,13 @@ private static void UpdatePlayerStatus(Packet packet, EntityUpdateStatusFlag upd
{
if ((updateFlag & EntityUpdateStatusFlag.HP) == EntityUpdateStatusFlag.HP)
{
- Core.Game.Player.Health = packet.ReadUInt();
+ Core.Game.Player.Health = packet.ReadInt();
EventManager.FireEvent("OnUpdateHP");
}
if ((updateFlag & EntityUpdateStatusFlag.MP) == EntityUpdateStatusFlag.MP)
{
- Core.Game.Player.Mana = packet.ReadUInt();
+ Core.Game.Player.Mana = packet.ReadInt();
EventManager.FireEvent("OnUpdateMP");
}
@@ -98,7 +98,7 @@ private static void UpdatePlayerStatus(Packet packet, EntityUpdateStatusFlag upd
private static void UpdatePetStatus(Packet packet, EntityUpdateStatusFlag updateFlag)
{
if ((updateFlag & EntityUpdateStatusFlag.HP) == EntityUpdateStatusFlag.HP)
- Core.Game.Player.AttackPet.Health = packet.ReadUInt();
+ Core.Game.Player.AttackPet.Health = packet.ReadInt();
if ((updateFlag & EntityUpdateStatusFlag.MP) == EntityUpdateStatusFlag.MP)
packet.ReadUInt();
@@ -144,7 +144,7 @@ private static void UpdatePetStatus(Packet packet, EntityUpdateStatusFlag update
private static void UpdateVehicleStatus(Packet packet, EntityUpdateStatusFlag updateFlag)
{
if ((updateFlag & EntityUpdateStatusFlag.HP) == EntityUpdateStatusFlag.HP)
- Core.Game.Player.Vehicle.Health = packet.ReadUInt();
+ Core.Game.Player.Vehicle.Health = packet.ReadInt();
if ((updateFlag & EntityUpdateStatusFlag.MP) == EntityUpdateStatusFlag.MP)
packet.ReadUInt();
diff --git a/Library/RSBot.Core/Objects/AbilityPet.cs b/Library/RSBot.Core/Objects/Cos/AbilityPet.cs
similarity index 88%
rename from Library/RSBot.Core/Objects/AbilityPet.cs
rename to Library/RSBot.Core/Objects/Cos/AbilityPet.cs
index cbfb84e7..c8e7673c 100644
--- a/Library/RSBot.Core/Objects/AbilityPet.cs
+++ b/Library/RSBot.Core/Objects/Cos/AbilityPet.cs
@@ -1,37 +1,12 @@
-using RSBot.Core.Client.ReferenceObjects;
-using RSBot.Core.Network;
-using RSBot.Core.Objects.Item;
+using RSBot.Core.Network;
+using RSBot.Core.Objects.Spawn;
using System.Collections.Generic;
using System.Linq;
namespace RSBot.Core.Objects
{
- public class AbilityPet
+ public class AbilityPet : SpawnedEntity
{
- ///
- /// Gets or sets the unique identifier.
- ///
- ///
- /// The unique identifier.
- ///
- public uint UniqueId { get; set; }
-
- ///
- /// Gets or sets the identifier.
- ///
- ///
- /// The identifier.
- ///
- public uint Id { get; set; }
-
- ///
- /// Gets the record.
- ///
- ///
- /// The record.
- ///
- public RefObjChar Record => Game.ReferenceManager.GetRefObjChar(Id);
-
///
/// Gets or sets the name.
///
diff --git a/Library/RSBot.Core/Objects/AttackPet.cs b/Library/RSBot.Core/Objects/Cos/AttackPet.cs
similarity index 73%
rename from Library/RSBot.Core/Objects/AttackPet.cs
rename to Library/RSBot.Core/Objects/Cos/AttackPet.cs
index e164ae51..ca1aad69 100644
--- a/Library/RSBot.Core/Objects/AttackPet.cs
+++ b/Library/RSBot.Core/Objects/Cos/AttackPet.cs
@@ -3,50 +3,19 @@
using RSBot.Core.Event;
using RSBot.Core.Network;
using RSBot.Core.Objects.Spawn;
+using System;
using System.Linq;
using System.Timers;
namespace RSBot.Core.Objects
{
- public class AttackPet
+ public class AttackPet : SpawnedBionic
{
- #region Fields
-
- private Timer _hungerTimer;
-
- #endregion Fields
-
- ///
- /// Gets or sets the unique identifier.
- ///
- ///
- /// The unique identifier.
- ///
- public uint UniqueId { get; set; }
-
- ///
- /// Gets or sets the identifier.
- ///
- ///
- /// The identifier.
- ///
- public uint Id { get; set; }
-
- ///
- /// Gets the record.
- ///
- ///
- /// The record.
- ///
- public RefObjChar Record => Game.ReferenceManager.GetRefObjChar(Id);
-
///
- /// Gets or sets the current hp.
+ ///
///
- ///
- /// The current hp.
- ///
- public uint Health { get; set; }
+ ///
+ public AttackPet(uint objId) : base(objId) {}
///
/// Gets or sets the experience.
@@ -102,7 +71,7 @@ public class AttackPet
///
/// The maximum health.
///
- public uint MaxHealth { get; set; }
+ public int MaxHealth { get; set; }
///
/// Gets or sets the bionic.
@@ -113,12 +82,9 @@ public class AttackPet
public SpawnedBionic Bionic => SpawnManager.GetEntity(UniqueId);
///
- /// Gets or sets the bad effect.
+ /// Hunger last tick
///
- ///
- /// The bad effect.
- ///
- public BadEffect BadEffect { get; set; }
+ private int _lastHungerTick;
///
/// Froms the packet.
@@ -129,14 +95,14 @@ public class AttackPet
///
internal static AttackPet FromPacket(Packet packet, uint uniqueId, uint id)
{
- var result = new AttackPet
+ var result = new AttackPet(id)
{
UniqueId = uniqueId,
Id = id,
- Health = packet.ReadUInt()
+ Health = packet.ReadInt()
};
- var maxHealth = packet.ReadUInt(); //UNKNOWN
+ var maxHealth = packet.ReadInt(); //UNKNOWN
result.MaxHealth = maxHealth != 0 ? maxHealth : result.Health;
result.Experience = packet.ReadULong();
@@ -145,7 +111,6 @@ internal static AttackPet FromPacket(Packet packet, uint uniqueId, uint id)
packet.ReadInt(); //UNKNOWN (maybe control?)
result.Name = packet.ReadString();
- result.StartHungerTimer();
return result;
}
@@ -161,27 +126,6 @@ public void Terminate()
PacketManager.SendPacket(packet, PacketDestination.Server);
}
- ///
- /// Starts the hunger timer.
- ///
- private void StartHungerTimer()
- {
- _hungerTimer = new Timer(3000);
- _hungerTimer.Elapsed += HungerTimer_Elapsed;
- _hungerTimer.Start();
- }
-
- ///
- /// Handles the Elapsed event of the HungerTimer control.
- ///
- /// The source of the event.
- /// The instance containing the event data.
- private void HungerTimer_Elapsed(object sender, ElapsedEventArgs e)
- {
- CurrentHungerPoints--;
- EventManager.FireEvent("OnAttackPetHungerUpdate");
- }
-
///
/// Uses the health potion.
///
@@ -247,5 +191,19 @@ public bool UseHungerPotion()
return true;
}
+
+ ///
+ /// Update the entity
+ ///
+ public override bool Update()
+ {
+ if(Environment.TickCount - _lastHungerTick > 3000)
+ {
+ CurrentHungerPoints--;
+ EventManager.FireEvent("OnAttackPetHungerUpdate");
+ }
+
+ return base.Update();
+ }
}
}
\ No newline at end of file
diff --git a/Library/RSBot.Core/Objects/Vehicle.cs b/Library/RSBot.Core/Objects/Cos/Vehicle.cs
similarity index 70%
rename from Library/RSBot.Core/Objects/Vehicle.cs
rename to Library/RSBot.Core/Objects/Cos/Vehicle.cs
index 2621cc68..ecd3e689 100644
--- a/Library/RSBot.Core/Objects/Vehicle.cs
+++ b/Library/RSBot.Core/Objects/Cos/Vehicle.cs
@@ -1,5 +1,4 @@
-using RSBot.Core.Client.ReferenceObjects;
-using RSBot.Core.Network;
+using RSBot.Core.Network;
using RSBot.Core.Objects.Spawn;
using System;
using System.Linq;
@@ -7,39 +6,19 @@
namespace RSBot.Core.Objects
{
- public class Vehicle : SpawnedEntity
+ public class Vehicle : SpawnedBionic
{
///
- /// Gets or sets the current health.
+ ///
///
- ///
- /// The current health.
- ///
- public uint Health { get; set; }
-
- ///
- /// Gets or sets the bad effect.
- ///
- ///
- /// The bad effect.
- ///
- public BadEffect BadEffect { get; set; }
-
- ///
- /// Froms the packet.
- ///
- /// The packet.
- /// The unique identifier.
- /// The identifier.
- ///
- internal static Vehicle FromPacket(Packet packet, uint uniqueId, uint id)
+ /// The entity model id
+ /// The entity unique id
+ /// The current health
+ public Vehicle(uint objId, uint uniqueId, int health)
+ : base(objId)
{
- return new Vehicle
- {
- UniqueId = uniqueId,
- Id = id,
- Health = packet.ReadUInt()
- };
+ UniqueId = uniqueId;
+ Health = health;
}
///
diff --git a/Library/RSBot.Core/Objects/Player.cs b/Library/RSBot.Core/Objects/Player.cs
index 475af1ce..10039d89 100644
--- a/Library/RSBot.Core/Objects/Player.cs
+++ b/Library/RSBot.Core/Objects/Player.cs
@@ -100,21 +100,13 @@ public class Player : SpawnedBionic
///
public uint ExperienceChunk { get; set; }
- ///
- /// Gets or sets the health.
- ///
- ///
- /// The health.
- ///
- public uint Health { get; set; }
-
///
/// Gets or sets the mana.
///
///
/// The mana.
///
- public uint Mana { get; set; }
+ public int Mana { get; set; }
///
/// Gets or sets the automatic inverst experience.
@@ -420,14 +412,6 @@ public class Player : SpawnedBionic
///
public bool InAction { get; set; }
- ///
- /// Gets or sets the bad effect.
- ///
- ///
- /// The bad effect.
- ///
- public BadEffect BadEffect { get; set; }
-
///
/// Gets or sets a value indicating whether this is untouchable.
/// Will be set automatically after telportation.
diff --git a/Library/RSBot.Core/Objects/Spawn/SpawnedBionic.cs b/Library/RSBot.Core/Objects/Spawn/SpawnedBionic.cs
index 04ef3cc5..a7b981f7 100644
--- a/Library/RSBot.Core/Objects/Spawn/SpawnedBionic.cs
+++ b/Library/RSBot.Core/Objects/Spawn/SpawnedBionic.cs
@@ -37,6 +37,14 @@ public class SpawnedBionic : SpawnedEntity
///
public int Health { get; set; }
+ ///
+ /// Gets or sets the bad effect.
+ ///
+ ///
+ /// The bad effect.
+ ///
+ public BadEffect BadEffect { get; set; }
+
///
///
///
diff --git a/Library/RSBot.Core/Objects/Spawn/SpawnedEntity.cs b/Library/RSBot.Core/Objects/Spawn/SpawnedEntity.cs
index 3ce063ff..ceb6119e 100644
--- a/Library/RSBot.Core/Objects/Spawn/SpawnedEntity.cs
+++ b/Library/RSBot.Core/Objects/Spawn/SpawnedEntity.cs
@@ -224,9 +224,8 @@ public void StopMoving(Position pos)
/// Update the instance
///
///
- public bool Update()
+ public virtual bool Update()
{
-
return false;
}
diff --git a/Library/RSBot.Core/Objects/Spawn/SpawnedSpellArea.cs b/Library/RSBot.Core/Objects/Spawn/SpawnedSpellArea.cs
index 8d0d5076..ea73cffb 100644
--- a/Library/RSBot.Core/Objects/Spawn/SpawnedSpellArea.cs
+++ b/Library/RSBot.Core/Objects/Spawn/SpawnedSpellArea.cs
@@ -16,7 +16,7 @@ public class SpawnedSpellArea : SpawnedEntity
///
/// The record.
///
- public RefSkill Record => Game.ReferenceManager.GetRefSkill(SkillId);
+ public new RefSkill Record => Game.ReferenceManager.GetRefSkill(SkillId);
///
/// Froms the packet.
diff --git a/Library/RSBot.Core/RSBot.Core.csproj b/Library/RSBot.Core/RSBot.Core.csproj
index ab5ee7b0..d91a5a86 100644
--- a/Library/RSBot.Core/RSBot.Core.csproj
+++ b/Library/RSBot.Core/RSBot.Core.csproj
@@ -73,6 +73,8 @@
+
+
@@ -215,9 +217,9 @@
-
+
-
+
@@ -282,7 +284,7 @@
-
+
diff --git a/Library/RSBot.Loader.Library/Library.cpp b/Library/RSBot.Loader.Library/Library.cpp
index 75b67e9f..393ebaf0 100644
--- a/Library/RSBot.Loader.Library/Library.cpp
+++ b/Library/RSBot.Loader.Library/Library.cpp
@@ -50,7 +50,7 @@ HANDLE WINAPI User_CreateMutexA(LPSECURITY_ATTRIBUTES lpMutexAttributes, BOOL bI
if (lpName && strcmp(lpName, "Silkroad Client") == 0)
{
char newName[128] = { 0 };
- _snprintf_s(newName, sizeof(newName), sizeof(newName) / sizeof(newName[0]) - 1, "Silkroad Client_%d", 0xFFFFFFFF & __rdtsc());
+ _snprintf_s(newName, sizeof(newName), sizeof(newName) / sizeof(newName[0]) - 1, "Silkroad Client_%lld", 0xFFFFFFFF & __rdtsc());
return Real_CreateMutexA(lpMutexAttributes, bInitialOwner, newName);
}
return Real_CreateMutexA(lpMutexAttributes, bInitialOwner, lpName);
@@ -76,7 +76,7 @@ HANDLE WINAPI User_CreateSemaphoreA(LPSECURITY_ATTRIBUTES lpSemaphoreAttributes,
if (lpName && strcmp(lpName, "Global\\Silkroad Client") == 0)
{
char newName[128] = { 0 };
- _snprintf_s(newName, sizeof(newName), sizeof(newName) / sizeof(newName[0]) - 1, "Global\\Silkroad Client_%d", 0xFFFFFFFF & __rdtsc());
+ _snprintf_s(newName, sizeof(newName), sizeof(newName) / sizeof(newName[0]) - 1, "Global\\Silkroad Client_%lld", 0xFFFFFFFF & __rdtsc());
return Real_CreateSemaphoreA(lpSemaphoreAttributes, lInitialCount, lMaximumCount, newName);
}
@@ -115,7 +115,7 @@ int WINAPI Detour_connect(SOCKET s, const struct sockaddr* name, int len)
for (auto& gatewayAddress : g_RealGatewayAddresses)
{
- struct in_addr maddr;
+ struct in_addr maddr = {0};
maddr.s_addr = *(u_long*)gethostbyname(gatewayAddress.c_str())->h_addr_list[0];
if (strcmp(inet_ntoa(editing->sin_addr), inet_ntoa(maddr)) == 0 && htons(editing->sin_port) == g_RealGatewayPort)
{
diff --git a/Plugins/RSBot.General/Components/AutoLogin.cs b/Plugins/RSBot.General/Components/AutoLogin.cs
index 768735e6..b0c0b01d 100644
--- a/Plugins/RSBot.General/Components/AutoLogin.cs
+++ b/Plugins/RSBot.General/Components/AutoLogin.cs
@@ -19,17 +19,14 @@ public static void DelayedLoginTry()
if (!GlobalConfig.Get("RSBot.General.EnableAutomatedLogin"))
{
Log.Warn("A new login attempt will be made shortly...");
- Task.Delay(1000).ContinueWith((e) =>
- {
- DoAutoLogin();
- });
+ DoAutoLogin();
}
}
///
/// Does the automatic login.
///
- public static async Task DoAutoLogin()
+ public static async void DoAutoLogin()
{
if (!GlobalConfig.Get("RSBot.General.EnableAutomatedLogin"))
return;
diff --git a/Plugins/RSBot.Party/Views/AutoFormParty.cs b/Plugins/RSBot.Party/Views/AutoFormParty.cs
index 1a15dd7b..ef15a3a4 100644
--- a/Plugins/RSBot.Party/Views/AutoFormParty.cs
+++ b/Plugins/RSBot.Party/Views/AutoFormParty.cs
@@ -35,14 +35,18 @@ private void AutoFormParty_Load(object sender, EventArgs e)
else if ((byte)Bundle.Container.PartyMatching.Config.Purpose > 1)
rbtn_Hunting.Checked = true;
- tb_Title.Text = Bundle.Container.PartyMatching.Config.Title;
-
var settingStr = Game.Party.Settings.ToString().Split(new[] { Environment.NewLine }, StringSplitOptions.RemoveEmptyEntries);
label_partytype.Text = settingStr[0];
label_partytype2.Text = settingStr[1];
min_level.Value = Bundle.Container.PartyMatching.Config.LevelFrom;
max_level.Value = Bundle.Container.PartyMatching.Config.LevelTo;
+
+ if (!Game.Party.Settings.ExperienceAutoShare &&
+ !Game.Party.Settings.ItemAutoShare)
+ tb_Title.Text = "Auto LTP - RSBot";
+ else
+ tb_Title.Text = Bundle.Container.PartyMatching.Config.Title;
}
private void btnAccept_Click(object sender, EventArgs e)
@@ -71,10 +75,19 @@ private void radioCheckedChanged(object sender, EventArgs e)
return;
Bundle.Container.PartyMatching.Config.Purpose = partyPurpose;
- tb_Title.Text = Game.ReferenceManager.GetTranslation("UIIT_MSG_PARTYMATCH_RECORD_DEFAULT" + rbtn?.Tag.ToString());
- if (!string.IsNullOrWhiteSpace(tb_Title.Text))
- Bundle.Container.PartyMatching.Config.Title = tb_Title.Text;
+ if (!Game.Party.Settings.ExperienceAutoShare &&
+ !Game.Party.Settings.ItemAutoShare)
+ {
+ tb_Title.Text = "Auto LTP - RSBot";
+ }
+ else
+ {
+ tb_Title.Text = Game.ReferenceManager.GetTranslation("UIIT_MSG_PARTYMATCH_RECORD_DEFAULT" + rbtn?.Tag.ToString());
+
+ if (!string.IsNullOrWhiteSpace(tb_Title.Text))
+ Bundle.Container.PartyMatching.Config.Title = tb_Title.Text;
+ }
}
}
}
\ No newline at end of file
diff --git a/Plugins/RSBot.Shopping/Bootstrap.cs b/Plugins/RSBot.Shopping/Bootstrap.cs
index 9ea37a0e..d1f7fa63 100644
--- a/Plugins/RSBot.Shopping/Bootstrap.cs
+++ b/Plugins/RSBot.Shopping/Bootstrap.cs
@@ -20,7 +20,7 @@ public class Bootstrap : IPlugin
InternalName = "RSBot.Items",
LoadIndex = 5,
TabDisplayIndex = 5,
- RequireIngame = false
+ RequireIngame = true
};
///