standardized code comments

This commit is contained in:
sin365
2026-02-26 17:31:44 +08:00
parent ee88fd7218
commit a23a9ca5c6

View File

@@ -145,8 +145,9 @@ func handleMsgMhfEnumerateShop(s *Session, p mhfpacket.MHFPacket) {
bf.WriteUint16(uint16(len(gachas))) bf.WriteUint16(uint16(len(gachas)))
for _, g := range gachas { for _, g := range gachas {
bf.WriteUint32(g.ID) bf.WriteUint32(g.ID)
if _config.ErupeConfig.RealClientMode >= _config.GG { //GG之前这段数据都没有 G1就没有如下数据 G1只有ID和名字 Before GG, there was no data for G1, so there was no data for G1 except for ID and name if _config.ErupeConfig.RealClientMode >= _config.GG {
//TODO 但是G2 和G3 的差异还需要测试G1和GG的数据已经清晰 But the difference between G2 and G3 still needs to be tested, and the data for G1 and GG are already clear //Before GG, there was no data for G1, so there was no data for G1 except for ID and name
//But the difference between G2 and G3 still needs to be tested, and the data for G1 and GG are already clear
bf.WriteUint32(0) // Unknown rank restrictions bf.WriteUint32(0) // Unknown rank restrictions
bf.WriteUint32(0) bf.WriteUint32(0)
bf.WriteUint32(0) bf.WriteUint32(0)
@@ -156,7 +157,7 @@ func handleMsgMhfEnumerateShop(s *Session, p mhfpacket.MHFPacket) {
bf.WriteUint32(0) // only 0 in known packet bf.WriteUint32(0) // only 0 in known packet
} }
ps.Uint8(bf, g.Name, true) ps.Uint8(bf, g.Name, true)
if _config.ErupeConfig.RealClientMode <= _config.GG { //小于等于GG的版本每一条发送到名字就结束了 For versions less than or equal to GG, each message sent to the name ends if _config.ErupeConfig.RealClientMode <= _config.GG { //For versions less than or equal to GG, each message sent to the name ends
continue continue
} }
ps.Uint8(bf, g.URLBanner, false) ps.Uint8(bf, g.URLBanner, false)
@@ -202,58 +203,31 @@ func handleMsgMhfEnumerateShop(s *Session, p mhfpacket.MHFPacket) {
for _, ge := range entries { for _, ge := range entries {
var items []GachaItem var items []GachaItem
if _config.ErupeConfig.RealClientMode <= _config.GG { if _config.ErupeConfig.RealClientMode <= _config.GG {
/* // If you need to configure the optional material list among the three options,Configure directly in gacha_detries,The same Entry Type can be merged and displayed in GG,In addition, the prizes are also directly configured in the gacha-entries table,
如果需要在三个选项中配置可选素材列表里, // MHFG1~GG does not use the gacha_items table throughout the entire process, which meets the lottery function of MHFG with a more single function
直接在gacha_entries中配置 // In addition, the MHFG function itself is relatively simple,Example of lottery configuration for G1~GG:
同样的EntryType即可在GG中合并显示 // eg: gachaname:test
此外奖品也直接在gacha_entries表中配置 // entry: itemgroup: group1:(choose one of the two) ITEM_1_ID:7 COUNT:1 ITEM_1_ID:8 COUNT:2group2:ITEM_1_ID:9 COUNT:3 ; reward:reward1: ITEM_ID:1 COUNT:4 weight:10% reward1: ITEM_ID:2 COUNT:5 weight:90%
MHFG1~GG全程不使用gacha_items表已满足MHFG功能更单一的抽奖功能 // table:gacha_shop |1|0|0|test|null|null|null|f|f|3|f|
此外本身MHFG功能就比较单一 // table:gacha_entries
G1 ~ GG的抽奖配置 示例: // |1|1|0|7|7|1|0|0|0|0|0|null|
// |4|1|0|7|8|2|0|0|0|0|0|null|
If you need to configure the optional material list among the three options, // |5|1|1|7|9|3|0|0|0|0|0|null|
Configure directly in gacha_detries // |8|1|100|7|1|4|1000|0|0|0|0|null|
The same Entry Type can be merged and displayed in GG // |9|1|100|7|2|5|9000|0|0|0|0|null|
In addition, the prizes are also directly configured in the gacha-entries table, bf.WriteUint8(ge.EntryType)
MHFG1~GG does not use the gacha_items table throughout the entire process, which meets the lottery function of MHFG with a more single function bf.WriteUint32(ge.ID)
In addition, the MHFG function itself is relatively simple bf.WriteUint8(ge.ItemType)
Example of lottery configuration for G1~GG: bf.WriteUint32(ge.ItemNumber)
eg: bf.WriteUint16(ge.ItemQuantity)
gachaname:test
entry:
itemgroup:
group1:(choose one of the two) ITEM_1_ID:7 COUNT:1 ITEM_1_ID:8 COUNT:2
group2:ITEM_1_ID:9 COUNT:3
reward:
reward1: ITEM_ID:1 COUNT:4 weight:10%
reward1: ITEM_ID:2 COUNT:5 weight:90%
table:gacha_shop
|id|min_gr|min_hr|name|url_bannel|url_feature|url_thmubnail|wide|recommendded|gacha_type|hidden|
|1|0|0|test|null|null|null|f|f|3|t|
table:gacha_entries
|id|gacha_id|entry_type|item_type|item_number|item_quantity|weight|rarity|rolls|frontier_points|daily_limit|name|
|1|1|0|7|7|1|0|0|0|0|0|null|
|4|1|0|7|8|2|0|0|0|0|0|null|
|5|1|1|7|9|3|0|0|0|0|0|null|
|8|1|100|7|1|4|1000|0|0|0|0|null|
|9|1|100|7|2|5|9000|0|0|0|0|null|
*/
bf.WriteUint8(ge.EntryType) //0
bf.WriteUint32(ge.ID) //1
bf.WriteUint8(ge.ItemType) //5
bf.WriteUint32(ge.ItemNumber) //6
bf.WriteUint16(ge.ItemQuantity) //10
var weightPr uint16 var weightPr uint16
if gachaType >= 4 { // If box //12 概率 if gachaType >= 4 { // If box
weightPr = 1 weightPr = 1
} else { } else {
weightPr = uint16(ge.Weight / divisor) weightPr = uint16(ge.Weight / divisor)
} }
bf.WriteUint16(weightPr) //12 概率 bf.WriteUint16(weightPr)
bf.WriteUint8(0) //14 结束符maybe) bf.WriteUint8(0)
continue continue
} }
bf.WriteUint8(ge.EntryType) bf.WriteUint8(ge.EntryType)