diff --git a/data/world.ts b/data/world.ts index b0c6104..5346974 100644 --- a/data/world.ts +++ b/data/world.ts @@ -5,6 +5,13 @@ export const SONGS_WORLD = [ { mcode: 38669, limited_ary: [2, 2, 2, 2, 2, -1, 2, 2, 2, 2], diffLv: [3, 7, 11, 14, 15, 0, 7, 11, 14, 15] }, { mcode: 38668, limited_ary: [2, 2, 2, 2, -1, -1, 2, 2, 2, -1], diffLv: [3, 6, 10, 13, 0, 0, 6, 10, 13, 0] }, { mcode: 38667, limited_ary: [2, 2, 2, 2, -1, -1, 2, 2, 2, -1], diffLv: [3, 6, 9, 12, 0, 0, 6, 9, 12, 0] }, + + { mcode: 38663, limited_ary: [0, 0, 0, 0, -1, -1, 0, 0, 0, -1], diffLv: [3, 7, 10, 13, 0, 0, 7, 10, 13, 0] }, + { mcode: 38660, limited_ary: [0, 0, 0, 0, -1, -1, 0, 0, 0, -1], diffLv: [1, 4, 8, 12, 0, 0, 4, 8, 12, 0] }, + { mcode: 38688, limited_ary: [0, 0, 0, 0, -1, -1, 0, 0, 0, -1], diffLv: [3, 7, 11, 14, 0, 0, 7, 11, 14, 0] }, + { mcode: 38672, limited_ary: [0, 0, 0, 0, -1, -1, 0, 0, 0, -1], diffLv: [2, 4, 9, 13, 0, 0, 4, 9, 13, 0] }, + { mcode: 38662, limited_ary: [0, 0, 0, 0, -1, -1, 0, 0, 0, -1], diffLv: [2, 5, 8, 13, 0, 0, 4, 8, 13, 0] }, + { mcode: 38731, limited_ary: [0, 0, 0, 0, -1, -1, 0, 0, 0, -1], diffLv: [1, 3, 9, 13, 0, 0, 3, 9, 12, 0] }, { mcode: 38722, limited_ary: [0, 0, 0, 0, -1, -1, 0, 0, 0, -1], diffLv: [2, 6, 10, 14, 0, 0, 6, 10, 14, 0] }, { mcode: 38704, limited_ary: [0, 0, 0, 0, -1, -1, 0, 0, 0, -1], diffLv: [1, 4, 9, 12, 0, 0, 4, 9, 12, 0] }, @@ -13,20 +20,72 @@ export const SONGS_WORLD = [ { mcode: 38723, limited_ary: [0, 0, 0, 0, 0, -1, 0, 0, 0, 0], diffLv: [2, 4, 9, 14, 12, 0, 5, 10, 14, 12] }, { mcode: 38721, limited_ary: [0, 0, 0, 0, -1, -1, 0, 0, 0, -1], diffLv: [2, 4, 8, 12, 0, 0, 4, 8, 12, 0] }, { mcode: 38706, limited_ary: [0, 0, 0, 0, -1, -1, 0, 0, 0, -1], diffLv: [1, 4, 9, 13, 0, 0, 4, 9, 13, 0] }, - { mcode: 38705, limited_ary: [0, 0, 0, 0, -1, -1, 0, 0, 0, -1], diffLv: [2, 6, 10, 13, 0, 0, 6, 10, 13, 0] } + { mcode: 38705, limited_ary: [0, 0, 0, 0, -1, -1, 0, 0, 0, -1], diffLv: [2, 6, 10, 13, 0, 0, 6, 10, 13, 0] }, + { mcode: 38727, limited_ary: [0, 0, 0, 0, -1, -1, 0, 0, 0, -1], diffLv: [3, 7, 11, 14, 0, 0, 7, 11, 14, 0] }, + { mcode: 38739, limited_ary: [0, 0, 0, 0, 0, -1, 0, 0, 0, 0], diffLv: [3, 5, 9, 12, 15, 0, 5, 9, 12, 15] }, + { mcode: 38664, limited_ary: [0, 0, 0, 0, -1, -1, 0, 0, 0, -1], diffLv: [3, 7, 9, 12, 0, 0, 7, 9, 12, 0] }, + { mcode: 38670, limited_ary: [0, 0, 0, 0, -1, -1, 0, 0, 0, -1], diffLv: [4, 7, 10, 13, 0, 0, 7, 10, 13, 0] }, + { mcode: 38680, limited_ary: [0, 0, 0, 0, -1, -1, 0, 0, 0, -1], diffLv: [3, 6, 11, 14, 0, 0, 6, 11, 14, 0] }, + { mcode: 38666, limited_ary: [0, 0, 0, 0, -1, -1, 0, 0, 0, -1], diffLv: [3, 7, 10, 14, 0, 0, 7, 10, 14, 0] }, + { mcode: 38671, limited_ary: [0, 0, 0, 0, -1, -1, 0, 0, 0, -1], diffLv: [1, 4, 8, 13, 0, 0, 4, 8, 13, 0] }, + { mcode: 38677, limited_ary: [0, 0, 0, 0, -1, -1, 0, 0, 0, -1], diffLv: [3, 6, 9, 12, 0, 0, 6, 9, 12, 0] }, + { mcode: 38678, limited_ary: [0, 0, 0, 0, -1, -1, 0, 0, 0, -1], diffLv: [1, 5, 9, 11, 0, 0, 3, 9, 12, 0] }, + { mcode: 38707, limited_ary: [0, -1, -1, -1, -1, -1, -1, -1, -1, -1], diffLv: [6, 0, 0, 0, 0, 0, 0, 0, 0, 0] }, + { mcode: 38695, limited_ary: [0, 0, 0, 0, -1, -1, 0, 0, 0, -1], diffLv: [3, 7, 11, 14, 0, 0, 7, 11, 14, 0] }, + { mcode: 38692, limited_ary: [0, 0, 0, 0, -1, -1, 0, 0, 0, -1], diffLv: [2, 7, 12, 15, 0, 0, 7, 12, 15, 0] }, + { mcode: 38694, limited_ary: [0, 0, 0, 0, -1, -1, 0, 0, 0, -1], diffLv: [3, 6, 11, 14, 0, 0, 6, 11, 14, 0] }, + { mcode: 38691, limited_ary: [0, 0, 0, 0, -1, -1, 0, 0, 0, -1], diffLv: [2, 8, 12, 15, 0, 0, 7, 12, 15, 0] }, + { mcode: 38693, limited_ary: [0, 0, 0, 0, -1, -1, 0, 0, 0, -1], diffLv: [3, 7, 11, 15, 0, 0, 7, 11, 15, 0] }, + { mcode: 38733, limited_ary: [0, 0, 0, 0, -1, -1, 0, 0, 0, -1], diffLv: [2, 5, 9, 12, 0, 0, 5, 9, 12, 0] }, + + { mcode: 38736, limited_ary: [2, 2, 2, 2, -1, -1, 2, 2, 2, -1], diffLv: [2, 5, 8, 13, 0, 0, 5, 8, 13, 0] }, + { mcode: 38735, limited_ary: [2, 2, 2, 2, -1, -1, 2, 2, 2, -1], diffLv: [3, 6, 10, 16, 0, 0, 6, 10, 16, 0] }, + { mcode: 38728, limited_ary: [2, 2, 2, 2, -1, -1, 2, 2, 2, -1], diffLv: [3, 7, 12, 15, 0, 0, 7, 12, 15, 0] }, + + { mcode: 38624, limited_ary: [2, 2, 2, 2, 2, -1, 2, 2, 2, 2], diffLv: [2, 5, 10, 15, 17, 0, 5, 10, 15, 17] }, + { mcode: 38623, limited_ary: [2, 2, 2, 2, 2, -1, 2, 2, 2, 2], diffLv: [3, 11, 15, 17, 18, 0, 11, 14, 17, 18] }, + { mcode: 38628, limited_ary: [2, 2, 2, 2, -1, -1, 2, 2, 2, -1], diffLv: [5, 9, 14, 18, 0, 0, 9, 14, 18, 0] }, + + { mcode: 38746, limited_ary: [2, 2, 2, 2, -1, -1, 2, 2, 2, -1], diffLv: [4, 8, 14, 16, 0, 0, 8, 14, 16, 0] }, + { mcode: 38745, limited_ary: [2, 2, 2, 2, -1, -1, 2, 2, 2, -1], diffLv: [3, 7, 12, 16, 0, 0, 7, 12, 16, 0] }, + { mcode: 38744, limited_ary: [2, 2, 2, 2, -1, -1, 2, 2, 2, -1], diffLv: [4, 7, 13, 17, 0, 0, 7, 13, 17, 0] }, + { mcode: 38747, limited_ary: [2, 2, 2, 2, -1, -1, 2, 2, 2, -1], diffLv: [4, 10, 15, 18, 0, 0, 10, 15, 18, 0] }, + { mcode: 38748, limited_ary: [2, 2, 2, 2, -1, -1, 2, 2, 2, -1], diffLv: [4, 9, 13, 16, 0, 0, 9, 13, 16, 0] } ] export const EVENTS_WORLD = [ - { id: 1, no: 1, sid: 38667, type: 70 }, { id: 2, no: 1, sid: 38667, type: 71 }, { id: 3, no: 1, sid: 38667, type: 72 }, { id: 4, no: 1, sid: 38667, type: 73 }, - { id: 5, no: 1, sid: 38661, type: 70 }, { id: 6, no: 1, sid: 38661, type: 71 }, { id: 7, no: 1, sid: 38661, type: 72 }, { id: 8, no: 1, sid: 38661, type: 73 }, - { id: 9, no: 1, sid: 38668, type: 70 }, { id: 10, no: 1, sid: 38668, type: 71 }, { id: 11, no: 1, sid: 38668, type: 72 }, { id: 12, no: 1, sid: 38668, type: 73 }, - { id: 13, no: 1, sid: 38665, type: 70 }, { id: 14, no: 1, sid: 38665, type: 71 }, { id: 15, no: 1, sid: 38665, type: 72 }, { id: 16, no: 1, sid: 38665, type: 73 }, - { id: 17, no: 1, sid: 38665, type: 74 }, { id: 18, no: 1, sid: 38669, type: 70 }, { id: 19, no: 1, sid: 38669, type: 71 }, { id: 20, no: 1, sid: 38669, type: 72 }, - { id: 21, no: 1, sid: 38669, type: 73 }, { id: 22, no: 1, sid: 38669, type: 74 }, { id: 23, no: 1, sid: 38659, type: 70 }, { id: 24, no: 1, sid: 38659, type: 71 }, - { id: 25, no: 1, sid: 38659, type: 72 }, { id: 26, no: 1, sid: 38659, type: 73 }, { id: 27, no: 1, sid: 38659, type: 74 }, { id: 28, no: 1, sid: 38667, type: 81 }, - { id: 29, no: 1, sid: 38667, type: 82 }, { id: 30, no: 1, sid: 38667, type: 83 }, { id: 31, no: 1, sid: 38661, type: 81 }, { id: 32, no: 1, sid: 38661, type: 82 }, - { id: 33, no: 1, sid: 38661, type: 83 }, { id: 34, no: 1, sid: 38668, type: 81 }, { id: 35, no: 1, sid: 38668, type: 82 }, { id: 36, no: 1, sid: 38668, type: 83 }, - { id: 37, no: 1, sid: 38665, type: 81 }, { id: 38, no: 1, sid: 38665, type: 82 }, { id: 39, no: 1, sid: 38665, type: 83 }, { id: 40, no: 1, sid: 38665, type: 84 }, - { id: 41, no: 1, sid: 38669, type: 81 }, { id: 42, no: 1, sid: 38669, type: 82 }, { id: 43, no: 1, sid: 38669, type: 83 }, { id: 44, no: 1, sid: 38669, type: 84 }, - { id: 45, no: 1, sid: 38659, type: 81 }, { id: 46, no: 1, sid: 38659, type: 82 }, { id: 47, no: 1, sid: 38659, type: 83 }, { id: 48, no: 1, sid: 38659, type: 84 } -] \ No newline at end of file + { id: 89, no: 0, cond: 0, rwrd: 0, type: 9999 }, + { id: 96, no: 0, cond: 0, rwrd: 0, type: 9999 }, + + { id: 1, no: 1, cond: 1, rwrd: 38667, type: 70 }, { id: 2, no: 1, cond: 1, rwrd: 38667, type: 71 }, { id: 3, no: 1, cond: 1, rwrd: 38667, type: 72 }, { id: 4, no: 1, cond: 1, rwrd: 38667, type: 73 }, + { id: 5, no: 1, cond: 1, rwrd: 38661, type: 70 }, { id: 6, no: 1, cond: 1, rwrd: 38661, type: 71 }, { id: 7, no: 1, cond: 1, rwrd: 38661, type: 72 }, { id: 8, no: 1, cond: 1, rwrd: 38661, type: 73 }, + { id: 9, no: 1, cond: 1, rwrd: 38668, type: 70 }, { id: 10, no: 1, cond: 1, rwrd: 38668, type: 71 }, { id: 11, no: 1, cond: 1, rwrd: 38668, type: 72 }, { id: 12, no: 1, cond: 1, rwrd: 38668, type: 73 }, + { id: 13, no: 1, cond: 1, rwrd: 38665, type: 70 }, { id: 14, no: 1, cond: 1, rwrd: 38665, type: 71 }, { id: 15, no: 1, cond: 1, rwrd: 38665, type: 72 }, { id: 16, no: 1, cond: 1, rwrd: 38665, type: 73 }, { id: 17, no: 1, cond: 1, rwrd: 38665, type: 74 }, + { id: 18, no: 1, cond: 1, rwrd: 38669, type: 70 }, { id: 19, no: 1, cond: 1, rwrd: 38669, type: 71 }, { id: 20, no: 1, cond: 1, rwrd: 38669, type: 72 }, { id: 21, no: 1, cond: 1, rwrd: 38669, type: 73 }, { id: 22, no: 1, cond: 1, rwrd: 38669, type: 74 }, + { id: 23, no: 1, cond: 1, rwrd: 38659, type: 70 }, { id: 24, no: 1, cond: 1, rwrd: 38659, type: 71 }, { id: 25, no: 1, cond: 1, rwrd: 38659, type: 72 }, { id: 26, no: 1, cond: 1, rwrd: 38659, type: 73 }, { id: 27, no: 1, cond: 1, rwrd: 38659, type: 74 }, + { id: 28, no: 1, cond: 1, rwrd: 38667, type: 81 }, { id: 29, no: 1, cond: 1, rwrd: 38667, type: 82 }, { id: 30, no: 1, cond: 1, rwrd: 38667, type: 83 }, + { id: 31, no: 1, cond: 1, rwrd: 38661, type: 81 }, { id: 32, no: 1, cond: 1, rwrd: 38661, type: 82 }, { id: 33, no: 1, cond: 1, rwrd: 38661, type: 83 }, + { id: 34, no: 1, cond: 1, rwrd: 38668, type: 81 }, { id: 35, no: 1, cond: 1, rwrd: 38668, type: 82 }, { id: 36, no: 1, cond: 1, rwrd: 38668, type: 83 }, + { id: 37, no: 1, cond: 1, rwrd: 38665, type: 81 }, { id: 38, no: 1, cond: 1, rwrd: 38665, type: 82 }, { id: 39, no: 1, cond: 1, rwrd: 38665, type: 83 }, { id: 40, no: 1, cond: 1, rwrd: 38665, type: 84 }, + { id: 41, no: 1, cond: 1, rwrd: 38669, type: 81 }, { id: 42, no: 1, cond: 1, rwrd: 38669, type: 82 }, { id: 43, no: 1, cond: 1, rwrd: 38669, type: 83 }, { id: 44, no: 1, cond: 1, rwrd: 38669, type: 84 }, + { id: 45, no: 1, cond: 1, rwrd: 38659, type: 81 }, { id: 46, no: 1, cond: 1, rwrd: 38659, type: 82 }, { id: 47, no: 1, cond: 1, rwrd: 38659, type: 83 }, { id: 48, no: 1, cond: 1, rwrd: 38659, type: 84 }, + + { id: 49, no: 0, cond: 2, rwrd: 38736, type: 27 }, { id: 50, no: 0, cond: 2, rwrd: 38735, type: 27 }, { id: 51, no: 0, cond: 2, rwrd: 38728, type: 27 }, + { id: 52, no: 0, cond: 1, rwrd: 38624, type: 27 }, { id: 53, no: 0, cond: 1, rwrd: 38623, type: 27 }, { id: 54, no: 0, cond: 1, rwrd: 38628, type: 27 }, + + { id: 55, no: 0, cond: 1, rwrd: 38736, type: 25 }, { id: 56, no: 1, cond: 1, rwrd: 38736, type: 25 }, { id: 57, no: 2, cond: 1, rwrd: 38736, type: 25 }, { id: 58, no: 3, cond: 1, rwrd: 38736, type: 25 }, + { id: 59, no: 0, cond: 1, rwrd: 38735, type: 25 }, { id: 60, no: 1, cond: 1, rwrd: 38735, type: 25 }, { id: 61, no: 2, cond: 1, rwrd: 38735, type: 25 }, { id: 62, no: 3, cond: 1, rwrd: 38735, type: 25 }, + { id: 63, no: 0, cond: 1, rwrd: 38728, type: 25 }, { id: 64, no: 1, cond: 1, rwrd: 38728, type: 25 }, { id: 65, no: 2, cond: 1, rwrd: 38728, type: 25 }, { id: 66, no: 3, cond: 1, rwrd: 38728, type: 25 }, + { id: 67, no: 0, cond: 1, rwrd: 38624, type: 25 }, { id: 68, no: 1, cond: 1, rwrd: 38624, type: 25 }, { id: 69, no: 2, cond: 1, rwrd: 38624, type: 25 }, { id: 70, no: 3, cond: 1, rwrd: 38624, type: 25 }, { id: 71, no: 4, cond: 1, rwrd: 38624, type: 25, dep: [67, 68, 69, 70, 72, 73, 74, 75, 77, 78, 79, 80] }, + { id: 72, no: 0, cond: 1, rwrd: 38623, type: 25 }, { id: 73, no: 1, cond: 1, rwrd: 38623, type: 25 }, { id: 74, no: 2, cond: 1, rwrd: 38623, type: 25 }, { id: 75, no: 3, cond: 1, rwrd: 38623, type: 25 }, { id: 76, no: 4, cond: 1, rwrd: 38623, type: 25, dep: [67, 68, 69, 70, 71, 72, 73, 74, 75, 77, 78, 79, 80] }, + { id: 77, no: 0, cond: 1, rwrd: 38628, type: 25 }, { id: 78, no: 1, cond: 1, rwrd: 38628, type: 25 }, { id: 79, no: 2, cond: 1, rwrd: 38628, type: 25 }, { id: 80, no: 3, cond: 1, rwrd: 38628, type: 25 }, + { id: 81, no: 0, cond: 1, rwrd: 1185, type: 201, save: 1, dep: [67, 68, 69, 70, 72, 73, 74, 75, 77, 78, 79, 80] }, + { id: 82, no: 0, cond: 1, rwrd: 1186, type: 201, save: 1, dep: [67, 68, 69, 70, 71, 72, 73, 74, 75, 77, 78, 79, 80] }, + + { id: 83, no: 0, cond: 1, rwrd: 38746, type: 17, comp: 0, save: 1 }, + { id: 84, no: 0, cond: 1, rwrd: 38745, type: 17, comp: 0, save: 1 }, + { id: 85, no: 0, cond: 1, rwrd: 38744, type: 17, comp: 0, save: 1 }, + { id: 86, no: 0, cond: 1, rwrd: 38747, type: 17, comp: 0, save: 1 }, + { id: 87, no: 0, cond: 1, rwrd: 38748, type: 17, comp: 0, save: 1 }, + { id: 88, no: 0, cond: 1, rwrd: 1189, type: 201, save: 1 } +] \ No newline at end of file diff --git a/handlers/ddrworld.ts b/handlers/ddrworld.ts index 818fa89..053cbce 100644 --- a/handlers/ddrworld.ts +++ b/handlers/ddrworld.ts @@ -43,8 +43,6 @@ async function saveScores(refid: string, songId: number, style: number, difficul export const playerdatanew: EPR = async (info, data, send) => { const refid = $(data).str("data.refid"); - console.log('playerdatanew') - console.log("----------------------") let ddrCode = _.random(1, 99999999) await DB.Upsert(refid, { collection: "profile3" }, { collection: "profile3", @@ -222,10 +220,10 @@ export const playerdatasave: EPR = async (info, data, send) => { let eid = e.number('eventid') let eno = e.number('eventno') let etype = e.number('eventtype') - let ctime = getDate() + let ctime = e.number('comptime') let sdata = e.number('savedata') - await DB.Upsert(refid, { collection: "event3", eventId: eid }, { + await DB.Upsert(refid, { collection: "event3", eventId: eid, eventNo: eno, eventType: etype }, { collection: "event3", eventId: eid, eventNo: eno, @@ -385,11 +383,36 @@ export const playerdataload: EPR = async (info, data, send) => { } let eventFin = [] + let eventData = await DB.Find(refid, { collection: "event3"}); for(const event of EVENTS_WORLD) { - let eventData = await DB.FindOne(refid, { collection: "event3", eventId: event.id, eventNo: event.no }); - eventFin.push({ - event_str: K.ITEM('str', event.id + ',' + event.type + ',' + event.no + ',0,' + event.sid + ',' + ((eventData) ? BigInt(eventData.compTime) : '0') + ',' + ((eventData) ? eventData.saveData : '0')) - }) + let eData = eventData.find(e => e.eventId === event.id) + let condmet = true + if(event.dep) { + event.dep.forEach(dep => { + let eData = eventData.find(e => e.eventId === dep) + if(eData === undefined) condmet = false + else if(eData.compTime === 0) condmet = false + }) + } + // id,type,no,condition,reward,comptime,savedata + if(condmet) { + if(event.type === 17) { + if (eData) eData.compTime = eData.compTime ? 0 : 1 + event.comp = event.comp ? 0 : 1 + } + eventFin.push({ + event_str: K.ITEM('str', event.id + ',' + event.type + ',' + event.no + ',' + event.cond + ',' + event.rwrd + ',' + (eData ? BigInt(eData.compTime) : (event.comp !== undefined ? event.comp : '0')) + ',' + ((eData) ? eData.saveData : ((event.save !== undefined) ? event.save : '0'))) + }) + } + } + + // test + if(IO.Exists('data/test.json')) { + let bufTest = await IO.ReadFile('data/test.json') + let eventTest = JSON.parse(bufTest.toString()) + for(const ex in eventTest['eventtest']) { + eventFin.push({ event_str: K.ITEM('str', eventTest['eventtest'][ex]) }) + } } return send.object({ @@ -479,6 +502,7 @@ export const playerdataload: EPR = async (info, data, send) => { }; export const musicdataload: EPR = async (info, data, send) => { + // I personally use the last A3 db for this, will check for missing songs let musicList = [] if(IO.Exists('data/musicdb.xml')) { let mdb = U.parseXML(U.DecodeString(await IO.ReadFile('data/musicdb.xml'), "shift_jis"), false) @@ -495,6 +519,7 @@ export const musicdataload: EPR = async (info, data, send) => { } } + for(const music of SONGS_WORLD) { for(const [index, diff] of music.diffLv.entries()) { if(music.limited_ary[index] != -1) { @@ -504,6 +529,20 @@ export const musicdataload: EPR = async (info, data, send) => { } } } + // test + if(IO.Exists('data/test.json')) { + let bufTest = await IO.ReadFile('data/test.json') + let eventTest = JSON.parse(bufTest.toString()) + for(const ex in eventTest['songstest']) { + for(const [index, diff] of eventTest['songstest'][ex].diffLv.entries()) { + if(eventTest['songstest'][ex].limited_ary[index] != -1) { + musicList.push({ + music_str: K.ITEM('str', eventTest['songstest'][ex].mcode + ',' + ((index > 4) ? '1,' : '0,') + (index % 5) + ',' + eventTest['songstest'][ex].limited_ary[index] + ',' + diff) + }) + } + } + } + } return send.object({ result: K.ITEM("s32", 0), @@ -520,7 +559,6 @@ export const rivaldataload: EPR = async (info, data, send) => { }; export const ghostdataload: EPR = async (info, data, send) => { - // i quite frankly dk what this is for lol i don't play ddr const refid = $(data).str("data.refid"); const ghostId = $(data).number("data.ghostid"); let ghostData = await DB.FindOne(refid, {collection: 'ghost3', songId: ghostId}) @@ -543,7 +581,6 @@ export const taboowordcheck: EPR = async (info, data, send) => { }; export const minidump: EPR = async (info, data, send) => { - console.log($(data).str('minidump')) return send.object({ result: K.ITEM('s32', 0) }) }; diff --git a/index.ts b/index.ts index 8552ae6..6f7f155 100644 --- a/index.ts +++ b/index.ts @@ -4,6 +4,7 @@ import { usergamedata_recv } from "./handlers/usergamedata_recv"; import { usergamedata_send } from "./handlers/usergamedata_send"; import { musicdataload, playerdatanew, playerdatasave, playerdataload, rivaldataload, ghostdataload, taboowordcheck, minidump } from "./handlers/ddrworld"; import { CommonOffset, OptionOffset, Profile } from "./models/profile"; +import { ProfileWorld } from "./models/ddrworld"; export function register() { R.GameCode("MDX"); @@ -165,4 +166,20 @@ export function register() { }); } }); + + R.WebUIEvent("updateName3", async ({ refid, name }) => { + await DB.Update(refid, { collection: "profile3" }, { + $set: { + dancerName: name + } + }); + }); + + R.WebUIEvent("updateWeight3", async ({ refid, weight }) => { + await DB.Update(refid, { collection: "profile3" }, { + $set: { + weight: weight + } + }); + }); } diff --git a/webui/js/profile_settings.js b/webui/js/profile_settings.js index 76fb7c9..0bbaf0d 100644 --- a/webui/js/profile_settings.js +++ b/webui/js/profile_settings.js @@ -12,6 +12,21 @@ $('#change-weight').on('click', () => { emit('updateWeight', { refid, weight }).then(() => location.reload()); }); +$('#change-name3').on('click', () => { + const name = $('#name3').val().toUpperCase(); + + emit('updateName3', { refid, name }).then(() => location.reload()); +}); + +$('#change-weight3').on('click', () => { + const weight1 = $('#weight31').val(); + const weight2 = $('#weight32').val(); + const weight = parseInt(weight1 + '.' + weight2); + + emit('updateWeight3', { refid, weight }).then(() => location.reload()); +}); + + $('#change-display-calories').on('click', () => { const selected = $('#display_calories option:selected').val(); diff --git a/webui/profile_settings.pug b/webui/profile_settings.pug index 1edb120..58dd80e 100644 --- a/webui/profile_settings.pug +++ b/webui/profile_settings.pug @@ -147,15 +147,9 @@ if profile else if profile3 - - const name = profile3.dancerName; - const weight = profile3.weight; - const dispWeight = profile3.isDispWeight; - // const character = parseInt(common[4]); - const arrowSkin = profile3.arrowDesign; - const guideline = profile3.opGuideline; - // const filter = parseInt(option[12]); - const judgmentPriority = profile3.arrowPriority; - const displayTiming = profile3.opTimingDisp; + const name3 = profile3.dancerName; + const weight3 = profile3.weight.toString().split('.'); + if(weight3.length < 2) weight3.push("0"); div .card @@ -171,110 +165,16 @@ else if profile3 label.label Dancer Name .field-body p.control - input.input(type="text", id="dancer_name", pattern="[A-Z]{8}", maxlength=8, value=name) - //- p.control - //- a.button.is-primary#change-name Change - - //- .field.is-horizontal.has-addons - //- .field-label.is-normal - //- label.label Workout Weight - //- .field-body - //- p.control - //- input.input(type="number", id="weight_1", value=weight.split(".")[0]) - //- p.control - //- input.input(type="number", id="weight_2", value=weight.split(".")[1]) - //- p.control - //- a.button.is-primary#change-weight Change - - //- .field.is-horizontal.has-addons - //- .field-label.is-normal - //- label.label Workout Display Calories - //- .field-body - //- p.control - //- .select - //- select#display_calories - //- if (dispWeight === 1) - //- option(value=0) Off - //- option(value=1, selected) On - //- else - //- option(value=0, selected) Off - //- option(value=1) On - //- p.control - //- a.button.is-primary#change-display-calories Submit - - //- .field.is-horizontal.has-addons - //- .field-label.is-normal - //- label.label Arrow Skin - //- .field-body - //- p.control - //- .select - //- select#arrow_skin - //- each v, i in arrowSkins - //- if (arrowSkin === i) - //- option(value=i, selected) #{v} - //- else - //- option(value=i) #{v} - //- p.control - //- a.button.is-primary#change-arrow-skin Submit - - //- .field.is-horizontal.has-addons - //- .field-label.is-normal - //- label.label Guideline - //- .field-body - //- p.control - //- .select - //- select#guideline - //- each v, i in guidelines - //- if (guideline === i) - //- option(value=i, selected) #{v} - //- else - //- option(value=i) #{v} - //- p.control - //- a.button.is-primary#change-guideline Submit - - //- .field.is-horizontal.has-addons - //- .field-label.is-normal - //- label.label Filter concentration - //- .field-body - //- p.control - //- .select - //- select#filter - //- each v, i in filters - //- if (filter === i) - //- option(value=i, selected) #{v} - //- else - //- option(value=i) #{v} - //- p.control - //- a.button.is-primary#change-filter Submit - - //- .field.is-horizontal.has-addons - //- .field-label.is-normal - //- label.label Judgment display priority - //- .field-body - //- p.control - //- .select - //- select#judgment_priority - //- each v, i in judgmentPrioritys - //- if (judgmentPriority === i) - //- option(value=i, selected) #{v} - //- else - //- option(value=i) #{v} - //- p.control - //- a.button.is-primary#change-judgment-priority Submit - - //- .field.is-horizontal.has-addons - //- .field-label.is-normal - //- label.label Display Timing judgment - //- .field-body - //- p.control - //- .select - //- select#display_timing - //- each v, i in ["Off", "On"] - //- if (displayTiming === i) - //- option(value=i, selected) #{v} - //- else - //- option(value=i) #{v} - //- p.control - //- a.button.is-primary#change-display-timing Submit + input.input(type="text", id="name3", pattern="[A-Z]{8}", maxlength=8, value=name3) + p.control + a.button.is-primary#change-name3 Change + .field-label.is-normal + label.label Weight + .field-body + p.control + input.input(type="text", id="weight31", pattern="[0-9]*", value=weight3[0]) + input.input(type="text", id="weight32", pattern="[0-9]", value=weight3[1]) + p.control + a.button.is-primary#change-weight3 Set script(src="static/js/profile_settings.js")