-
Notifications
You must be signed in to change notification settings - Fork 11
/
Copy pathCSpaceObjectTrade.cpp
808 lines (576 loc) · 18.4 KB
/
CSpaceObjectTrade.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
// CSpaceObjectTrade.cpp
//
// CSpaceObject class
// Copyright (c) 2014 by Kronosaur Productions, LLC. All Rights Reserved.
#include "PreComp.h"
#define STR_STATION_DESTROYED CONSTLIT("abandoned")
const int DAYS_TO_REFRESH_INVENTORY = 5;
void CSpaceObject::AddBuyOrder (CItemType *pType, const CString &sCriteria, int iPriceAdj)
// AddBuyOrder
//
// Adds an override buy order
{
CTradingDesc *pTrade = AllocTradeDescOverride();
pTrade->AddBuyOrder(pType, sCriteria, iPriceAdj);
}
void CSpaceObject::AddSellOrder (CItemType *pType, const CString &sCriteria, int iPriceAdj)
// AddSellOrder
//
// Adds an override sell order
{
CTradingDesc *pTrade = AllocTradeDescOverride();
pTrade->AddSellOrder(pType, sCriteria, iPriceAdj);
}
void CSpaceObject::AddTradeDesc (const CTradingDesc &Trade)
// AddTrade
//
// Adds trading entries
{
CTradingDesc *pTrade = AllocTradeDescOverride();
pTrade->AddOrders(Trade);
}
void CSpaceObject::AddTradeOrder (ETradeServiceTypes iService, const CString &sCriteria, CItemType *pItemType, int iPriceAdj)
// AddTradeOrder
//
// Adds a trade order to the override
{
CTradingDesc *pTrade = AllocTradeDescOverride();
pTrade->AddOrder(iService, sCriteria, pItemType, iPriceAdj);
}
CurrencyValue CSpaceObject::ChargeMoney (DWORD dwEconomyUNID, CurrencyValue iValue)
// ChargeMoney
//
// Subtract money. We return the remaining station balance or -1 if there
// isn't enough.
{
CCurrencyBlock *pMoney = GetCurrencyBlock();
if (pMoney == NULL)
return -1;
if (dwEconomyUNID == 0)
dwEconomyUNID = GetDefaultEconomyUNID();
if (iValue < 0 || pMoney->GetCredits(dwEconomyUNID) < iValue)
return -1;
return pMoney->IncCredits(dwEconomyUNID, -iValue);
}
CurrencyValue CSpaceObject::CreditMoney (DWORD dwEconomyUNID, CurrencyValue iValue)
// CreditMoney
//
// Add money to the account. We return the new balance or -1 if we failed
// somehow.
{
CCurrencyBlock *pMoney = GetCurrencyBlock(true);
if (pMoney == NULL)
return -1;
if (dwEconomyUNID == 0)
dwEconomyUNID = GetDefaultEconomyUNID();
if (iValue > 0)
return pMoney->IncCredits(dwEconomyUNID, iValue);
else
return pMoney->GetCredits(dwEconomyUNID);
}
bool CSpaceObject::GetArmorInstallPrice (const CItem &Item, DWORD dwFlags, int *retiPrice, CString *retsReason)
// GetArmorInstallPrice
//
// Returns the price to install the given armor
{
if (IsAbandoned())
return false;
// See if we have an override
CTradingDesc *pTradeOverride = GetTradeDescOverride();
if (pTradeOverride && pTradeOverride->GetArmorInstallPrice(this, Item, dwFlags, retiPrice))
return true;
// Otherwise, ask our design type
CDesignType *pType = GetType();
if (pType == NULL)
return false;
CTradingDesc *pTrade = pType->GetTradingDesc();
if (pTrade && pTrade->GetArmorInstallPrice(this, Item, dwFlags, retiPrice, retsReason))
return true;
// For compatibility, any ship prior to version 23 has a default.
// [For API Version 23 and above, ships must have a <Trade> descriptor.]
if (pType->GetAPIVersion() < 23
&& pType->GetType() == designShipClass)
{
if (retiPrice)
*retiPrice = CTradingDesc::CalcPriceForService(serviceReplaceArmor, this, Item, 1, dwFlags);
return true;
}
// Otherwise, we do not repair
return false;
}
bool CSpaceObject::GetArmorRepairPrice (CSpaceObject *pSource, const CItem &Item, int iHPToRepair, DWORD dwFlags, int *retiPrice)
// GetArmorRepairPrice
//
// Returns the price to repair the given number of HP for the given armor item.
{
if (IsAbandoned())
return false;
// See if we have an override
CTradingDesc *pTradeOverride = GetTradeDescOverride();
if (pTradeOverride && pTradeOverride->GetArmorRepairPrice(this, pSource, Item, iHPToRepair, dwFlags, retiPrice))
return true;
// Otherwise, ask our design type
CDesignType *pType = GetType();
if (pType == NULL)
return false;
CTradingDesc *pTrade = pType->GetTradingDesc();
if (pTrade && pTrade->GetArmorRepairPrice(this, pSource, Item, iHPToRepair, dwFlags, retiPrice))
return true;
// For compatibility, any ship prior to version 23 has a default.
// [For API Version 23 and above, ships must have a <Trade> descriptor.]
if (pType->GetAPIVersion() < 23
&& pType->GetType() == designShipClass)
{
if (retiPrice)
*retiPrice = CTradingDesc::CalcPriceForService(serviceRepairArmor, this, Item, iHPToRepair, dwFlags);
return true;
}
// Otherwise, we do not repair
return false;
}
CurrencyValue CSpaceObject::GetBalance (DWORD dwEconomyUNID)
// GetBalance
//
// Returns the current balance.
{
CCurrencyBlock *pMoney = GetCurrencyBlock();
if (pMoney == NULL)
return 0;
if (dwEconomyUNID == 0)
dwEconomyUNID = GetDefaultEconomyUNID();
return pMoney->GetCredits(dwEconomyUNID);
}
int CSpaceObject::GetBuyPrice (const CItem &Item, DWORD dwFlags, int *retiMaxCount)
// GetBuyPrice
//
// Returns the price at which the station will buy the given
// item. Also returns the max number of items that the station
// will buy at that price.
//
// Returns -1 if the station will not buy the item.
{
int iPrice;
if (IsAbandoned())
return -1;
// First see if we have an override
CTradingDesc *pTradeOverride = GetTradeDescOverride();
if (pTradeOverride && pTradeOverride->Buys(this, Item, dwFlags, &iPrice, retiMaxCount))
return iPrice;
// See if our type has a price
CDesignType *pType = GetType();
if (pType == NULL)
return -1;
CTradingDesc *pTrade = pType->GetTradingDesc();
if (pTrade && pTrade->Buys(this, Item, dwFlags, &iPrice, retiMaxCount))
return iPrice;
// Otherwise, we will not buy the item
return -1;
}
const CEconomyType *CSpaceObject::GetDefaultEconomy (void)
// GetDefaultEconomy
//
// Returns the default economy
{
CTradingDesc *pTradeOverride = GetTradeDescOverride();
if (pTradeOverride)
return pTradeOverride->GetEconomyType();
CDesignType *pType = GetType();
if (pType)
return pType->GetEconomyType();
return CEconomyType::AsType(g_pUniverse->FindDesignType(DEFAULT_ECONOMY_UNID));
}
DWORD CSpaceObject::GetDefaultEconomyUNID (void)
// GetDefaultEconomyUNID
//
// Returns the default economy
{
const CEconomyType *pCurrency = GetDefaultEconomy();
if (pCurrency)
return pCurrency->GetUNID();
return DEFAULT_ECONOMY_UNID;
}
bool CSpaceObject::GetDeviceInstallPrice (const CItem &Item, DWORD dwFlags, int *retiPrice, CString *retsReason, DWORD *retdwPriceFlags)
// GetDeviceInstallPrice
//
// Returns the price to install the given device
{
// Defaults to no reason
if (retsReason)
*retsReason = NULL_STR;
if (IsAbandoned())
return false;
// See if we have an override
CTradingDesc *pTradeOverride = GetTradeDescOverride();
if (pTradeOverride && pTradeOverride->GetDeviceInstallPrice(this, Item, dwFlags, retiPrice, retsReason, retdwPriceFlags))
return true;
// Otherwise, ask our design type
CDesignType *pType = GetType();
if (pType == NULL)
{
if (retsReason)
*retsReason = CONSTLIT("Unknown item.");
return false;
}
CTradingDesc *pTrade = pType->GetTradingDesc();
if (pTrade && pTrade->GetDeviceInstallPrice(this, Item, dwFlags, retiPrice, retsReason, retdwPriceFlags))
return true;
// Otherwise, we do not install
return false;
}
bool CSpaceObject::GetDeviceRemovePrice (const CItem &Item, DWORD dwFlags, int *retiPrice, DWORD *retdwPriceFlags)
// GetDeviceRemovePrice
//
// Returns the price to install the given device
{
if (IsAbandoned())
return false;
// See if we have an override
CTradingDesc *pTradeOverride = GetTradeDescOverride();
if (pTradeOverride && pTradeOverride->GetDeviceRemovePrice(this, Item, dwFlags, retiPrice, retdwPriceFlags))
return true;
// Otherwise, ask our design type
CDesignType *pType = GetType();
if (pType == NULL)
return false;
CTradingDesc *pTrade = pType->GetTradingDesc();
if (pTrade && pTrade->GetDeviceRemovePrice(this, Item, dwFlags, retiPrice, retdwPriceFlags))
return true;
// Otherwise, we do not remove
return false;
}
bool CSpaceObject::GetRefuelItemAndPrice (CSpaceObject *pObjToRefuel, CItemType **retpItemType, int *retiPrice)
// GetRefuelItemAndPrice
//
// Returns the appropriate item to use for refueling (based on the trading
// directives).
{
int i;
if (IsAbandoned())
return false;
// See if we have an override
CTradingDesc *pTradeOverride = GetTradeDescOverride();
if (pTradeOverride && pTradeOverride->GetRefuelItemAndPrice(this, pObjToRefuel, 0, retpItemType, retiPrice))
return true;
// Otherwise, ask our design type
CDesignType *pType = GetType();
if (pType == NULL)
return false;
CTradingDesc *pTrade = pType->GetTradingDesc();
if (pTrade && pTrade->GetRefuelItemAndPrice(this, pObjToRefuel, 0, retpItemType, retiPrice))
return true;
// For compatibility, any ship prior to version 23 has a default.
// [For API Version 23 and above, ships must have a <Trade> descriptor.]
if (pType->GetAPIVersion() < 23
&& pType->GetType() == designShipClass)
{
// Get the ship
CShip *pShipToRefuel = pObjToRefuel->AsShip();
if (pShipToRefuel == NULL)
return false;
// Find the highest-level item that can be used by the ship
int iBestLevel = 0;
int iBestPrice = 0;
CItemType *pBestItem = NULL;
for (i = 0; i < g_pUniverse->GetItemTypeCount(); i++)
{
CItemType *pType = g_pUniverse->GetItemType(i);
CItem Item(pType, 1);
if (pShipToRefuel->IsFuelCompatible(Item))
{
if (pBestItem == NULL || pType->GetLevel() > iBestLevel)
{
// Compute the price, because if we don't sell it, then we
// skip it.
//
// NOTE: Unlike selling, we allow 0 prices because some
// stations give fuel for free.
int iPrice = CTradingDesc::CalcPriceForService(serviceRefuel, this, Item, 1, 0);
if (iPrice >= 0)
{
pBestItem = pType;
iBestLevel = pType->GetLevel();
iBestPrice = iPrice;
}
}
}
}
if (pBestItem == NULL)
return false;
// Done
if (retpItemType)
*retpItemType = pBestItem;
if (retiPrice)
*retiPrice = iBestPrice;
return true;
}
// Otherwise, we do not refuel
return false;
}
int CSpaceObject::GetSellPrice (const CItem &Item, DWORD dwFlags)
// GetSellPrice
//
// Returns the price at which the station will sell the given
// item. Returns 0 if the station cannot or will not sell the
// item.
{
bool bHasTradeDirective = false;
int iPrice = -1;
if (IsAbandoned())
return 0;
// See if we have an override price
CTradingDesc *pTradeOverride = GetTradeDescOverride();
if (pTradeOverride)
{
pTradeOverride->Sells(this, Item, dwFlags, &iPrice);
bHasTradeDirective = true;
}
// See if our type has a price
CDesignType *pType = GetType();
if (iPrice == -1)
{
CTradingDesc *pTrade = (pType ? pType->GetTradingDesc() : NULL);
if (pTrade)
{
pTrade->Sells(this, Item, dwFlags, &iPrice);
bHasTradeDirective = true;
}
}
// If we still have no price, then try to figure out a default.
if (iPrice == -1)
{
// If we have Trade directives and they specify no price, then we can't
// sell any.
if (bHasTradeDirective)
return 0;
// For compatibility, any ship prior to version 23 has a default.
// [For API Version 23 and above, ships must have a <Trade> descriptor.]
else if (pType
&& pType->GetAPIVersion() < 23
&& pType->GetType() == designShipClass)
iPrice = CTradingDesc::CalcPriceForService(serviceSell, this, Item, 1, dwFlags);
// Otherwise, get the price from the item itself
else
iPrice = (int)GetDefaultEconomy()->Exchange(Item.GetCurrencyType(), Item.GetTradePrice(this));
}
// If we don't have any of the item, then we don't sell any
if (!(dwFlags & CTradingDesc::FLAG_NO_INVENTORY_CHECK))
{
CItemListManipulator ItemList(GetItemList());
if (!ItemList.SetCursorAtItem(Item))
return 0;
}
// Return the price
return iPrice;
}
bool CSpaceObject::GetShipBuyPrice (CShipClass *pClass, DWORD dwFlags, int *retiPrice)
// GetShipBuyPrice
//
// Returns the price for which we'd sell the given ship.
{
if (IsAbandoned())
return false;
// See if we have an override price
CTradingDesc *pTradeOverride = GetTradeDescOverride();
if (pTradeOverride && pTradeOverride->BuysShip(this, pClass, dwFlags, retiPrice))
return true;
// Otherwise, ask our design type
CDesignType *pType = GetType();
if (pType == NULL)
return false;
CTradingDesc *pTrade = pType->GetTradingDesc();
if (pTrade && pTrade->BuysShip(this, pClass, dwFlags, retiPrice))
return true;
// Otherwise, we do not sell.
return false;
}
bool CSpaceObject::GetShipBuyPrice (CSpaceObject *pShip, DWORD dwFlags, int *retiPrice)
// GetShipBuyPrice
//
// Returns the price for which we'd sell the given ship.
{
if (IsAbandoned())
return false;
// See if we have an override price
CTradingDesc *pTradeOverride = GetTradeDescOverride();
if (pTradeOverride && pTradeOverride->BuysShip(this, pShip, dwFlags, retiPrice))
return true;
// Otherwise, ask our design type
CDesignType *pType = GetType();
if (pType == NULL)
return false;
CTradingDesc *pTrade = pType->GetTradingDesc();
if (pTrade && pTrade->BuysShip(this, pShip, dwFlags, retiPrice))
return true;
// Otherwise, we do not sell.
return false;
}
bool CSpaceObject::GetShipSellPrice (CShipClass *pClass, DWORD dwFlags, int *retiPrice)
// GetShipSellPrice
//
// Returns the price for which we'd sell the given ship.
{
if (IsAbandoned())
return false;
// See if we have an override price
CTradingDesc *pTradeOverride = GetTradeDescOverride();
if (pTradeOverride && pTradeOverride->SellsShip(this, pClass, dwFlags, retiPrice))
return true;
// Otherwise, ask our design type
CDesignType *pType = GetType();
if (pType == NULL)
return false;
CTradingDesc *pTrade = pType->GetTradingDesc();
if (pTrade && pTrade->SellsShip(this, pClass, dwFlags, retiPrice))
return true;
// Otherwise, we do not sell.
return false;
}
bool CSpaceObject::GetShipSellPrice (CSpaceObject *pShip, DWORD dwFlags, int *retiPrice)
// GetShipSellPrice
//
// Returns the price for which we'd sell the given ship.
{
if (IsAbandoned())
return false;
// See if we have an override price
CTradingDesc *pTradeOverride = GetTradeDescOverride();
if (pTradeOverride && pTradeOverride->SellsShip(this, pShip, dwFlags, retiPrice))
return true;
// Otherwise, ask our design type
CDesignType *pType = GetType();
if (pType == NULL)
return false;
CTradingDesc *pTrade = pType->GetTradingDesc();
if (pTrade && pTrade->SellsShip(this, pShip, dwFlags, retiPrice))
return true;
// Otherwise, we do not sell.
return false;
}
int CSpaceObject::GetTradeMaxLevel (ETradeServiceTypes iService)
// GetTradeMaxLevel
//
// Returns the max tech level for this service.
{
int iMaxLevel = -1;
// See if we have an override
CTradingDesc *pTradeOverride = GetTradeDescOverride();
if (pTradeOverride)
{
int iLevel = pTradeOverride->GetMaxLevelMatched(iService);
if (iLevel > iMaxLevel)
iMaxLevel = iLevel;
}
// Ask base type
CDesignType *pType = GetType();
CTradingDesc *pTrade = (pType ? pType->GetTradingDesc() : NULL);
if (pTrade)
{
int iLevel = pTrade->GetMaxLevelMatched(iService);
if (iLevel > iMaxLevel)
iMaxLevel = iLevel;
}
return iMaxLevel;
}
bool CSpaceObject::HasTradeService (ETradeServiceTypes iService, const CTradingDesc::SHasServiceOptions &Options)
// HasTradeService
//
// Returns TRUE if we provide the given service.
{
// See if we have an override
CTradingDesc *pTradeOverride = GetTradeDescOverride();
if (pTradeOverride && pTradeOverride->HasService(iService, Options))
return true;
// Ask base type
CDesignType *pType = GetType();
CTradingDesc *pTrade = (pType ? pType->GetTradingDesc() : NULL);
if (pTrade && pTrade->HasService(iService, Options))
return true;
// No service
return false;
}
bool CSpaceObject::HasTradeUpgradeOnly (ETradeServiceTypes iService)
// HasTradeUpgradeOnly
//
// Returns TRUE if we provide the service for upgrade only.
{
// See if we have an override
CTradingDesc *pTradeOverride = GetTradeDescOverride();
if (pTradeOverride && pTradeOverride->HasServiceUpgradeOnly(iService))
return true;
// Ask base type
CDesignType *pType = GetType();
CTradingDesc *pTrade = (pType ? pType->GetTradingDesc() : NULL);
if (pTrade && pTrade->HasServiceUpgradeOnly(iService))
return true;
// No service
return false;
}
void CSpaceObject::SetTradeDesc (const CEconomyType *pCurrency, int iMaxCurrency, int iReplenishCurrency)
// SetTradeDesc
//
// Overrides trade desc
{
CTradingDesc *pTradeOverride = AllocTradeDescOverride();
if (pTradeOverride == NULL)
return;
pTradeOverride->SetEconomyType(pCurrency);
pTradeOverride->SetMaxCurrency(iMaxCurrency);
pTradeOverride->SetReplenishCurrency(iReplenishCurrency);
// This call will set up the currency.
pTradeOverride->OnCreate(this);
}
void CSpaceObject::UpdateTrade (SUpdateCtx &Ctx, int iInventoryRefreshed)
// UpdateTrade
//
// Updates trading directives. This creates new inventory, if necessary.
{
DEBUG_TRY
// Update override first
CTradingDesc *pTradeOverride = GetTradeDescOverride();
if (pTradeOverride)
{
pTradeOverride->OnUpdate(this);
if (!IsPlayerDocked())
pTradeOverride->RefreshInventory(this, iInventoryRefreshed);
}
// Handle base
CDesignType *pType = GetType();
CTradingDesc *pTrade = (pType ? pType->GetTradingDesc() : NULL);
if (pTrade)
{
// If we have a trade desc override, then don't update. [Otherwise
// we will replenish currency at double the rate.]
if (pTradeOverride == NULL)
pTrade->OnUpdate(this);
// But we still need to refresh inventory, since the base
// may contain items not in the override.
//
// LATER: Note that this doesn't handle the case where we try
// to override a specific item. The fix is to add the concept
// of overriding directly into the class.
if (!IsPlayerDocked())
pTrade->RefreshInventory(this, iInventoryRefreshed);
}
DEBUG_CATCH
}
void CSpaceObject::UpdateTradeExtended (const CTimeSpan &ExtraTime)
// UpdateTradeExtended
//
// Update trade after a long time.
{
// Refresh inventory, if necessary
CTradingDesc *pTradeOverride = GetTradeDescOverride();
CDesignType *pType = GetType();
CTradingDesc *pTrade = (pType ? pType->GetTradingDesc() : NULL);
if ((pTrade || pTradeOverride) && ExtraTime.Days() > 0 && !IsAbandoned())
{
// Compute the percent of the inventory that need to refresh
// (If % is >100 then we increase availability).
int iRefreshPercent = Min(300, 100 * ExtraTime.Days() / DAYS_TO_REFRESH_INVENTORY);
// Do it
if (pTradeOverride)
pTradeOverride->RefreshInventory(this, iRefreshPercent);
if (pTrade)
pTrade->RefreshInventory(this, iRefreshPercent);
}
}