vscode extension recommends, lua extension settings, jupyter notebook for batch changes, mod info tweaks and global notes
This commit is contained in:
1 parent
c3446207af
commit
06b08ea102
4 files changed
+239
-11
No files matched your search
+183
@@ -0,0 +1,183 @@
|
||||
{
|
||||
"cells": [
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": null,
|
||||
"id": "48125b87",
|
||||
"metadata": {},
|
||||
"outputs": [],
|
||||
"source": [
|
||||
"import glob\n",
|
||||
"import re\n",
|
||||
"import pprint\n",
|
||||
"\n",
|
||||
"files = glob.glob('units/*/*_unit.bp')\n",
|
||||
"pprint.pprint(files)"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": null,
|
||||
"id": "100d0de8",
|
||||
"metadata": {},
|
||||
"outputs": [],
|
||||
"source": [
|
||||
"for filename in files:\n",
|
||||
" file = open(filename, 'r')\n",
|
||||
" lines = file.readlines()\n",
|
||||
"\n",
|
||||
" for idx, line in enumerate(lines):\n",
|
||||
" check = re.match(\"^(\\s*)(Health) = ([0-9]+),$\", line)\n",
|
||||
" if check is not None:\n",
|
||||
" white = check.group(1)\n",
|
||||
" label = check.group(2)\n",
|
||||
" value = check.group(3)\n",
|
||||
" num = int(value)\n",
|
||||
" lines[idx] = f\"{white}{label} = {num * 30}, -- ({value}) * 30\\n\"\n",
|
||||
"\n",
|
||||
" file.close()\n",
|
||||
"\n",
|
||||
" out = open(filename, 'w')\n",
|
||||
" out.writelines(lines)\n",
|
||||
" out.close()"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": null,
|
||||
"id": "f1a0bbd2",
|
||||
"metadata": {},
|
||||
"outputs": [],
|
||||
"source": [
|
||||
"for filename in files:\n",
|
||||
" file = open(filename, 'r')\n",
|
||||
" lines = file.readlines()\n",
|
||||
"\n",
|
||||
" for idx, line in enumerate(lines):\n",
|
||||
" maxcheck = re.match(\"^(\\s*)(MaxHealth) = ([0-9]+),$\", line)\n",
|
||||
" if maxcheck is not None:\n",
|
||||
" white = maxcheck.group(1)\n",
|
||||
" label = maxcheck.group(2)\n",
|
||||
" value = maxcheck.group(3)\n",
|
||||
" num = int(value)\n",
|
||||
" lines[idx] = f\"{white}{label} = {num * 30},\\n\"\n",
|
||||
"\n",
|
||||
" file.close()\n",
|
||||
"\n",
|
||||
" out = open(filename, 'w')\n",
|
||||
" out.writelines(lines)\n",
|
||||
" out.close()"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": null,
|
||||
"id": "63e82c8d",
|
||||
"metadata": {},
|
||||
"outputs": [],
|
||||
"source": [
|
||||
"for filename in files:\n",
|
||||
" file = open(filename, 'r')\n",
|
||||
" lines = file.readlines()\n",
|
||||
"\n",
|
||||
" for idx, line in enumerate(lines):\n",
|
||||
" typecheck = re.match(\"^(\\s*)(ArmorType) = '(\\w+)',$\", line)\n",
|
||||
" if typecheck is not None:\n",
|
||||
" white = typecheck.group(1)\n",
|
||||
" value = typecheck.group(3)\n",
|
||||
" lines[idx] = f\"{white}ArmorType = 'Normal', -- '{value}'\\n\"\n",
|
||||
"\n",
|
||||
" file.close()\n",
|
||||
"\n",
|
||||
" out = open(filename, 'w')\n",
|
||||
" out.writelines(lines)\n",
|
||||
" out.close()"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": null,
|
||||
"id": "0e1a79be",
|
||||
"metadata": {},
|
||||
"outputs": [],
|
||||
"source": [
|
||||
"for filename in files:\n",
|
||||
" file = open(filename, 'r')\n",
|
||||
" lines = file.readlines()\n",
|
||||
"\n",
|
||||
" for idx, line in enumerate(lines):\n",
|
||||
" damcheck = re.match(\"^(\\s*)(Damage) = (.+),$\", line)\n",
|
||||
" if damcheck is not None:\n",
|
||||
" dncheck = re.match(\"^(\\s*)(DisplayName) = '(.+)',$\", lines[idx + 3])\n",
|
||||
" if dncheck is not None:\n",
|
||||
" white = damcheck.group(1)\n",
|
||||
" value = damcheck.group(3)\n",
|
||||
" num = \"\"\n",
|
||||
"\n",
|
||||
" dn = dncheck.group(3)\n",
|
||||
" if dn is \"Particle Projector Cannon\":\n",
|
||||
" num = \"30, -- (10) * 30\"\n",
|
||||
" if dn is \"Medium Laser\":\n",
|
||||
" num = \"150, -- (5) * 30\"\n",
|
||||
"\n",
|
||||
" lines[idx] = f\"{white}Damage = {num},\\n\"\n",
|
||||
"\n",
|
||||
" file.close()\n",
|
||||
"\n",
|
||||
" out = open(filename, 'w')\n",
|
||||
" out.writelines(lines)\n",
|
||||
" out.close()"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": null,
|
||||
"id": "2792e0e6",
|
||||
"metadata": {},
|
||||
"outputs": [],
|
||||
"source": [
|
||||
"for filename in files:\n",
|
||||
" file = open(filename, 'r')\n",
|
||||
" lines = file.readlines()\n",
|
||||
"\n",
|
||||
" for idx, line in enumerate(lines):\n",
|
||||
" check = re.match(\"^(\\s*)(DamageType) = '(.+)',$\", line)\n",
|
||||
" if check is not None and check.group(3) == \"BTCluster\":\n",
|
||||
" white = check.group(1)\n",
|
||||
" label = check.group(2)\n",
|
||||
" second = re.match(\"^(\\s*)(DisplayName) = '(.+)',$\", lines[idx + 1])\n",
|
||||
" if second is not None:\n",
|
||||
" if second.group(3) == \"Long Range Missles\" or second.group(3) == \"Short Range Missles\":\n",
|
||||
" lines[idx] = f\"{white}{label} = 'BTClusterMissile',\\n\"\n",
|
||||
" if second.group(3) == \"LB 10-X Autocannon\" or second.group(3) == \"LBX5_rounds\":\n",
|
||||
" lines[idx] = f\"{white}{label} = 'BTClusterBallistic',\\n\"\n",
|
||||
" file.close()\n",
|
||||
"\n",
|
||||
" out = open(filename, 'w')\n",
|
||||
" out.writelines(lines)\n",
|
||||
" out.close()"
|
||||
]
|
||||
}
|
||||
],
|
||||
"metadata": {
|
||||
"kernelspec": {
|
||||
"display_name": ".venv (3.11.3)",
|
||||
"language": "python",
|
||||
"name": "python3"
|
||||
},
|
||||
"language_info": {
|
||||
"codemirror_mode": {
|
||||
"name": "ipython",
|
||||
"version": 3
|
||||
},
|
||||
"file_extension": ".py",
|
||||
"mimetype": "text/x-python",
|
||||
"name": "python",
|
||||
"nbconvert_exporter": "python",
|
||||
"pygments_lexer": "ipython3",
|
||||
"version": "3.11.3"
|
||||
}
|
||||
},
|
||||
"nbformat": 4,
|
||||
"nbformat_minor": 5
|
||||
}
|
||||
Reference in new issue
Block a user