adjust_types.sh rewritten

This commit is contained in:
2023-11-26 09:23:26 -06:00
parent 02120d559e
commit c66cacd231
13 changed files with 153 additions and 117 deletions

View File

@@ -1,112 +0,0 @@
#!/usr/bin/env bash
#
# Wrapper for editing DayZ types.xml using xmlstarlet
#
#----------------------------------------------------------
# example: swap_flag M16A2 count_in_cargo 1 file
swap_flag() {
file=$4
if ! command -v xmlstarlet >/dev/null ; then
>&2 echo "NOT IN \$PATH: xmlstarlet"
exit 1
fi
if [ ! -f "$file" ] ; then
>&2 echo "File: '$file' is not a file"
exit 1
fi
if [ "$1" ] && [ "$2" ] && [ "$3" ] ; then
_name=$1
_flag=$2
_value=$3
xmlstarlet ed -P -L \
-u \ "//types/type[@name=\"$_name\"]/flags[@$_flag]/@$_flag" \
-v \
"$_value" \
"$file"
else
>&2 echo "Bad params in swap_flag"
exit 1
fi
}
# example: swap_value M4A1 nominal 3 file
swap_value() {
file=$4
if ! command -v xmlstarlet >/dev/null ; then
>&2 echo "NOT IN \$PATH: xmlstarlet"
exit 1
fi
if [ ! -f "$file" ] ; then
>&2 echo "File: '$file' is not a file"
exit 1
fi
if [ "$1" ] && [ "$2" ] && [ "$3" ] ; then
_name=$1
_tag=$2
_value=$3
xmlstarlet ed -P -L \
-u \ "//types/type[@name=\"$_name\"]/$_tag" \
-v \
"$_value" \
"$file"
else
>&2 echo "Bad params in swap_value"
exit 1
fi
}
usage() {
cat <<EOF
Usage: ${0##*/} [-f|-v] name tag value file
-f swap a flag from flags
-v swap a normal value
# --------------------------------
# Examples
# --------------------------------
# examples #1:
<type name="M16A2">
<lifetime>28800</lifetime>
</type>
${0##*/} -v M16A2 lifetime 20000 some_file.xml
# example #2:
<type name="M16A2">
<flags count_in_cargo="0" count_in_hoarder="0" count_in_map="1" count_in_player="0" crafted="0" deloot="0"/>
</type>
${0##*/} -f M16A2 count_in_player 1 some_file.xml
EOF
exit 1
}
if [ "$DEBUG" ] ; then
echo "ADJUSTING TYPE: $2 $3"
fi
case $1 in
-h|--help)
usage
;;
-f)
shift
swap_flag "$1" "$2" "$3" "$4" || exit 1
;;
-v)
shift
swap_value "$1" "$2" "$3" "$4" || exit 1
;;
esac

View File

@@ -0,0 +1,19 @@
{
"UpdateTime": 30,
"ServerInformation": [
{
"Name": "ZyaD Server Status",
"Address": "72.213.191.131:2305",
"Token": "MTA0ODc5MDAzNTM3NTMyOTM3MA.GlobiD.MDkpw9ySx15KiQkudeUPkA2FGAmIltIv9gi9H4",
"Status": 1,
"UseNameAsLabel": false,
"ProviderType": 0,
"ChannelID": null,
"StatusFormat": "Chernaurus: @Players/@MaxPlayers"
}
],
"ApplicationTokens": {
"SteamAPIKey": "21269ABF5364A400A6367F32109EC651",
"BattleMetricsKey": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJ0b2tlbiI6ImMyMTJhMTk0MDcyMjYzOGYiLCJpYXQiOjE2Njc5Njg3MTAsIm5iZiI6MTY2Nzk2ODcxMCwiaXNzIjoiaHR0cHM6Ly93d3cuYmF0dGxlbWV0cmljcy5jb20iLCJzdWIiOiJ1cm46dXNlcjo2MjY3MTAifQ.n8lc4qGwO2SYXvX50l2kbCHgi4dppW9P9G8sG2UB690"
}
}

Binary file not shown.

View File

@@ -0,0 +1,45 @@
<log4net>
<root>
<level value="ALL" />
<appender-ref ref="console" />
<appender-ref ref="file" />
</root>
<!--File Appender-->
<appender name="file" type="log4net.Appender.RollingFileAppender">
<threshold value="ERROR"/>
<file value="warnings_and_errors.log" />
<appendToFile value="true" />
<rollingStyle value="Size" />
<maxSizeRollBackups value="5" />
<maximumFileSize value="25MB" />
<staticLogFileName value="true" />
<layout type="log4net.Layout.PatternLayout">
<conversionPattern value="%date %level %logger - %message%newline" />
</layout>
</appender>
<!--Console appender-->
<appender name="console" type="log4net.Appender.ManagedColoredConsoleAppender">
<threshold value="INFO"/>
<mapping>
<level value="INFO" />
<forecolor value="Green" />
</mapping>
<mapping>
<level value="WARN" />
<forecolor value="Yellow" />
</mapping>
<mapping>
<level value="ERROR" />
<forecolor value="Red" />
</mapping>
<mapping>
<level value="DEBUG" />
<forecolor value="Blue" />
</mapping>
<layout type="log4net.Layout.PatternLayout">
<conversionpattern value="%date %-5level - %message%newline" />
</layout>
</appender>
</log4net>

View File

@@ -0,0 +1 @@
2022-12-03 22:12:29,734 ERROR PlayerCountBot.Providers.SteamProvider - [Steam] - 21cbba8c-0f4c-46f4-8ce0-52c27a808b8a - Server Address: 72.213.191.131:2305 was not found in Steam's directory.

View File

@@ -0,0 +1,11 @@
app id:
1048790035375329370
pub key:
15a2d69333ab4d3c7fe52cefce65a86fbfd607a0c39a23a85958b5b1529bd5d6
permission integer:
829531688784
token:
MTA0ODc5MDAzNTM3NTMyOTM3MA.GlobiD.MDkpw9ySx15KiQkudeUPkA2FGAmIltIv9gi9H4

BIN
archive/discord/logo.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 83 KiB

View File

@@ -0,0 +1 @@
1048793047376351282