• 注册
  • 玩家交流 玩家交流 关注:1676 内容:12238

    关于mod制作,想请教一下

  • 查看作者
  • 打赏作者
  • 当前位置: 七日杀中文网 > 玩家交流 > 正文
  • 玩家交流
  • 关于mod制作,想请教一下

    请问怎么把    open_time=”5.25″    插到这里面

    <lootcontainer name=”reinforcedChestT1″ count=”1″ size=”8,9″ sound_open=”UseActions/chest_tier1_open” sound_close=”UseActions/chest_tier1_close” loot_quality_template=”qualPlus1Template” ignore_loot_abundance=”true”>

    <item group=”groupReinforcedChestT1″/>

    </lootcontainer>

    我是想给房子的最终战利品修改开启需要时间免得被轻松白嫖,请问应该怎么改

    <append xpath=”/lootcontainers/lootcontainer[@name='reinforcedChestT1']”>open_time=”5.25″</append>

    "点赞是美意,打赏是鼓励"

    [教程]XPath指南 - 攻略教程 - 七日杀中文网 (7risha.com)


    看这里,有增加和减少属性的语句用法

  • 棉花庄园主很好,虽然不是你写的教程,但是很有帮助!
    拉黑 1年前 电脑端回复
  • 回复
    Lv.6
    以暴制暴

    看了一下你这个是set xpath的写法,我看了文件是一整条黏在一起 我试了一下insertAfter和append插入和附加代码都没办法插入你的open_time=”5.25″,我自己能想到的是两个办法。一个就是

    <remove xpath="/loot//lootcontainer[@name='reinforcedChestT1']"/>删除这一条。然后自己再


    <append xpath ="/loot"><!--新建属性-->


    <lootcontainer name="reinforcedChestT1" count="1" size="8,9" sound_open="UseActions/chest_tier1_open" sound_close="UseActions/chest_tier1_close" loot_quality_template="qualPlus1Template" ignore_loot_abundance="true" open_time="5.25" />


    <item group="groupReinforcedChestT1"/>


    </lootcontainer>


    </append>


    第二个方法就是使用XPath和Python中的ElementTree库来修改XML文件


    import xml.etree.ElementTree as ET tree = ET.parse('loot.xml') root = tree.getroot() lootcontainer = root.find(".//lootcontainer[@name='reinforcedChestT1']") lootcontainer.set('open_time', '5.25') tree.write('loot.xml')


    这是我能想到的两个方法了,期待其他大佬的回答


    核危机军队IP8.138.139.11端口26900

  • 棉花庄园主第一个办法我是以前一直在用的,后来觉得这样会不会太傻了,今天试了好几次,不管怎么写都没有发挥作用
    拉黑 1年前 电脑端回复
  • 棉花庄园主实在不行也只能用第一个办法了,有点土办法的感觉哈哈哈,但是是最方便直接的
    拉黑 1年前 电脑端回复
  • 習慣°孤單↘大佬666
    拉黑 1年前 手机端回复
  • 棉花庄园主看楼下,我知道怎么搞了
    拉黑 1年前 电脑端回复
  • 回复

    弄好了,分享一下方法


    <setattribute xpath="/lootcontainers/lootcontainer[@name='reinforcedChestT1']" name="open_time">5.25</setattribute>

    <setattribute xpath="/lootcontainers/lootcontainer[@name='reinforcedChestT2']" name="open_time">5.25</setattribute>

    <setattribute xpath="/lootcontainers/lootcontainer[@name='reinforcedChestT3']" name="open_time">5.25</setattribute>

    <setattribute xpath="/lootcontainers/lootcontainer[@name='hardenedChestT4']" name="open_time">5.25</setattribute>

    <setattribute xpath="/lootcontainers/lootcontainer[@name='hardenedChestT5']" name="open_time">5.25</setattribute>


    擅长做一些简单的mod。

    回复
    创建和谐社区,请勿发表 不符合法律法规 的内容,社区不是大家 发泄个人情绪 的地方
    获取金币请查看 网页右侧悬浮栏领金币按钮 ,做 签到社区任务 获得金币!

    请登录之后再进行评论

    登录
    • 大版主
    • 小版主
  • 摸鱼摸鱼摸
    摸鱼摸鱼摸
    交流吹水群967780922
  • 柒月白风清
    柒月白风清
    一只小萌新,万年摸鱼党!已经脱坑了。。。
  • Cure_805
    Cure_805
    晚上在睡觉,白天在工作,不一定能及时回复,有事可以留言!
  • 至善丶丶
    至善丶丶
    群:1050040662 定制/开服/地图制作/价格公道
  • 银河
    银河
    CSOL大灾变欢迎你的到来。QQ群:967780922
  • 无名氏_217
  • 安安
    安安
    大背包、常显、叠加、除草树,唯一作者QQ383125283
  • happy!
    happy!
    住院中
  • 咖啡很苦
  • 妮可Nike
    妮可Nike
    无聊写些小玩意儿
  • 暂没有数据

    赞助广告位

  • 点击展示图片即可一键加入QQ群
    赞助广告:100R/月 目前空缺广告位:0

    分享网站

  • 繁体中文
  • 任务
  • 动态
  • 到底部
  • 帖子间隔 侧栏位置: