Revision: | 1.1.1.1 (vendor branch) |
Committed: | Sun Feb 5 00:02:17 2006 UTC (18 years, 5 months ago) by root |
Branch: | UPSTREAM, MAIN |
CVS Tags: | post_fixaltar, last_stable, post_fixaltar2, rel-2_82, rel-2_81, rel-2_80, pre_coinconvert, UPSTREAM_2006_03_15, rel-3_0, rel-2_6, rel-2_7, rel-2_4, rel-2_5, rel-2_2, rel-2_0, rel-2_1, rel-2_72, rel-2_73, rel-2_71, rel-2_76, rel-2_77, rel-2_74, rel-2_75, rel-2_54, rel-2_55, rel-2_56, rel-2_79, UPSTREAM_2006_02_01, rel-2_53, pre_material_cfarch_normalize_run, rel-2_32, pre_fixconverter, post_coinconvert, pre_fixaltar2, pre_map_rename, UPSTREAM_2006_02_22, rel-2_90, rel-2_92, rel-2_93, rel-2_78, post_fixconverter, pre_fixaltar, rel-2_61, rel-2_43, rel-2_42, rel-2_41, HEAD |
Changes since 1.1: | +0 -0 lines |
Log Message: | Initial Import |
# | User | Rev | Content |
---|---|---|---|
1 | root | 1.1 | #!/bin/bash |
2 | # | ||
3 | # creator: josh@woosworld.net | ||
4 | # Simple script to replicate changes made to pshop1 | ||
5 | # to the rest of the pshops and keep the correct | ||
6 | # keys and exits working. | ||
7 | # | ||
8 | # Obviously this is based on some conventions I have | ||
9 | # don't use pshop1 anywhere else in the file etc... | ||
10 | # | ||
11 | |||
12 | #first rename the pshop1 dir so we don't erase it | ||
13 | mv pshop1 PSHOP | ||
14 | |||
15 | #then remove all the pshop files | ||
16 | rm -f pshop*/* | ||
17 | |||
18 | #copy PSHOP to all the pshop directories | ||
19 | for FILE in pshop*;do | ||
20 | if [ -d "$FILE" ] | ||
21 | then | ||
22 | #copy the files into the pshops directories | ||
23 | cp PSHOP/* "$FILE"/ | ||
24 | |||
25 | #go there | ||
26 | cd $FILE | ||
27 | |||
28 | #for each file in the pshop directory | ||
29 | for MYFILE in *;do | ||
30 | #correct the key values on inventory checkers | ||
31 | sed s/pshop1/$FILE/ $MYFILE > "$MYFILE"_2 | ||
32 | rm -f $MYFILE | ||
33 | mv "$MYFILE"_2 $MYFILE | ||
34 | done | ||
35 | |||
36 | #get the pshopnum | ||
37 | PSHOPNUM=`echo "$FILE" | cut -d p -f3` | ||
38 | |||
39 | #calculate HP and SP based on pshopnum | ||
40 | if [ $PSHOPNUM -lt 14 ] | ||
41 | then | ||
42 | #top row of shops | ||
43 | SP="2" | ||
44 | TEMPHP=`expr $PSHOPNUM \* 3` | ||
45 | HP=`expr $TEMPHP + 1` | ||
46 | else | ||
47 | #bottom row of shops | ||
48 | SP="6" | ||
49 | MODPSHOPNUM=`expr $PSHOPNUM - 14` | ||
50 | TEMPHP=`expr $MODPSHOPNUM \* 3` | ||
51 | HP=`expr $TEMPHP + 1` | ||
52 | fi | ||
53 | |||
54 | #fix the exit on gfloor | ||
55 | while read LINE | ||
56 | do | ||
57 | if [ "$LINE" == "slaying ../pshops_main" ] | ||
58 | then | ||
59 | #remove the 2 lines | ||
60 | read dummy_hp_line | ||
61 | read dummp_sp_line | ||
62 | |||
63 | #add the original back | ||
64 | echo "$LINE" >> gfloor2 | ||
65 | |||
66 | #write the new lines | ||
67 | echo "hp $HP" >> gfloor2 | ||
68 | echo "sp $SP" >> gfloor2 | ||
69 | |||
70 | else | ||
71 | #just add it back to the file | ||
72 | echo "$LINE" >> gfloor2 | ||
73 | fi | ||
74 | done < gfloor | ||
75 | |||
76 | #replace gfloor with gfloor2 | ||
77 | rm -f gfloor | ||
78 | mv gfloor2 gfloor | ||
79 | |||
80 | #go back up | ||
81 | cd .. | ||
82 | fi | ||
83 | done | ||
84 | |||
85 | #put pshop1 back | ||
86 | mv PSHOP pshop1 | ||
87 | |||
88 | #bye | ||
89 | exit 0 |