forked from CleverRaven/Cataclysm-DDA
-
Notifications
You must be signed in to change notification settings - Fork 0
/
npctrade.h
68 lines (59 loc) · 2.21 KB
/
npctrade.h
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
#pragma once
#ifndef CATA_SRC_NPCTRADE_H
#define CATA_SRC_NPCTRADE_H
#include <list>
#include <string>
#include <utility>
#include <vector>
#include "item_location.h"
#include "trade_ui.h"
#include "units_fwd.h"
constexpr char const *VAR_TRADE_IGNORE = "trade_ignore";
class Character;
class item;
class npc;
struct faction_price_rule;
class item_pricing
{
public:
item_pricing( Character &c, item &it, int v, int count ) : loc( c, &it ), price( v ) {
set_values( count );
}
item_pricing( item_location &&l, int v, int count ) : loc( std::move( l ) ), price( v ) {
set_values( count );
}
void set_values( int ip_count );
item_location loc;
int price = 0;
// Whether this is selected for trading
bool selected = false;
bool is_container = false;
int count = 0;
int charges = 0;
int u_has = 0;
int npc_has = 0;
int u_charges = 0;
int npc_charges = 0;
units::mass weight = 0_gram;
units::volume vol = 0_ml;
};
namespace npc_trading
{
bool pay_npc( npc &np, int cost );
int bionic_install_price( Character &installer, Character &patient, item_location const &bionic );
int adjusted_price( item const *it, int amount, Character const &buyer, Character const &seller );
int trading_price( Character const &buyer, Character const &seller,
trade_selector::entry_t const &it );
int calc_npc_owes_you( const npc &np, int your_balance );
bool npc_will_accept_trade( npc const &np, int your_balance );
bool npc_can_fit_items( npc const &np, trade_selector::select_t const &to_trade );
void update_npc_owed( npc &np, int your_balance, int your_sale_value );
int cash_to_favor( const npc &, int cash );
std::list<item> transfer_items( trade_selector::select_t &stuff, Character &giver,
Character &receiver, std::list<item_location *> &from_map,
bool use_escrow );
double net_price_adjustment( const Character &buyer, const Character &seller );
bool trade( npc &p, int cost, const std::string &deal );
std::vector<item_pricing> init_selling( npc &p );
} // namespace npc_trading
#endif // CATA_SRC_NPCTRADE_H