This commit is contained in:
wish
2024-02-21 03:46:15 +11:00
parent b969c53f3a
commit a9b9c94347
6 changed files with 19 additions and 11 deletions

View File

@@ -478,7 +478,7 @@ func handleMsgSysCastBinary(s *Session, p mhfpacket.MHFPacket) {
m := binpacket.MsgBinChat{
Type: BinaryMessageTypeChat,
Flags: 4,
Message: fmt.Sprintf(`%d`, token.RNG().Intn(100)+1),
Message: fmt.Sprintf(`%d`, token.RNG.Intn(100)+1),
SenderName: author,
}
bf := byteframe.NewByteFrame()

View File

@@ -101,8 +101,7 @@ func generateFeatureWeapons(count int) activeFeature {
nums := make([]int, 0)
var result int
for len(nums) < count {
rng := token.RNG()
num := rng.Intn(_max)
num := token.RNG.Intn(_max)
exist := false
for _, v := range nums {
if v == num {

View File

@@ -455,7 +455,7 @@ func handleMsgMhfEntryFesta(s *Session, p mhfpacket.MHFPacket) {
doAckSimpleFail(s, pkt.AckHandle, make([]byte, 4))
return
}
team := uint32(token.RNG().Intn(2))
team := uint32(token.RNG.Intn(2))
switch team {
case 0:
s.server.db.Exec("INSERT INTO festa_registrations VALUES ($1, 'blue')", guild.ID)

View File

@@ -433,13 +433,14 @@ func handleMsgMhfOperateWarehouse(s *Session, p mhfpacket.MHFPacket) {
func addWarehouseItem(s *Session, item mhfitem.MHFItemStack) {
giftBox := warehouseGetItems(s, 10)
item.WarehouseID = token.RNG().Uint32()
item.WarehouseID = token.RNG.Uint32()
giftBox = append(giftBox, item)
s.server.db.Exec("UPDATE warehouse SET item10=$1 WHERE character_id=$2", mhfitem.SerializeWarehouseItems(giftBox), s.charID)
}
func addWarehouseEquipment(s *Session, equipment mhfitem.MHFEquipment) {
giftBox := warehouseGetEquipment(s, 10)
equipment.WarehouseID = token.RNG.Uint32()
giftBox = append(giftBox, equipment)
s.server.db.Exec("UPDATE warehouse SET equip10=$1 WHERE character_id=$2", mhfitem.SerializeWarehouseEquipment(giftBox), s.charID)
}
@@ -509,7 +510,7 @@ func handleMsgMhfUpdateWarehouse(s *Session, p mhfpacket.MHFPacket) {
}
}
if !exists {
uItem.WarehouseID = token.RNG().Uint32()
uItem.WarehouseID = token.RNG.Uint32()
fItems = append(fItems, uItem)
}
}
@@ -532,7 +533,7 @@ func handleMsgMhfUpdateWarehouse(s *Session, p mhfpacket.MHFPacket) {
}
}
if !exists {
uEquip.WarehouseID = token.RNG().Uint32()
uEquip.WarehouseID = token.RNG.Uint32()
fEquip = append(fEquip, uEquip)
}
}