接口优化

This commit is contained in:
meixiongfeng 2024-01-03 16:41:48 +08:00
parent b62451fc35
commit 829b402ada
11 changed files with 95 additions and 106 deletions

View File

@ -12,7 +12,7 @@
}, },
"task_buried": 16000001, "task_buried": 16000001,
"task_icon": "cj_icon_lb_ty03", "task_icon": "cj_icon_lb_ty03",
"task_quality": 1, "task_quality": 0,
"task_reward": [ "task_reward": [
{ {
"a": "attr", "a": "attr",
@ -35,7 +35,7 @@
}, },
"task_buried": 16000002, "task_buried": 16000002,
"task_icon": "cj_icon_lb_ty02", "task_icon": "cj_icon_lb_ty02",
"task_quality": 2, "task_quality": 1,
"task_reward": [ "task_reward": [
{ {
"a": "attr", "a": "attr",
@ -58,7 +58,7 @@
}, },
"task_buried": 16000003, "task_buried": 16000003,
"task_icon": "cj_icon_lb_ty01", "task_icon": "cj_icon_lb_ty01",
"task_quality": 3, "task_quality": 2,
"task_reward": [ "task_reward": [
{ {
"a": "attr", "a": "attr",
@ -81,7 +81,7 @@
}, },
"task_buried": 16000004, "task_buried": 16000004,
"task_icon": "cj_icon_lb_ty03", "task_icon": "cj_icon_lb_ty03",
"task_quality": 1, "task_quality": 0,
"task_reward": [ "task_reward": [
{ {
"a": "attr", "a": "attr",
@ -104,7 +104,7 @@
}, },
"task_buried": 16000005, "task_buried": 16000005,
"task_icon": "cj_icon_lb_ty02", "task_icon": "cj_icon_lb_ty02",
"task_quality": 2, "task_quality": 1,
"task_reward": [ "task_reward": [
{ {
"a": "attr", "a": "attr",
@ -127,7 +127,7 @@
}, },
"task_buried": 16000006, "task_buried": 16000006,
"task_icon": "cj_icon_lb_ty01", "task_icon": "cj_icon_lb_ty01",
"task_quality": 3, "task_quality": 2,
"task_reward": [ "task_reward": [
{ {
"a": "attr", "a": "attr",
@ -150,7 +150,7 @@
}, },
"task_buried": 16000007, "task_buried": 16000007,
"task_icon": "cj_icon_lb_ty03", "task_icon": "cj_icon_lb_ty03",
"task_quality": 1, "task_quality": 0,
"task_reward": [ "task_reward": [
{ {
"a": "attr", "a": "attr",
@ -173,7 +173,7 @@
}, },
"task_buried": 16000008, "task_buried": 16000008,
"task_icon": "cj_icon_lb_ty02", "task_icon": "cj_icon_lb_ty02",
"task_quality": 2, "task_quality": 1,
"task_reward": [ "task_reward": [
{ {
"a": "attr", "a": "attr",
@ -196,7 +196,7 @@
}, },
"task_buried": 16000009, "task_buried": 16000009,
"task_icon": "cj_icon_lb_ty01", "task_icon": "cj_icon_lb_ty01",
"task_quality": 3, "task_quality": 2,
"task_reward": [ "task_reward": [
{ {
"a": "attr", "a": "attr",
@ -219,7 +219,7 @@
}, },
"task_buried": 16000010, "task_buried": 16000010,
"task_icon": "cj_icon_lb_ty03", "task_icon": "cj_icon_lb_ty03",
"task_quality": 1, "task_quality": 0,
"task_reward": [ "task_reward": [
{ {
"a": "attr", "a": "attr",
@ -242,7 +242,7 @@
}, },
"task_buried": 16000011, "task_buried": 16000011,
"task_icon": "cj_icon_lb_ty02", "task_icon": "cj_icon_lb_ty02",
"task_quality": 2, "task_quality": 1,
"task_reward": [ "task_reward": [
{ {
"a": "attr", "a": "attr",
@ -265,7 +265,7 @@
}, },
"task_buried": 16000012, "task_buried": 16000012,
"task_icon": "cj_icon_lb_ty01", "task_icon": "cj_icon_lb_ty01",
"task_quality": 3, "task_quality": 2,
"task_reward": [ "task_reward": [
{ {
"a": "attr", "a": "attr",
@ -288,7 +288,7 @@
}, },
"task_buried": 16000013, "task_buried": 16000013,
"task_icon": "cj_icon_lb_ty03", "task_icon": "cj_icon_lb_ty03",
"task_quality": 1, "task_quality": 0,
"task_reward": [ "task_reward": [
{ {
"a": "attr", "a": "attr",
@ -311,7 +311,7 @@
}, },
"task_buried": 16000014, "task_buried": 16000014,
"task_icon": "cj_icon_lb_ty02", "task_icon": "cj_icon_lb_ty02",
"task_quality": 2, "task_quality": 1,
"task_reward": [ "task_reward": [
{ {
"a": "attr", "a": "attr",
@ -334,7 +334,7 @@
}, },
"task_buried": 16000015, "task_buried": 16000015,
"task_icon": "cj_icon_lb_ty01", "task_icon": "cj_icon_lb_ty01",
"task_quality": 3, "task_quality": 2,
"task_reward": [ "task_reward": [
{ {
"a": "attr", "a": "attr",
@ -357,7 +357,7 @@
}, },
"task_buried": 16000016, "task_buried": 16000016,
"task_icon": "cj_icon_lb_ty03", "task_icon": "cj_icon_lb_ty03",
"task_quality": 1, "task_quality": 0,
"task_reward": [ "task_reward": [
{ {
"a": "attr", "a": "attr",
@ -380,7 +380,7 @@
}, },
"task_buried": 16000017, "task_buried": 16000017,
"task_icon": "cj_icon_lb_ty02", "task_icon": "cj_icon_lb_ty02",
"task_quality": 2, "task_quality": 1,
"task_reward": [ "task_reward": [
{ {
"a": "attr", "a": "attr",
@ -403,7 +403,7 @@
}, },
"task_buried": 16000018, "task_buried": 16000018,
"task_icon": "cj_icon_lb_ty01", "task_icon": "cj_icon_lb_ty01",
"task_quality": 3, "task_quality": 2,
"task_reward": [ "task_reward": [
{ {
"a": "attr", "a": "attr",

View File

@ -1,7 +1,7 @@
[ [
{ {
"id": 1, "id": 1,
"open_cond": 1, "open_cond": 0,
"open_value": 6, "open_value": 6,
"afterid": 0, "afterid": 0,
"BattleReadyID": 110, "BattleReadyID": 110,
@ -37,7 +37,7 @@
}, },
{ {
"id": 2, "id": 2,
"open_cond": 1, "open_cond": 0,
"open_value": 8, "open_value": 8,
"afterid": 1, "afterid": 1,
"BattleReadyID": 110, "BattleReadyID": 110,
@ -73,7 +73,7 @@
}, },
{ {
"id": 3, "id": 3,
"open_cond": 1, "open_cond": 0,
"open_value": 10, "open_value": 10,
"afterid": 2, "afterid": 2,
"BattleReadyID": 110, "BattleReadyID": 110,
@ -109,7 +109,7 @@
}, },
{ {
"id": 4, "id": 4,
"open_cond": 1, "open_cond": 0,
"open_value": 12, "open_value": 12,
"afterid": 3, "afterid": 3,
"BattleReadyID": 110, "BattleReadyID": 110,
@ -145,7 +145,7 @@
}, },
{ {
"id": 5, "id": 5,
"open_cond": 1, "open_cond": 0,
"open_value": 14, "open_value": 14,
"afterid": 4, "afterid": 4,
"BattleReadyID": 110, "BattleReadyID": 110,
@ -181,7 +181,7 @@
}, },
{ {
"id": 6, "id": 6,
"open_cond": 1, "open_cond": 0,
"open_value": 16, "open_value": 16,
"afterid": 5, "afterid": 5,
"BattleReadyID": 110, "BattleReadyID": 110,
@ -217,7 +217,7 @@
}, },
{ {
"id": 7, "id": 7,
"open_cond": 1, "open_cond": 0,
"open_value": 18, "open_value": 18,
"afterid": 6, "afterid": 6,
"BattleReadyID": 110, "BattleReadyID": 110,
@ -253,7 +253,7 @@
}, },
{ {
"id": 8, "id": 8,
"open_cond": 1, "open_cond": 0,
"open_value": 20, "open_value": 20,
"afterid": 7, "afterid": 7,
"BattleReadyID": 110, "BattleReadyID": 110,
@ -289,7 +289,7 @@
}, },
{ {
"id": 9, "id": 9,
"open_cond": 1, "open_cond": 0,
"open_value": 22, "open_value": 22,
"afterid": 8, "afterid": 8,
"BattleReadyID": 110, "BattleReadyID": 110,
@ -325,7 +325,7 @@
}, },
{ {
"id": 10, "id": 10,
"open_cond": 1, "open_cond": 0,
"open_value": 24, "open_value": 24,
"afterid": 9, "afterid": 9,
"BattleReadyID": 110, "BattleReadyID": 110,
@ -361,7 +361,7 @@
}, },
{ {
"id": 11, "id": 11,
"open_cond": 1, "open_cond": 0,
"open_value": 27, "open_value": 27,
"afterid": 10, "afterid": 10,
"BattleReadyID": 110, "BattleReadyID": 110,
@ -397,7 +397,7 @@
}, },
{ {
"id": 12, "id": 12,
"open_cond": 1, "open_cond": 0,
"open_value": 30, "open_value": 30,
"afterid": 11, "afterid": 11,
"BattleReadyID": 110, "BattleReadyID": 110,

View File

@ -2,7 +2,7 @@
{ {
"id": 1, "id": 1,
"ExaminationGroup": 1001, "ExaminationGroup": 1001,
"type": 1, "type": 0,
"topic": { "topic": {
"key": "ask_ask_library_topic_01", "key": "ask_ask_library_topic_01",
"text": "菲奥娜父亲的真实身份是?" "text": "菲奥娜父亲的真实身份是?"
@ -33,7 +33,7 @@
{ {
"id": 2, "id": 2,
"ExaminationGroup": 1001, "ExaminationGroup": 1001,
"type": 1, "type": 0,
"topic": { "topic": {
"key": "ask_ask_library_topic_02", "key": "ask_ask_library_topic_02",
"text": "诺斯是我们“守护联盟”的创始人之一,也是一位尊贵的守护神。那请问他成神之前是干什么的呢?" "text": "诺斯是我们“守护联盟”的创始人之一,也是一位尊贵的守护神。那请问他成神之前是干什么的呢?"
@ -64,7 +64,7 @@
{ {
"id": 3, "id": 3,
"ExaminationGroup": 1001, "ExaminationGroup": 1001,
"type": 1, "type": 0,
"topic": { "topic": {
"key": "ask_ask_library_topic_03", "key": "ask_ask_library_topic_03",
"text": "匹诺曹的良心是什么?" "text": "匹诺曹的良心是什么?"
@ -95,7 +95,7 @@
{ {
"id": 4, "id": 4,
"ExaminationGroup": 1002, "ExaminationGroup": 1002,
"type": 1, "type": 0,
"topic": { "topic": {
"key": "ask_ask_library_topic_04", "key": "ask_ask_library_topic_04",
"text": "阿宝的亲生父亲是谁?" "text": "阿宝的亲生父亲是谁?"
@ -126,7 +126,7 @@
{ {
"id": 5, "id": 5,
"ExaminationGroup": 1002, "ExaminationGroup": 1002,
"type": 1, "type": 0,
"topic": { "topic": {
"key": "ask_ask_library_topic_05", "key": "ask_ask_library_topic_05",
"text": "希卡普的黑龙,和那条白龙,生的龙是什么品种?" "text": "希卡普的黑龙,和那条白龙,生的龙是什么品种?"
@ -157,7 +157,7 @@
{ {
"id": 6, "id": 6,
"ExaminationGroup": 1002, "ExaminationGroup": 1002,
"type": 1, "type": 0,
"topic": { "topic": {
"key": "ask_ask_library_topic_06", "key": "ask_ask_library_topic_06",
"text": "马达加斯加企鹅团最喜欢吃什么?" "text": "马达加斯加企鹅团最喜欢吃什么?"
@ -188,7 +188,7 @@
{ {
"id": 7, "id": 7,
"ExaminationGroup": 1003, "ExaminationGroup": 1003,
"type": 1, "type": 0,
"topic": { "topic": {
"key": "ask_ask_library_topic_07", "key": "ask_ask_library_topic_07",
"text": "博肯族女仆布里奇特告别王子逃走时,留在台阶上的鞋子是什么?" "text": "博肯族女仆布里奇特告别王子逃走时,留在台阶上的鞋子是什么?"
@ -219,7 +219,7 @@
{ {
"id": 8, "id": 8,
"ExaminationGroup": 1003, "ExaminationGroup": 1003,
"type": 1, "type": 0,
"topic": { "topic": {
"key": "ask_ask_library_topic_08", "key": "ask_ask_library_topic_08",
"text": "史莱克向菲欧娜求婚时送她的戒指里刻着什么字?" "text": "史莱克向菲欧娜求婚时送她的戒指里刻着什么字?"
@ -250,7 +250,7 @@
{ {
"id": 9, "id": 9,
"ExaminationGroup": 1003, "ExaminationGroup": 1003,
"type": 1, "type": 0,
"topic": { "topic": {
"key": "ask_ask_library_topic_09", "key": "ask_ask_library_topic_09",
"text": "穿靴猫有一次冒险死于炮弹爆炸,那次冒险中他本来想偷什么?" "text": "穿靴猫有一次冒险死于炮弹爆炸,那次冒险中他本来想偷什么?"
@ -281,7 +281,7 @@
{ {
"id": 10, "id": 10,
"ExaminationGroup": 1004, "ExaminationGroup": 1004,
"type": 1, "type": 0,
"topic": { "topic": {
"key": "ask_ask_library_topic_10", "key": "ask_ask_library_topic_10",
"text": "巴布女王的老爹,做的手势叫什么名字?" "text": "巴布女王的老爹,做的手势叫什么名字?"
@ -312,7 +312,7 @@
{ {
"id": 11, "id": 11,
"ExaminationGroup": 1004, "ExaminationGroup": 1004,
"type": 1, "type": 0,
"topic": { "topic": {
"key": "ask_ask_library_topic_11", "key": "ask_ask_library_topic_11",
"text": "瓜哥发明的腰带是用什么做的?" "text": "瓜哥发明的腰带是用什么做的?"
@ -343,7 +343,7 @@
{ {
"id": 12, "id": 12,
"ExaminationGroup": 1004, "ExaminationGroup": 1004,
"type": 1, "type": 0,
"topic": { "topic": {
"key": "ask_ask_library_topic_12", "key": "ask_ask_library_topic_12",
"text": "悍娇虎最喜欢什么口味的食物?" "text": "悍娇虎最喜欢什么口味的食物?"
@ -374,7 +374,7 @@
{ {
"id": 13, "id": 13,
"ExaminationGroup": 1005, "ExaminationGroup": 1005,
"type": 1, "type": 0,
"topic": { "topic": {
"key": "ask_ask_library_topic_13", "key": "ask_ask_library_topic_13",
"text": "亲衣节时,戈伯的汤加进了什么意外的调料?" "text": "亲衣节时,戈伯的汤加进了什么意外的调料?"
@ -405,7 +405,7 @@
{ {
"id": 14, "id": 14,
"ExaminationGroup": 1005, "ExaminationGroup": 1005,
"type": 1, "type": 0,
"topic": { "topic": {
"key": "ask_ask_library_topic_14", "key": "ask_ask_library_topic_14",
"text": "雷霆狂花出阵时,众人涂在脸上的颜料是什么来源?" "text": "雷霆狂花出阵时,众人涂在脸上的颜料是什么来源?"
@ -436,7 +436,7 @@
{ {
"id": 15, "id": 15,
"ExaminationGroup": 1005, "ExaminationGroup": 1005,
"type": 1, "type": 0,
"topic": { "topic": {
"key": "ask_ask_library_topic_15", "key": "ask_ask_library_topic_15",
"text": "骇客蛛的黑客知识在哪个网站上学的?" "text": "骇客蛛的黑客知识在哪个网站上学的?"
@ -467,7 +467,7 @@
{ {
"id": 16, "id": 16,
"ExaminationGroup": 1006, "ExaminationGroup": 1006,
"type": 1, "type": 0,
"topic": { "topic": {
"key": "ask_ask_library_topic_16", "key": "ask_ask_library_topic_16",
"text": "希卡普的老妈瓦尔卡做的丸子,被戈伯评价像什么一样?" "text": "希卡普的老妈瓦尔卡做的丸子,被戈伯评价像什么一样?"
@ -498,7 +498,7 @@
{ {
"id": 17, "id": 17,
"ExaminationGroup": 1006, "ExaminationGroup": 1006,
"type": 1, "type": 0,
"topic": { "topic": {
"key": "ask_ask_library_topic_17", "key": "ask_ask_library_topic_17",
"text": "什么植物能让龙轻轻一闻,就欲仙欲死,欲罢不能?" "text": "什么植物能让龙轻轻一闻,就欲仙欲死,欲罢不能?"
@ -529,7 +529,7 @@
{ {
"id": 18, "id": 18,
"ExaminationGroup": 1006, "ExaminationGroup": 1006,
"type": 1, "type": 0,
"topic": { "topic": {
"key": "ask_ask_library_topic_18", "key": "ask_ask_library_topic_18",
"text": "以下哪个不是冰霜杰克的特征?" "text": "以下哪个不是冰霜杰克的特征?"
@ -560,7 +560,7 @@
{ {
"id": 19, "id": 19,
"ExaminationGroup": 1007, "ExaminationGroup": 1007,
"type": 1, "type": 0,
"topic": { "topic": {
"key": "ask_ask_library_topic_19", "key": "ask_ask_library_topic_19",
"text": "哪种龙的蛋孵化时会发生强烈的爆炸?" "text": "哪种龙的蛋孵化时会发生强烈的爆炸?"
@ -591,7 +591,7 @@
{ {
"id": 20, "id": 20,
"ExaminationGroup": 1007, "ExaminationGroup": 1007,
"type": 1, "type": 0,
"topic": { "topic": {
"key": "ask_ask_library_topic_20", "key": "ask_ask_library_topic_20",
"text": "阿宝的乳名是什么?" "text": "阿宝的乳名是什么?"
@ -622,7 +622,7 @@
{ {
"id": 21, "id": 21,
"ExaminationGroup": 1007, "ExaminationGroup": 1007,
"type": 1, "type": 0,
"topic": { "topic": {
"key": "ask_ask_library_topic_21", "key": "ask_ask_library_topic_21",
"text": "马达加斯加企鹅团的军师叫什么?" "text": "马达加斯加企鹅团的军师叫什么?"

View File

@ -11979,7 +11979,7 @@
"n": 1 "n": 1
}, },
"Npc_event_type": 0, "Npc_event_type": 0,
"NPC": -160, "NPC": -166,
"tipstxt": { "tipstxt": {
"key": "", "key": "",
"text": "" "text": ""
@ -12006,7 +12006,7 @@
"n": 1 "n": 1
}, },
"Npc_event_type": 0, "Npc_event_type": 0,
"NPC": -160, "NPC": -166,
"tipstxt": { "tipstxt": {
"key": "", "key": "",
"text": "" "text": ""
@ -12259,7 +12259,7 @@
"n": 1 "n": 1
}, },
"Npc_event_type": 0, "Npc_event_type": 0,
"NPC": -160, "NPC": -166,
"tipstxt": { "tipstxt": {
"key": "", "key": "",
"text": "" "text": ""
@ -12286,7 +12286,7 @@
"n": 1 "n": 1
}, },
"Npc_event_type": 0, "Npc_event_type": 0,
"NPC": -160, "NPC": -166,
"tipstxt": { "tipstxt": {
"key": "", "key": "",
"text": "" "text": ""
@ -12313,7 +12313,7 @@
"n": 1 "n": 1
}, },
"Npc_event_type": 0, "Npc_event_type": 0,
"NPC": -160, "NPC": -166,
"tipstxt": { "tipstxt": {
"key": "", "key": "",
"text": "" "text": ""
@ -12340,7 +12340,7 @@
"n": 1 "n": 1
}, },
"Npc_event_type": 0, "Npc_event_type": 0,
"NPC": -160, "NPC": -166,
"tipstxt": { "tipstxt": {
"key": "", "key": "",
"text": "" "text": ""
@ -12367,7 +12367,7 @@
"n": 1 "n": 1
}, },
"Npc_event_type": 0, "Npc_event_type": 0,
"NPC": -160, "NPC": -166,
"tipstxt": { "tipstxt": {
"key": "", "key": "",
"text": "" "text": ""

View File

@ -412,7 +412,7 @@
"text": "巅峰商店" "text": "巅峰商店"
}, },
"upper_shop": { "upper_shop": {
"key": "shop_shop_upper_shop_15", "key": "",
"text": "" "text": ""
}, },
"opencond": "shop15", "opencond": "shop15",

View File

@ -112,7 +112,7 @@ type (
CleanData(uid string) CleanData(uid string)
// 英雄加经验 // 英雄加经验
AddHerosExp(session IUserSession, heroObjs []string, exp int32) (curAddExp []int32, errdata *pb.ErrorData) AddHerosExp(session IUserSession, heroObjs []string, exp int32) (curAddExp map[string]int32, errdata *pb.ErrorData)
// 英雄练功 // 英雄练功
KungFuHero(session IUserSession, heroObjID string, bKongfu bool, kongfuUid string) (errdata *pb.ErrorData) KungFuHero(session IUserSession, heroObjID string, bKongfu bool, kongfuUid string) (errdata *pb.ErrorData)

View File

@ -398,14 +398,14 @@ func (this *ModelHero) cleanData(uid string) {
} }
} }
func (this *ModelHero) AddCardExp(session comm.IUserSession, heros []*pb.DBHero, exp int32, model *db.DBModel) (curAddExp []int32, errdata *pb.ErrorData) { func (this *ModelHero) AddCardExp(session comm.IUserSession, heros []*pb.DBHero, exp int32, model *db.DBModel) (curAddExp map[string]int32, errdata *pb.ErrorData) {
var ( var (
tasks []*pb.BuriedParam tasks []*pb.BuriedParam
changeupdate map[string]interface{} = make(map[string]interface{}) changeupdate map[string]interface{} = make(map[string]interface{})
maxlvhero *pb.DBHero maxlvhero *pb.DBHero
) )
curAddExp = make([]int32, len(heros)) curAddExp = make(map[string]int32, len(heros))
for i, hero := range heros { for _, hero := range heros {
var ( var (
preLv int32 //加经验之前的等级 preLv int32 //加经验之前的等级
curExp int32 // 加经验之后的经验 curExp int32 // 加经验之后的经验
@ -446,21 +446,23 @@ func (this *ModelHero) AddCardExp(session comm.IUserSession, heros []*pb.DBHero,
var maxExp int32 var maxExp int32
maxExp = _data.Heroexp maxExp = _data.Heroexp
if maxLv <= curLv && curExp >= maxExp { // 加经验之前校验是否达到最大等级 if maxLv <= curLv && curExp >= maxExp { // 加经验之前校验是否达到最大等级
curAddExp[i] = 0 // 已经满级的时候 curAddExp[hero.Id] = 0
//code = pb.ErrorCode_HeroMaxLv //
this.module.Debugf("英雄已经满级 不需要升级heroid:%s,addexp:%d", hero.Id, exp) this.module.Debugf("英雄已经满级 不需要升级heroid:%s,addexp:%d", hero.Id, exp)
return return
} }
curExp += exp // 先把经验加上 var fullexp int32 // 溢出的经验
for { // 死循环判断一键升级 curExp += exp // 先把经验加上
for { // 死循环判断一键升级
if _data.Heroexp == 0 { if _data.Heroexp == 0 {
curAddExp[i] = exp - (curExp - maxExp) // 减去超过部分的经验 fullexp = (curExp - maxExp)
//curAddExp[hero.Id] = exp - (curExp - maxExp) // 减去超过部分的经验
curExp = 0 curExp = 0
break break
} }
maxExp = _data.Heroexp maxExp = _data.Heroexp
if maxLv <= curLv && curExp >= maxExp { // 设置最大经验和等级 if maxLv <= curLv && curExp >= maxExp { // 设置最大经验和等级
curAddExp[i] = exp - (curExp - maxExp) // 减去超过部分的经验 fullexp = (curExp - maxExp)
//curAddExp[hero.Id] = exp - (curExp - maxExp) // 减去超过部分的经验
curLv = maxLv curLv = maxLv
curExp = maxExp curExp = maxExp
break break
@ -472,14 +474,17 @@ func (this *ModelHero) AddCardExp(session comm.IUserSession, heros []*pb.DBHero,
curLv += 1 // 经验够了 那么等级+1 curLv += 1 // 经验够了 那么等级+1
_data = this.module.configure.GetHeroLv(curLv) _data = this.module.configure.GetHeroLv(curLv)
if _data == nil { // 等级加失败了 回到原来的等级 if _data == nil { // 等级加失败了 回到原来的等级
fullexp = (curExp - maxExp)
curLv -= 1 curLv -= 1
break break
} }
} }
} }
if curAddExp[i] != 0 { if curAddExp[hero.Id] == 0 {
curAddExp[i] = exp // 真正加的经验 curAddExp[hero.Id] = exp // 真正加的经验
} else {
curAddExp[hero.Id] = (exp - fullexp)
} }
this.module.Debugf("add hero exp :old lv:%d,old exp:%d,new lv:%d,new exp:%d,addexp:%d", hero.Lv, hero.Exp, curLv, curExp, exp) this.module.Debugf("add hero exp :old lv:%d,old exp:%d,new lv:%d,new exp:%d,addexp:%d", hero.Lv, hero.Exp, curLv, curExp, exp)

View File

@ -835,15 +835,14 @@ func (this *Hero) CheckPeachReward(session comm.IUserSession, ctime int64) {
return return
} }
func (this *Hero) AddHerosExp(session comm.IUserSession, heroObjs []string, exp int32) (curAddExp []int32, errdata *pb.ErrorData) { func (this *Hero) AddHerosExp(session comm.IUserSession, heroObjs []string, exp int32) (curAddExp map[string]int32, errdata *pb.ErrorData) {
var ( var (
ids []string = make([]string, 0) ids []string = make([]string, 0)
heros []*pb.DBHero heros []*pb.DBHero
changeHero []*pb.DBHero // 变化的英雄 changeHero []*pb.DBHero // 变化的英雄
addExp []int32
err error err error
) )
curAddExp = make([]int32, len(heroObjs)) curAddExp = make(map[string]int32, len(heroObjs))
for _, v := range heroObjs { for _, v := range heroObjs {
if v != "" { if v != "" {
ids = append(ids, v) ids = append(ids, v)
@ -860,16 +859,10 @@ func (this *Hero) AddHerosExp(session comm.IUserSession, heroObjs []string, exp
} }
return return
} }
if addExp, errdata = this.modelHero.AddCardExp(session, heros, exp, model); errdata != nil { if curAddExp, errdata = this.modelHero.AddCardExp(session, heros, exp, model); errdata != nil {
return return
} }
for i, v := range heros {
for n, id := range heroObjs {
if v.Id == id {
curAddExp[n] = addExp[i]
}
}
}
changeHero = append(changeHero, heros...) changeHero = append(changeHero, heros...)
} }
} else { } else {
@ -881,16 +874,9 @@ func (this *Hero) AddHerosExp(session comm.IUserSession, heroObjs []string, exp
return return
} }
if addExp, errdata = this.modelHero.AddCardExp(session, heros, exp, nil); errdata != nil { if curAddExp, errdata = this.modelHero.AddCardExp(session, heros, exp, nil); errdata != nil {
return return
} }
for i, v := range heros {
for n, id := range heroObjs {
if v.Id == id {
curAddExp[n] = addExp[i]
}
}
}
changeHero = append(changeHero, heros...) changeHero = append(changeHero, heros...)
} }
if len(changeHero) > 0 { if len(changeHero) > 0 {

View File

@ -165,11 +165,12 @@ func (this *apiComp) ChallengeOver(session comm.IUserSession, req *pb.HuntingCha
for _, v := range req.Report.Info.Redflist[0].Team { for _, v := range req.Report.Info.Redflist[0].Team {
if v.Oid != "" && !v.Ishelp { // 助战英雄不加经验 if v.Oid != "" && !v.Ishelp { // 助战英雄不加经验
heroObjs = append(heroObjs, v.Oid) heroObjs = append(heroObjs, v.Oid)
changExp[v.Oid] = cfgHunting.Heroexp
} }
} }
} }
this.module.ModuleHero.AddHerosExp(session, heroObjs, cfgHunting.Heroexp) if changExp, errdata = this.module.ModuleHero.AddHerosExp(session, heroObjs, cfgHunting.Heroexp); errdata != nil {
return
}
} }
errdata = this.module.ModifyHuntingData(session.GetUserId(), mapData) errdata = this.module.ModifyHuntingData(session.GetUserId(), mapData)

View File

@ -21,14 +21,13 @@ func (this *apiComp) ChallengeOverCheck(session comm.IUserSession, req *pb.Integ
///挑战主线关卡 ///挑战主线关卡
func (this *apiComp) ChallengeOver(session comm.IUserSession, req *pb.IntegralChallengeOverReq) (errdata *pb.ErrorData) { func (this *apiComp) ChallengeOver(session comm.IUserSession, req *pb.IntegralChallengeOverReq) (errdata *pb.ErrorData) {
var ( var (
update map[string]interface{} update map[string]interface{}
res []*cfg.Gameatn res []*cfg.Gameatn
first bool // 是否是首通 first bool // 是否是首通
line []*pb.LineUp // 阵容数据 line []*pb.LineUp // 阵容数据
harm int32 harm int32
changExp map[string]int32 changExp map[string]int32
atno []*pb.UserAtno // atno 类型 atno []*pb.UserAtno // atno 类型
curAddExp []int32
) )
changExp = make(map[string]int32) changExp = make(map[string]int32)
harm = req.Report.Harm harm = req.Report.Harm
@ -139,17 +138,13 @@ func (this *apiComp) ChallengeOver(session comm.IUserSession, req *pb.IntegralCh
if v.HeroID != "" { if v.HeroID != "" {
if !v.Ishelp { // 助战英雄不加经验 if !v.Ishelp { // 助战英雄不加经验
heroObjs = append(heroObjs, v.Oid) heroObjs = append(heroObjs, v.Oid)
changExp[v.Oid] = 0
} }
} }
} }
} }
if curAddExp, errdata = this.module.ModuleHero.AddHerosExp(session, heroObjs, cfgData.Heroexp); errdata != nil { if changExp, errdata = this.module.ModuleHero.AddHerosExp(session, heroObjs, cfgData.Heroexp); errdata != nil {
return return
} }
for pos, v := range heroObjs {
changExp[v] = curAddExp[pos]
}
} }
err = this.module.modelIntegral.modifyIntegralData(session.GetUserId(), update) err = this.module.modelIntegral.modifyIntegralData(session.GetUserId(), update)

View File

@ -214,7 +214,9 @@ func (this *apiComp) ChallengeOver(session comm.IUserSession, req *pb.VikingChal
} }
} }
} }
this.module.ModuleHero.AddHerosExp(session, heroObjs, vikingCfg.Heroexp) if changExp, errdata = this.module.ModuleHero.AddHerosExp(session, heroObjs, vikingCfg.Heroexp); errdata != nil {
return
}
} }
session.SendMsg(string(this.module.GetType()), VikingChallengeOverResp, &pb.VikingChallengeOverResp{ session.SendMsg(string(this.module.GetType()), VikingChallengeOverResp, &pb.VikingChallengeOverResp{