function C:WeaponQualityUpToID(w) --同ID升品是否满足 local allweapon = self:Get("weaponList") local qualityCfg = DATA.GetData("WeaponQuality") local cfg =qualityCfg[w.quality] local stuff = {} --材料 local needStuffCnt = cfg.UpNeedCount for _, weapon in pairs(allweapon) do local isUse = HeroHelper:PairsWearWeapon(function (wearWeapon) --装备中的武器 if (weapon.guid ~= wearWeapon.guid and weapon.cfgid == wearWeapon.cfgid and wearWeapon.quality == cfg.UpNeedQuality) or cfg.UpNeedQuality ==0 then return true end end) if (not isUse) and weapon.guid ~= w.guid and weapon.cfgid == w.cfgid and ((weapon.quality == cfg.UpNeedQuality)or cfg.UpNeedQuality == 0 ) then if needStuffCnt > 0 then needStuffCnt = needStuffCnt -1 table.insert( stuff, weapon) end end end return needStuffCnt == 0,stuff end 在此方法中增加:当武器被当做素材时,标记此武器且指向把此武器作为素材的武器guid

时间: 2024-04-22 16:22:52 浏览: 14
好的,您的要求是在上述代码中增加一个标记,用于标记被当做素材的武器,并将其指向把它作为素材的武器guid。我可以为您提供以下代码实现: function C:WeaponQualityUpToID(w) local allweapon = self:Get("weaponList") local qualityCfg = DATA.GetData("WeaponQuality") local cfg = qualityCfg[w.quality] local stuff = {} --材料 local needStuffCnt = cfg.UpNeedCount for _, weapon in pairs(allweapon) do local isUse = HeroHelper:PairsWearWeapon(function (wearWeapon) --装备中的武器 if (weapon.guid ~= wearWeapon.guid and weapon.cfgid == wearWeapon.cfgid and wearWeapon.quality == cfg.UpNeedQuality) or cfg.UpNeedQuality == 0 then return true end end) if (not isUse) and weapon.guid ~= w.guid and weapon.cfgid == w.cfgid and ((weapon.quality == cfg.UpNeedQuality) or cfg.UpNeedQuality == 0) then if needStuffCnt > 0 then needStuffCnt = needStuffCnt - 1 table.insert(stuff, weapon) weapon.isMaterial = true --标记为素材 weapon.materialGuid = w.guid --指向把它作为素材的武器guid end end end return needStuffCnt == 0, stuff end 在这个修改后的代码中,我们添加了两个属性"isMaterial"和"materialGuid"来标记武器是否被用作素材以及它被用作素材的武器guid。当武器被用作素材时,我们将"isMaterial"属性设置为true,并将"materialGuid"属性设置为把它作为素材的武器guid。这将帮助您更好地跟踪武器的使用情况。

相关推荐

Traceback (most recent call last): File "D:/pycharts程序/基于機器學習的銷售量預測/main/随机森林模型.py", line 137, in <module> rfr.fit(X_train,y_train) File "C:\Users\DELL\AppData\Local\Programs\Python\Python37\lib\site-packages\sklearn\ensemble\_forest.py", line 467, in fit for i, t in enumerate(trees) File "C:\Users\DELL\AppData\Local\Programs\Python\Python37\lib\site-packages\joblib\parallel.py", line 1056, in __call__ self.retrieve() File "C:\Users\DELL\AppData\Local\Programs\Python\Python37\lib\site-packages\joblib\parallel.py", line 935, in retrieve self._output.extend(job.get(timeout=self.timeout)) File "C:\Users\DELL\AppData\Local\Programs\Python\Python37\lib\multiprocessing\pool.py", line 657, in get raise self._value File "C:\Users\DELL\AppData\Local\Programs\Python\Python37\lib\multiprocessing\pool.py", line 121, in worker result = (True, func(*args, **kwds)) File "C:\Users\DELL\AppData\Local\Programs\Python\Python37\lib\site-packages\joblib\_parallel_backends.py", line 595, in __call__ return self.func(*args, **kwargs) File "C:\Users\DELL\AppData\Local\Programs\Python\Python37\lib\site-packages\joblib\parallel.py", line 263, in __call__ for func, args, kwargs in self.items] File "C:\Users\DELL\AppData\Local\Programs\Python\Python37\lib\site-packages\joblib\parallel.py", line 263, in for func, args, kwargs in self.items] File "C:\Users\DELL\AppData\Local\Programs\Python\Python37\lib\site-packages\sklearn\utils\fixes.py", line 216, in __call__ return self.function(*args, **kwargs) File "C:\Users\DELL\AppData\Local\Programs\Python\Python37\lib\site-packages\sklearn\ensemble\_forest.py", line 185, in _parallel_build_trees tree.fit(X, y, sample_weight=curr_sample_weight, check_input=False) File "C:\Users\DELL\AppData\Local\Programs\Python\Python37\lib\site-packages\sklearn\tree\_classes.py", line 1320, in fit X_idx_sorted=X_idx_sorted, File "C:\Users\DELL\AppData\Local\Programs\Python\Python37\lib\site-packages\sklearn\tree\_classes.py", line 356, in fit criterion = CRITERIA_REG[self.criterion](self.n_outputs_, n_samples) KeyError: 'rmse'

> bplot <- ggplot(data=data,aes(x=牧食处理, y=牧食量, fill= 品种))+geom_bar(stat="identity",position="dodge")+geom_errorbar(aes(ymax=牧食量+se,ymin=牧食量-se),position=position_dodge(0.9), width=0.15)+scale_fill_brewer(palette = "Set1")+geom_text (aes(y=牧食量+se+0.2,label=t),position=position_dodge(0.9), size=3)+ylab("biomass (g)")+facet_grid('. ~ 栽培模式') > bplot Don't know how to automatically pick scale for object of type <function>. Defaulting to continuous. Error in geom_text(): ! Problem while computing aesthetics. ℹ Error occurred in the 3rd layer. Caused by error in compute_aesthetics(): ! Aesthetics are not valid data columns. ✖ The following aesthetics are invalid: ✖ label = t ℹ Did you mistype the name of a data column or forget to add after_stat()? Run rlang::last_trace() to see where the error occurred. > rlang::last_trace() <error/rlang_error> Error in geom_text(): ! Problem while computing aesthetics. ℹ Error occurred in the 3rd layer. Caused by error in compute_aesthetics(): ! Aesthetics are not valid data columns. ✖ The following aesthetics are invalid: ✖ label = t ℹ Did you mistype the name of a data column or forget to add after_stat()? --- Backtrace: ▆ 1. ├─base (local) <fn>(x) 2. └─ggplot2:::print.ggplot(x) 3. ├─ggplot2::ggplot_build(x) 4. └─ggplot2:::ggplot_build.ggplot(x) 5. └─ggplot2:::by_layer(...) 6. ├─rlang::try_fetch(...) 7. │ ├─base::tryCatch(...) 8. │ │ └─base (local) tryCatchList(expr, classes, parentenv, handlers) 9. │ │ └─base (local) tryCatchOne(expr, names, parentenv, handlers[[1L]]) 10. │ │ └─base (local) doTryCatch(return(expr), name, parentenv, handler) 11. │ └─base::withCallingHandlers(...) 12. └─ggplot2 (local) f(l = layers[[i]], d = data[[i]]) 13. └─l$compute_aesthetics(d, plot) 14. └─ggplot2 (local) compute_aesthetics(..., self = self)

Traceback (most recent call last): File "D:/PyCharm 2021/新建文件夹/数据转成可视化.py", line 105, in <module> map_1.render("全国疫情分布图.html") File "C:\Users\Administrator\AppData\Local\Programs\Python\Python38\lib\site-packages\pyecharts\charts\base.py", line 92, in render self._prepare_render() File "C:\Users\Administrator\AppData\Local\Programs\Python\Python38\lib\site-packages\pyecharts\charts\base.py", line 116, in _prepare_render self.json_contents = self.dump_options() File "C:\Users\Administrator\AppData\Local\Programs\Python\Python38\lib\site-packages\pyecharts\charts\base.py", line 77, in dump_options json.dumps(self.get_options(), indent=4, default=default, ignore_nan=True) File "C:\Users\Administrator\AppData\Local\Programs\Python\Python38\lib\site-packages\simplejson\__init__.py", line 381, in dumps return cls( File "C:\Users\Administrator\AppData\Local\Programs\Python\Python38\lib\site-packages\simplejson\encoder.py", line 300, in encode chunks = list(chunks) File "C:\Users\Administrator\AppData\Local\Programs\Python\Python38\lib\site-packages\simplejson\encoder.py", line 714, in _iterencode for chunk in _iterencode_dict(o, _current_indent_level): File "C:\Users\Administrator\AppData\Local\Programs\Python\Python38\lib\site-packages\simplejson\encoder.py", line 668, in _iterencode_dict for chunk in chunks: File "C:\Users\Administrator\AppData\Local\Programs\Python\Python38\lib\site-packages\simplejson\encoder.py", line 735, in _iterencode for chunk in _iterencode(o, _current_indent_level): File "C:\Users\Administrator\AppData\Local\Programs\Python\Python38\lib\site-packages\simplejson\encoder.py", line 714, in _iterencode for chunk in _iterencode_dict(o, _current_indent_level): File "C:\Users\Administrator\AppData\Local\Programs\Python\Python38\lib\site-packages\simplejson\encoder.py", line 668, in _iterencode_dict for chunk in chunks: File "C:\Users\Administrator\AppData\Local\Programs\Python\Python38\lib\site-packages\simplejson\encoder.py", line 544, in _iterencode_list for chunk in chunks: File "C:\Users\Administrator\AppData\Local\Programs\Python\Python38\lib\site-packages\simplejson\encoder.py", line 620, in _iterencode_dict key = _stringify_key(key) File "C:\Users\Administrator\AppData\Local\Programs\Python\Python38\lib\site-packages\simplejson\encoder.py", line 580, in _stringify_key raise TypeError('keys must be str, int, float, bool or None, ' TypeError: keys must be str, int, float, bool or None, not builtin_function_or_method

ValueError Traceback (most recent call last) Cell In[29], line 91 88 model.summary() 89 #模型训练 ---> 91 history = model.fit( 92 normed_train_data, train_labels, 93 epochs=100, validation_split=0.2, verbose=0) #verbose=表示不输出训练记录 94 #输出训练的各项指标值 95 hist = pd.DataFrame(history.history) File ~\anaconda3\lib\site-packages\keras\utils\traceback_utils.py:70, in filter_traceback.<locals>.error_handler(*args, **kwargs) 67 filtered_tb = _process_traceback_frames(e.__traceback__) 68 # To get the full stack trace, call: 69 # tf.debugging.disable_traceback_filtering() ---> 70 raise e.with_traceback(filtered_tb) from None 71 finally: 72 del filtered_tb File ~\AppData\Local\Temp\__autograph_generated_file1dq9vkey.py:15, in outer_factory.<locals>.inner_factory.<locals>.tf__train_function(iterator) 13 try: 14 do_return = True ---> 15 retval_ = ag__.converted_call(ag__.ld(step_function), (ag__.ld(self), ag__.ld(iterator)), None, fscope) 16 except: 17 do_return = False ValueError: in user code: File "C:\Users\lenovo\anaconda3\lib\site-packages\keras\engine\training.py", line 1284, in train_function * return step_function(self, iterator) File "C:\Users\lenovo\anaconda3\lib\site-packages\keras\engine\training.py", line 1268, in step_function ** outputs = model.distribute_strategy.run(run_step, args=(data,)) File "C:\Users\lenovo\anaconda3\lib\site-packages\keras\engine\training.py", line 1249, in run_step ** outputs = model.train_step(data) File "C:\Users\lenovo\anaconda3\lib\site-packages\keras\engine\training.py", line 1050, in train_step y_pred = self(x, training=True) File "C:\Users\lenovo\anaconda3\lib\site-packages\keras\utils\traceback_utils.py", line 70, in error_handler raise e.with_traceback(filtered_tb) from None File "C:\Users\lenovo\anaconda3\lib\site-packages\keras\engine\input_spec.py", line 298, in assert_input_compatibility raise ValueError( ValueError: Input 0 of layer "sequential_21" is incompatible with the layer: expected shape=(None, 14), found shape=(32, 15)

C:\Users\TXN>CD C:// C:\>Python "C:\Program Files (x86)\Intel\openvino_2021.4.752\deployment_tools\open_model_zoo\demos\human_pose_estimation_demo\python\human_pose_estimation_demo.py" -at openpose -d CPU -i 0 -m D:\model\fall_detection_zpp\intel\human-pose-estimation-0001\FP16\human-pose-estimation-0001.xml [ INFO ] Initializing Inference Engine... [ INFO ] Loading network... [ INFO ] Reading network from IR... Traceback (most recent call last): File "C:\Program Files (x86)\Intel\openvino_2021.4.752\deployment_tools\open_model_zoo\demos\human_pose_estimation_demo\python\human_pose_estimation_demo.py", line 283, in <module> sys.exit(main() or 0) File "C:\Program Files (x86)\Intel\openvino_2021.4.752\deployment_tools\open_model_zoo\demos\human_pose_estimation_demo\python\human_pose_estimation_demo.py", line 184, in main model = get_model(ie, args, frame.shape[1] / frame.shape[0]) File "C:\Program Files (x86)\Intel\openvino_2021.4.752\deployment_tools\open_model_zoo\demos\human_pose_estimation_demo\python\human_pose_estimation_demo.py", line 111, in get_model prob_threshold=args.prob_threshold) File "C:\Program Files (x86)\Intel\openvino_2021.4.752\deployment_tools\open_model_zoo\demos\common\python\models\open_pose.py", line 62, in __init__ strides=(1, 1), name=self.pooled_heatmaps_blob_name) File "C:\Users\TXN\AppData\Local\Programs\Python\Python37\lib\site-packages\ngraph\utils\decorators.py", line 22, in wrapper node = node_factory_function(*args, **kwargs) TypeError: max_pool() missing 1 required positional argument: 'dilations'

最新推荐

recommend-type

Google C++ Style Guide(Google C++编程规范)高清PDF

Scoping Namespaces Nested Classes Nonmember, Static Member, and Global Functions Local Variables Static and Global Variables Classes Doing Work in Constructors Default Constructors Explicit ...
recommend-type

6-10.py

6-10
recommend-type

基于机器学习的入侵检测系统+源码+说明.zip

基于机器学习的入侵检测系统+源码+说明.zip
recommend-type

matlab基于潜在低秩表示的红外与可见光图像融合.zip

matlab基于潜在低秩表示的红外与可见光图像融合.zip
recommend-type

4-5.py

4-5
recommend-type

zigbee-cluster-library-specification

最新的zigbee-cluster-library-specification说明文档。
recommend-type

管理建模和仿真的文件

管理Boualem Benatallah引用此版本:布阿利姆·贝纳塔拉。管理建模和仿真。约瑟夫-傅立叶大学-格勒诺布尔第一大学,1996年。法语。NNT:电话:00345357HAL ID:电话:00345357https://theses.hal.science/tel-003453572008年12月9日提交HAL是一个多学科的开放存取档案馆,用于存放和传播科学研究论文,无论它们是否被公开。论文可以来自法国或国外的教学和研究机构,也可以来自公共或私人研究中心。L’archive ouverte pluridisciplinaire
recommend-type

实现实时数据湖架构:Kafka与Hive集成

![实现实时数据湖架构:Kafka与Hive集成](https://img-blog.csdnimg.cn/img_convert/10eb2e6972b3b6086286fc64c0b3ee41.jpeg) # 1. 实时数据湖架构概述** 实时数据湖是一种现代数据管理架构,它允许企业以低延迟的方式收集、存储和处理大量数据。与传统数据仓库不同,实时数据湖不依赖于预先定义的模式,而是采用灵活的架构,可以处理各种数据类型和格式。这种架构为企业提供了以下优势: - **实时洞察:**实时数据湖允许企业访问最新的数据,从而做出更明智的决策。 - **数据民主化:**实时数据湖使各种利益相关者都可
recommend-type

2. 通过python绘制y=e-xsin(2πx)图像

可以使用matplotlib库来绘制这个函数的图像。以下是一段示例代码: ```python import numpy as np import matplotlib.pyplot as plt def func(x): return np.exp(-x) * np.sin(2 * np.pi * x) x = np.linspace(0, 5, 500) y = func(x) plt.plot(x, y) plt.xlabel('x') plt.ylabel('y') plt.title('y = e^{-x} sin(2πx)') plt.show() ``` 运行这段
recommend-type

JSBSim Reference Manual

JSBSim参考手册,其中包含JSBSim简介,JSBSim配置文件xml的编写语法,编程手册以及一些应用实例等。其中有部分内容还没有写完,估计有生之年很难看到完整版了,但是内容还是很有参考价值的。