DayZ 1.24
Loading...
Searching...
No Matches
ActionFishingNew Class Reference
Inheritance diagram for ActionFishingNew:
[legend]
Collaboration diagram for ActionFishingNew:
[legend]

Private Member Functions

void ActionFishingNew ()
 
override void CreateConditionComponents ()
 
override bool HasTarget ()
 
override bool HasAlternativeInterrupt ()
 
override bool ActionCondition (PlayerBase player, ActionTarget target, ItemBase item)
 
override ActionData CreateActionData ()
 
override bool SetupAction (PlayerBase player, ActionTarget target, ItemBase item, out ActionData action_data, Param extra_data=null)
 
override void OnFinishProgressServer (ActionData action_data)
 
override void OnFinishProgressClient (ActionData action_data)
 
override void OnStartClient (ActionData action_data)
 
override void OnStartServer (ActionData action_data)
 
override void OnEndClient (ActionData action_data)
 
override void OnEndServer (ActionData action_data)
 
override void WriteToContext (ParamsWriteContext ctx, ActionData action_data)
 
override bool ReadFromContext (ParamsReadContext ctx, out ActionReciveData action_recive_data)
 
int EvaluateFishingResult (ActionData action_data)
 
- Private Member Functions inherited from ActionContinuousBase
void OnStartAnimationLoopServer (ActionData action_data)
 
void OnStartAnimationLoopClient (ActionData action_data)
 
void OnEndAnimationLoopServer (ActionData action_data)
 
void OnEndAnimationLoopClient (ActionData action_data)
 
void OnFinishProgressServer (ActionData action_data)
 
void OnFinishProgressClient (ActionData action_data)
 

Private Attributes

const string ALLOWED_WATER_SURFACES = string.Format("%1|%2", UAWaterType.SEA, UAWaterType.FRESH)
 

Detailed Description

Definition at line 170 of file ActionFishingNew.c.

Constructor & Destructor Documentation

◆ ActionFishingNew()

void ActionFishingNew::ActionFishingNew ( )
inlineprivate

Member Function Documentation

◆ ActionCondition()

override bool ActionFishingNew::ActionCondition ( PlayerBase player,
ActionTarget target,
ItemBase item )
inlineprivate

Definition at line 200 of file ActionFishingNew.c.

201 {
204
205 if (rod)
206 bait = ItemBase.Cast(rod.FindAttachmentBySlotName("Hook"));
207
208 if (bait && !bait.IsRuined())
209 return true;
210
211 return false;
212 }

◆ CreateActionData()

override ActionData ActionFishingNew::CreateActionData ( )
inlineprivate

Definition at line 214 of file ActionFishingNew.c.

◆ CreateConditionComponents()

override void ActionFishingNew::CreateConditionComponents ( )
inlineprivate

◆ EvaluateFishingResult()

int ActionFishingNew::EvaluateFishingResult ( ActionData action_data)
inlineprivate

Definition at line 299 of file ActionFishingNew.c.

300 {
301 if (action_data.m_Player.IsQuickFishing())
302 return 1;
303
305 float rnd = fad.m_Player.GetRandomGeneratorSyncManager().GetRandom01(RandomGeneratorSyncUsage.RGSGeneric);
306 float daytimeModifier = 1;
307 float hookModifier = 1;
308 float chance;
309
310 daytimeModifier = GetGame().GetDayTime();
311 if ((daytimeModifier > 18 && daytimeModifier < 22) || (daytimeModifier > 5 && daytimeModifier < 9))
312 daytimeModifier = 1;
313 else
314 daytimeModifier = 0.5;
315
316 //fishing with an empty hook
317 if (fad.IsBaitEmptyHook())
318 hookModifier = 0.05;
319
320 chance = 1 - (((fad.FISHING_SUCCESS * daytimeModifier) + fad.m_RodQualityModifier)) * hookModifier;
321
322 if (rnd > chance)
323 return 1;
324 else if (rnd < fad.FISHING_BAIT_LOSS && !fad.IsBaitEmptyHook()) // restricts the loss of an empty hook (low chance is enough)
325 return 0;
326
327 return -1;
328 }
proto native CGame GetGame()

References GetGame().

Referenced by OnFinishProgressClient(), and OnFinishProgressServer().

◆ HasAlternativeInterrupt()

override bool ActionFishingNew::HasAlternativeInterrupt ( )
inlineprivate

Definition at line 195 of file ActionFishingNew.c.

196 {
197 return true;
198 }

◆ HasTarget()

override bool ActionFishingNew::HasTarget ( )
inlineprivate

Definition at line 190 of file ActionFishingNew.c.

191 {
192 return true;
193 }

Referenced by ReadFromContext(), and WriteToContext().

◆ OnEndClient()

override void ActionFishingNew::OnEndClient ( ActionData action_data)
inlineprivate

Definition at line 265 of file ActionFishingNew.c.

266 {
268 rod.AnimateFishingRod(false);
269 }

◆ OnEndServer()

override void ActionFishingNew::OnEndServer ( ActionData action_data)
inlineprivate

Definition at line 270 of file ActionFishingNew.c.

271 {
273 rod.AnimateFishingRod(false);
274 }

◆ OnFinishProgressClient()

override void ActionFishingNew::OnFinishProgressClient ( ActionData action_data)
inlineprivate

Definition at line 248 of file ActionFishingNew.c.

249 {
250 action_data.m_Callback.InternalCommand(DayZPlayerConstants.CMD_ACTIONINT_ACTION);
252 }
int EvaluateFishingResult(ActionData action_data)

References EvaluateFishingResult(), and FishingActionData::m_FishingResult.

◆ OnFinishProgressServer()

override void ActionFishingNew::OnFinishProgressServer ( ActionData action_data)
inlineprivate

Definition at line 242 of file ActionFishingNew.c.

243 {
244 action_data.m_Callback.InternalCommand(DayZPlayerConstants.CMD_ACTIONINT_ACTION);
246 }

References EvaluateFishingResult(), and FishingActionData::m_FishingResult.

◆ OnStartClient()

override void ActionFishingNew::OnStartClient ( ActionData action_data)
inlineprivate

Definition at line 254 of file ActionFishingNew.c.

255 {
257 rod.AnimateFishingRod(true);
258 }

◆ OnStartServer()

override void ActionFishingNew::OnStartServer ( ActionData action_data)
inlineprivate

Definition at line 259 of file ActionFishingNew.c.

260 {
262 rod.AnimateFishingRod(true);
263 }

◆ ReadFromContext()

override bool ActionFishingNew::ReadFromContext ( ParamsReadContext ctx,
out ActionReciveData action_recive_data )
inlineprivate

Definition at line 284 of file ActionFishingNew.c.

285 {
286 super.ReadFromContext(ctx, action_recive_data);
287
288 if (HasTarget())
289 {
291 if (!ctx.Read(cursor_position))
292 return false;
293
294 action_recive_data.m_Target.SetCursorHitPos(cursor_position);
295 }
296 return true;
297 }
override bool HasTarget()

References HasTarget().

◆ SetupAction()

override bool ActionFishingNew::SetupAction ( PlayerBase player,
ActionTarget target,
ItemBase item,
out ActionData action_data,
Param extra_data = null )
inlineprivate

Definition at line 220 of file ActionFishingNew.c.

221 {
222 if (super.SetupAction(player, target, item, action_data, extra_data))
223 {
224 vector cursorPosition = action_data.m_Target.GetCursorHitPos();
226 cursorPosition = player.GetPosition();
227
228 if (GetGame().SurfaceIsSea(cursorPosition[0], cursorPosition[2]))
230
232 if (rod)
233 {
234 FishingActionData.Cast(action_data).m_RodQualityModifier = rod.GetFishingEffectivityBonus();
235 FishingActionData.Cast(action_data).InitBait(ItemBase.Cast(action_data.m_MainItem.FindAttachmentBySlotName("Hook")));
236 }
237 return true;
238 }
239 return false;
240 }
void InitBait(ItemBase item)
static const vector Zero
Definition EnConvert.c:110

References GetGame(), FishingActionData::InitBait(), FishingActionData::m_IsSurfaceSea, FishingActionData::m_RodQualityModifier, and vector::Zero.

◆ WriteToContext()

override void ActionFishingNew::WriteToContext ( ParamsWriteContext ctx,
ActionData action_data )
inlineprivate

Definition at line 276 of file ActionFishingNew.c.

277 {
278 super.WriteToContext(ctx, action_data);
279
280 if (HasTarget())
281 ctx.Write(action_data.m_Target.GetCursorHitPos());
282 }

References HasTarget().

Member Data Documentation

◆ ALLOWED_WATER_SURFACES

const string ActionFishingNew::ALLOWED_WATER_SURFACES = string.Format("%1|%2", UAWaterType.SEA, UAWaterType.FRESH)
private

Definition at line 172 of file ActionFishingNew.c.

Referenced by CreateConditionComponents().


The documentation for this class was generated from the following file: