#!/usr/bin/env bash
tes3cmd="./tes3cmd"

result="Raym's Vampire Rumors - Patch for Purists.esp"
source_pfp="Patch for Purists.esm"
source_raym="Raym's Vampire Rumors.esp"

$tes3cmd dump --raw-with-header "${result}" --type DIAL\
 --exact-id "greeting 2"\
 "${source_pfp}" 
# sinyaramen
$tes3cmd dump --raw "${result}" --type INFO\
 --exact-id "23288195233207216141"\
 --exact-id "180039401103830822"\
 --exact-id "30079310442701032282"\
 "${source_pfp}" 
$tes3cmd dump --raw "${result}" --type INFO\
 --exact-id "2800538312175613916"\
 "${source_raym}" 
# irarak
$tes3cmd dump --raw "${result}" --type INFO\
 --exact-id "2611018385464224428"\
 "${source_pfp}" 
$tes3cmd modify "${result}" --hide-backups --type INFO \
  --exact-id "30079310442701032282" --run "\
  \$R->set({t=>'NNAM',f=>'Next_ID'}, '2800538312175613916')"
$tes3cmd modify "${result}" --hide-backups --type INFO \
  --exact-id "2800538312175613916" --run "\
  \$R->set({t=>'PNAM',f=>'Prev_ID'}, '30079310442701032282')"
$tes3cmd modify "${result}" --hide-backups --type INFO \
  --exact-id "2611018385464224428" --run "\
  \$R->set({t=>'PNAM',f=>'Prev_ID'}, '442510890497329826')"
