-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
4 changed files
with
174 additions
and
8 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
32 changes: 32 additions & 0 deletions
32
src/Snap.Hutao.Server/Snap.Hutao.Server/Model/Metadata/GachaEventInfoExtension.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
// Copyright (c) DGP Studio. All rights reserved. | ||
// Licensed under the MIT license. | ||
|
||
using Snap.Hutao.Server.Model.Entity.GachaLog; | ||
|
||
namespace Snap.Hutao.Server.Model.Metadata; | ||
|
||
public static class GachaEventInfoExtension | ||
{ | ||
public static IEnumerable<int> GetUpOrangeItems(this GachaEventInfo info) | ||
{ | ||
if (info.UpOrangeItem1 != 0U) | ||
{ | ||
yield return (int)info.UpOrangeItem1; | ||
} | ||
|
||
if (info.UpOrangeItem2 != 0U) | ||
{ | ||
yield return (int)info.UpOrangeItem2; | ||
} | ||
} | ||
|
||
public static bool ItemInThisEvent(this GachaEventInfo info, EntityGachaItem item) | ||
{ | ||
if (item.GachaType == info.Type && item.Time >= info.From && item.Time <= info.To) | ||
{ | ||
return true; | ||
} | ||
|
||
return false; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
96 changes: 96 additions & 0 deletions
96
src/Snap.Hutao.Server/Snap.Hutao.Server/Service/GachaLog/SpecializedGachaLogItems.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,96 @@ | ||
// Copyright (c) DGP Studio. All rights reserved. | ||
// Licensed under the MIT license. | ||
|
||
using Snap.Hutao.Server.Model.Entity.GachaLog; | ||
using Snap.Hutao.Server.Model.Metadata; | ||
|
||
namespace Snap.Hutao.Server.Service.GachaLog; | ||
|
||
internal static class SpecializedGachaLogItems | ||
{ | ||
// 10000003 琴 | ||
// 10000016 迪卢克 | ||
// 10000035 七七 | ||
// 10000041 莫娜 | ||
// 10000042 刻晴 | ||
// 10000069 提纳里 3.1 2022/9/28 6 | ||
// 10000079 迪西雅 3.6 2023/4/12 6 | ||
// 11501 风鹰剑 | ||
// 11502 天空之刃 | ||
// 12501 天空之傲 | ||
// 12502 狼的末路 | ||
// 13502 天空之脊 | ||
// 13505 和璞鸢 | ||
// 14501 天空之卷 | ||
// 14502 四风原典 | ||
// 15501 天空之翼 | ||
// 15502 阿莫斯之弓 | ||
private static readonly DateTimeOffset MinAllowedTime31 = new(2022, 9, 28, 6, 0, 0, new(8, 0, 0)); | ||
private static readonly DateTimeOffset MinAllowedTime36 = new(2023, 4, 12, 6, 0, 0, new(8, 0, 0)); | ||
private static readonly FrozenSet<int> DefiniteStandardAvatars = FrozenSet.ToFrozenSet([10000003, 10000016, 10000035, 10000041, 10000042]); | ||
private static readonly FrozenSet<int> DefiniteStandardWeapons = FrozenSet.ToFrozenSet([11501, 11502, 12501, 12502, 13502, 13505, 14501, 14502, 15501, 15502]); | ||
|
||
public static bool IsStandardWishItem(EntityGachaItem item) | ||
{ | ||
if (item.QueryType is GachaConfigType.AvatarEventWish) | ||
{ | ||
if (DefiniteStandardAvatars.Contains(item.ItemId)) | ||
{ | ||
return true; | ||
} | ||
|
||
if (item.ItemId is 10000069 && item.Time > MinAllowedTime31) | ||
{ | ||
return true; | ||
} | ||
|
||
if (item.ItemId is 10000079 && item.Time > MinAllowedTime36) | ||
{ | ||
return true; | ||
} | ||
|
||
return false; | ||
} | ||
else if (item.QueryType is GachaConfigType.WeaponEventWish) | ||
{ | ||
if (DefiniteStandardWeapons.Contains(item.ItemId)) | ||
{ | ||
return true; | ||
} | ||
|
||
return false; | ||
} | ||
|
||
return true; | ||
} | ||
|
||
public static bool IsAvatarStandardWishItem(EntityGachaItem item) | ||
{ | ||
if (DefiniteStandardAvatars.Contains(item.ItemId)) | ||
{ | ||
return true; | ||
} | ||
|
||
if (item.ItemId is 10000069 && item.Time > MinAllowedTime31) | ||
{ | ||
return true; | ||
} | ||
|
||
if (item.ItemId is 10000079 && item.Time > MinAllowedTime36) | ||
{ | ||
return true; | ||
} | ||
|
||
return false; | ||
} | ||
|
||
public static bool IsWeaponStandardWishItem(EntityGachaItem item) | ||
{ | ||
if (DefiniteStandardWeapons.Contains(item.ItemId)) | ||
{ | ||
return true; | ||
} | ||
|
||
return false; | ||
} | ||
} |