diff --git a/patch-schema/03-event_quests.sql b/patch-schema/03-event_quests.sql index b54758ffe..94aac0c65 100644 --- a/patch-schema/03-event_quests.sql +++ b/patch-schema/03-event_quests.sql @@ -3,14 +3,10 @@ BEGIN; create table if not exists event_quests ( id serial primary key, - index_value integer, max_players integer, quest_type integer not null, quest_id integer not null, - mark integer, - quest_option integer not null, - - + mark integer ); ALTER TABLE IF EXISTS public.servers DROP COLUMN IF EXISTS season; diff --git a/server/channelserver/handlers_quest.go b/server/channelserver/handlers_quest.go index f0995170a..aab84b960 100644 --- a/server/channelserver/handlers_quest.go +++ b/server/channelserver/handlers_quest.go @@ -119,9 +119,8 @@ func loadQuestFile(s *Session, questId int) []byte { func makeEventQuest(s *Session, rows *sql.Rows) ([]byte, error) { var id, mark uint32 var questId int - var indexValue, maxPlayers, questType uint8 - var questOption uint16 - rows.Scan(&id, &indexValue, &maxPlayers, &questType, &questId, &mark, &questOption) + var maxPlayers, questType uint8 + rows.Scan(&id, &maxPlayers, &questType, &questId, &mark) data := loadQuestFile(s, questId) if data == nil { @@ -130,8 +129,8 @@ func makeEventQuest(s *Session, rows *sql.Rows) ([]byte, error) { bf := byteframe.NewByteFrame() bf.WriteUint32(id) - bf.WriteUint32(0) //unk - bf.WriteUint8(indexValue) // Indexer + bf.WriteUint32(0) // Unk + bf.WriteUint8(0) // Unk switch questType { case 16: bf.WriteUint8(s.server.erupeConfig.GameplayOptions.RegularRavienteMaxPlayers) @@ -152,36 +151,38 @@ func makeEventQuest(s *Session, rows *sql.Rows) ([]byte, error) { } else { bf.WriteBool(true) } - bf.WriteUint16(0) //unk counter id possibly? + bf.WriteUint16(0) // Unk if _config.ErupeConfig.RealClientMode >= _config.G1 { bf.WriteUint32(mark) } - bf.WriteUint16(0) //possible padding + bf.WriteUint16(0) // Unk bf.WriteUint16(uint16(len(data))) bf.WriteBytes(data) - //Season/RequiredObject Flag Replacement - bf.Seek(0x18, 0) - // Bitset Structure: bit 8 unk, bit 7 required objective,bit 6 unk,bit 5 night,bit 4 day,bit 3 cold,bit 2 warm,bit 1 breeding + + // Time Flag Replacement + // Bitset Structure: b8 UNK, b7 Required Objective, b6 UNK, b5 Night, b4 Day, b3 Cold, b2 Warm, b1 Spring // if the byte is set to 0 the game choses the quest file corresponding to whatever season the game is on + bf.Seek(25, 0) + flagByte := bf.ReadUint8() + bf.Seek(25, 0) if s.server.erupeConfig.GameplayOptions.SeasonOverride { - bf.WriteUint16(0) + bf.WriteUint8(flagByte & 0b11100000) } else { - bf.WriteUint16(questOption) + bf.WriteUint8(flagByte) } - // Bitset Structure Quest Varient 1: bit 8 Hiden, bit 7 Fix HC,bit 6 HC to UL,bit 5 GRank,bit 4 Unk,bit 3 UNK,bit 2 UNK,bit 1 UNK - // Bitset Structure Quest Varient 2: bit 8 UNK, bit 7 No Halk Pots,bit 6 No halk/poogie,bit 5 Timer,bit 4 UNK,bit 3 Fixed Difficulty,bit 2 UNK,bit 1 UNK - // Bitset Structure Quest Varient 3: bit 8 Disable Reward Skill, bit 7 GSR to GR,bit 6 unk,bit 5 Musou?,bit 4 Zenith,bit 3 Inception,bit 2 UNK,bit 1 UNK - bf.Seek(0xAF, 0) - quest_variant_3 := bf.ReadUint8() - quest_variant_3 &= 0b11011111 //disables Inception flag at position 3 for any quests that dont have it set. - bf.Seek(0xAF, 0) - bf.WriteUint8(quest_variant_3) + // Bitset Structure Quest Variant 1: b8 UL Fixed, b7 UNK, b6 UNK, b5 UNK, b4 G Rank, b3 HC to UL, b2 Fix HC, b1 Hiden + // Bitset Structure Quest Variant 2: b8 Road, b7 High Conquest, b6 Fixed Difficulty, b5 No Active Feature, b4 Timer, b3 No Cuff, b2 No Halk Pots, b1 Low Conquest + // Bitset Structure Quest Variant 3: b8 No Sigils, b7 UNK, b6 Interception, b5 Zenith, b4 No GP Skills, b3 No Simple Mode?, b2 GSR to GR, b1 No Reward Skills + + bf.Seek(175, 0) + questVariant3 := bf.ReadUint8() + questVariant3 &= 0b11011111 // disable Interception flag + bf.Seek(175, 0) + bf.WriteUint8(questVariant3) ps.Uint8(bf, "", true) // Debug/Notes string for quest - return bf.Data(), nil - } func handleMsgMhfEnumerateQuest(s *Session, p mhfpacket.MHFPacket) { @@ -190,7 +191,7 @@ func handleMsgMhfEnumerateQuest(s *Session, p mhfpacket.MHFPacket) { bf := byteframe.NewByteFrame() bf.WriteUint16(0) - rows, _ := s.server.db.Query("SELECT id, COALESCE(max_players, 4) AS max_players, index_value,quest_type, quest_id,quest_option, COALESCE(mark, 0) AS mark FROM event_quests ORDER BY quest_id") + rows, _ := s.server.db.Query("SELECT id, COALESCE(max_players, 4) AS max_players, quest_type, quest_id, COALESCE(mark, 0) AS mark FROM event_quests ORDER BY quest_id") for rows.Next() { data, err := makeEventQuest(s, rows) if err != nil {