@@ -37,7 +37,7 @@ interface
37
37
' 201 205 229 49 91 161 0 200 0' , { Aero Blue, Azure, Green }
38
38
' 240 240 240 208 34 51 50 50 150' { White, Red Goes Fasta, Blue }
39
39
);
40
-
40
+
41
41
SATT_SaleTag = ' SALETAG' ;
42
42
43
43
var
@@ -148,17 +148,17 @@ implementation
148
148
end ;
149
149
150
150
Function ScalePrice ( GB: GameBoardPtr; PC,NPC: GearPtr; Price: Int64 ): LongInt;
151
- { Modify the price listed based upon the PC's shopping skill, }
151
+ { Modify the price listed based upon the PC's shopping skill, }
152
152
{ faction membership, and whatever else. }
153
153
var
154
- ShopRk,ShopTr,R: Integer; { ShopRank and ShopTarget }
155
- PriceMod: LongInt;
154
+ ShopRk,ShopTr,R: Integer; { ShopRank and ShopTarget }
155
+ PriceMod: LongInt;
156
156
Adv: GearPtr;
157
- begin
158
- { Start with the assumption that we're paying 100%. }
159
- PriceMod := 100 ;
157
+ begin
158
+ { Start with the assumption that we're paying 100%. }
159
+ PriceMod := 100 ;
160
160
161
- { First, let's modify this by Shopping skill. }
161
+ { First, let's modify this by Shopping skill. }
162
162
{ Determine the Shopping skill rank of the buyer. }
163
163
ShopRk := SkillValue( PC , NAS_Shopping , STAT_Charm );
164
164
@@ -175,8 +175,8 @@ implementation
175
175
end else if R < 0 then begin
176
176
{ It's much harder to haggle if the shopkeep }
177
177
{ doesn't like you. }
178
- ShopTr := ShopTr + Abs( R ) div 2 ;
179
- { If the dislike ventures into hate, there's a markup. }
178
+ ShopTr := ShopTr + Abs( R ) div 2 ;
179
+ { If the dislike ventures into hate, there's a markup. }
180
180
if R < -20 then PriceMod := PriceMod + Abs( R ) div 5 ;
181
181
end ;
182
182
end ;
@@ -189,20 +189,20 @@ implementation
189
189
if ShopRk > 50 then ShopRk := 50 ;
190
190
191
191
PriceMod := PriceMod - ShopRk;
192
- end ;
193
-
194
- { Next, let's take a look at factions. }
195
- if ( GB <> Nil ) and ( GB^.Scene <> Nil ) and ( NPC <> Nil ) then begin
196
- { ArchEnemies get a 20% markup, allies get a 10% discount. }
197
- Adv := FindRoot( GB^.Scene );
198
- if IsArchEnemy( Adv , NPC ) then begin
199
- PriceMod := PriceMod + 20 ;
200
- end else if IsArchAlly( Adv , NPC ) then begin
201
- PriceMod := PriceMod - 10 ;
202
- end ;
203
- end ;
204
-
205
- { Calculate the final price. }
192
+ end ;
193
+
194
+ { Next, let's take a look at factions. }
195
+ if ( GB <> Nil ) and ( GB^.Scene <> Nil ) and ( NPC <> Nil ) then begin
196
+ { ArchEnemies get a 20% markup, allies get a 10% discount. }
197
+ Adv := FindRoot( GB^.Scene );
198
+ if IsArchEnemy( Adv , NPC ) then begin
199
+ PriceMod := PriceMod + 20 ;
200
+ end else if IsArchAlly( Adv , NPC ) then begin
201
+ PriceMod := PriceMod - 10 ;
202
+ end ;
203
+ end ;
204
+
205
+ { Calculate the final price. }
206
206
Price := ( Price * PriceMod ) div 100 ;
207
207
if Price < 1 then Price := 1 ;
208
208
@@ -1129,7 +1129,7 @@ procedure PurchaseGearMenu( GB: GameBoardPtr; PC,NPC,Part: GearPtr );
1129
1129
{ Certain items may need some initialization. }
1130
1130
var
1131
1131
mecha_colors: String;
1132
- Fac: GearPtr;
1132
+ Fac: GearPtr;
1133
1133
Discount: Integer;
1134
1134
begin
1135
1135
if I^.G = GG_Mecha then begin
@@ -1154,13 +1154,13 @@ procedure PurchaseGearMenu( GB: GameBoardPtr; PC,NPC,Part: GearPtr );
1154
1154
end ;
1155
1155
1156
1156
SetSAtt( I^.SA , ' sdl_colors <' + mecha_colors + ' >' );
1157
- end ;
1158
-
1159
- { New v0.625- Maybe this item will be on sale! }
1160
- if ( Random( 20 ) = 1 ) then begin
1161
- Discount := ( Random( 5 ) + 1 ) * 5 ;
1162
- MarkGearsWithNAtt( I , NAG_GearOps , NAS_CostAdjust , -Discount );
1163
- MarkGearsWithSAtt( I , SATT_SaleTag + ' <' + ReplaceHash( MSgString( ' SALETAG_Discount' ) , BStr( Discount ) ) + ' >' );
1157
+ end ;
1158
+
1159
+ { New v0.625- Maybe this item will be on sale! }
1160
+ if ( Random( 20 ) = 1 ) then begin
1161
+ Discount := ( Random( 5 ) + 1 ) * 5 ;
1162
+ MarkGearsWithNAtt( I , NAG_GearOps , NAS_CostAdjust , -Discount );
1163
+ MarkGearsWithSAtt( I , SATT_SaleTag + ' <' + ReplaceHash( MSgString( ' SALETAG_Discount' ) , BStr( Discount ) ) + ' >' );
1164
1164
end ;
1165
1165
end ;
1166
1166
var
@@ -1173,13 +1173,13 @@ procedure PurchaseGearMenu( GB: GameBoardPtr; PC,NPC,Part: GearPtr );
1173
1173
{ Set the random seed to something less than random... }
1174
1174
NPCSeed := NAttValue( NPC^.NA , NAG_PErsonal , NAS_RandSeed );
1175
1175
NPCRestock := NAttValue( NPC^.NA , NAG_PErsonal , NAS_RestockTime );
1176
- if NPCSeed = 0 then begin
1176
+ if ( NPCSeed = 0 ) or ( GB^.Comtime > NPCRestock ) then begin
1177
1177
NPCSeed := Random( 2000000000 ) + 1 ;
1178
- NPCRestock := Random( 86400 ) + 1 ;
1178
+ NPCRestock := 86400 + GB^.Comtime ;
1179
1179
SetNAtt( NPC^.NA , NAG_PErsonal , NAS_RandSeed , NPCSeed );
1180
1180
SetNAtt( NPC^.NA , NAG_PErsonal , NAS_RestockTime , NPCRestock );
1181
1181
end ;
1182
- RandSeed := ( ( GB^.ComTime + NPCRestock ) div 86400 ) + NPCSeed;
1182
+ RandSeed := NPCSeed;
1183
1183
1184
1184
{ We've already got everything loaded from disk, in Standard_Equipment_List. }
1185
1185
{ Create a component list of legal parts. }
@@ -1279,7 +1279,7 @@ procedure PurchaseGearMenu( GB: GameBoardPtr; PC,NPC,Part: GearPtr );
1279
1279
1280
1280
N := 1 ;
1281
1281
while I <> Nil do begin
1282
- msg := FullGearName( I );
1282
+ msg := FullGearName( I );
1283
1283
1284
1284
{ Add extra information, depending upon item type. }
1285
1285
if I^.G = GG_Weapon then begin
@@ -1296,10 +1296,10 @@ procedure PurchaseGearMenu( GB: GameBoardPtr; PC,NPC,Part: GearPtr );
1296
1296
if ( I^.G <> GG_Mecha ) and ( I^.Scale > 0 ) then begin
1297
1297
msg := msg + ' (SF' + BStr( I^.Scale ) + ' )' ;
1298
1298
end ;
1299
-
1299
+
1300
1300
{ Add the sale tag, if it exists. }
1301
- msg2 := SAttValue( I^.SA , SATT_SALETAG );
1302
- if msg2 <> ' ' then msg := msg + ' (' + msg2 + ' )' ;
1301
+ msg2 := SAttValue( I^.SA , SATT_SALETAG );
1302
+ if msg2 <> ' ' then msg := msg + ' (' + msg2 + ' )' ;
1303
1303
1304
1304
{ Pad the message. }
1305
1305
{ $IFDEF ASCII}
@@ -1358,8 +1358,8 @@ procedure PurchaseGearMenu( GB: GameBoardPtr; PC,NPC,Part: GearPtr );
1358
1358
{ Create the menu. }
1359
1359
RPM := CreateRPGMenu( MenuItem , MenuSelect , ZONE_ShopMenu );
1360
1360
RPM^.Mode := RPMNoCleanup;
1361
-
1362
- BuildInventoryMenu( RPM , PCInv , True );
1361
+
1362
+ BuildInventoryMenu( RPM , PCInv , True );
1363
1363
1364
1364
AddRPGMenuItem( RPM , MsgString( ' SERVICES_Exit' ) , -1 );
1365
1365
@@ -1388,11 +1388,11 @@ procedure PurchaseGearMenu( GB: GameBoardPtr; PC,NPC,Part: GearPtr );
1388
1388
SERV_Menu := Nil ;
1389
1389
SERV_Info := Nil ;
1390
1390
end ;
1391
-
1392
- Function ShopkeeperCanRepairMecha ( NPC: GearPtr ): Boolean;
1393
- { Return TRUE if the shopkeeper can repair mecha, or FALSE otherwise. }
1394
- begin
1395
- ShopkeeperCanRepairMecha := ( NPC <> Nil ) and ( NAttValue( NPC^.NA , NAG_Skill , NAS_Repair ) > 5 );
1391
+
1392
+ Function ShopkeeperCanRepairMecha ( NPC: GearPtr ): Boolean;
1393
+ { Return TRUE if the shopkeeper can repair mecha, or FALSE otherwise. }
1394
+ begin
1395
+ ShopkeeperCanRepairMecha := ( NPC <> Nil ) and ( NAttValue( NPC^.NA , NAG_Skill , NAS_Repair ) > 5 );
1396
1396
end ;
1397
1397
1398
1398
Procedure ThisMechaWasSelected ( GB: GameBoardPtr; MekNum: Integer; PC,NPC: GearPtr );
@@ -1474,10 +1474,10 @@ procedure PurchaseGearMenu( GB: GameBoardPtr; PC,NPC,Part: GearPtr );
1474
1474
{ If this gear is a mecha, and it belongs to the PC, }
1475
1475
{ add it to the menu. }
1476
1476
if ( NAttValue( Mek^.NA , NAG_Location , NAS_Team ) = NAV_DefPlayerTeam ) and not GearActive( Mek ) then begin
1477
- msg := TeamMateName( Mek );
1478
-
1479
- msg2 := SAttValue( Mek^.SA , SATT_SALETAG );
1480
- if msg2 <> ' ' then msg := msg + ' (' + msg2 + ' )' ;
1477
+ msg := TeamMateName( Mek );
1478
+
1479
+ msg2 := SAttValue( Mek^.SA , SATT_SALETAG );
1480
+ if msg2 <> ' ' then msg := msg + ' (' + msg2 + ' )' ;
1481
1481
1482
1482
AddRPGMenuItem( RPM , msg , N );
1483
1483
end ;
0 commit comments