82 m_DrawInWorld = ButtonWidget.Cast(root.FindAnyWidget(
"ButtonDrawItem"));
88 m_ShowProtected = CheckBoxWidget.Cast(root.FindAnyWidget(
"ShowProtectedCheckbox"));
90 m_ClearInventory = CheckBoxWidget.Cast(root.FindAnyWidget(
"ForceClearCheckbox"));
92 m_ObjectFilter = MultilineEditBoxWidget.Cast(root.FindAnyWidget(
"ObjectFilter"));
104 m_ItemNameCopy = ButtonWidget.Cast(root.FindAnyWidget(
"ItemNameCopy"));
118 m_SpawnOnTarget = ButtonWidget.Cast(root.FindAnyWidget(
"ButtonSpawnInTarget"));
119 m_SpawnOnCursor = ButtonWidget.Cast(root.FindAnyWidget(
"ButtonSpawnCursor"));
120 m_SpawnInHands = ButtonWidget.Cast(root.FindAnyWidget(
"ButtonSpawnHands"));
137 m_ListActions = ButtonWidget.Cast(root.FindAnyWidget(
"ListActions"));
207 m_RectSpawnRow.SetText(CfgParamInt.Cast(params.Get(0)).GetValue().ToString());
208 m_RectSpawnColumn.SetText(CfgParamInt.Cast(params.Get(1)).GetValue().ToString());
222 string widget_name =
"ItemCategory" + counter;
224 CheckBoxWidget btw = CheckBoxWidget.Cast(
m_ParentRoot.FindAnyWidget(widget_name));
229 int bit = 1 << counter;
232 btw.SetChecked(
true);
233 btw.SetTextColor(
ARGB(255, 255, 0, 0));
302 g_Game.GetObjectsAtPosition(
g_Game.GetPlayer().GetPosition(), distance, objects, proxies);
304 foreach (
Object o: objects)
306 if (o.IsKindOf(type))
309 ScriptConsole.m_MarkedEntities.Insert(
new MapMarker(o.GetPosition(),
"",
COLOR_RED,eMapMarkerTypes.MARKERTYPE_MAP_BORDER_CROSS));
312 lines[0] = o.GetPosition();
313 lines[1] = o.GetPosition() +
"0 30 0";
322 Debug.
Log(
string.Format(
"found %1 instances of type %1", i, type));
328 ScriptConsole.m_MarkedEntities.Clear();
350 return super.OnKeyDown(w,
x,
y, key);
382 if (command_array.IsValidIndex(0))
384 string first_line = command_array.Get(0);
386 clear = (first_line ==
"clear_inv");
409 return item_params_array.param2;
421 return item_params_array.param2;
434 if (item_params_array.param1 == preset_name)
457 if (preset_name !=
"" && item_index > -1)
589 for (
int i = 0; i < preset_array.Count(); i++)
593 bool with_physics =
false;
607 EntityAI ent =
m_Developer.SpawnEntityInInventory(target, preset_array.Get(i), -1, quantity,
false, preset_name);
611 m_Developer.SpawnEntityOnCursorDir(player, preset_array.Get(i), quantity, distance, health,
false, preset_name, with_physics);
614 if (
g_Game.IsMultiplayer())
617 rpc.
Write(preset_name);
619 rpc.
Send(player,
ERPCs.DEV_RPC_SPAWN_PRESET,
true, player.GetIdentity());
623 PluginDeveloper plugin = PluginDeveloper.Cast(
GetPlugin(PluginDeveloper));
624 plugin.HandlePresetSpawn(player,preset_name,target);
633 if (default_preset !=
"")
639 default_preset =
"[" + default_preset +
"]";
645 prev_preset_params_array.param3 =
false;
655 preset_name =
"[" + preset_name +
"]";
663 preset_params_array.param3 =
true;
691 if (!
g_Game.IsKindOf(
object,
"DZ_LightAI") && !
g_Game.IsKindOf(
object,
"Man"))
693 DayZGame.m_IsPreviewSpawn =
true;
696 DayZGame.m_IsPreviewSpawn =
false;
764 return item_params_array.param1;
783 if (selected_row_index != -1)
808 for (i = custom_presets_array.Count() - 1; i >= 0; i--)
815 for (i = 0; i < presets_array.Count(); i++)
820 if (default_preset !=
"")
826 default_preset =
"[" + default_preset +
"]";
859 for (i = 0; i < preset_array.Count(); i++)
887 return ARGB(255,255,0,0);
889 return ARGB(255,0,255,0);
891 return ARGB(255,130,130,255);
893 return ARGB(255,255,255,0);
895 return ARGB(255,255,169,0);
907 filter.
Split(
" ", rawFilters);
912 foreach (
int i,
string f:rawFilters)
915 if (f.IndexOf(
":") == 1)
917 string clr = f.Substring(0, 1);
918 f = f.Substring(2, f.Length() - 2);
925 color =
ARGB(200,255,255,255);
929 colors.Insert(color);
934 void ChangeFilter(
TStringArray classes, TextListboxWidget widget, MultilineEditBoxWidget filterWidget,
int categoryMask = -1,
bool ignoreScope =
false)
942 filterWidget.GetText(widgetText);
950 for (
int i = 0; i < classes.Count(); i++)
952 string config_path = classes.Get(i);
954 int objects_count =
g_Game.ConfigGetChildrenCount(config_path);
955 for (
int j = 0; j < objects_count; j++)
959 g_Game.ConfigGetChildName(config_path, j, child_name);
961 int scope =
g_Game.ConfigGetInt(config_path +
" " + child_name +
" scope");
965 int category_bit =
g_Game.ConfigGetInt(config_path +
" " + child_name +
" debug_ItemCategory") - 1;
966 category_bit = (1 << category_bit);
968 bool display =
false;
970 if (category_bit & categoryMask)
976 string child_name_lower = child_name;
979 foreach (
int indx,
string filter:filters)
981 if (child_name_lower.
Contains(filter))
984 color = filterColors.Get(indx);
989 itemsByFilters.Set(filter, arr);
991 arr.Insert(child_name);
992 itemsAndColors.Insert(child_name,color);
997 else if (categoryMask == 0)
1004 itemsArray.Insert(child_name);
1014 foreach (
string it:itemsArray)
1016 widget.AddItem(it, NULL, 0);
1025 foreach (
string f:filters)
1031 foreach (
string itm: arr2)
1033 int row = widget.AddItem(itm, NULL, 0);
1034 int clr = itemsAndColors.Get(itm);
1037 widget.SetItemColor(row, 0, clr);
1064 super.OnChange(w,
x,
y, finished);
1088 CheckBoxWidget cbw = CheckBoxWidget.Cast(w);
1089 if (cbw.IsChecked())
1092 cbw.SetTextColor(
ARGB(255, 255, 0, 0));
1097 cbw.SetTextColor(
ARGB(255, 255, 255,255));
1141 int result = columnQ * rowQ;
1157 super.OnItemSelected(w,
x,
y, row, column, oldRow, oldColumn);
1189 super.OnClick(w,
x,
y,button);
1191 int objects_row_index;
1226 vector rayEnd = rayStart +
g_Game.GetCurrentCameraDirection() * 50;
1229 int hitComponentIndex;
1230 set<Object> hitObjects =
new set<Object>;
1232 DayZPhysics.
RaycastRV(rayStart, rayEnd, hitPos, hitNormal, hitComponentIndex, hitObjects, NULL, player,
false,
false, ObjIntersectView, 0.3);
1235 if (hitObjects.Count())
1236 target =
EntityAI.Cast(hitObjects.Get(0));
1251 if (target && target.IsInherited(
EntityAI))
1292 if (target && target.IsInherited(
EntityAI))
1310 if (spawnOnCrossHair)
1407 m_Developer.SpawnEntityOnGroundPatternGrid(player,
m_SelectedObject,count,
m_DamageEditBox.GetText().ToFloat(), 1, rows, columns, rowStep, columnStep,
m_IsShiftDown,
m_WithPhysicsCheckbox.IsChecked());
1449 super.OnDoubleClick(w,
x,
y, button);
1452 int objects_row_index;
1473 vector rayEnd = rayStart +
g_Game.GetCurrentCameraDirection() * 1.5;
1476 int hitComponentIndex;
1477 set<Object> hitObjects =
new set<Object>;
1478 DayZPhysics.
RaycastRV(rayStart, rayEnd, hitPos, hitNormal, hitComponentIndex, hitObjects, NULL, player);
1481 if (hitObjects.Count())
1482 target = hitObjects.Get(0);
1493 else if (button == 1)
1495 if (
g_Game.IsMultiplayer())
1502 player.LocalTakeEntityToHands(spawned_entity);
1506 else if (button == 2)
1524 super.Update(timeslice);
1555 w.GetText(widgetText);
1560 w.SetLine(0,widgetText);
1580 string message =
"";
1584 if (interactActions)
1586 message +=
"\n== Interact (F)\n\n";
1593 message +=
string.
Format(
"%1 <%2>\n",
Widget.TranslateString(ia.
GetText()), ia.ClassName());
1599 if (continuousInteractActions)
1601 message +=
"\n== Continuous Interact (F hold)\n\n";
1608 message +=
string.
Format(
"%1 <%2>\n",
Widget.TranslateString(cia.
GetText()), cia.ClassName());
1616 message +=
"\n== Single (LMB)\n\n";
1623 message +=
string.
Format(
"%1 <%2>\n",
Widget.TranslateString(sa.
GetText()), sa.ClassName());
1629 if (continuousActions)
1632 message +=
"\n== Continuous (LMB hold)\n\n";
1638 message +=
string.
Format(
"%1 <%2>\n",
Widget.TranslateString(ca.
GetText()), ca.ClassName());
1642 craftingAction = caction;
1645 message +=
"\n== Crafting recipes \n\n";
1648 PluginRecipesManager pluginRecipesManager = PluginRecipesManager.Cast(
GetPlugin(PluginRecipesManager));
1652 if (recipe.IsItemInRecipe(
"Inventory_Base"))
1655 message +=
string.
Format(
"%1 <%2>\n",
Widget.TranslateString(recipe.GetName()), recipe.Type());
1661 infoDialog.SetLabel(
string.Format(
"%1 related actions",
m_PreviewEntity.GetType()));
1662 infoDialog.SetContent(message);
const int ECE_CREATEPHYSICS
PlayerSpawnPresetDiscreteItemSetSlotData name
one set for cargo
static proto bool RaycastRV(vector begPos, vector endPos, out vector contactPos, out vector contactDir, out int contactComponent, set< Object > results=NULL, Object with=NULL, Object ignore=NULL, bool sorted=false, bool ground_only=false, int iType=ObjIntersectView, float radius=0.0, CollisionFlags flags=CollisionFlags.NEARESTCONTACT)
Raycasts world by given parameters.
static void Log(string message=LOG_DEFAULT, string plugin=LOG_DEFAULT, string author=LOG_DEFAULT, string label=LOG_DEFAULT, string entity=LOG_DEFAULT)
Prints debug message with normal prio.
static bool IsFreeCameraEnabled()
void RemoveItemFromPreset()
CheckBoxWidget m_ItemPreviewCheckbox
override bool OnChange(Widget w, int x, int y, bool finished)
string GetCurrentPresetName()
static int ITEMS_SELECTED_ROW
string PreprocessFilterText(MultilineEditBoxWidget w)
override bool OnKeyDown(Widget w, int x, int y, int key)
static string GetLastSelectedObject()
CheckBoxWidget m_ShowProtected
static string m_LastSelectedObject
MissionGameplay m_MissionGameplay
ButtonWidget m_ItemMoveDownButton
void ChangeFilter(TStringArray classes, TextListboxWidget widget, MultilineEditBoxWidget filterWidget, int categoryMask=-1, bool ignoreScope=false)
CheckBoxWidget m_WithPhysicsCheckbox
ButtonWidget m_ItemMoveUpButton
PluginDeveloper m_Developer
void SpawnPreset(EntityAI target, bool clear_inventory, string preset_name, InventoryLocationType location=InventoryLocationType.ATTACHMENT, float distance=0)
override void Update(float timeslice)
ButtonWidget m_PresetAddItemtButton
TStringArray GetItemsClasses()
ref array< string > m_CategoryButtonsNames
CheckBoxWidget m_ClearInventory
int GetPresetIndexByName(string preset_name)
override bool OnDoubleClick(Widget w, int x, int y, int button)
void PrepareFilters(string filter, out TStringArray filters, out TIntArray colors)
void SetTextSpawnButton(ButtonWidget w, bool special, string suffix=" Special")
TextWidget m_SelectedObjectLocalized
ref map< Widget, string > m_SpawnButtonsOriginalText
EditBoxWidget m_RectSpawnColumnStep
ImageWidget m_FilterOrderImage
ButtonWidget m_FilterOrderButton
void ~ScriptConsoleItemsTab()
static void DrawItems(string type, float distance=0)
void SelectObject(bool hide_presets=true)
TextWidget m_ItemDamageLabel
EditBoxWidget m_BatchSpawnQuantity
void SetPreviewObject(string object)
bool IsPresetFixed(string preset_name)
void ChangeFilterItems(bool forced=false)
void NewPreset(string preset_name)
static EntityAI m_PreviewEntity
string GetCurrentItemName()
ButtonWidget m_SpawnOnTarget
ref array< Widget > m_CategoryButtonsWidgets
ButtonWidget m_SpawnGroundPatternGrid
CheckBoxWidget m_CategoryMergeType
ItemPreviewWidget m_ItemPreviewWidget
static int ITEMS_IN_PRESET_SELECTED_ROW
const string CONST_DEFAULT_PRESET_PREFIX
EditBoxWidget m_RectSpawnRowStep
EditBoxWidget m_RectSpawnColumn
EditBoxWidget m_QuantityEditBox
ButtonWidget m_DrawInWorld
static float DRAW_DISTANCE
bool IsCurrentPresetFixed()
static bool m_WithPhysics
ButtonWidget m_SpawnInHands
EditBoxWidget m_DamageEditBox
TextWidget m_ItemQuantityLabel
ref Timer m_RefreshFilterTimer
static void DrawItemsClear()
int GetCurrentItemIndex()
override bool OnItemSelected(Widget w, int x, int y, int row, int column, int oldRow, int oldColumn)
void RenamePreset(string new_preset_name)
ButtonWidget m_ItemNameCopy
string GetCurrentObjectName()
TextListboxWidget m_PresetsTextListbox
int GetFilterColor(string color)
int GetCurrentPresetIndex()
ButtonWidget m_ListActions
TextListboxWidget m_ObjectsTextListbox
ButtonWidget m_ReloadShapeButton
ButtonWidget m_SpawnInInvButton
void ScriptConsoleItemsTab(Widget root, ScriptConsole console, Widget button, ScriptConsoleTabBase parent=null)
void SetObject(string object)
TextListboxWidget m_PresetItemsTextListbox
ButtonWidget m_PresetRemoveItemButton
static int m_SelectedObjectIsPreset
ButtonWidget m_PresetDeleteButton
ButtonWidget m_SpawnOnCursor
static float m_ItemQuantity
ButtonWidget m_PresetNewButton
ButtonWidget m_PresetSetDefaultButton
void ShowItemTransferButtons()
bool m_FilterOrderReversed
ButtonWidget m_DrawInWorldClear
bool ListItemRelatedActions()
EditBoxWidget m_DrawDistanceWidget
static int m_ObjectsScope
ButtonWidget m_PresetRenameButton
EditBoxWidget m_SpawnDistanceEditBox
static ref array< Shape > m_DebugShapes
EditBoxWidget m_RectSpawnRow
void SetDefaultPreset(int preset_index)
MultilineEditBoxWidget m_ObjectFilter
override bool OnClick(Widget w, int x, int y, int button)
ButtonWidget m_SpawnBatchButton
static int PRESETS_SELECTED_ROW
void SaveProfileSpawnDistance()
ButtonWidget m_SpawnGroundButton
void SetFilterOrder(bool reversed)
TextWidget m_SelectedObjectText
PluginConfigDebugProfile m_ConfigDebugProfile
void ScriptConsoleTabBase(Widget root, ScriptConsole console, Widget button, ScriptConsoleTabBase parent=null)
void AddItemToClipboard(TextListboxWidget text_listbox_widget)
PluginConfigDebugProfileFixed m_ConfigDebugProfileFixed
ScriptConsole m_ScriptConsole
proto native void Send(Object target, int rpc_type, bool guaranteed, PlayerIdentity recipient=NULL)
Initiate remote procedure call.
proto bool Write(void value_out)
Result for an object found in CGame.IsBoxCollidingGeometryProxy.
proto string ToString(bool simple=true)
array< string > TStringArray
static proto float Pow(float v, float power)
Return power of v ^ power.
proto native void dBodyDestroy(notnull IEntity ent)
Destroys attached physics body.
void Split(string sample, out array< string > output)
Splits string into array of strings separated by 'sample'.
static proto string Format(string fmt, void param1=NULL, void param2=NULL, void param3=NULL, void param4=NULL, void param5=NULL, void param6=NULL, void param7=NULL, void param8=NULL, void param9=NULL)
Gets n-th character from string.
bool Contains(string sample)
Returns true if sample is substring of string.
proto string Trim()
Returns trimmed string with removed leading and trailing whitespaces.
proto int Replace(string sample, string replace)
Replace all occurrances of 'sample' in 'str' by 'replace'.
proto int ToLower()
Changes string to lowercase.
FindInventoryLocationType
flags for searching locations in inventory
InventoryLocationType
types of Inventory Location
PluginBase GetPlugin(typename plugin_type)
int ARGB(int a, int r, int g, int b)
Param3< string, bool, bool > PresetParams