Skip to content

Commit

Permalink
better pinging, tooltips, fix some labels.
Browse files Browse the repository at this point in the history
  • Loading branch information
agaertner authored and dlamkins committed Oct 1, 2020
1 parent dc5f846 commit 075a8d3
Show file tree
Hide file tree
Showing 6 changed files with 49 additions and 34 deletions.
1 change: 1 addition & 0 deletions Controls/PlayerButton.cs
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
using Blish_HUD;
using Blish_HUD.ArcDps.Common;
using Blish_HUD.Controls;
using Blish_HUD.Input;
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Graphics;
using MonoGame.Extended.BitmapFonts;
Expand Down
1 change: 1 addition & 0 deletions KillProof Module.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -152,6 +152,7 @@
</ItemGroup>
<ItemGroup />
<ItemGroup>
<EmbeddedResource Include="Properties\Resources.de.resx" />
<EmbeddedResource Include="Properties\Resources.resx">
<Generator>ResXFileCodeGenerator</Generator>
<LastGenOutput>Resources.Designer.cs</LastGenOutput>
Expand Down
59 changes: 34 additions & 25 deletions KillProofModule.cs
Original file line number Diff line number Diff line change
Expand Up @@ -516,6 +516,7 @@ private void PlayerAddedEvent(CommonFields.Player player)
{
if (player.Self && _localPlayerButton != null)
{
_localPlayerButton.BasicTooltipText = "";
_localPlayerButton.Player = player;
_localPlayerButton.Icon = GetEliteRender(player);
_localPlayerButton.LeftMouseButtonPressed += delegate
Expand Down Expand Up @@ -620,7 +621,8 @@ private Panel BuildHomePanel(WindowBase wndw)
Location = new Point(0, 0),
Font = GameService.Content.GetFont(ContentService.FontFace.Menomonia,
ContentService.FontSize.Size16,
ContentService.FontStyle.Regular)
ContentService.FontStyle.Regular),
BasicTooltipText = RefreshMapToSeeYourProfile
};
}

Expand All @@ -633,7 +635,7 @@ private Panel BuildHomePanel(WindowBase wndw)
var labAccountName = new Label
{
Parent = header,
Size = new Point(200, 30),
Size = new Point(300, 30),
Location = new Point(header.Width / 2 - 100, header.Height / 2 + 30 + TOP_MARGIN),
StrokeText = true,
ShowShadow = true,
Expand Down Expand Up @@ -1303,7 +1305,7 @@ private Panel BuildKillProofQuickMenu()
};
var cooldownSend = DateTimeOffset.Now;
var hotButtonTimeSend = DateTimeOffset.Now;
var reduction = -1;
var reduction = 0;
var currentValue = 0;
sendButton.LeftMouseButtonReleased += delegate
{
Expand All @@ -1327,33 +1329,37 @@ private Panel BuildKillProofQuickMenu()
if (tokenSelection.Count == 0) return;
var singleRandomToken = tokenSelection.ElementAt(RandomUtil.GetRandom(0, tokenSelection.Count - 1));
chatLink.ItemId = singleRandomToken.Id;
var amount = _myKillProof.GetToken(singleRandomToken.Id)?.Amount ?? 0;
if (amount <= 250) {
chatLink.Quantity = Convert.ToByte(amount);
var totalAmount = _myKillProof.GetToken(singleRandomToken.Id)?.Amount ?? 0;
if (totalAmount <= 250) {
chatLink.Quantity = Convert.ToByte(totalAmount);
GameService.GameIntegration.Chat.Send(chatLink.ToString());
return;
}

var reductionTimes = amount / 250 - 1;
var reductionTimes = totalAmount / 250;
cooldown = DateTimeOffset.Now.Subtract(hotButtonTimeSend);

if (cooldown.TotalMilliseconds > 500)
{
reduction = -1;
reduction = 0;
currentValue = 0;
}

if (reduction < reductionTimes)
{
reduction++;
amount = 250 - reduction;
chatLink.Quantity = Convert.ToByte(amount);
currentValue += amount;

var tempAmount = 250 - reduction;
if (RandomUtil.GetRandom(0, 10) > 4)
{
currentValue += tempAmount;
reduction++;
}
chatLink.Quantity = Convert.ToByte(tempAmount);

} else {

chatLink.Quantity = Convert.ToByte(amount % currentValue);
reduction = -1;
chatLink.Quantity = Convert.ToByte(totalAmount % currentValue);
reduction = 0;
currentValue = 0;
cooldownSend = DateTimeOffset.Now;
}
Expand All @@ -1370,33 +1376,36 @@ private Panel BuildKillProofQuickMenu()
var token = _myKillProof.GetToken(dropdown.SelectedItem);
if (token == null) return;
chatLink.ItemId = token.Id;
var amount = token.Amount;
if (amount <= 250) {
chatLink.Quantity = Convert.ToByte(amount);
var totalAmount = token.Amount;
if (totalAmount <= 250) {
chatLink.Quantity = Convert.ToByte(totalAmount);
GameService.GameIntegration.Chat.Send(chatLink.ToString());
return;
}

var reductionTimes = amount / 250 - 1;
var reductionTimes = totalAmount / 250;
cooldown = DateTimeOffset.Now.Subtract(hotButtonTimeSend);

if (cooldown.TotalMilliseconds > 500)
{
reduction = -1;
reduction = 0;
currentValue = 0;
}

if (reduction < reductionTimes)
{
reduction++;
amount = 250 - reduction;
chatLink.Quantity = Convert.ToByte(amount);
currentValue += amount;
var tempAmount = 250 - reduction;
if (RandomUtil.GetRandom(0, 10) > 4)
{
currentValue += tempAmount;
reduction++;
}
chatLink.Quantity = Convert.ToByte(tempAmount);

} else {

chatLink.Quantity = Convert.ToByte(amount % currentValue);
reduction = -1;
chatLink.Quantity = Convert.ToByte(totalAmount % currentValue);
reduction = 0;
currentValue = 0;
cooldownSend = DateTimeOffset.Now;
}
Expand Down
4 changes: 3 additions & 1 deletion Properties/Resources.de.resx
Original file line number Diff line number Diff line change
Expand Up @@ -138,7 +138,9 @@
<comment>Toggle checkbox</comment>
</data>
<data name="Shows a menu on the top left corner of your screen which allows you to quickly access and ping your killproofs." xml:space="preserve">
<value>Zeigt ein Menü in der oberen linken Ecke deines Bildschirms an welches dir erlaubt schnell auf deine KillProofs zuzugreifen und sie anderen mitzuteilen.</value>
<value>Zeigt ein Menü in der oberen linken Ecke deines Bildschirms an welches
dir erlaubt schnell auf deine KillProofs zuzugreifen und sie anderen mitzuteilen.
Wird erst nach einem Kartenwechsel geladen.</value>
<comment>Smart Ping Menu: Checkbox description.</comment>
</data>
<data name="You started Blish HUD while Guild Wars 2 was already running." xml:space="preserve">
Expand Down
14 changes: 8 additions & 6 deletions Properties/Resources.resx
Original file line number Diff line number Diff line change
Expand Up @@ -138,7 +138,9 @@
<comment>Toggle checkbox</comment>
</data>
<data name="Shows a menu on the top left corner of your screen which allows you to quickly access and ping your killproofs." xml:space="preserve">
<value>Shows a menu on the top left corner of your screen which allows you to quickly access and ping your killproofs.</value>
<value>Shows a menu on the top left corner of your screen which
allows you to quickly access and ping your killproofs.
Loads on map change.</value>
<comment>Smart Ping Menu: Checkbox description.</comment>
</data>
<data name="You started Blish HUD while Guild Wars 2 was already running." xml:space="preserve">
Expand All @@ -164,7 +166,7 @@
<value>Update available! Visit killproof.me/addons</value>
</data>
<data name="ID:" xml:space="preserve">
<value>ID: </value>
<value>ID:</value>
<comment>Identification short.</comment>
</data>
<data name="Not yet registered :(" xml:space="preserve">
Expand All @@ -186,7 +188,7 @@
</data>
<data name="Total: {0} of {1} (killproof.me/{2})" xml:space="preserve">
<value>Total: {0} of {1} (killproof.me/{2})</value>
<comment>Smart Ping Menu: Chat message on right click send. Ex. "Total 250 of Legendary Insight (profile link)"</comment>
<comment>Smart Ping Menu: Chat message on right click send. Ex. &quot;Total 250 of Legendary Insight (profile link)&quot;</comment>
</data>
<data name="Everything" xml:space="preserve">
<value>Everything</value>
Expand All @@ -212,12 +214,12 @@
<value>profile available</value>
</data>
<data name="No profile for &quot;{0}&quot; found :(" xml:space="preserve">
<value>No profile for "{0}" found :(</value>
<value>No profile for &quot;{0}&quot; found :(</value>
<comment>{0} will be swapped with account name.</comment>
</data>
<data name="Send To Chat\nLeft-Click: Only send code up to a stack's worth (250x). \nRight-Click: Send killproof.me total amount." xml:space="preserve">
<data name="Send To Chat\nLeft-Click: Only send code up to a stack&apos;s worth (250x). \nRight-Click: Send killproof.me total amount." xml:space="preserve">
<value>Send To Chat
Left-Click: Only send code up to a stack's worth (250x).
Left-Click: Only send code up to a stack&apos;s worth (250x).
Right-Click: Send killproof.me total amount.</value>
<comment>Smart Ping Menu: Send Button tooltip.</comment>
</data>
Expand Down
4 changes: 2 additions & 2 deletions manifest.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,12 +12,12 @@
},
"url": "https://killproof.me/",
"author": {
"name": "Andrew Gardner",
"name": "Nekres",
"username": "Nekres.1038"
},
"contributors": [
{
"name": "Andrew Gardner",
"name": "Nekres",
"username": "Nekres.1038"
},
{
Expand Down

0 comments on commit 075a8d3

Please sign in to comment.