304 lines
24 KiB
Go
304 lines
24 KiB
Go
package test
|
|
|
|
import (
|
|
"fmt"
|
|
"server/backend"
|
|
avatarCfg "server/conf/avatar"
|
|
decorateCfg "server/conf/decorate"
|
|
faceCfg "server/conf/face"
|
|
languageCfg "server/conf/language"
|
|
notification_cfg "server/conf/notification"
|
|
"server/db"
|
|
"server/game"
|
|
"server/game/mod/item"
|
|
MsgMod "server/game/mod/msg"
|
|
GoUtil "server/game_util"
|
|
"server/msg"
|
|
"server/pkg/github.com/name5566/leaf/log"
|
|
"sort"
|
|
"testing"
|
|
)
|
|
|
|
func TestThriftServer(t *testing.T) {
|
|
backend.Start()
|
|
}
|
|
|
|
func TestFixDecorate(t *testing.T) {
|
|
// Initialize player
|
|
p := new(game.Player)
|
|
p.FixDecorate()
|
|
|
|
//
|
|
p.InitPlayer("dee8eeb83ea3c54e48427b7ff20066fb")
|
|
p.FixDecorate()
|
|
|
|
DecorateMod := p.GetDecorateMod()
|
|
DecorateMod.AreaId = 3
|
|
DecorateMod.Progress = 22
|
|
p.FixDecorate()
|
|
}
|
|
|
|
func TestFixUserData(t *testing.T) {
|
|
// 确保数据库已初始化
|
|
if db.SqlDb == nil {
|
|
db.InitDB()
|
|
// 等待初始化完成
|
|
for i := 0; i < 10; i++ {
|
|
if db.SqlDb != nil {
|
|
break
|
|
}
|
|
log.Warn("Waiting for database initialization...")
|
|
// time.Sleep(100 * time.Millisecond)
|
|
}
|
|
}
|
|
|
|
if db.SqlDb == nil {
|
|
t.Fatal("Database initialization failed")
|
|
}
|
|
|
|
log.Warn("hello world")
|
|
type account struct {
|
|
Account string `db:"user_name"`
|
|
}
|
|
var accounts []account
|
|
sqlDb := db.GetDB() // 使用线程安全的方式获取连接
|
|
if sqlDb == nil {
|
|
t.Fatal("Database connection is nil")
|
|
}
|
|
err := sqlDb.Select(&accounts, "SELECT `user_name` FROM t_account order by auto_id")
|
|
if err != nil {
|
|
t.Errorf("Failed to fetch accounts: %v", err)
|
|
return
|
|
}
|
|
i := 0
|
|
for _, acc := range accounts {
|
|
i++
|
|
fmt.Printf("Fixing account %d/%d: %s\n", i, len(accounts), acc.Account)
|
|
account := acc.Account
|
|
p := new(game.Player)
|
|
p.InitPlayer(account)
|
|
DecorateMod := p.GetDecorateMod()
|
|
if DecorateMod.PartCost == nil {
|
|
return
|
|
}
|
|
for k := range DecorateMod.PartCost {
|
|
AreaId := decorateCfg.GetAreaIdByIndoorId(k)
|
|
if AreaId < DecorateMod.AreaId {
|
|
log.Debug("Fixing account: %s, PartId: %d, OldAreaId: %d, NewAreaId: %d\n", account, k, AreaId, DecorateMod.AreaId)
|
|
}
|
|
}
|
|
p.Stop()
|
|
p = nil
|
|
}
|
|
log.Debug("All accounts fixed")
|
|
}
|
|
|
|
func TestRandInt(t *testing.T) {
|
|
p1 := new(game.Player)
|
|
p1.InitPlayer("3625212")
|
|
CollectMod := p1.GetCollectMod()
|
|
p1.PushClientRes(CollectMod.BackData(p1.GetOrderFactor()))
|
|
}
|
|
|
|
func TestII(t *testing.T) {
|
|
for i := 0; i < 10; i++ {
|
|
fmt.Printf("i: %d\n", i)
|
|
}
|
|
}
|
|
|
|
func TestLevelUp(t *testing.T) {
|
|
p1 := new(game.Player)
|
|
p1.InitPlayer("3625212")
|
|
PlayerBaseMod := p1.GetPlayerBaseMod()
|
|
PlayerBaseMod.AddExp(p1, 10000, 10000)
|
|
}
|
|
|
|
func TestEndless(t *testing.T) {
|
|
p1 := new(game.Player)
|
|
p1.InitPlayer("3625212")
|
|
p1.ZeroUpdate(nil)
|
|
MailMod := p1.GetMailMod()
|
|
MailMod.BackData()
|
|
}
|
|
|
|
func TestAdmin(t *testing.T) {
|
|
player := new(game.Player)
|
|
player.M_DwUin = 100100626
|
|
player.InitPlayerOnly()
|
|
player.ZeroUpdate(nil)
|
|
}
|
|
|
|
// 10130 10165
|
|
func TestNotify(t *testing.T) {
|
|
titlekey, infokey := notification_cfg.GetFriendApplyNotificationMsg()
|
|
title := languageCfg.GetLanguage(msg.LANG_TYPE(1), titlekey)
|
|
info := languageCfg.GetLanguage(msg.LANG_TYPE(1), infokey)
|
|
// titlekey, infokey := notification_cfg.GetPetroomGameNotificationMsg()
|
|
// title := languageCfg.GetLanguage(msg.LANG_TYPE(1), titlekey)
|
|
// info := languageCfg.GetLanguage(msg.LANG_TYPE(1), infokey)
|
|
GoUtil.NotifyPlayer(3625212, 2, title, fmt.Sprintf(info, "猫猫"))
|
|
// GoUtil.NotifyPlayer(19246, 1, "Test Notification", "This is a test notification from the server.")
|
|
}
|
|
|
|
func TestAnalyzeDecorate(t *testing.T) {
|
|
uids := []int{111354, 111355, 111358, 111364, 111359, 111357, 111363, 111369, 111371, 111379, 111384, 111383, 111366, 111373, 111377, 111389, 111393, 111395, 111401, 111397, 111396, 111403, 111404, 111399, 111409, 111406, 111415, 111410, 111421, 111419, 111413, 111422, 111423, 111425, 111405, 111429, 111356, 111411, 111431, 111424, 111426, 111441, 111428, 111454, 111455, 111436, 111420, 111453, 111460, 111452, 111459, 111458, 111456, 111464, 111465, 111382, 111468, 111472, 111376, 111480, 111362, 111490, 111497, 111498, 111500, 111434, 111496, 111474, 111482, 111504, 111506, 111514, 111515, 111470, 111512, 111523, 111520, 111478, 111533, 111538, 111534, 111491, 111522, 111537, 111446, 111477, 111544, 111526, 111528, 111546, 111543, 111548, 111535, 111432, 111553, 111467, 111542, 111560, 111457, 111549, 111536, 111516, 111531, 111487, 111557, 111529, 111568, 111540, 111539, 111416, 111561, 111555, 111558, 111581, 111475, 111564, 111524, 111484, 111583, 111587, 111585, 111584, 111525, 111552, 111592, 111595, 111603, 111599, 111604, 111591, 111608, 111607, 111598, 111610, 111615, 111614, 111596, 111562, 111572, 111381, 111625, 111621, 111632, 111550, 111630, 111628, 111602, 111567, 111445, 111633, 111623, 111647, 111653, 111649, 111593, 111646, 111645, 111651, 111643, 111611, 111636, 111519, 111661, 111662, 111667, 111670, 111387, 111664, 111650, 111672, 111378, 111660, 111666, 111675, 111663, 111686, 111685, 111575, 111688, 111659, 111691, 111637, 111695, 111676, 111386, 111699, 111701, 111709, 111444, 111702, 111718, 111704, 111679, 111710, 111706, 111617, 111708, 111722, 111721, 111412, 111728, 111720, 111727, 111733, 111563, 111503, 111738, 111729, 111556, 111744, 111732, 111750, 111748, 111745, 111541, 111740, 111747, 111731, 111755, 111761, 111724, 111756, 111760, 111766, 111696, 111717, 111774, 111780, 111776, 111786, 111787, 111785, 111782, 111795, 111798, 111775, 111790, 111800, 111796, 111788, 111792, 111398, 111803, 111802, 111804, 111799, 111811, 111815, 111716, 111759, 111816, 111824, 111814, 111817, 111829, 111807, 111840, 111839, 111835, 111837, 111821, 111810, 111846, 111758, 111834, 111852, 111850, 111820, 111855, 111849, 111848, 111831, 111866, 111844, 111851, 111868, 111826, 111684, 111874, 111880, 111869, 111883, 111884, 111847, 111888, 111887, 111890, 111892, 111857, 111713, 111842, 111854, 111894, 111903, 111877, 111908, 111858, 111794, 111906, 111904, 111767, 111871, 111891, 111910, 111918, 111899, 111914, 111917, 111907, 111875, 111920, 111863, 111913, 111926, 111703, 111825, 111677, 111928, 111753, 111931, 111365, 111762, 111872, 111768, 111878, 111570, 111938, 111935, 111946, 111624, 111944, 111942, 111940, 111833, 111620, 111763, 111957, 111805, 111511, 111948, 111966, 111882, 111967, 111965, 111970, 111867, 111723, 111969, 111941, 111730, 111973, 111978, 111983, 111987, 111989, 111980, 111991, 111569, 111589, 112003, 111990, 111606, 111984, 111998, 112006, 112007, 111461, 111999, 112010, 112012, 111901, 111781, 111812, 112016, 111736, 111771, 111705, 111509, 111488, 112024, 112030, 111961, 111579, 112036, 111616, 112040, 112043, 111997, 112048, 112035, 112052, 111972, 112057, 111669, 111777, 112056, 112032, 112063, 112062, 111793, 112061, 112050, 112066, 112038, 111518, 111673, 112068, 111655, 112071, 112074, 111986, 111943, 112017, 112011, 112083, 112078, 112087, 112020, 111391, 111836, 112082, 112091, 112053, 112090, 111947, 112096, 112099, 112100, 112085, 112101, 112102, 111739, 111671, 112107, 112109, 111433, 111754, 111439, 111838, 111499, 111665, 111476, 111885, 111502, 111627, 111530, 111959, 111414, 111933, 111668, 112079, 111613, 111749, 112027, 111609, 112054, 111678, 111813, 111994, 111513, 111547, 111622, 111692, 111897, 111784, 111492, 112047, 111951, 112039, 111652, 111687, 112033, 112077, 111801, 111437, 111566, 111648, 111735, 111955, 112110, 112055, 112008, 112023, 111719, 111949, 111510, 112037, 111809, 112075, 112058, 111689, 111789, 111545, 111870, 112070, 111797, 112106, 112015, 112073, 112013, 112081, 111443, 111772, 111712, 111698, 112031, 111988, 111956, 111924, 111830, 111993, 112080, 111950, 111930, 111977, 111642, 111626, 112021, 112111, 112069, 111845, 111485, 111783, 111856, 111981, 111605, 111764, 111697, 111881, 111450, 111822, 111408, 111463, 111921, 112041, 112046, 111861, 112009, 111818, 111481, 111905, 111368, 111495, 111360, 112072, 111392, 111823, 111939, 111974, 111927, 112025, 111418, 111979, 112105, 111656, 111508, 111494, 111629, 111934, 112028, 112000, 112086, 111982, 112094, 111929, 111447, 111427, 111964, 111819, 112089, 111769, 111385, 111911, 111937, 111394, 111586, 111471, 111407, 111674, 111963, 111654, 112049, 111442, 111952, 112029, 111690, 112065, 112076, 111912, 112095, 111741, 111638, 111876, 111527, 111751, 111936, 111808, 111590, 111919, 111832, 111400, 111594, 111958, 111451, 111580, 112005, 111853, 111639, 112014, 111743, 111631, 111734, 111574, 111841, 111843, 111681, 111714, 111737, 112060, 111634, 111693, 111757, 111388, 111577, 111640, 111902, 112098, 111435, 111828, 112019, 112022, 111770, 111707, 111862, 111469, 111576, 111466, 111742, 111380, 111954, 111968, 111752, 111909, 111765, 111953, 111778, 112042, 111962, 112001, 112034, 111960, 111619, 111554, 111893, 111865, 111600, 111746, 111985, 111971, 111505, 112051, 111945, 111483, 111916, 111995, 112004, 111859, 112044}
|
|
decorate := make(map[string]int)
|
|
for _, uid := range uids {
|
|
p1 := new(game.Player)
|
|
p1.InitPlayerByUid(uid)
|
|
DecorateMod := p1.GetDecorateMod()
|
|
doco_id := fmt.Sprintf("%d_%d", DecorateMod.AreaId, DecorateMod.Progress)
|
|
decorate[doco_id]++
|
|
p1 = nil
|
|
}
|
|
// Sort by AreaId first, then by Progress
|
|
type decorateInfo struct {
|
|
key string
|
|
count int
|
|
}
|
|
var sorted []decorateInfo
|
|
for k, v := range decorate {
|
|
sorted = append(sorted, decorateInfo{k, v})
|
|
}
|
|
sort.Slice(sorted, func(i, j int) bool {
|
|
var areaI, progressI, areaJ, progressJ int
|
|
fmt.Sscanf(sorted[i].key, "%d_%d", &areaI, &progressI)
|
|
fmt.Sscanf(sorted[j].key, "%d_%d", &areaJ, &progressJ)
|
|
if areaI != areaJ {
|
|
return areaI < areaJ
|
|
}
|
|
return progressI < progressJ
|
|
})
|
|
keys := make([]string, 0, len(sorted))
|
|
values := make([]int, 0, len(sorted))
|
|
for _, item := range sorted {
|
|
keys = append(keys, item.key)
|
|
values = append(values, item.count)
|
|
}
|
|
fmt.Printf("keys: %v\n", keys)
|
|
fmt.Printf("values: %v\n", values)
|
|
}
|
|
|
|
func TestAnalyzeOrder(t *testing.T) {
|
|
uids := []int{111354, 111355, 111358, 111364, 111359, 111357, 111363, 111369, 111371, 111379, 111384, 111383, 111366, 111373, 111377, 111389, 111393, 111395, 111401, 111397, 111396, 111403, 111404, 111399, 111409, 111406, 111415, 111410, 111421, 111419, 111413, 111422, 111423, 111425, 111405, 111429, 111356, 111411, 111431, 111424, 111426, 111441, 111428, 111454, 111455, 111436, 111420, 111453, 111460, 111452, 111459, 111458, 111456, 111464, 111465, 111382, 111468, 111472, 111376, 111480, 111362, 111490, 111497, 111498, 111500, 111434, 111496, 111474, 111482, 111504, 111506, 111514, 111515, 111470, 111512, 111523, 111520, 111478, 111533, 111538, 111534, 111491, 111522, 111537, 111446, 111477, 111544, 111526, 111528, 111546, 111543, 111548, 111535, 111432, 111553, 111467, 111542, 111560, 111457, 111549, 111536, 111516, 111531, 111487, 111557, 111529, 111568, 111540, 111539, 111416, 111561, 111555, 111558, 111581, 111475, 111564, 111524, 111484, 111583, 111587, 111585, 111584, 111525, 111552, 111592, 111595, 111603, 111599, 111604, 111591, 111608, 111607, 111598, 111610, 111615, 111614, 111596, 111562, 111572, 111381, 111625, 111621, 111632, 111550, 111630, 111628, 111602, 111567, 111445, 111633, 111623, 111647, 111653, 111649, 111593, 111646, 111645, 111651, 111643, 111611, 111636, 111519, 111661, 111662, 111667, 111670, 111387, 111664, 111650, 111672, 111378, 111660, 111666, 111675, 111663, 111686, 111685, 111575, 111688, 111659, 111691, 111637, 111695, 111676, 111386, 111699, 111701, 111709, 111444, 111702, 111718, 111704, 111679, 111710, 111706, 111617, 111708, 111722, 111721, 111412, 111728, 111720, 111727, 111733, 111563, 111503, 111738, 111729, 111556, 111744, 111732, 111750, 111748, 111745, 111541, 111740, 111747, 111731, 111755, 111761, 111724, 111756, 111760, 111766, 111696, 111717, 111774, 111780, 111776, 111786, 111787, 111785, 111782, 111795, 111798, 111775, 111790, 111800, 111796, 111788, 111792, 111398, 111803, 111802, 111804, 111799, 111811, 111815, 111716, 111759, 111816, 111824, 111814, 111817, 111829, 111807, 111840, 111839, 111835, 111837, 111821, 111810, 111846, 111758, 111834, 111852, 111850, 111820, 111855, 111849, 111848, 111831, 111866, 111844, 111851, 111868, 111826, 111684, 111874, 111880, 111869, 111883, 111884, 111847, 111888, 111887, 111890, 111892, 111857, 111713, 111842, 111854, 111894, 111903, 111877, 111908, 111858, 111794, 111906, 111904, 111767, 111871, 111891, 111910, 111918, 111899, 111914, 111917, 111907, 111875, 111920, 111863, 111913, 111926, 111703, 111825, 111677, 111928, 111753, 111931, 111365, 111762, 111872, 111768, 111878, 111570, 111938, 111935, 111946, 111624, 111944, 111942, 111940, 111833, 111620, 111763, 111957, 111805, 111511, 111948, 111966, 111882, 111967, 111965, 111970, 111867, 111723, 111969, 111941, 111730, 111973, 111978, 111983, 111987, 111989, 111980, 111991, 111569, 111589, 112003, 111990, 111606, 111984, 111998, 112006, 112007, 111461, 111999, 112010, 112012, 111901, 111781, 111812, 112016, 111736, 111771, 111705, 111509, 111488, 112024, 112030, 111961, 111579, 112036, 111616, 112040, 112043, 111997, 112048, 112035, 112052, 111972, 112057, 111669, 111777, 112056, 112032, 112063, 112062, 111793, 112061, 112050, 112066, 112038, 111518, 111673, 112068, 111655, 112071, 112074, 111986, 111943, 112017, 112011, 112083, 112078, 112087, 112020, 111391, 111836, 112082, 112091, 112053, 112090, 111947, 112096, 112099, 112100, 112085, 112101, 112102, 111739, 111671, 112107, 112109, 111433, 111754, 111439, 111838, 111499, 111665, 111476, 111885, 111502, 111627, 111530, 111959, 111414, 111933, 111668, 112079, 111613, 111749, 112027, 111609, 112054, 111678, 111813, 111994, 111513, 111547, 111622, 111692, 111897, 111784, 111492, 112047, 111951, 112039, 111652, 111687, 112033, 112077, 111801, 111437, 111566, 111648, 111735, 111955, 112110, 112055, 112008, 112023, 111719, 111949, 111510, 112037, 111809, 112075, 112058, 111689, 111789, 111545, 111870, 112070, 111797, 112106, 112015, 112073, 112013, 112081, 111443, 111772, 111712, 111698, 112031, 111988, 111956, 111924, 111830, 111993, 112080, 111950, 111930, 111977, 111642, 111626, 112021, 112111, 112069, 111845, 111485, 111783, 111856, 111981, 111605, 111764, 111697, 111881, 111450, 111822, 111408, 111463, 111921, 112041, 112046, 111861, 112009, 111818, 111481, 111905, 111368, 111495, 111360, 112072, 111392, 111823, 111939, 111974, 111927, 112025, 111418, 111979, 112105, 111656, 111508, 111494, 111629, 111934, 112028, 112000, 112086, 111982, 112094, 111929, 111447, 111427, 111964, 111819, 112089, 111769, 111385, 111911, 111937, 111394, 111586, 111471, 111407, 111674, 111963, 111654, 112049, 111442, 111952, 112029, 111690, 112065, 112076, 111912, 112095, 111741, 111638, 111876, 111527, 111751, 111936, 111808, 111590, 111919, 111832, 111400, 111594, 111958, 111451, 111580, 112005, 111853, 111639, 112014, 111743, 111631, 111734, 111574, 111841, 111843, 111681, 111714, 111737, 112060, 111634, 111693, 111757, 111388, 111577, 111640, 111902, 112098, 111435, 111828, 112019, 112022, 111770, 111707, 111862, 111469, 111576, 111466, 111742, 111380, 111954, 111968, 111752, 111909, 111765, 111953, 111778, 112042, 111962, 112001, 112034, 111960, 111619, 111554, 111893, 111865, 111600, 111746, 111985, 111971, 111505, 112051, 111945, 111483, 111916, 111995, 112004, 111859, 112044}
|
|
order := make(map[int]int)
|
|
for _, uid := range uids {
|
|
p1 := new(game.Player)
|
|
p1.InitPlayerByUid(uid)
|
|
OrderMod := p1.GetOrderMod()
|
|
for order_id := range OrderMod.OrderList {
|
|
if order_id > 10000 {
|
|
//continue
|
|
}
|
|
order[order_id]++
|
|
}
|
|
p1 = nil
|
|
}
|
|
|
|
type orderInfo struct {
|
|
orderId int
|
|
count int
|
|
}
|
|
var sorted []orderInfo
|
|
for k, v := range order {
|
|
sorted = append(sorted, orderInfo{k, v})
|
|
}
|
|
sort.Slice(sorted, func(i, j int) bool {
|
|
return sorted[i].orderId < sorted[j].orderId
|
|
})
|
|
keys := make([]int, 0, len(sorted))
|
|
values := make([]int, 0, len(sorted))
|
|
for _, item := range sorted {
|
|
keys = append(keys, item.orderId)
|
|
values = append(values, item.count)
|
|
}
|
|
fmt.Printf("%s\n", formatIntSlice(keys))
|
|
fmt.Printf("%s\n", formatIntSlice(values))
|
|
|
|
sort.Slice(sorted, func(i, j int) bool {
|
|
return sorted[i].count > sorted[j].count
|
|
})
|
|
for _, item := range sorted {
|
|
fmt.Printf("OrderId: %d, Count: %d\n", item.orderId, item.count)
|
|
}
|
|
}
|
|
|
|
func TestAnalyzeCharge(t *testing.T) {
|
|
uids := []int{111354, 111355, 111358, 111364, 111359, 111357, 111363, 111369, 111371, 111379, 111384, 111383, 111366, 111373, 111377, 111389, 111393, 111395, 111401, 111397, 111396, 111403, 111404, 111399, 111409, 111406, 111415, 111410, 111421, 111419, 111413, 111422, 111423, 111425, 111405, 111429, 111356, 111411, 111431, 111424, 111426, 111441, 111428, 111454, 111455, 111436, 111420, 111453, 111460, 111452, 111459, 111458, 111456, 111464, 111465, 111382, 111468, 111472, 111376, 111480, 111362, 111490, 111497, 111498, 111500, 111434, 111496, 111474, 111482, 111504, 111506, 111514, 111515, 111470, 111512, 111523, 111520, 111478, 111533, 111538, 111534, 111491, 111522, 111537, 111446, 111477, 111544, 111526, 111528, 111546, 111543, 111548, 111535, 111432, 111553, 111467, 111542, 111560, 111457, 111549, 111536, 111516, 111531, 111487, 111557, 111529, 111568, 111540, 111539, 111416, 111561, 111555, 111558, 111581, 111475, 111564, 111524, 111484, 111583, 111587, 111585, 111584, 111525, 111552, 111592, 111595, 111603, 111599, 111604, 111591, 111608, 111607, 111598, 111610, 111615, 111614, 111596, 111562, 111572, 111381, 111625, 111621, 111632, 111550, 111630, 111628, 111602, 111567, 111445, 111633, 111623, 111647, 111653, 111649, 111593, 111646, 111645, 111651, 111643, 111611, 111636, 111519, 111661, 111662, 111667, 111670, 111387, 111664, 111650, 111672, 111378, 111660, 111666, 111675, 111663, 111686, 111685, 111575, 111688, 111659, 111691, 111637, 111695, 111676, 111386, 111699, 111701, 111709, 111444, 111702, 111718, 111704, 111679, 111710, 111706, 111617, 111708, 111722, 111721, 111412, 111728, 111720, 111727, 111733, 111563, 111503, 111738, 111729, 111556, 111744, 111732, 111750, 111748, 111745, 111541, 111740, 111747, 111731, 111755, 111761, 111724, 111756, 111760, 111766, 111696, 111717, 111774, 111780, 111776, 111786, 111787, 111785, 111782, 111795, 111798, 111775, 111790, 111800, 111796, 111788, 111792, 111398, 111803, 111802, 111804, 111799, 111811, 111815, 111716, 111759, 111816, 111824, 111814, 111817, 111829, 111807, 111840, 111839, 111835, 111837, 111821, 111810, 111846, 111758, 111834, 111852, 111850, 111820, 111855, 111849, 111848, 111831, 111866, 111844, 111851, 111868, 111826, 111684, 111874, 111880, 111869, 111883, 111884, 111847, 111888, 111887, 111890, 111892, 111857, 111713, 111842, 111854, 111894, 111903, 111877, 111908, 111858, 111794, 111906, 111904, 111767, 111871, 111891, 111910, 111918, 111899, 111914, 111917, 111907, 111875, 111920, 111863, 111913, 111926, 111703, 111825, 111677, 111928, 111753, 111931, 111365, 111762, 111872, 111768, 111878, 111570, 111938, 111935, 111946, 111624, 111944, 111942, 111940, 111833, 111620, 111763, 111957, 111805, 111511, 111948, 111966, 111882, 111967, 111965, 111970, 111867, 111723, 111969, 111941, 111730, 111973, 111978, 111983, 111987, 111989, 111980, 111991, 111569, 111589, 112003, 111990, 111606, 111984, 111998, 112006, 112007, 111461, 111999, 112010, 112012, 111901, 111781, 111812, 112016, 111736, 111771, 111705, 111509, 111488, 112024, 112030, 111961, 111579, 112036, 111616, 112040, 112043, 111997, 112048, 112035, 112052, 111972, 112057, 111669, 111777, 112056, 112032, 112063, 112062, 111793, 112061, 112050, 112066, 112038, 111518, 111673, 112068, 111655, 112071, 112074, 111986, 111943, 112017, 112011, 112083, 112078, 112087, 112020, 111391, 111836, 112082, 112091, 112053, 112090, 111947, 112096, 112099, 112100, 112085, 112101, 112102, 111739, 111671, 112107, 112109, 111433, 111754, 111439, 111838, 111499, 111665, 111476, 111885, 111502, 111627, 111530, 111959, 111414, 111933, 111668, 112079, 111613, 111749, 112027, 111609, 112054, 111678, 111813, 111994, 111513, 111547, 111622, 111692, 111897, 111784, 111492, 112047, 111951, 112039, 111652, 111687, 112033, 112077, 111801, 111437, 111566, 111648, 111735, 111955, 112110, 112055, 112008, 112023, 111719, 111949, 111510, 112037, 111809, 112075, 112058, 111689, 111789, 111545, 111870, 112070, 111797, 112106, 112015, 112073, 112013, 112081, 111443, 111772, 111712, 111698, 112031, 111988, 111956, 111924, 111830, 111993, 112080, 111950, 111930, 111977, 111642, 111626, 112021, 112111, 112069, 111845, 111485, 111783, 111856, 111981, 111605, 111764, 111697, 111881, 111450, 111822, 111408, 111463, 111921, 112041, 112046, 111861, 112009, 111818, 111481, 111905, 111368, 111495, 111360, 112072, 111392, 111823, 111939, 111974, 111927, 112025, 111418, 111979, 112105, 111656, 111508, 111494, 111629, 111934, 112028, 112000, 112086, 111982, 112094, 111929, 111447, 111427, 111964, 111819, 112089, 111769, 111385, 111911, 111937, 111394, 111586, 111471, 111407, 111674, 111963, 111654, 112049, 111442, 111952, 112029, 111690, 112065, 112076, 111912, 112095, 111741, 111638, 111876, 111527, 111751, 111936, 111808, 111590, 111919, 111832, 111400, 111594, 111958, 111451, 111580, 112005, 111853, 111639, 112014, 111743, 111631, 111734, 111574, 111841, 111843, 111681, 111714, 111737, 112060, 111634, 111693, 111757, 111388, 111577, 111640, 111902, 112098, 111435, 111828, 112019, 112022, 111770, 111707, 111862, 111469, 111576, 111466, 111742, 111380, 111954, 111968, 111752, 111909, 111765, 111953, 111778, 112042, 111962, 112001, 112034, 111960, 111619, 111554, 111893, 111865, 111600, 111746, 111985, 111971, 111505, 112051, 111945, 111483, 111916, 111995, 112004, 111859, 112044, 111486, 111367, 111925, 111779, 112112, 111601, 111489, 112088, 111370, 112097, 111860, 111635, 112002, 111864, 112084, 111559, 111507, 111390, 111976, 111922, 111900, 111932, 111402, 111438, 111827, 112067, 111618, 111501, 112064, 111711, 111898, 111573, 112093, 111532, 112104, 111725, 111644, 111473, 111597, 111430, 111896, 111375, 111715, 111879, 111657, 111895, 111700, 112059, 111517, 111582, 111658, 111612, 111479, 111996, 111683, 111448, 112092, 111682, 111923, 111641, 111565, 111361, 111551, 111440, 111417, 111493, 112018, 111886, 111694, 112045, 112108, 111680, 111449, 112103, 111588, 111521, 111571, 111773, 111372, 111975, 111578, 111462, 111791, 111915, 111374, 111889, 112026, 111873, 111726, 111806, 111992}
|
|
var charge float64
|
|
var chargeCount int
|
|
for _, uid := range uids {
|
|
p1 := new(game.Player)
|
|
p1.InitPlayerByUid(uid)
|
|
ChargeMod := p1.GetChargeMod()
|
|
if ChargeMod.Charge > 0 {
|
|
charge += ChargeMod.Charge
|
|
chargeCount++
|
|
}
|
|
p1 = nil
|
|
}
|
|
fmt.Printf("Total Charge: %.2f, Charge Count: %d\n", charge, chargeCount)
|
|
}
|
|
|
|
func formatIntSlice(slice []int) string {
|
|
result := "["
|
|
for i, num := range slice {
|
|
result += fmt.Sprintf("%d", num)
|
|
if i < len(slice)-1 {
|
|
result += ","
|
|
}
|
|
}
|
|
result += "]"
|
|
return result
|
|
}
|
|
|
|
func TestMsgFormat(t *testing.T) {
|
|
m := &MsgMod.Msg{
|
|
From: 10002,
|
|
To: 10003,
|
|
Type: 1,
|
|
SendT: 179865132,
|
|
End: 179832654,
|
|
Id: 0,
|
|
UniKey: "dsfjioefnefe",
|
|
H: 1,
|
|
HandleType: 20001,
|
|
Item: []*item.Item{
|
|
{Id: 1, Num: 10},
|
|
{Id: 2, Num: 20},
|
|
{Id: 3, Num: 30},
|
|
},
|
|
}
|
|
fmt.Printf("Msg: %v\n", m)
|
|
}
|
|
|
|
func TestRandFace(t *testing.T) {
|
|
face := faceCfg.GetRandInitId()
|
|
avatar := avatarCfg.GetRandInitId()
|
|
fmt.Printf("Random Face ID: %d, Random Avatar ID: %d\n", face, avatar)
|
|
}
|
|
|
|
func TestChampionShipCreateRobot(t *testing.T) {
|
|
robot := game.CreateRobot(1.0, 1)
|
|
fmt.Printf("Created Robot: %v\n", robot)
|
|
}
|
|
|
|
func TestRedisZset(t *testing.T) {
|
|
db.RedisZAdd("rank_user", "100001", 100)
|
|
}
|
|
|
|
func TestGeoIp(t *testing.T) {
|
|
ip := "117.30.95.111:5557"
|
|
ip = GoUtil.GetIPFromAddr(ip)
|
|
code, _ := GoUtil.GetCountryByIP(ip)
|
|
fmt.Printf("IP: %s, Country Code: %s\n", ip, code)
|
|
}
|
|
|
|
func TestRandAn(t *testing.T) {
|
|
rI := []int{1, 2, 3, 4, 5, 6, 7}
|
|
for i := 0; i < 10; i++ {
|
|
randNum := GoUtil.RandSliceNumNonAdjacent(rI, 3)
|
|
fmt.Printf("Random Number: %v\n", randNum)
|
|
}
|
|
}
|