Skip to content

Commit

Permalink
Removed RSBot.Theme library. Use standart windows components (#99)
Browse files Browse the repository at this point in the history
  • Loading branch information
SDClowen authored Mar 21, 2022
1 parent 78159ce commit d6a7b6c
Show file tree
Hide file tree
Showing 72 changed files with 476 additions and 3,827 deletions.
4 changes: 0 additions & 4 deletions Application/RSBot/RSBot.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -199,10 +199,6 @@
<Project>{b62c693a-62e0-4d29-8702-dd8b3b6b308b}</Project>
<Name>RSBot.Pk2</Name>
</ProjectReference>
<ProjectReference Include="..\..\Library\RSBot.Theme\RSBot.Theme.csproj">
<Project>{9e2a3ce3-d977-4e96-9f56-49288cf7d6b3}</Project>
<Name>RSBot.Theme</Name>
</ProjectReference>
</ItemGroup>
<ItemGroup>
<PublishFile Include="application.ico">
Expand Down
10 changes: 2 additions & 8 deletions Application/RSBot/Views/About.Designer.cs

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

45 changes: 15 additions & 30 deletions Application/RSBot/Views/Controls/Character.Designer.cs

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

59 changes: 29 additions & 30 deletions Application/RSBot/Views/Controls/Character.cs
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ private void SubscribeEvents()
EventManager.SubscribeEvent("OnLoadCharacterStats", OnLoadCharacterStats);
EventManager.SubscribeEvent("OnLevelUp", OnLevelUp);
EventManager.SubscribeEvent("OnExpSpUpdate", OnExpUpdate);
EventManager.SubscribeEvent("OnUpdateHPMP", OnHPMPUpdate);
EventManager.SubscribeEvent("OnUpdateHPMP", OnLoadCharacterStats);
EventManager.SubscribeEvent("OnUpdateGold", OnUpdateGold);
EventManager.SubscribeEvent("OnUpdateSP", OnUpdateSP);
EventManager.SubscribeEvent("OnAgentServerDisconnected", OnAgentServerDisconnected);
Expand All @@ -45,10 +45,28 @@ private void OnUpdateGold()
/// <summary>
/// On Hp/MP update
/// </summary>
private void OnHPMPUpdate()
private void OnLoadCharacterStats()
{
progressHP.Position = (int)Game.Player.Health;
progressMP.Position = (int)Game.Player.Mana;
lblInt.Text = Game.Player.Intelligence.ToString();
lblStr.Text = Game.Player.Strength.ToString();

if (Game.Player.MaximumHealth == 0)
return;

if (Game.Player.MaximumMana == 0)
return;

progressHP.Maximum = Game.Player.MaximumHealth;
progressMP.Maximum = Game.Player.MaximumMana;

if(Game.Player.Health > Game.Player.MaximumHealth)
progressHP.Maximum = Game.Player.Health;

if (Game.Player.Mana > Game.Player.MaximumMana)
progressMP.Maximum = Game.Player.Mana;

progressHP.Value = Game.Player.Health;
progressMP.Value = Game.Player.Mana;

progressHP.Text = Game.Player.Health + @"/" + Game.Player.MaximumHealth;
progressMP.Text = Game.Player.Mana + @"/" + Game.Player.MaximumMana;
Expand All @@ -60,29 +78,10 @@ private void OnHPMPUpdate()
/// <exception cref="System.NotImplementedException"></exception>
private void OnExpUpdate()
{
var percentageExp = ((double)Game.Player.Experience / (double)Game.ReferenceManager.GetRefLevel(Game.Player.Level).Exp_C) * 100;
progressEXP.Position = Convert.ToInt32(percentageExp);
progressEXP.Text = Math.Round(percentageExp, 2) + @"%";
}
var percentageExp = (Game.Player.Experience * 100.0) / Game.ReferenceManager.GetRefLevel(Game.Player.Level).Exp_C;

/// <summary>
/// s the on load character stats.
/// </summary>
private void OnLoadCharacterStats()
{
lblInt.Text = Game.Player.Intelligence.ToString();
lblStr.Text = Game.Player.Strength.ToString();

progressHP.PositionMax = (int)Game.Player.MaximumHealth;
progressMP.PositionMax = (int)Game.Player.MaximumMana;

progressHP.Position = (int)Game.Player.Health;
progressMP.Position = (int)Game.Player.Mana;

progressEXP.PositionMax = 100;

progressHP.Text = Game.Player.Health + @"/" + Game.Player.MaximumHealth;
progressMP.Text = Game.Player.Mana + @"/" + Game.Player.MaximumMana;
progressEXP.Value = Convert.ToInt32(percentageExp);
progressEXP.Text = Math.Round(percentageExp, 2) + @"%";
}

/// <summary>
Expand All @@ -101,7 +100,7 @@ private void OnLoadCharacter()
lblPlayerName.Text = Game.Player.Name;
lblLevel.Text = Game.Player.Level.ToString();

OnHPMPUpdate();
OnLoadCharacterStats();
OnExpUpdate();
OnUpdateSP();
OnUpdateGold();
Expand All @@ -118,11 +117,11 @@ private void OnAgentServerDisconnected()
lblInt.Text = "0";
lblGold.Text = "0";
lblSP.Text = "0";
progressHP.Position = 0;
progressHP.Value = 0;
progressHP.Text = "0 / 0";
progressMP.Position = 0;
progressMP.Value = 0;
progressMP.Text = "0 / 0";
progressEXP.Position = 0;
progressEXP.Value = 0;
progressEXP.Text = "%0";
}
}
Expand Down
15 changes: 5 additions & 10 deletions Application/RSBot/Views/Controls/Entity.Designer.cs

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

14 changes: 10 additions & 4 deletions Application/RSBot/Views/Controls/Entity.cs
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,10 @@ private void OnSelectEntity(SpawnedBionic entity)
lblType.Text = monster.Rarity.GetName();
}

progressHP.Position = percent;
if (percent > 100)
percent = 100;

progressHP.Value = percent;
progressHP.Text = percent + "%";
}

Expand All @@ -58,15 +61,18 @@ private void OnUpdateSelectedEntityHP(SpawnedBionic entity)
{
if (!entity.HasHealth)
{
progressHP.Position = 100;
progressHP.Value = 100;
return;
}

if (entity is SpawnedMonster monster)
{
var percent = (monster.Health * 100) / monster.MaxHealth;
if (percent > 100)
percent = 100;

progressHP.Position = percent;
progressHP.Maximum = monster.MaxHealth;
progressHP.Value = percent;
progressHP.Text = percent + "%";
}
}
Expand Down Expand Up @@ -101,7 +107,7 @@ private void OnAgentServerDisconnected()
private void Clear()
{
lblEntityName.Text = "No entity selected";
progressHP.Position = 0;
progressHP.Value = 0;
progressHP.Text ="0%";
lblType.Text = "";
}
Expand Down
45 changes: 15 additions & 30 deletions Application/RSBot/Views/Controls/Pet.Designer.cs

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading

0 comments on commit d6a7b6c

Please sign in to comment.