Dayz
Build 1.29.163047, Scripts Rev. 123548
Dayz Code Explorer by Zeroy
Toggle main menu visibility
Loading...
Searching...
No Matches
actionpackgift.c
Go to the documentation of this file.
1
class
ActionPackGiftCB
:
ActionContinuousBaseCB
2
{
3
override
void
CreateActionComponent
()
4
{
5
m_ActionData
.m_ActionComponent =
new
CAContinuousTime
(
UATimeSpent
.
UNPACK
);
6
}
7
};
8
9
class
ActionPackGift
:
ActionContinuousBase
10
{
11
void
ActionPackGift
()
12
{
13
m_CallbackClass
=
ActionPackGiftCB
;
14
m_CommandUID
=
DayZPlayerConstants
.CMD_ACTIONMOD_OPENITEM;
15
//m_FullBody = true;
16
m_StanceMask
=
DayZPlayerConstants
.STANCEMASK_ERECT |
DayZPlayerConstants
.STANCEMASK_CROUCH;
17
m_SpecialtyWeight
= UASoftSkillsWeight.ROUGH_LOW;
18
m_Text
=
"#STR_Wrap"
;
19
}
20
21
override
void
CreateConditionComponents
()
22
{
23
m_ConditionItem
=
new
CCINonRuined
;
24
m_ConditionTarget
=
new
CCTNonRuined
;
25
}
26
27
override
bool
HasTarget
()
28
{
29
return
true
;
30
}
31
32
override
bool
ActionCondition
(
PlayerBase
player,
ActionTarget
target,
ItemBase
item )
33
{
34
ItemBase
item_to_pack =
ItemBase
.Cast(target.GetObject());
35
if
(!item_to_pack)
36
return
false
;
37
38
if
( !item_to_pack.
IsTakeable
() )
return
false
;
39
if
( item_to_pack.IsBeingPlaced() )
return
false
;
40
if
(
BaseBuildingBase
.Cast(item_to_pack) )
return
false
;
41
if
( !item_to_pack.
CanPutInCargo
(null) )
return
false
;
42
43
EntityAI
tgt_parent =
EntityAI
.Cast( target.GetParent() );
44
45
if
( tgt_parent )
46
{
47
if
( item_to_pack.GetInventory().IsAttachment() )
48
{
49
if
( !item_to_pack.
CanDetachAttachment
(tgt_parent) || !tgt_parent.CanReleaseAttachment(item_to_pack) )
50
return
false
;
51
}
52
else
53
{
54
if
( !item_to_pack.
CanRemoveFromCargo
(tgt_parent) || !tgt_parent.CanReleaseCargo(item_to_pack) )
55
return
false
;
56
}
57
}
58
59
if
( item_to_pack.GetInventory().GetCargo() && item_to_pack.GetInventory().GetCargo().GetItemCount() > 0)
60
return
false
;
61
62
if
( !item_to_pack.IsWeapon() && item_to_pack.GetInventory().AttachmentCount() > 0)
63
return
false
;
64
65
66
int
x
,
y
;
67
g_Game
.GetInventoryItemSize( item_to_pack,
x
,
y
);
68
69
if
(
x
> 5 ||
y
> 5 )
70
return
false
;
71
72
return
true
;
73
}
74
75
override
void
OnFinishProgressClient
(
ActionData
action_data )
76
{
77
PlayerBase
player = action_data.m_Player;
78
ItemBase
item_to_pack =
ItemBase
.Cast(action_data.m_Target.GetObject());
79
80
player.RemoveQuickBarEntityShortcut(item_to_pack);
81
82
}
83
84
override
void
OnFinishProgressServer
(
ActionData
action_data )
85
{
86
ItemBase
item_to_pack =
ItemBase
.Cast(action_data.m_Target.GetObject());
87
ItemBase
item = action_data.m_MainItem;
88
PlayerBase
player = action_data.m_Player;
89
string
typeName;
90
91
if
(item_to_pack)
92
{
93
int
x
,
y
;
94
g_Game
.GetInventoryItemSize( item_to_pack,
x
,
y
);
95
int
rnd =
Math
.
RandomIntInclusive
(1, 4);
96
97
ReplaceWithNewReciveCargoLambda
lambda;
98
99
if
(
x
<= 2 &&
y
<= 2 )
100
{
101
typeName =
"GiftBox_Small_"
+ rnd;
102
}
103
else
if
(
x
<= 3 &&
y
<= 3 )
104
{
105
typeName =
"GiftBox_Medium_"
+ rnd;
106
}
107
else
if
(
x
<= 5 &&
y
<= 5 )
108
{
109
typeName =
"GiftBox_Large_"
+ rnd;
110
}
111
else
return
;
112
113
114
if
(!
g_Game
.IsDedicatedServer())
115
player.RemoveQuickBarEntityShortcut(item_to_pack);
116
117
ClearActionJuncture
(action_data);
118
119
lambda =
new
ReplaceWithNewReciveCargoLambda
( item, typeName, player,item_to_pack);
120
player.ServerReplaceItemWithNew(lambda);
121
122
}
123
124
125
}
126
};
127
128
class
ReplaceWithNewReciveCargoLambda
:
TurnItemIntoItemLambda
129
{
130
protected
EntityAI
m_ItemToCargo
;
131
void
ReplaceWithNewReciveCargoLambda
(
EntityAI
old_item,
string
new_item_type,
PlayerBase
player,
EntityAI
item_to_cargo)
132
{
133
m_ItemToCargo
= item_to_cargo;
134
}
135
136
override
void
OnSuccess
(
EntityAI
new_item)
137
{
138
super.OnSuccess(new_item);
139
140
InventoryLocation
src =
new
InventoryLocation
;
141
m_ItemToCargo
.GetInventory().GetCurrentInventoryLocation(src);
142
InventoryLocation
dst =
new
InventoryLocation
;
143
144
dst.
SetCargo
(new_item,
m_ItemToCargo
, 0,0,0,
false
);
145
146
if
( dst.
IsValid
() )
147
{
148
if
(
g_Game
.IsDedicatedServer())
149
m_Player
.ServerTakeToDst(src,dst);
150
else
151
m_Player
.LocalTakeToDst(src,dst);
152
153
}
154
}
155
};
ActionData
ActionBase ActionData
Definition
actionbase.c:30
ActionTarget
class ActionTargets ActionTarget
m_Player
map m_Player
ActionBaseCB::m_ActionData
ActionData m_ActionData
Definition
animatedactionbase.c:3
ActionBase::m_Text
string m_Text
Definition
actionbase.c:64
ActionBase::m_ConditionItem
ref CCIBase m_ConditionItem
Definition
actionbase.c:70
ActionBase::m_SpecialtyWeight
float m_SpecialtyWeight
Definition
actionbase.c:83
ActionBase::m_ConditionTarget
ref CCTBase m_ConditionTarget
Definition
actionbase.c:71
ActionBase::ClearActionJuncture
void ClearActionJuncture(ActionData action_data)
Definition
actionbase.c:1104
ActionBase::m_StanceMask
int m_StanceMask
Definition
actionbase.c:68
ActionContinuousBaseCB
Definition
actioncontinuousbase.c:2
ActionContinuousBase::ActionContinuousBase
void ActionContinuousBase()
Definition
actioncontinuousbase.c:124
ActionPackGiftCB
Definition
actionpackgift.c:2
ActionPackGiftCB::CreateActionComponent
override void CreateActionComponent()
Definition
actionpackgift.c:3
ActionPackGift::OnFinishProgressServer
override void OnFinishProgressServer(ActionData action_data)
Definition
actionpackgift.c:84
ActionPackGift::CreateConditionComponents
override void CreateConditionComponents()
Definition
actionpackgift.c:21
ActionPackGift::ActionPackGift
void ActionPackGift()
Definition
actionpackgift.c:11
ActionPackGift::ActionCondition
override bool ActionCondition(PlayerBase player, ActionTarget target, ItemBase item)
Definition
actionpackgift.c:32
ActionPackGift::OnFinishProgressClient
override void OnFinishProgressClient(ActionData action_data)
Definition
actionpackgift.c:75
ActionPackGift::HasTarget
override bool HasTarget()
Definition
actionpackgift.c:27
AnimatedActionBase::m_CommandUID
int m_CommandUID
Definition
animatedactionbase.c:143
AnimatedActionBase::m_CallbackClass
m_CallbackClass
Definition
animatedactionbase.c:145
BaseBuildingBase
Definition
fence.c:2
CAContinuousTime
Definition
cacontinuoustime.c:2
CCINonRuined
Definition
ccinonruined.c:2
CCTNonRuined
Definition
cctnonruined.c:2
EntityAI
Definition
inventoryitem.c:2
InventoryLocation
InventoryLocation.
Definition
inventorylocation.c:30
InventoryLocation::IsValid
proto native bool IsValid()
verify current set inventory location
InventoryLocation::SetCargo
proto native void SetCargo(notnull EntityAI parent, EntityAI e, int idx, int row, int col, bool flip)
ItemBase
Definition
inventoryitem.c:742
ItemBase::CanPutInCargo
override bool CanPutInCargo(EntityAI parent)
Definition
gardenbase.c:331
ItemBase::CanRemoveFromCargo
override bool CanRemoveFromCargo(EntityAI parent)
Definition
basebuildingbase.c:1019
ItemBase::IsTakeable
override bool IsTakeable()
Definition
basebuildingbase.c:1008
ItemBase::CanDetachAttachment
override bool CanDetachAttachment(EntityAI parent)
Definition
gardenlime.c:42
Math
Definition
enmath.c:7
PlayerBase
Definition
playerbaseclient.c:2
ReplaceWithNewReciveCargoLambda
Definition
actionpackgift.c:129
ReplaceWithNewReciveCargoLambda::OnSuccess
override void OnSuccess(EntityAI new_item)
Definition
actionpackgift.c:136
ReplaceWithNewReciveCargoLambda::m_ItemToCargo
EntityAI m_ItemToCargo
Definition
actionpackgift.c:130
ReplaceWithNewReciveCargoLambda::ReplaceWithNewReciveCargoLambda
void ReplaceWithNewReciveCargoLambda(EntityAI old_item, string new_item_type, PlayerBase player, EntityAI item_to_cargo)
Definition
actionpackgift.c:131
TurnItemIntoItemLambda
Definition
miscgameplayfunctions.c:92
UATimeSpent
Definition
actionconstants.c:28
UATimeSpent::UNPACK
const float UNPACK
Definition
actionconstants.c:86
g_Game
DayZGame g_Game
Definition
dayzgame.c:3942
DayZPlayerConstants
DayZPlayerConstants
defined in C++
Definition
dayzplayer.c:602
Math::RandomIntInclusive
static int RandomIntInclusive(int min, int max)
Returns a random int number between and min [inclusive] and max [inclusive].
Definition
enmath.c:54
x
Icon x
y
Icon y
Games
Dayz
scripts
4_world
classes
useractionscomponent
actions
continuous
actionpackgift.c
Generated by
1.17.0