Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #!/bin/bash
- #: Title: csgo_weapon_getdata_spreadsheet
- #: Date: 2013-07-11
- # License: Public Domain
- scriptname="csgo_weapon_getdata_spreadsheet"
- version="0.6"
- author="Cameron Bullivant <BlackRetina@gmail.com>"
- description="Description: csgo_weapon_getdata_spreadsheet finds information relevant to weapons in /csgo/scripts/weapon_*.txt and formats it for spreadsheets"
- usage="csgo_weapon_getdata_spreadsheet [-h | -v ] weapon_*.txt"
- function usage () #@ DESCRIPTION: print usage information
- {
- #@ USAGE: usage
- #@ REQUIRES: variable defined: $scriptname
- printf "%s - %s\n" "$scriptname" "$description"
- printf "USAGE: %s\n" "$usage"
- }
- readonly -f usage
- function version() #@ DESCRIPTION: print version information
- {
- #@ USAGE: version
- #@ REQUIRES: variables defined: $scriptname, $author and $version
- printf "%s version %s\n" "$scriptname" "$version"
- printf "by %s, \n" "$author"
- }
- readonly -f version
- optstring=hv
- while getopts $optstring opt
- do
- case $opt in
- h) usage; exit 0 ;;
- v) version; exit 0;;
- *) usage; exit 1 ;;
- esac
- done
- for var in $@
- do
- weapontype=`awk '/"?WeaponType"?/ { print $2 }' $var `
- case $weapontype in
- *SniperRifle*) sniperrifle="$sniperrifle $var";;
- *Rifle*) rifle="$rifle $var" ;;
- *SubMachinegun*) submachinegun="$submachinegun $var";;
- *Machinegun*) machinegun="$machinegun $var";;
- *Shotgun*) shotgun="$shotgun $var";;
- *Pistol*) pistol="$pistol $var";;
- *Grenade*) grenade="$grenade $var";;
- *) miscellaneous="$miscellaneous $var";;
- esac
- done
- function getData() {
- COUNT=0;
- for filename in $@
- do
- n=0;
- arr1=()
- arr2=()
- printf -v bullets "%d" $(awk '/"?Bullets"?/ { print $2 }' $filename | sed -e 's/\"//g' -e 's/.$//')
- printf -v killaward "%d" $(awk '/"?KillAward"?/ { print $2 }' $filename | sed -e 's/\"//g' -e 's/.$//')
- printf -v arr2[$n] "%s" "Armor Ratio"
- printf -v arr1[$[n++]] "%.3f" $(awk '/"?WeaponArmorRatio"?/ { print $2 }' $filename | sed -e 's/\"//g' -e 's/.$//')
- printf -v arr2[$n] "%s" "Damage"
- printf -v arr1[$[n++]] "%d" $(awk '/"?Damage"?/ { print $2 }' $filename | sed -e 's/\"//g' -e 's/.$//' )
- printf -v arr2[$n] "%s" "RangeModifier"
- printf -v arr1[$[n++]] "%.3f" $(awk '/"?RangeModifier"?/ { print $2 }' $filename | sed -e 's/\"//g' -e 's/.$//' )
- printf -v arr2[$n] "%s" "CycleTime"
- printf -v arr1[$[n++]] "%.3f" $(awk '/"?CycleTime"?/ { print $2 }' $filename | sed -e 's/\"//g' -e 's/.$//' )
- printf -v arr2[$n] "%s" "Penetration"
- printf -v arr1[$[n++]] "%d" $(awk '/"?Penetration"?/ { print $2 }' $filename | sed -e 's/\"//g' -e 's/.$//' )
- printf -v arr2[$n] "%s" "Kill Award"
- if [ $killaward -eq 0 ]; then printf -v arr1[$[n++]] "%d" '300'; else printf -v arr1[$[n++]] "%d" $killaward; fi
- printf -v arr2[$n] "%s" "Speed"
- printf -v arr1[$[n++]] "%d" $(awk '/(MaxPlayerSpeed )|("MaxPlayerSpeed")/ { print $2 }' $filename | sed -e 's/\"//g' -e 's/.$//' )
- printf -v arr2[$n] "%s" "Clip Size"
- printf -v arr1[$[n++]] "%d" $(awk '/"?clip_size"?/ { print $2 }' $filename | sed -e 's/\"//g' -e 's/.$//')
- printf -v arr2[$n] "%s" "Price"
- printf -v arr1[$[n++]] "%d" $(awk '/"?WeaponPrice"?/ { print $2 }' $filename | sed -e 's/\"//g' -e 's/.$//' )
- printf -v arr2[$n] "%s" "Range"
- printf -v arr1[$[n++]] "%d" $(awk '/(Range )|("Range")/ { print $2 }' $filename | sed -e 's/\"//g' -e 's/.$//' )
- printf -v arr2[$n] "%s" "FullAuto"
- printf -v arr1[$[n++]] "%d" $(awk '/(FullAuto )|("FullAuto")/ { print $2 }' $filename | sed -e 's/\"//g' -e 's/.$//' )
- printf -v arr2[$n] "%s" "FlinchVelocityModifierLarge"
- printf -v arr1[$[n++]] "%.3f" $(awk '/(FlinchVelocityModifierLarge )|("?FlinchVelocityModifierLarge"?)/ { print $2 }' $filename | sed -e 's/\"//g' -e 's/.$//' )
- printf -v arr2[$n] "%s" "FlinchVelocityModifierSmall"
- printf -v arr1[$[n++]] "%.3f" $(awk '/(FlinchVelocityModifierSmall )|("?FlinchVelocityModifierSmall"?)/ { print $2 }' $filename | sed -e 's/\"//g' -e 's/.$//' )
- printf -v arr2[$n] "%s" "Spread"
- printf -v arr1[$[n++]] "%.3f" $(awk '/(Spread )|("Spread")/ { print $2 }' $filename | sed -e 's/\"//g' -e 's/.$//' )
- printf -v arr2[$n] "%s" "InaccuracyCrouch"
- printf -v arr1[$[n++]] "%.3f" $(awk '/(InaccuracyCrouch )|("InaccuracyCrouch")/ { print $2 }' $filename | sed -e 's/\"//g' -e 's/.$//' )
- printf -v arr2[$n] "%s" "InaccuracyStand"
- printf -v arr1[$[n++]] "%.3f" $(awk '/(InaccuracyStand )|("InaccuracyStand")/ { print $2 }' $filename | sed -e 's/\"//g' -e 's/.$//' )
- printf -v arr2[$n] "%s" "InaccuracyFire"
- printf -v arr1[$[n++]] "%.3f" $(awk '/(InaccuracyFire )|("InaccuracyFire")/ { print $2 }' $filename | sed -e 's/\"//g' -e 's/.$//' )
- printf -v arr2[$n] "%s" "InaccuracyMove"
- printf -v arr1[$[n++]] "%.3f" $(awk '/(InaccuracyMove )|("InaccuracyMove")/ { print $2 }' $filename | sed -e 's/\"//g' -e 's/.$//' )
- printf -v arr2[$n] "%s" "InaccuracyJump"
- printf -v arr1[$[n++]] "%.3f" $(awk '/(InaccuracyJump )|("InaccuracyJump")/ { print $2 }' $filename | sed -e 's/\"//g' -e 's/.$//' )
- printf -v arr2[$n] "%s" "InaccuracyLand"
- printf -v arr1[$[n++]] "%.3f" $(awk '/(InaccuracyLand )|("InaccuracyLand")/ { print $2 }' $filename | sed -e 's/\"//g' -e 's/.$//' )
- printf -v arr2[$n] "%s" "InaccuracyLadder"
- printf -v arr1[$[n++]] "%.3f" $(awk '/(InaccuracyLadder )|("InaccuracyLadder")/ { print $2 }' $filename | sed -e 's/\"//g' -e 's/.$//' )
- printf -v arr2[$n] "%s" "RecoveryTimeCrouch"
- printf -v arr1[$[n++]] "%.6f" $(awk '/"?RecoveryTimeCrouch"?/ { print $2 }' $filename | sed -e 's/\"//g' -e 's/.$//' )
- printf -v arr2[$n] "%s" "RecoveryTimeStand"
- printf -v arr1[$[n++]] "%.6f" $(awk '/"?RecoveryTimeStand"?/ { print $2 }' $filename | sed -e 's/\"//g' -e 's/.$//' )
- printf -v arr2[$n] "%s" "RecoilAngleVariance"
- printf -v arr1[$[n++]] "%d" $(awk '/(RecoilAngleVariance )|("RecoilAngleVariance")/ { print $2 }' $filename | sed -e 's/\"//g' -e 's/.$//' )
- printf -v arr2[$n] "%s" "RecoilMagnitude"
- printf -v arr1[$[n++]] "%.3f" $(awk '/(RecoilMagnitude )|("RecoilMagnitude")/ { print $2 }' $filename | sed -e 's/\"//g' -e 's/.$//' )
- printf -v arr2[$n] "%s" "RecoilMagnitudeVariance"
- printf -v arr1[$[n++]] "%d" $(awk '/(RecoilMagnitudeVariance )|("RecoilMagnitudeVariance")/ { print $2 }' $filename | sed -e 's/\"//g' -e 's/.$//' )
- printf -v arr2[$n] "%s" "SpreadAlt"
- printf -v arr1[$[n++]] "%.3f" $(awk '/"?SpreadAlt"?/ { print $2 }' $filename | sed -e 's/\"//g' -e 's/.$//' )
- printf -v arr2[$n] "%s" "InaccuracyCrouchAlt"
- printf -v arr1[$[n++]] "%.3f" $(awk '/"?InaccuracyCrouchAlt"?/ { print $2 }' $filename | sed -e 's/\"//g' -e 's/.$//' )
- printf -v arr2[$n] "%s" "InaccuracyStandAlt"
- printf -v arr1[$[n++]] "%.3f" $(awk '/"?InaccuracyStandAlt"?/ { print $2 }' $filename | sed -e 's/\"//g' -e 's/.$//' )
- printf -v arr2[$n] "%s" "InaccuracyFireAlt"
- printf -v arr1[$[n++]] "%.3f" $(awk '/"?InaccuracyFireAlt"?/ { print $2 }' $filename | sed -e 's/\"//g' -e 's/\r//' )
- printf -v arr2[$n] "%s" "InaccuracyMoveAlt"
- printf -v arr1[$[n++]] "%.3f" $(awk '/"?InaccuracyMoveAlt"?/ { print $2 }' $filename | sed -e 's/\"//g' -e 's/.$//' )
- printf -v arr2[$n] "%s" "InaccuracyJumpAlt"
- printf -v arr1[$[n++]] "%.3f" $(awk '/(InaccuracyJumpAlt )|("InaccuracyJumpAlt")/ { print $2 }' $filename | sed -e 's/\"//g' -e 's/.$//' )
- printf -v arr2[$n] "%s" "InaccuracyLandAlt"
- printf -v arr1[$[n++]] "%.3f" $(awk '/(InaccuracyLandAlt )|("InaccuracyLandAlt")/ { print $2 }' $filename | sed -e 's/\"//g' -e 's/.$//' )
- printf -v arr2[$n] "%s" "InaccuracyLadderAlt"
- printf -v arr1[$[n++]] "%.3f" $(awk '/(InaccuracyLadderAlt )|("InaccuracyLadderAlt")/ { print $2 }' $filename | sed -e 's/\"//g' -e 's/.$//' )
- printf -v arr2[$n] "%s" "RecoilAngleVarianceAlt"
- printf -v arr1[$[n++]] "%d" $(awk '/"?RecoilAngleVarianceAlt"?/ { print $2 }' $filename | sed -e 's/\"//g' -e 's/.$//' )
- printf -v arr2[$n] "%s" "RecoilMagnitudeAlt"
- printf -v arr1[$[n++]] "%.3f" $(awk '/"?RecoilMagnitudeAlt"?/ { print $2 }' $filename | sed -e 's/\"//g' -e 's/.$//' )
- printf -v arr2[$n] "%s" "RecoilMagnitudeVarianceAlt"
- printf -v arr1[$[n++]] "%d" $(awk '/"?RecoilMagnitudeVarianceAlt"?/ { print $2 }' $filename | sed -e 's/\"//g' -e 's/.$//' )
- if [ $bullets -ne 1 ]; then printf -v arr2[$n] "%s" "Bullets"; printf -v arr1[$[n++]] "%d" $bullets; fi
- if [ $COUNT -eq 0 ]; then printf "%s:" "${arr2[@]}"; echo ""; fi
- printf "%s:" "$(echo $filename | sed -e 's/weapon_//' -e 's/.txt//' )" "${arr1[@]}"; echo "";
- (( COUNT++ ))
- done
- }
- printf "%s" "Pistols:"
- getData $pistol
- printf "\n%s" "Shotguns:"
- getData $shotgun
- printf "\n%s" "SMGs:"
- getData $submachinegun
- printf "\n%s" "Automatic Rifles:"
- getData $rifle
- printf "\n%s" "LMGs:"
- getData $machinegun
- printf "\n%s" "Sniper Rifles:"
- getData $sniperrifle
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement