1 // Ryzom - MMORPG Framework <http://dev.ryzom.com/projects/ryzom/>
2 // Copyright (C) 2010 Winch Gate Property Limited
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.
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/>.
19 #ifndef RY_SABRINA_ACTOR_PLAYER_H
20 #define RY_SABRINA_ACTOR_PLAYER_H
23 #include "nel/misc/types_nl.h"
25 #include "sabrina_pointers.h"
26 #include "sabrina_actor.h"
29 //------------------------------------------------------------------------------------------------------
31 //------------------------------------------------------------------------------------------------------
35 const uint32 SLOTS_PER_MEMORY_BANK
= 20;
39 //------------------------------------------------------------------------------------------------------
40 // CSabrinaActorPlayer - Player specialisation of Sabrina actor class
41 //------------------------------------------------------------------------------------------------------
43 class CSabrinaActorPlayer
: public ISabrinaActor
46 //------------------------------------------------------------------------------------------------------
48 CSabrinaActorPlayer(CEntityBase
*parent
);
49 CSabrinaActorPlayer(const CSabrinaActorPlayer
& other
);
50 virtual ~CSabrinaActorPlayer();
52 //------------------------------------------------------------------------------------------------------
53 // Virtual application of results of a Sabrina Action to a target
55 virtual void cbSabrinaActionApplyBegin();
56 virtual void applyHeal(SABRINA::THealType healType
, uint32 healQuantity
);
57 virtual void applyDamage(SABRINA::TDmgType damageType
, uint32 damage
);
58 virtual void applyBeginSecondaryEffect(SABRINA::TEffectType effectType
, uint32 strength
);
59 virtual void applyEndSecondaryEffect(SABRINA::TEffectType effectType
);
60 virtual void cbSabrinaActionApplyEnd();
63 //------------------------------------------------------------------------------------------------------
64 // Virtual Read Accessor Interface
66 virtual sint32
getSkillValue(SKILLS::ESkills skill
) const;
67 virtual sint32
getAttackSkillValue() const;
68 virtual sint32
getDefenseSkillValue() const;
69 virtual sint32
getDodgeSkillValue() const;
70 virtual bool getRightHandWeaponStats(CWeaponStats
& stats
) const;
71 virtual bool getLeftHandWeaponStats(CWeaponStats
& stats
) const;
72 virtual bool getAmmoStats(CWeaponStats
& stats
) const;
73 virtual bool getArmorProtectionStats(SLOT_EQUIPMENT::TSlotEquipment slot
,CArmorStats
& protection
) const;
74 virtual bool getLeftHandProtectionStats(CShieldStats
& protection
) const;
75 virtual ISabrinaActor
* getTarget() const;
78 //------------------------------------------------------------------------------------------------------
79 // Logical test routines
81 virtual bool isValidOffensiveTarget(ISabrinaActor
* target
) const;
82 virtual bool isValidCurativeTarget(ISabrinaActor
* target
) const;
85 //------------------------------------------------------------------------------------------------------
86 // Management of the player's own actions
88 virtual void beginSabrinaAction(const ISabrinaPhraseModel
* phrase
);
89 virtual void cancelSabrinaAction(SABRINA::TEventCode reason
);
92 //------------------------------------------------------------------------------------------------------
93 // Virtual callbacks for message sending on activation/ cancelation of Sabrina actions
95 virtual void cbSabrinaActionBegin(const CSabrinaPhraseInstance
* completedPhrase
);
96 virtual void cbSabrinaActionSuccess(const CSabrinaPhraseInstance
* completedPhrase
, SABRINA::TEventCode code
);
97 virtual void cbSabrinaActionFailure(const CSabrinaPhraseInstance
* completedPhrase
, SABRINA::TEventCode code
);
98 virtual void cbSabrinaActionCancel(const CSabrinaPhraseInstance
* completedPhrase
, SABRINA::TEventCode code
);
99 virtual void cbSabrinaActionEnd(const CSabrinaPhraseInstance
* completedPhrase
);
102 //------------------------------------------------------------------------------------------------------
103 // Cyclic action management methods
105 /// set the cyclic action
106 void setCyclicAction( ISabrinaPhraseModel
*phrase
);
108 /// stop the cyclic action
109 void stopCyclicAction(const TDataSetRow
&entityRowId
);
112 //------------------------------------------------------------------------------------------------------
113 // Management of the player's phrase memory
115 // add memory banks (used at player connection to creat memory set)
116 // note that memory bank names are limited to 7 letters
117 void addMemoryBank(const std::string
& memoryBankName
);
119 // memorize a phrase in a slot in a memory bank
120 void memorize(const std::string
& memoryBankName
, uint32 memorySlot
, ISabrinaPhraseDescription
* phrase
);
122 // set the 'active memory bank' variable
123 void setActiveMemoryBank(const std::string
& memoryBankName
);
125 // set the default action within the active memory bank (~0u to reset to no default action)
126 // deppending on the action type this may or may not be a cyclic action
127 void setDefaultAction(uint32 memorySlot
);
129 // execute an action from within the active memory bank
130 void executeAction(uint32 memorySlot
);
132 // the client and/ or server has indicated that they now (or no longer) are well placed for
133 // performing the current default action (the action must be cyclic)
134 void setCyclicActionFlag(bool value
);
137 //------------------------------------------------------------------------------------------------------
138 // Message Management for player information messages...
143 // the player's current active action phrase
144 CSabrinaPhraseInstancePtr _CurrentActionPhrase
;
146 // structure for the player's phrase memory...
149 uint64 BankId
; // used as a 0..7 character asciiz string
150 std::vector
<ISabrinaPhraseDescriptionPtr
> MemorySlots
; // MemorySlots[SABRINA::SLOTS_PER_MEMORY_BANK];
151 uint32 DefaultAction
; // ~0u if none
155 MemorySlots(SABRINA::SLOTS_PER_MEMORY_BANK
),
159 // copy constructor (needed to protect smart pointers...)
160 CMemoryBank(const CMemoryBank
& other
):
161 BankId(other
.BankId
),
162 MemorySlots(other
.MemorySlots
),
163 DefaultAction(other
.DefaultAction
)
167 // the player's set of memory banks (one per right hand item type)
168 std::vector
<CMemoryBank
> _MemoryBanks
;
169 // index of the active memory bank (within _MemoryBanks)
170 uint32 _ActiveMemoryBank
;
172 // a flag used to determine whether or not to launch a new action automatically when the
173 // current action terminates
174 bool _CyclicActionFlag
; // set to true if the client is well placed and default action is cyclic