Merge branch 'fixes' into main/rendor-staging
[ryzomcore.git] / ryzom / common / src / game_share / outpost.h
blob260410aaea6efe2d45fa9dad9edb48762c358f7c
1 // Ryzom - MMORPG Framework <http://dev.ryzom.com/projects/ryzom/>
2 // Copyright (C) 2010 Winch Gate Property Limited
3 //
4 // This program is free software: you can redistribute it and/or modify
5 // it under the terms of the GNU Affero General Public License as
6 // published by the Free Software Foundation, either version 3 of the
7 // License, or (at your option) any later version.
8 //
9 // This program is distributed in the hope that it will be useful,
10 // but WITHOUT ANY WARRANTY; without even the implied warranty of
11 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 // GNU Affero General Public License for more details.
14 // You should have received a copy of the GNU Affero General Public License
15 // along with this program. If not, see <http://www.gnu.org/licenses/>.
17 /** @page outpost
19 The new outpost system is defined by the document outpost-v2.doc.
23 #ifndef RY_OUTPOSTENUMS_H
24 #define RY_OUTPOSTENUMS_H
26 #include "nel/misc/types_nl.h"
28 namespace OUTPOSTENUMS
30 const uint32 MAX_OUTPOST = 16; // Same as (#x) in the database SERVER:GUILD:OUTPOST:O#x:S see (database.xml)
32 const uint32 OUTPOST_MAX_SPAWN_ZONE = 16; // Same as (#y) in the database SERVER:GUILD:OUTPOST:O#x:SPAWN_ZONE:#y see (database.xml)
33 const uint32 OUTPOST_MAX_SQUAD_SHOP = 16; // Same as (#y) in the database SERVER:GUILD:OUTPOST:O#x:SQUAD_SHOP:#y see (database.xml)
35 const uint32 OUTPOST_NB_BUYABLE_SQUAD_SLOTS = 6;
36 const uint32 OUTPOST_NB_SQUAD_SLOTS = 12;
37 const uint32 OUTPOST_MAX_SQUAD_TRAINING = OUTPOST_NB_SQUAD_SLOTS * 2; // Same as (#y) in the database SERVER:GUILD:OUTPOST:SQUADS:SP#y see (database.xml)
38 const uint32 OUTPOST_MAX_SQUAD_SPAWNED = OUTPOST_MAX_SQUAD_TRAINING; // Same as (#y) in the database SERVER:GUILD:OUTPOST:SQUADS:T#y see (database.xml)
40 const uint32 OUTPOST_MAX_BUILDINGS = 4; // Same as (#y) in the database SERVER:GUILD:OUTPOST:O#x:BUILDINGS:#y see (database.xml)
43 // :NOTE: All enums fisrt entry is the undefined state. Uninitialized
44 // enums would be created in that state, which is invalid. It will
45 // consistently take the value 0.
47 /// PVP type of the outpost
48 enum TPVPType
50 UnknownPVPType,
51 PVE, // can only be attacked if the outpost is held by a tribe and if the attacking guild comes from the same continent as the outpost
52 PVP, // can only be attacked if the attacking guild comes from the same continent as the outpost
53 RVR, // can only be attacked if the attacking guild comes from another continent as the outpost
54 Full, // same as RVR but cant be set by the high council
55 GVE, // Only one guild vs tribes
56 GVG, // Only one guild vs another guild
59 enum TPVPSide
61 OutpostOwner = 0,
62 OutpostAttacker = 1,
63 UnknownPVPSide
66 // :NOTE: The outpost state machine is defined by a list of possible
67 // states for the outpost, a list of possible events, a list of possible
68 // actions (which can change the state of the outpost), and some event
69 // handlers. It is possible to associate an event handler to a state/event
70 // pair. An event handler can call some actions, which may affect the
71 // current state of the outpost or some internal variables of it.
73 /// current state of the outpost
74 enum TOutpostState
76 UnknownOutpostState,
77 Peace, // nothing happens
78 WarDeclaration, // a guild declared war on the outpost
79 AttackBefore, // the delay between war declaration and war has elapsed. Attacker tries to take the outpost
80 AttackRound, // ...
81 AttackAfter,
82 DefenseBefore, // the attack was successful. The attacker must now defend the outpost
83 DefenseRound, // ...
84 DefenseAfter
87 /// events that can affect outpost state
88 enum TOutpostEvent
90 UnknownOutpostEvent,
91 StartOfState, // this is when the state starts
92 EndOfState, // this is when the state ends
93 Challenged, // the outpost was challenged
94 OwnerVanished, // the owner guild vanished
95 AttackerVanished, // the attacker guild vanished
96 Timer0End, // the current state timer reached its end, there may
97 Timer1End, // be 3 concurrent timers, one for the phase, one
98 Timer2End, // for the combat round, and one for the squad spawn
99 AttackerGiveUp, // the attack guild gave up the attack
100 OwnerGiveUp, // the owner guild gave up the outpost
101 SquadKilled, // a defending squad was killed
102 EventAisUp, // the ais of the outpost started (or we did)
103 EventAisDown, // the ais of the outpost stopped
104 // AllSquadsKilled, // all defending squads were killed
107 /// type of the squad
108 enum TSquadType
110 UnknownSquadType,
111 Default, // squad recruited automatically when the outpost is taken
112 Recruited, // squad recruited by the guild
113 Mercenary // a special mercenary squad
116 /// current state of a building used for database
117 enum TOutpostBuildingState
119 UnknownOutpostBuildingState,
120 BuildingInPlace, // In place (constructed)
121 BuildingConstructing // Constructing
124 /// current state of a state
125 enum TSquadState
127 UnknownSquadState,
128 NotCreated, // squad has not been created in AIS
129 NotReady, // squad is not ready to be spawned
130 NotSpawned, // squad is ready and waiting to be spawned
131 Spawning, // spawn order has been issued but not yet confirmed
132 Spawned, // squad is spawned
133 Dead // squad is dead
136 /// events that can affect outpost state
137 enum TSpecialOutpostEvent
139 UnknownSpecialOutpostEvent,
140 PeaceStateBegin, // State of outpost is now peace
141 PeaceStateEnd, // State of outpost is no more peace
142 TribeOwnershipBegin, // Owner of the outpost is now a tribe (even if not in peace)
143 TribeOwnershipEnd, // Owner of the outpost is no more a tribe
144 GuildOwnershipBegin, // Owner of the outpost is now a guild (even if not in peace)
145 GuildOwnershipEnd, // Owner of the outpost is no more a guild
146 StateChanged, // State of outpost changed
147 OwnerChanged, // Owner of outpost changed
148 AttackerChanged // Attacker of outpost changed
151 std::string const& toString(TPVPType val);
152 TPVPType toPVPType(std::string const& val);
153 std::string const& toString(TPVPSide val);
154 TPVPSide toPVPSide(std::string const& val);
155 std::string const& toString(TOutpostState val);
156 TOutpostState toOutpostState(std::string const& val);
157 std::string const& toString(TOutpostEvent val);
158 TOutpostEvent toOutpostEvent(std::string const& val);
159 std::string const& toString(TSquadType val);
160 TSquadType toSquadType(std::string const& val);
161 std::string const& toString(TSquadState val);
162 TSquadState toSquadState(std::string const& val);
163 std::string const& toString(TSpecialOutpostEvent val);
164 TSpecialOutpostEvent toSpecialOutpostEvent(std::string const& val);
168 #endif