├── $PREFIX$ ├── 4_World ├── weapon_base.c └── weaponfsm.c ├── 5_Mission ├── ClassClothing.c ├── ClassData.c ├── ClassItem.c ├── ClassMenu.c ├── ClassSelectionClass.c ├── ClassSelectionUtils.c ├── json │ ├── JsonClassClothing.c │ ├── JsonClassData.c │ ├── JsonClassItem.c │ ├── JsonClassMagazine.c │ ├── JsonClassSelection.c │ └── JsonConfig.c ├── layouts │ ├── class.layout │ └── menu.layout ├── missiongameplay.c └── missionserver.c ├── Config.example.json ├── LICENSE ├── README.md ├── config.cpp ├── dayz.gproj ├── keys.js └── serverDZ.cfg /$PREFIX$: -------------------------------------------------------------------------------- 1 | Test Mod\Scripts -------------------------------------------------------------------------------- /4_World/weapon_base.c: -------------------------------------------------------------------------------- 1 | modded class Weapon_Base 2 | { 3 | void UpdateAnimationState (bool has_bullet, bool has_mag, int specificIndex = 0) 4 | { 5 | if (m_fsm) 6 | { 7 | m_fsm.UpdateAnimationState(has_bullet, has_mag, specificIndex); 8 | SyncSelectionState(has_bullet, has_mag); 9 | } 10 | } 11 | 12 | }; 13 | 14 | -------------------------------------------------------------------------------- /4_World/weaponfsm.c: -------------------------------------------------------------------------------- 1 | modded class WeaponFSM { 2 | void UpdateAnimationState (bool has_bullet, bool has_mag, int specificIndex = 0) { 3 | array candidates = new array; 4 | 5 | int tc = m_Transitions.Count(); 6 | for (int i = 0; i < tc; ++i) 7 | { 8 | WeaponTransition trans = m_Transitions.Get(i); 9 | WeaponStableState state = WeaponStableState.Cast(trans.m_srcState); 10 | if (state && state.HasBullet() == has_bullet && state.HasMagazine() == has_mag && state.IsJammed() == false) 11 | candidates.Insert(state); 12 | } 13 | 14 | int cc = candidates.Count(); 15 | if (cc) 16 | { 17 | WeaponStableState selected = candidates.Get(specificIndex); 18 | Terminate(); 19 | m_State = selected; 20 | Start(null, true); 21 | selected.SyncAnimState(); 22 | } 23 | else 24 | { 25 | wpnDebugPrint("[wpnfsm] RandomizeFSMState - warning - cannot randomize, no states available"); 26 | } 27 | } 28 | }; -------------------------------------------------------------------------------- /5_Mission/ClassClothing.c: -------------------------------------------------------------------------------- 1 | class ClassClothing { 2 | 3 | //ToDo for Fututre Clothing Selection 4 | protected EntityAI m_top; 5 | protected EntityAI m_pants; 6 | protected EntityAI m_shoes; 7 | protected EntityAI m_backpack; 8 | protected EntityAI m_vest; 9 | 10 | protected EntityAI m_gloves; 11 | protected EntityAI m_belt; 12 | protected EntityAI m_hat; 13 | protected EntityAI m_glasses; 14 | protected EntityAI m_mask; 15 | protected EntityAI m_armband; 16 | 17 | void ClassClothing(JsonClassClothing clothing) { 18 | TStringArray parts = {"top", "pants", "shoes", "backpack", "vest", "gloves", "belt", "hat", "glasses", "mask", "armband"}; 19 | 20 | Object obj = GetGame().CreateObject(clothing.top, Vector(0, 0, 0), true); 21 | this.m_top = EntityAI.Cast(Entity.Cast(obj)); 22 | 23 | obj = GetGame().CreateObject(clothing.pants, Vector(0, 0, 0), true); 24 | this.m_pants = EntityAI.Cast(Entity.Cast(obj)); 25 | 26 | obj = GetGame().CreateObject(clothing.shoes, Vector(0, 0, 0), true); 27 | this.m_shoes = EntityAI.Cast(Entity.Cast(obj)); 28 | 29 | obj = GetGame().CreateObject(clothing.backpack, Vector(0, 0, 0), true); 30 | this.m_backpack = EntityAI.Cast(Entity.Cast(obj)); 31 | 32 | obj = GetGame().CreateObject(clothing.vest, Vector(0, 0, 0), true); 33 | this.m_vest = EntityAI.Cast(Entity.Cast(obj)); 34 | 35 | obj = GetGame().CreateObject(clothing.gloves, Vector(0, 0, 0), true); 36 | this.m_gloves = EntityAI.Cast(Entity.Cast(obj)); 37 | 38 | obj = GetGame().CreateObject(clothing.belt, Vector(0, 0, 0), true); 39 | this.m_belt = EntityAI.Cast(Entity.Cast(obj)); 40 | 41 | obj = GetGame().CreateObject(clothing.hat, Vector(0, 0, 0), true); 42 | this.m_hat = EntityAI.Cast(Entity.Cast(obj)); 43 | 44 | obj = GetGame().CreateObject(clothing.glasses, Vector(0, 0, 0), true); 45 | this.m_glasses = EntityAI.Cast(Entity.Cast(obj)); 46 | 47 | obj = GetGame().CreateObject(clothing.mask, Vector(0, 0, 0), true); 48 | this.m_mask = EntityAI.Cast(Entity.Cast(obj)); 49 | 50 | obj = GetGame().CreateObject(clothing.armband, Vector(0, 0, 0), true); 51 | this.m_armband = EntityAI.Cast(Entity.Cast(obj)); 52 | } 53 | 54 | EntityAI GetTop() { 55 | return m_top; 56 | } 57 | 58 | EntityAI GetPants() { 59 | return m_pants; 60 | } 61 | 62 | EntityAI GetShoes() { 63 | return m_shoes; 64 | } 65 | 66 | EntityAI GetBackpack() { 67 | return m_backpack; 68 | } 69 | 70 | EntityAI GetVest() { 71 | return m_vest; 72 | } 73 | 74 | EntityAI GetGloves() { 75 | return m_gloves; 76 | } 77 | 78 | EntityAI GetBelt() { 79 | return m_belt; 80 | } 81 | 82 | EntityAI GetHat() { 83 | return m_hat; 84 | } 85 | 86 | EntityAI GetGlasses() { 87 | return m_glasses; 88 | } 89 | 90 | EntityAI GetMask() { 91 | return m_mask; 92 | } 93 | 94 | EntityAI GetArmband() { 95 | return m_armband; 96 | } 97 | } -------------------------------------------------------------------------------- /5_Mission/ClassData.c: -------------------------------------------------------------------------------- 1 | class ClassData extends UIScriptedMenu { 2 | 3 | protected string ClassName = "CLASSNAME"; 4 | protected ref array PrimaryItems; 5 | protected ref array SecondaryItems; 6 | protected ref array Utilities; 7 | protected ref array GeneralItems; 8 | protected ref array Clothes; 9 | 10 | protected ClassItem CurrentPrimary; 11 | protected ClassItem CurrentSecondary; 12 | protected ClassItem CurrentUtility; 13 | 14 | protected int CurrentPrimaryIndex = 0; 15 | protected int CurrentSecondaryIndex = 0; 16 | protected int CurrentUtilityIndex = 0; 17 | 18 | bool selected = false; 19 | 20 | void ClassData() { 21 | PrimaryItems = new array; 22 | SecondaryItems = new array; 23 | Utilities = new array; 24 | GeneralItems = new array; 25 | Clothes = new array; 26 | } 27 | 28 | void SetClassName(string className) { 29 | ClassName = className; 30 | 31 | if(layoutRoot) { 32 | TextWidget classNameWidget = TextWidget.Cast(layoutRoot.FindAnyWidget("ClassName")); 33 | classNameWidget.SetText(className); 34 | } 35 | } 36 | 37 | void SetPrimaryItems(array items) { 38 | PrimaryItems.Clear(); 39 | foreach(ClassItem item: items) { 40 | PrimaryItems.Insert(item); 41 | } 42 | } 43 | 44 | void SetSecondaryItems(array items) { 45 | SecondaryItems.Clear(); 46 | foreach(ClassItem item: items) { 47 | SecondaryItems.Insert(item); 48 | } 49 | } 50 | 51 | void SetUtilities(array items) { 52 | Utilities.Clear(); 53 | foreach(ClassItem item: items) { 54 | Utilities.Insert(item); 55 | } 56 | } 57 | 58 | void SetGeneralItems(array items) { 59 | GeneralItems.Clear(); 60 | foreach(ClassItem item: items) { 61 | GeneralItems.Insert(item); 62 | } 63 | } 64 | 65 | void SetClothes(array clothes) { 66 | Clothes.Clear(); 67 | foreach(ClassClothing clothing: clothes) { 68 | Clothes.Insert(clothing); 69 | } 70 | } 71 | 72 | void Next(string category) { 73 | int maxIndex = 0; 74 | switch(category) { 75 | case "primary": 76 | maxIndex = PrimaryItems.Count() - 1; 77 | if(CurrentPrimaryIndex != maxIndex) { 78 | CurrentPrimaryIndex++; 79 | } 80 | else { 81 | CurrentPrimaryIndex = 0; 82 | } 83 | break; 84 | case "secondary": 85 | maxIndex = SecondaryItems.Count() - 1; 86 | if(CurrentSecondaryIndex != maxIndex) { 87 | CurrentSecondaryIndex++; 88 | } 89 | else { 90 | CurrentSecondaryIndex = 0; 91 | } 92 | break; 93 | case "utility": 94 | maxIndex = Utilities.Count() - 1; 95 | if(CurrentUtilityIndex != maxIndex) { 96 | CurrentUtilityIndex++; 97 | } 98 | else { 99 | CurrentUtilityIndex = 0; 100 | } 101 | break; 102 | } 103 | } 104 | 105 | 106 | void Prev(string category) { 107 | int maxIndex = 0; 108 | switch(category) { 109 | case "primary": 110 | maxIndex = PrimaryItems.Count() - 1; 111 | if(CurrentPrimaryIndex != 0) { 112 | CurrentPrimaryIndex--; 113 | } 114 | else { 115 | CurrentPrimaryIndex = maxIndex; 116 | } 117 | break; 118 | case "secondary": 119 | maxIndex = SecondaryItems.Count() - 1; 120 | if(CurrentSecondaryIndex != 0) { 121 | CurrentSecondaryIndex--; 122 | } 123 | else { 124 | CurrentSecondaryIndex = maxIndex; 125 | } 126 | break; 127 | case "utility": 128 | maxIndex = Utilities.Count() - 1; 129 | if(CurrentUtilityIndex != 0) { 130 | CurrentUtilityIndex--; 131 | } 132 | else { 133 | CurrentUtilityIndex = maxIndex; 134 | } 135 | break; 136 | } 137 | } 138 | 139 | override void Refresh() { 140 | super.Refresh(); 141 | 142 | ItemPreviewWidget primaryPreview = ItemPreviewWidget.Cast(layoutRoot.FindAnyWidget("ClassPrimaryPreview")); 143 | ItemPreviewWidget secondaryPreview = ItemPreviewWidget.Cast(layoutRoot.FindAnyWidget("ClassSecondaryPreview")); 144 | ItemPreviewWidget utilityPreview = ItemPreviewWidget.Cast(layoutRoot.FindAnyWidget("ClassUtilityPreview")); 145 | 146 | if(PrimaryItems.Count()) { 147 | if(CurrentPrimary) CurrentPrimary.selected = !CurrentPrimary.selected; 148 | CurrentPrimary = PrimaryItems.Get(CurrentPrimaryIndex); 149 | CurrentPrimary.selected = !CurrentPrimary.selected; 150 | } 151 | 152 | if(SecondaryItems.Count()) { 153 | if(CurrentSecondary) CurrentSecondary.selected = !CurrentSecondary.selected; 154 | CurrentSecondary = SecondaryItems.Get(CurrentSecondaryIndex); 155 | CurrentSecondary.selected = !CurrentSecondary.selected; 156 | } 157 | 158 | if(Utilities.Count()) { 159 | if(CurrentUtility) CurrentUtility.selected = !CurrentUtility.selected; 160 | CurrentUtility = Utilities.Get(CurrentUtilityIndex); 161 | CurrentUtility.selected = !CurrentUtility.selected; 162 | } 163 | 164 | if(CurrentPrimary) primaryPreview.SetItem(CurrentPrimary.GetItem()); 165 | if(CurrentSecondary) secondaryPreview.SetItem(CurrentSecondary.GetItem()); 166 | if(CurrentUtility) utilityPreview.SetItem(CurrentUtility.GetItem()); 167 | } 168 | 169 | void LoadFromJSON(JsonClassData data) { 170 | SetClassName(data.className); 171 | selected = data.selected; 172 | 173 | ClassItem newItem; 174 | array primaryItems = new array(); 175 | foreach(JsonClassItem jsonWp: data.primaryItems) { 176 | newItem = ClassItem.LoadFromJSON(jsonWp); 177 | primaryItems.Insert(newItem); 178 | 179 | if(newItem.selected) { 180 | CurrentPrimaryIndex = primaryItems.Count() - 1; 181 | } 182 | } 183 | 184 | array secondaryItems = new array; 185 | foreach(JsonClassItem jsonWs: data.secondaryItems) { 186 | newItem = ClassItem.LoadFromJSON(jsonWs); 187 | secondaryItems.Insert(newItem); 188 | 189 | if(newItem.selected) { 190 | CurrentSecondaryIndex = secondaryItems.Count() - 1; 191 | } 192 | } 193 | 194 | array utilities = new array; 195 | foreach(JsonClassItem jsonU: data.utilities) { 196 | newItem = ClassItem.LoadFromJSON(jsonU); 197 | utilities.Insert(newItem); 198 | 199 | if(newItem.selected) { 200 | CurrentUtilityIndex = utilities.Count() - 1; 201 | } 202 | } 203 | 204 | array generalItems = new array; 205 | foreach(JsonClassItem jsonG: data.utilities) { 206 | newItem = ClassItem.LoadFromJSON(jsonG); 207 | generalItems.Insert(newItem); 208 | } 209 | 210 | array clothings = new array; 211 | foreach(JsonClassClothing jsonC: data.clothes) { 212 | clothings.Insert(new ClassClothing(jsonC)); 213 | } 214 | 215 | SetPrimaryItems(primaryItems); 216 | SetSecondaryItems(secondaryItems); 217 | SetUtilities(utilities); 218 | SetGeneralItems(generalItems); 219 | SetClothes(clothings); 220 | } 221 | 222 | JsonClassSelection GetSelection() { 223 | return new JsonClassSelection(ClassName, CurrentPrimary, CurrentSecondary, CurrentUtility); 224 | } 225 | } -------------------------------------------------------------------------------- /5_Mission/ClassItem.c: -------------------------------------------------------------------------------- 1 | class ClassItem { 2 | 3 | protected EntityAI m_Entity = null; 4 | protected ref TStringArray m_EntityAttachments; 5 | protected ref TStringArray m_Magazines = {}; 6 | protected ref array m_Cargo = {}; 7 | protected int m_Quantity = 0; 8 | 9 | bool selected = false; 10 | 11 | void ClassItem(string ObjectName) { 12 | Object itemObj = GetGame().CreateObject(ObjectName, Vector(0, 0, 0), true); 13 | m_Entity = EntityAI.Cast(EntityAI.Cast(Entity.Cast(itemObj))); 14 | } 15 | 16 | EntityAI SetAttachments(TStringArray attachments) { 17 | m_EntityAttachments = attachments; 18 | 19 | foreach(string attachment: m_EntityAttachments) { 20 | m_Entity.GetInventory().CreateAttachment(attachment); 21 | } 22 | 23 | return m_Entity; 24 | } 25 | 26 | void SetQuantity(int q) { 27 | m_Quantity = q; 28 | } 29 | 30 | void AddCargo(ClassItem item) { 31 | m_Cargo.Insert(item); 32 | } 33 | 34 | void AddMagazines(string type, int quantity) { 35 | //CREATE FAKE MAG 36 | Weapon_Base gun = Weapon_Base.Cast(m_Entity); 37 | Magazine mag = Magazine.Cast(GetGame().CreateObject(type, Vector(0, 0, 0), true)); 38 | 39 | if(gun && mag) { 40 | gun.AttachMagazine(0, mag); 41 | gun.SelectionMagazineShow(); 42 | } 43 | 44 | for(int i = 0; i < quantity; i++) { 45 | m_Magazines.Insert(type); 46 | } 47 | } 48 | 49 | EntityAI GetItem() { 50 | return m_Entity; 51 | } 52 | 53 | array GetCargo() { 54 | return m_Cargo; 55 | } 56 | 57 | int GetQuantity() { 58 | return m_Quantity; 59 | } 60 | 61 | TStringArray GetAttachments() { 62 | return m_EntityAttachments; 63 | } 64 | 65 | TStringArray GetMagazines() { 66 | return m_Magazines; 67 | } 68 | 69 | static ClassItem LoadFromJSON(JsonClassItem data) { 70 | ClassItem item = new ClassItem(data.name); 71 | item.selected = data.selected; 72 | 73 | if(data.quantity) { 74 | item.SetQuantity(data.quantity); 75 | } 76 | 77 | if(data.attachments) { 78 | item.SetAttachments(data.attachments); 79 | } 80 | 81 | if(data.cargo) { 82 | foreach(JsonClassItem _item: data.cargo) { 83 | item.AddCargo(LoadFromJSON(_item)); 84 | } 85 | } 86 | 87 | if(data.magazines) { 88 | foreach(JsonClassMagazine mag: data.magazines) { 89 | item.AddMagazines(mag.name, mag.quantity); 90 | } 91 | } 92 | 93 | return item; 94 | } 95 | 96 | array GetCargoJSON() { 97 | array cargo = new array; 98 | foreach(ClassItem cargoItem: m_Cargo) { 99 | cargo.Insert(cargoItem.ToJSON()); 100 | } 101 | 102 | return cargo; 103 | } 104 | 105 | JsonClassItem ToJSON() { 106 | return new JsonClassItem(GetItem().GetType(), GetQuantity(), GetAttachments(), GetCargoJSON()); 107 | } 108 | } -------------------------------------------------------------------------------- /5_Mission/ClassMenu.c: -------------------------------------------------------------------------------- 1 | class ClassMenu extends UIScriptedMenu { 2 | 3 | private ref Widget m_currentClass; 4 | private ref array m_AvailableClasses; 5 | private ref JsonConfig m_Config; 6 | private ref array m_DrawnWigets; 7 | private int m_currentClassIndex = 1; 8 | private int m_classesToShow = 3; 9 | private int m_currentPage = 1; 10 | bool selectedClass = false; 11 | 12 | void ClassMenu(){ 13 | m_AvailableClasses = new ref array; 14 | m_Config = new ref JsonConfig; 15 | m_DrawnWigets = new ref array; 16 | } 17 | 18 | void SetAvailableClasses(ref array classes){ 19 | m_AvailableClasses = classes; 20 | } 21 | 22 | void SetConfig(ref JsonConfig config){ 23 | m_Config = config; 24 | } 25 | 26 | void SetSelectedClass(bool selected) { 27 | selectedClass = selected; 28 | } 29 | 30 | override Widget Init() { 31 | layoutRoot = GetGame().GetWorkspace().CreateWidgets( "d3xters-class-selection\\Scripts\\5_Mission\\layouts\\menu.layout" ); 32 | return layoutRoot; 33 | } 34 | 35 | override void OnShow() { 36 | if(m_AvailableClasses && m_AvailableClasses.Count()) { 37 | super.OnShow(); 38 | GetGame().GetInput().ChangeGameFocus( 1 ); 39 | 40 | int index = 0; 41 | int count = 0; 42 | int page = 1; 43 | 44 | foreach(JsonClassData jsonClassData: m_AvailableClasses) { 45 | count++; 46 | 47 | ClassData classData = new ClassData(); 48 | classData.LoadFromJSON(jsonClassData); 49 | 50 | if(classData.selected) { 51 | m_currentClassIndex = index; 52 | m_currentPage = page; 53 | } 54 | 55 | if(count == 3) { 56 | page++; 57 | count = 0; 58 | } 59 | 60 | index++; 61 | } 62 | 63 | DrawClasses(); 64 | } 65 | } 66 | 67 | private int GetPages() { 68 | if(m_AvailableClasses.Count() <= m_classesToShow) return 1; 69 | return (Math.Ceil(m_AvailableClasses.Count() / m_classesToShow); 70 | } 71 | 72 | private int GetCurrentPage() { 73 | return m_currentPage; 74 | } 75 | 76 | private void DrawClass(int index, int position = 0) { 77 | float containerW, containerH, frameW, frameH; 78 | GetLayoutRoot().GetSize(containerW, containerH); 79 | 80 | float startX = 80; 81 | float startY = containerH * 0.16; 82 | 83 | ClassData classData = null; 84 | ref Widget classFrame = GetGame().GetWorkspace().CreateWidgets( "d3xters-class-selection\\Scripts\\5_Mission\\layouts\\class.layout", layoutRoot); 85 | classFrame.GetScript(classData); 86 | classFrame.GetSize(frameW, frameH); 87 | 88 | if(position > 0) { 89 | startX += ((containerW - 160 - (frameW * 3)) / 2 + frameW) * position; 90 | } 91 | classFrame.SetPos(startX, startY); 92 | 93 | layoutRoot.AddChild(classFrame); 94 | 95 | classData.layoutRoot = classFrame; 96 | classData.LoadFromJSON(m_AvailableClasses.Get(index)); 97 | classData.Refresh(); 98 | 99 | if(classData.selected) { 100 | m_currentClass = classFrame; 101 | } 102 | 103 | m_DrawnWigets.Insert(classFrame); 104 | } 105 | 106 | private void DrawClasses() { 107 | foreach(Widget drawnWidget: m_DrawnWigets) { 108 | drawnWidget.Unlink(); 109 | } 110 | m_DrawnWigets.Clear(); 111 | 112 | int firstItem = (GetCurrentPage() * m_classesToShow) - 3; 113 | int middleItem = (GetCurrentPage() * m_classesToShow) - 2; 114 | int lastItem = GetCurrentPage() * m_classesToShow - 1; 115 | 116 | if(m_AvailableClasses.Get(firstItem)) DrawClass(firstItem, 0); 117 | if(m_AvailableClasses.Get(middleItem)) DrawClass(middleItem, 1); 118 | if(m_AvailableClasses.Get(lastItem)) DrawClass(lastItem, 2); 119 | 120 | ChangeCurrentClass(m_currentClass); 121 | TextWidget PageNumber = TextWidget.Cast(GetLayoutRoot().FindAnyWidget("PageNumber")); 122 | PageNumber.SetText("Page: " + GetCurrentPage() + "/" + GetPages()); 123 | } 124 | 125 | override void OnHide() { 126 | super.OnHide(); 127 | GetGame().GetInput().ResetGameFocus(); 128 | } 129 | 130 | override bool OnClick(Widget w, int x, int y, int button) 131 | { 132 | ClassData classData = null; 133 | 134 | switch(w.GetName()) { 135 | case "PrimaryNext": 136 | w.GetParent().GetParent().GetScript(classData); 137 | classData.Next("primary"); 138 | classData.Refresh(); 139 | break; 140 | case "PrimaryPrev": 141 | w.GetParent().GetParent().GetScript(classData); 142 | classData.Prev("primary"); 143 | classData.Refresh(); 144 | break; 145 | case "SecondaryNext": 146 | w.GetParent().GetParent().GetScript(classData); 147 | classData.Next("secondary"); 148 | classData.Refresh(); 149 | break; 150 | case "SecondaryPrev": 151 | w.GetParent().GetParent().GetScript(classData); 152 | classData.Prev("secondary"); 153 | classData.Refresh(); 154 | break; 155 | case "UtilityNext": 156 | w.GetParent().GetParent().GetScript(classData); 157 | classData.Next("utility"); 158 | classData.Refresh(); 159 | break; 160 | case "UtilityPrev": 161 | w.GetParent().GetParent().GetScript(classData); 162 | classData.Prev("utility"); 163 | classData.Refresh(); 164 | break; 165 | case "SelectButton": 166 | SelectClass(); 167 | break; 168 | case "ClassesPrev": 169 | m_currentPage--; 170 | if(m_currentPage <= 0) m_currentPage = GetPages(); 171 | DrawClasses(); 172 | break; 173 | case "ClassesNext": 174 | m_currentPage++; 175 | if(GetCurrentPage() > GetPages()){ 176 | m_currentPage = 1; 177 | } 178 | DrawClasses(); 179 | break; 180 | } 181 | 182 | return super.OnClick(w, x, y, button); 183 | } 184 | 185 | 186 | void SelectClass() { 187 | if(m_currentClass) { 188 | ClassData data; 189 | m_currentClass.GetScript(data); 190 | GetRPCManager().SendRPC("ClassSelection", "SetPlayerClass", new Param1(data.GetSelection())); 191 | 192 | if(m_Config.giveWeaponsAfterDeath && selectedClass) { 193 | GetGame().GetUIManager().ShowDialog("Success!", "You will receive new gear next time you die.", 0, DBT_OK, DBB_YES, DMT_INFO, this); 194 | } 195 | 196 | selectedClass = true; 197 | Hide(); 198 | } 199 | } 200 | 201 | override bool OnMouseButtonDown(Widget w, int x, int y, int button) 202 | { 203 | switch(w.GetName()) { 204 | case "ClassFrame": 205 | ChangeCurrentClass(w); 206 | break; 207 | } 208 | return super.OnMouseButtonDown(w, x, y, button); 209 | } 210 | 211 | void ChangeCurrentClass(Widget newClass) { 212 | if(newClass) { 213 | ClassData oldClassData = null; 214 | ClassData newClassData = null; 215 | 216 | Widget background = newClass.FindAnyWidget("ClassFrameBackground"); 217 | 218 | if(m_currentClass) { 219 | m_currentClass.GetScript(oldClassData); 220 | oldClassData.selected = !oldClassData.selected; 221 | m_currentClass.FindAnyWidget("ClassFrameBackground").SetColor(background.GetColor()); 222 | } 223 | 224 | newClass.GetScript(newClassData); 225 | newClassData.selected = !newClassData.selected; 226 | m_currentClass = newClass; 227 | 228 | background.SetColor(COLOR_RED_A); 229 | } 230 | } 231 | 232 | void Toggle() { 233 | if (!GetLayoutRoot().IsVisible()){ 234 | Show(); 235 | } 236 | else { 237 | Hide(); 238 | } 239 | } 240 | 241 | void Show() { 242 | if(!m_AvailableClasses || !m_AvailableClasses.Count()) { 243 | GetRPCManager().SendRPC("ClassSelection", "RequestSyncAvailableClasses", null, true); 244 | } 245 | 246 | UIManager UIMgr = GetGame().GetUIManager(); 247 | if(UIMgr && !GetLayoutRoot().IsVisible() && m_AvailableClasses && m_AvailableClasses.Count()) { 248 | UIMgr.HideDialog(); 249 | UIMgr.CloseAll(); 250 | UIMgr.ShowScriptedMenu(this , NULL ); 251 | } 252 | } 253 | 254 | void Hide() { 255 | UIManager UIMgr = GetGame().GetUIManager(); 256 | if(UIMgr && GetLayoutRoot().IsVisible()) { 257 | UIMgr.HideDialog(); 258 | UIMgr.CloseAll(); 259 | UIMgr.HideScriptedMenu(this); 260 | } 261 | } 262 | } -------------------------------------------------------------------------------- /5_Mission/ClassSelectionClass.c: -------------------------------------------------------------------------------- 1 | class ClassSelectionClass { 2 | ref ClassSelectionUtils Utils = new ClassSelectionUtils; 3 | 4 | ref array m_AvailableClasses; 5 | ref array m_GerneralItems; 6 | ref map> m_PlayerClasses; 7 | ref array m_PlayersToRespawn; 8 | 9 | void ClassSelectionClass() { 10 | if(GetGame().IsServer()){ 11 | m_PlayerClasses = new map>; 12 | m_PlayersToRespawn = new array; 13 | 14 | GetRPCManager().AddRPC("ClassSelection", "RequestSyncAvailableClasses", this); 15 | GetRPCManager().AddRPC("ClassSelection", "RequestConfig", this); 16 | GetRPCManager().AddRPC("ClassSelection", "SetPlayerClass", this); 17 | 18 | Utils.CreateDefaultFiles(); 19 | 20 | //Load General Items 21 | m_GerneralItems = Utils.LoadGeneralItems(); 22 | 23 | //Load Existing Classes 24 | m_AvailableClasses = Utils.LoadClasses(); 25 | 26 | //Check Config and Version 27 | Utils.CheckVersion(); 28 | } 29 | } 30 | 31 | void RequestSyncAvailableClasses(CallType type, ref ParamsReadContext ctx, ref PlayerIdentity sender, ref Object target ) { 32 | if( type == CallType.Server ) 33 | { 34 | SendSyncAvailableClasses(sender); 35 | } 36 | } 37 | 38 | void RequestConfig(CallType type, ref ParamsReadContext ctx, ref PlayerIdentity sender, ref Object target ) { 39 | if( type == CallType.Server ) 40 | { 41 | ref JsonConfig clientConfig = new JsonConfig(); 42 | clientConfig.keyToOpen = Utils.config.keyToOpen; 43 | clientConfig.giveWeaponsAfterDeath = Utils.config.giveWeaponsAfterDeath; 44 | clientConfig.showClassSelectOnRespawnOnly = Utils.config.showClassSelectOnRespawnOnly; 45 | clientConfig.version = Utils.config.version; 46 | 47 | GetRPCManager().SendRPC("ClassSelection", "SyncConfig", new Param1(clientConfig), true, sender); 48 | } 49 | } 50 | 51 | void SendSyncAvailableClasses(PlayerIdentity player) { 52 | ref array CustomClasses = new array; 53 | 54 | foreach(JsonClassData copyClass: m_AvailableClasses) { 55 | if(!PlayerCanAccessClass(copyClass.className, player)) continue; 56 | 57 | ref JsonClassData newClass = new JsonClassData(); 58 | newClass.className = copyClass.className; 59 | newClass.primaryItems = copyClass.primaryItems; 60 | newClass.secondaryItems = copyClass.secondaryItems; 61 | newClass.utilities = copyClass.utilities; 62 | newClass.clothes = copyClass.clothes; 63 | 64 | CustomClasses.Insert(newClass); 65 | } 66 | 67 | if(m_PlayerClasses.Contains(player.GetId())) { 68 | ref array playerClasses = m_PlayerClasses.Get(player.GetId()); 69 | 70 | foreach(JsonClassData customClass: CustomClasses) { 71 | foreach(JsonClassSelection playerClass: playerClasses) { 72 | if(playerClass.className == customClass.className) { 73 | customClass.selected = playerClass.selected; 74 | 75 | //Check Selected Primaries 76 | foreach(JsonClassItem customClassPrimaryWeapon: customClass.primaryItems) { 77 | customClassPrimaryWeapon.selected = false; 78 | 79 | if(customClassPrimaryWeapon.name == playerClass.primary.name) { 80 | customClassPrimaryWeapon.selected = true; 81 | 82 | //ToDo: Check Selected Attachments 83 | } 84 | } 85 | 86 | //Check Selected Secondaries 87 | foreach(JsonClassItem customClassSecondaryWeapon: customClass.secondaryItems) { 88 | customClassSecondaryWeapon.selected = false; 89 | 90 | if(customClassSecondaryWeapon.name == playerClass.secondary.name) { 91 | customClassSecondaryWeapon.selected = true; 92 | 93 | //ToDo: Check Selected Attachments 94 | } 95 | } 96 | 97 | //Check Selected Utilities 98 | foreach(JsonClassItem customClassUtility: customClass.utilities) { 99 | customClassUtility.selected = false; 100 | 101 | if(customClassUtility.name == playerClass.utility.name) { 102 | customClassUtility.selected = true; 103 | } 104 | } 105 | } 106 | } 107 | } 108 | } 109 | 110 | GetRPCManager().SendRPC("ClassSelection", "SyncAvailableClasses", new Param1>(CustomClasses), true, player); 111 | } 112 | 113 | void LoadPlayerData(PlayerIdentity identity) { 114 | m_PlayerClasses.Set(identity.GetId(), Utils.LoadPlayerData(identity)); 115 | } 116 | 117 | bool PlayerCanAccessClass(string className, PlayerIdentity identity) { 118 | ref map whiteList = Utils.GetWhiteList(); 119 | foreach(string name, ref TStringArray players: whiteList) { 120 | if(name == className) { 121 | players = whiteList.Get(name); 122 | if(players.Find(identity.GetPlainId()) > -1) { 123 | return true; 124 | } 125 | 126 | return false; 127 | } 128 | } 129 | 130 | return true; 131 | } 132 | 133 | void SetPlayerClass(CallType type, ref ParamsReadContext ctx, ref PlayerIdentity sender, ref Object target ) { 134 | Param1 params; 135 | if ( !ctx.Read( params ) ) return; 136 | 137 | if( type == CallType.Server ) 138 | { 139 | PlayerBase player = Utils.GetPlayerById(sender.GetPlayerId()); 140 | bool PlayerHasClasses = false; 141 | 142 | //Update Players Custom Classes 143 | ref JsonClassSelection selectedClass = params.param1; 144 | selectedClass.selected = true; 145 | 146 | if(PlayerCanAccessClass(selectedClass.className, sender)) { 147 | if(!m_PlayerClasses.Contains(sender.GetId())) { 148 | m_PlayerClasses.Set(sender.GetId(), new ref array); 149 | } 150 | 151 | if(m_PlayerClasses.Contains(sender.GetId())) { 152 | ref array playerClasses = m_PlayerClasses.Get(sender.GetId()); 153 | 154 | bool exists = false; 155 | foreach(int classIndex, JsonClassSelection playerClass: playerClasses) { 156 | PlayerHasClasses = true; 157 | 158 | if(playerClass) { 159 | playerClass.selected = false; 160 | playerClasses.Remove(classIndex); 161 | 162 | if(selectedClass.className == playerClass.className) { 163 | exists = true; 164 | playerClasses.InsertAt(selectedClass, classIndex); 165 | } 166 | else { 167 | playerClasses.InsertAt(playerClass, classIndex); 168 | } 169 | } 170 | } 171 | 172 | if(!exists) playerClasses.Insert(selectedClass); 173 | 174 | m_PlayerClasses.Set(sender.GetId(), playerClasses); 175 | } 176 | } 177 | SendSyncAvailableClasses(sender); 178 | 179 | //Save ClassSelectionUtils 180 | Utils.SavePlayerClasses(m_PlayerClasses.Get(sender.GetId()), sender.GetId()); 181 | 182 | //Force Respawn 183 | if(!Utils.config.giveWeaponsAfterDeath || !PlayerHasClasses) { 184 | player.SetHealth(0); 185 | } 186 | } 187 | } 188 | 189 | 190 | void SetClothes(JsonClassClothing classData, PlayerBase player) 191 | { 192 | GetGame().ObjectDelete(player.GetHumanInventory().GetEntityInHands()); 193 | player.RemoveAllItems(); 194 | 195 | player.GetInventory().CreateInInventory(classData.top); 196 | player.GetInventory().CreateInInventory(classData.pants); 197 | player.GetInventory().CreateInInventory(classData.shoes); 198 | player.GetInventory().CreateInInventory(classData.gloves); 199 | player.GetInventory().CreateInInventory(classData.glasses); 200 | player.GetInventory().CreateInInventory(classData.mask); 201 | player.GetInventory().CreateInInventory(classData.armband); 202 | player.GetInventory().CreateInInventory(classData.hat); 203 | 204 | ItemBase vest = ItemBase.Cast(player.GetInventory().CreateInInventory(classData.vest)); 205 | ItemBase backpack = ItemBase.Cast(player.GetInventory().CreateInInventory(classData.backpack)); 206 | ItemBase belt = ItemBase.Cast(player.GetInventory().CreateInInventory(classData.belt)); 207 | 208 | if(vest) { 209 | foreach(string vestAttachment: classData.vestAttachments) { 210 | vest.GetInventory().CreateAttachment(vestAttachment); 211 | } 212 | } 213 | 214 | if(backpack) { 215 | foreach(string backpackAttachment: classData.backpackAttachments) { 216 | backpack.GetInventory().CreateAttachment(backpackAttachment); 217 | } 218 | } 219 | 220 | if(belt) { 221 | foreach(string beltAttachment: classData.beltAttachments) { 222 | belt.GetInventory().CreateAttachment(beltAttachment); 223 | } 224 | } 225 | } 226 | 227 | ItemBase SpawnItem(ClassItem item, PlayerBase player, bool InHands = false, bool SkipQuantity = false, ItemBase container = null) { 228 | if(item) { 229 | ItemBase ent_Item; 230 | TStringArray mags = item.GetMagazines(); 231 | EntityAI vest = player.GetInventory().FindAttachment(InventorySlots.GetSlotIdFromString("Vest")); 232 | 233 | if(InHands) { 234 | GetGame().ObjectDelete(player.GetHumanInventory().GetEntityInHands()); 235 | ent_Item = ItemBase.Cast(player.GetHumanInventory().CreateInHands(item.GetItem().GetType())); 236 | } 237 | else if(container) { 238 | ent_Item = ItemBase.Cast(container.GetInventory().CreateInInventory(item.GetItem().GetType())); 239 | } 240 | else { 241 | EntityAI shoes = player.GetInventory().FindAttachment(InventorySlots.GetSlotIdFromString("Feet")); 242 | if(shoes && !ent_Item) { 243 | ent_Item = ItemBase.Cast(shoes.GetInventory().CreateInInventory(item.GetItem().GetType())); 244 | } 245 | 246 | if(vest && !ent_Item) { 247 | ent_Item = ItemBase.Cast(vest.GetInventory().CreateInInventory(item.GetItem().GetType())); 248 | } 249 | 250 | if(!ent_Item) { 251 | ent_Item = ItemBase.Cast(player.GetInventory().CreateInInventory(item.GetItem().GetType())); 252 | } 253 | } 254 | 255 | if(ent_Item) { 256 | if(mags && mags.Count()) { 257 | Weapon_Base weaponBase = Weapon_Base.Cast(ent_Item); 258 | 259 | if(weaponBase) { 260 | Magazine newMag; 261 | foreach(string mag: mags) { 262 | newMag = null; 263 | if(vest) { 264 | newMag = Magazine.Cast(vest.GetInventory().CreateInInventory(mag)); 265 | } 266 | 267 | if(!newMag) { 268 | newMag = Magazine.Cast(player.GetInventory().CreateInInventory(mag)); 269 | } 270 | } 271 | 272 | if(GetGame().IsMultiplayer()) 273 | { 274 | GetGame().RemoteObjectDelete(weaponBase); 275 | GetGame().RemoteObjectDelete(newMag); 276 | } 277 | 278 | int mi = weaponBase.GetCurrentMuzzle(); 279 | bool has_mag = false; 280 | bool has_bullet = false; 281 | int animationIndex = 0; 282 | 283 | //Attach Mag if possible 284 | if(newMag && weaponBase.CanAttachMagazine(mi, newMag)) { 285 | weaponBase.AttachMagazine(mi, newMag); 286 | pushToChamberFromAttachedMagazine(weaponBase, mi); 287 | has_bullet = true; 288 | has_mag = true; 289 | } 290 | else { 291 | float ammo_damage; 292 | string ammo_type; 293 | 294 | if(newMag && newMag.LocalAcquireCartridge(ammo_damage, ammo_type)){ 295 | if(weaponBase.GetInternalMagazineMaxCartridgeCount(mi)) { 296 | while(!weaponBase.IsInternalMagazineFull(mi)) { 297 | weaponBase.PushCartridgeToInternalMagazine(mi, ammo_damage, ammo_type); 298 | } 299 | } 300 | 301 | for(int i = 0; i < weaponBase.GetMuzzleCount(); i++) { 302 | weaponBase.PushCartridgeToChamber(i, ammo_damage, ammo_type); 303 | has_bullet = true; 304 | } 305 | } 306 | } 307 | 308 | weaponBase.UpdateAnimationState(has_bullet, has_mag, animationIndex); 309 | 310 | if(GetGame().IsMultiplayer()) 311 | { 312 | GetGame().RemoteObjectCreate(weaponBase); 313 | GetGame().RemoteObjectCreate(newMag); 314 | } 315 | } 316 | } 317 | 318 | //Add attachments 319 | TStringArray attachments = item.GetAttachments(); 320 | foreach(string attachment: attachments) { 321 | EntityAI addedAttachment = ent_Item.GetInventory().CreateAttachment(attachment); 322 | if(addedAttachment) addedAttachment.GetInventory().CreateAttachment("Battery9V"); 323 | } 324 | 325 | //If items have quantity add as much 326 | if(!SkipQuantity && item.GetQuantity() > 0) { 327 | if(ent_Item.CanBeSplit()) { 328 | ent_Item.SetQuantity(item.GetQuantity()); 329 | } 330 | else { 331 | for(int q = 0; q < item.GetQuantity() - 1; q++) { 332 | SpawnItem(item, player, false, true, container); 333 | } 334 | } 335 | } 336 | 337 | //Add cargo 338 | if(ent_Item.CanDisplayCargo() && item.GetCargo().Count()) { 339 | ref array cargo = item.GetCargo(); 340 | foreach(ClassItem cargoItem: cargo) { 341 | SpawnItem(cargoItem, player, false, false, ent_Item); 342 | } 343 | } 344 | 345 | if(ent_Item.IsFood()) { 346 | return Edible_Base.Cast(ent_Item); 347 | } 348 | 349 | if(ent_Item.IsWeapon()) { 350 | return Weapon_Base.Cast(ent_Item); 351 | } 352 | 353 | return ent_Item; 354 | } 355 | } 356 | 357 | return null; 358 | } 359 | 360 | void CheckClassItem(array baseItems, JsonClassItem selectedItem, out ClassItem foundItem) { 361 | foreach(JsonClassItem baseItem: baseItems){ 362 | if(baseItem.name == selectedItem.name) { 363 | foundItem = ClassItem.LoadFromJSON(baseItem); 364 | 365 | if(selectedItem.attachments) { 366 | bool validAttachments = true; 367 | 368 | foreach(string attachemnt: selectedItem.attachments) { 369 | if(baseItem.attachments.Find(attachemnt)) { 370 | validAttachments = false; 371 | } 372 | } 373 | 374 | if(validAttachments) { 375 | foundItem.SetAttachments(selectedItem.attachments); 376 | } 377 | } 378 | } 379 | } 380 | } 381 | 382 | void GiveClassEquipment(EntityAI ent_player) { 383 | PlayerBase player = PlayerBase.Cast(ent_player); 384 | ref array playerClasses = null; 385 | 386 | if(m_PlayerClasses.Contains(player.GetIdentity().GetId())) { 387 | playerClasses = m_PlayerClasses.Get(player.GetIdentity().GetId()); 388 | } 389 | 390 | bool giveItemsToPlayer = true; 391 | 392 | if(playerClasses && Utils.config.showClassSelectOnRespawnOnly) { 393 | if(m_PlayersToRespawn.Find(player.GetIdentity().GetId()) == -1) { 394 | giveItemsToPlayer = false; 395 | m_PlayerClasses.Remove(player.GetIdentity().GetId()); 396 | m_PlayersToRespawn.Insert(player.GetIdentity().GetId()); 397 | } 398 | } 399 | 400 | if (playerClasses && giveItemsToPlayer) 401 | { 402 | ref JsonClassSelection selectedClass = null; 403 | 404 | foreach(ref JsonClassSelection playerClass: playerClasses) { 405 | if(playerClass.selected) selectedClass = playerClass; 406 | } 407 | 408 | if(!selectedClass && !Utils.config.showClassSelectOnRespawnOnly) selectedClass = playerClasses.Get(0); 409 | 410 | if(selectedClass && PlayerCanAccessClass(selectedClass.className, player.GetIdentity())) { 411 | //Check if Class has Weapons and attachments available 412 | ref JsonClassData foundClass; 413 | ref ClassItem foundPrimary; 414 | ref ClassItem foundSecondary; 415 | ref ClassItem foundUtility; 416 | 417 | foreach(JsonClassData baseClass: m_AvailableClasses) { 418 | if(baseClass.className == selectedClass.className) { 419 | foundClass = baseClass; 420 | 421 | CheckClassItem(baseClass.primaryItems, selectedClass.primary, foundPrimary); 422 | CheckClassItem(baseClass.secondaryItems, selectedClass.secondary, foundSecondary); 423 | CheckClassItem(baseClass.utilities, selectedClass.utility, foundUtility); 424 | } 425 | } 426 | 427 | if(foundClass) { 428 | SetClothes(foundClass.clothes.GetRandomElement(), player); 429 | player.SetQuickBarEntityShortcut(SpawnItem(foundPrimary, player, true), 0); 430 | player.SetQuickBarEntityShortcut(SpawnItem(foundSecondary, player), 1); 431 | player.SetQuickBarEntityShortcut(SpawnItem(foundUtility, player), 2); 432 | 433 | foreach(JsonClassItem classGeneralItem: foundClass.generalItems) { 434 | SpawnItem(ClassItem.LoadFromJSON(classGeneralItem), player); 435 | } 436 | } 437 | } 438 | 439 | foreach(JsonClassItem generalItem: m_GerneralItems) { 440 | SpawnItem(ClassItem.LoadFromJSON(generalItem), player); 441 | } 442 | 443 | m_PlayersToRespawn.RemoveItem(player.GetIdentity().GetId()); 444 | } 445 | 446 | SendSyncAvailableClasses(player.GetIdentity()); 447 | } 448 | } -------------------------------------------------------------------------------- /5_Mission/ClassSelectionUtils.c: -------------------------------------------------------------------------------- 1 | class ClassSelectionUtils { 2 | static const string cfgPath = "$profile:"; 3 | static const string cfgMainDir = "ClassSelection\\"; 4 | static const string cfgClasses = "ClassSelection\\Classes\\"; 5 | static const string cfgPlayerSaves = "ClassSelection\\PlayerSaves\\"; 6 | static const string version = "v0.3"; 7 | ref JsonConfig config; 8 | 9 | ref map GetWhiteList() { 10 | RefreshConfig(); 11 | return config.whiteList; 12 | } 13 | 14 | void RefreshConfig() { 15 | JsonFileLoader.JsonLoadFile(cfgPath + "ClassSelection\\Config.json", config); 16 | } 17 | 18 | void CheckVersion() { 19 | RefreshConfig(); 20 | 21 | if(config) { 22 | string error = ""; 23 | if(config.version != version) { 24 | error = "The Class-Selection mod had some important changes, check the workshop, fix your JSON files and set the version in the Config.json to " + version; 25 | Print(error); 26 | Debug.LogError(error); 27 | Error(error); 28 | GetGame().RequestExit(IDC_MAIN_QUIT); 29 | } 30 | 31 | /* 32 | if(config.showClassSelectOnRespawn && config.giveWeaponsAfterDeath) { 33 | error = "The Class-Selection mod doesn't support showClassSelectOnRespawn and giveWeaponsAfterDeath on the same time, decide what to use and change the config!"; 34 | Print(error); 35 | Debug.LogError(error); 36 | Error(error); 37 | GetGame().RequestExit(IDC_MAIN_QUIT); 38 | }*/ 39 | } 40 | else { 41 | config = SaveConfigExample(); 42 | } 43 | } 44 | 45 | static void CreateDefaultFiles() { 46 | if (!FileExist(cfgPath + cfgMainDir)) MakeDirectory(cfgPath + cfgMainDir); 47 | if (!FileExist(cfgPath + cfgClasses)) { 48 | MakeDirectory(cfgPath + cfgClasses); 49 | SaveClassExampleJSON(cfgPath + cfgClasses); 50 | } 51 | if (!FileExist(cfgPath + cfgPlayerSaves)) MakeDirectory(cfgPath + cfgPlayerSaves); 52 | if (!FileExist(cfgPath + "ClassSelection\\ClassDataExample_"+ version +".json")) SaveClassExampleJSON(cfgPath + "ClassSelection\\"); 53 | if (!FileExist(cfgPath + "ClassSelection\\GeneralItems.json")) SaveItemsExampleJSON(cfgPath + "ClassSelection\\"); 54 | } 55 | 56 | static ref array LoadGeneralItems() { 57 | ref array items = new array; 58 | JsonFileLoader>.JsonLoadFile(cfgPath + "ClassSelection\\GeneralItems.json", items); 59 | return items; 60 | } 61 | 62 | static private ref JsonClassData LoadClassJSON(string ClassName) { 63 | ref JsonClassData loadedClass = new JsonClassData(); 64 | JsonFileLoader.JsonLoadFile(cfgPath + cfgClasses + ClassName, loadedClass); 65 | 66 | if(loadedClass.className) { 67 | return loadedClass; 68 | } 69 | 70 | return null; 71 | } 72 | 73 | static ref array LoadClasses() { 74 | ref array classes = new array; 75 | 76 | string CurrentClassFileName; 77 | FileAttr CurrentClassFileAttr; 78 | 79 | FindFileHandle ClassFileHandle = FindFile(cfgPath + cfgClasses + "*.json", CurrentClassFileName, CurrentClassFileAttr, FindFileFlags.DIRECTORIES); 80 | if(CurrentClassFileName) { 81 | classes.Insert(LoadClassJSON(CurrentClassFileName)); 82 | 83 | while(FindNextFile(ClassFileHandle, CurrentClassFileName, CurrentClassFileAttr)) { 84 | classes.Insert(LoadClassJSON(CurrentClassFileName)); 85 | } 86 | } 87 | 88 | if(classes.Count() == 0) { 89 | string error = "No valid Classes for Class Selection Loaded, maybe invalid JSON? Try to check with online tools."; 90 | Print(error); 91 | Debug.LogError(error); 92 | Error(error); 93 | GetGame().RequestExit(IDC_MAIN_QUIT); 94 | } 95 | 96 | return classes; 97 | } 98 | 99 | static ref JsonConfig SaveConfigExample() { 100 | ref JsonConfig example = new JsonConfig(); 101 | example.version = version; 102 | example.whiteList = new map; 103 | example.whiteList["Admin"] = {"76561198160761279"}; 104 | example.keyToOpen = "KC_COMMA"; 105 | 106 | JsonFileLoader.JsonSaveFile(cfgPath + cfgMainDir + "Config.json", example); 107 | 108 | return example; 109 | } 110 | 111 | static void SaveItemsExampleJSON(string path) { 112 | array example = new array; 113 | 114 | example.Insert(new JsonClassItem("Rag", 6, {}, null, {})); 115 | example.Insert(new JsonClassItem("TacticalBaconCan", 5, {}, null, {})); 116 | example.Insert(new JsonClassItem("WaterBottle", 0, {}, null, {})); 117 | example.Insert(new JsonClassItem("HuntingKnife", 0, {}, null, {})); 118 | 119 | JsonFileLoader>.JsonSaveFile(path + "GeneralItems.json", example); 120 | } 121 | 122 | static void SaveClassExampleJSON(string path) { 123 | JsonClassData example = new JsonClassData(); 124 | 125 | example.className = "Assault"; 126 | example.primaryItems = { 127 | new JsonClassItem("M4A1", 0, {"M4_RISHndgrd_Black", "M4_MPBttstck_Black", "ACOGOptic"}, null, {new JsonClassMagazine("Mag_STANAG_30Rnd", 5)}), 128 | new JsonClassItem("Mosin9130", 0, {}, null, {new JsonClassMagazine("Ammo_762x54", 5)}), 129 | new JsonClassItem("Izh43Shotgun", 0, {}, null, {new JsonClassMagazine("Ammo_12gaPellets", 5)}) 130 | }; 131 | example.secondaryItems = { 132 | new JsonClassItem("MakarovIJ70", 0, {"MakarovPBSuppressor"}, null, {new JsonClassMagazine("MAG_IJ70_8RND", 5)}) 133 | }; 134 | example.utilities = { 135 | new JsonClassItem("LandMineTrap") 136 | }; 137 | example.generalItems = { 138 | new JsonClassItem("FirstAidKit", 0, null, {new JsonClassItem("SalineBagIV"), new JsonClassItem("Epinephrine")}) 139 | }; 140 | 141 | JsonClassClothing clothing = new JsonClassClothing(); 142 | clothing.top = "M65Jacket_Black"; 143 | clothing.pants = "GorkaPants_PautRev"; 144 | clothing.shoes = "MilitaryBoots_Redpunk"; 145 | clothing.backpack = "TortillaBag"; 146 | clothing.vest = "PlateCarrierVest"; 147 | clothing.gloves = "TacticalGloves_Black"; 148 | clothing.belt = "Belt"; 149 | clothing.hat = "BallisticHelmet_UN"; 150 | clothing.glasses = "AviatorGlasses"; 151 | clothing.mask = "GasMask"; 152 | clothing.armband = "Armband_Pink"; 153 | clothing.vestAttachments = { 154 | "PlateCarrierHolster", 155 | "PlateCarrierPouches", 156 | "M67Grenade", 157 | "M67Grenade", 158 | "M67Grenade", 159 | }; 160 | clothing.backpackAttachments = { 161 | "Chemlight_Blue" 162 | }; 163 | 164 | example.clothes = { 165 | clothing 166 | }; 167 | 168 | JsonFileLoader.JsonSaveFile(path + "ClassDataExample_"+ version +".json", example); 169 | } 170 | 171 | static ref array LoadPlayerData(PlayerIdentity identity) { 172 | ref array playerClasses = new array; 173 | JsonFileLoader>.JsonLoadFile(cfgPath + cfgPlayerSaves + identity.GetId() + ".json", playerClasses); 174 | return playerClasses; 175 | } 176 | 177 | static void SavePlayerClasses(array classes, string id) { 178 | JsonFileLoader>.JsonSaveFile(cfgPath + cfgPlayerSaves + id + ".json", classes); 179 | } 180 | 181 | static PlayerBase GetPlayerById (int plyId) { 182 | array players = new array; 183 | PlayerBase result = NULL; 184 | 185 | if (GetGame().IsMultiplayer()) { 186 | GetGame().GetPlayers(players); 187 | 188 | for (int i = 0; i < players.Count(); i++) { 189 | if (players.Get(i).GetIdentity().GetPlayerId() == plyId) { 190 | result = PlayerBase.Cast(players.Get(i)); 191 | } 192 | } 193 | } else { 194 | result = PlayerBase.Cast(GetGame().GetPlayer()); 195 | } 196 | 197 | return result; 198 | } 199 | 200 | static int StringToKeyCode(string code) { 201 | switch(code) { 202 | case "KC_ESCAPE": 203 | return KeyCode.KC_ESCAPE; 204 | break; 205 | case "KC_1": 206 | return KeyCode.KC_1; 207 | break; 208 | case "KC_2": 209 | return KeyCode.KC_2; 210 | break; 211 | case "KC_3": 212 | return KeyCode.KC_3; 213 | break; 214 | case "KC_4": 215 | return KeyCode.KC_4; 216 | break; 217 | case "KC_5": 218 | return KeyCode.KC_5; 219 | break; 220 | case "KC_6": 221 | return KeyCode.KC_6; 222 | break; 223 | case "KC_7": 224 | return KeyCode.KC_7; 225 | break; 226 | case "KC_8": 227 | return KeyCode.KC_8; 228 | break; 229 | case "KC_9": 230 | return KeyCode.KC_9; 231 | break; 232 | case "KC_0": 233 | return KeyCode.KC_0; 234 | break; 235 | case "KC_MINUS": 236 | return KeyCode.KC_MINUS; 237 | break; 238 | case "KC_EQUALS": 239 | return KeyCode.KC_EQUALS; 240 | break; 241 | case "KC_BACK": 242 | return KeyCode.KC_BACK; 243 | break; 244 | case "KC_TAB": 245 | return KeyCode.KC_TAB; 246 | break; 247 | case "KC_Q": 248 | return KeyCode.KC_Q; 249 | break; 250 | case "KC_W": 251 | return KeyCode.KC_W; 252 | break; 253 | case "KC_E": 254 | return KeyCode.KC_E; 255 | break; 256 | case "KC_R": 257 | return KeyCode.KC_R; 258 | break; 259 | case "KC_T": 260 | return KeyCode.KC_T; 261 | break; 262 | case "KC_Y": 263 | return KeyCode.KC_Y; 264 | break; 265 | case "KC_U": 266 | return KeyCode.KC_U; 267 | break; 268 | case "KC_I": 269 | return KeyCode.KC_I; 270 | break; 271 | case "KC_O": 272 | return KeyCode.KC_O; 273 | break; 274 | case "KC_P": 275 | return KeyCode.KC_P; 276 | break; 277 | case "KC_LBRACKET": 278 | return KeyCode.KC_LBRACKET; 279 | break; 280 | case "KC_RBRACKET": 281 | return KeyCode.KC_RBRACKET; 282 | break; 283 | case "KC_RETURN": 284 | return KeyCode.KC_RETURN; 285 | break; 286 | case "KC_LCONTROL": 287 | return KeyCode.KC_LCONTROL; 288 | break; 289 | case "KC_A": 290 | return KeyCode.KC_A; 291 | break; 292 | case "KC_S": 293 | return KeyCode.KC_S; 294 | break; 295 | case "KC_D": 296 | return KeyCode.KC_D; 297 | break; 298 | case "KC_F": 299 | return KeyCode.KC_F; 300 | break; 301 | case "KC_G": 302 | return KeyCode.KC_G; 303 | break; 304 | case "KC_H": 305 | return KeyCode.KC_H; 306 | break; 307 | case "KC_J": 308 | return KeyCode.KC_J; 309 | break; 310 | case "KC_K": 311 | return KeyCode.KC_K; 312 | break; 313 | case "KC_L": 314 | return KeyCode.KC_L; 315 | break; 316 | case "KC_SEMICOLON": 317 | return KeyCode.KC_SEMICOLON; 318 | break; 319 | case "KC_APOSTROPHE": 320 | return KeyCode.KC_APOSTROPHE; 321 | break; 322 | case "KC_GRAVE": 323 | return KeyCode.KC_GRAVE; 324 | break; 325 | case "KC_LSHIFT": 326 | return KeyCode.KC_LSHIFT; 327 | break; 328 | case "KC_BACKSLASH": 329 | return KeyCode.KC_BACKSLASH; 330 | break; 331 | case "KC_Z": 332 | return KeyCode.KC_Z; 333 | break; 334 | case "KC_X": 335 | return KeyCode.KC_X; 336 | break; 337 | case "KC_C": 338 | return KeyCode.KC_C; 339 | break; 340 | case "KC_V": 341 | return KeyCode.KC_V; 342 | break; 343 | case "KC_B": 344 | return KeyCode.KC_B; 345 | break; 346 | case "KC_N": 347 | return KeyCode.KC_N; 348 | break; 349 | case "KC_M": 350 | return KeyCode.KC_M; 351 | break; 352 | case "KC_COMMA": 353 | return KeyCode.KC_COMMA; 354 | break; 355 | case "KC_PERIOD": 356 | return KeyCode.KC_PERIOD; 357 | break; 358 | case "KC_SLASH": 359 | return KeyCode.KC_SLASH; 360 | break; 361 | case "KC_RSHIFT": 362 | return KeyCode.KC_RSHIFT; 363 | break; 364 | case "KC_MULTIPLY": 365 | return KeyCode.KC_MULTIPLY; 366 | break; 367 | case "KC_LMENU": 368 | return KeyCode.KC_LMENU; 369 | break; 370 | case "KC_SPACE": 371 | return KeyCode.KC_SPACE; 372 | break; 373 | case "KC_CAPITAL": 374 | return KeyCode.KC_CAPITAL; 375 | break; 376 | case "KC_F1": 377 | return KeyCode.KC_F1; 378 | break; 379 | case "KC_F2": 380 | return KeyCode.KC_F2; 381 | break; 382 | case "KC_F3": 383 | return KeyCode.KC_F3; 384 | break; 385 | case "KC_F4": 386 | return KeyCode.KC_F4; 387 | break; 388 | case "KC_F5": 389 | return KeyCode.KC_F5; 390 | break; 391 | case "KC_F6": 392 | return KeyCode.KC_F6; 393 | break; 394 | case "KC_F7": 395 | return KeyCode.KC_F7; 396 | break; 397 | case "KC_F8": 398 | return KeyCode.KC_F8; 399 | break; 400 | case "KC_F9": 401 | return KeyCode.KC_F9; 402 | break; 403 | case "KC_F10": 404 | return KeyCode.KC_F10; 405 | break; 406 | case "KC_NUMLOCK": 407 | return KeyCode.KC_NUMLOCK; 408 | break; 409 | case "KC_SCROLL": 410 | return KeyCode.KC_SCROLL; 411 | break; 412 | case "KC_NUMPAD7": 413 | return KeyCode.KC_NUMPAD7; 414 | break; 415 | case "KC_NUMPAD8": 416 | return KeyCode.KC_NUMPAD8; 417 | break; 418 | case "KC_NUMPAD9": 419 | return KeyCode.KC_NUMPAD9; 420 | break; 421 | case "KC_SUBTRACT": 422 | return KeyCode.KC_SUBTRACT; 423 | break; 424 | case "KC_NUMPAD4": 425 | return KeyCode.KC_NUMPAD4; 426 | break; 427 | case "KC_NUMPAD5": 428 | return KeyCode.KC_NUMPAD5; 429 | break; 430 | case "KC_NUMPAD6": 431 | return KeyCode.KC_NUMPAD6; 432 | break; 433 | case "KC_ADD": 434 | return KeyCode.KC_ADD; 435 | break; 436 | case "KC_NUMPAD1": 437 | return KeyCode.KC_NUMPAD1; 438 | break; 439 | case "KC_NUMPAD2": 440 | return KeyCode.KC_NUMPAD2; 441 | break; 442 | case "KC_NUMPAD3": 443 | return KeyCode.KC_NUMPAD3; 444 | break; 445 | case "KC_NUMPAD0": 446 | return KeyCode.KC_NUMPAD0; 447 | break; 448 | case "KC_DECIMAL": 449 | return KeyCode.KC_DECIMAL; 450 | break; 451 | case "KC_OEM_102": 452 | return KeyCode.KC_OEM_102; 453 | break; 454 | case "KC_F11": 455 | return KeyCode.KC_F11; 456 | break; 457 | case "KC_F12": 458 | return KeyCode.KC_F12; 459 | break; 460 | case "KC_NUMPADEQUALS": 461 | return KeyCode.KC_NUMPADEQUALS; 462 | break; 463 | case "KC_PREVTRACK": 464 | return KeyCode.KC_PREVTRACK; 465 | break; 466 | case "KC_AT": 467 | return KeyCode.KC_AT; 468 | break; 469 | case "KC_COLON": 470 | return KeyCode.KC_COLON; 471 | break; 472 | case "KC_UNDERLINE": 473 | return KeyCode.KC_UNDERLINE; 474 | break; 475 | case "KC_STOP": 476 | return KeyCode.KC_STOP; 477 | break; 478 | case "KC_AX": 479 | return KeyCode.KC_AX; 480 | break; 481 | case "KC_UNLABELED": 482 | return KeyCode.KC_UNLABELED; 483 | break; 484 | case "KC_NEXTTRACK": 485 | return KeyCode.KC_NEXTTRACK; 486 | break; 487 | case "KC_NUMPADENTER": 488 | return KeyCode.KC_NUMPADENTER; 489 | break; 490 | case "KC_RCONTROL": 491 | return KeyCode.KC_RCONTROL; 492 | break; 493 | case "KC_MUTE": 494 | return KeyCode.KC_MUTE; 495 | break; 496 | case "KC_CALCULATOR": 497 | return KeyCode.KC_CALCULATOR; 498 | break; 499 | case "KC_PLAYPAUSE": 500 | return KeyCode.KC_PLAYPAUSE; 501 | break; 502 | case "KC_MEDIASTOP": 503 | return KeyCode.KC_MEDIASTOP; 504 | break; 505 | case "KC_VOLUMEDOWN": 506 | return KeyCode.KC_VOLUMEDOWN; 507 | break; 508 | case "KC_VOLUMEUP": 509 | return KeyCode.KC_VOLUMEUP; 510 | break; 511 | case "KC_WEBHOME": 512 | return KeyCode.KC_WEBHOME; 513 | break; 514 | case "KC_NUMPADCOMMA": 515 | return KeyCode.KC_NUMPADCOMMA; 516 | break; 517 | case "KC_DIVIDE": 518 | return KeyCode.KC_DIVIDE; 519 | break; 520 | case "KC_SYSRQ": 521 | return KeyCode.KC_SYSRQ; 522 | break; 523 | case "KC_RMENU": 524 | return KeyCode.KC_RMENU; 525 | break; 526 | case "KC_PAUSE": 527 | return KeyCode.KC_PAUSE; 528 | break; 529 | case "KC_HOME": 530 | return KeyCode.KC_HOME; 531 | break; 532 | case "KC_UP": 533 | return KeyCode.KC_UP; 534 | break; 535 | case "KC_PRIOR": 536 | return KeyCode.KC_PRIOR; 537 | break; 538 | case "KC_LEFT": 539 | return KeyCode.KC_LEFT; 540 | break; 541 | case "KC_RIGHT": 542 | return KeyCode.KC_RIGHT; 543 | break; 544 | case "KC_END": 545 | return KeyCode.KC_END; 546 | break; 547 | case "KC_DOWN": 548 | return KeyCode.KC_DOWN; 549 | break; 550 | case "KC_NEXT": 551 | return KeyCode.KC_NEXT; 552 | break; 553 | case "KC_INSERT": 554 | return KeyCode.KC_INSERT; 555 | break; 556 | case "KC_DELETE": 557 | return KeyCode.KC_DELETE; 558 | break; 559 | case "KC_LWIN": 560 | return KeyCode.KC_LWIN; 561 | break; 562 | case "KC_RWIN": 563 | return KeyCode.KC_RWIN; 564 | break; 565 | case "KC_APPS": 566 | return KeyCode.KC_APPS; 567 | break; 568 | case "KC_POWER": 569 | return KeyCode.KC_POWER; 570 | break; 571 | case "KC_SLEEP": 572 | return KeyCode.KC_SLEEP; 573 | break; 574 | case "KC_WAKE": 575 | return KeyCode.KC_WAKE; 576 | break; 577 | case "KC_MEDIASELECT": 578 | return KeyCode.KC_MEDIASELECT; 579 | break; 580 | } 581 | 582 | return -1; 583 | } 584 | } -------------------------------------------------------------------------------- /5_Mission/json/JsonClassClothing.c: -------------------------------------------------------------------------------- 1 | class JsonClassClothing { 2 | string top; 3 | string pants; 4 | string shoes; 5 | string backpack; 6 | string vest; 7 | string gloves; 8 | string belt; 9 | string hat; 10 | string glasses; 11 | string mask; 12 | string armband; 13 | 14 | ref TStringArray vestAttachments; 15 | ref TStringArray backpackAttachments; 16 | ref TStringArray beltAttachments; 17 | }; -------------------------------------------------------------------------------- /5_Mission/json/JsonClassData.c: -------------------------------------------------------------------------------- 1 | typedef array JsonClassItemArray; 2 | typedef array JsonClassClothingArray; 3 | 4 | class JsonClassData { 5 | string className; 6 | bool selected; 7 | 8 | ref JsonClassItemArray primaryItems; 9 | ref JsonClassItemArray secondaryItems; 10 | ref JsonClassItemArray utilities; 11 | ref JsonClassItemArray generalItems; 12 | ref JsonClassClothingArray clothes; 13 | }; -------------------------------------------------------------------------------- /5_Mission/json/JsonClassItem.c: -------------------------------------------------------------------------------- 1 | typedef array JsonClassMagazineArray; 2 | 3 | class JsonClassItem { 4 | string name; 5 | bool selected; 6 | int quantity; 7 | 8 | ref TStringArray attachments; 9 | ref JsonClassItemArray cargo; 10 | ref JsonClassMagazineArray magazines; 11 | 12 | void JsonClassItem(string w_name, int w_quantity = 0, ref TStringArray w_attachments = null, ref JsonClassItemArray w_cargo = null, ref JsonClassMagazineArray w_mags = null) { 13 | name = w_name; 14 | attachments = w_attachments; 15 | magazines = w_mags; 16 | quantity = w_quantity; 17 | cargo = w_cargo; 18 | } 19 | }; -------------------------------------------------------------------------------- /5_Mission/json/JsonClassMagazine.c: -------------------------------------------------------------------------------- 1 | class JsonClassMagazine { 2 | string name; 3 | int quantity; 4 | 5 | void JsonClassMagazine(string m_name, int m_quantity = 1) { 6 | name = m_name; 7 | quantity = m_quantity; 8 | } 9 | }; -------------------------------------------------------------------------------- /5_Mission/json/JsonClassSelection.c: -------------------------------------------------------------------------------- 1 | class JsonClassSelection { 2 | string className; 3 | bool selected = false; 4 | ref JsonClassItem primary; 5 | ref JsonClassItem secondary; 6 | ref JsonClassItem utility; 7 | 8 | void JsonClassSelection(string s_classname, ClassItem s_primary, ClassItem s_secondary, ClassItem s_utility) { 9 | className = s_classname; 10 | primary = s_primary.ToJSON(); 11 | secondary = s_secondary.ToJSON(); 12 | utility = s_utility.ToJSON(); 13 | } 14 | } -------------------------------------------------------------------------------- /5_Mission/json/JsonConfig.c: -------------------------------------------------------------------------------- 1 | class JsonConfig { 2 | string version; 3 | string keyToOpen; 4 | bool giveWeaponsAfterDeath = false; 5 | bool showClassSelectOnRespawnOnly = false; 6 | bool overrideEquipCharacter = true; 7 | bool overrideStartingEquipSetup = false; 8 | ref map whiteList; 9 | } -------------------------------------------------------------------------------- /5_Mission/layouts/class.layout: -------------------------------------------------------------------------------- 1 | FrameWidgetClass ClassFrame { 2 | position 556.862 297.155 3 | size 287 530 4 | hexactpos 1 5 | vexactpos 1 6 | hexactsize 1 7 | vexactsize 1 8 | scriptclass "ClassData" 9 | { 10 | PanelWidgetClass ClassFrameBackground { 11 | ignorepointer 1 12 | color 0.0118 0.0118 0.0118 0.7059 13 | position 0 0 14 | size 1 1 15 | halign center_ref 16 | valign center_ref 17 | hexactpos 0 18 | vexactpos 0 19 | hexactsize 0 20 | vexactsize 0 21 | style rover_sim_colorable 22 | { 23 | PanelWidgetClass BorderLeft { 24 | inheritalpha 1 25 | ignorepointer 1 26 | color 1 1 1 0.098 27 | size 2 1 28 | valign center_ref 29 | hexactpos 1 30 | vexactpos 1 31 | hexactsize 1 32 | vexactsize 0 33 | style rover_sim_colorable 34 | } 35 | PanelWidgetClass BorderRight { 36 | inheritalpha 1 37 | ignorepointer 1 38 | color 1 1 1 0.098 39 | size 2 1 40 | halign right_ref 41 | valign center_ref 42 | hexactpos 1 43 | vexactpos 1 44 | hexactsize 1 45 | vexactsize 0 46 | style rover_sim_colorable 47 | } 48 | PanelWidgetClass BorderTop { 49 | inheritalpha 1 50 | ignorepointer 1 51 | color 1 1 1 0.098 52 | position 0 0 53 | size 283 2 54 | halign center_ref 55 | hexactpos 1 56 | vexactpos 1 57 | hexactsize 1 58 | vexactsize 1 59 | style rover_sim_colorable 60 | } 61 | } 62 | } 63 | TextWidgetClass ClassName { 64 | ignorepointer 1 65 | position 0 24 66 | size 0.8 40 67 | halign center_ref 68 | hexactpos 0 69 | vexactpos 1 70 | hexactsize 0 71 | vexactsize 1 72 | text "CLASS NAME" 73 | "exact text" 0 74 | "size to text h" 0 75 | "size to text v" 0 76 | "text halign" center 77 | "text valign" center 78 | } 79 | FrameWidgetClass PrimaryWeaponFrame { 80 | clipchildren 0 81 | ignorepointer 0 82 | position 0 100 83 | size 0.8 105 84 | halign center_ref 85 | hexactpos 0 86 | vexactpos 1 87 | hexactsize 0 88 | vexactsize 1 89 | { 90 | ButtonWidgetClass PrimaryNext { 91 | size 0.1 1 92 | halign right_ref 93 | valign center_ref 94 | hexactpos 1 95 | vexactpos 1 96 | hexactsize 0 97 | vexactsize 0 98 | scaled 1 99 | style Empty 100 | text ">" 101 | text_proportion 0.3 102 | } 103 | ButtonWidgetClass PrimaryPrev { 104 | size 0.1 1 105 | valign center_ref 106 | hexactpos 1 107 | vexactpos 1 108 | hexactsize 0 109 | vexactsize 0 110 | scaled 1 111 | style Empty 112 | text "<" 113 | text_proportion 0.3 114 | } 115 | TextWidgetClass PrimaryLabel { 116 | ignorepointer 1 117 | position 0 -10 118 | size 1 14 119 | halign center_ref 120 | hexactpos 0 121 | vexactpos 1 122 | hexactsize 0 123 | vexactsize 1 124 | style Light 125 | text "Primary Weapon:" 126 | "exact text" 0 127 | } 128 | ItemPreviewWidgetClass ClassPrimaryPreview { 129 | ignorepointer 1 130 | position 0 14 131 | size 0.8 90 132 | halign center_ref 133 | hexactpos 0 134 | vexactpos 1 135 | hexactsize 0 136 | vexactsize 1 137 | priority 1 138 | draggable 0 139 | "force flip enable" 0 140 | } 141 | } 142 | } 143 | FrameWidgetClass SecondaryWeaponFrame { 144 | clipchildren 0 145 | ignorepointer 0 146 | position 0 235 147 | size 0.8 105 148 | halign center_ref 149 | hexactpos 0 150 | vexactpos 1 151 | hexactsize 0 152 | vexactsize 1 153 | { 154 | ButtonWidgetClass SecondaryPrev { 155 | size 0.1 1 156 | valign center_ref 157 | hexactpos 1 158 | vexactpos 1 159 | hexactsize 0 160 | vexactsize 0 161 | scaled 1 162 | style Empty 163 | text "<" 164 | text_proportion 0.3 165 | } 166 | ButtonWidgetClass SecondaryNext { 167 | size 0.1 1 168 | halign right_ref 169 | valign center_ref 170 | hexactpos 1 171 | vexactpos 1 172 | hexactsize 0 173 | vexactsize 0 174 | scaled 1 175 | style Empty 176 | text ">" 177 | text_proportion 0.3 178 | } 179 | TextWidgetClass SecondaryLabel { 180 | ignorepointer 1 181 | position 0 -10 182 | size 1 14 183 | halign center_ref 184 | hexactpos 0 185 | vexactpos 1 186 | hexactsize 0 187 | vexactsize 1 188 | style Light 189 | text "Secondary Weapon:" 190 | "exact text" 0 191 | } 192 | ItemPreviewWidgetClass ClassSecondaryPreview { 193 | ignorepointer 1 194 | position 0 14 195 | size 0.8 90 196 | halign center_ref 197 | hexactpos 0 198 | vexactpos 1 199 | hexactsize 0 200 | vexactsize 1 201 | draggable 0 202 | "force flip enable" 0 203 | } 204 | } 205 | } 206 | FrameWidgetClass UtilityFrame { 207 | clipchildren 0 208 | ignorepointer 0 209 | position 0 370 210 | size 0.8 105 211 | halign center_ref 212 | hexactpos 0 213 | vexactpos 1 214 | hexactsize 0 215 | vexactsize 1 216 | { 217 | ButtonWidgetClass UtilityPrev { 218 | size 0.1 1 219 | valign center_ref 220 | hexactpos 1 221 | vexactpos 1 222 | hexactsize 0 223 | vexactsize 0 224 | scaled 1 225 | style Empty 226 | text "<" 227 | text_proportion 0.3 228 | } 229 | ButtonWidgetClass UtilityNext { 230 | size 0.1 1 231 | halign right_ref 232 | valign center_ref 233 | hexactpos 1 234 | vexactpos 1 235 | hexactsize 0 236 | vexactsize 0 237 | scaled 1 238 | style Empty 239 | text ">" 240 | text_proportion 0.3 241 | } 242 | TextWidgetClass UtilityLabel { 243 | ignorepointer 1 244 | position 0 -10 245 | size 1 14 246 | halign center_ref 247 | hexactpos 0 248 | vexactpos 1 249 | hexactsize 0 250 | vexactsize 1 251 | style Light 252 | text "Utility:" 253 | "exact text" 0 254 | } 255 | ItemPreviewWidgetClass ClassUtilityPreview { 256 | ignorepointer 1 257 | position 0 14 258 | size 0.8 90 259 | halign center_ref 260 | hexactpos 0 261 | vexactpos 1 262 | hexactsize 0 263 | vexactsize 1 264 | draggable 0 265 | "force flip enable" 0 266 | } 267 | } 268 | } 269 | ButtonWidgetClass SelectClass { 270 | ignorepointer 1 271 | position 0 0 272 | size 1 35 273 | halign center_ref 274 | valign bottom_ref 275 | hexactpos 1 276 | vexactpos 1 277 | hexactsize 0 278 | vexactsize 1 279 | style MenuDefault 280 | text "SELECT" 281 | text_offset 0 1 282 | text_proportion 0.5 283 | } 284 | } 285 | } -------------------------------------------------------------------------------- /5_Mission/layouts/menu.layout: -------------------------------------------------------------------------------- 1 | FrameWidgetClass rootFrame { 2 | visible 0 3 | clipchildren 1 4 | inheritalpha 0 5 | size 1260 775 6 | halign center_ref 7 | valign center_ref 8 | hexactpos 0 9 | vexactpos 0 10 | hexactsize 1 11 | vexactsize 1 12 | scriptclass "ClassMenu" 13 | { 14 | PanelWidgetClass BackgroundPanel { 15 | visible 1 16 | clipchildren 1 17 | inheritalpha 1 18 | ignorepointer 1 19 | color 0 0 0 0.7451 20 | size 1 1 21 | halign center_ref 22 | valign center_ref 23 | hexactpos 0 24 | vexactpos 0 25 | hexactsize 0 26 | vexactsize 0 27 | scaled 1 28 | style rover_sim_colorable 29 | { 30 | PanelWidgetClass HeadingBackground { 31 | inheritalpha 0 32 | ignorepointer 1 33 | color 0.2 0.2 0.2 1 34 | position 0 0 35 | size 1 80 36 | hexactpos 1 37 | vexactpos 1 38 | hexactsize 0 39 | vexactsize 1 40 | style rover_sim_colorable 41 | { 42 | PanelWidgetClass BorderBottom { 43 | inheritalpha 1 44 | ignorepointer 1 45 | color 1 1 1 0.1961 46 | size 1 1 47 | halign center_ref 48 | valign bottom_ref 49 | hexactpos 1 50 | vexactpos 1 51 | hexactsize 0 52 | vexactsize 1 53 | style rover_sim_colorable 54 | } 55 | } 56 | } 57 | TextWidgetClass Heading { 58 | ignorepointer 1 59 | position 0 17 60 | size 1 45 61 | halign center_ref 62 | hexactpos 0 63 | vexactpos 1 64 | hexactsize 0 65 | vexactsize 1 66 | text "Choose a class and items!" 67 | "exact text" 0 68 | "size to text h" 0 69 | "size to text v" 0 70 | "text halign" center 71 | "text valign" center 72 | } 73 | ButtonWidgetClass SelectButton { 74 | position 0 35 75 | size 540.323 48 76 | halign center_ref 77 | valign bottom_ref 78 | hexactpos 1 79 | vexactpos 1 80 | hexactsize 1 81 | vexactsize 1 82 | style MenuDefault 83 | text "CONFIRM CLASS" 84 | text_offset 0 1.5 85 | text_proportion 0.5 86 | } 87 | ButtonWidgetClass ClassesPrev { 88 | position 0.023 0 89 | size 0.03 1 90 | valign center_ref 91 | hexactpos 0 92 | vexactpos 1 93 | hexactsize 0 94 | vexactsize 0 95 | scaled 1 96 | style Empty 97 | text "<" 98 | text_proportion 0.3 99 | } 100 | ButtonWidgetClass ClassesNext { 101 | position 0.023 0 102 | size 0.03 1 103 | halign right_ref 104 | valign center_ref 105 | hexactpos 0 106 | vexactpos 1 107 | hexactsize 0 108 | vexactsize 0 109 | scaled 1 110 | style Empty 111 | text ">" 112 | text_proportion 0.3 113 | } 114 | TextWidgetClass PageNumber { 115 | ignorepointer 1 116 | position 80 45 117 | size 250 25 118 | valign bottom_ref 119 | hexactpos 1 120 | vexactpos 1 121 | hexactsize 1 122 | vexactsize 1 123 | text "Page: 0 / 0" 124 | } 125 | } 126 | } 127 | } 128 | } -------------------------------------------------------------------------------- /5_Mission/missiongameplay.c: -------------------------------------------------------------------------------- 1 | modded class MissionGameplay { 2 | 3 | ref ClassMenu m_ClassMenu; 4 | ref array m_AvailableClasses; 5 | ref JsonConfig m_Config; 6 | 7 | void MissionGameplay() 8 | { 9 | GetRPCManager().SendRPC("ClassSelection", "RequestConfig", null, true); 10 | GetRPCManager().AddRPC("ClassSelection", "SyncAvailableClasses", this, SingeplayerExecutionType.Client); 11 | GetRPCManager().AddRPC("ClassSelection", "SyncConfig", this, SingeplayerExecutionType.Client); 12 | } 13 | 14 | override void OnKeyPress( int key ) { 15 | super.OnKeyPress(key); 16 | 17 | switch ( key ) { 18 | case ClassSelectionUtils.StringToKeyCode(m_Config.keyToOpen): 19 | if(!m_Config.showClassSelectOnRespawnOnly) GetClassMenu().Toggle(); 20 | break; 21 | default: 22 | } 23 | } 24 | 25 | override void OnUpdate(float timeslice) 26 | { 27 | super.OnUpdate(timeslice); 28 | 29 | PlayerBase player = PlayerBase.Cast(GetGame().GetPlayer()); 30 | if(m_Initialized && !IsPaused() && player && player.IsPlayerLoaded() && !IsPlayerRespawning() && player.IsAlive()) { 31 | if(!HasSelectedClass()) { 32 | GetClassMenu().Show(); 33 | } 34 | } 35 | else { 36 | GetClassMenu().Hide(); 37 | } 38 | } 39 | 40 | void SyncAvailableClasses(CallType type, ref ParamsReadContext ctx, ref PlayerIdentity sender, ref Object target ) 41 | { 42 | Param1> classes; 43 | if ( !ctx.Read( classes ) ) return; 44 | 45 | if( type == CallType.Client ) 46 | { 47 | Print( "ClassSelection - Sync Classes!" ); 48 | m_AvailableClasses = classes.param1; 49 | GetClassMenu(); 50 | } 51 | } 52 | 53 | void SyncConfig(CallType type, ref ParamsReadContext ctx, ref PlayerIdentity sender, ref Object target ) 54 | { 55 | Param1 config; 56 | if ( !ctx.Read( config ) ) return; 57 | 58 | if( type == CallType.Client ) 59 | { 60 | Print( "ClassSelection - Sync Config!" ); 61 | m_Config = config.param1; 62 | } 63 | } 64 | 65 | bool HasSelectedClass(bool returnAvailable = false) { 66 | if(m_AvailableClasses) { 67 | foreach(ref JsonClassData classData: m_AvailableClasses) { 68 | if(classData.selected) { 69 | return true; 70 | } 71 | } 72 | } 73 | if(returnAvailable) return false; 74 | 75 | return GetClassMenu().selectedClass; 76 | } 77 | 78 | private ref ClassMenu GetClassMenu() { 79 | if ( !m_ClassMenu ) { 80 | m_ClassMenu = new ref ClassMenu(); 81 | m_ClassMenu.Init(); 82 | } 83 | 84 | m_ClassMenu.SetAvailableClasses(m_AvailableClasses); 85 | m_ClassMenu.SetConfig(m_Config); 86 | m_ClassMenu.SetSelectedClass(HasSelectedClass(true)); 87 | 88 | return m_ClassMenu; 89 | } 90 | } 91 | -------------------------------------------------------------------------------- /5_Mission/missionserver.c: -------------------------------------------------------------------------------- 1 | modded class MissionServer 2 | { 3 | ref ClassSelectionClass DayZClassSelectionClass; 4 | 5 | override void OnInit() { 6 | super.OnInit(); 7 | GetClassSelection(); 8 | } 9 | 10 | ClassSelectionClass GetClassSelection() { 11 | if(DayZClassSelectionClass == null) { 12 | DayZClassSelectionClass = new ClassSelectionClass(); 13 | } 14 | 15 | return DayZClassSelectionClass; 16 | } 17 | 18 | override void OnEvent(EventType eventTypeId, Param params) 19 | { 20 | super.OnEvent(eventTypeId, params); 21 | 22 | PlayerIdentity identity; 23 | PlayerBase player; 24 | 25 | switch(eventTypeId) 26 | { 27 | case ClientPrepareEventTypeID: 28 | ClientPrepareEventParams clientPrepareParams; 29 | Class.CastTo(clientPrepareParams, params); 30 | 31 | identity = clientPrepareParams.param1; 32 | if(identity) { 33 | GetClassSelection().LoadPlayerData(identity); 34 | } 35 | break; 36 | case ClientReadyEventTypeID: 37 | ClientReadyEventParams readyParams; 38 | Class.CastTo(readyParams, params); 39 | 40 | identity = readyParams.param1; 41 | Class.CastTo(player, readyParams.param2); 42 | if (!player) 43 | { 44 | Debug.Log("ClientReadyEvent: Player is empty"); 45 | return; 46 | } 47 | 48 | GetClassSelection().SendSyncAvailableClasses(identity); 49 | break; 50 | } 51 | } 52 | 53 | override void EquipCharacter(MenuDefaultCharacterData char_data) 54 | { 55 | super.EquipCharacter(char_data); 56 | 57 | if(GetClassSelection().Utils.config.overrideEquipCharacter) { 58 | GetClassSelection().GiveClassEquipment(m_player); 59 | } 60 | } 61 | 62 | override void StartingEquipSetup(PlayerBase player, bool clothesChosen) 63 | { 64 | super.StartingEquipSetup(player, clothesChosen); 65 | 66 | if(GetClassSelection().Utils.config.overrideStartingEquipSetup) { 67 | GetClassSelection().GiveClassEquipment(m_player); 68 | } 69 | } 70 | }; -------------------------------------------------------------------------------- /Config.example.json: -------------------------------------------------------------------------------- 1 | { 2 | "version": "v0.3", 3 | "keyToOpen": "KC_COMMA", 4 | "giveWeaponsAfterDeath": 1, 5 | "showClassSelectOnRespawnOnly": 0, 6 | "whiteList": { 7 | "Admin": [ 8 | "76561198160761279" 9 | ] 10 | } 11 | } -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | GNU GENERAL PUBLIC LICENSE 2 | Version 3, 29 June 2007 3 | 4 | Copyright (C) 2007 Free Software Foundation, Inc. 5 | Everyone is permitted to copy and distribute verbatim copies 6 | of this license document, but changing it is not allowed. 7 | 8 | Preamble 9 | 10 | The GNU General Public License is a free, copyleft license for 11 | software and other kinds of works. 12 | 13 | The licenses for most software and other practical works are designed 14 | to take away your freedom to share and change the works. By contrast, 15 | the GNU General Public License is intended to guarantee your freedom to 16 | share and change all versions of a program--to make sure it remains free 17 | software for all its users. We, the Free Software Foundation, use the 18 | GNU General Public License for most of our software; it applies also to 19 | any other work released this way by its authors. You can apply it to 20 | your programs, too. 21 | 22 | When we speak of free software, we are referring to freedom, not 23 | price. Our General Public Licenses are designed to make sure that you 24 | have the freedom to distribute copies of free software (and charge for 25 | them if you wish), that you receive source code or can get it if you 26 | want it, that you can change the software or use pieces of it in new 27 | free programs, and that you know you can do these things. 28 | 29 | To protect your rights, we need to prevent others from denying you 30 | these rights or asking you to surrender the rights. Therefore, you have 31 | certain responsibilities if you distribute copies of the software, or if 32 | you modify it: responsibilities to respect the freedom of others. 33 | 34 | For example, if you distribute copies of such a program, whether 35 | gratis or for a fee, you must pass on to the recipients the same 36 | freedoms that you received. You must make sure that they, too, receive 37 | or can get the source code. And you must show them these terms so they 38 | know their rights. 39 | 40 | Developers that use the GNU GPL protect your rights with two steps: 41 | (1) assert copyright on the software, and (2) offer you this License 42 | giving you legal permission to copy, distribute and/or modify it. 43 | 44 | For the developers' and authors' protection, the GPL clearly explains 45 | that there is no warranty for this free software. For both users' and 46 | authors' sake, the GPL requires that modified versions be marked as 47 | changed, so that their problems will not be attributed erroneously to 48 | authors of previous versions. 49 | 50 | Some devices are designed to deny users access to install or run 51 | modified versions of the software inside them, although the manufacturer 52 | can do so. This is fundamentally incompatible with the aim of 53 | protecting users' freedom to change the software. The systematic 54 | pattern of such abuse occurs in the area of products for individuals to 55 | use, which is precisely where it is most unacceptable. Therefore, we 56 | have designed this version of the GPL to prohibit the practice for those 57 | products. If such problems arise substantially in other domains, we 58 | stand ready to extend this provision to those domains in future versions 59 | of the GPL, as needed to protect the freedom of users. 60 | 61 | Finally, every program is threatened constantly by software patents. 62 | States should not allow patents to restrict development and use of 63 | software on general-purpose computers, but in those that do, we wish to 64 | avoid the special danger that patents applied to a free program could 65 | make it effectively proprietary. To prevent this, the GPL assures that 66 | patents cannot be used to render the program non-free. 67 | 68 | The precise terms and conditions for copying, distribution and 69 | modification follow. 70 | 71 | TERMS AND CONDITIONS 72 | 73 | 0. Definitions. 74 | 75 | "This License" refers to version 3 of the GNU General Public License. 76 | 77 | "Copyright" also means copyright-like laws that apply to other kinds of 78 | works, such as semiconductor masks. 79 | 80 | "The Program" refers to any copyrightable work licensed under this 81 | License. Each licensee is addressed as "you". "Licensees" and 82 | "recipients" may be individuals or organizations. 83 | 84 | To "modify" a work means to copy from or adapt all or part of the work 85 | in a fashion requiring copyright permission, other than the making of an 86 | exact copy. The resulting work is called a "modified version" of the 87 | earlier work or a work "based on" the earlier work. 88 | 89 | A "covered work" means either the unmodified Program or a work based 90 | on the Program. 91 | 92 | To "propagate" a work means to do anything with it that, without 93 | permission, would make you directly or secondarily liable for 94 | infringement under applicable copyright law, except executing it on a 95 | computer or modifying a private copy. Propagation includes copying, 96 | distribution (with or without modification), making available to the 97 | public, and in some countries other activities as well. 98 | 99 | To "convey" a work means any kind of propagation that enables other 100 | parties to make or receive copies. Mere interaction with a user through 101 | a computer network, with no transfer of a copy, is not conveying. 102 | 103 | An interactive user interface displays "Appropriate Legal Notices" 104 | to the extent that it includes a convenient and prominently visible 105 | feature that (1) displays an appropriate copyright notice, and (2) 106 | tells the user that there is no warranty for the work (except to the 107 | extent that warranties are provided), that licensees may convey the 108 | work under this License, and how to view a copy of this License. If 109 | the interface presents a list of user commands or options, such as a 110 | menu, a prominent item in the list meets this criterion. 111 | 112 | 1. Source Code. 113 | 114 | The "source code" for a work means the preferred form of the work 115 | for making modifications to it. "Object code" means any non-source 116 | form of a work. 117 | 118 | A "Standard Interface" means an interface that either is an official 119 | standard defined by a recognized standards body, or, in the case of 120 | interfaces specified for a particular programming language, one that 121 | is widely used among developers working in that language. 122 | 123 | The "System Libraries" of an executable work include anything, other 124 | than the work as a whole, that (a) is included in the normal form of 125 | packaging a Major Component, but which is not part of that Major 126 | Component, and (b) serves only to enable use of the work with that 127 | Major Component, or to implement a Standard Interface for which an 128 | implementation is available to the public in source code form. A 129 | "Major Component", in this context, means a major essential component 130 | (kernel, window system, and so on) of the specific operating system 131 | (if any) on which the executable work runs, or a compiler used to 132 | produce the work, or an object code interpreter used to run it. 133 | 134 | The "Corresponding Source" for a work in object code form means all 135 | the source code needed to generate, install, and (for an executable 136 | work) run the object code and to modify the work, including scripts to 137 | control those activities. However, it does not include the work's 138 | System Libraries, or general-purpose tools or generally available free 139 | programs which are used unmodified in performing those activities but 140 | which are not part of the work. For example, Corresponding Source 141 | includes interface definition files associated with source files for 142 | the work, and the source code for shared libraries and dynamically 143 | linked subprograms that the work is specifically designed to require, 144 | such as by intimate data communication or control flow between those 145 | subprograms and other parts of the work. 146 | 147 | The Corresponding Source need not include anything that users 148 | can regenerate automatically from other parts of the Corresponding 149 | Source. 150 | 151 | The Corresponding Source for a work in source code form is that 152 | same work. 153 | 154 | 2. Basic Permissions. 155 | 156 | All rights granted under this License are granted for the term of 157 | copyright on the Program, and are irrevocable provided the stated 158 | conditions are met. This License explicitly affirms your unlimited 159 | permission to run the unmodified Program. The output from running a 160 | covered work is covered by this License only if the output, given its 161 | content, constitutes a covered work. This License acknowledges your 162 | rights of fair use or other equivalent, as provided by copyright law. 163 | 164 | You may make, run and propagate covered works that you do not 165 | convey, without conditions so long as your license otherwise remains 166 | in force. You may convey covered works to others for the sole purpose 167 | of having them make modifications exclusively for you, or provide you 168 | with facilities for running those works, provided that you comply with 169 | the terms of this License in conveying all material for which you do 170 | not control copyright. Those thus making or running the covered works 171 | for you must do so exclusively on your behalf, under your direction 172 | and control, on terms that prohibit them from making any copies of 173 | your copyrighted material outside their relationship with you. 174 | 175 | Conveying under any other circumstances is permitted solely under 176 | the conditions stated below. Sublicensing is not allowed; section 10 177 | makes it unnecessary. 178 | 179 | 3. Protecting Users' Legal Rights From Anti-Circumvention Law. 180 | 181 | No covered work shall be deemed part of an effective technological 182 | measure under any applicable law fulfilling obligations under article 183 | 11 of the WIPO copyright treaty adopted on 20 December 1996, or 184 | similar laws prohibiting or restricting circumvention of such 185 | measures. 186 | 187 | When you convey a covered work, you waive any legal power to forbid 188 | circumvention of technological measures to the extent such circumvention 189 | is effected by exercising rights under this License with respect to 190 | the covered work, and you disclaim any intention to limit operation or 191 | modification of the work as a means of enforcing, against the work's 192 | users, your or third parties' legal rights to forbid circumvention of 193 | technological measures. 194 | 195 | 4. Conveying Verbatim Copies. 196 | 197 | You may convey verbatim copies of the Program's source code as you 198 | receive it, in any medium, provided that you conspicuously and 199 | appropriately publish on each copy an appropriate copyright notice; 200 | keep intact all notices stating that this License and any 201 | non-permissive terms added in accord with section 7 apply to the code; 202 | keep intact all notices of the absence of any warranty; and give all 203 | recipients a copy of this License along with the Program. 204 | 205 | You may charge any price or no price for each copy that you convey, 206 | and you may offer support or warranty protection for a fee. 207 | 208 | 5. Conveying Modified Source Versions. 209 | 210 | You may convey a work based on the Program, or the modifications to 211 | produce it from the Program, in the form of source code under the 212 | terms of section 4, provided that you also meet all of these conditions: 213 | 214 | a) The work must carry prominent notices stating that you modified 215 | it, and giving a relevant date. 216 | 217 | b) The work must carry prominent notices stating that it is 218 | released under this License and any conditions added under section 219 | 7. This requirement modifies the requirement in section 4 to 220 | "keep intact all notices". 221 | 222 | c) You must license the entire work, as a whole, under this 223 | License to anyone who comes into possession of a copy. This 224 | License will therefore apply, along with any applicable section 7 225 | additional terms, to the whole of the work, and all its parts, 226 | regardless of how they are packaged. This License gives no 227 | permission to license the work in any other way, but it does not 228 | invalidate such permission if you have separately received it. 229 | 230 | d) If the work has interactive user interfaces, each must display 231 | Appropriate Legal Notices; however, if the Program has interactive 232 | interfaces that do not display Appropriate Legal Notices, your 233 | work need not make them do so. 234 | 235 | A compilation of a covered work with other separate and independent 236 | works, which are not by their nature extensions of the covered work, 237 | and which are not combined with it such as to form a larger program, 238 | in or on a volume of a storage or distribution medium, is called an 239 | "aggregate" if the compilation and its resulting copyright are not 240 | used to limit the access or legal rights of the compilation's users 241 | beyond what the individual works permit. Inclusion of a covered work 242 | in an aggregate does not cause this License to apply to the other 243 | parts of the aggregate. 244 | 245 | 6. Conveying Non-Source Forms. 246 | 247 | You may convey a covered work in object code form under the terms 248 | of sections 4 and 5, provided that you also convey the 249 | machine-readable Corresponding Source under the terms of this License, 250 | in one of these ways: 251 | 252 | a) Convey the object code in, or embodied in, a physical product 253 | (including a physical distribution medium), accompanied by the 254 | Corresponding Source fixed on a durable physical medium 255 | customarily used for software interchange. 256 | 257 | b) Convey the object code in, or embodied in, a physical product 258 | (including a physical distribution medium), accompanied by a 259 | written offer, valid for at least three years and valid for as 260 | long as you offer spare parts or customer support for that product 261 | model, to give anyone who possesses the object code either (1) a 262 | copy of the Corresponding Source for all the software in the 263 | product that is covered by this License, on a durable physical 264 | medium customarily used for software interchange, for a price no 265 | more than your reasonable cost of physically performing this 266 | conveying of source, or (2) access to copy the 267 | Corresponding Source from a network server at no charge. 268 | 269 | c) Convey individual copies of the object code with a copy of the 270 | written offer to provide the Corresponding Source. This 271 | alternative is allowed only occasionally and noncommercially, and 272 | only if you received the object code with such an offer, in accord 273 | with subsection 6b. 274 | 275 | d) Convey the object code by offering access from a designated 276 | place (gratis or for a charge), and offer equivalent access to the 277 | Corresponding Source in the same way through the same place at no 278 | further charge. You need not require recipients to copy the 279 | Corresponding Source along with the object code. If the place to 280 | copy the object code is a network server, the Corresponding Source 281 | may be on a different server (operated by you or a third party) 282 | that supports equivalent copying facilities, provided you maintain 283 | clear directions next to the object code saying where to find the 284 | Corresponding Source. Regardless of what server hosts the 285 | Corresponding Source, you remain obligated to ensure that it is 286 | available for as long as needed to satisfy these requirements. 287 | 288 | e) Convey the object code using peer-to-peer transmission, provided 289 | you inform other peers where the object code and Corresponding 290 | Source of the work are being offered to the general public at no 291 | charge under subsection 6d. 292 | 293 | A separable portion of the object code, whose source code is excluded 294 | from the Corresponding Source as a System Library, need not be 295 | included in conveying the object code work. 296 | 297 | A "User Product" is either (1) a "consumer product", which means any 298 | tangible personal property which is normally used for personal, family, 299 | or household purposes, or (2) anything designed or sold for incorporation 300 | into a dwelling. In determining whether a product is a consumer product, 301 | doubtful cases shall be resolved in favor of coverage. For a particular 302 | product received by a particular user, "normally used" refers to a 303 | typical or common use of that class of product, regardless of the status 304 | of the particular user or of the way in which the particular user 305 | actually uses, or expects or is expected to use, the product. A product 306 | is a consumer product regardless of whether the product has substantial 307 | commercial, industrial or non-consumer uses, unless such uses represent 308 | the only significant mode of use of the product. 309 | 310 | "Installation Information" for a User Product means any methods, 311 | procedures, authorization keys, or other information required to install 312 | and execute modified versions of a covered work in that User Product from 313 | a modified version of its Corresponding Source. The information must 314 | suffice to ensure that the continued functioning of the modified object 315 | code is in no case prevented or interfered with solely because 316 | modification has been made. 317 | 318 | If you convey an object code work under this section in, or with, or 319 | specifically for use in, a User Product, and the conveying occurs as 320 | part of a transaction in which the right of possession and use of the 321 | User Product is transferred to the recipient in perpetuity or for a 322 | fixed term (regardless of how the transaction is characterized), the 323 | Corresponding Source conveyed under this section must be accompanied 324 | by the Installation Information. But this requirement does not apply 325 | if neither you nor any third party retains the ability to install 326 | modified object code on the User Product (for example, the work has 327 | been installed in ROM). 328 | 329 | The requirement to provide Installation Information does not include a 330 | requirement to continue to provide support service, warranty, or updates 331 | for a work that has been modified or installed by the recipient, or for 332 | the User Product in which it has been modified or installed. Access to a 333 | network may be denied when the modification itself materially and 334 | adversely affects the operation of the network or violates the rules and 335 | protocols for communication across the network. 336 | 337 | Corresponding Source conveyed, and Installation Information provided, 338 | in accord with this section must be in a format that is publicly 339 | documented (and with an implementation available to the public in 340 | source code form), and must require no special password or key for 341 | unpacking, reading or copying. 342 | 343 | 7. Additional Terms. 344 | 345 | "Additional permissions" are terms that supplement the terms of this 346 | License by making exceptions from one or more of its conditions. 347 | Additional permissions that are applicable to the entire Program shall 348 | be treated as though they were included in this License, to the extent 349 | that they are valid under applicable law. If additional permissions 350 | apply only to part of the Program, that part may be used separately 351 | under those permissions, but the entire Program remains governed by 352 | this License without regard to the additional permissions. 353 | 354 | When you convey a copy of a covered work, you may at your option 355 | remove any additional permissions from that copy, or from any part of 356 | it. (Additional permissions may be written to require their own 357 | removal in certain cases when you modify the work.) You may place 358 | additional permissions on material, added by you to a covered work, 359 | for which you have or can give appropriate copyright permission. 360 | 361 | Notwithstanding any other provision of this License, for material you 362 | add to a covered work, you may (if authorized by the copyright holders of 363 | that material) supplement the terms of this License with terms: 364 | 365 | a) Disclaiming warranty or limiting liability differently from the 366 | terms of sections 15 and 16 of this License; or 367 | 368 | b) Requiring preservation of specified reasonable legal notices or 369 | author attributions in that material or in the Appropriate Legal 370 | Notices displayed by works containing it; or 371 | 372 | c) Prohibiting misrepresentation of the origin of that material, or 373 | requiring that modified versions of such material be marked in 374 | reasonable ways as different from the original version; or 375 | 376 | d) Limiting the use for publicity purposes of names of licensors or 377 | authors of the material; or 378 | 379 | e) Declining to grant rights under trademark law for use of some 380 | trade names, trademarks, or service marks; or 381 | 382 | f) Requiring indemnification of licensors and authors of that 383 | material by anyone who conveys the material (or modified versions of 384 | it) with contractual assumptions of liability to the recipient, for 385 | any liability that these contractual assumptions directly impose on 386 | those licensors and authors. 387 | 388 | All other non-permissive additional terms are considered "further 389 | restrictions" within the meaning of section 10. If the Program as you 390 | received it, or any part of it, contains a notice stating that it is 391 | governed by this License along with a term that is a further 392 | restriction, you may remove that term. If a license document contains 393 | a further restriction but permits relicensing or conveying under this 394 | License, you may add to a covered work material governed by the terms 395 | of that license document, provided that the further restriction does 396 | not survive such relicensing or conveying. 397 | 398 | If you add terms to a covered work in accord with this section, you 399 | must place, in the relevant source files, a statement of the 400 | additional terms that apply to those files, or a notice indicating 401 | where to find the applicable terms. 402 | 403 | Additional terms, permissive or non-permissive, may be stated in the 404 | form of a separately written license, or stated as exceptions; 405 | the above requirements apply either way. 406 | 407 | 8. Termination. 408 | 409 | You may not propagate or modify a covered work except as expressly 410 | provided under this License. Any attempt otherwise to propagate or 411 | modify it is void, and will automatically terminate your rights under 412 | this License (including any patent licenses granted under the third 413 | paragraph of section 11). 414 | 415 | However, if you cease all violation of this License, then your 416 | license from a particular copyright holder is reinstated (a) 417 | provisionally, unless and until the copyright holder explicitly and 418 | finally terminates your license, and (b) permanently, if the copyright 419 | holder fails to notify you of the violation by some reasonable means 420 | prior to 60 days after the cessation. 421 | 422 | Moreover, your license from a particular copyright holder is 423 | reinstated permanently if the copyright holder notifies you of the 424 | violation by some reasonable means, this is the first time you have 425 | received notice of violation of this License (for any work) from that 426 | copyright holder, and you cure the violation prior to 30 days after 427 | your receipt of the notice. 428 | 429 | Termination of your rights under this section does not terminate the 430 | licenses of parties who have received copies or rights from you under 431 | this License. If your rights have been terminated and not permanently 432 | reinstated, you do not qualify to receive new licenses for the same 433 | material under section 10. 434 | 435 | 9. Acceptance Not Required for Having Copies. 436 | 437 | You are not required to accept this License in order to receive or 438 | run a copy of the Program. Ancillary propagation of a covered work 439 | occurring solely as a consequence of using peer-to-peer transmission 440 | to receive a copy likewise does not require acceptance. However, 441 | nothing other than this License grants you permission to propagate or 442 | modify any covered work. These actions infringe copyright if you do 443 | not accept this License. Therefore, by modifying or propagating a 444 | covered work, you indicate your acceptance of this License to do so. 445 | 446 | 10. Automatic Licensing of Downstream Recipients. 447 | 448 | Each time you convey a covered work, the recipient automatically 449 | receives a license from the original licensors, to run, modify and 450 | propagate that work, subject to this License. You are not responsible 451 | for enforcing compliance by third parties with this License. 452 | 453 | An "entity transaction" is a transaction transferring control of an 454 | organization, or substantially all assets of one, or subdividing an 455 | organization, or merging organizations. If propagation of a covered 456 | work results from an entity transaction, each party to that 457 | transaction who receives a copy of the work also receives whatever 458 | licenses to the work the party's predecessor in interest had or could 459 | give under the previous paragraph, plus a right to possession of the 460 | Corresponding Source of the work from the predecessor in interest, if 461 | the predecessor has it or can get it with reasonable efforts. 462 | 463 | You may not impose any further restrictions on the exercise of the 464 | rights granted or affirmed under this License. For example, you may 465 | not impose a license fee, royalty, or other charge for exercise of 466 | rights granted under this License, and you may not initiate litigation 467 | (including a cross-claim or counterclaim in a lawsuit) alleging that 468 | any patent claim is infringed by making, using, selling, offering for 469 | sale, or importing the Program or any portion of it. 470 | 471 | 11. Patents. 472 | 473 | A "contributor" is a copyright holder who authorizes use under this 474 | License of the Program or a work on which the Program is based. The 475 | work thus licensed is called the contributor's "contributor version". 476 | 477 | A contributor's "essential patent claims" are all patent claims 478 | owned or controlled by the contributor, whether already acquired or 479 | hereafter acquired, that would be infringed by some manner, permitted 480 | by this License, of making, using, or selling its contributor version, 481 | but do not include claims that would be infringed only as a 482 | consequence of further modification of the contributor version. For 483 | purposes of this definition, "control" includes the right to grant 484 | patent sublicenses in a manner consistent with the requirements of 485 | this License. 486 | 487 | Each contributor grants you a non-exclusive, worldwide, royalty-free 488 | patent license under the contributor's essential patent claims, to 489 | make, use, sell, offer for sale, import and otherwise run, modify and 490 | propagate the contents of its contributor version. 491 | 492 | In the following three paragraphs, a "patent license" is any express 493 | agreement or commitment, however denominated, not to enforce a patent 494 | (such as an express permission to practice a patent or covenant not to 495 | sue for patent infringement). To "grant" such a patent license to a 496 | party means to make such an agreement or commitment not to enforce a 497 | patent against the party. 498 | 499 | If you convey a covered work, knowingly relying on a patent license, 500 | and the Corresponding Source of the work is not available for anyone 501 | to copy, free of charge and under the terms of this License, through a 502 | publicly available network server or other readily accessible means, 503 | then you must either (1) cause the Corresponding Source to be so 504 | available, or (2) arrange to deprive yourself of the benefit of the 505 | patent license for this particular work, or (3) arrange, in a manner 506 | consistent with the requirements of this License, to extend the patent 507 | license to downstream recipients. "Knowingly relying" means you have 508 | actual knowledge that, but for the patent license, your conveying the 509 | covered work in a country, or your recipient's use of the covered work 510 | in a country, would infringe one or more identifiable patents in that 511 | country that you have reason to believe are valid. 512 | 513 | If, pursuant to or in connection with a single transaction or 514 | arrangement, you convey, or propagate by procuring conveyance of, a 515 | covered work, and grant a patent license to some of the parties 516 | receiving the covered work authorizing them to use, propagate, modify 517 | or convey a specific copy of the covered work, then the patent license 518 | you grant is automatically extended to all recipients of the covered 519 | work and works based on it. 520 | 521 | A patent license is "discriminatory" if it does not include within 522 | the scope of its coverage, prohibits the exercise of, or is 523 | conditioned on the non-exercise of one or more of the rights that are 524 | specifically granted under this License. You may not convey a covered 525 | work if you are a party to an arrangement with a third party that is 526 | in the business of distributing software, under which you make payment 527 | to the third party based on the extent of your activity of conveying 528 | the work, and under which the third party grants, to any of the 529 | parties who would receive the covered work from you, a discriminatory 530 | patent license (a) in connection with copies of the covered work 531 | conveyed by you (or copies made from those copies), or (b) primarily 532 | for and in connection with specific products or compilations that 533 | contain the covered work, unless you entered into that arrangement, 534 | or that patent license was granted, prior to 28 March 2007. 535 | 536 | Nothing in this License shall be construed as excluding or limiting 537 | any implied license or other defenses to infringement that may 538 | otherwise be available to you under applicable patent law. 539 | 540 | 12. No Surrender of Others' Freedom. 541 | 542 | If conditions are imposed on you (whether by court order, agreement or 543 | otherwise) that contradict the conditions of this License, they do not 544 | excuse you from the conditions of this License. If you cannot convey a 545 | covered work so as to satisfy simultaneously your obligations under this 546 | License and any other pertinent obligations, then as a consequence you may 547 | not convey it at all. For example, if you agree to terms that obligate you 548 | to collect a royalty for further conveying from those to whom you convey 549 | the Program, the only way you could satisfy both those terms and this 550 | License would be to refrain entirely from conveying the Program. 551 | 552 | 13. Use with the GNU Affero General Public License. 553 | 554 | Notwithstanding any other provision of this License, you have 555 | permission to link or combine any covered work with a work licensed 556 | under version 3 of the GNU Affero General Public License into a single 557 | combined work, and to convey the resulting work. The terms of this 558 | License will continue to apply to the part which is the covered work, 559 | but the special requirements of the GNU Affero General Public License, 560 | section 13, concerning interaction through a network will apply to the 561 | combination as such. 562 | 563 | 14. Revised Versions of this License. 564 | 565 | The Free Software Foundation may publish revised and/or new versions of 566 | the GNU General Public License from time to time. Such new versions will 567 | be similar in spirit to the present version, but may differ in detail to 568 | address new problems or concerns. 569 | 570 | Each version is given a distinguishing version number. If the 571 | Program specifies that a certain numbered version of the GNU General 572 | Public License "or any later version" applies to it, you have the 573 | option of following the terms and conditions either of that numbered 574 | version or of any later version published by the Free Software 575 | Foundation. If the Program does not specify a version number of the 576 | GNU General Public License, you may choose any version ever published 577 | by the Free Software Foundation. 578 | 579 | If the Program specifies that a proxy can decide which future 580 | versions of the GNU General Public License can be used, that proxy's 581 | public statement of acceptance of a version permanently authorizes you 582 | to choose that version for the Program. 583 | 584 | Later license versions may give you additional or different 585 | permissions. However, no additional obligations are imposed on any 586 | author or copyright holder as a result of your choosing to follow a 587 | later version. 588 | 589 | 15. Disclaimer of Warranty. 590 | 591 | THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY 592 | APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT 593 | HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY 594 | OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, 595 | THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 596 | PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM 597 | IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF 598 | ALL NECESSARY SERVICING, REPAIR OR CORRECTION. 599 | 600 | 16. Limitation of Liability. 601 | 602 | IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING 603 | WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS 604 | THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY 605 | GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE 606 | USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF 607 | DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD 608 | PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), 609 | EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF 610 | SUCH DAMAGES. 611 | 612 | 17. Interpretation of Sections 15 and 16. 613 | 614 | If the disclaimer of warranty and limitation of liability provided 615 | above cannot be given local legal effect according to their terms, 616 | reviewing courts shall apply local law that most closely approximates 617 | an absolute waiver of all civil liability in connection with the 618 | Program, unless a warranty or assumption of liability accompanies a 619 | copy of the Program in return for a fee. 620 | 621 | END OF TERMS AND CONDITIONS 622 | 623 | How to Apply These Terms to Your New Programs 624 | 625 | If you develop a new program, and you want it to be of the greatest 626 | possible use to the public, the best way to achieve this is to make it 627 | free software which everyone can redistribute and change under these terms. 628 | 629 | To do so, attach the following notices to the program. It is safest 630 | to attach them to the start of each source file to most effectively 631 | state the exclusion of warranty; and each file should have at least 632 | the "copyright" line and a pointer to where the full notice is found. 633 | 634 | 635 | Copyright (C) 636 | 637 | This program is free software: you can redistribute it and/or modify 638 | it under the terms of the GNU General Public License as published by 639 | the Free Software Foundation, either version 3 of the License, or 640 | (at your option) any later version. 641 | 642 | This program is distributed in the hope that it will be useful, 643 | but WITHOUT ANY WARRANTY; without even the implied warranty of 644 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 645 | GNU General Public License for more details. 646 | 647 | You should have received a copy of the GNU General Public License 648 | along with this program. If not, see . 649 | 650 | Also add information on how to contact you by electronic and paper mail. 651 | 652 | If the program does terminal interaction, make it output a short 653 | notice like this when it starts in an interactive mode: 654 | 655 | Copyright (C) 656 | This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'. 657 | This is free software, and you are welcome to redistribute it 658 | under certain conditions; type `show c' for details. 659 | 660 | The hypothetical commands `show w' and `show c' should show the appropriate 661 | parts of the General Public License. Of course, your program's commands 662 | might be different; for a GUI interface, you would use an "about box". 663 | 664 | You should also get your employer (if you work as a programmer) or school, 665 | if any, to sign a "copyright disclaimer" for the program, if necessary. 666 | For more information on this, and how to apply and follow the GNU GPL, see 667 | . 668 | 669 | The GNU General Public License does not permit incorporating your program 670 | into proprietary programs. If your program is a subroutine library, you 671 | may consider it more useful to permit linking proprietary applications with 672 | the library. If this is what you want to do, use the GNU Lesser General 673 | Public License instead of this License. But first, please read 674 | . 675 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # DayZ Class-Selection 2 | 3 | This mod adds an Class-Selection Menu to the game, server-owners can customize the classes and the weapons available. (via JSON files) 4 | Each class can have many weapons to select from. 5 | 6 | ## Features 7 | 8 | * __Players will receive a fully loaded and ready to shoot weapon.__ 9 | * Players can choose from diffrent items in each class 10 | * Players will respawn with the same class after death, but they can change it by pressing "," 11 | * Players will be forced to select a class on first join 12 | * Attachments already have batteries if needed 13 | 14 | 15 | ## Status: Beta 16 | ________________________________________________________ 17 | 18 | ## Config: 19 | Make sure to use the -profiles startparameter for your server! (e.g. -profiles=configs) 20 | 21 | Use the ClassDataExample.json as template and create your classes in the classes folder. 22 | ![Folder](https://i.imgur.com/GzOtUqg.png) 23 | 24 | ## Incompatible Mods: 25 | * Expansion Mod 26 | 27 | ### Important! 28 | __(Following needed if you override the "EquipCharacter()" function in your CustomMission (init.c) or via. a modded MissionServer class.)__ 29 | Make sure that you call "GetClassSelection().GiveClassEquipment(m_player);" and don't clear player items after that call, for obvious reasons. 30 | 31 | ## Future-Development: 32 | 33 | * Json for general items given to all players 34 | * Whitelist for classes 35 | * Add Quantity Field to utility items / add own type 36 | * Add support for container items e.g. first aid kit etc. 37 | * Attachment selection Menu 38 | * Clothing selection Menu 39 | 40 | ### Please give me credits if you use / modify the sourcecode of my mod! 41 | 42 | # Useful Commands: 43 | ## Restart & Rebuild Mod 44 | 45 | ```Stop-Process -Name "DayZDiag_x64";Start-Process -FilePath "C:\Program Files\PBO Manager v.1.4 beta\PBOConsole.exe" -ArgumentList '-pack "P:\d3xters-class-selection\Scripts" "P:\d3xters-class-selection\Addons\d3xters-class-selection.pbo"';./DayZDiag_x64.exe -server -config="serverDZ.cfg" "-mod=RPCFramework;d3xters-class-selection" -nopause -filePatching -profiles=configs;./DayZDiag_x64.exe -nopause "-mod=RPCFramework;d3xters-class-selction" -filePatching -connect=192.168.178.39 -port=2302;``` 46 | 47 | 48 | ## Restart Only Server & Rebuild Mod 49 | 50 | ```Stop-Process -Name "DayZDiag_x64";Start-Process -FilePath "C:\Program Files\PBO Manager v.1.4 beta\PBOConsole.exe" -ArgumentList '-pack "P:\d3xters-class-selection\Scripts" "P:\d3xters-class-selection\Addons\d3xters-class-selection.pbo"';./DayZDiag_x64.exe -server -config="serverDZ.cfg" "-mod=RPCFramework;d3xters-class-selection" -nopause -filePatching -profiles=configs;``` 51 | 52 | 53 | -------------------------------------------------------------------------------- /config.cpp: -------------------------------------------------------------------------------- 1 | class CfgPatches 2 | { 3 | class classslection_scripts 4 | { 5 | units[]={}; 6 | weapons[]={}; 7 | requiredVersion=0.1; 8 | requiredAddons[]= 9 | { 10 | "DZ_Data", 11 | "RPC_Scripts" 12 | }; 13 | }; 14 | }; 15 | 16 | class CfgMods 17 | { 18 | class classslection 19 | { 20 | 21 | dir = "d3xters-class-selection"; 22 | picture = ""; 23 | hideName = 1; 24 | hidePicture = 1; 25 | name = "DayZ Class-Selection Mod"; 26 | action = "https://github.com/d3xter-dev"; 27 | author = "D3XTER-dev"; 28 | authorID = "LemmingTV"; 29 | version = "0.1"; 30 | extra = 0; 31 | type = "mod"; 32 | dependencies[] = {"Game", "World", "Mission"}; 33 | 34 | class defs 35 | { 36 | class gameScriptModule 37 | { 38 | value = ""; 39 | files[] = {"d3xters-class-selection/Scripts/3_Game"}; 40 | }; 41 | class worldScriptModule 42 | { 43 | value = ""; 44 | files[] = {"d3xters-class-selection/Scripts/4_World"}; 45 | }; 46 | class missionScriptModule 47 | { 48 | value = ""; 49 | files[] = {"d3xters-class-selection/Scripts/5_Mission"}; 50 | }; 51 | }; 52 | }; 53 | }; -------------------------------------------------------------------------------- /dayz.gproj: -------------------------------------------------------------------------------- 1 | GameProjectClass { 2 | ID "DayZ" 3 | TITLE "DayZ" 4 | Configurations { 5 | GameProjectConfigClass PC { 6 | platformHardware PC 7 | skeletonDefinitions "DZ/Anims/cfg/skeletons.anim.xml" 8 | FileSystem { 9 | FileSystemPathClass { 10 | Name "Game Root" 11 | Directory "./" 12 | } 13 | } 14 | imageSets { 15 | "gui/imagesets/ccgui_enforce.imageset" 16 | "gui/imagesets/rover_imageset.imageset" 17 | "gui/imagesets/dayz_gui.imageset" 18 | "gui/imagesets/dayz_crosshairs.imageset" 19 | "gui/imagesets/dayz_inventory.imageset" 20 | "gui/imagesets/inventory_icons.imageset" 21 | "gui/imagesets/main_menu_newsfeed.imageset" 22 | "gui/imagesets/smart_panel.imageset" 23 | "gui/imagesets/GUI_back_alpha.imageset" 24 | "gui/imagesets/GUI_back_alpha_icon.imageset" 25 | "gui/imagesets/xbox_buttons.imageset" 26 | "gui/imagesets/playstation_buttons.imageset" 27 | "gui/imagesets/selection.imageset" 28 | "gui/imagesets/console_toolbar.imageset" 29 | } 30 | widgetStyles { 31 | "gui/looknfeel/dayzwidgets.styles" 32 | "gui/looknfeel/widgets.styles" 33 | } 34 | ScriptModules { 35 | ScriptModulePathClass { 36 | Name "core" 37 | Paths { 38 | "DayZ Data/scripts/1_Core" 39 | } 40 | EntryPoint "" 41 | } 42 | ScriptModulePathClass { 43 | Name "gameLib" 44 | Paths { 45 | "DayZ Data/scripts/2_GameLib" 46 | } 47 | EntryPoint "" 48 | } 49 | ScriptModulePathClass { 50 | Name "game" 51 | Paths { 52 | "DayZ Data/scripts/3_Game" 53 | "DayZ-RPCFramework/RPCFramework/Addons/scripts/3_Game" 54 | "d3xters-class-selection/Scripts/3_Game" 55 | } 56 | EntryPoint "CreateGame" 57 | } 58 | ScriptModulePathClass { 59 | Name "world" 60 | Paths { 61 | "DayZ Data/scripts/4_World" 62 | "d3xters-class-selection/Scripts/4_World" 63 | } 64 | EntryPoint "" 65 | } 66 | ScriptModulePathClass { 67 | Name "mission" 68 | Paths { 69 | "DayZ Data/scripts/5_Mission" 70 | "d3xters-class-selection/Scripts/5_Mission" 71 | } 72 | EntryPoint "CreateMission" 73 | } 74 | ScriptModulePathClass { 75 | Name "workbench" 76 | Paths { 77 | "DayZ Data/scripts/editor/Workbench" 78 | "DayZ Data/scripts/editor/plugins" 79 | } 80 | EntryPoint "" 81 | } 82 | } 83 | } 84 | GameProjectConfigClass XBOX_ONE { 85 | platformHardware XBOX_ONE 86 | } 87 | GameProjectConfigClass PS4 { 88 | platformHardware PS4 89 | } 90 | GameProjectConfigClass LINUX { 91 | platformHardware LINUX 92 | } 93 | } 94 | } 95 | -------------------------------------------------------------------------------- /keys.js: -------------------------------------------------------------------------------- 1 | let keys =["KC_ESCAPE","KC_1","KC_2","KC_3","KC_4","KC_5","KC_6","KC_7","KC_8","KC_9","KC_0","KC_MINUS","KC_EQUALS","KC_BACK","KC_TAB","KC_Q","KC_W","KC_E","KC_R","KC_T","KC_Y","KC_U","KC_I","KC_O","KC_P","KC_LBRACKET","KC_RBRACKET","KC_RETURN","KC_LCONTROL","KC_A","KC_S","KC_D","KC_F","KC_G","KC_H","KC_J","KC_K","KC_L","KC_SEMICOLON","KC_APOSTROPHE","KC_GRAVE","KC_LSHIFT","KC_BACKSLASH","KC_Z","KC_X","KC_C","KC_V","KC_B","KC_N","KC_M","KC_COMMA","KC_PERIOD","KC_SLASH","KC_RSHIFT","KC_MULTIPLY","KC_LMENU","KC_SPACE","KC_CAPITAL","KC_F1","KC_F2","KC_F3","KC_F4","KC_F5","KC_F6","KC_F7","KC_F8","KC_F9","KC_F10","KC_NUMLOCK","KC_SCROLL","KC_NUMPAD7","KC_NUMPAD8","KC_NUMPAD9","KC_SUBTRACT","KC_NUMPAD4","KC_NUMPAD5","KC_NUMPAD6","KC_ADD","KC_NUMPAD1","KC_NUMPAD2","KC_NUMPAD3","KC_NUMPAD0","KC_DECIMAL","KC_OEM_102","KC_F11","KC_F12","KC_NUMPADEQUALS","KC_PREVTRACK","KC_AT","KC_COLON","KC_UNDERLINE","KC_STOP","KC_AX","KC_UNLABELED","KC_NEXTTRACK","KC_NUMPADENTER","KC_RCONTROL","KC_MUTE","KC_CALCULATOR","KC_PLAYPAUSE","KC_MEDIASTOP","KC_VOLUMEDOWN","KC_VOLUMEUP","KC_WEBHOME","KC_NUMPADCOMMA","KC_DIVIDE","KC_SYSRQ","KC_RMENU","KC_PAUSE","KC_HOME","KC_UP","KC_PRIOR","KC_LEFT","KC_RIGHT","KC_END","KC_DOWN","KC_NEXT","KC_INSERT","KC_DELETE","KC_LWIN","KC_RWIN","KC_APPS","KC_POWER","KC_SLEEP","KC_WAKE","KC_MEDIASELECT"]; 2 | 3 | let code = ""; 4 | for(let key in keys) { 5 | code += ('case "KEY":\n' 6 | + ' return KeyCode.KEY;\n' 7 | + 'break;\n').replace('KEY', keys[key]).replace('KEY', keys[key]); 8 | } -------------------------------------------------------------------------------- /serverDZ.cfg: -------------------------------------------------------------------------------- 1 | hostname = "EXAMPLE NAME"; // Server name 2 | password = ""; // Password to connect to the server 3 | passwordAdmin = ""; // Password to become a server admin 4 | 5 | enableWhitelist = 0; // Enable/disable whitelist (value 0-1) 6 | 7 | maxPlayers = 60; // Maximum amount of players 8 | 9 | BattlEye = 0; // turn off BE since diag exe does not run with it 10 | 11 | verifySignatures = 0; // if testing mods which aren't properly signed 12 | 13 | forceSameBuild = 1; // When enabled, the server will allow the connection only to clients with same the .exe revision as the server (value 0-1) 14 | 15 | disableVoN = 0; // Enable/disable voice over network (value 0-1) 16 | vonCodecQuality = 20; // Voice over network codec quality, the higher the better (values 0-30) 17 | 18 | disable3rdPerson = 0; // Toggles the 3rd person view for players (value 0-1) 19 | disableCrosshair = 0; // Toggles the cross-hair (value 0-1) 20 | 21 | serverTime = "SystemTime"; // Initial in-game time of the server. "SystemTime" means the local time of the machine. Another possibility is to set the time to some value in "YYYY/MM/DD/HH/MM" format, e.g "2015/4/8/17/23". 22 | serverTimeAcceleration = 1; // Accelerated Time - The numerical value being a multiplier (0.1-64). Thus, in case it is set to 24, time would move 24 times faster than normal. An entire day would pass in one hour. 23 | serverNightTimeAcceleration = 1;// Accelerated Nigh Time - The numerical value being a multiplier (0.1-64) and also multiplied by serverTimeAcceleration value. 24 | // Thus, in case it is set to 4 and serverTimeAcceleration is set to 2, night time would move 8 times faster than normal. 25 | // An entire night would pass in 3 hours. 26 | serverTimePersistent = 0; // Persistent Time (value 0-1)// The actual server time is saved to storage, so when active, the next server start will use the saved time value. 27 | 28 | guaranteedUpdates = 1; // Communication protocol used with game server (use only number 1) 29 | 30 | loginQueueConcurrentPlayers = 5; // The number of players concurrently processed during the login process. Should prevent massive performance drop during connection when a lot of people are connecting at the same time. 31 | loginQueueMaxPlayers = 500; // The maximum number of players that can wait in login queue 32 | 33 | instanceId = 1; // DayZ server instance id, to identify the number of instances per box and their storage folders with persistence files 34 | 35 | storeHouseStateDisabled = false;// Disable houses/doors persistence (value true/false), usable in case of problems with persistence 36 | storageAutoFix = 1; // Checks if the persistence files are corrupted and replaces corrupted ones with empty ones (value 0-1) 37 | allowFilePatching = 1; 38 | 39 | class Missions 40 | { 41 | class DayZ 42 | { 43 | template = "dayzOffline.chernarusplus"; // Mission to load on server startup. . 44 | }; 45 | }; --------------------------------------------------------------------------------