79 super.InitializeTab(root, console, button, parent);
83 m_DrawInWorld = ButtonWidget.Cast(root.FindAnyWidget(
"ButtonDrawItem"));
89 m_ShowProtected = CheckBoxWidget.Cast(root.FindAnyWidget(
"ShowProtectedCheckbox"));
91 m_ClearInventory = CheckBoxWidget.Cast(root.FindAnyWidget(
"ForceClearCheckbox"));
93 m_ObjectFilter = MultilineEditBoxWidget.Cast(root.FindAnyWidget(
"ObjectFilter"));
105 m_ItemNameCopy = ButtonWidget.Cast(root.FindAnyWidget(
"ItemNameCopy"));
119 m_SpawnOnTarget = ButtonWidget.Cast(root.FindAnyWidget(
"ButtonSpawnInTarget"));
120 m_SpawnOnCursor = ButtonWidget.Cast(root.FindAnyWidget(
"ButtonSpawnCursor"));
121 m_SpawnInHands = ButtonWidget.Cast(root.FindAnyWidget(
"ButtonSpawnHands"));
138 m_ListActions = ButtonWidget.Cast(root.FindAnyWidget(
"ListActions"));
208 m_RectSpawnRow.SetText(CfgParamInt.Cast(params.Get(0)).GetValue().ToString());
209 m_RectSpawnColumn.SetText(CfgParamInt.Cast(params.Get(1)).GetValue().ToString());
223 string widget_name =
"ItemCategory" + counter;
225 CheckBoxWidget btw = CheckBoxWidget.Cast(
m_ParentRoot.FindAnyWidget(widget_name));
230 int bit = 1 << counter;
233 btw.SetChecked(
true);
234 btw.SetTextColor(
ARGB(255, 255, 0, 0));
305 foreach (
Object o: objects)
307 if (o.IsKindOf(type))
313 lines[0] = o.GetPosition();
314 lines[1] = o.GetPosition() +
"0 30 0";
323 Debug.
Log(
string.Format(
"found %1 instances of type %1", i, type));
351 return super.OnKeyDown(w,
x,
y, key);
383 if (command_array.IsValidIndex(0))
385 string first_line = command_array.Get(0);
387 clear = (first_line ==
"clear_inv");
410 return item_params_array.param2;
422 return item_params_array.param2;
435 if (item_params_array.param1 == preset_name)
458 if (preset_name !=
"" && item_index > -1)
590 for (
int i = 0; i < preset_array.Count(); i++)
594 bool with_physics =
false;
608 EntityAI ent =
m_Developer.SpawnEntityInInventory(target, preset_array.Get(i), -1, quantity,
false, preset_name);
612 m_Developer.SpawnEntityOnCursorDir(player, preset_array.Get(i), quantity, distance, health,
false, preset_name, with_physics);
615 if (
g_Game.IsMultiplayer())
618 rpc.
Write(preset_name);
620 rpc.
Send(player,
ERPCs.DEV_RPC_SPAWN_PRESET,
true, player.GetIdentity());
624 PluginDeveloper plugin = PluginDeveloper.Cast(
GetPlugin(PluginDeveloper));
625 plugin.HandlePresetSpawn(player,preset_name,target);
634 if (default_preset !=
"")
640 default_preset =
"[" + default_preset +
"]";
646 prev_preset_params_array.param3 =
false;
656 preset_name =
"[" + preset_name +
"]";
664 preset_params_array.param3 =
true;
692 if (!
g_Game.IsKindOf(
object,
"DZ_LightAI") && !
g_Game.IsKindOf(
object,
"Man"))
694 DayZGame.m_IsPreviewSpawn =
true;
697 DayZGame.m_IsPreviewSpawn =
false;
738 if (itemName !=
string.
Empty)
740 g_Game.CopyToClipboard(itemName);
761 return item_params_array.param1;
780 if (selected_row_index != -1)
786 int index = item_name.
IndexOf(
" - [");
789 item_name.
Split(
" - [", tokens);
813 for (i = custom_presets_array.Count() - 1; i >= 0; i--)
820 for (i = 0; i < presets_array.Count(); i++)
825 if (default_preset !=
"")
831 default_preset =
"[" + default_preset +
"]";
864 for (i = 0; i < preset_array.Count(); i++)
892 return ARGB(255,255,0,0);
894 return ARGB(255,0,255,0);
896 return ARGB(255,130,130,255);
898 return ARGB(255,255,255,0);
900 return ARGB(255,255,169,0);
912 filter.
Split(
" ", rawFilters);
917 foreach (
int i,
string f:rawFilters)
920 if (f.IndexOf(
":") == 1)
922 string clr = f.Substring(0, 1);
923 f = f.Substring(2, f.Length() - 2);
930 color =
ARGB(200,255,255,255);
934 colors.Insert(color);
939 void ChangeFilter(TextListboxWidget widget, MultilineEditBoxWidget filterWidget,
int categoryMask = -1,
bool ignoreScope =
false)
947 filterWidget.GetText(widgetText);
956 foreach (
string itemName, ScriptConsoleItem itemData : items)
958 string displayName =
"NO DISPLAY NAME";
959 if (itemData.m_DisplayName !=
string.Empty)
960 displayName = itemData.m_DisplayName;
962 int scope = itemData.m_Scope;
965 int categoryBit = itemData.m_CategoryMask;
966 categoryBit = (1 << categoryBit);
968 bool display =
false;
969 bool matchWithDisplayName =
false;
971 if (categoryBit & categoryMask)
977 string childNameLower = itemName;
979 string displayNameLower = displayName;
982 foreach (
int indx,
string filter : filters)
987 color = filterColors.Get(indx);
992 itemsByFilters.Set(filter, arr);
995 arr.Insert(itemName +
" - [" + displayName +
"]");
996 itemsAndColors.Insert(itemName +
" - [" + displayName +
"]",color);
1001 else if (categoryMask == 0)
1008 itemsArray.Insert(itemName +
" - [" + displayName +
"]");
1016 foreach (
string it : itemsArray)
1018 widget.AddItem(it, NULL, 0);
1027 foreach (
string f : filters)
1033 foreach (
string itm: arr2)
1035 int row = widget.AddItem(itm, NULL, 0);
1036 int clr = itemsAndColors.Get(itm);
1039 widget.SetItemColor(row, 0, clr);
1063 super.OnChange(w,
x,
y, finished);
1087 CheckBoxWidget cbw = CheckBoxWidget.Cast(w);
1088 if (cbw.IsChecked())
1091 cbw.SetTextColor(
ARGB(255, 255, 0, 0));
1096 cbw.SetTextColor(
ARGB(255, 255, 255,255));
1140 int result = columnQ * rowQ;
1156 super.OnItemSelected(w,
x,
y, row, column, oldRow, oldColumn);
1188 super.OnClick(w,
x,
y,button);
1190 int objects_row_index;
1225 vector rayEnd = rayStart +
g_Game.GetCurrentCameraDirection() * 50;
1228 int hitComponentIndex;
1229 set<Object> hitObjects =
new set<Object>;
1231 DayZPhysics.
RaycastRV(rayStart, rayEnd, hitPos, hitNormal, hitComponentIndex, hitObjects, NULL, player,
false,
false, ObjIntersectView, 0.3);
1234 if (hitObjects.Count())
1235 target =
EntityAI.Cast(hitObjects.Get(0));
1250 if (target && target.IsInherited(
EntityAI))
1291 if (target && target.IsInherited(
EntityAI))
1309 if (spawnOnCrossHair)
1406 m_Developer.SpawnEntityOnGroundPatternGrid(player,
m_SelectedObject,count,
m_DamageEditBox.GetText().ToFloat(), 1, rows, columns, rowStep, columnStep,
m_IsShiftDown,
m_WithPhysicsCheckbox.IsChecked());
1448 super.OnDoubleClick(w,
x,
y, button);
1451 int objects_row_index;
1472 vector rayEnd = rayStart +
g_Game.GetCurrentCameraDirection() * 1.5;
1475 int hitComponentIndex;
1476 set<Object> hitObjects =
new set<Object>;
1477 DayZPhysics.
RaycastRV(rayStart, rayEnd, hitPos, hitNormal, hitComponentIndex, hitObjects, NULL, player);
1480 if (hitObjects.Count())
1481 target = hitObjects.Get(0);
1492 else if (button == 1)
1494 if (
g_Game.IsMultiplayer())
1501 player.LocalTakeEntityToHands(spawned_entity);
1505 else if (button == 2)
1523 super.Update(timeslice);
1554 w.GetText(widgetText);
1559 w.SetLine(0,widgetText);
1579 string message =
"";
1583 if (interactActions)
1585 message +=
"\n== Interact (F)\n\n";
1592 message +=
string.
Format(
"%1 <%2>\n",
Widget.TranslateString(ia.GetText()), ia.ClassName());
1598 if (continuousInteractActions)
1600 message +=
"\n== Continuous Interact (F hold)\n\n";
1607 message +=
string.
Format(
"%1 <%2>\n",
Widget.TranslateString(cia.GetText()), cia.ClassName());
1615 message +=
"\n== Single (LMB)\n\n";
1622 message +=
string.
Format(
"%1 <%2>\n",
Widget.TranslateString(sa.GetText()), sa.ClassName());
1628 if (continuousActions)
1631 message +=
"\n== Continuous (LMB hold)\n\n";
1637 message +=
string.
Format(
"%1 <%2>\n",
Widget.TranslateString(ca.GetText()), ca.ClassName());
1641 craftingAction = caction;
1644 message +=
"\n== Crafting recipes \n\n";
1647 PluginRecipesManager pluginRecipesManager = PluginRecipesManager.Cast(
GetPlugin(PluginRecipesManager));
1651 if (recipe.IsItemInRecipe(
"Inventory_Base"))
1654 message +=
string.
Format(
"%1 <%2>\n",
Widget.TranslateString(recipe.GetName()), recipe.Type());
1660 infoDialog.SetLabel(
string.Format(
"%1 related actions",
m_PreviewEntity.GetType()));
1661 infoDialog.SetContent(message);
const int ECE_CREATEPHYSICS
class BunkerBroadcastJsonDataBase proxies
PlayerSpawnPresetDiscreteItemSetSlotData name
one set for cargo
FindInventoryLocationType
flags for searching locations in inventory
InventoryLocationType
types of Inventory Location
PluginBase GetPlugin(typename plugin_type)
Param3< string, bool, bool > PresetParams
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()
ButtonWidget m_DrawInWorldClear
ref array< string > m_CategoryButtonsNames
void SpawnPreset(EntityAI target, bool clear_inventory, string preset_name, InventoryLocationType location=InventoryLocationType.ATTACHMENT, float distance=0)
TextWidget m_ItemQuantityLabel
ButtonWidget m_SpawnOnCursor
void PrepareFilters(string filter, out TStringArray filters, out TIntArray colors)
ButtonWidget m_PresetSetDefaultButton
CheckBoxWidget m_WithPhysicsCheckbox
ButtonWidget m_SpawnGroundPatternGrid
ref map< Widget, string > m_SpawnButtonsOriginalText
CheckBoxWidget m_ClearInventory
EditBoxWidget m_QuantityEditBox
TextListboxWidget m_PresetItemsTextListbox
ButtonWidget m_DrawInWorld
CheckBoxWidget m_ShowProtected
static string GetLastSelectedObject()
MissionGameplay m_MissionGameplay
MultilineEditBoxWidget m_ObjectFilter
CheckBoxWidget m_ItemPreviewCheckbox
void SelectObject(bool hide_presets=true)
ButtonWidget m_ReloadShapeButton
int GetCurrentItemIndex()
void ShowItemTransferButtons()
override bool OnKeyDown(Widget w, int x, int y, int key)
ButtonWidget m_PresetRemoveItemButton
void NewPreset(string preset_name)
CheckBoxWidget m_CategoryMergeType
ButtonWidget m_ItemMoveUpButton
static bool m_WithPhysics
static void DrawItemsClear()
static int ITEMS_SELECTED_ROW
TextWidget m_SelectedObjectText
EditBoxWidget m_DamageEditBox
void SetDefaultPreset(int preset_index)
ButtonWidget m_SpawnInHands
ButtonWidget m_PresetDeleteButton
string GetCurrentItemName()
override bool OnDoubleClick(Widget w, int x, int y, int button)
override void OnSelected()
static float m_ItemQuantity
EditBoxWidget m_BatchSpawnQuantity
static EntityAI m_PreviewEntity
EditBoxWidget m_DrawDistanceWidget
ButtonWidget m_SpawnOnTarget
ButtonWidget m_PresetNewButton
bool ListItemRelatedActions()
string GetCurrentObjectName()
override bool OnChange(Widget w, int x, int y, bool finished)
bool IsCurrentPresetFixed()
void ~ScriptConsoleItemsTab()
ButtonWidget m_SpawnGroundButton
int GetPresetIndexByName(string preset_name)
static ref array< Shape > m_DebugShapes
void AddItemToClipboard()
ButtonWidget m_ItemNameCopy
ButtonWidget m_FilterOrderButton
EditBoxWidget m_RectSpawnRow
ImageWidget m_FilterOrderImage
void ChangeFilter(TextListboxWidget widget, MultilineEditBoxWidget filterWidget, int categoryMask=-1, bool ignoreScope=false)
bool m_FilterOrderReversed
TextListboxWidget m_ObjectsTextListbox
PluginDeveloper m_Developer
string PreprocessFilterText(MultilineEditBoxWidget w)
ItemPreviewWidget m_ItemPreviewWidget
static void DrawItems(string type, float distance=0)
ButtonWidget m_ListActions
EditBoxWidget m_RectSpawnRowStep
EditBoxWidget m_RectSpawnColumnStep
TextListboxWidget m_PresetsTextListbox
int GetCurrentPresetIndex()
void RenamePreset(string new_preset_name)
const string CONST_DEFAULT_PRESET_PREFIX
void SetTextSpawnButton(ButtonWidget w, bool special, string suffix=" Special")
ButtonWidget m_PresetRenameButton
bool IsPresetFixed(string preset_name)
override bool OnClick(Widget w, int x, int y, int button)
ButtonWidget m_ItemMoveDownButton
void SetPreviewObject(string object)
static int PRESETS_SELECTED_ROW
ref array< Widget > m_CategoryButtonsWidgets
static float DRAW_DISTANCE
ref Timer m_RefreshFilterTimer
static string m_LastSelectedObject
static int ITEMS_IN_PRESET_SELECTED_ROW
string GetCurrentPresetName()
TextWidget m_ItemDamageLabel
EditBoxWidget m_RectSpawnColumn
ButtonWidget m_PresetAddItemtButton
int GetFilterColor(string color)
override bool OnItemSelected(Widget w, int x, int y, int row, int column, int oldRow, int oldColumn)
void RemoveItemFromPreset()
EditBoxWidget m_SpawnDistanceEditBox
void SetObject(string object)
override void InitializeTab(Widget root, ScriptConsole console, Widget button, ScriptConsoleTabBase parent=null)
void SaveProfileSpawnDistance()
void ChangeFilterItems(bool forced=false)
void SetFilterOrder(bool reversed)
TextWidget m_SelectedObjectLocalized
ButtonWidget m_SpawnBatchButton
ButtonWidget m_SpawnInInvButton
override void Update(float timeslice)
static int m_SelectedObjectIsPreset
PluginConfigDebugProfile m_ConfigDebugProfile
ScriptConsole m_ScriptConsole
PluginConfigDebugProfileFixed m_ConfigDebugProfileFixed
proto native void Send(Object target, int rpc_type, bool guaranteed, PlayerIdentity recipient=NULL)
Initiate remote procedure call. When called on client, RPC is evaluated on server; When called on ser...
proto bool Write(void value_out)
Result for an object found in CGame.IsBoxCollidingGeometryProxy.
proto string ToString(bool simple=true)
class array< Class T > 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.
proto int Replace(string sample, string replace)
Replace all occurrances of 'sample' in 'str' by 'replace'.
proto string Trim()
Returns trimmed string with removed leading and trailing whitespaces.
bool Contains(string sample)
Returns true if sample is substring of string.
void Split(string sample, out array< string > output)
Splits string into array of strings separated by 'sample'.
proto native int IndexOf(string sample)
Finds 'sample' in 'str'. Returns -1 when not found.
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.
proto int ToLower()
Changes string to lowercase. Returns length.
int ARGB(int a, int r, int g, int b)