Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Removed attributes and skill change restrictions #431

Closed
21 changes: 21 additions & 0 deletions src/TQVaultAE.Domain/Entities/PlayerLevel.cs
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
using System;
using System.Collections.Generic;
using System.Linq;

namespace TQVaultAE.Domain.Entities
{
Expand Down Expand Up @@ -160,5 +161,25 @@ public static int GetLevelMinXP(int level)
}
throw new ArgumentOutOfRangeException("Level does not exist or is not supported");
}

public static int GetLevelByXP(int xp, out int levelXp)
{
foreach (var item in _levelKey.Reverse())
{
if (xp >= item.Value)
{
levelXp = item.Value;
return item.Key;
}
}
var last = _levelKey.Last();
levelXp = last.Value;
return last.Key;
}

public static int GetMaxXp()
{
return _levelKey.Last().Value;
}
}
}
61 changes: 45 additions & 16 deletions src/TQVaultAE.GUI/CharacterEditDialog.Designer.cs

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

25 changes: 13 additions & 12 deletions src/TQVaultAE.GUI/CharacterEditDialog.cs
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,7 @@ private void UpdatePlayerInfo(bool mustResetAttributes = false)
playerInfo.MasteriesAllowed = 2;

playerInfo.CurrentXP = int.Parse(xpTextBox.Text);
playerInfo.Money = PlayerCollection.PlayerInfo.Money > 0 ? PlayerCollection.PlayerInfo.Money : 0;
playerInfo.Money = Math.Max(0, Math.Abs(int.Parse(moneyTextBox.Text)));
playerInfo.DifficultyUnlocked = difficultlyComboBox.SelectedIndex;
playerInfo.SkillPoints = Convert.ToInt32(skillPointsNumericUpDown.Value);

Expand Down Expand Up @@ -187,6 +187,7 @@ private void CharacterEditDlg_Load(object sender, EventArgs e)
IntelligenceLabel.Text = Resources.CEIntelligence;
healthLabel.Text = Resources.CEHealth;
manaLabel.Text = Resources.CEMana;
moneyLabel.Text = Resources.CEMoney;
levelLabel.Text = Resources.CELevel;
xpLabel.Text = Resources.CEXp;
attributeLabel.Text = Resources.CEAttributePoints;
Expand Down Expand Up @@ -254,6 +255,8 @@ private void CharacterEditDlg_Load(object sender, EventArgs e)
manacUpDown.Value = PlayerCollection.PlayerInfo.BaseMana;
manacUpDown.Tag = attrHMTag;

moneyTextBox.Text = PlayerCollection.PlayerInfo.Money.ToString();

if (PlayerCollection.PlayerInfo.CurrentLevel > Convert.ToInt32(levelNumericUpDown.Maximum))
levelNumericUpDown.Maximum = PlayerCollection.PlayerInfo.CurrentLevel;

Expand Down Expand Up @@ -285,6 +288,10 @@ private void CharacterEditDlg_Load(object sender, EventArgs e)
levelingCheckBox.Enabled = false;
levelingCheckBox.Visible = false;
}
else
{
levelingCheckBox.Checked = true;
}

_loaded = true;
}
Expand Down Expand Up @@ -360,18 +367,12 @@ private void StatsUpDown_ValueChanged(object sender, EventArgs e)
private void LevelingCheckBox_CheckedChanged(object sender, EventArgs e)
{
if (sender == null) return;

var chkbx = (CheckBox)sender;
if (chkbx.Checked)
{
this.difficultlyComboBox.Enabled = true;
this.levelNumericUpDown.Enabled = true;
}
else
{
this.difficultlyComboBox.Enabled = false;
this.levelNumericUpDown.Enabled = false;
}

this.difficultlyComboBox.Enabled = chkbx.Checked;
this.levelNumericUpDown.Enabled = chkbx.Checked;
this.attributeNumericUpDown.Enabled = chkbx.Checked;
this.skillPointsNumericUpDown.Enabled = chkbx.Checked;
}

private void ResetMasteriesScalingButton_Click(object sender, EventArgs e)
Expand Down
3 changes: 3 additions & 0 deletions src/TQVaultAE.Presentation/Resources.de.resx
Original file line number Diff line number Diff line change
Expand Up @@ -1081,4 +1081,7 @@ Hier ist ein komplexes Beispiel: 'arctic & frost @schwert $ episch | selten'
<data name="ItemEmbers" xml:space="preserve">
<value>Eternal Embers Gegenstand</value>
</data>
<data name="CEMoney" xml:space="preserve">
<value>Geld</value>
</data>
</root>
3 changes: 3 additions & 0 deletions src/TQVaultAE.Presentation/Resources.es.resx
Original file line number Diff line number Diff line change
Expand Up @@ -1075,4 +1075,7 @@ He aquí un ejemplo complejo: 'glacial &amp; hielo @espada $raro'</value>
<data name="ItemEmbers" xml:space="preserve">
<value>Objeto de Eternal Embers</value>
</data>
<data name="CEMoney" xml:space="preserve">
<value>Dinero</value>
</data>
</root>
3 changes: 3 additions & 0 deletions src/TQVaultAE.Presentation/Resources.pl.resx
Original file line number Diff line number Diff line change
Expand Up @@ -1077,4 +1077,7 @@ Oto złożony przykład: 'arktyczny &amp;mróz @miecz $pospolity | epicki'</valu
<data name="ItemEmbers" xml:space="preserve">
<value>Przedmiot z Eternal Embers</value>
</data>
<data name="CEMoney" xml:space="preserve">
<value>Pieniądze</value>
</data>
</root>
3 changes: 3 additions & 0 deletions src/TQVaultAE.Presentation/Resources.pt.resx
Original file line number Diff line number Diff line change
Expand Up @@ -1544,4 +1544,7 @@ O personagem também não poderá equipar itens onde os requisitos não forem at
<data name="ItemEmbers" xml:space="preserve">
<value>Item de Eternal Embers</value>
</data>
<data name="CEMoney" xml:space="preserve">
<value>Dinheiro</value>
</data>
</root>
3 changes: 3 additions & 0 deletions src/TQVaultAE.Presentation/Resources.ru.resx
Original file line number Diff line number Diff line change
Expand Up @@ -1094,4 +1094,7 @@ Used to track changes in the translation file.</comment>
<data name="ItemEmbers" xml:space="preserve">
<value>Предмет Eternal Embers</value>
</data>
<data name="CEMoney" xml:space="preserve">
<value>Деньги</value>
</data>
</root>
Loading