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

Switch the daily songs to a rotating pool each week. #216

Merged
merged 1 commit into from
May 18, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
77 changes: 53 additions & 24 deletions Unity/Assets/UMAssets/Scripts/Database/DKCJADHKGAN.cs
Original file line number Diff line number Diff line change
Expand Up @@ -8,32 +8,32 @@ public class DKCJADHKGAN_EventWeekDay : DIHHCBACKGG_DbSection
{
public class JFFPEKOEINE
{
public long KINJOEIAHFK; // 0x8
public long PCCFAKEOBIC; // 0x10
public long KINJOEIAHFK_StartDate; // 0x8
public long PCCFAKEOBIC_EndDate; // 0x10
public int JCADAMLIOKK_Id; // 0x18
public sbyte PPEGAKEIEGM_Enabled; // 0x1C
public int AIDNHPGEHPM; // 0x20
public int DJCHKGLCLPD; // 0x24
public int AIDNHPGEHPM_Crypted; // 0x20
public int DJCHKGLCLPD_Crypted; // 0x24
public string CIOJJBOHEEJ; // 0x28
public List<List<int>> BEPAMEEBPGI = new List<List<int>>(); // 0x2C
public List<List<int>> BEPAMEEBPGI_SongIdByWeekday = new List<List<int>>(); // 0x2C

public int ELEPHBOKIGK { get { return AIDNHPGEHPM ^ 0x5717f14f; } set { AIDNHPGEHPM = value ^ 0x5717f14f; } } //0x198E5A0 IIJFLONJAFL 0x198E160 LHNFGPIGCNE
public int AEHCKNNGAKF { get { return DJCHKGLCLPD ^ 0x5717f14f; } set { DJCHKGLCLPD = value ^ 0x5717f14f; } } //0x198E5B4 KKNJPEMGEBF 0x198E174 NPDLLBHCIJP
public int ELEPHBOKIGK_MaxCount { get { return AIDNHPGEHPM_Crypted ^ 0x5717f14f; } set { AIDNHPGEHPM_Crypted = value ^ 0x5717f14f; } } //0x198E5A0 IIJFLONJAFL 0x198E160 LHNFGPIGCNE
public int AEHCKNNGAKF_BonusMaxCount { get { return DJCHKGLCLPD_Crypted ^ 0x5717f14f; } set { DJCHKGLCLPD_Crypted = value ^ 0x5717f14f; } } //0x198E5B4 KKNJPEMGEBF 0x198E174 NPDLLBHCIJP

//// RVA: 0x198E5C8 Offset: 0x198E5C8 VA: 0x198E5C8
public List<int> OPCBHOLFCHO(int IAPNPKAGEGH)
public List<int> OPCBHOLFCHO_GetSongsForWeekDay(int IAPNPKAGEGH)
{
return BEPAMEEBPGI[IAPNPKAGEGH];
return BEPAMEEBPGI_SongIdByWeekday[IAPNPKAGEGH];
}

//// RVA: 0x198DA90 Offset: 0x198DA90 VA: 0x198DA90
public bool FLPDCNBLOKL(int IAPNPKAGEGH, int GHBPLHBNMBK)
public bool FLPDCNBLOKL_IsSongForWeekDay(int IAPNPKAGEGH, int GHBPLHBNMBK)
{
if(BEPAMEEBPGI[IAPNPKAGEGH] != null)
if(BEPAMEEBPGI_SongIdByWeekday[IAPNPKAGEGH] != null)
{
for(int i = 0; i < BEPAMEEBPGI[IAPNPKAGEGH].Count; i++)
for(int i = 0; i < BEPAMEEBPGI_SongIdByWeekday[IAPNPKAGEGH].Count; i++)
{
if (BEPAMEEBPGI[IAPNPKAGEGH][i] == GHBPLHBNMBK)
if (BEPAMEEBPGI_SongIdByWeekday[IAPNPKAGEGH][i] == GHBPLHBNMBK)
return true;
}
}
Expand All @@ -51,7 +51,7 @@ public JFFPEKOEINE PPIBJECKCEF(long FJLBOKEKFKA)
{
for(int i = 0; i < MPCJGPEBCCD.Count; i++)
{
if (MPCJGPEBCCD[i].PPEGAKEIEGM_Enabled == 2 && FJLBOKEKFKA >= MPCJGPEBCCD[i].KINJOEIAHFK && MPCJGPEBCCD[i].PCCFAKEOBIC >= FJLBOKEKFKA)
if (MPCJGPEBCCD[i].PPEGAKEIEGM_Enabled == 2 && FJLBOKEKFKA >= MPCJGPEBCCD[i].KINJOEIAHFK_StartDate && MPCJGPEBCCD[i].PCCFAKEOBIC_EndDate >= FJLBOKEKFKA)
return MPCJGPEBCCD[i];
}
return null;
Expand All @@ -63,7 +63,7 @@ public bool FLPDCNBLOKL(long JHNMKKNEENE, int GHBPLHBNMBK)
JFFPEKOEINE data = PPIBJECKCEF(JHNMKKNEENE);
if(data != null)
{
return data.FLPDCNBLOKL((int)Utility.GetLocalDateTime(JHNMKKNEENE).DayOfWeek, GHBPLHBNMBK);
return data.FLPDCNBLOKL_IsSongForWeekDay((int)Utility.GetLocalDateTime(JHNMKKNEENE).DayOfWeek, GHBPLHBNMBK);
}
return false;
}
Expand Down Expand Up @@ -92,21 +92,50 @@ public override bool IIEMACPEEBJ(byte[] DBBGALAPFGC)
JFFPEKOEINE data = new JFFPEKOEINE();
data.JCADAMLIOKK_Id = (int)array[i].PPFNGGCBJKC;
data.PPEGAKEIEGM_Enabled = (sbyte)JKAECBCNHAN_IsEnabled(1, (int)array[i].PLALNIIBLOF, 0);
data.KINJOEIAHFK = array[i].FNEIADJMHHO;
data.PCCFAKEOBIC = array[i].KOMKKBDABJP;
data.KINJOEIAHFK_StartDate = array[i].FNEIADJMHHO;
data.PCCFAKEOBIC_EndDate = array[i].KOMKKBDABJP;
data.CIOJJBOHEEJ = array[i].GENIJOLKBNH;
data.ELEPHBOKIGK = array[i].BFINGCJHOHI;
data.AEHCKNNGAKF = array[i].OEOIHIIIMCK;
//UnityEngine.Debug.LogError(Utility.GetLocalDateTime(data.KINJOEIAHFK).ToShortDateString() + " " + Utility.GetLocalDateTime(data.KINJOEIAHFK).ToShortTimeString()+" "+ Utility.GetLocalDateTime(data.PCCFAKEOBIC).ToShortDateString() + " " + Utility.GetLocalDateTime(data.PCCFAKEOBIC).ToShortTimeString() + " " + data.CIOJJBOHEEJ+" "+data.ELEPHBOKIGK+" "+data.AEHCKNNGAKF);
data.ELEPHBOKIGK_MaxCount = array[i].BFINGCJHOHI;
data.AEHCKNNGAKF_BonusMaxCount = array[i].OEOIHIIIMCK;
//UnityEngine.Debug.LogError(Utility.GetLocalDateTime(data.KINJOEIAHFK_StartDate).ToShortDateString() + " " + Utility.GetLocalDateTime(data.KINJOEIAHFK_StartDate).ToShortTimeString()+" "+ Utility.GetLocalDateTime(data.PCCFAKEOBIC_EndDate).ToShortDateString() + " " + Utility.GetLocalDateTime(data.PCCFAKEOBIC_EndDate).ToShortTimeString() + " " + data.CIOJJBOHEEJ+" "+data.ELEPHBOKIGK_MaxCount+" "+data.AEHCKNNGAKF_BonusMaxCount);
for(int j = 0; j < array[i].EHDDADDKMFI.Length; j++)
{
data.BEPAMEEBPGI.Add(JCAGLPANMFC(array[i].EHDDADDKMFI[j]));
data.BEPAMEEBPGI_SongIdByWeekday.Add(JCAGLPANMFC(array[i].EHDDADDKMFI[j]));
/*for(int k = 0; k < data.BEPAMEEBPGI_SongIdByWeekday[data.BEPAMEEBPGI_SongIdByWeekday.Count - 1].Count; k++)
{
UnityEngine.Debug.LogError(j+" "+data.BEPAMEEBPGI_SongIdByWeekday[data.BEPAMEEBPGI_SongIdByWeekday.Count - 1][k]);
}*/
}
MPCJGPEBCCD.Add(data);
}
// UMO, enable last one
if (MPCJGPEBCCD.Count > 0)
MPCJGPEBCCD[MPCJGPEBCCD.Count - 1].PCCFAKEOBIC = Utility.GetTargetUnixTime(2100, 1, 1, 0, 0, 0);
// UMO, loop the event. Use only those without bonus and set bonus on fixed days
{
List<JFFPEKOEINE> usableList = MPCJGPEBCCD.FindAll((JFFPEKOEINE _) =>
{
return _.AEHCKNNGAKF_BonusMaxCount == 0;
});
// Special days : 27/12 => 01/03
// Start from 1 week before today up to 2 weeks after
DateTime t = Utility.GetLocalDateTime(Utility.GetCurrentUnixTime());
DateTime start = t.Date.AddDays(-(int)t.DayOfWeek + 1).AddDays(-7);
// Find the index to use. Count the number of weeks since 1/1/24
DateTime loopStart = new DateTime(2024, 1, 1);
int weekDiff = (start - loopStart).Days / 7;
int idx = weekDiff % usableList.Count;
//UnityEngine.Debug.LogError(start.ToLongDateString()+" "+usableList.Count+" "+weekDiff+" "+idx);
DateTime s1 = start;
for(int i = 0; i < 4; i++)
{
JFFPEKOEINE data = usableList[(idx + i) % usableList.Count];
data.KINJOEIAHFK_StartDate = Utility.GetTargetUnixTime(s1.Year, s1.Month, s1.Day, 0, 0, 0);
DateTime s1b = s1.AddDays(6);
s1 = s1.AddDays(7);
data.PCCFAKEOBIC_EndDate = Utility.GetTargetUnixTime(s1b.Year, s1b.Month, s1b.Day, 23, 59, 59);
if(i == 1 && ((t.Month == 12 && t.Day >= 27) || (t.Month == 1 && t.Day <= 3)))
data.AEHCKNNGAKF_BonusMaxCount = 2;
//UnityEngine.Debug.LogError(((idx + i) % usableList.Count)+" "+Utility.GetLocalDateTime(data.KINJOEIAHFK_StartDate).ToShortDateString() + " " + Utility.GetLocalDateTime(data.KINJOEIAHFK_StartDate).ToShortTimeString()+" "+ Utility.GetLocalDateTime(data.PCCFAKEOBIC_EndDate).ToShortDateString() + " " + Utility.GetLocalDateTime(data.PCCFAKEOBIC_EndDate).ToShortTimeString());
}
}
return true;
}

Expand Down
18 changes: 9 additions & 9 deletions Unity/Assets/UMAssets/Scripts/IBJAKJJICBC.cs
Original file line number Diff line number Diff line change
Expand Up @@ -134,8 +134,8 @@ public class ANJLFFPBAEF_DifficultyInfo
public int KCKBOIDCPCK { get { return AFDHDBMKLJL ^ FBGGEFFJJHB_Key; } set { AFDHDBMKLJL = value ^ FBGGEFFJJHB_Key; } } //0x121357C LIKAGINKECG 0x1213590 DDLKEDBBGCB
public int JJEFMIHJMHC { get { return KOOODCKJNJO ^ FBGGEFFJJHB_Key; } set { KOOODCKJNJO = value ^ FBGGEFFJJHB_Key;} } //0x12135A4 BAPFJJJLHCC 0x12135B8 OGMOOIOKJHG
public int BELHFPMBAPJ_WeekPlay { get { return NEBJMHHHDMO ^ FBGGEFFJJHB_Key; } set { NEBJMHHHDMO = value ^ FBGGEFFJJHB_Key; } } //0x12136F4 HJBNBOJBKPO 0x1213708 LJLMDPIGCFJ
public int JOJNGDPHOKG { get { return PDLMMOJDBKM ^ FBGGEFFJJHB_Key; } set { PDLMMOJDBKM = value ^ FBGGEFFJJHB_Key; } } //0x121371C MBDGLMBPBEJ 0x1213730 JLIOGCHPNFJ
public int MOJMEFIENDM_WeeklyEventCount { get { return (JOJNGDPHOKG) - (BELHFPMBAPJ_WeekPlay); } } //0x1213744 PBNIFHCLKNA
public int JOJNGDPHOKG_WeeklyMax { get { return PDLMMOJDBKM ^ FBGGEFFJJHB_Key; } set { PDLMMOJDBKM = value ^ FBGGEFFJJHB_Key; } } //0x121371C MBDGLMBPBEJ 0x1213730 JLIOGCHPNFJ
public int MOJMEFIENDM_WeeklyEventCount { get { return (JOJNGDPHOKG_WeeklyMax) - (BELHFPMBAPJ_WeekPlay); } } //0x1213744 PBNIFHCLKNA
public bool AJGCPCMLGKO_IsEvent { get { return AFCMIOIGAJN_EventInfo != null; } } //0x12141A8 LFBNCKMILGK
public bool MNDFBBMNJGN { get { return LOFKFOCAJGB != FBGGEFFJJHB_Key; } } //0x12141B8 KLMOKPHBBOC LOFKFOCAJGB
// public int JKIADEKHGLC { get; set; } 0x12141D4 OMELGCEEHKD 0x12141E8 EJEGDHIDAHL LOFKFOCAJGB
Expand Down Expand Up @@ -164,7 +164,7 @@ public bool KDAJEGNBOFJ { get {
// // RVA: 0x1213764 Offset: 0x1213764 VA: 0x1213764
public void IEBGBOBPJMB(int NGDGGPCLPKC)
{
BELHFPMBAPJ_WeekPlay = Mathf.Clamp(BELHFPMBAPJ_WeekPlay - NGDGGPCLPKC, 0, JOJNGDPHOKG);
BELHFPMBAPJ_WeekPlay = Mathf.Clamp(BELHFPMBAPJ_WeekPlay - NGDGGPCLPKC, 0, JOJNGDPHOKG_WeeklyMax);
}

// // RVA: 0x1213814 Offset: 0x1213814 VA: 0x1213814
Expand Down Expand Up @@ -365,7 +365,7 @@ public void KHEKNNFCAOI(int GHBPLHBNMBK, bool HCIKDFECJGE = false, int NLKONOBBD
IHKFMJDOBAH = WeekdayEventAttr.Type.None;
LHONOILACFL_IsWeeklyEvent = false;
BELHFPMBAPJ_WeekPlay = 0;
JOJNGDPHOKG = 0;
JOJNGDPHOKG_WeeklyMax = 0;
BJANNALFGGA = true;
}
else
Expand All @@ -382,7 +382,7 @@ public void KHEKNNFCAOI(int GHBPLHBNMBK, bool HCIKDFECJGE = false, int NLKONOBBD
DateTime date = Utility.GetLocalDateTime(JHNMKKNEENE);
NKEIFPPGNLH_WeeklyendTime = Utility.GetTargetUnixTime(date.Year, date.Month, date.Day, 0, 0, 0) + 86400;
BELHFPMBAPJ_WeekPlay = saveInfo.FECIGAOOFBE_Wply;
JOJNGDPHOKG = IOFOHHOJCBE;
JOJNGDPHOKG_WeeklyMax = IOFOHHOJCBE;
EKANGPODCEP_EventId = LMPNAPIGAEA(IHKFMJDOBAH);
}
EEFLOOBOAGF = musicInfo.EEFLOOBOAGF;
Expand Down Expand Up @@ -878,14 +878,14 @@ public static List<IBJAKJJICBC> FKDIMODKKJD(int DEPGBBJMFED_Serie, long JHNMKKNE
bool ok = false;
if (DEPGBBJMFED_Serie == 5)
{
if (ev != null && ev.FLPDCNBLOKL((int)time.DayOfWeek, musicInfo.GHBPLHBNMBK_FreeMusicId))
if (ev != null && ev.FLPDCNBLOKL_IsSongForWeekDay((int)time.DayOfWeek, musicInfo.GHBPLHBNMBK_FreeMusicId))
{
CIOECGOMILE.HHCJCDFCLOB.AHEFHIMGIBI_ServerSave.LCKMBHDMPIP_RecordMusic.FAMANJGJANN_FreeMusicInfo[i].FKBPJCDBDAG_SetWeekEventServerDate(JHNMKKNEENE_Date);
//Setup vars
//L311
b = true;
val = ev.AEHCKNNGAKF + ev.ELEPHBOKIGK;
b2 = ev.AEHCKNNGAKF > 0;
val = ev.AEHCKNNGAKF_BonusMaxCount + ev.ELEPHBOKIGK_MaxCount;
b2 = ev.AEHCKNNGAKF_BonusMaxCount > 0;
ok = true;
}
}
Expand Down Expand Up @@ -1031,7 +1031,7 @@ public static List<IBJAKJJICBC> LIENJMIJMIE(long JHNMKKNEENE, bool GBNOALJPOBM =
DateTime date = Utility.GetLocalDateTime(JHNMKKNEENE);
if(e != null)
{
List<int> l = e.OPCBHOLFCHO((int)date.DayOfWeek);
List<int> l = e.OPCBHOLFCHO_GetSongsForWeekDay((int)date.DayOfWeek);
if(l != null)
{
for(int i = 0; i < l.Count; i++)
Expand Down
2 changes: 1 addition & 1 deletion Unity/Assets/UMAssets/Scripts/JBCAHMMCOKK.cs
Original file line number Diff line number Diff line change
Expand Up @@ -436,7 +436,7 @@ private static void HEGEKFMJNCC(List<JBCAHMMCOKK> NNDGIAEFMOG, JJCJKALEIAC_HomeP
{
if(l[i].LHONOILACFL_IsWeeklyEvent)
{
if(l[i].BELHFPMBAPJ_WeekPlay < l[i].JOJNGDPHOKG)
if(l[i].BELHFPMBAPJ_WeekPlay < l[i].JOJNGDPHOKG_WeeklyMax)
{
JBCAHMMCOKK data = new JBCAHMMCOKK();
data.KHEKNNFCAOI(KOGBMDOONFA.PPFNGGCBJKC);
Expand Down
2 changes: 1 addition & 1 deletion Unity/Assets/UMAssets/Scripts/JGEOBNENMAH.cs
Original file line number Diff line number Diff line change
Expand Up @@ -1791,7 +1791,7 @@ public int BHOAOPKAPGD(int GHBPLHBNMBK)
if(IMMAOANGPNK.HHCJCDFCLOB.NKEBMCIMJND_Database.CLLPBOPLICM_EventWeekDay.FLPDCNBLOKL(record.CAPAIICHDMH_WDat, GHBPLHBNMBK))
{
DKCJADHKGAN_EventWeekDay.JFFPEKOEINE data = IMMAOANGPNK.HHCJCDFCLOB.NKEBMCIMJND_Database.CLLPBOPLICM_EventWeekDay.PPIBJECKCEF(record.CAPAIICHDMH_WDat);
return data.ELEPHBOKIGK + data.AEHCKNNGAKF;
return data.ELEPHBOKIGK_MaxCount + data.AEHCKNNGAKF_BonusMaxCount;
}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -380,7 +380,7 @@ private void OnClickChallenge(BKANGIKIEML.NODKLJHEAJB sceneType, int conditionId
{
if(l[i].LHONOILACFL_IsWeeklyEvent)
{
if(l[i].BELHFPMBAPJ_WeekPlay < l[i].JOJNGDPHOKG)
if(l[i].BELHFPMBAPJ_WeekPlay < l[i].JOJNGDPHOKG_WeeklyMax)
{
if(l[i].GHBPLHBNMBK_FreeMusicId > 0)
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -428,7 +428,7 @@ public static void Challenge(FKMOKDCJFEN view)
{
if(l[i].LHONOILACFL_IsWeeklyEvent)
{
if(l[i].BELHFPMBAPJ_WeekPlay < l[i].JOJNGDPHOKG)
if(l[i].BELHFPMBAPJ_WeekPlay < l[i].JOJNGDPHOKG_WeeklyMax)
{
if(l[i].GHBPLHBNMBK_FreeMusicId > 0)
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1157,7 +1157,7 @@ private void SelectArgsFocus(MusicSelectArgs args)
{
if(info.LHONOILACFL_IsWeeklyEvent)
{
if(info.BELHFPMBAPJ_WeekPlay < info.JOJNGDPHOKG)
if(info.BELHFPMBAPJ_WeekPlay < info.JOJNGDPHOKG_WeeklyMax)
{
list_no = i;
break;
Expand Down