Skip to content

Commit

Permalink
Fix double lookup when calculating item options
Browse files Browse the repository at this point in the history
  • Loading branch information
Kaioru committed Oct 10, 2023
1 parent 6fc49f6 commit caa1894
Showing 1 changed file with 36 additions and 44 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -346,50 +346,42 @@ ItemGrade.Epic or

private async Task ApplyItemOption(IFieldUser user, int option, int level)
{
try
{
var template = await user.StageUser.Context.Templates.ItemOption.Retrieve(option);
if (template == null) return;
if (!template.Levels.ContainsKey(level)) return;
var levelTemplate = template.Levels[level];

STR += levelTemplate.IncSTR;
DEX += levelTemplate.IncDEX;
LUK += levelTemplate.IncLUK;
INT += levelTemplate.IncINT;

MaxHP += levelTemplate.IncMaxHP;
MaxMP += levelTemplate.IncMaxMP;

PAD += levelTemplate.IncPAD;
PDD += levelTemplate.IncPDD;
MAD += levelTemplate.IncMAD;
MDD += levelTemplate.IncMDD;
ACC += levelTemplate.IncACC;
EVA += levelTemplate.IncEVA;

Speed += levelTemplate.IncSpeed;
Jump += levelTemplate.IncJump;

STRr += levelTemplate.IncSTRr;
DEXr += levelTemplate.IncDEXr;
LUKr += levelTemplate.IncLUKr;
INTr += levelTemplate.IncINTr;

MaxHPr += levelTemplate.IncMaxHPr;
MaxMPr += levelTemplate.IncMaxMPr;

PADr += levelTemplate.IncPADr;
PDDr += levelTemplate.IncPDDr;
MADr += levelTemplate.IncMADr;
MDDr += levelTemplate.IncMDDr;
ACCr += levelTemplate.IncACCr;
EVAr += levelTemplate.IncEVAr;
}
catch (Exception e)
{
Console.WriteLine(e);
}
var template = await user.StageUser.Context.Templates.ItemOption.Retrieve(option);
if (template == null) return;
if (!template.Levels.TryGetValue(level, out var levelTemplate)) return;

STR += levelTemplate.IncSTR;
DEX += levelTemplate.IncDEX;
LUK += levelTemplate.IncLUK;
INT += levelTemplate.IncINT;

MaxHP += levelTemplate.IncMaxHP;
MaxMP += levelTemplate.IncMaxMP;

PAD += levelTemplate.IncPAD;
PDD += levelTemplate.IncPDD;
MAD += levelTemplate.IncMAD;
MDD += levelTemplate.IncMDD;
ACC += levelTemplate.IncACC;
EVA += levelTemplate.IncEVA;

Speed += levelTemplate.IncSpeed;
Jump += levelTemplate.IncJump;

STRr += levelTemplate.IncSTRr;
DEXr += levelTemplate.IncDEXr;
LUKr += levelTemplate.IncLUKr;
INTr += levelTemplate.IncINTr;

MaxHPr += levelTemplate.IncMaxHPr;
MaxMPr += levelTemplate.IncMaxMPr;

PADr += levelTemplate.IncPADr;
PDDr += levelTemplate.IncPDDr;
MADr += levelTemplate.IncMADr;
MDDr += levelTemplate.IncMDDr;
ACCr += levelTemplate.IncACCr;
EVAr += levelTemplate.IncEVAr;
}

private async Task ApplySkills(IFieldUser user)
Expand Down

0 comments on commit caa1894

Please sign in to comment.