From 29cf7add112524f4b685d6836d881f10515162cf Mon Sep 17 00:00:00 2001 From: wish Date: Sat, 11 Mar 2023 16:26:16 +1100 Subject: [PATCH] rework netcafe course activation --- config.json | 1 - network/mhfpacket/msg_sys_update_right.go | 18 +++++++++--------- server/channelserver/handlers.go | 11 ++++++++--- 3 files changed, 17 insertions(+), 13 deletions(-) diff --git a/config.json b/config.json index 98311f132..cd86056a3 100644 --- a/config.json +++ b/config.json @@ -85,7 +85,6 @@ {"Name": "HunterSupport", "Enabled": false}, {"Name": "NBoost", "Enabled": false}, {"Name": "NetCafe", "Enabled": true}, - {"Name": "OfficialCafe", "Enabled": true}, {"Name": "HLRenewing", "Enabled": true}, {"Name": "EXRenewing", "Enabled": true} ], diff --git a/network/mhfpacket/msg_sys_update_right.go b/network/mhfpacket/msg_sys_update_right.go index d6260c934..8364e37bf 100644 --- a/network/mhfpacket/msg_sys_update_right.go +++ b/network/mhfpacket/msg_sys_update_right.go @@ -78,25 +78,25 @@ func (m *MsgSysUpdateRight) Build(bf *byteframe.ByteFrame, ctx *clientctx.Client func Courses() []Course { var courses = []Course{ {Aliases: []string{"Trial", "TL"}, ID: 1}, - {Aliases: []string{"HunterLife", "HL"}, ID: 2}, + {Aliases: []string{"HunterLife", "HL"}, ID: 2}, // BASIC {Aliases: []string{"Extra", "ExtraA", "EX"}, ID: 3}, {Aliases: []string{"ExtraB"}, ID: 4}, {Aliases: []string{"Mobile"}, ID: 5}, {Aliases: []string{"Premium"}, ID: 6}, {Aliases: []string{"Pallone", "ExtraC"}, ID: 7}, - {Aliases: []string{"Assist", "Legend", "Rasta"}, ID: 8}, // Legend + {Aliases: []string{"Assist", "Legend", "Rasta"}, ID: 8}, // LEGEND {Aliases: []string{"N"}, ID: 9}, - {Aliases: []string{"Hiden", "Secret"}, ID: 10}, // Secret - {Aliases: []string{"HunterSupport", "HunterAid", "Support", "Aid", "Royal"}, ID: 11}, // Royal + {Aliases: []string{"Hiden", "Secret"}, ID: 10}, // SECRET + {Aliases: []string{"HunterSupport", "HunterAid", "Support", "Aid", "Royal"}, ID: 11}, // ROYAL {Aliases: []string{"NBoost", "NetCafeBoost", "Boost"}, ID: 12}, // 13-19 = (unknown), 20 = DEBUG, 21 = COG_LINK_EXPIRED, 22 = 360_GOLD, 23 = PS3_TROP {Aliases: []string{"COG"}, ID: 24}, - {Aliases: []string{"NetCafe", "Cafe", "InternetCafe"}, ID: 25}, - {Aliases: []string{"OfficialCafe", "Official"}, ID: 26}, - {Aliases: []string{"HLRenewing", "HLR", "HLRenewal", "HLRenew"}, ID: 27}, - {Aliases: []string{"EXRenewing", "EXR", "EXRenewal", "EXRenew"}, ID: 28}, + // 25 = CAFE_SP, active with 26 but useless on it's own? Just use OFFICIAL and set bit + {Aliases: []string{"NetCafe", "Cafe", "OfficialCafe", "Official"}, ID: 26}, + {Aliases: []string{"HLRenewing", "HLR", "HLRenewal", "HLRenew"}, ID: 27}, // CARD + {Aliases: []string{"EXRenewing", "EXR", "EXRenewal", "EXRenew"}, ID: 28}, // CARD_EX {Aliases: []string{"Free"}, ID: 29}, - // 30 = real netcafe bit + // 30 = NETCAFE, what actually gives you any NetCafe gameplay benefits } for i := range courses { courses[i].Value = uint32(math.Pow(2, float64(courses[i].ID))) diff --git a/server/channelserver/handlers.go b/server/channelserver/handlers.go index 5ca89c86d..343b12094 100644 --- a/server/channelserver/handlers.go +++ b/server/channelserver/handlers.go @@ -78,13 +78,18 @@ func updateRights(s *Session) { s.server.db.QueryRow("SELECT rights FROM users u INNER JOIN characters c ON u.id = c.user_id WHERE c.id = $1", s.charID).Scan(&rightsInt) s.courses = mhfpacket.GetCourseStruct(rightsInt) rights := []mhfpacket.ClientRight{{1, 0, 0}} - var netcafeBitSet bool + var normalCafeBitSet, netcafeBitSet bool for _, course := range s.courses { - if (course.ID == 9 || course.ID == 25 || course.ID == 26) && !netcafeBitSet { + if (course.ID == 9 || course.ID == 26) && !netcafeBitSet { netcafeBitSet = true - rightsInt += 0x40000000 // set netcafe bit + rightsInt += 0x40000000 rights = append(rights, mhfpacket.ClientRight{ID: 30}) } + if (course.ID == 26) && !normalCafeBitSet { + normalCafeBitSet = true + rightsInt += 0x2000000 + rights = append(rights, mhfpacket.ClientRight{ID: 25}) + } rights = append(rights, mhfpacket.ClientRight{ID: course.ID, Timestamp: 0x70DB59F0}) } update := &mhfpacket.MsgSysUpdateRight{