Pol  Revision:cb584c9
spelbook.h
Go to the documentation of this file.
1 
10 #ifndef __SPELBOOK_H
11 #define __SPELBOOK_H
12 
13 #include "../clib/compilerspecifics.h"
14 #include "../clib/rawtypes.h"
15 #include "item/item.h"
16 #ifndef CONTAINR_H
17 #include "containr.h"
18 #endif
19 
20 namespace Pol
21 {
22 namespace Network
23 {
24 class Client;
25 namespace Pol
26 {
27 namespace Bscript
28 {
29 class BObjectImp;
30 class Executor;
31 } // namespace Bscript
32 namespace Clib
33 {
34 class ConfigElem;
35 class StreamWriter;
36 } // namespace Clib
37 namespace Items
38 {
39 class ItemDesc;
40 } // namespace Items
41 } // namespace Pol
42 }
43 namespace Items
44 {
45 class SpellbookDesc;
46 }
47 namespace Core
48 {
49 class Spellbook : public UContainer
50 {
51  typedef UContainer base;
52 
53 public:
54  explicit Spellbook( const Items::SpellbookDesc& descriptor );
55  virtual ~Spellbook();
56  virtual size_t estimatedSize() const POL_OVERRIDE;
57 
58  bool has_spellid( unsigned int spellid ) const;
59  bool remove_spellid( unsigned int spellid );
60  bool add_spellid( unsigned int spellid );
61  u8 bitwise_contents[8];
62  u8 spell_school;
63  virtual void add( Items::Item* item ) POL_OVERRIDE;
64  virtual void printProperties( Clib::StreamWriter& sw ) const POL_OVERRIDE;
65  virtual void readProperties( Clib::ConfigElem& elem ) POL_OVERRIDE;
66  virtual void printOn( Clib::StreamWriter& sw ) const POL_OVERRIDE;
67  virtual void printSelfOn( Clib::StreamWriter& sw ) const POL_OVERRIDE;
68  virtual void double_click( Network::Client* client ) POL_OVERRIDE;
69  void send_book_old( Network::Client* client );
70  virtual bool script_isa( unsigned isatype ) const POL_OVERRIDE;
71  virtual Bscript::BObjectImp* script_method( const char* methodname,
72  Bscript::Executor& ex ) POL_OVERRIDE;
73  virtual Bscript::BObjectImp* script_method_id( const int id, Bscript::Executor& ex ) POL_OVERRIDE;
74 
75 private:
76  virtual bool can_add( const Items::Item& item ) const POL_OVERRIDE;
77  virtual void add_bulk( int item_count_delta, int weight_delta ) POL_OVERRIDE;
78  void calc_current_bitwise_contents();
79 
80 protected:
81  friend class Items::Item;
82 };
83 
84 class USpellScroll : public Items::Item
85 {
86  typedef Items::Item base;
87 
88 public:
89  virtual ~USpellScroll(){};
90  virtual size_t estimatedSize() const POL_OVERRIDE;
91  virtual u16 get_senditem_amount() const POL_OVERRIDE;
92  static u16 convert_objtype_to_spellnum( u32 objtype, u8 school );
93 
94 protected:
95  explicit USpellScroll( const Items::ItemDesc& descriptor );
96  friend Items::Item* Items::Item::create( const Items::ItemDesc& itemdesc, u32 serial );
97 
98 private:
99 };
100 
101 void send_spellbook_contents( Network::Client* client, Spellbook& spellbook );
102 }
103 }
104 #endif
unsigned char u8
Definition: rawtypes.h:25
static Item * create(u32 objtype, u32 serial=0)
Definition: itemcr.cpp:53
#define POL_OVERRIDE
Items::Item base
Definition: spelbook.h:86
u16 convert_objtype_to_spellnum(u32 objtype, int school)
unsigned short u16
Definition: rawtypes.h:26
unsigned int u32
Definition: rawtypes.h:27
virtual ~USpellScroll()
Definition: spelbook.h:89
UContainer base
Definition: spelbook.h:51
void send_spellbook_contents(Network::Client *client, Spellbook &spellbook)
Definition: spelbook.cpp:384
Definition: berror.cpp:12