Skip to content
Open
Show file tree
Hide file tree
Changes from 8 commits
Commits
Show all changes
37 commits
Select commit Hold shift + click to select a range
7890325
削弱boss, 调低仙途奇缘灵石上限
PackageInstaller Apr 18, 2025
68ad081
群拍卖会指令帮助信息修正
PackageInstaller Apr 18, 2025
34c9c0d
修复传承抽卡不加次数问题。。
PackageInstaller Apr 19, 2025
9a130dc
加了个关闭秘境的指令
PackageInstaller Apr 24, 2025
6443f44
初步适配postgresql
PackageInstaller Apr 25, 2025
0f470f2
升级版本号先
PackageInstaller Apr 25, 2025
e0d1b58
修复bug
PackageInstaller Apr 25, 2025
b9a3b4a
更改条件表达式
PackageInstaller Apr 25, 2025
b868c32
优化传承抽卡部分
PackageInstaller Apr 25, 2025
54308ca
小修改
PackageInstaller Apr 25, 2025
e92a95a
切磋适配道号,以及战斗数值添加中文单位
PackageInstaller Apr 25, 2025
307837c
加入修仙名字随机生成
PackageInstaller Apr 25, 2025
8b7b1f9
添加新的丹药配方网址
PackageInstaller Apr 25, 2025
c2a2544
小修改
PackageInstaller Apr 25, 2025
2c651af
官方机器人默认开启修仙模组
PackageInstaller Apr 25, 2025
d3323b2
一些小优化
PackageInstaller Apr 25, 2025
0980863
重新弄了下修仙名词随机生成器
PackageInstaller Apr 26, 2025
a04abf8
把名词随机放data去了
PackageInstaller Apr 26, 2025
075dd0e
Update README.md
PackageInstaller Apr 26, 2025
06779a8
Update README.md
PackageInstaller Apr 26, 2025
8254857
更新example
PackageInstaller Apr 26, 2025
b79d4a0
更新了一下下
PackageInstaller Apr 26, 2025
33c2aac
名称改了一下
PackageInstaller Apr 26, 2025
106ab85
update README
PackageInstaller Apr 26, 2025
7f81a60
小更新
PackageInstaller Apr 26, 2025
bb2fd8e
一些优化
PackageInstaller Apr 27, 2025
b731f95
bug修复
PackageInstaller Apr 27, 2025
837b33a
数据库表结构调整
PackageInstaller Apr 27, 2025
cc1397e
一些小小的修改(确信
PackageInstaller May 2, 2025
4500307
加了点数据库优化的玩意
PackageInstaller May 2, 2025
9c9a3d3
修复bug
PackageInstaller May 2, 2025
ef446e7
bug修复
PackageInstaller May 3, 2025
ec6c2df
修复突破cdbug
PackageInstaller May 4, 2025
ea19864
修复bug
PackageInstaller May 4, 2025
24a730b
嗯,修复了一些格式上的问题
PackageInstaller May 4, 2025
cd7e22b
宗门部分适配pg
PackageInstaller May 11, 2025
91e48c8
修复bug
PackageInstaller May 11, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion data/xiuxian/xiuxian_version.txt
Original file line number Diff line number Diff line change
@@ -1 +1 @@
xiuxian_2.2
xiuxian_2.3
12 changes: 6 additions & 6 deletions data/xiuxian/礼包/礼包.json
Original file line number Diff line number Diff line change
Expand Up @@ -19,20 +19,20 @@
"name": "新手大礼包",
"type": "礼包",
"buff_1": 9937,
"type_1": "功法",
"type_1": "技能",
"name_1": "一气化三清",
"amount_1": 1,
"buff_2": 8932,
"type_2": "神通",
"type_2": "技能",
"name_2": "星宿劫",
"amount_2": 1,
"buff_3": 15408,
"type_3": "辅修功法",
"type_3": "技能",
"name_3": "斗战诀",
"amount_3": 1,
"buff_4": 7085,
"type_4": "法器",
"name_4": "冲天槊",
"buff_4": 15466,
"type_4": "装备",
"name_4": "少姜",
"amount_4": 1,
"buff_5": 15050,
"type_5": "礼包",
Expand Down
8 changes: 4 additions & 4 deletions data/xiuxian/装备/法器.json
Original file line number Diff line number Diff line change
Expand Up @@ -863,12 +863,12 @@
},
"15466": {
"name": "少姜",
"atk_buff": 1,
"crit_buff": 1,
"atk_buff": 10,
"crit_buff": 10,
"def_buff": 1,
"critatk": 1,
"critatk": 10,
"zw": 0,
"mp_buff": 1,
"mp_buff": 10,
"rank": -5,
"level": "无上仙器",
"type": "装备",
Expand Down
741 changes: 190 additions & 551 deletions nonebot_plugin_xiuxian_2/xiuxian/xiuxian_back/__init__.py

Large diffs are not rendered by default.

93 changes: 46 additions & 47 deletions nonebot_plugin_xiuxian_2/xiuxian/xiuxian_back/back_util.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
from ..xiuxian_utils.item_json import Items
from ..xiuxian_utils.utils import number_to
from ..xiuxian_utils.xiuxian2_handle import (
XiuxianDateManage, UserBuffDate,
XiuxianDataManage, UserBuffData,
get_weapon_info_msg, get_armor_info_msg,
get_player_info, save_player_info,
get_sec_msg, get_main_info_msg, get_sub_info_msg
Expand All @@ -16,7 +16,6 @@
from ..xiuxian_config import convert_rank

items = Items()
sql_message = XiuxianDateManage()

YAOCAIINFOMSG = {
"-1": "性寒",
Expand All @@ -30,7 +29,7 @@
}


def check_equipment_can_use(user_id, goods_id):
async def check_equipment_can_use(user_id, goods_id):
"""

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

issue (code-quality): 我们发现了如下问题:

Original comment in English

issue (code-quality): We've found these issues:

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

issue (code-quality): 我们发现了以下问题:

Original comment in English

issue (code-quality): We've found these issues:

装备数据库字段:
good_type -> '装备'
Expand All @@ -46,50 +45,50 @@ def check_equipment_can_use(user_id, goods_id):
顶用:
"""
flag = False
back_equipment = sql_message.get_item_by_good_id_and_user_id(user_id, goods_id)
back_equipment = await XiuxianDataManage().get_item_by_good_id_and_user_id(user_id, goods_id)
if back_equipment['state'] == 0:
flag = True
return flag


def get_use_equipment_sql(user_id, goods_id):
async def get_use_equipment_sql(user_id, goods_id):
"""
使用装备
返回sql,和法器或防具
"""
sql_str = []
item_info = items.get_data_by_item_id(goods_id)
user_buff_info = UserBuffDate(user_id).BuffInfo
user_buff_info = await UserBuffData(user_id).BuffInfo
now_time = datetime.now()
item_type = ''
if item_info['item_type'] == "法器":
item_type = "法器"
in_use_id = user_buff_info['faqi_buff']
sql_str.append(
f"UPDATE back set update_time='{now_time}',action_time='{now_time}',state=1 WHERE user_id={user_id} and goods_id={goods_id}") # 装备
f"UPDATE xiuxian_back set update_time='{now_time}',action_time='{now_time}',state=1 WHERE user_id={user_id} and goods_id={goods_id}") # 装备
if in_use_id != 0:
sql_str.append(
f"UPDATE back set update_time='{now_time}',action_time='{now_time}',state=0 WHERE user_id={user_id} and goods_id={in_use_id}") # 取下原有的
f"UPDATE xiuxian_back set update_time='{now_time}',action_time='{now_time}',state=0 WHERE user_id={user_id} and goods_id={in_use_id}") # 取下原有的

if item_info['item_type'] == "防具":
item_type = "防具"
in_use_id = user_buff_info['armor_buff']
sql_str.append(
f"UPDATE back set update_time='{now_time}',action_time='{now_time}',state=1 WHERE user_id={user_id} and goods_id={goods_id}") # 装备
f"UPDATE xiuxian_back set update_time='{now_time}',action_time='{now_time}',state=1 WHERE user_id={user_id} and goods_id={goods_id}") # 装备
if in_use_id != 0:
sql_str.append(
f"UPDATE back set update_time='{now_time}',action_time='{now_time}',state=0 WHERE user_id={user_id} and goods_id={in_use_id}") # 取下原有的
f"UPDATE xiuxian_back set update_time='{now_time}',action_time='{now_time}',state=0 WHERE user_id={user_id} and goods_id={in_use_id}") # 取下原有的

return sql_str, item_type


def get_no_use_equipment_sql(user_id, goods_id):
async def get_no_use_equipment_sql(user_id, goods_id):
"""
卸载装备
返回sql,和法器或防具
"""
item_info = items.get_data_by_item_id(goods_id)
user_buff_info = UserBuffDate(user_id).BuffInfo
user_buff_info = await UserBuffData(user_id).BuffInfo
now_time = datetime.now()
sql_str = []
item_type = ""
Expand All @@ -108,21 +107,21 @@ def get_no_use_equipment_sql(user_id, goods_id):
if goods_id == in_use_id or in_use_id != 0:
# 卸载当前装备
sql_str.append(
f"UPDATE back set update_time='{now_time}',action_time='{now_time}',state=0 WHERE user_id={user_id} and goods_id={goods_id}")
f"UPDATE xiuxian_back set update_time='{now_time}',action_time='{now_time}',state=0 WHERE user_id={user_id} and goods_id={goods_id}")
# 如果还有其他装备需要卸载(对于法器和防具的情况)
if in_use_id != 0 and goods_id != in_use_id:
sql_str.append(
f"UPDATE back set update_time='{now_time}',action_time='{now_time}',state=0 WHERE user_id={user_id} and goods_id={in_use_id}")
f"UPDATE xiuxian_back set update_time='{now_time}',action_time='{now_time}',state=0 WHERE user_id={user_id} and goods_id={in_use_id}")
Comment on lines 111 to +114

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

suggestion (code-quality): 将条件判断从嵌套条件中提取出来 (hoist-if-from-if)

Suggested change
# 如果还有其他装备需要卸载(对于法器和防具的情况)
if in_use_id != 0 and goods_id != in_use_id:
sql_str.append(
f"UPDATE back set update_time='{now_time}',action_time='{now_time}',state=0 WHERE user_id={user_id} and goods_id={in_use_id}")
f"UPDATE xiuxian_back set update_time='{now_time}',action_time='{now_time}',state=0 WHERE user_id={user_id} and goods_id={in_use_id}")
# 如果还有其他装备需要卸载(对于法器和防具的情况)
if in_use_id != 0 and goods_id != in_use_id:
sql_str.append(
f"UPDATE xiuxian_back set update_time='{now_time}',action_time='{now_time}',state=0 WHERE user_id={user_id} and goods_id={in_use_id}")
Original comment in English

suggestion (code-quality): Hoist conditional out of nested conditional (hoist-if-from-if)

Suggested change
# 如果还有其他装备需要卸载(对于法器和防具的情况)
if in_use_id != 0 and goods_id != in_use_id:
sql_str.append(
f"UPDATE back set update_time='{now_time}',action_time='{now_time}',state=0 WHERE user_id={user_id} and goods_id={in_use_id}")
f"UPDATE xiuxian_back set update_time='{now_time}',action_time='{now_time}',state=0 WHERE user_id={user_id} and goods_id={in_use_id}")
# 如果还有其他装备需要卸载(对于法器和防具的情况)
if in_use_id != 0 and goods_id != in_use_id:
sql_str.append(
f"UPDATE xiuxian_back set update_time='{now_time}',action_time='{now_time}',state=0 WHERE user_id={user_id} and goods_id={in_use_id}")

Comment on lines 111 to +114

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

suggestion (code-quality): 将条件判断从嵌套条件中提升出来(hoist-if-from-if

Suggested change
# 如果还有其他装备需要卸载(对于法器和防具的情况)
if in_use_id != 0 and goods_id != in_use_id:
sql_str.append(
f"UPDATE back set update_time='{now_time}',action_time='{now_time}',state=0 WHERE user_id={user_id} and goods_id={in_use_id}")
f"UPDATE xiuxian_back set update_time='{now_time}',action_time='{now_time}',state=0 WHERE user_id={user_id} and goods_id={in_use_id}")
# 如果还有其他装备需要卸载(对于法器和防具的情况)
if in_use_id != 0 and goods_id != in_use_id:
sql_str.append(
f"UPDATE xiuxian_back set update_time='{now_time}',action_time='{now_time}',state=0 WHERE user_id={user_id} and goods_id={in_use_id}")
Original comment in English

suggestion (code-quality): Hoist conditional out of nested conditional (hoist-if-from-if)

Suggested change
# 如果还有其他装备需要卸载(对于法器和防具的情况)
if in_use_id != 0 and goods_id != in_use_id:
sql_str.append(
f"UPDATE back set update_time='{now_time}',action_time='{now_time}',state=0 WHERE user_id={user_id} and goods_id={in_use_id}")
f"UPDATE xiuxian_back set update_time='{now_time}',action_time='{now_time}',state=0 WHERE user_id={user_id} and goods_id={in_use_id}")
# 如果还有其他装备需要卸载(对于法器和防具的情况)
if in_use_id != 0 and goods_id != in_use_id:
sql_str.append(
f"UPDATE xiuxian_back set update_time='{now_time}',action_time='{now_time}',state=0 WHERE user_id={user_id} and goods_id={in_use_id}")


return sql_str, item_type



def check_equipment_use_msg(user_id, goods_id):
async def check_equipment_use_msg(user_id, goods_id):
"""
检测装备是否已用
"""
user_back = sql_message.get_item_by_good_id_and_user_id(user_id, goods_id)
user_back = await XiuxianDataManage().get_item_by_good_id_and_user_id(user_id, goods_id)
state = user_back['state']
is_use = False
if state == 0:
Expand All @@ -132,7 +131,7 @@ def check_equipment_use_msg(user_id, goods_id):
return is_use


def get_user_main_back_msg(user_id):
async def get_user_main_back_msg(user_id):

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

issue (code-quality): get_user_main_back_msg 代码质量较低 - 14% (low-code-quality)


解释该函数的质量分数低于 25% 的阈值。
该分数由方法长度、认知复杂度和工作记忆共同决定。

如何改进?

可以考虑将该函数重构得更短、更易读。

  • 通过将功能片段提取到独立函数中,减少函数长度。这是最重要的优化——理想情况下函数应少于 10 行。
  • 通过引入守卫子句提前返回,减少嵌套。
  • 确保变量作用域紧凑,让相关代码聚集在一起而不是分散在函数各处。
Original comment in English

issue (code-quality): Low code quality found in get_user_main_back_msg - 14% (low-code-quality)


ExplanationThe quality score for this function is below the quality threshold of 25%.
This score is a combination of the method length, cognitive complexity and working memory.

How can you solve this?

It might be worth refactoring this function to make it shorter and more readable.

  • Reduce the function length by extracting pieces of functionality out into
    their own functions. This is the most important thing you can do - ideally a
    function should be less than 10 lines.
  • Reduce nesting, perhaps by introducing guard clauses to return early.
  • Ensure that variables are tightly scoped, so that code using related concepts
    sits together within the function rather than being scattered.

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

issue (code-quality): get_user_main_back_msg 代码质量较低 - 14%(low-code-quality


解释该函数的质量分数低于 25% 的阈值。
该分数综合了方法长度、认知复杂度和工作记忆。

如何改进?

可以考虑重构该函数,使其更短、更易读。

  • 通过将功能片段提取到独立函数中来缩短函数长度。这是最重要的——理想情况下一个函数应少于 10 行。
  • 通过引入守卫子句提前返回,减少嵌套。
  • 确保变量作用域紧凑,让相关代码聚集在一起而不是分散在函数各处。
Original comment in English

issue (code-quality): Low code quality found in get_user_main_back_msg - 14% (low-code-quality)


ExplanationThe quality score for this function is below the quality threshold of 25%.
This score is a combination of the method length, cognitive complexity and working memory.

How can you solve this?

It might be worth refactoring this function to make it shorter and more readable.

  • Reduce the function length by extracting pieces of functionality out into
    their own functions. This is the most important thing you can do - ideally a
    function should be less than 10 lines.
  • Reduce nesting, perhaps by introducing guard clauses to return early.
  • Ensure that variables are tightly scoped, so that code using related concepts
    sits together within the function rather than being scattered.

"""
获取背包内的所有物品信息
"""
Expand All @@ -145,7 +144,7 @@ def get_user_main_back_msg(user_id):
l_yaocai_msg = []
l_libao_msg = []
l_msg = []
user_backs = sql_message.get_back_msg(user_id) # list(back)
user_backs = await XiuxianDataManage().get_back_msg(user_id) # list(back)
if user_backs is None:
return l_msg
for user_back in user_backs:
Expand All @@ -157,7 +156,7 @@ def get_user_main_back_msg(user_id):

elif user_back['goods_type'] == "丹药":
l_elixir_msg = get_elixir_msg(l_elixir_msg, user_back['goods_id'], user_back['goods_num'], user_back['bind_num'])

elif user_back['goods_type'] == "神物":
l_shenwu_msg = get_shenwu_msg(l_shenwu_msg, user_back['goods_id'], user_back['goods_num'], user_back['bind_num'])

Expand Down Expand Up @@ -443,13 +442,13 @@ def get_yaocai_info_msg(goods_id, item_info):
return msg


def check_use_elixir(user_id, goods_id, num):
user_info = sql_message.get_user_info_with_id(user_id)
async def check_use_elixir(user_id, goods_id, num):

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

issue (code-quality): 我们发现了如下问题:


解释

该函数的质量分数低于 25% 的阈值。
该分数由方法长度、认知复杂度和工作记忆共同决定。

如何改进?

可以考虑将该函数重构得更短、更易读。

  • 通过将功能片段提取到独立函数中,减少函数长度。这是最重要的优化——理想情况下函数应少于 10 行。
  • 通过引入守卫子句提前返回,减少嵌套。
  • 确保变量作用域紧凑,让相关代码聚集在一起而不是分散在函数各处。
Original comment in English

issue (code-quality): We've found these issues:


Explanation

The quality score for this function is below the quality threshold of 25%.
This score is a combination of the method length, cognitive complexity and working memory.

How can you solve this?

It might be worth refactoring this function to make it shorter and more readable.

  • Reduce the function length by extracting pieces of functionality out into
    their own functions. This is the most important thing you can do - ideally a
    function should be less than 10 lines.
  • Reduce nesting, perhaps by introducing guard clauses to return early.
  • Ensure that variables are tightly scoped, so that code using related concepts
    sits together within the function rather than being scattered.

user_info = await XiuxianDataManage().get_user_info_with_id(user_id)
user_rank = convert_rank(user_info['level'])[0]
goods_info = items.get_data_by_item_id(goods_id)
goods_rank = goods_info['rank']
goods_name = goods_info['name']
back = sql_message.get_item_by_good_id_and_user_id(user_id, goods_id)
back = await XiuxianDataManage().get_item_by_good_id_and_user_id(user_id, goods_id)
goods_all_num = back['all_num'] # 数据库里的使用数量
remaining_limit = goods_info['all_num'] - goods_all_num # 剩余可用数量

Expand All @@ -459,8 +458,8 @@ def check_use_elixir(user_id, goods_id, num):
elif goods_rank - user_rank > 18: # 最高使用限制
msg = f"道友当前境界为:{user_info['level']},丹药:{goods_name}已不能满足道友,请寻找适合道友的丹药吧!"
else: # 检查完毕
sql_message.update_back_j(user_id, goods_id, num, 1)
sql_message.update_levelrate(user_id, user_info['level_up_rate'] + goods_info['buff'] * num)
await XiuxianDataManage().update_back_j(user_id, goods_id, num, 1)
await XiuxianDataManage().update_levelrate(user_id, user_info['level_up_rate'] + goods_info['buff'] * num)
msg = f"道友成功使用丹药:{goods_name}{num}颗,下一次突破的成功概率提高{goods_info['buff'] * num}%!"

elif goods_info['buff_type'] == "level_up_big": # 增加大境界突破概率的丹药
Expand All @@ -476,8 +475,8 @@ def check_use_elixir(user_id, goods_id, num):
else:
msg = f"道友成功使用丹药:{goods_name}{num}颗, 下一次突破的成功概率提高{goods_info['buff'] * num}%!"

sql_message.update_back_j(user_id, goods_id, num, 1)
sql_message.update_levelrate(user_id, user_info['level_up_rate'] + goods_info['buff'] * num)
await XiuxianDataManage().update_back_j(user_id, goods_id, num, 1)
await XiuxianDataManage().update_levelrate(user_id, user_info['level_up_rate'] + goods_info['buff'] * num)

elif goods_info['buff_type'] == "hp": # 回复状态的丹药
if user_info['root'] == "器师":
Expand All @@ -499,8 +498,8 @@ def check_use_elixir(user_id, goods_id, num):
else:
new_mp = user_info['mp'] + recover_mp
msg = f"道友成功使用丹药:{goods_name}{num}颗,经过境界转化状态恢复了{int(buff * 100 * num)}%!"
sql_message.update_back_j(user_id, goods_id, num=num ,use_key=1)
sql_message.update_user_hp_mp(user_id, new_hp, new_mp)
await XiuxianDataManage().update_back_j(user_id, goods_id, num=num ,use_key=1)
await XiuxianDataManage().update_user_hp_mp(user_id, new_hp, new_mp)
else:
if goods_rank < user_rank: # 使用限制
msg = f"丹药:{goods_name}的使用境界为{goods_info['境界']}以上,道友不满足使用条件!"
Expand All @@ -523,8 +522,8 @@ def check_use_elixir(user_id, goods_id, num):
else:
new_mp = user_info['mp'] + recover_mp
msg = f"道友成功使用丹药:{goods_name}{num}颗,经过境界转化状态恢复了{int(buff * 100 * num)}%!"
sql_message.update_back_j(user_id, goods_id, num=num ,use_key=1)
sql_message.update_user_hp_mp(user_id, new_hp, new_mp)
await XiuxianDataManage().update_back_j(user_id, goods_id, num=num ,use_key=1)
await XiuxianDataManage().update_user_hp_mp(user_id, new_hp, new_mp)

elif goods_info['buff_type'] == "all": # 回满状态的丹药
if user_info['root'] == "器师":
Expand All @@ -533,8 +532,8 @@ def check_use_elixir(user_id, goods_id, num):
if user_info['hp'] == user_max_hp and user_info['mp'] == user_max_mp:
msg = f"道友的状态是满的,用不了哦!"
else:
sql_message.update_back_j(user_id, goods_id, use_key=1)
sql_message.update_user_hp(user_id)
await XiuxianDataManage().update_back_j(user_id, goods_id, use_key=1)
await XiuxianDataManage().update_user_hp(user_id)
msg = f"道友成功使用丹药:{goods_name}1颗,状态已全部恢复!"
else:
if goods_rank < user_rank: # 使用限制
Expand All @@ -545,23 +544,23 @@ def check_use_elixir(user_id, goods_id, num):
if user_info['hp'] == user_max_hp and user_info['mp'] == user_max_mp:
msg = f"道友的状态是满的,用不了哦!"
else:
sql_message.update_back_j(user_id, goods_id, use_key=1)
sql_message.update_user_hp(user_id)
await XiuxianDataManage().update_back_j(user_id, goods_id, use_key=1)
await XiuxianDataManage().update_user_hp(user_id)
msg = f"道友成功使用丹药:{goods_name}1颗,状态已全部恢复!"

elif goods_info['buff_type'] == "atk_buff": # 永久加攻击buff的丹药
if user_info['root'] == "器师":
buff = goods_info['buff'] * num
sql_message.updata_user_atk_buff(user_id, buff)
sql_message.update_back_j(user_id, goods_id,num=num, use_key=1)
await XiuxianDataManage().updata_user_atk_buff(user_id, buff)
await XiuxianDataManage().update_back_j(user_id, goods_id,num=num, use_key=1)
msg = f"道友成功使用丹药:{goods_name}{num}颗,攻击力永久增加{buff}点!"
else:
if goods_rank < user_rank: # 使用限制
msg = f"丹药:{goods_name}的使用境界为{goods_info['境界']}以上,道友不满足使用条件!"
else:
buff = goods_info['buff'] * num
sql_message.updata_user_atk_buff(user_id, buff)
sql_message.update_back_j(user_id, goods_id,num=num, use_key=1)
await XiuxianDataManage().updata_user_atk_buff(user_id, buff)
await XiuxianDataManage().update_back_j(user_id, goods_id,num=num, use_key=1)
msg = f"道友成功使用丹药:{goods_name}{num}颗,攻击力永久增加{buff}点!"

elif goods_info['buff_type'] == "exp_up": # 加固定经验值的丹药
Expand All @@ -572,31 +571,31 @@ def check_use_elixir(user_id, goods_id, num):
user_hp = int(user_info['hp'] + (exp / 2))
user_mp = int(user_info['mp'] + exp)
user_atk = int(user_info['atk'] + (exp / 10))
sql_message.update_exp(user_id, exp)
sql_message.update_power2(user_id) # 更新战力
sql_message.update_user_attribute(user_id, user_hp, user_mp, user_atk) # 这种事情要放在update_exp方法里
sql_message.update_back_j(user_id, goods_id, num=num, use_key=1)
await XiuxianDataManage().update_exp(user_id, exp, 0)
await XiuxianDataManage().update_power2(user_id) # 更新战力
await XiuxianDataManage().update_user_attribute(user_id, user_hp, user_mp, user_atk) # 这种事情要放在update_exp方法里
await XiuxianDataManage().update_back_j(user_id, goods_id, num=num, use_key=1)
msg = f"道友成功使用丹药:{goods_name}{num}颗,修为增加{exp}点!"
else:
msg = f"该类型的丹药目前暂时不支持使用!"
return msg


def get_use_jlq_msg(user_id, goods_id):
user_info = sql_message.get_user_info_with_id(user_id)
async def get_use_jlq_msg(user_id, goods_id):
user_info = await XiuxianDataManage().get_user_info_with_id(user_id)
if user_info['blessed_spot_flag'] == 0:
msg = f"道友还未拥有洞天福地,无法使用该物品"
else:
item_info = items.get_data_by_item_id(goods_id)
user_buff_data = UserBuffDate(user_id).BuffInfo
user_buff_data = await UserBuffData(user_id).BuffInfo
if int(user_buff_data['blessed_spot']) >= item_info['修炼速度']:
msg = f"该聚灵旗的等级不能满足道友的福地了,使用了也没效果"
else:
mix_elixir_info = get_player_info(user_id, "mix_elixir_info")
mix_elixir_info['药材速度'] = item_info['药材速度']
save_player_info(user_id, mix_elixir_info, 'mix_elixir_info')
sql_message.update_back_j(user_id, goods_id)
sql_message.updata_user_blessed_spot(user_id, item_info['修炼速度'])
await XiuxianDataManage().update_back_j(user_id, goods_id)
await XiuxianDataManage().updata_user_blessed_spot(user_id, item_info['修炼速度'])
msg = f"道友洞天福地的聚灵旗已经替换为:{item_info['name']}"
return msg

Expand Down
Loading