Pol  Revision:cb584c9
party.h
Go to the documentation of this file.
1 
7 #ifndef PARTY_H
8 #define PARTY_H
9 
10 #include <stddef.h>
11 #include <vector>
12 
13 #include "../clib/rawtypes.h"
14 #include "../clib/refptr.h"
15 #include "proplist.h"
16 
17 namespace Pol
18 {
19 namespace Clib
20 {
21 class ConfigElem;
22 } // namespace Clib
23 } // namespace Pol
24 
25 namespace Pol
26 {
27 namespace Clib
28 {
29 class StreamWriter;
30 }
31 namespace Mobile
32 {
33 class Character;
34 }
35 namespace Network
36 {
37 class Client;
38 }
39 namespace Module
40 {
41 class EPartyRefObjImp;
42 }
43 
44 namespace Core
45 {
46 struct PKTBI_BF;
47 
48 void handle_add( Network::Client* client, PKTBI_BF* msg );
49 void handle_remove( Network::Client* client, PKTBI_BF* msg );
50 void handle_member_msg( Network::Client* client, PKTBI_BF* msg );
51 void handle_party_msg( Network::Client* client, PKTBI_BF* msg );
52 void handle_loot_perm( Network::Client* client, PKTBI_BF* msg );
53 void handle_accept_invite( Network::Client* client, PKTBI_BF* msg );
54 void handle_decline_invite( Network::Client* client, PKTBI_BF* msg );
55 
56 class Party : public ref_counted
57 {
58 public:
59  explicit Party( Clib::ConfigElem& elem );
60  explicit Party( u32 serial );
61  bool is_leader( u32 serial ) const;
62  bool is_member( u32 serial ) const;
63  bool is_candidate( u32 serial ) const;
64  bool register_with_members();
65  bool add_candidate( u32 serial );
66  bool add_member( u32 serial );
67  void add_offline_mem( u32 serial );
68  bool remove_candidate( u32 serial );
69  bool remove_member( u32 serial );
70  bool remove_offline_mem( u32 serial );
71  void set_leader( u32 serial );
72  void send_remove_member( Mobile::Character* chr, bool* disband );
73  void send_member_list( Mobile::Character* to_chr );
74  void send_msg_to_all( unsigned int clilocnr, const char* affix = 0,
75  Mobile::Character* exeptchr = nullptr ) const;
76  bool test_size() const;
77  bool can_add() const;
78  void disband();
79  void send_stat_to( Mobile::Character* chr, Mobile::Character* bob ) const;
80  void send_stats_on_add( Mobile::Character* newmember ) const;
81  void on_mana_changed( Mobile::Character* chr ) const;
82  void on_stam_changed( Mobile::Character* chr ) const;
83  void send_member_msg_public( Mobile::Character* chr, u16* wtext, size_t wtextlen ) const;
84  void send_member_msg_private( Mobile::Character* chr, Mobile::Character* tochr, u16* wtext,
85  size_t wtextlen ) const;
86  u32 leader() const;
87  void printOn( Clib::StreamWriter& sw ) const;
88  u32 get_member_at( unsigned short pos ) const;
89  void cleanup();
90  size_t estimateSize() const;
91 
93 
94 private:
95  std::vector<u32> _member_serials;
96  std::vector<u32> _candidates_serials;
97  std::vector<u32> _offlinemember_serials;
100 };
101 
102 void send_invite( Mobile::Character* member, Mobile::Character* leader );
103 void add_candidate( Mobile::Character* member, Mobile::Character* leader );
104 void disband_party( u32 leader );
109 void invite_timeout( Mobile::Character* mem );
110 }
111 }
112 #endif
u32 _leaderserial
Definition: party.h:98
std::vector< u32 > _offlinemember_serials
Definition: party.h:97
void invite_timeout(Mobile::Character *mem)
Definition: party.cpp:1412
void handle_party_msg(Network::Client *client, PKTBI_BF *msg)
Definition: party.cpp:1174
void add_candidate(Mobile::Character *member, Mobile::Character *leader)
Definition: party.cpp:1342
unsigned short u16
Definition: rawtypes.h:26
unsigned int u32
Definition: rawtypes.h:27
void handle_add(Network::Client *client, PKTBI_BF *msg)
Definition: party.cpp:995
void on_loggon_party(Mobile::Character *chr)
Definition: party.cpp:923
void send_empty_party(Mobile::Character *chr)
Definition: party.cpp:795
void on_loggoff_party(Mobile::Character *chr)
Definition: party.cpp:878
void handle_loot_perm(Network::Client *client, PKTBI_BF *msg)
Definition: party.cpp:1262
void disband_party(u32 leader)
Definition: party.cpp:824
void handle_member_msg(Network::Client *client, PKTBI_BF *msg)
Definition: party.cpp:1115
void handle_accept_invite(Network::Client *client, PKTBI_BF *msg)
Definition: party.cpp:1278
std::vector< u32 > _member_serials
Definition: party.h:95
void send_attributes_normalized(Mobile::Character *chr, Mobile::Character *bob)
Definition: party.cpp:1452
void handle_decline_invite(Network::Client *client, PKTBI_BF *msg)
Definition: party.cpp:1310
PropertyList _proplist
Definition: party.h:99
void handle_remove(Network::Client *client, PKTBI_BF *msg)
Definition: party.cpp:1053
std::vector< u32 > _candidates_serials
Definition: party.h:96
Definition: berror.cpp:12
void send_invite(Mobile::Character *member, Mobile::Character *leader)
Definition: party.cpp:1438