mirror of
https://github.com/Ottermandias/Glamourer.git
synced 2025-12-12 10:17:23 +01:00
Fix some item unlock mechanism.
This commit is contained in:
parent
a666832419
commit
282f7791bf
2 changed files with 17 additions and 7 deletions
|
|
@ -104,7 +104,7 @@ public class ItemUnlockManager : ISavable, IDisposable
|
||||||
InventoryType.RetainerMarket,
|
InventoryType.RetainerMarket,
|
||||||
};
|
};
|
||||||
|
|
||||||
bool AddItem(uint itemId, long time)
|
private bool AddItem(uint itemId, long time)
|
||||||
{
|
{
|
||||||
itemId = HandleHq(itemId);
|
itemId = HandleHq(itemId);
|
||||||
if (!_items.ItemService.AwaitedService.TryGetValue(itemId, out var equip) || !_unlocked.TryAdd(equip.ItemId, time))
|
if (!_items.ItemService.AwaitedService.TryGetValue(itemId, out var equip) || !_unlocked.TryAdd(equip.ItemId, time))
|
||||||
|
|
@ -145,7 +145,7 @@ public class ItemUnlockManager : ISavable, IDisposable
|
||||||
if (scan)
|
if (scan)
|
||||||
Scan();
|
Scan();
|
||||||
|
|
||||||
var time = DateTimeOffset.UtcNow.ToUnixTimeMilliseconds();
|
var time = DateTimeOffset.UtcNow.ToUnixTimeMilliseconds();
|
||||||
var mirageManager = MirageManager.Instance();
|
var mirageManager = MirageManager.Instance();
|
||||||
var changes = false;
|
var changes = false;
|
||||||
if (mirageManager != null)
|
if (mirageManager != null)
|
||||||
|
|
@ -186,7 +186,7 @@ public class ItemUnlockManager : ISavable, IDisposable
|
||||||
var item = container->GetInventorySlot(_currentInventoryIndex++);
|
var item = container->GetInventorySlot(_currentInventoryIndex++);
|
||||||
if (item != null)
|
if (item != null)
|
||||||
{
|
{
|
||||||
changes |= AddItem(item->ItemID, time);
|
changes |= AddItem(item->ItemID, time);
|
||||||
changes |= AddItem(item->GlamourID, time);
|
changes |= AddItem(item->GlamourID, time);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -295,8 +295,9 @@ public class ItemUnlockManager : ISavable, IDisposable
|
||||||
ret.TryAdd(item.ItemId, new UnlockRequirements(row.RowId, 0, 0, 0, UnlockType.Cabinet));
|
ret.TryAdd(item.ItemId, new UnlockRequirements(row.RowId, 0, 0, 0, UnlockType.Cabinet));
|
||||||
}
|
}
|
||||||
|
|
||||||
var gilShop = gameData.GetExcelSheet<GilShopItem>()!;
|
var gilShopItem = gameData.GetExcelSheet<GilShopItem>()!;
|
||||||
foreach (var row in gilShop)
|
var gilShop = gameData.GetExcelSheet<GilShop>()!;
|
||||||
|
foreach (var row in gilShopItem)
|
||||||
{
|
{
|
||||||
if (!items.ItemService.AwaitedService.TryGetValue(row.Item.Row, out var item))
|
if (!items.ItemService.AwaitedService.TryGetValue(row.Item.Row, out var item))
|
||||||
continue;
|
continue;
|
||||||
|
|
@ -305,6 +306,16 @@ public class ItemUnlockManager : ISavable, IDisposable
|
||||||
var quest2 = row.QuestRequired[1].Row;
|
var quest2 = row.QuestRequired[1].Row;
|
||||||
var achievement = row.AchievementRequired.Row;
|
var achievement = row.AchievementRequired.Row;
|
||||||
var state = row.StateRequired;
|
var state = row.StateRequired;
|
||||||
|
|
||||||
|
var shop = gilShop.GetRow(row.RowId);
|
||||||
|
if (shop != null && shop.Quest.Row != 0)
|
||||||
|
{
|
||||||
|
if (quest1 == 0)
|
||||||
|
quest1 = shop.Quest.Row;
|
||||||
|
else if (quest2 == 0)
|
||||||
|
quest2 = shop.Quest.Row;
|
||||||
|
}
|
||||||
|
|
||||||
var type = (quest1 != 0 ? UnlockType.Quest1 : 0)
|
var type = (quest1 != 0 ? UnlockType.Quest1 : 0)
|
||||||
| (quest2 != 0 ? UnlockType.Quest2 : 0)
|
| (quest2 != 0 ? UnlockType.Quest2 : 0)
|
||||||
| (achievement != 0 ? UnlockType.Achievement : 0);
|
| (achievement != 0 ? UnlockType.Achievement : 0);
|
||||||
|
|
|
||||||
|
|
@ -30,9 +30,8 @@ public readonly record struct UnlockRequirements(uint Quest1, uint Quest2, uint
|
||||||
bool CheckQuest(uint quest)
|
bool CheckQuest(uint quest)
|
||||||
=> uiState->IsUnlockLinkUnlockedOrQuestCompleted(quest);
|
=> uiState->IsUnlockLinkUnlockedOrQuestCompleted(quest);
|
||||||
|
|
||||||
// TODO ClientStructs
|
|
||||||
bool CheckAchievement(uint achievement)
|
bool CheckAchievement(uint achievement)
|
||||||
=> false;
|
=> uiState->Achievement.IsLoaded() && uiState->Achievement.IsComplete((int) achievement);
|
||||||
|
|
||||||
return Type switch
|
return Type switch
|
||||||
{
|
{
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue