Skip to content

Commit

Permalink
Merge pull request #7 from planetarium/9c-2656
Browse files Browse the repository at this point in the history
사용되지 않는 서브 레시피 아이디 삭제
  • Loading branch information
ipdae authored Aug 12, 2020
2 parents a3e99a7 + cac7a68 commit 10e398f
Show file tree
Hide file tree
Showing 5 changed files with 10 additions and 47 deletions.
12 changes: 1 addition & 11 deletions Lib9c/Action/CombinationEquipment.cs
Original file line number Diff line number Diff line change
Expand Up @@ -158,16 +158,6 @@ public override IAccountStateDelta Execute(IActionContext context)
);
}

// 서브 레시피 해금 검사.
if (!avatarState.worldInformation.IsStageCleared(subRecipe.UnlockStage))
{
return LogError(
context,
"Aborted as the signer is not cleared the minimum stage level required to use the subrecipe {@SubRecipe} yet.",
subRecipe
);
}

requiredBlockIndex += subRecipe.RequiredBlockIndex;
requiredGold += subRecipe.RequiredGold;
requiredActionPoint += subRecipe.RequiredActionPoint;
Expand Down Expand Up @@ -244,7 +234,7 @@ public override IAccountStateDelta Execute(IActionContext context)
requiredBlockIndex);
result.id = mail.id;
avatarState.Update(mail);
avatarState.questList.UpdateCombinationEquipmentQuest(RecipeId, SubRecipeId);
avatarState.questList.UpdateCombinationEquipmentQuest(RecipeId);
avatarState.UpdateFromCombination(equipment);
avatarState.UpdateQuestRewards(ctx);
return states
Expand Down
14 changes: 2 additions & 12 deletions Lib9c/Model/Quest/CombinationEquipmentQuest.cs
Original file line number Diff line number Diff line change
Expand Up @@ -12,24 +12,18 @@ public class CombinationEquipmentQuest : Quest
{
public readonly int RecipeId;
public readonly int StageId;
public readonly int? SubRecipeId;

public CombinationEquipmentQuest(QuestSheet.Row data, QuestReward reward, int stageId) : base(data, reward)
{
var row = (CombinationEquipmentQuestSheet.Row) data;
RecipeId = row.RecipeId;
SubRecipeId = row.SubRecipeId;
StageId = stageId;
}

public CombinationEquipmentQuest(Dictionary serialized) : base(serialized)
{
RecipeId = serialized["recipe_id"].ToInteger();
StageId = serialized["stage_id"].ToInteger();
if (serialized.TryGetValue((Text) "sub_recipe_id", out var value))
{
SubRecipeId = value.ToNullableInteger();
}
}

//임시처리. 새 타입을 만들어서 위젯에 띄워줘야합니다.
Expand All @@ -50,12 +44,12 @@ public override string GetProgressText() =>
Goal
);

public void Update(int recipeId, int? subRecipeId)
public void Update(int recipeId)
{
if (Complete)
return;

if (recipeId == RecipeId && subRecipeId == SubRecipeId)
if (recipeId == RecipeId)
{
_current++;
}
Expand All @@ -69,10 +63,6 @@ public override IValue Serialize()
[(Text) "recipe_id"] = RecipeId.Serialize(),
[(Text) "stage_id"] = StageId.Serialize(),
};
if (SubRecipeId.HasValue)
{
dict[(Text) "sub_recipe_id"] = SubRecipeId.Serialize();
}
return new Dictionary(dict.Union((Dictionary) base.Serialize()));
}
}
Expand Down
14 changes: 2 additions & 12 deletions Lib9c/Model/Quest/Quest.cs
Original file line number Diff line number Diff line change
Expand Up @@ -211,16 +211,6 @@ EquipmentItemSubRecipeSheet equipmentItemSubRecipeSheet
}

stageId = recipeRow.UnlockStage;
if (row10.SubRecipeId.HasValue)
{
var subRow = equipmentItemSubRecipeSheet.Values
.FirstOrDefault(r => r.Id == row10.SubRecipeId);
if (subRow is null)
{
throw new ArgumentException($"Invalid Sub Recipe Id : {row10.SubRecipeId}");
}
stageId = Math.Max(stageId, subRow.UnlockStage);
}
quest = new CombinationEquipmentQuest(row10, reward, stageId);
_quests.Add(quest);
break;
Expand Down Expand Up @@ -368,13 +358,13 @@ public void UpdateItemTypeCollectQuest(IEnumerable<ItemBase> items)
[(Text) "completedQuestIds"] = new List(completedQuestIds.Select(i => i.Serialize()))
});

public void UpdateCombinationEquipmentQuest(int recipeId, int? subRecipeId)
public void UpdateCombinationEquipmentQuest(int recipeId)
{
var targets = _quests.OfType<CombinationEquipmentQuest>()
.Where(q => !q.Complete);
foreach (var target in targets)
{
target.Update(recipeId, subRecipeId);
target.Update(recipeId);
}
}

Expand Down
12 changes: 5 additions & 7 deletions Lib9c/TableData/Item/EquipmentItemSubRecipeSheet.cs
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,6 @@ public class Row : SheetRow<int>
public int RequiredActionPoint { get; private set; }
public long RequiredGold { get; private set; }
public long RequiredBlockIndex { get; private set; }
public int UnlockStage { get; private set; }
public List<MaterialInfo> Materials { get; private set; }
public List<OptionInfo> Options { get; private set; }
public int MaxOptionLimit { get; private set; }
Expand All @@ -47,27 +46,26 @@ public override void Set(IReadOnlyList<string> fields)
RequiredActionPoint = ParseInt(fields[1]);
RequiredGold = ParseLong(fields[2]);
RequiredBlockIndex = ParseInt(fields[3]);
UnlockStage = ParseInt(fields[4]);
Materials = new List<MaterialInfo>();
Options = new List<OptionInfo>();
for (var i = 0; i < 3; i++)
{
var offset = i * 2;
if (string.IsNullOrEmpty(fields[5 + offset]) || string.IsNullOrEmpty(fields[6 + offset]))
if (string.IsNullOrEmpty(fields[4 + offset]) || string.IsNullOrEmpty(fields[5 + offset]))
continue;

Materials.Add(new MaterialInfo(ParseInt(fields[5 + offset]), ParseInt(fields[6 + offset])));
Materials.Add(new MaterialInfo(ParseInt(fields[4 + offset]), ParseInt(fields[5 + offset])));
}

for (var i = 0; i < 4; i++)
{
var offset = i * 2;
if (string.IsNullOrEmpty(fields[11 + offset]) || string.IsNullOrEmpty(fields[12 + offset]))
if (string.IsNullOrEmpty(fields[10 + offset]) || string.IsNullOrEmpty(fields[11 + offset]))
continue;

Options.Add(new OptionInfo(ParseInt(fields[11 + offset]), ParseDecimal(fields[12 + offset])));
Options.Add(new OptionInfo(ParseInt(fields[10 + offset]), ParseDecimal(fields[11 + offset])));
}
MaxOptionLimit = ParseInt(fields[19]);
MaxOptionLimit = ParseInt(fields[18]);
}
}

Expand Down
5 changes: 0 additions & 5 deletions Lib9c/TableData/Quest/CombinationEquipmentQuestSheet.cs
Original file line number Diff line number Diff line change
Expand Up @@ -11,16 +11,11 @@ public class CombinationEquipmentQuestSheet : Sheet<int, CombinationEquipmentQue
public class Row : QuestSheet.Row
{
public int RecipeId { get; private set; }
public int? SubRecipeId { get; private set; }

public override void Set(IReadOnlyList<string> fields)
{
base.Set(fields);
RecipeId = ParseInt(fields[3]);
if (!string.IsNullOrEmpty(fields[4]))
{
SubRecipeId = ParseInt(fields[4]);
}
}
}

Expand Down

0 comments on commit 10e398f

Please sign in to comment.