上传代码调整

This commit is contained in:
liwei1dao 2023-06-08 15:28:10 +08:00
parent 47b59bd48d
commit c5cf79f4b8
28 changed files with 834 additions and 2765 deletions

File diff suppressed because it is too large Load Diff

View File

@ -2,451 +2,217 @@
{
"id": 1,
"quality": 1,
"lv": 1,
"initLv": 1,
"score": 1
},
{
"id": 2,
"quality": 1,
"lv": 5,
"initLv": 2,
"score": 2
},
{
"id": 3,
"quality": 1,
"lv": 10,
"initLv": 3,
"score": 3
},
{
"id": 4,
"quality": 1,
"lv": 15,
"initLv": 4,
"score": 4
},
{
"id": 5,
"quality": 1,
"lv": 20,
"initLv": 5,
"score": 5
},
{
"id": 6,
"quality": 1,
"lv": 25,
"initLv": 6,
"score": 6
},
{
"id": 7,
"quality": 1,
"lv": 30,
"quality": 2,
"initLv": 1,
"score": 7
},
{
"id": 8,
"quality": 1,
"lv": 25,
"quality": 2,
"initLv": 2,
"score": 8
},
{
"id": 9,
"quality": 1,
"lv": 30,
"quality": 2,
"initLv": 3,
"score": 9
},
{
"id": 10,
"quality": 1,
"lv": 35,
"quality": 2,
"initLv": 4,
"score": 10
},
{
"id": 11,
"quality": 1,
"lv": 40,
"quality": 2,
"initLv": 5,
"score": 11
},
{
"id": 12,
"quality": 1,
"lv": 45,
"quality": 2,
"initLv": 6,
"score": 12
},
{
"id": 13,
"quality": 1,
"lv": 50,
"quality": 3,
"initLv": 1,
"score": 13
},
{
"id": 14,
"quality": 1,
"lv": 55,
"quality": 3,
"initLv": 2,
"score": 14
},
{
"id": 15,
"quality": 1,
"lv": 60,
"quality": 3,
"initLv": 3,
"score": 15
},
{
"id": 16,
"quality": 2,
"lv": 1,
"score": 17
"quality": 3,
"initLv": 4,
"score": 16
},
{
"id": 17,
"quality": 2,
"lv": 5,
"score": 19
"quality": 3,
"initLv": 5,
"score": 17
},
{
"id": 18,
"quality": 2,
"lv": 10,
"score": 21
"quality": 3,
"initLv": 6,
"score": 18
},
{
"id": 19,
"quality": 2,
"lv": 15,
"score": 23
"quality": 4,
"initLv": 1,
"score": 19
},
{
"id": 20,
"quality": 2,
"lv": 20,
"score": 25
"quality": 4,
"initLv": 2,
"score": 20
},
{
"id": 21,
"quality": 2,
"lv": 25,
"score": 27
"quality": 4,
"initLv": 3,
"score": 21
},
{
"id": 22,
"quality": 2,
"lv": 30,
"score": 29
"quality": 4,
"initLv": 4,
"score": 22
},
{
"id": 23,
"quality": 2,
"lv": 25,
"score": 31
"quality": 4,
"initLv": 5,
"score": 23
},
{
"id": 24,
"quality": 2,
"lv": 30,
"score": 33
"quality": 4,
"initLv": 6,
"score": 24
},
{
"id": 25,
"quality": 2,
"lv": 35,
"score": 35
"quality": 5,
"initLv": 1,
"score": 25
},
{
"id": 26,
"quality": 2,
"lv": 40,
"score": 37
"quality": 5,
"initLv": 2,
"score": 26
},
{
"id": 27,
"quality": 2,
"lv": 45,
"score": 39
"quality": 5,
"initLv": 3,
"score": 27
},
{
"id": 28,
"quality": 2,
"lv": 50,
"score": 41
"quality": 5,
"initLv": 4,
"score": 28
},
{
"id": 29,
"quality": 2,
"lv": 55,
"score": 43
"quality": 5,
"initLv": 5,
"score": 29
},
{
"id": 30,
"quality": 2,
"lv": 60,
"score": 45
"quality": 5,
"initLv": 6,
"score": 30
},
{
"id": 31,
"quality": 3,
"lv": 1,
"score": 48
"quality": 6,
"initLv": 1,
"score": 31
},
{
"id": 32,
"quality": 3,
"lv": 5,
"score": 51
"quality": 6,
"initLv": 2,
"score": 32
},
{
"id": 33,
"quality": 3,
"lv": 10,
"score": 54
"quality": 6,
"initLv": 3,
"score": 33
},
{
"id": 34,
"quality": 3,
"lv": 15,
"score": 57
"quality": 6,
"initLv": 4,
"score": 34
},
{
"id": 35,
"quality": 3,
"lv": 20,
"score": 60
"quality": 6,
"initLv": 5,
"score": 35
},
{
"id": 36,
"quality": 3,
"lv": 25,
"score": 63
},
{
"id": 37,
"quality": 3,
"lv": 30,
"score": 66
},
{
"id": 38,
"quality": 3,
"lv": 25,
"score": 69
},
{
"id": 39,
"quality": 3,
"lv": 30,
"score": 72
},
{
"id": 40,
"quality": 3,
"lv": 35,
"score": 75
},
{
"id": 41,
"quality": 3,
"lv": 40,
"score": 78
},
{
"id": 42,
"quality": 3,
"lv": 45,
"score": 81
},
{
"id": 43,
"quality": 3,
"lv": 50,
"score": 84
},
{
"id": 44,
"quality": 3,
"lv": 55,
"score": 87
},
{
"id": 45,
"quality": 3,
"lv": 60,
"score": 90
},
{
"id": 46,
"quality": 4,
"lv": 1,
"score": 94
},
{
"id": 47,
"quality": 4,
"lv": 5,
"score": 98
},
{
"id": 48,
"quality": 4,
"lv": 10,
"score": 102
},
{
"id": 49,
"quality": 4,
"lv": 15,
"score": 106
},
{
"id": 50,
"quality": 4,
"lv": 20,
"score": 110
},
{
"id": 51,
"quality": 4,
"lv": 25,
"score": 114
},
{
"id": 52,
"quality": 4,
"lv": 30,
"score": 118
},
{
"id": 53,
"quality": 4,
"lv": 25,
"score": 122
},
{
"id": 54,
"quality": 4,
"lv": 30,
"score": 126
},
{
"id": 55,
"quality": 4,
"lv": 35,
"score": 130
},
{
"id": 56,
"quality": 4,
"lv": 40,
"score": 134
},
{
"id": 57,
"quality": 4,
"lv": 45,
"score": 138
},
{
"id": 58,
"quality": 4,
"lv": 50,
"score": 142
},
{
"id": 59,
"quality": 4,
"lv": 55,
"score": 146
},
{
"id": 60,
"quality": 4,
"lv": 60,
"score": 150
},
{
"id": 61,
"quality": 5,
"lv": 1,
"score": 155
},
{
"id": 62,
"quality": 5,
"lv": 5,
"score": 160
},
{
"id": 63,
"quality": 5,
"lv": 10,
"score": 165
},
{
"id": 64,
"quality": 5,
"lv": 15,
"score": 170
},
{
"id": 65,
"quality": 5,
"lv": 20,
"score": 175
},
{
"id": 66,
"quality": 5,
"lv": 25,
"score": 180
},
{
"id": 67,
"quality": 5,
"lv": 30,
"score": 185
},
{
"id": 68,
"quality": 5,
"lv": 25,
"score": 190
},
{
"id": 69,
"quality": 5,
"lv": 30,
"score": 195
},
{
"id": 70,
"quality": 5,
"lv": 35,
"score": 200
},
{
"id": 71,
"quality": 5,
"lv": 40,
"score": 205
},
{
"id": 72,
"quality": 5,
"lv": 45,
"score": 210
},
{
"id": 73,
"quality": 5,
"lv": 50,
"score": 215
},
{
"id": 74,
"quality": 5,
"lv": 55,
"score": 220
},
{
"id": 75,
"quality": 5,
"lv": 60,
"score": 225
"quality": 6,
"initLv": 6,
"score": 36
}
]

View File

@ -3,7 +3,7 @@
"id": 10,
"name": {
"key": "worldtask_world_all_name_1",
"text": "章节1全部任务"
"text": "章节1:燃烧远征"
},
"task_icon": "",
"task_txt": {
@ -19,236 +19,16 @@
]
},
{
"id": 300,
"id": 20,
"name": {
"key": "worldtask_world_all_name_2",
"text": "欢迎到来"
"text": "章节2:军团再临"
},
"task_icon": "",
"task_txt": {
"key": "worldtask_world_all_task_txt_2",
"text": "完成所有任务有可以领取额外奖励"
},
"reword": [
{
"a": "item",
"t": "10000001",
"n": 5
}
]
},
{
"id": 310,
"name": {
"key": "worldtask_world_all_name_3",
"text": "武馆内勤奋的身影是?"
},
"task_icon": "",
"task_txt": {
"key": "worldtask_world_all_task_txt_3",
"text": "完成所有任务有可以领取额外奖励"
},
"reword": [
{
"a": "item",
"t": "10000001",
"n": 2
},
{
"a": "attr",
"t": "diamond",
"n": 100
}
]
},
{
"id": 320,
"name": {
"key": "worldtask_world_all_name_4",
"text": "铁匠铺门口身影是?"
},
"task_icon": "",
"task_txt": {
"key": "worldtask_world_all_task_txt_4",
"text": "完成所有任务有可以领取额外奖励"
},
"reword": [
{
"a": "item",
"t": "10000001",
"n": 2
},
{
"a": "attr",
"t": "diamond",
"n": 100
}
]
},
{
"id": 330,
"name": {
"key": "worldtask_world_all_name_5",
"text": "戈伯的嘱托"
},
"task_icon": "",
"task_txt": {
"key": "worldtask_world_all_task_txt_5",
"text": "完成所有任务有可以领取额外奖励"
},
"reword": [
{
"a": "item",
"t": "10000001",
"n": 2
},
{
"a": "attr",
"t": "diamond",
"n": 100
}
]
},
{
"id": 340,
"name": {
"key": "worldtask_world_all_name_6",
"text": "武馆秘闻"
},
"task_icon": "",
"task_txt": {
"key": "worldtask_world_all_task_txt_6",
"text": "完成所有任务有可以领取额外奖励"
},
"reword": [
{
"a": "item",
"t": "10000001",
"n": 2
},
{
"a": "attr",
"t": "diamond",
"n": 100
}
]
},
{
"id": 350,
"name": {
"key": "worldtask_world_all_name_7",
"text": "好像有人再看我?"
},
"task_icon": "",
"task_txt": {
"key": "worldtask_world_all_task_txt_7",
"text": "完成所有任务有可以领取额外奖励"
},
"reword": [
{
"a": "item",
"t": "10000001",
"n": 2
},
{
"a": "attr",
"t": "diamond",
"n": 100
}
]
},
{
"id": 360,
"name": {
"key": "worldtask_world_all_name_8",
"text": "戈伯的委托"
},
"task_icon": "",
"task_txt": {
"key": "worldtask_world_all_task_txt_8",
"text": "完成所有任务有可以领取额外奖励"
},
"reword": [
{
"a": "item",
"t": "10000001",
"n": 2
},
{
"a": "attr",
"t": "diamond",
"n": 100
}
]
},
{
"id": 370,
"name": {
"key": "worldtask_world_all_name_9",
"text": "测试主线1"
},
"task_icon": "",
"task_txt": {
"key": "worldtask_world_all_task_txt_9",
"text": "完成所有任务有可以领取额外奖励"
},
"reword": [
{
"a": "item",
"t": "10000001",
"n": 3
}
]
},
{
"id": 380,
"name": {
"key": "worldtask_world_all_name_10",
"text": "测试主线2"
},
"task_icon": "",
"task_txt": {
"key": "worldtask_world_all_task_txt_10",
"text": "完成所有任务有可以领取额外奖励"
},
"reword": [
{
"a": "item",
"t": "10000001",
"n": 4
}
]
},
{
"id": 390,
"name": {
"key": "worldtask_world_all_name_11",
"text": "测试主线3"
},
"task_icon": "",
"task_txt": {
"key": "worldtask_world_all_task_txt_11",
"text": "完成所有任务有可以领取额外奖励"
},
"reword": [
{
"a": "item",
"t": "10000001",
"n": 5
}
]
},
{
"id": 400,
"name": {
"key": "worldtask_world_all_name_12",
"text": "测试主线4"
},
"task_icon": "",
"task_txt": {
"key": "worldtask_world_all_task_txt_12",
"text": "完成所有任务有可以领取额外奖励"
},
"reword": [
{
"a": "item",
@ -258,14 +38,14 @@
]
},
{
"id": 410,
"id": 30,
"name": {
"key": "worldtask_world_all_name_13",
"text": "测试主线5"
"key": "worldtask_world_all_name_3",
"text": "章节3:军团又临"
},
"task_icon": "",
"task_txt": {
"key": "worldtask_world_all_task_txt_13",
"key": "worldtask_world_all_task_txt_3",
"text": "完成所有任务有可以领取额外奖励"
},
"reword": [
@ -277,14 +57,14 @@
]
},
{
"id": 420,
"id": 40,
"name": {
"key": "worldtask_world_all_name_14",
"text": "测试主线6"
"key": "worldtask_world_all_name_4",
"text": "章节4:军团撤退"
},
"task_icon": "",
"task_txt": {
"key": "worldtask_world_all_task_txt_14",
"key": "worldtask_world_all_task_txt_4",
"text": "完成所有任务有可以领取额外奖励"
},
"reword": [
@ -296,14 +76,14 @@
]
},
{
"id": 430,
"id": 50,
"name": {
"key": "worldtask_world_all_name_15",
"text": "测试主线7"
"key": "worldtask_world_all_name_5",
"text": "章节5:军团解散"
},
"task_icon": "",
"task_txt": {
"key": "worldtask_world_all_task_txt_15",
"key": "worldtask_world_all_task_txt_5",
"text": "完成所有任务有可以领取额外奖励"
},
"reword": [
@ -313,480 +93,5 @@
"n": 9
}
]
},
{
"id": 440,
"name": {
"key": "worldtask_world_all_name_16",
"text": "测试主线8"
},
"task_icon": "",
"task_txt": {
"key": "worldtask_world_all_task_txt_16",
"text": "完成所有任务有可以领取额外奖励"
},
"reword": [
{
"a": "item",
"t": "10000001",
"n": 10
}
]
},
{
"id": 450,
"name": {
"key": "worldtask_world_all_name_17",
"text": "测试主线9"
},
"task_icon": "",
"task_txt": {
"key": "worldtask_world_all_task_txt_17",
"text": "完成所有任务有可以领取额外奖励"
},
"reword": [
{
"a": "item",
"t": "10000001",
"n": 11
}
]
},
{
"id": 460,
"name": {
"key": "worldtask_world_all_name_18",
"text": "测试主线10"
},
"task_icon": "",
"task_txt": {
"key": "worldtask_world_all_task_txt_18",
"text": "完成所有任务有可以领取额外奖励"
},
"reword": [
{
"a": "item",
"t": "10000001",
"n": 12
}
]
},
{
"id": 470,
"name": {
"key": "worldtask_world_all_name_19",
"text": "测试主线11"
},
"task_icon": "",
"task_txt": {
"key": "worldtask_world_all_task_txt_19",
"text": "完成所有任务有可以领取额外奖励"
},
"reword": [
{
"a": "item",
"t": "10000001",
"n": 13
}
]
},
{
"id": 480,
"name": {
"key": "worldtask_world_all_name_20",
"text": "测试主线12"
},
"task_icon": "",
"task_txt": {
"key": "worldtask_world_all_task_txt_20",
"text": "完成所有任务有可以领取额外奖励"
},
"reword": [
{
"a": "item",
"t": "10000001",
"n": 14
}
]
},
{
"id": 490,
"name": {
"key": "worldtask_world_all_name_21",
"text": "测试主线13"
},
"task_icon": "",
"task_txt": {
"key": "worldtask_world_all_task_txt_21",
"text": "完成所有任务有可以领取额外奖励"
},
"reword": [
{
"a": "item",
"t": "10000001",
"n": 15
}
]
},
{
"id": 500,
"name": {
"key": "worldtask_world_all_name_22",
"text": "测试主线14"
},
"task_icon": "",
"task_txt": {
"key": "worldtask_world_all_task_txt_22",
"text": "完成所有任务有可以领取额外奖励"
},
"reword": [
{
"a": "item",
"t": "10000001",
"n": 16
}
]
},
{
"id": 510,
"name": {
"key": "worldtask_world_all_name_23",
"text": "测试主线15"
},
"task_icon": "",
"task_txt": {
"key": "worldtask_world_all_task_txt_23",
"text": "完成所有任务有可以领取额外奖励"
},
"reword": [
{
"a": "item",
"t": "10000001",
"n": 17
}
]
},
{
"id": 520,
"name": {
"key": "worldtask_world_all_name_24",
"text": "测试主线16"
},
"task_icon": "",
"task_txt": {
"key": "worldtask_world_all_task_txt_24",
"text": "完成所有任务有可以领取额外奖励"
},
"reword": [
{
"a": "item",
"t": "10000001",
"n": 18
}
]
},
{
"id": 530,
"name": {
"key": "worldtask_world_all_name_25",
"text": "测试主线17"
},
"task_icon": "",
"task_txt": {
"key": "worldtask_world_all_task_txt_25",
"text": "完成所有任务有可以领取额外奖励"
},
"reword": [
{
"a": "item",
"t": "10000001",
"n": 19
}
]
},
{
"id": 540,
"name": {
"key": "worldtask_world_all_name_26",
"text": "测试主线18"
},
"task_icon": "",
"task_txt": {
"key": "worldtask_world_all_task_txt_26",
"text": "完成所有任务有可以领取额外奖励"
},
"reword": [
{
"a": "item",
"t": "10000001",
"n": 20
}
]
},
{
"id": 550,
"name": {
"key": "worldtask_world_all_name_27",
"text": "测试主线19"
},
"task_icon": "",
"task_txt": {
"key": "worldtask_world_all_task_txt_27",
"text": "完成所有任务有可以领取额外奖励"
},
"reword": [
{
"a": "item",
"t": "10000001",
"n": 21
}
]
},
{
"id": 560,
"name": {
"key": "worldtask_world_all_name_28",
"text": "测试主线20"
},
"task_icon": "",
"task_txt": {
"key": "worldtask_world_all_task_txt_28",
"text": "完成所有任务有可以领取额外奖励"
},
"reword": [
{
"a": "item",
"t": "10000001",
"n": 22
}
]
},
{
"id": 570,
"name": {
"key": "worldtask_world_all_name_29",
"text": "测试主线21"
},
"task_icon": "",
"task_txt": {
"key": "worldtask_world_all_task_txt_29",
"text": "完成所有任务有可以领取额外奖励"
},
"reword": [
{
"a": "item",
"t": "10000001",
"n": 23
}
]
},
{
"id": 580,
"name": {
"key": "worldtask_world_all_name_30",
"text": "测试主线22"
},
"task_icon": "",
"task_txt": {
"key": "worldtask_world_all_task_txt_30",
"text": "完成所有任务有可以领取额外奖励"
},
"reword": [
{
"a": "item",
"t": "10000001",
"n": 24
}
]
},
{
"id": 590,
"name": {
"key": "worldtask_world_all_name_31",
"text": "测试主线23"
},
"task_icon": "",
"task_txt": {
"key": "worldtask_world_all_task_txt_31",
"text": "完成所有任务有可以领取额外奖励"
},
"reword": [
{
"a": "item",
"t": "10000001",
"n": 25
}
]
},
{
"id": 600,
"name": {
"key": "worldtask_world_all_name_32",
"text": "测试主线24"
},
"task_icon": "",
"task_txt": {
"key": "worldtask_world_all_task_txt_32",
"text": "完成所有任务有可以领取额外奖励"
},
"reword": [
{
"a": "item",
"t": "10000001",
"n": 26
}
]
},
{
"id": 610,
"name": {
"key": "worldtask_world_all_name_33",
"text": "测试主线25"
},
"task_icon": "",
"task_txt": {
"key": "worldtask_world_all_task_txt_33",
"text": "完成所有任务有可以领取额外奖励"
},
"reword": [
{
"a": "item",
"t": "10000001",
"n": 27
}
]
},
{
"id": 620,
"name": {
"key": "worldtask_world_all_name_34",
"text": "测试主线26"
},
"task_icon": "",
"task_txt": {
"key": "worldtask_world_all_task_txt_34",
"text": "完成所有任务有可以领取额外奖励"
},
"reword": [
{
"a": "item",
"t": "10000001",
"n": 28
}
]
},
{
"id": 630,
"name": {
"key": "worldtask_world_all_name_35",
"text": "测试主线27"
},
"task_icon": "",
"task_txt": {
"key": "worldtask_world_all_task_txt_35",
"text": "完成所有任务有可以领取额外奖励"
},
"reword": [
{
"a": "item",
"t": "10000001",
"n": 29
}
]
},
{
"id": 640,
"name": {
"key": "worldtask_world_all_name_36",
"text": "测试主线28"
},
"task_icon": "",
"task_txt": {
"key": "worldtask_world_all_task_txt_36",
"text": "完成所有任务有可以领取额外奖励"
},
"reword": [
{
"a": "item",
"t": "10000001",
"n": 30
}
]
},
{
"id": 650,
"name": {
"key": "worldtask_world_all_name_37",
"text": "测试主线29"
},
"task_icon": "",
"task_txt": {
"key": "worldtask_world_all_task_txt_37",
"text": "完成所有任务有可以领取额外奖励"
},
"reword": [
{
"a": "item",
"t": "10000001",
"n": 31
}
]
},
{
"id": 660,
"name": {
"key": "worldtask_world_all_name_38",
"text": "测试主线30"
},
"task_icon": "",
"task_txt": {
"key": "worldtask_world_all_task_txt_38",
"text": "完成所有任务有可以领取额外奖励"
},
"reword": [
{
"a": "item",
"t": "10000001",
"n": 32
}
]
},
{
"id": 70010,
"name": {
"key": "worldtask_world_all_name_39",
"text": "日常测试任务"
},
"task_icon": "",
"task_txt": {
"key": "worldtask_world_all_task_txt_39",
"text": "完成所有任务有可以领取额外奖励"
},
"reword": [
{
"a": "item",
"t": "10000001",
"n": 1
}
]
},
{
"id": 80010,
"name": {
"key": "worldtask_world_all_name_40",
"text": "周常测试任务"
},
"task_icon": "",
"task_txt": {
"key": "worldtask_world_all_task_txt_40",
"text": "完成所有任务有可以领取额外奖励"
},
"reword": [
{
"a": "item",
"t": "10000001",
"n": 1
}
]
}
]

View File

@ -54,7 +54,6 @@ const (
ModulePagoda core.M_Modules = "pagoda" //魔塔模块
ModuleMartialhall core.M_Modules = "martialhall" //武馆模块
ModuleGourmet core.M_Modules = "gourmet" //美食馆
ModuleRtask core.M_Modules = "rtask" //随机任务
ModuleSmithy core.M_Modules = "smithy" //铁匠铺
ModuleTimer core.M_Modules = "timer" //定时任务模块
ModuleViking core.M_Modules = "viking" //维京远征
@ -135,10 +134,6 @@ const (
///武馆数据表
TableMartialhall = "martialhall"
// 随机任务
TableRtask = "rtask"
// 随机任务触发记录
TableRtaskRecord = "rrecord"
///记录用户爬塔排行数据
TablePagodaRecord = "pagodarecord"
///有序的爬塔排行 (真正的排行榜 最多只有50条)
@ -285,8 +280,7 @@ const ( //Rpc
//Moonfantasy 月之秘境
Rpc_ModuleMoonfantasyTrigger core.Rpc_Key = "Rpc_ModuleMoonfantasyTrigger" //月之秘境触发消息
Rpc_ModuleMoonfantasyTriggerMF core.Rpc_Key = "Rpc_ModuleMoonfantasyTriggerMF" //月之秘境触发消息
//rtask 上传随机任务代码
Rpc_ModuleRtaskSendTask core.Rpc_Key = "Rpc_ModuleRtaskSendTask" //随机任务触发
// friend
Rpc_ModuleFriendUseAssitHero core.Rpc_Key = "Rpc_ModuleFriendUseAssitHero" //使用助战英雄
Rpc_ModuleFriendDB core.Rpc_Key = "Rpc_ModuleFriendDB"

View File

@ -82,22 +82,22 @@ func (this *apiComp) Equip(session comm.IUserSession, req *pb.EquipmentEquipReq)
}
return
}
if minstr > confs[i].Color {
minstr = confs[i].Color
if minstr > confs[i].InitLv {
minstr = confs[i].InitLv
}
// equipStr[confs[i].Star]++
if i < 4 {
if confs[i].Color < suite1Str {
suite1Str = confs[i].Color
if confs[i].InitLv < suite1Str {
suite1Str = confs[i].InitLv
}
if equipments[i].Lv < suite1Lv {
suite1Lv = equipments[i].Lv
}
} else if i < 6 {
if confs[i].Color < suite2Str {
suite2Str = confs[i].Color
if confs[i].InitLv < suite2Str {
suite2Str = confs[i].InitLv
}
if equipments[i].Lv < suite2Lv {
suite2Lv = equipments[i].Lv

View File

@ -63,7 +63,7 @@ func (this *apiComp) Upgrade(session comm.IUserSession, req *pb.EquipmentUpgrade
return
}
//找到下一个等级的相关配置
if intensify, err = this.module.configure.GetEquipmentIntensifyConfigureById(conf.EquipId, conf.Color, equipment.Lv); err != nil || intensify.Need == nil || len(intensify.Need) == 0 {
if intensify, err = this.module.configure.GetEquipmentIntensifyConfigureById(conf.EquipId, conf.InitLv, equipment.Lv); err != nil || intensify.Need == nil || len(intensify.Need) == 0 {
this.module.Errorf("Equip_Check err:%v", err)
errdata = &pb.ErrorData{
Code: pb.ErrorCode_EquipmentLvlimitReached,
@ -217,13 +217,13 @@ func (this *apiComp) Upgrade(session comm.IUserSession, req *pb.EquipmentUpgrade
tasks = append(tasks, comm.GetBuriedParam(comm.Rtype49, 1, hero.Suite1Star, hero.Suite1Lv))
tasks = append(tasks, comm.GetBuriedParam(comm.Rtype93, 1, hero.SuiteId, suite1Lv))
tasks = append(tasks, comm.GetBuriedParam2(comm.Rtype43, equipment.Id, equipment.Lv))
tasks = append(tasks, comm.GetBuriedParam2(comm.Rtype45, equipment.Id, conf.Color, hero.SuiteExtId, hero.Suite2Lv))
tasks = append(tasks, comm.GetBuriedParam2(comm.Rtype45, equipment.Id, conf.InitLv, hero.SuiteExtId, hero.Suite2Lv))
}
if conf.Pos >= 4 && conf.Pos < 6 && hero.SuiteExtId != 0 {
hero.Suite2Lv = suite2Lv
tasks = append(tasks, comm.GetBuriedParam(comm.Rtype48, 1, hero.Suite2Star, hero.Suite2Lv))
tasks = append(tasks, comm.GetBuriedParam(comm.Rtype93, 1, hero.SuiteExtId, suite2Lv))
tasks = append(tasks, comm.GetBuriedParam2(comm.Rtype45, equipment.Id, conf.Color, hero.SuiteExtId, hero.Suite2Lv))
tasks = append(tasks, comm.GetBuriedParam2(comm.Rtype45, equipment.Id, conf.InitLv, hero.SuiteExtId, hero.Suite2Lv))
}
if errdata = this.module.ModuleHero.UpdateEquipment(session, hero, equipments); errdata != nil {
return

View File

@ -49,7 +49,7 @@ func (this *apiComp) Wash(session comm.IUserSession, req *pb.EquipmentWashReq) (
}
return
}
gole := this.module.ModuleTools.GetGlobalConf().EquipmentConsumption[conf.Color-1]
gole := this.module.ModuleTools.GetGlobalConf().EquipmentConsumption[conf.InitLv-1]
if errdata = this.module.ConsumeRes(session, []*cfg.Gameatn{{A: comm.AttrType, T: comm.ResGold, N: gole}}, true); errdata != nil {
return
}

View File

@ -111,8 +111,8 @@ func (this *modelEquipmentComp) AddEquipments(session comm.IUserSession, cIds ma
return nil, err
} else {
//随机任务
tasks = append(tasks, comm.GetBuriedParam(comm.Rtype50, 1, c.Color))
tasks = append(tasks, comm.GetBuriedParam(comm.Rtype97, 1, c.Suittype, c.Color))
tasks = append(tasks, comm.GetBuriedParam(comm.Rtype50, 1, c.InitLv))
tasks = append(tasks, comm.GetBuriedParam(comm.Rtype97, 1, c.Suittype, c.InitLv))
unm := int32(1)
if equipment.AdverbEntry != nil {
unm += int32(len(equipment.AdverbEntry))
@ -120,11 +120,11 @@ func (this *modelEquipmentComp) AddEquipments(session comm.IUserSession, cIds ma
if equipment.Adverbskill != nil {
unm += int32(len(equipment.Adverbskill))
}
tasks = append(tasks, comm.GetBuriedParam(comm.Rtype99, 1, unm, c.Color))
tasks = append(tasks, comm.GetBuriedParam(comm.Rtype99, 1, unm, c.InitLv))
if c.Pos == 7 {
tasks = append(tasks, comm.GetBuriedParam(comm.Rtype103, 1, c.Color))
tasks = append(tasks, comm.GetBuriedParam(comm.Rtype103, 1, c.InitLv))
} else if c.Pos == 6 {
tasks = append(tasks, comm.GetBuriedParam(comm.Rtype101, 1, c.Color))
tasks = append(tasks, comm.GetBuriedParam(comm.Rtype101, 1, c.InitLv))
}
add[equipment.Id] = equipment
change = append(change, equipment)

View File

@ -245,8 +245,8 @@ func (this *Equipment) AddEquipment(session comm.IUserSession, equip *pb.DB_Equi
}
tasks := make([]*pb.BuriedParam, 0)
//随机任务
tasks = append(tasks, comm.GetBuriedParam(comm.Rtype50, 1, configure.Color))
tasks = append(tasks, comm.GetBuriedParam(comm.Rtype97, 1, configure.Suittype, configure.Color))
tasks = append(tasks, comm.GetBuriedParam(comm.Rtype50, 1, configure.InitLv))
tasks = append(tasks, comm.GetBuriedParam(comm.Rtype97, 1, configure.Suittype, configure.InitLv))
unm := int32(1)
if equip.AdverbEntry != nil {
unm += int32(len(equip.AdverbEntry))
@ -254,11 +254,11 @@ func (this *Equipment) AddEquipment(session comm.IUserSession, equip *pb.DB_Equi
if equip.Adverbskill != nil {
unm += int32(len(equip.Adverbskill))
}
tasks = append(tasks, comm.GetBuriedParam(comm.Rtype99, 1, unm, configure.Color))
tasks = append(tasks, comm.GetBuriedParam(comm.Rtype99, 1, unm, configure.InitLv))
if configure.Pos == 7 {
tasks = append(tasks, comm.GetBuriedParam(comm.Rtype103, 1, configure.Color))
tasks = append(tasks, comm.GetBuriedParam(comm.Rtype103, 1, configure.InitLv))
} else if configure.Pos == 6 {
tasks = append(tasks, comm.GetBuriedParam(comm.Rtype101, 1, configure.Color))
tasks = append(tasks, comm.GetBuriedParam(comm.Rtype101, 1, configure.InitLv))
}
go this.ModuleBuried.TriggerBuried(session.GetUserId(), tasks...)
this.equipmentsChangePush(session, []*pb.DB_Equipment{equip})
@ -474,7 +474,7 @@ func (this *Equipment) GetForgeEquip(session comm.IUserSession, suiteId int32, p
}
if pos != -1 {
for _, v := range configures {
if v.Pos == pos && v.Color == lv {
if v.Pos == pos && v.InitLv == lv {
if eruip, err = this.modelEquipment.newEquipment(session.GetUserId(), v, dyweight, isepic); err == nil {
this.equipmentsChangePush(session, []*pb.DB_Equipment{eruip})
return
@ -497,7 +497,7 @@ func (this *Equipment) GetForgeEquip(session comm.IUserSession, suiteId int32, p
} else {
lvs = make([]*cfg.GameEquipData, 0)
for _, v := range configures {
if v.Color == lv {
if v.InitLv == lv {
lvs = append(lvs, v)
}
}

View File

@ -128,7 +128,7 @@ func (this *apiComp) ChallengeOver(session comm.IUserSession, req *pb.HuntingCha
if v.A == "equp" {
for _, star := range req.Star {
cfg := this.configure.GetEquipmentConfigureById(v.T)
if cfg != nil && star == cfg.Color { // 自动出售 转换成其他道具
if cfg != nil && star == cfg.InitLv { // 自动出售 转换成其他道具
if len(cfg.Sale) != 0 {
bFound = true
del = append(del, cfg.Id)

View File

@ -1,30 +0,0 @@
package rtask
import (
"go_dreamfactory/lego/core"
"go_dreamfactory/modules"
)
const (
// RtaskSubTypeGetrecord = "getrecord" //任务数据
// RtaskSubTypeSend = "send" //触发任务
)
type apiComp struct {
modules.MCompGate
service core.IService
module *ModuleRtask
}
// 组件初始化接口
func (this *apiComp) Init(service core.IService, module core.IModule, comp core.IModuleComp, options core.IModuleOptions) (err error) {
err = this.MCompGate.Init(service, module, comp, options)
this.module = module.(*ModuleRtask)
this.service = service
return
}
func (this *apiComp) Start() (err error) {
err = this.MCompGate.Start()
return
}

View File

@ -1,55 +0,0 @@
package rtask
import (
"go_dreamfactory/comm"
"go_dreamfactory/pb"
)
func (this *apiComp) RtestCheck(session comm.IUserSession, req *pb.RtaskTestReq) (errdata *pb.ErrorData) {
if len(req.Params) < 1 {
errdata = &pb.ErrorData{
Code: pb.ErrorCode_ReqParameterError,
Title: pb.ErrorCode_ReqParameterError.ToString(),
}
}
return
}
func (this *apiComp) Rtest(session comm.IUserSession, req *pb.RtaskTestReq) (errdata *pb.ErrorData) {
if errdata = this.RtestCheck(session, req); errdata != nil {
return
}
rsp := &pb.RtaskTestResp{Flag: true, RtaskType: req.RtaskType}
// 校验
if req.CondiId != 0 {
condIds, err := this.module.ModuleBuried.CheckCondition(session.GetUserId(), req.CondiId)
if err == nil && len(condIds) > 0 {
rsp.Flag = true
}
// 触发
} else if req.RtaskType != 0 && len(req.Params) > 0 {
conds := []int32{}
switch len(req.Params) {
case 2:
conds[0] = req.Params[1]
case 3:
conds[0] = req.Params[1]
conds[1] = req.Params[2]
case 4:
conds[0] = req.Params[1]
conds[1] = req.Params[2]
conds[2] = req.Params[3]
case 5:
conds[0] = req.Params[1]
conds[1] = req.Params[2]
conds[2] = req.Params[3]
conds[3] = req.Params[4]
}
this.module.ModuleBuried.TriggerBuried(session.GetUserId(), comm.GetBuriedParam(comm.TaskType(req.RtaskType), req.Params[0], conds...))
rsp.Flag = true
}
session.SendMsg(string(this.module.GetType()), "rtest", rsp)
return
}

View File

@ -1,71 +0,0 @@
package rtask
import (
"fmt"
"go_dreamfactory/lego/core"
"go_dreamfactory/modules"
cfg "go_dreamfactory/sys/configure/structs"
)
const (
gameTaskCond = "game_rdtaskcondi.json"
)
type configureComp struct {
modules.MCompConfigure
}
func (this *configureComp) Init(service core.IService, module core.IModule, comp core.IModuleComp, options core.IModuleOptions) (err error) {
err = this.MCompConfigure.Init(service, module, comp, options)
err = this.LoadMultiConfigure(map[string]interface{}{
gameTaskCond: cfg.NewGameRdtaskCondi,
})
return
}
func (this *configureComp) getRtaskCondiCfg() (data *cfg.GameRdtaskCondi, err error) {
var (
v interface{}
ok bool
)
if v, err = this.GetConfigure(gameTaskCond); err != nil {
return
} else {
if data, ok = v.(*cfg.GameRdtaskCondi); !ok {
err = fmt.Errorf("%T is *cfg.GameRdtaskCondi", v)
return
}
}
return
}
// 查询任务类型
func (this *configureComp) getRtaskTypeById(typeId int32) (data *cfg.GameRdtaskCondiData, err error) {
cfg, err := this.getRtaskCondiCfg()
if err != nil {
return
}
if cfg != nil {
if data, ok := cfg.GetDataMap()[typeId]; ok {
return data, nil
}
}
return
}
func (this *configureComp) getRtaskCondis(typeId int32) (list []*cfg.GameRdtaskCondiData) {
cfg, err := this.getRtaskCondiCfg()
if err != nil {
return
}
if cfg != nil {
for _, v := range cfg.GetDataList() {
if v.Type == typeId {
list = append(list, v)
}
}
}
return
}

View File

@ -1,207 +0,0 @@
package rtask
import (
"fmt"
"go_dreamfactory/lego/sys/log"
"go_dreamfactory/pb"
cfg "go_dreamfactory/sys/configure/structs"
"github.com/pkg/errors"
)
func lenParam(cfg *cfg.GameRdtaskCondiData, vals ...int32) (n int, err error) {
if cfg.Data1 != 0 && cfg.Data2 != 0 && cfg.Data3 != 0 && cfg.Data4 != 0 && cfg.Data5 != 0 {
if len(vals) != 5 {
err = errors.New(fmt.Sprintf("%v 参数个数不一致,期望5实际是%v", cfg.Id, len(vals)))
return
} else {
n = len(vals)
return
}
}
if cfg.Data1 != 0 && cfg.Data2 != 0 && cfg.Data3 != 0 && cfg.Data4 != 0 {
if len(vals) != 4 {
err = errors.New(fmt.Sprintf("%v 参数个数不一致,期望4实际是%v", cfg.Id, len(vals)))
return
} else {
n = len(vals)
return
}
}
if cfg.Data1 != 0 && cfg.Data2 != 0 && cfg.Data3 != 0 {
if len(vals) != 3 {
err = errors.New(fmt.Sprintf("%v 参数个数不一致,期望3实际是%v", cfg.Id, len(vals)))
return
} else {
n = len(vals)
return
}
}
if cfg.Data1 != 0 && cfg.Data2 != 0 {
if len(vals) != 2 {
err = errors.New(fmt.Sprintf("%v 参数个数不一致,期望2实际是%v", cfg.Id, len(vals)))
return
} else {
n = len(vals)
return
}
}
if cfg.Data1 != 0 && vals[0] != 0 {
if len(vals) != 1 {
err = errors.New(fmt.Sprintf("%v 参数个数不一致,期望1实际是%v", cfg.Id, len(vals)))
return
} else {
n = len(vals)
return
}
}
return
}
func toMap(vals ...int32) map[int32]int32 {
d := make(map[int32]int32, len(vals))
for i, v := range vals {
d[int32(i)] = v
}
return d
}
func toArr(m map[int32]int32) (params []int32) {
for _, v := range m {
params = append(params, v)
}
return
}
func hasUpdateData(len int, data *pb.RtaskData, vals ...int32) map[int32]int32 {
if data == nil || len == 0 {
return nil
}
res := make(map[int32]int32)
switch len {
case 1:
if vals[0] > data.Data[0] {
res[0] = vals[0]
}
case 2:
if vals[0] > data.Data[0] {
res[0] = vals[0]
}
if vals[1] >= data.Data[1] {
res[1] = vals[1]
}
case 3:
if vals[0] > data.Data[0] {
res[0] = vals[0]
}
if vals[1] > data.Data[1] {
res[1] = vals[1]
}
if vals[2] > data.Data[2] {
res[2] = vals[2]
}
case 4:
if vals[0] > data.Data[0] {
res[0] = vals[0]
}
if vals[1] > data.Data[1] {
res[1] = vals[1]
}
if vals[2] > data.Data[2] {
res[2] = vals[2]
}
if vals[3] > data.Data[3] {
res[3] = vals[3]
}
case 5:
if vals[0] > data.Data[0] {
res[0] = vals[0]
}
if vals[1] > data.Data[1] {
res[1] = vals[1]
}
if vals[2] > data.Data[2] {
res[2] = vals[2]
}
if vals[3] > data.Data[3] {
res[3] = vals[3]
}
if vals[4] > data.Data[4] {
res[4] = vals[4]
}
}
return res
}
func printCondiLog(uid string, cfg *cfg.GameRdtaskCondiData) {
log.Debugf("uid:%v condiId:%v rtype:%v", uid, cfg.Id, cfg.Type)
}
type Num interface {
~int32 | ~string | ~bool
}
// 等于
func equal[T Num](actual, expected T) bool {
return actual == expected
}
// 大于等于
func greatEqual(actual, expected int32) bool {
return actual >= expected
}
// 大于
func great(actual, expected int32) bool {
return actual > expected
}
// 小于等于
func lessEqual(actual, expected int32) bool {
return actual <= expected
}
func soEqual[T Num](actual T, expected T) (ok bool, err error) {
if !equal(actual, expected) {
err = errors.New(fmt.Sprintf("soEqual actual:%v expect:%v", actual, expected))
return
}
ok = true
return
}
func soGreat(actual, expected int32) (ok bool, err error) {
if !great(actual, expected) {
err = errors.New(fmt.Sprintf("soGreat actual:%v expect:%v", actual, expected))
return
}
ok = true
return
}
func soGreatEqual(actual, expected int32) (ok bool, err error) {
if !greatEqual(actual, expected) {
err = errors.New(fmt.Sprintf("soGreatEqual actual:%v expect:%v", actual, expected))
return
}
ok = true
return
}
func soLessEqual(actual, expected int32) (ok bool, err error) {
if !lessEqual(actual, expected) {
err = errors.New(fmt.Sprintf("soLessEqual actual:%v expect:%v", actual, expected))
return
}
ok = true
return
}

View File

@ -1,88 +0,0 @@
package rtask
import (
"go_dreamfactory/comm"
"go_dreamfactory/lego/core"
"go_dreamfactory/lego/sys/log"
"go_dreamfactory/modules"
"go_dreamfactory/pb"
"go_dreamfactory/sys/configure"
"go_dreamfactory/sys/db"
"github.com/pkg/errors"
"go.mongodb.org/mongo-driver/bson/primitive"
"go.mongodb.org/mongo-driver/mongo"
"go.mongodb.org/mongo-driver/x/bsonx"
)
type ModelRtaskRecord struct {
modules.MCompModel
module *ModuleRtask
service core.IService
}
func (this *ModelRtaskRecord) Init(service core.IService, module core.IModule, comp core.IModuleComp, options core.IModuleOptions) (err error) {
this.TableName = comm.TableRtaskRecord
err = this.MCompModel.Init(service, module, comp, options)
this.module = module.(*ModuleRtask)
this.service = service
this.DB.CreateIndex(core.SqlTable(this.TableName), mongo.IndexModel{
Keys: bsonx.Doc{{Key: "uid", Value: bsonx.Int32(1)}},
})
return
}
// 获取玩家待校验数据
// Deprecated
func (this *ModelRtaskRecord) GetVerifyData(uid string, condiId int32) (*pb.RtaskData, error) {
record := &pb.DBRtaskRecord{}
err := this.Get(uid, record)
if err != nil {
return nil, errors.Wrapf(err, "record Get err: %v condiId[%v]", uid, condiId)
}
return record.Vals[condiId], nil
}
// 获取玩家任务条件记录
// 配置表: rdtask_condi
func (this *ModelRtaskRecord) getRecord(uid string) *pb.DBRtaskRecord {
record := &pb.DBRtaskRecord{}
if this.module.IsCross() {
var (
stag string
conn *db.DBConn
err error
)
if stag, err = comm.UidToSTag(uid); err != nil {
return nil
}
if stag == this.service.GetTag() {
if conn, err = db.Local(); err != nil {
return nil
}
} else {
if conn, err = db.ServerDBConn(stag); err != nil {
return nil
}
}
model := db.NewDBModel(this.TableName, this.Expired, conn)
if model != nil {
model.Get(uid, record)
}
} else {
if err := this.Get(uid, record); err != nil {
if err == mongo.ErrNoDocuments {
record.Id = primitive.NewObjectID().Hex()
record.Ctime = configure.Now().Unix()
record.Vals = make(map[int32]*pb.RtaskData)
if err := this.Add(uid, record); err != nil {
log.Errorln(err)
return nil
}
}
}
}
return record
}

View File

@ -1,103 +0,0 @@
package rtask
import (
"fmt"
"go_dreamfactory/comm"
"go_dreamfactory/lego/core"
"go_dreamfactory/lego/sys/redis"
"go_dreamfactory/modules"
"go_dreamfactory/pb"
"github.com/pkg/errors"
"go.mongodb.org/mongo-driver/bson/primitive"
"go.mongodb.org/mongo-driver/mongo"
)
type ModelRtask struct {
modules.MCompModel
module *ModuleRtask
service core.IService
}
func (this *ModelRtask) Init(service core.IService, module core.IModule, comp core.IModuleComp, options core.IModuleOptions) (err error) {
this.TableName = comm.TableRtask
err = this.MCompModel.Init(service, module, comp, options)
this.module = module.(*ModuleRtask)
this.service = service
return
}
// 更新玩家的随机任务ID
func (this *ModelRtask) updateUserRtaskId(uid string, rtaskId int32) (err error) {
ex_update := map[string]interface{}{
"rtaskId": rtaskId,
}
return this.module.ModuleUser.ChangeUserExpand(uid, ex_update)
}
// 查询用户随机任务
func (this *ModelRtask) GetRtask(uid string) *pb.DBRtask {
rtask := &pb.DBRtask{Uid: uid}
err := this.Get(uid, rtask)
if err != nil {
if err == redis.RedisNil || err == mongo.ErrNoDocuments {
_id := primitive.NewObjectID().Hex()
rtask.Id = _id
if err := this.Add(uid, rtask); err != nil {
return nil
}
}
}
return rtask
}
// 确定选项前的校验
func (this *ModelRtask) checkCondi(uid string, condiId int32, record *pb.DBRtaskRecord, params ...int32) (err error, ok bool) {
if condiId <= 0 {
return nil, true
}
conf, err := this.module.configure.getRtaskTypeById(condiId)
if err != nil || conf == nil {
errors.Errorf("conf not found condiID: %v", condiId)
return
}
if conf.Valid == 1 {
ok = true
return
}
//验证限定条件
var condi *rtaskCondHandle
cond, ok := this.module.handleMap.Load(condiId)
if !ok {
rcs := this.module.getHandle(comm.TaskType(conf.Type))
for _, v := range rcs {
if v.condId == condiId {
cond = v
}
}
}
if condi, ok = cond.(*rtaskCondHandle); !ok {
err = fmt.Errorf("condiType err")
return
}
if condi.verify == nil {
errors.Errorf("condiID: %v", condiId)
return
}
if ok, _, err = condi.verify(uid, conf, params...); !ok {
err = errors.WithMessagef(err, "uid: %v do rtask [condiId:%v] condition not reach", uid, condiId)
return
}
return
}
func (this *ModelRtask) userlock(uid string) (result *redis.RedisMutex, err error) {
return this.DBModel.Redis.NewRedisMutex(fmt.Sprintf("ulocktask:%s", uid))
}

View File

@ -1,526 +0,0 @@
// package 随机任务
// 随机任务
// 赵长远
package rtask
import (
"context"
"fmt"
"go_dreamfactory/comm"
"go_dreamfactory/lego/base"
"go_dreamfactory/lego/core"
"go_dreamfactory/lego/sys/log"
"go_dreamfactory/modules"
"go_dreamfactory/pb"
cfg "go_dreamfactory/sys/configure/structs"
"go_dreamfactory/sys/db"
"go_dreamfactory/utils"
"sync"
"github.com/pkg/errors"
)
var _ comm.IRtask = (*ModuleRtask)(nil)
// 限定条件
type rtaskCondHandle struct {
condId int32 //任务条件配置ID
verify verifyHandle //校验任务条件
update updateDataHandle //更新任务数据
}
// 任务参数校验
type verifyHandle func(uid string, cfg *cfg.GameRdtaskCondiData, params ...int32) (bool, int32, error)
// 任务数据更新
type updateDataHandle func(uid string, record *pb.DBRtaskRecord, cfg *cfg.GameRdtaskCondiData, vals ...int32) error
type ModuleRtask struct {
modules.ModuleBase
service base.IRPCXService
modelRtask *ModelRtask
modelRtaskRecord *ModelRtaskRecord
api *apiComp
configure *configureComp
handleMap sync.Map //map[int32]*rtaskCondi //任务校验处理器
}
func NewModule() core.IModule {
return &ModuleRtask{}
}
func (this *ModuleRtask) GetType() core.M_Modules {
return comm.ModuleRtask
}
func (this *ModuleRtask) Init(service core.IService, module core.IModule, options core.IModuleOptions) (err error) {
err = this.ModuleBase.Init(service, module, options)
this.service = service.(base.IRPCXService)
return
}
func (this *ModuleRtask) Start() (err error) {
err = this.ModuleBase.Start()
this.service.RegisterFunctionName(string(comm.Rpc_ModuleRtaskSendTask), this.Rpc_ModuleRtaskSendTask)
return
}
func (this *ModuleRtask) OnInstallComp() {
this.ModuleBase.OnInstallComp()
this.api = this.RegisterComp(new(apiComp)).(*apiComp)
this.modelRtask = this.RegisterComp(new(ModelRtask)).(*ModelRtask)
this.modelRtaskRecord = this.RegisterComp(new(ModelRtaskRecord)).(*ModelRtaskRecord)
this.configure = this.RegisterComp(new(configureComp)).(*configureComp)
}
func (this *ModuleRtask) registerVerifyHandle(condiId int32, condi *rtaskCondHandle) {
this.handleMap.Store(condiId, condi)
}
func (this *ModuleRtask) getHandle(tt comm.TaskType) (handles []*rtaskCondHandle) {
for _, v := range this.configure.getRtaskCondis(int32(tt)) {
switch tt {
// 两个参数 大于1个参数且第一个参数累计第二个参数等于
case comm.Rtype1, comm.Rtype16, comm.Rtype17, comm.Rtype51, comm.Rtype119,
comm.Rtype120, comm.Rtype121, comm.Rtype125, comm.Rtype126, comm.Rtype127, comm.Rtype187:
handle := &rtaskCondHandle{
condId: v.Id,
verify: this.modelRtaskRecord.verifyMultiEqual,
update: this.modelRtaskRecord.addUpdate,
}
handles = append(handles, handle)
this.registerVerifyHandle(v.Id, handle)
//两个参数 第一个参数覆盖 第二个参数等于
case comm.Rtype4, comm.Rtype5, comm.Rtype6, comm.Rtype8, comm.Rtype10, comm.Rtype35, comm.Rtype158, comm.Rtype168,
comm.Rtype122, comm.Rtype133:
handle := &rtaskCondHandle{
condId: v.Id,
verify: this.modelRtaskRecord.veriftyEqualParam, //两个参数 等于
update: this.modelRtaskRecord.overrideUpdate,
}
handles = append(handles, handle)
this.registerVerifyHandle(v.Id, handle)
// 两个参数 第一个参数累计 第二个参数大于等于
case comm.Rtype50:
handle := &rtaskCondHandle{
condId: v.Id,
verify: this.modelRtaskRecord.veriftyGreatEqualParam,
update: this.modelRtaskRecord.addUpdate,
}
handles = append(handles, handle)
this.registerVerifyHandle(v.Id, handle)
// 两个参数 第一个大于等于 第二个等于
case comm.Rtype61, comm.Rtype159, comm.Rtype160, comm.Rtype75:
handle := &rtaskCondHandle{
condId: v.Id,
verify: this.modelRtaskRecord.verifyMultiEqual, //两个参数 等于
update: this.modelRtaskRecord.overrideUpdate,
}
handles = append(handles, handle)
this.registerVerifyHandle(v.Id, handle)
// 一个参数且覆盖
case comm.Rtype109, comm.Rtype129, comm.Rtype134:
handle := &rtaskCondHandle{
condId: v.Id,
verify: this.modelRtaskRecord.verifyFirstEqualParam,
update: this.modelRtaskRecord.overrideUpdate,
}
handles = append(handles, handle)
this.registerVerifyHandle(v.Id, handle)
// 一个参数且累计
case comm.Rtype7,
comm.Rtype12, comm.Rtype13, comm.Rtype14, comm.Rtype15, comm.Rtype18, comm.Rtype19,
comm.Rtype23, comm.Rtype24, comm.Rtype26, comm.Rtype27, comm.Rtype28, comm.Rtype38, comm.Rtype39,
comm.Rtype47,
comm.Rtype53, comm.Rtype54, comm.Rtype57,
comm.Rtype60, comm.Rtype62, comm.Rtype64, comm.Rtype87, comm.Rtype88, comm.Rtype89,
comm.Rtype90, comm.Rtype91, comm.Rtype92, comm.Rtype94, comm.Rtype95, comm.Rtype97, comm.Rtype96, comm.Rtype98, comm.Rtype99,
comm.Rtype104, comm.Rtype102, comm.Rtype103, comm.Rtype105, comm.Rtype106, comm.Rtype108,
comm.Rtype113, comm.Rtype114, comm.Rtype115, comm.Rtype116, comm.Rtype117, comm.Rtype118, comm.Rtype124, comm.Rtype128,
comm.Rtype130, comm.Rtype131, comm.Rtype132, comm.Rtype135,
comm.Rtype141, comm.Rtype142, comm.Rtype143, comm.Rtype144, comm.Rtype145, comm.Rtype146, comm.Rtype147, comm.Rtype148, comm.Rtype149,
comm.Rtype152, comm.Rtype153, comm.Rtype154, comm.Rtype156,
comm.Rtype161, comm.Rtype165, comm.Rtype166, comm.Rtype167,
comm.Rtype171, comm.Rtype172, comm.Rtype173, comm.Rtype175, comm.Rtype177,
comm.Rtype181, comm.Rtype182, comm.Rtype183, comm.Rtype184, comm.Rtype185, comm.Rtype186, comm.Rtype188:
handle := &rtaskCondHandle{
condId: v.Id,
verify: this.modelRtaskRecord.verifyFirstGreatEqualParam,
update: this.modelRtaskRecord.addUpdate,
}
handles = append(handles, handle)
this.registerVerifyHandle(v.Id, handle)
//////
case comm.Rtype3:
handle := &rtaskCondHandle{
condId: v.Id,
verify: this.modelRtask.verifyRtype3,
}
handles = append(handles, handle)
this.registerVerifyHandle(v.Id, handle)
case comm.Rtype9:
handle := &rtaskCondHandle{
condId: v.Id,
verify: this.modelRtask.verfiyRtype9,
}
handles = append(handles, handle)
this.registerVerifyHandle(v.Id, handle)
case comm.Rtype20:
handle := &rtaskCondHandle{
condId: v.Id,
verify: this.modelRtask.verifyRtype20,
}
handles = append(handles, handle)
this.registerVerifyHandle(v.Id, handle)
case comm.Rtype138:
handle := &rtaskCondHandle{
condId: v.Id,
verify: this.modelRtask.verifyRtype138,
}
handles = append(handles, handle)
this.registerVerifyHandle(v.Id, handle)
// 多参数 第一个大于等于 其它等于
case comm.Rtype25, comm.Rtype30,
comm.Rtype32, comm.Rtype33, comm.Rtype34, comm.Rtype36,
comm.Rtype37, comm.Rtype40,
comm.Rtype46, comm.Rtype76, comm.Rtype79,
comm.Rtype52, comm.Rtype55, comm.Rtype56, comm.Rtype82,
comm.Rtype65, comm.Rtype66, comm.Rtype67, comm.Rtype68, comm.Rtype70, comm.Rtype140,
comm.Rtype169, comm.Rtype174, comm.Rtype179, comm.Rtype180:
handle := &rtaskCondHandle{
condId: v.Id,
verify: this.modelRtaskRecord.verifyMultiEqual,
update: this.modelRtaskRecord.addUpdate,
}
handles = append(handles, handle)
this.registerVerifyHandle(v.Id, handle)
// 三个参数 第二个等于 第三个大于等于
case comm.Rtype73, comm.Rtype77, comm.Rtype80, comm.Rtype83, comm.Rtype93:
handle := &rtaskCondHandle{
condId: v.Id,
verify: this.modelRtaskRecord.verifyThirdGreatEqualParam,
update: this.modelRtaskRecord.addUpdate,
}
handles = append(handles, handle)
this.registerVerifyHandle(v.Id, handle)
case comm.Rtype41, comm.Rtype42:
handle := &rtaskCondHandle{
condId: v.Id,
verify: this.modelRtaskRecord.verifyThirdGreatEqualParam,
update: this.modelRtaskRecord.addUpdate,
}
handles = append(handles, handle)
this.registerVerifyHandle(v.Id, handle)
case comm.Rtype43:
handle := &rtaskCondHandle{
condId: v.Id,
verify: this.modelRtask.verifyRtype43,
update: this.modelRtaskRecord.overrideUpdate,
}
handles = append(handles, handle)
this.registerVerifyHandle(v.Id, handle)
case comm.Rtype78:
handle := &rtaskCondHandle{
condId: v.Id,
verify: this.modelRtaskRecord.verifyThirdLessEqualParam,
update: this.modelRtaskRecord.overrideUpdate,
}
handles = append(handles, handle)
this.registerVerifyHandle(v.Id, handle)
case comm.Rtype111:
handle := &rtaskCondHandle{
condId: v.Id,
verify: this.modelRtask.verifyRtype111,
update: this.modelRtaskRecord.overrideUpdate,
}
handles = append(handles, handle)
this.registerVerifyHandle(v.Id, handle)
case comm.Rtype123:
handle := &rtaskCondHandle{
condId: v.Id,
verify: this.modelRtask.verifyRtype123,
update: this.modelRtaskRecord.overrideUpdate,
}
handles = append(handles, handle)
this.registerVerifyHandle(v.Id, handle)
default:
log.Warnf("rtaskType[%v] handle not register", tt)
}
}
return
}
// 处理触发的任务
func (this *ModuleRtask) processOneTask(session comm.IUserSession, record *pb.DBRtaskRecord, rtaskType comm.TaskType, params ...int32) (condIds []int32, errdata *pb.ErrorData) {
uid := session.GetUserId()
handles := this.getHandle(rtaskType)
// update
for _, handle := range handles {
conf, err := this.configure.getRtaskTypeById(handle.condId)
if err != nil {
return
}
if conf.Data == 1 { //接取
if r, ok := record.Vals[handle.condId]; ok {
if r.Flag == 0 { //非接取
r.Data = make(map[int32]int32)
r.Rtype = conf.Type
} else {
return
}
}
}
if handle.verify != nil {
var (
ok bool
d int32
)
if len(params) == 1 {
ok = true
} else {
ok, d, err = handle.verify(uid, conf, params...)
if err != nil {
// this.Error("参数校验失败", log.Field{Key: "err", Value: err.Error()})
}
}
if !ok {
continue
}
if handle.update != nil {
if d > 0 {
params[0] = d
}
if err := handle.update(uid, record, conf, params...); err != nil {
log.Errorf("update task:%v", err)
errdata = &pb.ErrorData{
Code: pb.ErrorCode_DBError,
Title: pb.ErrorCode_DBError.ToString(),
Message: err.Error(),
}
return
}
}
condIds = append(condIds, handle.condId)
}
}
return
}
type RPCRtaskReq struct {
Uid string
TaskParams []*comm.TaskParam
}
func (this *ModuleRtask) TriggerTask(uid string, taskParams ...*comm.TaskParam) {
session, ok := this.GetUserSession(uid)
if !ok {
return
}
this.Debug("任务触发",
log.Field{Key: "uid", Value: uid},
log.Field{Key: "tasks", Value: taskParams})
if this.IsCross() {
//随机任务
if _, err := this.service.AcrossClusterRpcGo(
context.Background(),
session.GetServiecTag(),
comm.Service_Worker,
string(comm.Rpc_ModuleRtaskSendTask),
&RPCRtaskReq{Uid: uid, TaskParams: taskParams},
nil); err != nil {
log.Errorln(err)
}
return
}
this.processTasks(session, taskParams...)
session.Push()
this.PutUserSession(session)
return
}
func (this *ModuleRtask) processTasks(session comm.IUserSession, taskParams ...*comm.TaskParam) {
lock, _ := this.modelRtask.userlock(session.GetUserId())
err := lock.Lock()
if err != nil {
this.Error("TriggerTask userlock err!", log.Field{Key: "err", Value: err.Error()})
}
defer lock.Unlock()
uid := session.GetUserId()
record := this.modelRtaskRecord.getRecord(uid)
var condIds []int32
for _, tp := range taskParams {
ids, _ := this.processOneTask(session, record, tp.TT, tp.Params...)
condIds = append(condIds, ids...)
comm.PuttaskParam(tp)
}
update := map[string]interface{}{
"vals": record.Vals,
}
this.modelRtaskRecord.Change(uid, update)
//去重
condIds = utils.RemoveDuplicate(condIds)
//带通知的condIds
var condIdsForNotify []int32
for _, condId := range condIds {
r, _ := record.Vals[condId]
conf, _ := this.configure.getRtaskTypeById(condId)
if r.Data[0] >= conf.Data1 {
condIdsForNotify = append(condIdsForNotify, condId)
}
}
if len(condIdsForNotify) == 0 {
return
}
//通知世界任务模块
// module, err := this.service.GetModule(comm.ModuleWorldtask)
// if err == nil {
// //世界任务
// if worldtask, ok := module.(comm.IWorldtask); ok {
// if err := worldtask.TaskCondFinishNotify(session, condIdsForNotify); err != nil {
// }
// }
// }
// 通知公会任务模块
// sociatyModule, err := this.service.GetModule(comm.ModuleSociaty)
// if err != nil {
// return
// }
// if sociaty, ok := sociatyModule.(comm.ISociaty); ok {
// if err2 := sociaty.TaskcondNotify(uid, condIdsForNotify); err2 != nil {
// }
// }
}
// 任务条件校验
// Deprecated
func (this *ModuleRtask) CheckCondi(uid string, condiId int32, params ...int32) (errdata *pb.ErrorData) {
record := this.modelRtaskRecord.getRecord(uid)
if record == nil {
return
}
if len(params) == 0 {
if v, ok := record.Vals[condiId]; ok {
for _, p := range v.Data {
params = append(params, p)
}
}
}
if _, ok := this.modelRtask.checkCondi(uid, condiId, record, params...); !ok {
return
}
return
}
func (this *ModuleRtask) CheckCondis(uid string, condiIds ...int32) (cids []int32) {
record := this.modelRtaskRecord.getRecord(uid)
if record == nil {
return
}
for _, condId := range condiIds {
if r, ok := record.Vals[condId]; ok {
conf, err := this.configure.getRtaskTypeById(condId)
if err != nil || conf == nil {
errors.Errorf("conf not found condiID: %v", condId)
return
}
if r.Data[0] >= conf.Data1 {
cids = append(cids, condId)
}
}
}
return
}
func (this *ModuleRtask) RemoveCondi(uid string, condiId int32) (err error) {
dr := this.modelRtaskRecord.getRecord(uid)
if dr != nil && dr.Vals != nil {
delete(dr.Vals, condiId)
}
return
}
// 获取玩家任务条件记录
func (this *ModuleRtask) GetCondiData(uid string) *pb.DBRtaskRecord {
return this.modelRtaskRecord.getRecord(uid)
}
// 远程条件校验
func (this *ModuleRtask) RemoteCheckCondi(uid string, condiId int32, rsp *pb.DBRtaskRecord) error {
if rsp == nil {
return errors.New("pb.DBRtaskRecord is not instance")
}
sid, _, ok := utils.UIdSplit(uid)
if !ok {
return errors.New("sid split error")
}
conn, err := db.ServerDBConn(sid)
if err != nil {
return err
}
model := db.NewDBModel(comm.TableRtaskRecord, 0, conn)
if err := model.Get(uid, rsp); err != nil {
return err
}
return nil
}
func (this *ModuleRtask) ChangeCondi(uid string, data map[int32]*pb.RtaskData) error {
if len(data) > 0 {
update := map[string]interface{}{
"vals": data,
}
return this.modelRtaskRecord.Change(uid, update)
}
return nil
}
type TaskProcessResp struct {
CondIds []int32
}
// 接收区服worker发起的秘境事件
func (this *ModuleRtask) Rpc_ModuleRtaskSendTask(ctx context.Context, args *RPCRtaskReq, reply *pb.EmptyResp) (err error) {
this.Debug("Rpc_ModuleRtaskSendTask",
log.Field{Key: "args", Value: args},
)
if args.Uid == "" {
err = errors.New("参数异常!")
return
}
if this.IsCross() {
err = errors.New("环境错误 此处为跨服环境!")
return
}
if session, ok := this.GetUserSession(args.Uid); !ok {
err = fmt.Errorf("未查询到用户:%s在线信息!", args.Uid)
return
} else {
this.processTasks(session, args.TaskParams...)
session.Push()
}
return
}

View File

@ -1,55 +0,0 @@
// package 更新任务触发后的数据更新
package rtask
import (
"go_dreamfactory/pb"
"go_dreamfactory/sys/configure"
cfg "go_dreamfactory/sys/configure/structs"
)
// 覆盖更新
func (this *ModelRtaskRecord) overrideUpdate(uid string, record *pb.DBRtaskRecord, cfg *cfg.GameRdtaskCondiData, vals ...int32) (err error) {
var paramLen int
if paramLen, err = lenParam(cfg, vals...); err != nil {
return err
}
if record.Vals == nil {
record.Vals = make(map[int32]*pb.RtaskData)
}
if v, ok := record.Vals[cfg.Id]; ok {
v.Data = hasUpdateData(paramLen, v, vals...)
} else {
data := &pb.RtaskData{
Rtype: cfg.Type,
Data: toMap(vals...),
Timestamp: configure.Now().Unix(),
}
record.Vals[cfg.Id] = data
}
return
}
// 累计更新 - 招募等
func (this *ModelRtaskRecord) addUpdate(uid string, record *pb.DBRtaskRecord, cfg *cfg.GameRdtaskCondiData, vals ...int32) (err error) {
if record.Vals == nil {
record.Vals = make(map[int32]*pb.RtaskData)
}
//查找任务数据
if v, ok := record.Vals[cfg.Id]; ok {
newArr := make([]int32, len(vals))
copy(newArr, vals)
srcCount := v.Data[0]
newArr[0] = srcCount + vals[0]
v.Data = toMap(newArr...)
v.Timestamp = configure.Now().Unix()
} else {
record.Vals[cfg.Id] = &pb.RtaskData{
Data: toMap(vals...),
Rtype: cfg.Type,
Timestamp: configure.Now().Unix(),
}
}
return
}

View File

@ -1,497 +0,0 @@
// 校验任务条件
package rtask
import (
"fmt"
"go_dreamfactory/comm"
"go_dreamfactory/pb"
"go_dreamfactory/sys/configure"
cfg "go_dreamfactory/sys/configure/structs"
"go_dreamfactory/utils"
"github.com/spf13/cast"
)
// n params (1-GreatEqual 2-equal 3-equal 4-equal 5-equal)
func (this *ModelRtaskRecord) verifyMultiEqual(uid string, cfg *cfg.GameRdtaskCondiData, params ...int32) (ok bool, count int32, err error) {
if len(params) == 0 {
err = fmt.Errorf("玩家参数数据缺失,用户参数:%v", params)
return
}
var paramLen int
if paramLen, err = lenParam(cfg, params...); err == nil {
//参数比较,默认第一个参数soGreateEqual,其它soEqual
switch paramLen {
case 1:
// ok, err = soGreatEqual(params[0], cfg.Data1)
ok = true
return
case 2:
// if ok, err = soGreatEqual(params[0], cfg.Data1); !ok {
// return
// }
if ok, err = soEqual(params[1], cfg.Data2); !ok {
return
}
case 3:
// if ok, err = soGreatEqual(params[0], cfg.Data1); !ok {
// return
// }
if ok, err = soEqual(params[1], cfg.Data2); !ok {
return
}
if ok, err = soEqual(params[2], cfg.Data3); !ok {
return
}
case 4:
// if ok, err = soGreatEqual(params[0], cfg.Data1); !ok {
// return
// }
if ok, err = soEqual(params[1], cfg.Data2); !ok {
return
}
if ok, err = soEqual(params[2], cfg.Data3); !ok {
return
}
if ok, err = soEqual(params[3], cfg.Data4); !ok {
return
}
case 5:
// if ok, err = soGreatEqual(params[0], cfg.Data1); !ok {
// return
// }
if ok, err = soEqual(params[1], cfg.Data2); !ok {
return
}
if ok, err = soEqual(params[2], cfg.Data3); !ok {
return
}
if ok, err = soEqual(params[3], cfg.Data4); !ok {
return
}
if ok, err = soEqual(params[4], cfg.Data5); !ok {
return
}
}
}
return
}
// firstParam (first-Equal)
func (this *ModelRtaskRecord) verifyFirstEqualParam(uid string, cfg *cfg.GameRdtaskCondiData, params ...int32) (ok bool, count int32, err error) {
if len(params) == 1 {
ok, err = soEqual(params[0], cfg.Data1)
}
return
}
// firstParam (first-greatEqual)
func (this *ModelRtaskRecord) verifyFirstGreatEqualParam(uid string, cfg *cfg.GameRdtaskCondiData, params ...int32) (ok bool, count int32, err error) {
if len(params) != 1 {
err = fmt.Errorf("玩家参数数据缺失,用户参数:%v", params)
return
}
ok = true
return
}
// three params (first-greatEqual second-equal third-lessEqual)
func (this *ModelRtaskRecord) verifyThirdLessEqualParam(uid string, cfg *cfg.GameRdtaskCondiData, params ...int32) (ok bool, count int32, err error) {
if len(params) != 3 {
err = fmt.Errorf("玩家参数数据缺失,用户参数:%v", params)
return
}
var paramLen int
if paramLen, err = lenParam(cfg, params...); err == nil {
//参数比较,默认第一个参数soGreateEqual,其它soEqual
switch paramLen {
case 1:
ok = true
return
case 2:
if ok, err = soEqual(params[1], cfg.Data2); !ok {
return
}
case 3:
if ok, err = soEqual(params[1], cfg.Data2); !ok {
return
}
if ok, err = soLessEqual(params[2], cfg.Data3); !ok {
return
}
}
}
return
}
// three params (first-greatEqual second-equal third-greatEqual)
func (this *ModelRtaskRecord) verifyThirdGreatEqualParam(uid string, cfg *cfg.GameRdtaskCondiData, params ...int32) (ok bool, count int32, err error) {
if len(params) != 3 {
err = fmt.Errorf("玩家参数数据缺失,用户参数:%v", params)
return
}
var paramLen int
if paramLen, err = lenParam(cfg, params...); err == nil {
//参数比较,默认第一个参数soGreateEqual,其它soEqual
switch paramLen {
case 1:
ok = true
return
case 2:
if ok, err = soEqual(params[1], cfg.Data2); !ok {
return
}
case 3:
if ok, err = soEqual(params[1], cfg.Data2); !ok {
return
}
if ok, err = soGreatEqual(params[2], cfg.Data3); !ok {
return
}
}
}
return
}
// two params (first-Equal second-Equal)
func (this *ModelRtaskRecord) veriftyEqualParam(uid string, cfg *cfg.GameRdtaskCondiData, params ...int32) (ok bool, count int32, err error) {
if len(params) != 2 {
err = fmt.Errorf("玩家参数数据缺失,用户参数:%v", params)
return
}
// var paramLen int
if _, err = lenParam(cfg, params...); err == nil {
if ok, err = soEqual(params[1], cfg.Data2); !ok {
return
}
// }
}
return
}
// two params (first-Equal second-GreatEqual)
func (this *ModelRtaskRecord) veriftyGreatEqualParam(uid string, cfg *cfg.GameRdtaskCondiData, params ...int32) (ok bool, count int32, err error) {
if len(params) != 2 {
err = fmt.Errorf("玩家参数数据缺失,用户参数:%v", params)
return
}
// var paramLen int
if _, err = lenParam(cfg, params...); err == nil {
if ok, err = soGreatEqual(params[1], cfg.Data2); !ok {
return
}
}
return
}
// 英雄指定
func (this *ModelRtask) verfiyRtype1(uid string, cfg *cfg.GameRdtaskCondiData, params ...int32) (ok bool, err error) {
heroModule, err := this.service.GetModule(comm.ModuleHero)
if err != nil {
return false, err
}
if h, y := heroModule.(comm.IHero); y {
for _, v := range h.GetHeroList(uid) {
ok, err = soEqual(cast.ToString(cfg.Data1), v.HeroID)
if ok {
return
}
}
}
return
}
// 剧情
// Deprecated
func (this *ModelRtask) verifyRtype2(uid string, cfg *cfg.GameRdtaskCondiData, params ...int32) (ok bool, err error) {
m, err := this.service.GetModule(comm.ModuleMline)
if err != nil {
return
}
if ml, y := m.(comm.IMline); y {
qjId := ml.GetUserMlineData(uid, 1)
return soEqual(qjId, cfg.Data1)
}
return
}
// 每日任务
// Deprecated
func (this *ModelRtask) verifyRtype3(uid string, cfg *cfg.GameRdtaskCondiData, params ...int32) (ok bool, count int32, err error) {
m, err := this.service.GetModule(comm.ModuleTask)
if err != nil {
return
}
if ml, y := m.(comm.ITask); y {
for _, task := range ml.GetTaskDayFinished(uid) {
if task.TaskId >= cfg.Data1 {
ok = true
break
}
}
}
return
}
// 指定英雄等级
func (this *ModelRtask) verifyRtype4(uid string, cfg *cfg.GameRdtaskCondiData, params ...int32) (ok bool, count int32, err error) {
m, err := this.service.GetModule(comm.ModuleHero)
if err != nil {
return
}
if ml, y := m.(comm.IHero); y {
var hero *pb.DBHero
for _, v := range ml.GetHeroList(uid) {
if cast.ToString(cfg.Data1) == v.HeroID {
hero = v
break
}
}
if hero != nil {
if ok, err = soEqual(hero.HeroID, cast.ToString(cfg.Data1)); !ok {
return
}
if ok, err = soGreatEqual(hero.Lv, cfg.Data2); !ok {
return
}
}
}
return
}
// 指定英雄的指定装备数量
func (this *ModelRtask) verifyRtype5(uid string, cfg *cfg.GameRdtaskCondiData, params ...int32) (ok bool, err error) {
m, err := this.service.GetModule(comm.ModuleHero)
if err != nil {
return
}
if ml, y := m.(comm.IHero); y {
var (
hero *pb.DBHero
heroId string
)
for _, v := range ml.GetHeroList(uid) {
if cast.ToString(cfg.Data1) == v.HeroID {
hero = v
break
}
}
var count int32
if hero != nil {
heroId = hero.HeroID
for _, v := range hero.EquipID {
if v != "" {
count++
}
}
}
if ok, err = soEqual(heroId, cast.ToString(cfg.Data1)); !ok {
return
}
return soGreatEqual(count, cfg.Data2)
}
return
}
// 指定英雄星级
func (this *ModelRtask) verifyRtype6(uid string, cfg *cfg.GameRdtaskCondiData, params ...int32) (ok bool, err error) {
m, err := this.service.GetModule(comm.ModuleHero)
if err != nil {
return
}
if ml, y := m.(comm.IHero); y {
var hero *pb.DBHero
for _, v := range ml.GetHeroList(uid) {
if cast.ToString(cfg.Data1) == v.HeroID {
hero = v
break
}
}
if hero != nil {
if ok, err = soEqual(hero.HeroID, cast.ToString(cfg.Data1)); !ok {
return
}
return soGreatEqual(hero.Star, cfg.Data2)
}
}
return
}
// 日常登录一次
func (this *ModelRtask) verfiyRtype7(uid string, cfg *cfg.GameRdtaskCondiData, params ...int32) (ok bool, err error) {
userModule, err := this.service.GetModule(comm.ModuleUser)
if err != nil {
return
}
if um, y := userModule.(comm.IUser); y {
if user := um.GetUser(uid); user != nil {
return soEqual(utils.IsToday(user.Logintime), true)
}
}
return
}
// 累计登陆xx天
func (this *ModelRtask) verfiyRtype8(uid string, cfg *cfg.GameRdtaskCondiData, params ...int32) (ok bool, err error) {
userModule, err := this.service.GetModule(comm.ModuleUser)
if err != nil {
return
}
if um, y := userModule.(comm.IUser); y {
ud, err := um.GetUserExpand(uid)
if err != nil {
return false, err
}
return soGreatEqual(ud.LoginAddCount, cfg.Data1)
}
return
}
// 连续登陆xx天 未埋点的处理方法
func (this *ModelRtask) verfiyRtype9(uid string, cfg *cfg.GameRdtaskCondiData, params ...int32) (ok bool, count int32, err error) {
userModule, err := this.service.GetModule(comm.ModuleUser)
if err != nil {
return
}
if um, y := userModule.(comm.IUser); y {
ud, err := um.GetUserExpand(uid)
if err != nil {
return false, 0, err
}
ok, err = soGreatEqual(ud.LoginContinueCount, cfg.Data1)
}
return
}
// 拥有xx个好友
func (this *ModelRtask) verfiyRtype10(uid string, cfg *cfg.GameRdtaskCondiData, params ...int32) (ok bool, count int32, err error) {
m, err := this.service.GetModule(comm.ModuleFriend)
if err != nil {
return
}
if mi, y := m.(comm.IFriend); y {
count := mi.GetFriendCount(uid)
ok, err = soGreatEqual(count, cfg.Data1)
}
return
}
// 用户等级达到xx级
func (this *ModelRtask) verifyRtype20(uid string, cfg *cfg.GameRdtaskCondiData, params ...int32) (ok bool, count int32, err error) {
userModule, err := this.service.GetModule(comm.ModuleUser)
if err != nil {
return
}
if um, y := userModule.(comm.IUser); y {
if user := um.GetUser(uid); user != nil {
ok, err = soGreatEqual(user.Lv, cfg.Data1)
return
}
}
return
}
// 日常任务活跃度达到xx
func (this *ModelRtask) verifyRtype63(uid string, cfg *cfg.GameRdtaskCondiData, params ...int32) (ok bool, count int32, err error) {
userModule, err := this.service.GetModule(comm.ModuleUser)
if err != nil {
return
}
if um, y := userModule.(comm.IUser); y {
de, err := um.GetUserExpand(uid)
if err != nil {
return false, 0, err
}
if de != nil {
ok, err = soGreatEqual(de.Activeday, cfg.Data1)
}
}
return
}
// 记录玩家在线时间并记入进度
func (this *ModelRtask) verifyRtype138(uid string, cfg *cfg.GameRdtaskCondiData, params ...int32) (ok bool, count int32, err error) {
userModule, err := this.service.GetModule(comm.ModuleUser)
if err != nil {
return
}
if um, y := userModule.(comm.IUser); y {
if user := um.GetUser(uid); user != nil {
now := configure.Now().Unix()
l := (now - user.Logintime) / 60
ok, err = soGreatEqual(int32(l), cfg.Data1)
return
}
}
return
}
func (this *ModelRtask) verifyRtype43(uid string, cfg *cfg.GameRdtaskCondiData, params ...int32) (ok bool, count int32, err error) {
equipment, ec := this.module.ModuleEquipment.QueryEquipments(uid)
if ec == nil {
for _, e := range equipment {
if ok, _ = soGreatEqual(e.Lv, cfg.Data2); ok {
count++
}
}
}
ok = true
return
}
func (this *ModelRtask) verifyRtype111(uid string, cfg *cfg.GameRdtaskCondiData, params ...int32) (ok bool, count int32, err error) {
m, err := this.service.GetModule(comm.ModuleHero)
if err != nil {
return
}
if ml, y := m.(comm.IHero); y {
for _, hero := range ml.GetHeroList(uid) {
if ok, err = soGreatEqual(hero.Lv, cfg.Data2); ok {
count++
}
}
}
ok = true
return
}
func (this *ModelRtask) verifyRtype123(uid string, cfg *cfg.GameRdtaskCondiData, params ...int32) (ok bool, count int32, err error) {
m, err := this.service.GetModule(comm.ModuleHero)
if err != nil {
return
}
if ml, y := m.(comm.IHero); y {
heroList := ml.GetHeroList(uid)
for _, heroId := range ml.QueryHeroTelnetByCount(uid, int(cfg.Data2)) {
for _, hero := range heroList {
if heroId == hero.Id && hero.Star == cfg.Data3 {
count++
}
}
}
}
ok = true
return
}

View File

@ -312,7 +312,7 @@ func (this *apiComp) ForgeEquip(session comm.IUserSession, req *pb.SmithyForgeEq
if equipConf := this.module.configure.GetEquipmentConfigureById(v.CId); equipConf != nil { // 获取装备等级
go func(cid string, star int32, AdverbEntry int32) {
this.module.modelAtlas.CheckActivateAtlas(session.GetUserId(), cid, star, AdverbEntry, stove.Forge[req.ReelId])
}(v.CId, equipConf.Color, int32(len(v.AdverbEntry)+1)) // 品质按副词条数+1 来算
}(v.CId, equipConf.InitLv, int32(len(v.AdverbEntry)+1)) // 品质按副词条数+1 来算
}
}
var equip map[int32]int32 // key xingji value 数量
@ -320,7 +320,7 @@ func (this *apiComp) ForgeEquip(session comm.IUserSession, req *pb.SmithyForgeEq
tasks := make([]*pb.BuriedParam, 0)
for _, v := range atno {
if cfg := this.module.configure.GetEquipmentConfigureById(v.T); cfg != nil {
equip[cfg.Color]++
equip[cfg.InitLv]++
}
}
for k, v := range equip {

View File

@ -278,7 +278,7 @@ func (this *configureComp) LoadSmithyAtlasScoreConf() {
this._mapAtlasScore = make(map[int64]int32, 0)
defer this.hlock.Unlock()
for _, value := range configure.GetDataList() {
this._mapAtlasScore[int64(value.Quality<<16)+int64(value.Lv)] = value.Score
this._mapAtlasScore[int64(value.Quality<<16)+int64(value.InitLv)] = value.Score
}
return
}

View File

@ -1,26 +0,0 @@
package task
import (
"go_dreamfactory/comm"
"go_dreamfactory/pb"
)
func (this *apiComp) GetrecordCheck(session comm.IUserSession, req *pb.TaskGetrecordReq) (errdata *pb.ErrorData) {
return
}
// 获取玩家任务条件记录
// 客户端会在登录时拉取此数据
func (this *apiComp) Getrecord(session comm.IUserSession, req *pb.TaskGetrecordReq) (errdata *pb.ErrorData) {
rsp := &pb.TaskGetrecordResp{}
if imodule, err := this.service.GetModule(comm.ModuleRtask); err == nil {
if itask, ok := imodule.(comm.IRtask); ok {
record := itask.GetCondiData(session.GetUserId())
if record.Uid != "" && record.Vals != nil {
rsp.Record = record
}
}
}
session.SendMsg(string(this.module.GetType()), TaskSubTypeGetrecord, rsp)
return
}

View File

@ -123,7 +123,7 @@ func (this *apiComp) ChallengeOver(session comm.IUserSession, req *pb.VikingChal
if v.A == "equp" {
for _, star := range req.Star {
cfg := this.configure.GetEquipmentConfigureById(v.T)
if cfg != nil && star == cfg.Color { // 自动出售 转换成其他道具
if cfg != nil && star == cfg.InitLv { // 自动出售 转换成其他道具
if len(cfg.Sale) != 0 {
bFound = true
del = append(del, cfg.Id)

View File

@ -142,31 +142,6 @@ func (this *ModelWorldtask) findNextTasks(parentTaskId int32) (taskIds []int32)
return
}
func (this *ModelWorldtask) checkCondi(uid string, condiId int32) bool {
if m, err := this.service.GetModule(comm.ModuleRtask); err == nil {
iwt, ok := m.(comm.IRtask)
if ok {
if errdata := iwt.CheckCondi(uid, condiId); errdata != nil {
this.moduleWorldtask.Debug("任务完成条件不满足",
log.Field{Key: "uid", Value: uid},
log.Field{Key: "condiId", Value: condiId},
)
return false
}
//update flag=1
dr := iwt.GetCondiData(uid)
if dr != nil {
if v, ok := dr.Vals[condiId]; ok {
v.Flag = 1
iwt.ChangeCondi(uid, dr.Vals)
}
}
return true
}
}
return false
}
// 更新当前任务的完成条件
func (this *ModelWorldtask) updateCurrentTaskCond(uid string, userLv int32, userTask *pb.DBWorldtask, nextTaskId int32) *pb.DBWorldtask {

View File

@ -38,7 +38,6 @@ import (
"go_dreamfactory/modules/pvp"
"go_dreamfactory/modules/reddot"
"go_dreamfactory/modules/reputation"
"go_dreamfactory/modules/rtask"
"go_dreamfactory/modules/shop"
"go_dreamfactory/modules/smithy"
"go_dreamfactory/modules/sociaty"
@ -94,7 +93,6 @@ func main() {
forum.NewModule(),
pagoda.NewModule(),
gourmet.NewModule(),
rtask.NewModule(),
viking.NewModule(),
smithy.NewModule(),
moonfantasy.NewModule(),

View File

@ -12,17 +12,17 @@ import "errors"
type GameRdtaskCondiData struct {
Id int32
Data int32
Rtype int32
Ctype int32
Notify []string
TypeSp int32
Tasktxt string
Type int32
Valid int32
NPC int32
Data1 int32
Data2 int32
Data3 int32
Data4 int32
Data5 int32
Value int32
Filter []int32
Filter2 []string
}
const TypeId_GameRdtaskCondiData = 2060899038
@ -33,17 +33,56 @@ func (*GameRdtaskCondiData) GetTypeId() int32 {
func (_v *GameRdtaskCondiData)Deserialize(_buf map[string]interface{}) (err error) {
{ var _ok_ bool; var _tempNum_ float64; if _tempNum_, _ok_ = _buf["id"].(float64); !_ok_ { err = errors.New("id error"); return }; _v.Id = int32(_tempNum_) }
{ var _ok_ bool; var _tempNum_ float64; if _tempNum_, _ok_ = _buf["data"].(float64); !_ok_ { err = errors.New("data error"); return }; _v.Data = int32(_tempNum_) }
{ var _ok_ bool; var _tempNum_ float64; if _tempNum_, _ok_ = _buf["rtype"].(float64); !_ok_ { err = errors.New("rtype error"); return }; _v.Rtype = int32(_tempNum_) }
{ var _ok_ bool; var _tempNum_ float64; if _tempNum_, _ok_ = _buf["ctype"].(float64); !_ok_ { err = errors.New("ctype error"); return }; _v.Ctype = int32(_tempNum_) }
{
var _arr_ []interface{}
var _ok_ bool
if _arr_, _ok_ = _buf["notify"].([]interface{}); !_ok_ { err = errors.New("notify error"); return }
_v.Notify = make([]string, 0, len(_arr_))
for _, _e_ := range _arr_ {
var _list_v_ string
{ if _list_v_, _ok_ = _e_.(string); !_ok_ { err = errors.New("_list_v_ error"); return } }
_v.Notify = append(_v.Notify, _list_v_)
}
}
{ var _ok_ bool; var _tempNum_ float64; if _tempNum_, _ok_ = _buf["type_sp"].(float64); !_ok_ { err = errors.New("type_sp error"); return }; _v.TypeSp = int32(_tempNum_) }
{var _ok_ bool; var __json_text__ map[string]interface{}; if __json_text__, _ok_ = _buf["tasktxt"].(map[string]interface{}) ; !_ok_ { err = errors.New("_v.Tasktxt error"); return }; { var _ok_ bool; if _, _ok_ = __json_text__["key"].(string); !_ok_ { err = errors.New("key error"); return } }; { var _ok_ bool; if _v.Tasktxt, _ok_ = __json_text__["text"].(string); !_ok_ { err = errors.New("text error"); return } } }
{ var _ok_ bool; var _tempNum_ float64; if _tempNum_, _ok_ = _buf["type"].(float64); !_ok_ { err = errors.New("type error"); return }; _v.Type = int32(_tempNum_) }
{ var _ok_ bool; var _tempNum_ float64; if _tempNum_, _ok_ = _buf["valid"].(float64); !_ok_ { err = errors.New("valid error"); return }; _v.Valid = int32(_tempNum_) }
{ var _ok_ bool; var _tempNum_ float64; if _tempNum_, _ok_ = _buf["NPC"].(float64); !_ok_ { err = errors.New("NPC error"); return }; _v.NPC = int32(_tempNum_) }
{ var _ok_ bool; var _tempNum_ float64; if _tempNum_, _ok_ = _buf["data1"].(float64); !_ok_ { err = errors.New("data1 error"); return }; _v.Data1 = int32(_tempNum_) }
{ var _ok_ bool; var _tempNum_ float64; if _tempNum_, _ok_ = _buf["data2"].(float64); !_ok_ { err = errors.New("data2 error"); return }; _v.Data2 = int32(_tempNum_) }
{ var _ok_ bool; var _tempNum_ float64; if _tempNum_, _ok_ = _buf["data3"].(float64); !_ok_ { err = errors.New("data3 error"); return }; _v.Data3 = int32(_tempNum_) }
{ var _ok_ bool; var _tempNum_ float64; if _tempNum_, _ok_ = _buf["data4"].(float64); !_ok_ { err = errors.New("data4 error"); return }; _v.Data4 = int32(_tempNum_) }
{ var _ok_ bool; var _tempNum_ float64; if _tempNum_, _ok_ = _buf["data5"].(float64); !_ok_ { err = errors.New("data5 error"); return }; _v.Data5 = int32(_tempNum_) }
{ var _ok_ bool; var _tempNum_ float64; if _tempNum_, _ok_ = _buf["value"].(float64); !_ok_ { err = errors.New("value error"); return }; _v.Value = int32(_tempNum_) }
{
var _arr_ []interface{}
var _ok_ bool
if _arr_, _ok_ = _buf["filter"].([]interface{}); !_ok_ { err = errors.New("filter error"); return }
_v.Filter = make([]int32, 0, len(_arr_))
for _, _e_ := range _arr_ {
var _list_v_ int32
{ var _ok_ bool; var _x_ float64; if _x_, _ok_ = _e_.(float64); !_ok_ { err = errors.New("_list_v_ error"); return }; _list_v_ = int32(_x_) }
_v.Filter = append(_v.Filter, _list_v_)
}
}
{
var _arr_ []interface{}
var _ok_ bool
if _arr_, _ok_ = _buf["filter2"].([]interface{}); !_ok_ { err = errors.New("filter2 error"); return }
_v.Filter2 = make([]string, 0, len(_arr_))
for _, _e_ := range _arr_ {
var _list_v_ string
{ if _list_v_, _ok_ = _e_.(string); !_ok_ { err = errors.New("_list_v_ error"); return } }
_v.Filter2 = append(_v.Filter2, _list_v_)
}
}
return
}

View File

@ -13,7 +13,7 @@ import "errors"
type GameSmithyAtlasScoreData struct {
Id int32
Quality int32
Lv int32
InitLv int32
Score int32
}
@ -26,7 +26,7 @@ func (*GameSmithyAtlasScoreData) GetTypeId() int32 {
func (_v *GameSmithyAtlasScoreData)Deserialize(_buf map[string]interface{}) (err error) {
{ var _ok_ bool; var _tempNum_ float64; if _tempNum_, _ok_ = _buf["id"].(float64); !_ok_ { err = errors.New("id error"); return }; _v.Id = int32(_tempNum_) }
{ var _ok_ bool; var _tempNum_ float64; if _tempNum_, _ok_ = _buf["quality"].(float64); !_ok_ { err = errors.New("quality error"); return }; _v.Quality = int32(_tempNum_) }
{ var _ok_ bool; var _tempNum_ float64; if _tempNum_, _ok_ = _buf["lv"].(float64); !_ok_ { err = errors.New("lv error"); return }; _v.Lv = int32(_tempNum_) }
{ var _ok_ bool; var _tempNum_ float64; if _tempNum_, _ok_ = _buf["initLv"].(float64); !_ok_ { err = errors.New("initLv error"); return }; _v.InitLv = int32(_tempNum_) }
{ var _ok_ bool; var _tempNum_ float64; if _tempNum_, _ok_ = _buf["score"].(float64); !_ok_ { err = errors.New("score error"); return }; _v.Score = int32(_tempNum_) }
return
}

View File

@ -18,6 +18,7 @@ type GameEquipData struct {
Suittype int32
Suitintr string
Pos int32
InitLv int32
Color int32
Effects string
Leadlibrary int32
@ -45,6 +46,7 @@ func (_v *GameEquipData)Deserialize(_buf map[string]interface{}) (err error) {
{ var _ok_ bool; var _tempNum_ float64; if _tempNum_, _ok_ = _buf["suittype"].(float64); !_ok_ { err = errors.New("suittype error"); return }; _v.Suittype = int32(_tempNum_) }
{var _ok_ bool; var __json_text__ map[string]interface{}; if __json_text__, _ok_ = _buf["suitintr"].(map[string]interface{}) ; !_ok_ { err = errors.New("_v.Suitintr error"); return }; { var _ok_ bool; if _, _ok_ = __json_text__["key"].(string); !_ok_ { err = errors.New("key error"); return } }; { var _ok_ bool; if _v.Suitintr, _ok_ = __json_text__["text"].(string); !_ok_ { err = errors.New("text error"); return } } }
{ var _ok_ bool; var _tempNum_ float64; if _tempNum_, _ok_ = _buf["pos"].(float64); !_ok_ { err = errors.New("pos error"); return }; _v.Pos = int32(_tempNum_) }
{ var _ok_ bool; var _tempNum_ float64; if _tempNum_, _ok_ = _buf["initLv"].(float64); !_ok_ { err = errors.New("initLv error"); return }; _v.InitLv = int32(_tempNum_) }
{ var _ok_ bool; var _tempNum_ float64; if _tempNum_, _ok_ = _buf["color"].(float64); !_ok_ { err = errors.New("color error"); return }; _v.Color = int32(_tempNum_) }
{ var _ok_ bool; if _v.Effects, _ok_ = _buf["Effects"].(string); !_ok_ { err = errors.New("Effects error"); return } }
{ var _ok_ bool; var _tempNum_ float64; if _tempNum_, _ok_ = _buf["leadlibrary"].(float64); !_ok_ { err = errors.New("leadlibrary error"); return }; _v.Leadlibrary = int32(_tempNum_) }