-
Notifications
You must be signed in to change notification settings - Fork 33
/
InventoryOwner.h
249 lines (201 loc) · 8.37 KB
/
InventoryOwner.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
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
/////////////////////////////////////////////////////
// Äëÿ ïåðñîíàæåé, èìåþùèõ èíâåíòàðü
// InventoryOwner.h
//////////////////////////////////////////////////////
#pragma once
#include "InfoPortionDefs.h"
#include "pda_space.h"
#include "attachment_owner.h"
#include "script_space_forward.h"
#include "character_info.h"
#include "inventory_space.h"
#include "script_export_space.h"
class CSE_Abstract;
class CInventory;
class CInventoryItem;
class CTrade;
class CPda;
class CGameObject;
class CEntityAlive;
class CCustomZone;
class CInfoPortionWrapper;
class NET_Packet;
class CCharacterInfo;
class CSpecificCharacter;
class CTradeParameters;
class CPurchaseList;
class CWeapon;
class CCustomOutfit;
class CInventoryOwner : public CAttachmentOwner {
public:
CInventoryOwner ();
virtual ~CInventoryOwner ();
public:
virtual CInventoryOwner* cast_inventory_owner () {return this;}
public:
virtual DLL_Pure *_construct ();
virtual BOOL net_Spawn (CSE_Abstract* DC);
virtual void net_Destroy ();
void Init ();
virtual void Load (LPCSTR section);
virtual void reinit ();
virtual void reload (LPCSTR section);
virtual void OnEvent (NET_Packet& P, u16 type);
//serialization
virtual void save (NET_Packet &output_packet);
virtual void load (IReader &input_packet);
//îáíîâëåíèå
virtual void UpdateInventoryOwner (u32 deltaT);
virtual bool CanPutInSlot (PIItem item, u32 slot){return true;};
CPda* GetPDA () const;
// èíâåíòàðü
CInventory *m_inventory;
////////////////////////////////////
//òîðãîâëÿ è îáùåíèå ñ ïåðñîíàæåì
virtual bool AllowItemToTrade (CInventoryItem const * item, const SInvItemPlace& place) const;
virtual void OnFollowerCmd (int cmd) {};//redefine for CAI_Stalkker
bool bDisableBreakDialog;
//èíèöèàëèçàöèÿ îáúåêòà òîðãîâëè
CTrade* GetTrade();
//äëÿ âêëþ÷åíèÿ ðàçãîâîðà
virtual bool OfferTalk (CInventoryOwner* talk_partner);
virtual void StartTalk (CInventoryOwner* talk_partner, bool start_trade = true);
virtual void StopTalk ();
virtual bool IsTalking ();
void StartTrading ();
void StopTrading ();
bool IsTrading ();
virtual void EnableTalk () {m_bAllowTalk = true;}
virtual void DisableTalk () {m_bAllowTalk = false;}
virtual bool IsTalkEnabled () { return m_bAllowTalk;}
void EnableTrade () {m_bAllowTrade = true;}
void DisableTrade () {m_bAllowTrade = false;}
bool IsTradeEnabled () { return m_bAllowTrade;}
void EnableInvUpgrade () {m_bAllowInvUpgrade = true;}
void DisableInvUpgrade () {m_bAllowInvUpgrade = false;}
bool IsInvUpgradeEnabled () { return m_bAllowInvUpgrade;}
CInventoryOwner* GetTalkPartner() {return m_pTalkPartner;}
virtual void NewPdaContact (CInventoryOwner*);
virtual void LostPdaContact (CInventoryOwner*);
//èãðîâîå èìÿ
virtual LPCSTR Name () const;
LPCSTR IconName () const;
u32 get_money () const {return m_money;}
void set_money (u32 amount, bool bSendEvent);
bool is_alive ();
protected:
u32 m_money;
// òîðãîâëÿ
CTrade* m_pTrade;
bool m_bTrading;
bool m_bTalking;
CInventoryOwner* m_pTalkPartner;
bool m_bAllowTalk;
bool m_bAllowTrade;
bool m_bAllowInvUpgrade;
u16 m_tmp_active_slot_num;
bool m_play_show_hide_reload_sounds;
//////////////////////////////////////////////////////////////////////////
// ñþæåòíàÿ èíôîðìàöèÿ
public:
//ïåðñîíàæ ïîëó÷èë íîâóþ ïîðöèþ èíôîðìàöèè
virtual bool OnReceiveInfo (shared_str info_id) const;
//óáðàòü èíôîðìàöèþ
virtual void OnDisableInfo (shared_str info_id) const;
//ïåðåäàòü/óäàëèòü èíôîðìàöèþ ÷åðåç ñåðâåð
virtual void TransferInfo (shared_str info_id, bool add_info) const;
//åñòü ëè èíôîðìàöèÿ ó ïåðñîíàæà
virtual bool HasInfo (shared_str info_id) const;
// virtual bool GetInfo (shared_str info_id, INFO_DATA&) const;
#ifdef DEBUG
void CInventoryOwner::DumpInfo() const;
#endif
CInfoPortionWrapper *m_known_info_registry;
//////////////////////////////////////////////////////////////////////////
// èíâåíòàðü
public:
const CInventory &inventory() const {VERIFY (m_inventory); return(*m_inventory);}
CInventory &inventory() {VERIFY (m_inventory); return(*m_inventory);}
//âîçâðàùàåò òåêóøèé ðàçáðîñ ñòðåëüáû (â ðàäèàíàõ) ñ ó÷åòîì äâèæåíèÿ
virtual float GetWeaponAccuracy () const;
//ìàêñèìàëüíûé ïåðåíîñèìû âåñ
virtual float MaxCarryWeight () const;
CCustomOutfit* GetOutfit () const;
bool CanPlayShHdRldSounds () const {return m_play_show_hide_reload_sounds;};
void SetPlayShHdRldSounds (bool play) {m_play_show_hide_reload_sounds = play;};
//////////////////////////////////////////////////////////////////////////
//èãðîâûå õàðàêòåðèñòèêè ïåðñîíàæà
public:
CCharacterInfo& CharacterInfo () const {VERIFY(m_pCharacterInfo); return *m_pCharacterInfo;}
IC const CSpecificCharacter& SpecificCharacter () const {return CharacterInfo().m_SpecificCharacter;};
bool InfinitiveMoney () {return CharacterInfo().m_SpecificCharacter.MoneyDef().inf_money;}
//óñòàíîâêà ãðóïïèðîâêè íà êëèåíòñêîì è ñåðâåðíîì îáúêòå
virtual void SetCommunity (CHARACTER_COMMUNITY_INDEX);
virtual void SetRank (CHARACTER_RANK_VALUE);
virtual void ChangeRank (CHARACTER_RANK_VALUE);
virtual void SetReputation (CHARACTER_REPUTATION_VALUE);
virtual void ChangeReputation(CHARACTER_REPUTATION_VALUE);
virtual void SetIcon(const shared_str& iconName){ CharacterInfo().m_SpecificCharacter.data()->m_icon_name = iconName; };
//äëÿ ðàáîòû ñ relation system
u16 object_id () const;
CHARACTER_COMMUNITY_INDEX Community () const {return CharacterInfo().Community().index();};
CHARACTER_RANK_VALUE Rank () const {return CharacterInfo().Rank().value();};
CHARACTER_REPUTATION_VALUE Reputation () const {return CharacterInfo().Reputation().value();};
float Sympathy () const {return CharacterInfo().Sympathy(); }
protected:
CCharacterInfo* m_pCharacterInfo;
xr_string m_game_name;
public:
virtual void renderable_Render ();
virtual void OnItemTake (CInventoryItem *inventory_item);
virtual void OnItemBelt (CInventoryItem *inventory_item, const SInvItemPlace& previous_place);
virtual void OnItemRuck (CInventoryItem *inventory_item, const SInvItemPlace& previous_place);
virtual void OnItemSlot (CInventoryItem *inventory_item, const SInvItemPlace& previous_place);
virtual void OnItemDrop (CInventoryItem *inventory_item, bool just_before_destroy);
virtual void OnItemDropUpdate ();
virtual bool use_bolts () const {return(true);}
virtual void spawn_supplies ();
protected:
shared_str m_item_to_spawn;
u32 m_ammo_in_box_to_spawn;
public:
IC const shared_str &item_to_spawn () const {return m_item_to_spawn;}
IC const u32 &ammo_in_box_to_spawn () const {return m_ammo_in_box_to_spawn;}
public:
virtual bool unlimited_ammo () = 0;
virtual void on_weapon_shot_start (CWeapon *weapon);
virtual void on_weapon_shot_update ();
virtual void on_weapon_shot_stop ();
virtual void on_weapon_shot_remove (CWeapon *weapon);
virtual void on_weapon_hide (CWeapon *weapon);
public:
virtual bool use_simplified_visual () const {return (false);};
private:
CTradeParameters *m_trade_parameters;
CPurchaseList *m_purchase_list;
BOOL m_need_osoznanie_mode;
bool m_deadbody_can_take;
bool m_deadbody_closed;
public:
IC CTradeParameters &trade_parameters () const;
virtual LPCSTR trade_section () const;
float deficit_factor (const shared_str §ion) const;
void buy_supplies (CInifile &ini_file, LPCSTR section);
void sell_useless_items ();
virtual void on_before_sell (CInventoryItem *item) {}
virtual void on_before_buy (CInventoryItem *item) {}
virtual bool can_use_dynamic_lights () {return true;}
virtual bool use_default_throw_force ();
virtual float missile_throw_force ();
virtual bool use_throw_randomness ();
virtual bool NeedOsoznanieMode () {return m_need_osoznanie_mode!=FALSE;}
void deadbody_can_take (bool status);
IC bool deadbody_can_take_status() const { return m_deadbody_can_take; }
void deadbody_closed (bool status);
IC bool deadbody_closed_status () const { return m_deadbody_closed; }
DECLARE_SCRIPT_REGISTER_FUNCTION
};
#include "inventory_owner_inline.h"
add_to_type_list(CInventoryOwner)
#undef script_type_list
#define script_type_list save_type_list(CInventoryOwner)