1 // Ryzom - MMORPG Framework <http://dev.ryzom.com/projects/ryzom/>
2 // Copyright (C) 2010 Winch Gate Property Limited
4 // This source file has been modified by the following contributors:
5 // Copyright (C) 2019 Jan BOON (Kaetemi) <jan.boon@kaetemi.be>
7 // This program is free software: you can redistribute it and/or modify
8 // it under the terms of the GNU Affero General Public License as
9 // published by the Free Software Foundation, either version 3 of the
10 // License, or (at your option) any later version.
12 // This program is distributed in the hope that it will be useful,
13 // but WITHOUT ANY WARRANTY; without even the implied warranty of
14 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 // GNU Affero General Public License for more details.
17 // You should have received a copy of the GNU Affero General Public License
18 // along with this program. If not, see <http://www.gnu.org/licenses/>.
22 #ifndef RY_PET_INTERFACE_MESSAGES_H
23 #define RY_PET_INTERFACE_MESSAGES_H
25 #include "nel/misc/types_nl.h"
26 #include "nel/misc/sheet_id.h"
28 #include "game_share/synchronised_message.h"
29 #include "game_share/mirror.h"
33 // Pet interface message class for AIS / EGS communication
35 //----------------------------------------------------------------
37 //----------------------------------------------------------------
38 class CPetSpawnMsg
: public CMirrorTransportClass
41 enum TSpawnMode
{ NEAR_PLAYER
= 0, NEAR_POINT
};
44 TDataSetRow CharacterMirrorRow
;
45 NLMISC::CSheetId PetSheetId
;
46 uint16 PetIdx
; // must be returned to EGS with CPetSpawnConfirmationMsg class
47 sint32 Coordinate_X
, Coordinate_Y
, Coordinate_H
; //For NEAR_POINT mode
49 float Heading
; //For NEAR_POINT mode
52 virtual void description ()
54 className ("CPetSpawnMsg");
55 property ("AIInstanceId", PropUInt32
, std::numeric_limits
<uint32
>::max(), AIInstanceId
);
56 property ("SpawnMode", PropUInt16
, (uint16
)NEAR_PLAYER
, SpawnMode
);
57 property ("CharacterMirrorRow", PropDataSetRow
, TDataSetRow(), CharacterMirrorRow
);
58 property ("PetSheetId", PropSheetId
, NLMISC::CSheetId::Unknown
, PetSheetId
);
59 property ("PetIndex", PropUInt16
, (uint16
)0, PetIdx
);
60 property ("Coordinate_X", PropSInt32
, (sint32
)0, Coordinate_X
);
61 property ("Coordinate_Y", PropSInt32
, (sint32
)0, Coordinate_Y
);
62 property ("Coordinate_H", PropSInt32
, (sint32
)0, Coordinate_H
);
63 property ("Cell", PropSInt32
, (sint32
)0, Cell
);
64 property ("Heading", PropFloat
, 0.0f
, Heading
);
65 property ("CustomName", PropUCString
, ucstring(""), CustomName
);
68 virtual void callback (const std::string
&/* name */, NLNET::TServiceId
/* id */) {}
72 //----------------------------------------------------------------
74 //----------------------------------------------------------------
75 class CPetSpawnConfirmationMsg
: public CMirrorTransportClass
83 CHARACTER_LAND_MAP_UNKNOWN
,
84 COORDINATE_NOT_IN_WORLD
,
90 TDataSetRow CharacterMirrorRow
;
91 TDataSetRow PetMirrorRow
; //If spawned
94 virtual void description ()
96 className ("CPetSpawnConfirmationMsg");
97 property ("SpawnError", PropUInt16
, (uint16
)NO_ERROR_SPAWN
, SpawnError
);
98 property ("CharacterMirrorRow", PropDataSetRow
, TDataSetRow(), CharacterMirrorRow
);
99 property ("PetMirrorRow", PropDataSetRow
, TDataSetRow(), PetMirrorRow
);
100 property ("PetIndex", PropUInt16
, (uint16
)0, PetIdx
);
102 virtual void callback (const std::string
&/* name */, NLNET::TServiceId
/* id */) {}
106 //----------------------------------------------------------------
108 //----------------------------------------------------------------
109 class CPetCommandMsg
: public CMirrorTransportClass
112 enum TCommand
{ STAND
= 0, FOLLOW
, GOTO_POINT
, GOTO_POINT_DESPAWN
, LIBERATE
, DESPAWN
};
113 enum TCommandError
{ COLLISION_NOT_VALIDNO_ERROR_SPAWN
= 0, CHARATER_UNKNOWN
, PET_SHEETID_UNKNOWN
, CHARACTER_LAND_MAP_UNKNOWN
, COORDINATE_NOT_IN_WORLD
, NOT_IMPLEMENTED
, INTERNAL_ERROR
};
115 TDataSetRow CharacterMirrorRow
;
116 TDataSetRow PetMirrorRow
;
117 sint32 Coordinate_X
, Coordinate_Y
, Coordinate_H
; //For GOTO_POINT, GOTO_POINT_DESPAWN and SPAWN_POINT commands
118 float Heading
; // For GOTO_POINT_DESPAWN commands (via stable)
120 virtual void description ()
122 className ("CPetCommandMsg");
123 property ("Command", PropUInt16
, (uint16
)STAND
, Command
);
124 property ("CharacterMirrorRow", PropDataSetRow
, TDataSetRow(), CharacterMirrorRow
);
125 property ("PetMirrorRow", PropDataSetRow
, TDataSetRow(), PetMirrorRow
);
126 property ("Coordinate_X", PropSInt32
, (sint32
)0, Coordinate_X
);
127 property ("Coordinate_Y", PropSInt32
, (sint32
)0, Coordinate_Y
);
128 property ("Coordinate_H", PropSInt32
, (sint32
)0, Coordinate_H
);
129 property ("Heading", PropFloat
, 0.0f
, Heading
);
132 virtual void callback (const std::string
&/* name */, NLNET::TServiceId
/* id */) {}
135 //----------------------------------------------------------------
136 // command confirmation
137 //----------------------------------------------------------------
138 class CPetCommandConfirmationMsg
: public CMirrorTransportClass
141 enum TCommandError
{ NO_ERROR_COMMAND
= 0, POSITION_COLLISION_NOT_VALID
};
143 TDataSetRow CharacterMirrorRow
;
144 TDataSetRow PetMirrorRow
;
146 CPetCommandConfirmationMsg()
149 CPetCommandConfirmationMsg(uint16 commandError
, const CPetCommandMsg
&msg
)
150 :CommandError(commandError
)
151 ,CharacterMirrorRow(msg
.CharacterMirrorRow
)
152 ,PetMirrorRow(msg
.PetMirrorRow
)
155 virtual void description ()
157 className ("CPetCommandConfirmationMsg");
158 property ("CommandError", PropUInt16
, (uint16
)NO_ERROR_COMMAND
, CommandError
);
160 virtual void callback (const std::string
&/* name */, NLNET::TServiceId
/* id */) {}
163 //----------------------------------------------------------------
165 //----------------------------------------------------------------
166 class CPetSetOwner
: public CMirrorTransportClass
170 TDataSetRow OwnerMirrorRow
;
171 TDataSetRow PetMirrorRow
;
173 virtual void description ()
175 className ("CPetSetOwner");
176 property ("OwnerMirrorRow", PropDataSetRow
, TDataSetRow(), OwnerMirrorRow
);
177 property ("PetMirrorRow", PropDataSetRow
, TDataSetRow(), PetMirrorRow
);
180 virtual void callback (const std::string
&/* name */, NLNET::TServiceId
/* id */) {}
183 #endif //RY_PET_INTERFACE_MESSAGES_H