Pol  Revision:4b29d2b
uoexpansion.h
Go to the documentation of this file.
1 #ifndef PLIB_UOEXPANSION_H
2 #define PLIB_UOEXPANSION_H
3 
4 #include "../clib/compilerspecifics.h"
5 #include "../clib/rawtypes.h"
6 
7 namespace Pol
8 {
9 namespace Plib
10 {
11 enum class B9Feature : u32
12 {
13  T2A = 0x01, // Chats, regions (1.25.35)
14  Renaissance = 0x02, // Trammel/felucca (2.0.0)
15  ThirdDawn = 0x04, // Ilshenar, 3D client (3.0.0)
16  LBR = 0x08, // LBR skills, map (3.0.7b)
17  AOS = 0x10, // AOS skills, map, spells, fightbook (3.0.8z)
18  Has6thSlot = 0x20, // 6th character slot (4.0.3a)
19  SE = 0x40, // SE Features + housing tiles (4.0.5a)
20  ML = 0x80, // ML features: elven race, spells, skills + housing tiles
21 
22  Splash8thAge = 0x100, // Splash screen 8th age (5.0.1a)
23 
24  CrystalShadowTiles = 0x200, // Splash screen 9th age + crystal/shadow house tiles (5.0.5a)
25  Splash9thAge = 0x200, // ^
26 
27  Splash10thAge = 0x400, // Splash screen 10th age (6.0.3.0 ??)
28 
29  IncreasedStorage = 0x800, // Increased house/bank storage (6.0.3.0 or earlier)
30 
31  Has7thSlot = 0x1000, // 7th character slot (6.0.3.0 or earlier)
32  KRFaces = 0x2000, // ?? (6.0.0.0 was KR release)
33 
34  TrialAcct = 0x4000,
35  LiveAcct = 0x8000,
36 
37  SA = 0x10000, // Gargoyle race, spells, skills (7.0.0.0)
38  HSA = 0x20000, // HSA features (7.0.9.0)
39  GothicTiles = 0x40000, // Gothic housing tiles (7.0.9.0)
40  RusticTiles = 0x80000, // Rustic housing tiles (7.0.9.0)
41 };
42 
43 enum class A9Feature : u32
44 {
45  Unk1 = 0x01, // Unknown, never sent by OSI
46  ConfigReqLogout = 0x02, // Send config/req logout (IGR? overwrite configuration button?)
47  SingleCharacter = 0x04, // Siege style 1 char/acct
48  ContextMenus = 0x08, // Enable NPC popup/context menus
49  LimitSlots = 0x10, // Limit character slots
50  AOS = 0x20, // AOS features (necromancer/paladin classes & tooltips) (3.0.8z)
51  Has6thSlot = 0x40, // 6th character slot (4.0.3a)
52 
53  SamuraiNinja = 0x80, // Samurai and Ninja classes (4.0.5a)
54  ElvenRace = 0x100, // (4.0.11d)
55 
56  Unk2 = 0x200, // Added with UOKR launch (6.0.0.0)
57  UO3DClientType = 0x400, // Send UO3D client type (client will send 0xE1 packet) (6.0.0.0)
58 
59  Unk3 = 0x800, // Added between UOKR and UOSA launch
60 
61  Has7thSlot = 0x1000, // 7th character slot, only 2D client (6.0.3.0 or earlier)
62 
63  Unk4 = 0x2000, // Added with UOSA launch (7.0.0.0)
64 
65  NewMovement = 0x4000, // New movement packets 0xF0 -> 0xF2 (7.0.0.0)
66  UnlockNewFeluccaAreas = 0x8000, // Unlock new felucca areas (factions map0x.mul and such)
67  // (7.0.0.0 - SA or HSA, not sure)
68 };
69 
70 
71 enum class ExpansionVersion : u8
72 {
73  T2A,
74  LBR,
75  AOS,
76  SE,
77  ML,
78  KR,
79  SA,
80  HSA,
81 
82  LastVersion = HSA
83 };
84 const int numExpansions = static_cast<int>( ExpansionVersion::LastVersion ) + 1;
85 const char* getExpansionName( ExpansionVersion x );
86 
87 
89 {
90 public:
91  virtual ~UOExpansion(){};
92  virtual bool hasFeature( A9Feature feature ) const = 0;
93  virtual bool hasFeature( B9Feature feature ) const = 0;
94  virtual u32 A9Flags() const = 0;
95  virtual u32 B9Flags() const = 0;
96 
97  virtual ExpansionVersion version() const { return ExpansionVersion::T2A; }
98  virtual int characterSlots() const { return 5; }
99 };
100 
102 {
104 
105 public:
106  ClientFeatures( UOExpansion& expansion ) : m_expansion( expansion ) {}
107  bool hasCustomHousing() const { return supports( ExpansionVersion::AOS ); }
108  bool hasSamuraiNinja() const { return m_expansion.hasFeature( A9Feature::SamuraiNinja ); }
109  bool hasElvenRace() const { return m_expansion.hasFeature( A9Feature::ElvenRace ); }
110  bool hasContextMenus() const { return m_expansion.hasFeature( A9Feature::ContextMenus ); }
111  bool hasNewMovementPacket() const { return m_expansion.hasFeature( A9Feature::NewMovement ); }
112  // Commonly used expansion
113  bool supportsAOS() const { return supports( ExpansionVersion::AOS ); }
114  bool supports( ExpansionVersion version ) const
115  {
116  ExpansionVersion myVersion = m_expansion.version();
117  return myVersion >= version;
118  }
119 
120 private: // noncopyable
121  ClientFeatures( const ClientFeatures& );
122  ClientFeatures& operator=( const ClientFeatures& );
123 };
124 
126 {
127 protected:
130  int m_slots;
132 
133 public:
134  FlagExpansion( u32 A9Flag, u32 B9Flag, int slots, ExpansionVersion version )
135  : m_A9Flag( A9Flag ), m_B9Flag( B9Flag ), m_slots( slots ), m_version( version )
136  {
137  }
138 
139  virtual u32 A9Flags() const POL_OVERRIDE { return m_A9Flag; }
140  virtual u32 B9Flags() const POL_OVERRIDE { return m_B9Flag; }
141  virtual bool hasFeature( A9Feature x ) const POL_OVERRIDE
142  {
143  return ( m_A9Flag & static_cast<u32>( x ) ) != 0;
144  }
145  virtual bool hasFeature( B9Feature x ) const POL_OVERRIDE
146  {
147  return ( m_B9Flag & static_cast<u32>( x ) ) != 0;
148  }
149 
150  virtual ExpansionVersion version() const POL_OVERRIDE { return m_version; }
151  virtual int characterSlots() const POL_OVERRIDE { return m_slots; }
152 };
153 }
154 }
155 #endif
bool hasNewMovementPacket() const
Definition: uoexpansion.h:111
unsigned char u8
Definition: rawtypes.h:25
virtual bool hasFeature(A9Feature x) const POL_OVERRIDE
Definition: uoexpansion.h:141
virtual int characterSlots() const POL_OVERRIDE
Definition: uoexpansion.h:151
#define POL_OVERRIDE
virtual ExpansionVersion version() const
Definition: uoexpansion.h:97
bool supportsAOS() const
Definition: uoexpansion.h:113
virtual bool hasFeature(A9Feature feature) const =0
virtual int characterSlots() const
Definition: uoexpansion.h:98
virtual ExpansionVersion version() const POL_OVERRIDE
Definition: uoexpansion.h:150
virtual u32 B9Flags() const POL_OVERRIDE
Definition: uoexpansion.h:140
FlagExpansion(u32 A9Flag, u32 B9Flag, int slots, ExpansionVersion version)
Definition: uoexpansion.h:134
bool hasCustomHousing() const
Definition: uoexpansion.h:107
const int numExpansions
Definition: uoexpansion.h:84
unsigned int u32
Definition: rawtypes.h:27
ClientFeatures(UOExpansion &expansion)
Definition: uoexpansion.h:106
const UOExpansion & m_expansion
Definition: uoexpansion.h:103
ExpansionVersion m_version
Definition: uoexpansion.h:131
virtual bool hasFeature(B9Feature x) const POL_OVERRIDE
Definition: uoexpansion.h:145
virtual u32 A9Flags() const POL_OVERRIDE
Definition: uoexpansion.h:139
bool hasSamuraiNinja() const
Definition: uoexpansion.h:108
bool supports(ExpansionVersion version) const
Definition: uoexpansion.h:114
bool hasContextMenus() const
Definition: uoexpansion.h:110
bool hasElvenRace() const
Definition: uoexpansion.h:109
const char * getExpansionName(ExpansionVersion x)
Definition: uoexpansion.cpp:12
Definition: berror.cpp:12