决战c语言txt,Item_kinds1.txt文件解析

本帖最后由 Ser_Charles 于 2012-8-27 17:42 编辑

先给出MS里module_items.py文件的注释:

##############################################################

#  Each item record contains the following fields:

#  1) Item id: used for referencing items in other files.

#     The prefix itm_ is automatically added before each item id.

#  2) Item name. Name of item as it'll appear in inventory window

#  3) List of meshes.  Each mesh record is a tuple containing the following fields:

#    3.1) Mesh name.

#    3.2) Modifier bits that this mesh matches.

#     Note that the first mesh record is the default.

#  4) Item flags. See header_items.py for a list of available flags.

#  5) Item capabilities. Used for which animations this item is used with. See header_items.py for a list of available flags.

#  6) Item value.

#  7) Item stats: Bitwise-or of various stats about the item such as:

#      weight, abundance, difficulty, head_armor, body_armor,leg_armor, etc...

#  8) Modifier bits: Modifiers that can be applied to this item.

#  9) [Optional] Triggers: List of simple triggers to be associated with the item.

#  10) [Optional] Factions: List of factions that item can be found as merchandise.

#############################################################

一般来说对TXT进行解析时上面这个注释帮助很大,因为TXT里数据的顺序就是按注释里的来。不过物品稍显例外,一是TXT里的顺序和MS里不完全一致,二是比如“weight, abundance, difficulty, head_armor, body_armor,leg_armor, etc...”没有说清楚到底有哪些属性以及在TXT里的顺序。

我们挑取itm_sword_medieval_a这把剑为例:

itm_sword_medieval_a Sword Sword 2  sword_medieval_a 0  sword_medieval_a_scabbard 3458764513820540928  4259842 9223388564182532111 163 155668 1.500000 100 0 0 0 0 27648 99 0 95 0 278 27

0

0

为了方便下面的解释,我也给出MS里这个物品的代码:

["sword_medieval_a", "Sword", [("sword_medieval_a",0),("sword_medieval_a_scabbard", ixmesh_carry)], itp_type_one_handed_wpn|itp_merchandise|itp_primary,  itc_longsword|itcf_carry_sword_left_hip|itcf_show_holster_when_drawn,

163, weight(1.5)|difficulty(0)|spd_rtng(99) | weapon_length(95)|swing_damage(27 , cut) | thrust_damage(22, pierce),imodbits_sword_high ],

解析这一条TXT码,第一步是拆分这些字段和数据。而且不仅是拆分字符和数字,空格和回车的拆分也是有讲究的。我先给出我拆分的结果,再来解释为什么。被拆分的字段我会用引号括起来,回车我用[crlf]表示。

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值