├── .editorconfig ├── .github ├── ISSUE_TEMPLATE │ ├── bug-report.md │ └── feature-request.md └── workflows │ └── release.yml ├── .gitignore ├── LICENSE ├── Makefile ├── README.md ├── dumps ├── PlayerPuppet.txt └── settings.ini ├── icon.png ├── manifest.json ├── mods └── braindance_protocol │ ├── BD.lua │ ├── CPStyling │ ├── LICENSE │ ├── README.md │ ├── init.lua │ ├── png-lua │ │ ├── README.md │ │ ├── deflatelua.lua │ │ └── png.lua │ ├── styles.lua │ └── theme.lua │ ├── ai │ └── vehicles.lua │ ├── cheats │ ├── ammo.lua │ ├── crafting.lua │ ├── cyberware.lua │ ├── facts.lua │ ├── itemsets.lua │ ├── johnny.lua │ ├── legend.lua │ ├── modify.lua │ ├── platform.lua │ ├── player.lua │ └── teleport.lua │ ├── data │ └── ItemHashes.txt │ ├── engine │ ├── saves.lua │ ├── time.lua │ └── visual.lua │ ├── examples │ └── init.lua │ ├── fact.lua │ ├── hotkeys.lua │ ├── i18n │ ├── LICENSE │ ├── README.md │ ├── init.lua │ ├── interpolate.lua │ ├── plural.lua │ ├── variants.lua │ └── version.lua │ ├── init.lua │ ├── inventory.lua │ ├── lang │ ├── README.md │ ├── cn.lua │ ├── da.lua │ ├── de.lua │ ├── en.lua │ ├── fr.lua │ ├── lang.lua │ ├── ru.lua │ └── update.lua │ ├── options.lua │ ├── player.lua │ ├── protocols.lua │ ├── ui │ ├── init.lua │ ├── list.lua │ ├── search.lua │ ├── searchbar.lua │ ├── searchlist.lua │ └── widgets.lua │ ├── utility.lua │ └── utility │ └── shopper.lua └── tools ├── cybermods.sh └── nexus.sh /.editorconfig: -------------------------------------------------------------------------------- 1 | root = true 2 | 3 | [*] 4 | indent_size = 4 5 | indent_style = space 6 | charset = utf-8 7 | trim_trailing_whitespace = true 8 | insert_final_newline = true 9 | end_of_line = lf 10 | 11 | [Makefile] 12 | indent_style = tab 13 | -------------------------------------------------------------------------------- /.github/ISSUE_TEMPLATE/bug-report.md: -------------------------------------------------------------------------------- 1 | --- 2 | name: Bug Report 3 | about: Create a report to help us improve and fix your issue 4 | title: '' 5 | labels: '' 6 | assignees: '' 7 | 8 | --- 9 | 10 | ## Description 11 | A brief, concise, summary of your issue. 12 | 13 | ## Expected Behaviour 14 | A short summary of expected behaviour. 15 | 16 | ## Actual Behaviour 17 | A short summary of the actual behaviour. 18 | 19 | ## Replication Steps 20 | Short, bullet-pointed, replication steps. 21 | -------------------------------------------------------------------------------- /.github/ISSUE_TEMPLATE/feature-request.md: -------------------------------------------------------------------------------- 1 | --- 2 | name: Feature Request 3 | about: Create a feature request for a script you'd like to see 4 | title: '' 5 | labels: '' 6 | assignees: '' 7 | 8 | --- 9 | 10 | ## Description 11 | A brief, concise, summary of your feature. 12 | 13 | ## Code Snippets and Documentation 14 | Any useful code snippets or documentation that will reduce time to research. 15 | 16 | ## Further Details 17 | Optional details e.g. suggested parameters or default values. 18 | -------------------------------------------------------------------------------- /.github/workflows/release.yml: -------------------------------------------------------------------------------- 1 | name: Release 2 | on: 3 | release: 4 | types: [published] 5 | 6 | jobs: 7 | build: 8 | runs-on: ubuntu-latest 9 | steps: 10 | - uses: actions/checkout@v2 11 | - name: Set env 12 | run: echo "RELEASE_VERSION=${GITHUB_REF#refs/*/}" >> $GITHUB_ENV 13 | 14 | - name: Update manifest.json version_number 15 | uses: jossef/action-set-json-field@v1 16 | with: 17 | file: manifest.json 18 | field: version_number 19 | value: ${{ env.RELEASE_VERSION }} 20 | 21 | - name: Copy files 22 | run: | 23 | mkdir -p ./build/nexus/bin/x64/plugins/cyber_engine_tweaks/ ./build/cybermods/ ./build/release/ 24 | cp LICENSE ./mods/braindance_protocol/ 25 | rsync -a mods/ ./build/nexus/bin/x64/plugins/cyber_engine_tweaks/mods/ 26 | rsync -a mods/ ./build/cybermods/mods/ 27 | rsync -a README.md manifest.json icon.png ./build/cybermods/ 28 | - name: Zip NexusMods Release 29 | uses: TheDoctor0/zip-release@0.4.1 30 | with: 31 | filename: ../release/braindance_protocol_${{ env.RELEASE_VERSION }}.zip 32 | directory: ./build/nexus/ 33 | 34 | - name: Zip CyberMods Release 35 | uses: TheDoctor0/zip-release@0.4.1 36 | with: 37 | filename: ../release/braindance_protocol_${{ env.RELEASE_VERSION }}_cybermods.zip 38 | directory: ./build/cybermods/ 39 | 40 | - name: Upload Artifacts 41 | uses: ncipollo/release-action@v1 42 | with: 43 | allowUpdates: true 44 | omitNameDuringUpdate: true 45 | omitBodyDuringUpdate: true 46 | artifacts: "./build/release/braindance_protocol_${{ env.RELEASE_VERSION }}.zip,./build/release/braindance_protocol_${{ env.RELEASE_VERSION }}_cybermods.zip" 47 | token: ${{ secrets.GITHUB_TOKEN }} 48 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | builds/* 2 | .git/ 3 | .github/ 4 | 5 | # Local Development 6 | mods/braindance_protocol/braindance_protocol*.log 7 | mods/braindance_protocol/db.sqlite3 8 | mods/braindance_protocol/config.json 9 | mods/braindance_protocol/favorites.json 10 | mods/braindance_protocol/lang/*_old.lua 11 | -------------------------------------------------------------------------------- /Makefile: -------------------------------------------------------------------------------- 1 | DIR := ${CURDIR} 2 | .DEFAULT_GOAL := help 3 | .PHONY: package 4 | 5 | package: ## Package the project 6 | bash tools/cybermods.sh 7 | bash tools/nexus.sh 8 | 9 | help: ## Show this help 10 | @grep -E '^[a-zA-Z_-]+:.*?## .*$$' $(MAKEFILE_LIST) | sed 's/Makefile://' | awk 'BEGIN {FS = ":.*?## "}; {printf "\033[36m%-30s\033[0m %s\n", $$1, $$2}' 11 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # BraindanceProtocol 2 | 3 | A GUI and Console tool to modify your Cyberpunk 2077 experience. 4 | 5 | ## Preview 6 | ![Preview GUI](https://i.imgur.com/CqgWaUB.gif) ![Favorites and Search](https://i.imgur.com/oEi4JrV.gif) 7 | 8 | ## Requirements 9 | 10 | - Requires latest version of [CyberEngineTweaks](https://github.com/yamashi/CyberEngineTweaks/releases/latest). 11 | - For help installing CyberEngineTweaks, see this [Installation page on the wiki](https://wiki.cybermods.net/cyber-engine-tweaks/getting-started/installing). 12 | - Legitimate Copy of Cyberpunk 2077 Version 1.3 13 | 14 | ## Installation 15 | 16 | Drop `mods` folder into `bin\x64\plugins\cyber_engine_tweaks\` 17 | 18 | *Please make a clean installation if you are updating BraindanceProtocol 19 | 20 | ## Usage 21 | 22 | - Configure the hotkey for opening the GUI inside the ![Hotkeys](https://i.imgur.com/CunXqfq.png) tab of CyberEngineTweaks 23 | - To open the GUI, either: 24 | 1. Open the [CET](https://github.com/yamashi/CyberEngineTweaks) console - OR - 25 | 2. Press the hotkey to open the GUI (You need to close the console first) 26 | 27 | 28 | 29 | ## Configuring Custom Hotkeys 30 | 31 | Follow these steps to configure custom hotkeys, for the protocols you want to keybind: 32 | 33 | 1. Open the BDP GUI 34 | 2. Find your desired protocol(s), and press the hotkey icon: ![Hotkey icon](https://i.imgur.com/AfPZJbj.png) 35 | 3. Open the [CET](https://github.com/yamashi/CyberEngineTweaks) console and press the ![Reload All Mods](https://i.imgur.com/WGNgDiE.png) button 36 | 4. Configure your new hotkey(s) from the ![Hotkeys](https://i.imgur.com/CunXqfq.png) tab in CET 37 | 38 | ![Custom Hotkeys](https://i.imgur.com/f1HhudU.gif) 39 | 40 | 41 | ## Currently Supported Languages 42 | 43 | - English 44 | - Chinese - 中文 (Translator: Senfee-Cheng) 45 | - Danish - Dansk (Translator: VP-EN) 46 | - German - Deutsch (Translator: nodeg) 47 | - Russian - Русский (Translator: vanja-san) 48 | - French - Français (Translator: praxatics) 49 | 50 | ## How to display other languages 51 | Here is a [detailed guide](https://wiki.cybermods.net/cyber-engine-tweaks/getting-started/configuration/change-font-and-font-size#how-to-display-non-english-characters) on how to change the font of CET to display the non-English Characters. 52 | 53 | ## Need help with translation 54 | 55 | Please read [this guide](https://github.com/WolvenKit/BraindanceProtocol/blob/main/mods/braindance_protocol/lang/README.md) and [this issue](https://github.com/WolvenKit/BraindanceProtocol/issues/53) to get more information. 56 | -------------------------------------------------------------------------------- /dumps/PlayerPuppet.txt: -------------------------------------------------------------------------------- 1 | { 2 | name: PlayerPuppet, 3 | functions: { 4 | IsPlayer;, 5 | IsReplacer;, 6 | IsVRReplacer;, 7 | IsJohnnyReplacer;, 8 | IsReplicable;, 9 | GetReplicatedStateClass;, 10 | IsCoverModifierAdded;, 11 | IsWorkspotDamageReductionAdded;, 12 | IsWorkspotVisibilityReductionActive;, 13 | GetOverlappedSecurityZones;, 14 | GetPS, 15 | OnRequestComponents, 16 | FindVehicleCameraManager;, 17 | OnTakeControl, 18 | OnReleaseControl, 19 | OnGameAttached, 20 | GracePeriodAfterSpawn;, 21 | OnMakePlayerVisibleAfterSpawn, 22 | OnWeaponEquipEvent, 23 | EvaluateApplyingReplacerGameplayRestrictions;, 24 | ResolveCachedGameplayRestrictions;, 25 | AddGameplayRestriction;IBlackboardTweakDBID, 26 | RemoveGameplayRestriction;IBlackboardTweakDBID, 27 | CacheGameplayRestriction;TweakDBID, 28 | PlayerAttachedCallback;GameObject, 29 | PlayerDetachedCallback;GameObject, 30 | OnAttach, 31 | OnDetach, 32 | ShouldRegisterToHUD;, 33 | OnAction, 34 | CanCycleLootData;, 35 | KeybaordAndMouseControlsActive;, 36 | DeductGameInputActionType;, 37 | HasPrimaryOrSecondaryEquipment;, 38 | ActivateIconicCyberware;, 39 | ProcessCallVehicleAction;gameinputActionType, 40 | IsCallingVehicleRestricted;, 41 | GetUnlockedVehiclesSize;, 42 | SendSummonVehicleQuickSlotsManagerRequest;, 43 | CheckVehicleSystemGarageState;, 44 | CheckRadialContextRequest;, 45 | OnActionMultiplayer;ListenerActionListenerActionConsumer, 46 | GetCPOQuickSlotID;ListenerAction, 47 | UpdatePlayerSettings;, 48 | GetQuickSlotsManager;, 49 | GetInspectionComponent;, 50 | GetFPPCameraComponent;, 51 | GetBufferModifier;, 52 | SetBufferModifier;Int32, 53 | GetPlayerStateMachineBlackboard;, 54 | GetPlayerPerkDataBlackboard;, 55 | GetHackingDataBlackboard;, 56 | GetDamageThresholdParams;, 57 | RegisterUIBlackboardListener;, 58 | SetupInPlayerDevelopmentSystem;, 59 | UpdateVisibilityModifier;, 60 | OnBeingNoticed, 61 | SetEntityNoticedPlayerBBValue;Bool, 62 | OnClearBeingNoticedBB, 63 | OnBeingTargetByLaserSight, 64 | OnBeingTarget, 65 | OnInteractionStateChange, 66 | OnUpdateVisibilityModifierEvent, 67 | OnUpdateAutoRevealStatEvent, 68 | HasAutoReveal;, 69 | OnUIContextChange, 70 | OnUIRadialContextChange, 71 | OnUIContactListContextChanged, 72 | OnUIVendorContextChange, 73 | OnExperienceGained, 74 | OnLevelUp, 75 | OnRequestStats, 76 | OnBuyAttribute, 77 | OnItemAddedToSlot, 78 | OnPartAddedToSlotEvent, 79 | OnClearItemAppearanceEvent, 80 | OnResetItemAppearanceEvent, 81 | OnItemRemovedFromSlot, 82 | OnPartRemovedFromSlotEvent, 83 | OnItemChangedEvent, 84 | OnPartRemovedEvent, 85 | OnItemAddedToInventory, 86 | UpdateInventoryWeight;Float, 87 | OnItemBeingRemovedFromInventory, 88 | OnInventoryEmpty, 89 | EvaluateEncumbrance;, 90 | CalculateEncumbrance;, 91 | OnEvaluateEncumbranceEvent, 92 | SendCheckRemovedItemWithSlotActiveItemRequest;ItemID, 93 | OnTakedownOrder, 94 | OnSpiderbotOrderTargetEvent, 95 | OnHitBlockedOrDeflected;gameHitEvent, 96 | OnHitAnimation;gameHitEvent, 97 | AddOnHitRumble;gameHitEvent, 98 | PushHitDataToGraph;gameHitEvent, 99 | SendCameraShakeDataToGraph;gameHitEventFloat, 100 | OnHitUI;gameHitEvent, 101 | OnHitSounds;gameHitEvent, 102 | OnDamageInflicted, 103 | GetLastDamageInflictedTime;, 104 | OnInteraction, 105 | OnTogglePlayerFlashlightEvent, 106 | OnMagFieldHitEvent, 107 | OnKatanaMagFieldHitDelayEvent;KatanaMagFieldHitDelayEvent, 108 | OnResetMagFieldHitsEvent;ResetMagFieldHitsEvent, 109 | OnResetTickEvent, 110 | SendMagFieldAnimFeature;, 111 | InitializeTweakDBRecords;, 112 | DefineModifierGroups;, 113 | RegisterStatListeners;PlayerPuppet, 114 | UnregisterStatListeners;PlayerPuppet, 115 | OnCleanUpTimeDilationEvent, 116 | OnHealthUpdateEvent, 117 | UpdateHealthStateSFX;HealthUpdateEvent, 118 | UpdateHealthStateVFX;HealthUpdateEvent, 119 | SetZoomBlackboardValues;Bool, 120 | GetZoomBlackboardValues;, 121 | OnRewardEvent, 122 | OnManagePersonalLinkChangeEvent, 123 | GetPhoneCallFactName;CNameCName, 124 | TriggerInspect;StringFloatFloatFloat, 125 | SetInvisible;Bool, 126 | OnHeavyFootstepEvent, 127 | PlayFootstepCameraShakeBasedOnProximity;HeavyFootstepEvent, 128 | UpdateVisibility;, 129 | UpdateSecondaryVisibilityOffset;Bool, 130 | EnableCombatVisibilityDistances;Bool, 131 | OnLocomotionStateChanged, 132 | OnCombatStateChanged, 133 | OnNumberOfCombatantsChanged, 134 | OnPlayerCoverStatusChangedEvent, 135 | OnStatusEffectApplied, 136 | DisableFootstepAudio;Bool, 137 | DisableCameraBobbing;Bool, 138 | OnAdditiveCameraMovementsSettingChanged;, 139 | ProcessBreathingEffectApplication;StatusEffectEvent, 140 | ProcessTieredDrunkEffect;StatusEffectEvent, 141 | ProcessTieredDruggedEffect;StatusEffectEvent, 142 | OnStatusEffectRemoved, 143 | OnAttitudeChanged, 144 | OnAdHocAnimationRequest, 145 | OnSceneForceWeaponAimEvent, 146 | OnSceneForceWeaponSafeEvent, 147 | OnEnableBraindanceActions, 148 | OnDisableBraindanceActions, 149 | OnForceBraindanceCameraToggle, 150 | OnPauseBraindance, 151 | OnModifyOverlappedSecurityArease, 152 | AddOverrlappedSecurityZone;PersistentID, 153 | RemoveOverrlappedSecurityZone;PersistentID, 154 | SendSceneOverridesAnimFeature;IBlackboard, 155 | OnWorkspotStartedEvent, 156 | OnWorkspotFinishedEvent, 157 | GetPlayerCurrentWorkspotTags;, 158 | PlayerContainsWorkspotTag;CName, 159 | IsCooldownForActionActive;TweakDBID, 160 | RegisterToFacts;, 161 | OnFactChangedEvent, 162 | OnSysDebuggerEvent, 163 | AllowOuterwearClothing;, 164 | DisallowOuterwearClothing;, 165 | InitializeFocusModeTagging;, 166 | UnInitializeFocusModeTagging;, 167 | OnRequestEquipHeavyWeapon, 168 | OnFillAnimWrapperInfoBasedOnEquippedItem, 169 | OnIncapacitated;, 170 | RefreshCPOVisionAppearance;, 171 | OnResurrected;, 172 | IsIncapacitated;, 173 | RegisterCPOMissionDataCallback;, 174 | UnregisterCPOMissionDataCallback;, 175 | OnCPOMissionDataTransferred, 176 | OnCPOMissionDataTransferredServer;CPOMissionDataTransferred, 177 | OnCPOMissionDataTransferredClient;CPOMissionDataTransferred, 178 | OnCPOMissionDataTransferredChoiceTokenClient;CPOMissionDataTransferred, 179 | OnCPOChoiceTokenDrawTextEvent, 180 | CPOMissionDataOnPlayerDetach;, 181 | OnCPOMissionPlayerVotedEvent, 182 | OnPlayerDamageFromDataEvent, 183 | OnCPOMissionDataUpdateEvent, 184 | GetCompatibleCPOMissionDeviceName;, 185 | OnCPOMissionDataChanged, 186 | SetHasCPOMissionData;BoolCNameCNameBool, 187 | OnCPOGiveChoiceTokenEvent, 188 | ProcessDamageEvents;BoolCName, 189 | OnDeath, 190 | ForceCloseRadialWheel;, 191 | Revive;Float, 192 | OnTargetNeutraliziedEvent, 193 | OnRewindableSectionEvent, 194 | IsInCombat;, 195 | IsNaked;, 196 | IsMoving;, 197 | IsMovingHorizontally;, 198 | IsMovingVertically;, 199 | OnZoneChange, 200 | SetWarningMessage;String, 201 | StartProcessingVForVendettaAchievement;GameObject, 202 | CreateVendettaTimeDelayEvent;, 203 | OnFinishedVendettaTimeEvent, 204 | CheckVForVendettaAchievement;TargetNeutraliziedEvent, 205 | OnProcessVendettaAchievementEvent, 206 | OnRemoveConsumableDelayedEvent, 207 | GetNetworkLinkSlotName;, 208 | IsNetworkLinkDynamic;, 209 | RegisterRemoteMappin;, 210 | UnregisterRemoteMappin;, 211 | OnRegisterFastTravelPoints, 212 | ShouldShowScanner;, 213 | OnWoundedInstigated, 214 | OnDismembermentInstigated, 215 | GetPrimaryTargetingComponent;, 216 | ApplyNPCLevelAndProgressionBuild;GameObjectCName, 217 | OnMeleeHitEvent, 218 | OnMeleeHitSloMo, 219 | FindBuildSpacing;StringString, 220 | GotKeycardNotification;, 221 | OnHackPlayerEvent, 222 | OnCarHitPlayer, 223 | OnDistrictChanged, 224 | GetGunshotRange;, 225 | GetExplosionRange;, 226 | GetMinigamePrograms;, 227 | OnUpdateMiniGameProgramsEvent, 228 | UpdateMinigamePrograms;MinigameProgramDataBool, 229 | RestoreMinigamePrograms;, 230 | GetMinigameBlackboard;, 231 | InitInterestingFacts;, 232 | ApplyAimAssistSettings;String, 233 | RegisterInterestingFactsListeners;, 234 | UnregisterInterestingFactsListeners;, 235 | SetBlackboardIntVariable;BlackboardID_IntInt32, 236 | InvalidateZone;, 237 | OnZoneFactChanged;Int32, 238 | SetSecurityAreaTypeE3HACK;ESecurityAreaType, 239 | OnEnterUndefinedZone;, 240 | OnEnterPublicZone;, 241 | OnExitPublicZone;, 242 | OnEnterSafeZone;, 243 | OnExitSafeZone;, 244 | OnEnterRestrictedZone;, 245 | OnEnterDangerousZone;, 246 | GetCurrentZoneType;Int32, 247 | GetCurrentSecurityZoneType;GameObject, 248 | OnInvalidateVisionModeController, 249 | }, 250 | properties: { 251 | quickSlotsManager : handle:QuickSlotsManager, 252 | inspectionComponent : handle:InspectionComponent, 253 | Phone : handle:PlayerPhone, 254 | fppCameraComponent : handle:gameFPPCameraComponent, 255 | primaryTargetingComponent : handle:gameTargetingComponent, 256 | DEBUG_Visualizer : handle:DEBUG_VisualizerComponent, 257 | Debug_DamageInputRec : handle:DEBUG_DamageInputReceiver, 258 | highDamageThreshold : Float, 259 | medDamageThreshold : Float, 260 | lowDamageThreshold : Float, 261 | meleeHighDamageThreshold : Float, 262 | meleeMedDamageThreshold : Float, 263 | meleeLowDamageThreshold : Float, 264 | explosionHighDamageThreshold : Float, 265 | explosionMedDamageThreshold : Float, 266 | explosionLowDamageThreshold : Float, 267 | effectTimeStamp : Float, 268 | curInventoryWeight : Float, 269 | healthVfxBlackboard : handle:worldEffectBlackboard, 270 | laserTargettingVfxBlackboard : handle:worldEffectBlackboard, 271 | itemLogBlackboard : handle:gameIBlackboard, 272 | lastScanTarget : whandle:gameObject, 273 | meleeSelectInputProcessed : Bool, 274 | waitingForDelayEvent : Bool, 275 | randomizedTime : Float, 276 | isResetting : Bool, 277 | delayEventID : gameDelayID, 278 | resetTickID : gameDelayID, 279 | katanaAnimProgression : Float, 280 | coverModifierActive : Bool, 281 | workspotDamageReductionActive : Bool, 282 | workspotVisibilityReductionActive : Bool, 283 | currentPlayerWorkspotTags : array:CName, 284 | incapacitated : Bool, 285 | remoteMappinId : gameNewMappinID, 286 | CPOMissionDataState : handle:CPOMissionDataState, 287 | CPOMissionDataBbId : Uint32, 288 | armorStatListener : handle:ArmorStatListener, 289 | healthStatListener : handle:HealthStatListener, 290 | oxygenStatListener : handle:OxygenStatListener, 291 | aimAssistListener : handle:AimAssistSettingsListener, 292 | autoRevealListener : handle:AutoRevealStatListener, 293 | isTalkingOnPhone : Bool, 294 | DataDamageUpdateID : gameDelayID, 295 | playerAttachedCallbackID : Uint32, 296 | playerDetachedCallbackID : Uint32, 297 | combatStateListener : Uint32, 298 | LocomotionStateListener : Uint32, 299 | numberOfCombatantsListenerID : Uint32, 300 | numberOfCombatants : Int32, 301 | zoneChangeListener : Uint32, 302 | coverVisibilityPerkBlocked : Bool, 303 | behindCover : Bool, 304 | inCombat : Bool, 305 | hasBeenDetected : Bool, 306 | inCrouch : Bool, 307 | gunshotRange : Float, 308 | explosionRange : Float, 309 | nextBufferModifier : Int32, 310 | attackingNetrunnerID : entEntityID, 311 | NPCDeathInstigator : whandle:NPCPuppet, 312 | bestTargettingWeapon : whandle:gameweaponObject, 313 | bestTargettingDot : Float, 314 | targettingEnemies : Int32, 315 | coverRecordID : TweakDBID, 316 | damageReductionRecordID : TweakDBID, 317 | visReductionRecordID : TweakDBID, 318 | lastDmgInflicted : EngineTime, 319 | lowHealthNextRumbleTime : Float, 320 | securityAreaTypeE3HACK : ESecurityAreaType, 321 | overlappedSecurityZones : array:gamePersistentID, 322 | interestingFacts : InterestingFacts, 323 | interestingFactsListenersIds : InterestingFactsListenersIds, 324 | interestingFactsListenersFunctions : InterestingFactsListenersFunctions, 325 | visionModeController : handle:PlayerVisionModeController, 326 | cachedGameplayRestrictions : array:TweakDBID, 327 | delayEndGracePeriodAfterSpawnEventID : gameDelayID, 328 | bossThatTargetsPlayer : entEntityID, 329 | choiceTokenTextLayerId : Uint32, 330 | choiceTokenTextDrawn : Bool, 331 | } 332 | } -------------------------------------------------------------------------------- /icon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/WolvenKit/BraindanceProtocol/edb7d9eafbe9bd468b006ce6184e4142511bd27a/icon.png -------------------------------------------------------------------------------- /manifest.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "BraindanceProtocol", 3 | "version_number": "", 4 | "website_url": "https://github.com/WolvenKit/BraindanceProtocol", 5 | "description": "A Cheat and Utility GUI to modify your Cyberpunk 2077 experience", 6 | "dependencies": [] 7 | } 8 | -------------------------------------------------------------------------------- /mods/braindance_protocol/BD.lua: -------------------------------------------------------------------------------- 1 | local BD = {} 2 | -- Load LUA modules into memory 3 | 4 | BD.Utilities = require("utility") 5 | BD.Player = require("player") 6 | BD.Inventory = require("inventory") 7 | BD.Vehicles = require("ai/vehicles") 8 | BD.Examples = require("examples/init") 9 | BD.Shopper = require("utility/shopper") 10 | BD.Saves = require("engine/saves") 11 | BD.Time = require("engine/time") 12 | 13 | BD.Cheats = { 14 | Crafting = require("cheats/crafting"), 15 | Johnny = require("cheats/johnny"), 16 | Player = require("cheats/player"), 17 | Legend = require("cheats/legend"), 18 | Platform = require("cheats/platform"), 19 | Modify = require("cheats/modify"), 20 | ItemSets = require("cheats/itemsets"), 21 | Cyberware = require("cheats/cyberware"), 22 | Facts = require("cheats/facts"), 23 | Teleport = require("cheats/teleport"), 24 | Ammo = require("cheats/ammo") 25 | } 26 | 27 | return BD 28 | -------------------------------------------------------------------------------- /mods/braindance_protocol/CPStyling/LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2021 Mingming Cui 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /mods/braindance_protocol/CPStyling/README.md: -------------------------------------------------------------------------------- 1 | # CPStyling.lua 2 | 3 | This project can be found at https://github.com/Nats-ji/CPStyling.lua 4 | 5 | ### What is this 6 | Made for Cyber Engine Tweaks Mod creation. 7 | This is a set of color schemes and widgets I made to match the style of Cyberpunk 2077's UI. 8 | I also included some useful functions for easier and faster ImGui styling. 9 | 10 | 11 | Please make PR if you want to fix bugs or make improvements 12 | ### How to use 13 | ```lua 14 | CPS = require "CPStyling" 15 | theme = CPS.theme 16 | color = CPS.color 17 | ``` 18 | 19 | To use `CPS.loadPNG()` and `CPS.CPDraw()` functions, you need to include the `png-lua` library. 20 | 21 | #This project is still WIP, will add more widgets. You can also download the demo to play with it yourself. 22 | 23 | ![Imgur](https://i.imgur.com/fe3cd4w.png) 24 | 25 | ### Projects using this library 26 | CP77-TetrisArcade [[Nexus]](https://www.nexusmods.com/cyberpunk2077/mods/1118) | [[Github]](https://github.com/justarandomguyintheinternet/cp77_arcade_tetris) 27 | 28 | ![Imgur](https://i.imgur.com/zrhar0j.png) 29 | 30 | CP77-Braindance Protocol [[Nexus]](https://www.nexusmods.com/cyberpunk2077/mods/616) | [[Github]](https://github.com/WolvenKit/BraindanceProtocol) 31 | 32 | ![Imgur](https://i.imgur.com/bVqLG7c.png) 33 | 34 | ### Utilities 35 | ```lua 36 | --Check if a file exists 37 | CPS.fileExists(filename) 38 | --returns bool 39 | 40 | --Setup the style for a new window and it's content. 41 | CPS.setThemeBegin() 42 | -- ImGui.Begin("I'm a window") 43 | -- ImGui.End() 44 | CPS.setThemeEnd() 45 | 46 | --Setup the style for frame items (Checkbox, Combobox, Inputbox, etc.), 47 | --Needs to be put bellow ImGui.Begin() or window's title will also be bordered. 48 | CPS.setFrameThemeBegin() 49 | CPS.setFrameThemeEnd() 50 | 51 | --Same as ImGui.PushStyleColor(ImGuiCol.style, r, g, b, a), but can take any color format. 52 | CPS.colorBegin(style, color) 53 | -- style (string): style = "Text" 54 | -- color can be u32 (number): color = 0x00000000 55 | -- color can be rgb (table): color = { 0.40 , 0.17 , 0.12 } 56 | -- color can be rgba (table): color = { 0.40 , 0.17 , 0.12 , 0.5 } 57 | -- color can be hex (string): color = "#672b1f" color = "672b1f" 58 | -- color can be hex with alpha (table): color = { "672b1f", 0.5 } 59 | CPS.colorEnd(count) --Same as ImGui.PopStyleColor(count) 60 | 61 | ---Example--- 62 | CPS.colorBegin("Button", { 1, 0, 0, 1 }) 63 | CPS.colorBegin("Button", "672b1f") 64 | CPS.colorBegin("Button", theme.Button) -- get color from theme.lua 65 | CPS.colorBegin("Button", color.blue) -- get color from styles.lua 66 | ImGui.Button("I'm a Button") 67 | CPS.colorEnd(1) 68 | 69 | --Same as ImGui.PushStyleVar() 70 | CPS.styleBegin(style, var1) 71 | CPS.styleBegin(style, var1, var2) 72 | -- Same as ImGui.PushStyleVar(ImGuiStyleVar.style, var1, var2) 73 | -- style (string): style = "ChildRounding" 74 | -- var1 (float), var2 (float) 75 | CPS.styleEnd(count) -- Same as ImGui.PopStyleVar(count) 76 | 77 | ---Example--- 78 | CPS.styleBegin("FrameBorderSize", 5) 79 | ImGui.Button("I'm a bordered button", 200, 30) 80 | CPS.styleEnd(1) 81 | ``` 82 | ### Cyberpunk Style Widgets 83 | 84 | CPButton: 85 | 86 | ![Imgur](https://i.imgur.com/4neA19J.gif) 87 | ```lua 88 | press = CPS.CPButton(label) 89 | press = CPS.CPButton(label, sizex, sizey) 90 | -- label (string), sizex (float), sizey (float) 91 | -- Returns press (bool) 92 | 93 | ---Example--- 94 | btn1 = CPS.CPButton("Btn1") 95 | btn2 = CPS.CPButton("Btn2", 50, 30) 96 | ``` 97 | CPToggle: 98 | 99 | ![Imgur](https://i.imgur.com/gTwpaLY.gif) 100 | ```lua 101 | value, press = CPS.CPToggle(label, label_on, label_off, value, sizex, sizey) 102 | -- label (string), label_on (string), label_off (string), value (bool), sizex (float), sizey (float) 103 | -- Returns value (bool), press (bool) 104 | 105 | ---Example--- 106 | value, press = CPS.CPToggle("Toggle godmode", "OFF", "ON", value, 180, 0) 107 | ``` 108 | CPToolTip: 109 | 110 | ![Imgur](https://i.imgur.com/i467ORZ.gif) 111 | ```lua 112 | CPS.CPToolTip1Begin(sizex, sizey) 113 | -- ImGui.Text("This is a CPToolTip1") 114 | CPS.CPToolTip1End() 115 | 116 | CPS.CPToolTip2Begin(sizex, sizey) 117 | -- ImGui.Text("This is a CPToolTip2") 118 | CPS.CPToolTip2End() 119 | ``` 120 | CPRect: 121 | 122 | ![Imgur](https://i.imgur.com/M5FHWtb.png) 123 | ```lua 124 | press = CPS.CPRect1(label, sizex, sizey, color, border_color [O], border_size [O], border_rounding [O], textalignx [O], textaligny [O]) 125 | -- lable (string), sizex (float), sizey (float), color (any format), border_color (any format) 126 | -- border_size (float), border_rounding (float), textalignx (float), textaligny (float) 127 | -- Returns press (bool) 128 | 129 | CPS.CPRect2(text_id, sizex, sizey, color) 130 | -- text_id (string), sizex (float), sizey(float), color (any format) 131 | -- Faster than CPRect1 but without return value. 132 | -- Also used in CPS.CPDraw() 133 | 134 | ---Example--- 135 | -- Draw a red 50x50 Circle 136 | CPS.CPRect1("##circle", 50, 50, {0,0,0,0}, color.red, 5, 25) 137 | -- Draw a green rounded rectangle with a brown border and text inside aligned to the right. 138 | CPS.CPRect1("I'm the text", 150, 50, color.green, color.brown, 3, 10, 1, 0.5) 139 | ``` 140 | loadPNG and CPDraw: 141 | 142 | ![img](https://github.com/Nats-ji/CPStyling.lua/raw/master/.image/cpdraw.gif) 143 | 144 | ```lua 145 | -- Load a png image from file 146 | image = CPS.loadPNG(path_to_png) 147 | -- Return image = { wdith = int, height = int, pixels = { 148 | [1]:{ 149 | [1]:{ R, G, B, A }, 150 | [2]:{ R, G, B, A }, 151 | ...... 152 | }, 153 | [2]:{ 154 | ...... 155 | }, 156 | ..... 157 | } 158 | -- Draw the png image 159 | CPS.CPDraw(text_id, image, scale) 160 | -- text_id (string), image (table), scale (number) 161 | 162 | ---Example--- 163 | image = CPS.loadPNG("./images/logo.png") 164 | CPS.CPDraw("logo", image, 5) 165 | ``` 166 | 167 | ### Color Names 168 | ```lua 169 | "red" 170 | "cyan" 171 | "blue" 172 | "darkblue" 173 | "lightblue" 174 | "purple" 175 | "yellow" 176 | "lime" 177 | "magenta" 178 | "white" 179 | "silver" 180 | "grey" 181 | "black" 182 | "orange" 183 | "brown" 184 | "maroon" 185 | "green" 186 | "olive" 187 | ``` 188 | 189 | 190 | ### ImGui style names 191 | Color 192 | ```lua 193 | "Text" 194 | "TextDisabled" 195 | "WindowBg" 196 | "ChildBg" 197 | "PopupBg" 198 | "Border" 199 | "BorderShadow" 200 | "FrameBg" 201 | "FrameBgHovered" 202 | "FrameBgActive" 203 | "FrameBgDisabled" 204 | "FrameBgHoveredDisabled" 205 | "FrameBgActiveDisabled" 206 | "TitleBg" 207 | "TitleBgActive" 208 | "TitleBgCollapsed" 209 | "MenuBarBg" 210 | "ScrollbarBg" 211 | "ScrollbarGrab" 212 | "ScrollbarGrabHovered" 213 | "ScrollbarGrabActive" 214 | "CheckMark" 215 | "CheckMarkTrueDisabled" 216 | "CheckMarkFalseDisabled" 217 | "SliderGrab" 218 | "SliderGrabActive" 219 | "Button" 220 | "ButtonHovered" 221 | "ButtonActive" 222 | "Header" 223 | "HeaderHovered" 224 | "HeaderActive" 225 | "Separator" 226 | "SeparatorHovered" 227 | "SeparatorActive" 228 | "ResizeGrip" 229 | "ResizeGripHovered" 230 | "ResizeGripActive" 231 | "Tab" 232 | "TabHovered" 233 | "TabActive" 234 | "TabUnfocused" 235 | "TabUnfocusedActive" 236 | "DockingPreview" 237 | "DockingEmptyBg" 238 | "PlotLines" 239 | "PlotLinesHovered" 240 | "PlotHistogram" 241 | "PlotHistogramHovered" 242 | "TextSelectedBg" 243 | "DragDropTarget" 244 | "NavHighlight" 245 | "NavWindowingHighlight" 246 | "NavWindowingDimBg" 247 | "ModalWindowDimBg" 248 | "ModalWindowDarkening" 249 | "COUNT" 250 | ``` 251 | 252 | StyleVar 253 | ```lua 254 | "Alpha" 255 | "WindowPadding" 256 | "WindowRounding" 257 | "WindowBorderSize" 258 | "WindowMinSize" 259 | "WindowTitleAlign" 260 | "ChildRounding" 261 | "ChildBorderSize" 262 | "PopupRounding" 263 | "PopupBorderSize" 264 | "FramePadding" 265 | "FrameRounding" 266 | "FrameBorderSize" 267 | "ItemSpacing" 268 | "ItemInnerSpacing" 269 | "IndentSpacing" 270 | "ScrollbarSize" 271 | "ScrollbarRounding" 272 | "GrabMinSize" 273 | "GrabRounding" 274 | "TabRounding" 275 | "SelectableTextAlign" 276 | "ButtonTextAlign" 277 | "COUNT" 278 | ``` 279 | -------------------------------------------------------------------------------- /mods/braindance_protocol/CPStyling/init.lua: -------------------------------------------------------------------------------- 1 | -- MIT License 2 | -- 3 | -- CPStyling.lua https://github.com/Nats-ji/CPStyling.lua 4 | -- 5 | -- This file is a part of CPStyling.lua 6 | -- 7 | -- Copyright (c) 2021 Mingming Cui 8 | -- 9 | -- Permission is hereby granted, free of charge, to any person obtaining a copy 10 | -- of this software and associated documentation files (the "Software"), to deal 11 | -- in the Software without restriction, including without limitation the rights 12 | -- to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 13 | -- copies of the Software, and to permit persons to whom the Software is 14 | -- furnished to do so, subject to the following conditions: 15 | -- 16 | -- The above copyright notice and this permission notice shall be included in all 17 | -- copies or substantial portions of the Software. 18 | -- 19 | -- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 20 | -- IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 21 | -- FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 22 | -- AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 23 | -- LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 24 | -- OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 25 | -- SOFTWARE. 26 | 27 | local CPStyle = {} 28 | local currentFilePath = "CPStyling/" 29 | CPStyle.theme = require(currentFilePath.."theme") 30 | local styles = require(currentFilePath.."styles") 31 | local ImGuiStyleNames = styles.ImGuiStyleNames 32 | CPStyle.color = styles.color 33 | 34 | png = require(currentFilePath.."png-lua/png") 35 | 36 | local function ToImGuiStyleName(style, which) 37 | if which == "Col" then 38 | for i in pairs(ImGuiStyleNames.Col) do 39 | if style == ImGuiStyleNames.Col[i].ImGuiStyleShort then 40 | return ImGuiStyleNames.Col[i].ImGuiStyle 41 | end 42 | end 43 | elseif which == "Var" then 44 | for i in pairs(ImGuiStyleNames.Var) do 45 | if style == ImGuiStyleNames.Var[i].ImGuiStyleShort then 46 | return ImGuiStyleNames.Var[i].ImGuiStyle 47 | end 48 | end 49 | end 50 | end 51 | 52 | local function hex2rgb(hex) 53 | local hex = hex:gsub("#","") 54 | if hex:len() == 3 then 55 | return (tonumber("0x"..hex:sub(1,1))*17)/255, (tonumber("0x"..hex:sub(2,2))*17)/255, (tonumber("0x"..hex:sub(3,3))*17)/255 56 | else 57 | return tonumber("0x"..hex:sub(1,2))/255, tonumber("0x"..hex:sub(3,4))/255, tonumber("0x"..hex:sub(5,6))/255 58 | end 59 | end 60 | 61 | function CPStyle.colorBegin(style, color) 62 | if type(color) == "number" then 63 | ImGui.PushStyleColor(ToImGuiStyleName(style, "Col"), color) 64 | elseif type(color) == "string" then 65 | local r, g, b = hex2rgb(color) 66 | ImGui.PushStyleColor(ToImGuiStyleName(style, "Col"), r, g, b, 1) 67 | elseif type(color) == "table" then 68 | if type(color[1]) == "string" and type(color[2]) == "number" then 69 | local r, g, b = hex2rgb(color[1]) 70 | ImGui.PushStyleColor(ToImGuiStyleName(style, "Col"), r, g, b, color[2]) 71 | elseif type(color[1]) == "number" and type(color[2]) == "number" and type(color[3]) == "number" then 72 | if color[4] == nil then 73 | ImGui.PushStyleColor(ToImGuiStyleName(style, "Col"), color[1], color[2], color[3], 1) 74 | else 75 | ImGui.PushStyleColor(ToImGuiStyleName(style, "Col"), color[1], color[2], color[3], color[4]) 76 | end 77 | end 78 | end 79 | end 80 | 81 | function CPStyle.colorEnd(count) 82 | if count == nil then 83 | ImGui.PopStyleColor() 84 | else 85 | ImGui.PopStyleColor(count) 86 | end 87 | end 88 | -- 89 | function CPStyle.styleBegin(style, var1, var2) 90 | if var2 == nil then 91 | ImGui.PushStyleVar(ToImGuiStyleName(style, "Var"), var1) 92 | else 93 | ImGui.PushStyleVar(ToImGuiStyleName(style, "Var"), var1, var2) 94 | end 95 | end 96 | 97 | function CPStyle.styleEnd(count) 98 | if count == nil then 99 | ImGui.PopStyleVar() 100 | else 101 | ImGui.PopStyleVar(count) 102 | end 103 | end 104 | 105 | function CPStyle.setThemeBegin() 106 | CPStyle.colorBegin("Text" , CPStyle.theme.Text) 107 | CPStyle.colorBegin("TextDisabled" , CPStyle.theme.TextDisabled) 108 | CPStyle.colorBegin("WindowBg" , CPStyle.theme.WindowBg) 109 | CPStyle.colorBegin("ChildBg" , CPStyle.theme.ChildBg) 110 | CPStyle.colorBegin("PopupBg" , CPStyle.theme.PopupBg) 111 | CPStyle.colorBegin("Border" , CPStyle.theme.Border) 112 | CPStyle.colorBegin("BorderShadow" , CPStyle.theme.BorderShadow) 113 | CPStyle.colorBegin("FrameBg" , CPStyle.theme.FrameBg) 114 | CPStyle.colorBegin("FrameBgHovered" , CPStyle.theme.FrameBgHovered) 115 | CPStyle.colorBegin("FrameBgActive" , CPStyle.theme.FrameBgActive) 116 | CPStyle.colorBegin("TitleBg" , CPStyle.theme.TitleBg) 117 | CPStyle.colorBegin("TitleBgActive" , CPStyle.theme.TitleBgActive) 118 | CPStyle.colorBegin("TitleBgCollapsed" , CPStyle.theme.TitleBgCollapsed) 119 | CPStyle.colorBegin("MenuBarBg" , CPStyle.theme.MenuBarBg) 120 | CPStyle.colorBegin("ScrollbarBg" , CPStyle.theme.ScrollbarBg) 121 | CPStyle.colorBegin("ScrollbarGrab" , CPStyle.theme.ScrollbarGrab) 122 | CPStyle.colorBegin("ScrollbarGrabHovered" , CPStyle.theme.ScrollbarGrabHovered) 123 | CPStyle.colorBegin("ScrollbarGrabActive" , CPStyle.theme.ScrollbarGrabActive) 124 | CPStyle.colorBegin("CheckMark" , CPStyle.theme.CheckMark) 125 | CPStyle.colorBegin("SliderGrab" , CPStyle.theme.SliderGrab) 126 | CPStyle.colorBegin("SliderGrabActive" , CPStyle.theme.SliderGrabActive) 127 | CPStyle.colorBegin("Button" , CPStyle.theme.Button) 128 | CPStyle.colorBegin("ButtonHovered" , CPStyle.theme.ButtonHovered) 129 | CPStyle.colorBegin("ButtonActive" , CPStyle.theme.ButtonActive) 130 | CPStyle.colorBegin("Header" , CPStyle.theme.Header) 131 | CPStyle.colorBegin("HeaderHovered" , CPStyle.theme.HeaderHovered) 132 | CPStyle.colorBegin("HeaderActive" , CPStyle.theme.HeaderActive) 133 | CPStyle.colorBegin("Separator" , CPStyle.theme.Separator) 134 | CPStyle.colorBegin("SeparatorHovered" , CPStyle.theme.SeparatorHovered) 135 | CPStyle.colorBegin("SeparatorActive" , CPStyle.theme.SeparatorActive) 136 | CPStyle.colorBegin("ResizeGrip" , CPStyle.theme.ResizeGrip) 137 | CPStyle.colorBegin("ResizeGripHovered" , CPStyle.theme.ResizeGripHovered) 138 | CPStyle.colorBegin("ResizeGripActive" , CPStyle.theme.ResizeGripActive) 139 | CPStyle.colorBegin("Tab" , CPStyle.theme.Tab) 140 | CPStyle.colorBegin("TabHovered" , CPStyle.theme.TabHovered) 141 | CPStyle.colorBegin("TabActive" , CPStyle.theme.TabActive) 142 | CPStyle.colorBegin("TabUnfocused" , CPStyle.theme.TabUnfocused) 143 | CPStyle.colorBegin("TabUnfocusedActive" , CPStyle.theme.TabUnfocusedActive) 144 | -- CPStyle.colorBegin("PlotLines" , CPStyle.theme.PlotLines) 145 | -- CPStyle.colorBegin("PlotLinesHovered" , CPStyle.theme.PlotLinesHovered) 146 | -- CPStyle.colorBegin("PlotHistogram" , CPStyle.theme.PlotHistogram) 147 | -- CPStyle.colorBegin("PlotHistogramHovered" , CPStyle.theme.PlotHistogramHovered) 148 | CPStyle.colorBegin("TextSelectedBg" , CPStyle.theme.TextSelectedBg) 149 | -- CPStyle.colorBegin("DragDropTarget" , CPStyle.theme.DragDropTarget) 150 | -- CPStyle.colorBegin("NavHighlight" , CPStyle.theme.NavHighlight) 151 | -- CPStyle.colorBegin("NavWindowingHighlight" , CPStyle.theme.NavWindowingHighlight) 152 | -- CPStyle.colorBegin("NavWindowingDimBg" , CPStyle.theme.NavWindowingDimBg) 153 | CPStyle.colorBegin("ModalWindowDimBg" , CPStyle.theme.ModalWindowDimBg) 154 | CPStyle.styleBegin("WindowRounding" , 0) 155 | CPStyle.styleBegin("ScrollbarSize" , 9) 156 | end 157 | 158 | function CPStyle.setThemeEnd() 159 | CPStyle.styleEnd(2) 160 | CPStyle.colorEnd(40) 161 | end 162 | 163 | function CPStyle.setFrameThemeBegin() 164 | CPStyle.colorBegin("FrameBg" , CPStyle.theme.CPFrameBg) 165 | CPStyle.colorBegin("FrameBgHovered" , CPStyle.theme.CPFrameBgHovered) 166 | CPStyle.colorBegin("FrameBgActive" , CPStyle.theme.CPFrameBgActive) 167 | CPStyle.colorBegin("SliderGrab" , CPStyle.theme.CPSliderGrab) 168 | CPStyle.colorBegin("SliderGrabActive" , CPStyle.theme.CPSliderGrabActive) 169 | CPStyle.colorBegin("Border" , CPStyle.theme.CPFrameBorder) 170 | CPStyle.colorBegin("TextSelectedBg" , CPStyle.theme.CPTextSelectedBg) 171 | CPStyle.styleBegin("FrameBorderSize" , 1) 172 | end 173 | 174 | function CPStyle.setFrameThemeEnd() 175 | CPStyle.styleEnd(1) 176 | CPStyle.colorEnd(7) 177 | end 178 | 179 | -- CPButton 180 | 181 | function CPStyle.CPButton(label, sizex, sizey) 182 | local press, hovered 183 | ImGui.BeginGroup() 184 | CPStyle.styleBegin("FrameBorderSize", 1) 185 | CPStyle.colorBegin("Button", CPStyle.theme.CPButton) 186 | CPStyle.colorBegin("ButtonHovered", CPStyle.theme.CPButtonHovered) 187 | CPStyle.colorBegin("ButtonActive", CPStyle.theme.CPButtonActive) 188 | CPStyle.colorBegin("Text", CPStyle.theme.CPButtonText) 189 | CPStyle.colorBegin("Border", CPStyle.theme.CPButtonBorder) 190 | if sizex == nil or sizey == nil then 191 | press = ImGui.Button(label) 192 | else 193 | press = ImGui.Button(label, sizex, sizey) 194 | end 195 | CPStyle.colorEnd(5) 196 | hovered = ImGui.IsItemHovered() 197 | if hovered then 198 | ImGui.SameLine(0.0001) 199 | CPStyle.colorBegin("Border", CPStyle.theme.CPButtonBorderHovered) 200 | CPStyle.colorBegin("Text", CPStyle.theme.Hidden) 201 | CPStyle.colorBegin("Button", CPStyle.theme.Hidden) 202 | if sizex == nil or sizey == nil then 203 | ImGui.Button(label.."##hovered") 204 | else 205 | ImGui.Button(label.."##hovered", sizex, sizey) 206 | end 207 | CPStyle.colorEnd(3) 208 | end 209 | CPStyle.styleEnd(1) 210 | ImGui.EndGroup() 211 | return press 212 | end 213 | 214 | -- CPToggle 215 | 216 | function CPStyle.CPToggle(label, label_off, label_on, value, sizex, sizey) 217 | local press_off, press_on, hovered 218 | ImGui.BeginGroup() 219 | CPStyle.styleBegin("FrameBorderSize", 1) 220 | ImGui.BeginGroup() 221 | if value then 222 | CPStyle.colorBegin("Button", CPStyle.theme.CPToggleOffDisabled) 223 | CPStyle.colorBegin("Text", CPStyle.theme.CPToggleOffDisabledText) 224 | CPStyle.colorBegin("ButtonHovered", CPStyle.theme.CPToggleOffDisabledHovered) 225 | CPStyle.colorBegin("ButtonActive", CPStyle.theme.CPToggleOffDisabled) 226 | CPStyle.colorBegin("Border", CPStyle.theme.CPToggleOffDisabledBorder) 227 | press_off = ImGui.Button(label_off.."##cp", sizex/2-1,sizey) 228 | ImGui.PopStyleColor(5) 229 | ImGui.SameLine(sizex/2+1) 230 | CPStyle.colorBegin("Button", CPStyle.theme.CPToggleOn) 231 | CPStyle.colorBegin("Text", CPStyle.theme.CPToggleOnText) 232 | CPStyle.colorBegin("ButtonHovered", CPStyle.theme.CPToggleOnHovered) 233 | CPStyle.colorBegin("ButtonActive", CPStyle.theme.CPToggleOn) 234 | CPStyle.colorBegin("Border", CPStyle.theme.CPToggleOnBorder) 235 | press_on = ImGui.Button(label_on.."##cp", sizex/2-1, sizey) 236 | ImGui.PopStyleColor(5) 237 | 238 | else 239 | CPStyle.colorBegin("Button", CPStyle.theme.CPToggleOff) 240 | CPStyle.colorBegin("Text", CPStyle.theme.CPToggleOffText) 241 | CPStyle.colorBegin("ButtonHovered", CPStyle.theme.CPToggleOffHovered) 242 | CPStyle.colorBegin("ButtonActive", CPStyle.theme.CPToggleOff) 243 | CPStyle.colorBegin("Border", CPStyle.theme.CPToggleOffBorder) 244 | press_off = ImGui.Button(label_off.."##cp", sizex/2-1,sizey) 245 | ImGui.PopStyleColor(5) 246 | ImGui.SameLine(sizex/2+1) 247 | CPStyle.colorBegin("Button", CPStyle.theme.CPToggleOnDisabled) 248 | CPStyle.colorBegin("Text", CPStyle.theme.CPToggleOnDisabledText) 249 | CPStyle.colorBegin("ButtonHovered", CPStyle.theme.CPToggleOnDisabledHovered) 250 | CPStyle.colorBegin("ButtonActive", CPStyle.theme.CPToggleOnDisabled) 251 | CPStyle.colorBegin("Border", CPStyle.theme.CPToggleOnDisabledBorder) 252 | press_on = ImGui.Button(label_on.."##cp", sizex/2-1, sizey) 253 | ImGui.PopStyleColor(5) 254 | end 255 | 256 | if press_off and value == false then 257 | value = true 258 | elseif press_off and value == true then 259 | value = false 260 | elseif press_on and value == true then 261 | value = false 262 | elseif press_on and value == false then 263 | value = true 264 | end 265 | if press_off or press_on then press = true else press = false end 266 | ImGui.EndGroup() 267 | hovered = ImGui.IsItemHovered() 268 | 269 | if hovered then --show hovered border color and text color 270 | ImGui.SameLine(0.0001) 271 | ImGui.BeginGroup() 272 | if value then 273 | CPStyle.colorBegin("Border", CPStyle.theme.CPToggleOffDisabledBorderHovered) 274 | CPStyle.colorBegin("Button", CPStyle.theme.CPToggleOffDisabledHovered) 275 | CPStyle.colorBegin("Text", CPStyle.theme.CPToggleOffDisabledTextHovered) 276 | ImGui.Button(label_off.."##hovered", sizex/2-1,sizey) 277 | ImGui.PopStyleColor(3) 278 | ImGui.SameLine(sizex/2+1) 279 | CPStyle.colorBegin("Border", CPStyle.theme.CPToggleOnBorderHovered) 280 | CPStyle.colorBegin("Button", CPStyle.theme.CPToggleOnHovered) 281 | CPStyle.colorBegin("Text", CPStyle.theme.CPToggleOnTextHovered) 282 | ImGui.Button(label_on.."##hovered", sizex/2-1, sizey) 283 | ImGui.PopStyleColor(3) 284 | 285 | else 286 | CPStyle.colorBegin("Border", CPStyle.theme.CPToggleOffBorderHovered) 287 | CPStyle.colorBegin("Button", CPStyle.theme.CPToggleOffHovered) 288 | CPStyle.colorBegin("Text", CPStyle.theme.CPToggleOffTextHovered) 289 | ImGui.Button(label_off.."##hovered", sizex/2-1,sizey) 290 | ImGui.PopStyleColor(3) 291 | ImGui.SameLine(sizex/2+1) 292 | CPStyle.colorBegin("Border", CPStyle.theme.CPToggleOnDisabledBorderHovered) 293 | CPStyle.colorBegin("Button", CPStyle.theme.CPToggleOnDisabledHovered) 294 | CPStyle.colorBegin("Text", CPStyle.theme.CPToggleOnDisabledTextHovered) 295 | ImGui.Button(label_on.."##hovered", sizex/2-1, sizey) 296 | ImGui.PopStyleColor(3) 297 | end 298 | ImGui.EndGroup() 299 | end 300 | CPStyle.styleEnd(1) 301 | if label ~= nil and label ~= "" and label:match("^##") == nil then 302 | CPStyle.colorBegin("Button", CPStyle.theme.Hidden) 303 | CPStyle.colorBegin("Text", CPStyle.theme.Text) 304 | CPStyle.colorBegin("ButtonHovered", CPStyle.theme.Hidden) 305 | CPStyle.colorBegin("ButtonActive", CPStyle.theme.Hidden) 306 | CPStyle.styleBegin("FrameBorderSize", 0) 307 | CPStyle.styleBegin("ButtonTextAlign", 0, 0.5) 308 | ImGui.SameLine(sizex) 309 | ImGui.Button(label, 0, sizey) 310 | CPStyle.styleEnd(2) 311 | CPStyle.colorEnd(4) 312 | end 313 | ImGui.EndGroup() 314 | return value, press 315 | end 316 | 317 | function CPStyle.CPToolTip1Begin(sizex, sizey) 318 | CPStyle.styleBegin("WindowRounding", 0) 319 | CPStyle.styleBegin("PopupBorderSize", 0) 320 | CPStyle.styleBegin("ChildBorderSize", 1) 321 | CPStyle.colorBegin("PopupBg", CPStyle.theme.Hidden) 322 | CPStyle.colorBegin("ChildBg", CPStyle.theme.CPFrameBg) 323 | ImGui.BeginTooltip() 324 | CPStyle.CPRect("##SideRect", 8, sizey, CPStyle.theme.CPFrameBg, CPStyle.theme.CPFrameBorder, 1, 0) 325 | ImGui.SameLine(20) 326 | ImGui.BeginGroup() 327 | ImGui.BeginChild("ToolTipMain", sizex, sizey, true) 328 | end 329 | 330 | function CPStyle.CPToolTip1End() 331 | ImGui.EndChild() 332 | ImGui.EndGroup() 333 | ImGui.EndTooltip() 334 | CPStyle.colorEnd(2) 335 | CPStyle.styleEnd(3) 336 | end 337 | 338 | function CPStyle.CPToolTip2Begin(sizex, sizey) 339 | CPStyle.styleBegin("WindowRounding", 0) 340 | CPStyle.styleBegin("PopupBorderSize", 0) 341 | CPStyle.styleBegin("ChildBorderSize", 1) 342 | CPStyle.colorBegin("PopupBg", CPStyle.theme.Hidden) 343 | CPStyle.colorBegin("ChildBg", CPStyle.theme.CPToolTip2Bg) 344 | CPStyle.colorBegin("Border", CPStyle.theme.CPToolTip2Border) 345 | CPStyle.colorBegin("Separator", CPStyle.theme.CPToolTip2Separator) 346 | ImGui.BeginTooltip() 347 | CPStyle.CPRect("##SideRect", 8, sizey, CPStyle.theme.CPToolTip2SideBg, CPStyle.theme.CPToolTip2Border, 1, 0) 348 | ImGui.SameLine(16) 349 | ImGui.BeginGroup() 350 | ImGui.BeginChild("ToolTip2Main", sizex, sizey, true) 351 | end 352 | 353 | function CPStyle.CPToolTip2End() 354 | ImGui.EndChild() 355 | ImGui.EndGroup() 356 | ImGui.EndTooltip() 357 | CPStyle.colorEnd(4) 358 | CPStyle.styleEnd(3) 359 | end 360 | 361 | function CPStyle.CPRect(label, sizex, sizey, color, border_color, border_size, border_rounding, textalignx, textaligny) 362 | if border_color == nil then border_color = CPStyle.theme.Border end 363 | if border_size == nil then border_size = 0 end 364 | if border_rounding == nil then border_rounding = 0 end 365 | if textalignx == nil then textalignx = 0.5 end 366 | if textaligny == nil then textaligny = 0.5 end 367 | CPStyle.colorBegin("Border", border_color) 368 | CPStyle.colorBegin("Button", color) 369 | CPStyle.colorBegin("ButtonActive", color) 370 | CPStyle.colorBegin("ButtonHovered", color) 371 | CPStyle.styleBegin("FrameBorderSize", border_size) 372 | CPStyle.styleBegin("FrameRounding", border_rounding) 373 | CPStyle.styleBegin("ButtonTextAlign", textalignx, textaligny) 374 | local press = ImGui.Button(label, sizex, sizey) 375 | CPStyle.styleEnd(3) 376 | CPStyle.colorEnd(4) 377 | return press 378 | end 379 | 380 | function CPStyle.CPRect2(label, sizex, sizey, color) 381 | CPStyle.colorBegin("ChildBg", color) 382 | ImGui.BeginChild(label, sizex, sizey) 383 | ImGui.EndChild() 384 | CPStyle.colorEnd(1) 385 | end 386 | 387 | function CPStyle.CPDraw(name, image, scale) 388 | ImGui.BeginGroup() 389 | local basex, basey = ImGui.GetCursorPos() 390 | local pixelx = 1 391 | local pixely = 1 392 | local cursorx = basex 393 | local cursory = basey 394 | local totalPixel = image.width*image.height 395 | for i = 1, totalPixel do 396 | ImGui.SetCursorPos(cursorx, cursory) 397 | if image.pixels[pixely][pixelx][4] ~= 0 then 398 | CPStyle.CPRect2("##"..name..i, scale*1.2, scale*1.2, image.pixels[pixely][pixelx]) 399 | end 400 | pixelx = pixelx + 1 401 | if pixelx > image.width then pixelx = 1 pixely = pixely + 1 end 402 | cursorx = basex+(pixelx-1)*scale 403 | cursory = basey+(pixely-1)*scale 404 | end 405 | ImGui.EndGroup() 406 | end 407 | 408 | function CPStyle.loadPNG(imagepath) 409 | local imgraw = png(imagepath) 410 | local img = {} 411 | local x = {} 412 | local y = {} 413 | img.width = imgraw.width 414 | img.height = imgraw.height 415 | for i in pairs(imgraw.pixels) do 416 | for t in pairs(imgraw.pixels[i]) do 417 | y[t] = { imgraw.pixels[i][t].R/255, imgraw.pixels[i][t].G/255, imgraw.pixels[i][t].B/255, imgraw.pixels[i][t].A/255 } 418 | end 419 | x[i] = y 420 | y = {} 421 | end 422 | img.pixels = x 423 | return img 424 | end 425 | 426 | function CPStyle.fileExists(filename) 427 | local f=io.open(filename,"r") 428 | if (f~=nil) then io.close(f) return true else return false end 429 | end 430 | 431 | return CPStyle 432 | -------------------------------------------------------------------------------- /mods/braindance_protocol/CPStyling/png-lua/README.md: -------------------------------------------------------------------------------- 1 | Forked from https://github.com/Didericis/png-lua 2 | 3 | PNGLua 4 | ====== 5 | 6 | A pure lua implementation of a PNG decoder 7 | 8 | Usage 9 | ----- 10 | 11 | To initialize a new png image: 12 | 13 | img = pngImage(, newRowCallback, verbose, memSave) 14 | 15 | The argument "verbose" should be a boolean. If true, it will print messages while decoding. The argument "memSave" should also be a boolean. If true, it will not save pixel data after it has been decoded (you must use the pixel data passed to the newRowCallback to deal with image data).The available data from the image is as follows: 16 | 17 | ``` 18 | img.width = 0 19 | img.height = 0 20 | img.depth = 0 21 | img.colorType = 0 22 | img.pixels = { 23 | 1: { 24 | 1: { R: ..., G: ..., B: ..., A: ...}, 25 | 2: { R: ..., G: ..., B: ..., A: ...}, 26 | ... 27 | }, 28 | 2: { 29 | 1: { R: ..., G: ..., B: ..., A: ...}, 30 | 2: { R: ..., G: ..., B: ..., A: ...}, 31 | ... 32 | } 33 | ... 34 | } 35 | 36 | ``` 37 | 38 | The newRowCallback argument should have the following structure: 39 | 40 | newRowCallback(rowNum, rowTotal, rowPixels) 41 | 42 | "rowNum" refers to the current row, "rowTotal" refers to the total number of rows in the image, and "rowPixels" refers to the table of pixels in the current row. 43 | 44 | Support 45 | ------- 46 | 47 | The supported colortypes are as follows: 48 | 49 | - Grayscale 50 | - Truecolor 51 | - Indexed 52 | - Greyscale/alpha 53 | - Truecolor/alpha 54 | 55 | So far the module only supports 256 Colors in png-8, png-24 as well as png-32 files. and no ancillary chunks. 56 | 57 | More than 256 colors might be supported (Bit-depths over 8) as long as they align with whole bytes. These have not been tested. 58 | 59 | Multiple IDAT chunks of arbitrary lengths are supported. Filter type 0 is currently the only supported filter type. 60 | 61 | Errors 62 | ------- 63 | So far no error-checking has been implemented. No crc32 checks are done. 64 | -------------------------------------------------------------------------------- /mods/braindance_protocol/CPStyling/png-lua/png.lua: -------------------------------------------------------------------------------- 1 | -- The MIT License (MIT) 2 | 3 | -- Copyright (c) 2013 DelusionalLogic 4 | 5 | -- Permission is hereby granted, free of charge, to any person obtaining a copy of 6 | -- this software and associated documentation files (the "Software"), to deal in 7 | -- the Software without restriction, including without limitation the rights to 8 | -- use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of 9 | -- the Software, and to permit persons to whom the Software is furnished to do so, 10 | -- subject to the following conditions: 11 | 12 | -- The above copyright notice and this permission notice shall be included in all 13 | -- copies or substantial portions of the Software. 14 | 15 | -- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | -- IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS 17 | -- FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR 18 | -- COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER 19 | -- IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN 20 | -- CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 21 | 22 | local currentFilePath = "CPStyling/png-lua/" 23 | local deflate = require(currentFilePath.."deflatelua") 24 | local requiredDeflateVersion = "0.3.20111128" 25 | 26 | if (deflate._VERSION ~= requiredDeflateVersion) then 27 | error("Incorrect deflate version: must be "..requiredDeflateVersion..", not "..deflate._VERSION) 28 | end 29 | 30 | local function bsRight(num, pow) 31 | return math.floor(num / 2^pow) 32 | end 33 | 34 | local function bsLeft(num, pow) 35 | return math.floor(num * 2^pow) 36 | end 37 | 38 | local function bytesToNum(bytes) 39 | local n = 0 40 | for k,v in ipairs(bytes) do 41 | n = bsLeft(n, 8) + v 42 | end 43 | if (n > 2147483647) then 44 | return (n - 4294967296) 45 | else 46 | return n 47 | end 48 | n = (n > 2147483647) and (n - 4294967296) or n 49 | return n 50 | end 51 | 52 | local function readInt(stream, bps) 53 | local bytes = {} 54 | bps = bps or 4 55 | for i=1,bps do 56 | bytes[i] = stream:read(1):byte() 57 | end 58 | return bytesToNum(bytes) 59 | end 60 | 61 | local function readChar(stream, num) 62 | num = num or 1 63 | return stream:read(num) 64 | end 65 | 66 | local function readByte(stream) 67 | return stream:read(1):byte() 68 | end 69 | 70 | local function getDataIHDR(stream, length) 71 | local data = {} 72 | data["width"] = readInt(stream) 73 | data["height"] = readInt(stream) 74 | data["bitDepth"] = readByte(stream) 75 | data["colorType"] = readByte(stream) 76 | data["compression"] = readByte(stream) 77 | data["filter"] = readByte(stream) 78 | data["interlace"] = readByte(stream) 79 | return data 80 | end 81 | 82 | local function getDataIDAT(stream, length, oldData) 83 | local data = {} 84 | if (oldData == nil) then 85 | data.data = readChar(stream, length) 86 | else 87 | data.data = oldData.data .. readChar(stream, length) 88 | end 89 | return data 90 | end 91 | 92 | local function getDataPLTE(stream, length) 93 | local data = {} 94 | data["numColors"] = math.floor(length/3) 95 | data["colors"] = {} 96 | for i = 1, data["numColors"] do 97 | data.colors[i] = { 98 | R = readByte(stream), 99 | G = readByte(stream), 100 | B = readByte(stream) 101 | } 102 | end 103 | return data 104 | end 105 | 106 | local function extractChunkData(stream) 107 | local chunkData = {} 108 | local length 109 | local type 110 | local crc 111 | 112 | while type ~= "IEND" do 113 | length = readInt(stream) 114 | type = readChar(stream, 4) 115 | if (type == "IHDR") then 116 | chunkData[type] = getDataIHDR(stream, length) 117 | elseif (type == "IDAT") then 118 | chunkData[type] = getDataIDAT(stream, length, chunkData[type]) 119 | elseif (type == "PLTE") then 120 | chunkData[type] = getDataPLTE(stream, length) 121 | else 122 | readChar(stream, length) 123 | end 124 | crc = readChar(stream, 4) 125 | end 126 | 127 | return chunkData 128 | end 129 | 130 | local function makePixel(stream, depth, colorType, palette) 131 | local bps = math.floor(depth/8) --bits per sample 132 | local pixelData = { R = 0, G = 0, B = 0, A = 0 } 133 | local grey 134 | local index 135 | local color 136 | 137 | if colorType == 0 then 138 | grey = readInt(stream, bps) 139 | pixelData.R = grey 140 | pixelData.G = grey 141 | pixelData.B = grey 142 | pixelData.A = 255 143 | elseif colorType == 2 then 144 | pixelData.R = readInt(stream, bps) 145 | pixelData.G = readInt(stream, bps) 146 | pixelData.B = readInt(stream, bps) 147 | pixelData.A = 255 148 | elseif colorType == 3 then 149 | index = readInt(stream, bps)+1 150 | color = palette.colors[index] 151 | pixelData.R = color.R 152 | pixelData.G = color.G 153 | pixelData.B = color.B 154 | pixelData.A = 255 155 | elseif colorType == 4 then 156 | grey = readInt(stream, bps) 157 | pixelData.R = grey 158 | pixelData.G = grey 159 | pixelData.B = grey 160 | pixelData.A = readInt(stream, bps) 161 | elseif colorType == 6 then 162 | pixelData.R = readInt(stream, bps) 163 | pixelData.G = readInt(stream, bps) 164 | pixelData.B = readInt(stream, bps) 165 | pixelData.A = readInt(stream, bps) 166 | end 167 | 168 | return pixelData 169 | end 170 | 171 | local function bitFromColorType(colorType) 172 | if colorType == 0 then return 1 end 173 | if colorType == 2 then return 3 end 174 | if colorType == 3 then return 1 end 175 | if colorType == 4 then return 2 end 176 | if colorType == 6 then return 4 end 177 | error 'Invalid colortype' 178 | end 179 | 180 | local function paethPredict(a, b, c) 181 | local p = a + b - c 182 | local varA = math.abs(p - a) 183 | local varB = math.abs(p - b) 184 | local varC = math.abs(p - c) 185 | 186 | if varA <= varB and varA <= varC then 187 | return a 188 | elseif varB <= varC then 189 | return b 190 | else 191 | return c 192 | end 193 | end 194 | 195 | local function filterType1(curPixel, lastPixel) 196 | local lastByte 197 | local newPixel = {} 198 | for fieldName, curByte in pairs(curPixel) do 199 | lastByte = lastPixel and lastPixel[fieldName] or 0 200 | newPixel[fieldName] = (curByte + lastByte) % 256 201 | end 202 | return newPixel 203 | end 204 | 205 | local prevPixelRow = {} 206 | local function getPixelRow(stream, depth, colorType, palette, length) 207 | local pixelRow = {} 208 | local bpp = math.floor(depth/8) * bitFromColorType(colorType) 209 | local bpl = bpp*length 210 | local filterType = readByte(stream) 211 | 212 | if filterType == 0 then 213 | for x = 1, length do 214 | pixelRow[x] = makePixel(stream, depth, colorType, palette) 215 | end 216 | elseif filterType == 1 then 217 | local curPixel 218 | local lastPixel 219 | local newPixel 220 | local lastByte 221 | for x = 1, length do 222 | curPixel = makePixel(stream, depth, colorType, palette) 223 | lastPixel = prevPixelRow[pixelNum] 224 | newPixel = {} 225 | for fieldName, curByte in pairs(curPixel) do 226 | lastByte = lastPixel and lastPixel[fieldName] or 0 227 | newPixel[fieldName] = (curByte + lastByte) % 256 228 | end 229 | pixelRow[x] = newPixel 230 | end 231 | else 232 | error("Unsupported filter type: " .. tostring(filterType)) 233 | end 234 | prevPixelRow = pixelRow 235 | 236 | return pixelRow 237 | end 238 | 239 | 240 | local function pngImage(path, progCallback, verbose, memSave) 241 | local stream = io.open(path, "rb") 242 | local chunkData 243 | local imStr 244 | local width = 0 245 | local height = 0 246 | local depth = 0 247 | local colorType = 0 248 | local output = {} 249 | local pixels = {} 250 | local StringStream 251 | local function printV(msg) 252 | if (verbose) then 253 | print(msg) 254 | end 255 | end 256 | 257 | if readChar(stream, 8) ~= "\137\080\078\071\013\010\026\010" then 258 | error "Not a png" 259 | end 260 | 261 | printV("Parsing Chunks...") 262 | chunkData = extractChunkData(stream) 263 | 264 | width = chunkData.IHDR.width 265 | height = chunkData.IHDR.height 266 | depth = chunkData.IHDR.bitDepth 267 | colorType = chunkData.IHDR.colorType 268 | 269 | printV("Deflating...") 270 | deflate.inflate_zlib { 271 | input = chunkData.IDAT.data, 272 | output = function(byte) 273 | output[#output+1] = string.char(byte) 274 | end, 275 | disable_crc = true 276 | } 277 | StringStream = { 278 | str = table.concat(output), 279 | read = function(self, num) 280 | local toreturn = self.str:sub(1, num) 281 | self.str = self.str:sub(num + 1, self.str:len()) 282 | return toreturn 283 | end 284 | } 285 | 286 | printV("Creating pixelmap...") 287 | for i = 1, height do 288 | local pixelRow = getPixelRow(StringStream, depth, colorType, chunkData.PLTE, width) 289 | if progCallback ~= nil then 290 | progCallback(i, height, pixelRow) 291 | end 292 | if not memSave then 293 | pixels[i] = pixelRow 294 | end 295 | end 296 | 297 | printV("Done.") 298 | return { 299 | width = width, 300 | height = height, 301 | depth = depth, 302 | colorType = colorType, 303 | pixels = pixels 304 | } 305 | end 306 | 307 | return pngImage 308 | -------------------------------------------------------------------------------- /mods/braindance_protocol/CPStyling/styles.lua: -------------------------------------------------------------------------------- 1 | -- MIT License 2 | -- 3 | -- CPStyling.lua https://github.com/Nats-ji/CPStyling.lua 4 | -- 5 | -- This file is a part of CPStyling.lua 6 | -- 7 | -- Copyright (c) 2021 Mingming Cui 8 | -- 9 | -- Permission is hereby granted, free of charge, to any person obtaining a copy 10 | -- of this software and associated documentation files (the "Software"), to deal 11 | -- in the Software without restriction, including without limitation the rights 12 | -- to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 13 | -- copies of the Software, and to permit persons to whom the Software is 14 | -- furnished to do so, subject to the following conditions: 15 | -- 16 | -- The above copyright notice and this permission notice shall be included in all 17 | -- copies or substantial portions of the Software. 18 | -- 19 | -- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 20 | -- IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 21 | -- FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 22 | -- AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 23 | -- LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 24 | -- OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 25 | -- SOFTWARE. 26 | 27 | return { 28 | color = { 29 | red = { 1.00, 0.00, 0.00, 1.00 }, 30 | cyan = { 0.00, 1.00, 1.00, 1.00 }, 31 | blue = { 0.00, 0.00, 1.00, 1.00 }, 32 | darkblue = { 0.00, 0.00, 0.63, 1.00 }, 33 | lightblue = { 0.68, 0.85, 0.90, 1.00 }, 34 | purple = { 0.50, 0.00, 0.50, 1.00 }, 35 | yellow = { 1.00, 1.00, 0.00, 1.00 }, 36 | lime = { 0.00, 1.00, 0.00, 1.00 }, 37 | magenta = { 1.00, 0.00, 1.00, 1.00 }, 38 | white = { 1.00, 1.00, 1.00, 1.00 }, 39 | silver = { 0.75, 0.75, 0.75, 1.00 }, 40 | grey = { 0.50, 0.50, 0.50, 1.00 }, 41 | black = { 0.00, 0.00, 0.00, 1.00 }, 42 | orange = { 1.00, 0.65, 0.00, 1.00 }, 43 | brown = { 0.65, 0.16, 0.16, 1.00 }, 44 | maroon = { 0.50, 0.00, 0.00, 1.00 }, 45 | green = { 0.00, 0.50, 0.00, 1.00 }, 46 | olive = { 0.50, 0.50, 0.00, 1.00 } 47 | }, 48 | 49 | ImGuiStyleNames = { 50 | Col = { 51 | { ImGuiStyle = ImGuiCol.Text , ImGuiStyleShort = "Text" }, 52 | { ImGuiStyle = ImGuiCol.TextDisabled , ImGuiStyleShort = "TextDisabled" }, 53 | { ImGuiStyle = ImGuiCol.WindowBg , ImGuiStyleShort = "WindowBg" }, 54 | { ImGuiStyle = ImGuiCol.ChildBg , ImGuiStyleShort = "ChildBg" }, 55 | { ImGuiStyle = ImGuiCol.PopupBg , ImGuiStyleShort = "PopupBg" }, 56 | { ImGuiStyle = ImGuiCol.Border , ImGuiStyleShort = "Border" }, 57 | { ImGuiStyle = ImGuiCol.BorderShadow , ImGuiStyleShort = "BorderShadow" }, 58 | { ImGuiStyle = ImGuiCol.FrameBg , ImGuiStyleShort = "FrameBg" }, 59 | { ImGuiStyle = ImGuiCol.FrameBgHovered , ImGuiStyleShort = "FrameBgHovered" }, 60 | { ImGuiStyle = ImGuiCol.FrameBgActive , ImGuiStyleShort = "FrameBgActive" }, 61 | { ImGuiStyle = ImGuiCol.TitleBg , ImGuiStyleShort = "TitleBg" }, 62 | { ImGuiStyle = ImGuiCol.TitleBgActive , ImGuiStyleShort = "TitleBgActive" }, 63 | { ImGuiStyle = ImGuiCol.TitleBgCollapsed , ImGuiStyleShort = "TitleBgCollapsed" }, 64 | { ImGuiStyle = ImGuiCol.MenuBarBg , ImGuiStyleShort = "MenuBarBg" }, 65 | { ImGuiStyle = ImGuiCol.ScrollbarBg , ImGuiStyleShort = "ScrollbarBg" }, 66 | { ImGuiStyle = ImGuiCol.ScrollbarGrab , ImGuiStyleShort = "ScrollbarGrab" }, 67 | { ImGuiStyle = ImGuiCol.ScrollbarGrabHovered , ImGuiStyleShort = "ScrollbarGrabHovered" }, 68 | { ImGuiStyle = ImGuiCol.ScrollbarGrabActive , ImGuiStyleShort = "ScrollbarGrabActive" }, 69 | { ImGuiStyle = ImGuiCol.CheckMark , ImGuiStyleShort = "CheckMark" }, 70 | { ImGuiStyle = ImGuiCol.SliderGrab , ImGuiStyleShort = "SliderGrab" }, 71 | { ImGuiStyle = ImGuiCol.SliderGrabActive , ImGuiStyleShort = "SliderGrabActive" }, 72 | { ImGuiStyle = ImGuiCol.Button , ImGuiStyleShort = "Button" }, 73 | { ImGuiStyle = ImGuiCol.ButtonHovered , ImGuiStyleShort = "ButtonHovered" }, 74 | { ImGuiStyle = ImGuiCol.ButtonActive , ImGuiStyleShort = "ButtonActive" }, 75 | { ImGuiStyle = ImGuiCol.Header , ImGuiStyleShort = "Header" }, 76 | { ImGuiStyle = ImGuiCol.HeaderHovered , ImGuiStyleShort = "HeaderHovered" }, 77 | { ImGuiStyle = ImGuiCol.HeaderActive , ImGuiStyleShort = "HeaderActive" }, 78 | { ImGuiStyle = ImGuiCol.Separator , ImGuiStyleShort = "Separator" }, 79 | { ImGuiStyle = ImGuiCol.SeparatorHovered , ImGuiStyleShort = "SeparatorHovered" }, 80 | { ImGuiStyle = ImGuiCol.SeparatorActive , ImGuiStyleShort = "SeparatorActive" }, 81 | { ImGuiStyle = ImGuiCol.ResizeGrip , ImGuiStyleShort = "ResizeGrip" }, 82 | { ImGuiStyle = ImGuiCol.ResizeGripHovered , ImGuiStyleShort = "ResizeGripHovered" }, 83 | { ImGuiStyle = ImGuiCol.ResizeGripActive , ImGuiStyleShort = "ResizeGripActive" }, 84 | { ImGuiStyle = ImGuiCol.Tab , ImGuiStyleShort = "Tab" }, 85 | { ImGuiStyle = ImGuiCol.TabHovered , ImGuiStyleShort = "TabHovered" }, 86 | { ImGuiStyle = ImGuiCol.TabActive , ImGuiStyleShort = "TabActive" }, 87 | { ImGuiStyle = ImGuiCol.TabUnfocused , ImGuiStyleShort = "TabUnfocused" }, 88 | { ImGuiStyle = ImGuiCol.TabUnfocusedActive , ImGuiStyleShort = "TabUnfocusedActive" }, 89 | { ImGuiStyle = ImGuiCol.PlotLines , ImGuiStyleShort = "PlotLines" }, 90 | { ImGuiStyle = ImGuiCol.PlotLinesHovered , ImGuiStyleShort = "PlotLinesHovered" }, 91 | { ImGuiStyle = ImGuiCol.PlotHistogram , ImGuiStyleShort = "PlotHistogram" }, 92 | { ImGuiStyle = ImGuiCol.PlotHistogramHovered , ImGuiStyleShort = "PlotHistogramHovered" }, 93 | { ImGuiStyle = ImGuiCol.TextSelectedBg , ImGuiStyleShort = "TextSelectedBg" }, 94 | { ImGuiStyle = ImGuiCol.DragDropTarget , ImGuiStyleShort = "DragDropTarget" }, 95 | { ImGuiStyle = ImGuiCol.NavHighlight , ImGuiStyleShort = "NavHighlight" }, 96 | { ImGuiStyle = ImGuiCol.NavWindowingHighlight , ImGuiStyleShort = "NavWindowingHighlight" }, 97 | { ImGuiStyle = ImGuiCol.NavWindowingDimBg , ImGuiStyleShort = "NavWindowingDimBg" }, 98 | { ImGuiStyle = ImGuiCol.ModalWindowDimBg , ImGuiStyleShort = "ModalWindowDimBg" }, 99 | { ImGuiStyle = ImGuiCol.COUNT , ImGuiStyleShort = "COUNT" } 100 | }, 101 | Var = { 102 | { ImGuiStyle = ImGuiStyleVar.Alpha , ImGuiStyleShort = "Alpha" }, 103 | { ImGuiStyle = ImGuiStyleVar.WindowPadding , ImGuiStyleShort = "WindowPadding" }, 104 | { ImGuiStyle = ImGuiStyleVar.WindowRounding , ImGuiStyleShort = "WindowRounding" }, 105 | { ImGuiStyle = ImGuiStyleVar.WindowBorderSize , ImGuiStyleShort = "WindowBorderSize" }, 106 | { ImGuiStyle = ImGuiStyleVar.WindowMinSize , ImGuiStyleShort = "WindowMinSize" }, 107 | { ImGuiStyle = ImGuiStyleVar.WindowTitleAlign , ImGuiStyleShort = "WindowTitleAlign" }, 108 | { ImGuiStyle = ImGuiStyleVar.ChildRounding , ImGuiStyleShort = "ChildRounding" }, 109 | { ImGuiStyle = ImGuiStyleVar.ChildBorderSize , ImGuiStyleShort = "ChildBorderSize" }, 110 | { ImGuiStyle = ImGuiStyleVar.PopupRounding , ImGuiStyleShort = "PopupRounding" }, 111 | { ImGuiStyle = ImGuiStyleVar.PopupBorderSize , ImGuiStyleShort = "PopupBorderSize" }, 112 | { ImGuiStyle = ImGuiStyleVar.FramePadding , ImGuiStyleShort = "FramePadding" }, 113 | { ImGuiStyle = ImGuiStyleVar.FrameRounding , ImGuiStyleShort = "FrameRounding" }, 114 | { ImGuiStyle = ImGuiStyleVar.FrameBorderSize , ImGuiStyleShort = "FrameBorderSize" }, 115 | { ImGuiStyle = ImGuiStyleVar.ItemSpacing , ImGuiStyleShort = "ItemSpacing" }, 116 | { ImGuiStyle = ImGuiStyleVar.ItemInnerSpacing , ImGuiStyleShort = "ItemInnerSpacing" }, 117 | { ImGuiStyle = ImGuiStyleVar.IndentSpacing , ImGuiStyleShort = "IndentSpacing" }, 118 | { ImGuiStyle = ImGuiStyleVar.ScrollbarSize , ImGuiStyleShort = "ScrollbarSize" }, 119 | { ImGuiStyle = ImGuiStyleVar.ScrollbarRounding , ImGuiStyleShort = "ScrollbarRounding" }, 120 | { ImGuiStyle = ImGuiStyleVar.GrabMinSize , ImGuiStyleShort = "GrabMinSize" }, 121 | { ImGuiStyle = ImGuiStyleVar.GrabRounding , ImGuiStyleShort = "GrabRounding" }, 122 | { ImGuiStyle = ImGuiStyleVar.TabRounding , ImGuiStyleShort = "TabRounding" }, 123 | { ImGuiStyle = ImGuiStyleVar.SelectableTextAlign , ImGuiStyleShort = "SelectableTextAlign" }, 124 | { ImGuiStyle = ImGuiStyleVar.ButtonTextAlign , ImGuiStyleShort = "ButtonTextAlign" }, 125 | { ImGuiStyle = ImGuiStyleVar.COUNT , ImGuiStyleShort = "COUNT" } 126 | } 127 | } 128 | } 129 | -------------------------------------------------------------------------------- /mods/braindance_protocol/CPStyling/theme.lua: -------------------------------------------------------------------------------- 1 | -- MIT License 2 | -- 3 | -- CPStyling.lua https://github.com/Nats-ji/CPStyling.lua 4 | -- 5 | -- This file is a part of CPStyling.lua 6 | -- 7 | -- Copyright (c) 2021 Mingming Cui 8 | -- 9 | -- Permission is hereby granted, free of charge, to any person obtaining a copy 10 | -- of this software and associated documentation files (the "Software"), to deal 11 | -- in the Software without restriction, including without limitation the rights 12 | -- to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 13 | -- copies of the Software, and to permit persons to whom the Software is 14 | -- furnished to do so, subject to the following conditions: 15 | -- 16 | -- The above copyright notice and this permission notice shall be included in all 17 | -- copies or substantial portions of the Software. 18 | -- 19 | -- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 20 | -- IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 21 | -- FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 22 | -- AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 23 | -- LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 24 | -- OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 25 | -- SOFTWARE. 26 | 27 | return { 28 | Text = { 1.00, 0.38, 0.33, 1.00 }, 29 | TextDisabled = { 0.48, 0.39, 0.40, 1.00 }, 30 | WindowBg = { 0.06, 0.04, 0.06, 0.90 }, 31 | ChildBg = { 0.00, 0.00, 0.00, 0.00 }, 32 | PopupBg = { 0.06, 0.04, 0.06, 0.90 }, 33 | Border = { 0.30, 0.07, 0.08, 1.00 }, 34 | BorderShadow = { 0.00, 0.00, 0.00, 0.00 }, 35 | FrameBg = { 0.50, 0.13, 0.16, 0.50 }, 36 | FrameBgHovered = { 0.32, 0.11, 0.12, 0.50 }, 37 | FrameBgActive = { 0.50, 0.13, 0.16, 0.50 }, 38 | -- FrameBgDisabled = { 0.48, 0.39, 0.40, 1.00 }, 39 | -- FrameBgHoveredDisabled = { 0.48, 0.39, 0.40, 1.00 }, 40 | -- FrameBgActiveDisabled = { 0.48, 0.39, 0.40, 1.00 }, 41 | TitleBg = { 0.06, 0.04, 0.06, 0.90 }, 42 | TitleBgActive = { 0.06, 0.04, 0.06, 0.90 }, 43 | TitleBgCollapsed = { 0.06, 0.04, 0.06, 0.90 }, 44 | MenuBarBg = { 0.00, 0.00, 0.00, 0.00 }, 45 | ScrollbarBg = { 0.23, 0.07, 0.09, 1.00 }, 46 | ScrollbarGrab = { 0.95, 0.30, 0.28, 1.00 }, 47 | ScrollbarGrabHovered = { 0.95, 0.30, 0.28, 1.00 }, 48 | ScrollbarGrabActive = { 0.95, 0.30, 0.28, 1.00 }, 49 | CheckMark = { 1.00, 0.44, 0.40, 1.00 }, 50 | -- CheckMarkTrueDisabled = { 0.34, 0.22, 0.24, 1.00 }, 51 | -- CheckMarkFalseDisabled = { 0.48, 0.39, 0.40, 1.00 }, 52 | SliderGrab = { 0.64, 0.22, 0.21, 1.00 }, 53 | SliderGrabActive = { 0.64, 0.22, 0.21, 1.00 }, 54 | Button = { 0.57, 0.17, 0.16, 1.00 }, 55 | ButtonHovered = { 0.45, 0.13, 0.14, 1.00 }, 56 | ButtonActive = { 0.57, 0.17, 0.16, 1.00 }, 57 | Header = { 0.08, 0.08, 0.15, 1.00 }, 58 | HeaderHovered = { 0.22, 0.64, 0.69, 0.30 }, 59 | HeaderActive = { 0.22, 0.64, 0.69, 0.50 }, 60 | Separator = { 0.26, 0.09, 0.09, 1.00 }, 61 | SeparatorHovered = { 0.26, 0.09, 0.09, 1.00 }, 62 | SeparatorActive = { 0.26, 0.09, 0.09, 1.00 }, 63 | ResizeGrip = { 0.00, 0.00, 0.00, 0.00 }, 64 | ResizeGripHovered = { 0.45, 0.13, 0.14, 1.00 }, 65 | ResizeGripActive = { 0.57, 0.17, 0.16, 1.00 }, 66 | Tab = { 0.57, 0.17, 0.16, 1.00 }, 67 | TabHovered = { 0.45, 0.13, 0.14, 1.00 }, 68 | TabActive = { 0.57, 0.17, 0.16, 1.00 }, 69 | TabUnfocused = { 0.45, 0.14, 0.13, 1.00 }, 70 | TabUnfocusedActive = { 0.58, 0.18, 0.16, 1.00 }, 71 | -- PlotLines = { 0.00, 0.00, 0.00, 0.00 }, 72 | -- PlotLinesHovered = { 0.00, 0.00, 0.00, 0.00 }, 73 | -- PlotHistogram = { 0.00, 0.00, 0.00, 0.00 }, 74 | -- PlotHistogramHovered = { 0.00, 0.00, 0.00, 0.00 }, 75 | TextSelectedBg = { 0.06, 0.06, 0.12, 1.00 }, 76 | -- DragDropTarget = { 0.00, 0.00, 0.00, 0.00 }, 77 | -- NavHighlight = { 0.00, 0.00, 0.00, 0.00 }, 78 | -- NavWindowingHighlight = { 0.00, 0.00, 0.00, 0.00 }, 79 | -- NavWindowingDimBg = { 0.00, 0.00, 0.00, 0.00 }, 80 | ModalWindowDimBg = { 0.00, 0.00, 0.00, 0.40 }, 81 | CPButton = { 0.06, 0.06, 0.12, 1.00 }, 82 | CPButtonHovered = { 0.43, 0.13, 0.13, 1.00 }, 83 | CPButtonActive = { 0.57, 0.16, 0.16, 1.00 }, 84 | CPButtonText = { 0.34, 0.95, 0.98, 1.00 }, 85 | CPButtonBorder = { 0.40, 0.08, 0.09, 1.00 }, 86 | CPButtonBorderHovered = { 0.34, 0.95, 0.98, 1.00 }, 87 | CPToggleOn = { 0.37, 0.96, 1.00, 1.00 }, 88 | CPToggleOnHovered = { 0.29, 0.77, 0.80, 1.00 }, 89 | CPToggleOnText = { 0.00, 0.00, 0.00, 1.00 }, 90 | CPToggleOnTextHovered = { 0.00, 0.00, 0.00, 1.00 }, 91 | CPToggleOnBorder = { 0.29, 0.61, 0.58, 1.00 }, 92 | CPToggleOnBorderHovered = { 0.26, 0.66, 0.65, 1.00 }, 93 | CPToggleOnDisabled = { 0.03, 0.12, 0.12, 1.00 }, 94 | CPToggleOnDisabledHovered = { 0.05, 0.16, 0.16, 1.00 }, 95 | CPToggleOnDisabledText = { 0.08, 0.23, 0.25, 1.00 }, 96 | CPToggleOnDisabledTextHovered = { 0.09, 0.29, 0.30, 1.00 }, 97 | CPToggleOnDisabledBorder = { 0.06, 0.15, 0.15, 1.00 }, 98 | CPToggleOnDisabledBorderHovered = { 0.09, 0.24, 0.25, 1.00 }, 99 | CPToggleOff = { 0.58, 0.18, 0.16, 1.00 }, 100 | CPToggleOffHovered = { 0.45, 0.14, 0.13, 1.00 }, 101 | CPToggleOffText = { 1.00, 0.44, 0.41, 1.00 }, 102 | CPToggleOffTextHovered = { 1.00, 0.36, 0.33, 1.00 }, 103 | CPToggleOffBorder = { 0.92, 0.29, 0.26, 1.00 }, 104 | CPToggleOffBorderHovered = { 0.76, 0.23, 0.21, 1.00 }, 105 | CPToggleOffDisabled = { 0.09, 0.04, 0.07, 1.00 }, 106 | CPToggleOffDisabledHovered = { 0.16, 0.06, 0.07, 1.00 }, 107 | CPToggleOffDisabledText = { 0.32, 0.09, 0.10, 1.00 }, 108 | CPToggleOffDisabledTextHovered = { 0.36, 0.11, 0.11, 1.00 }, 109 | CPToggleOffDisabledBorder = { 0.19, 0.08, 0.09, 1.00 }, 110 | CPToggleOffDisabledBorderHovered = { 0.30, 0.09, 0.10, 1.00 }, 111 | CPFrameBg = { 0.06, 0.06, 0.12, 1.00 }, 112 | CPFrameBgHovered = { 0.31, 0.11, 0.11, 1.00 }, 113 | CPFrameBgActive = { 0.57, 0.19, 0.19, 1.00 }, 114 | CPSliderGrab = { 0.64, 0.21, 0.21, 1.00 }, 115 | CPSliderGrabActive = { 0.64, 0.21, 0.21, 1.00 }, 116 | CPFrameBorder = { 0.40, 0.08, 0.09, 1.00 }, 117 | CPTextSelectedBg = { 0.45, 0.14, 0.13, 1.00 }, 118 | CPToolTip2Bg = { 0.11, 0.22, 0.25, 0.60 }, 119 | CPToolTip2Border = { 0.18, 0.42, 0.46, 1.00 }, 120 | CPToolTip2Separator = { 0.24, 0.55, 0.58, 1.00 }, 121 | CPToolTip2SideBg = { 0.12, 0.24, 0.27, 1.00 }, 122 | Hidden = { 0.00, 0.00, 0.00, 0.00 } 123 | } 124 | -------------------------------------------------------------------------------- /mods/braindance_protocol/ai/vehicles.lua: -------------------------------------------------------------------------------- 1 | local Vehicles = {} 2 | 3 | local Utilities = require("utility") 4 | 5 | 6 | function Vehicles.PreventKnockdown() 7 | local moduleName = "Prevent Vehicle Knockdown" 8 | GameOptions.SetFloat("Crowds", "MinimumSpeedForKnockdownByCar", 99.000000) 9 | Utilities.FinishProtocol(moduleName) 10 | end 11 | 12 | function Vehicles.GetAll() 13 | local moduleName = "Get all vehicles" 14 | 15 | vs = Game.GetVehicleSystem() 16 | vs:EnableAllPlayerVehicles() 17 | 18 | Utilities.FinishProtocol(moduleName) 19 | end 20 | 21 | -- Individual Vehicles 22 | function Vehicles.GetMahirSupronFS3() 23 | local moduleName = "Adding Vehicle: Mahir - Supron FS3" 24 | 25 | vs = Game.GetVehicleSystem() 26 | vs:EnablePlayerVehicle('Vehicle.v_standard25_mahir_supron_player', true, false) 27 | 28 | Utilities.FinishProtocol(moduleName) 29 | end 30 | 31 | function Vehicles.GetMaiMaiP126() 32 | local moduleName = "Adding Vehicle: Makigai - MaiMai P126" 33 | 34 | vs = Game.GetVehicleSystem() 35 | vs:EnablePlayerVehicle('Vehicle.v_standard2_makigai_maimai_player', true, false) 36 | 37 | Utilities.FinishProtocol(moduleName) 38 | end 39 | 40 | function Vehicles.GetThortonColbyC125() 41 | local moduleName = "Adding Vehicle: Thorton - Colby C125" 42 | 43 | vs = Game.GetVehicleSystem() 44 | vs:EnablePlayerVehicle('Vehicle.v_standard2_thorton_colby_player', true, false) 45 | 46 | Utilities.FinishProtocol(moduleName) 47 | end 48 | 49 | function Vehicles.GetThortonColbyCX410Green() 50 | local moduleName = "Adding Vehicle: Thorton - Colby CX 410 Butte (green)" 51 | 52 | vs = Game.GetVehicleSystem() 53 | vs:EnablePlayerVehicle('Vehicle.v_standard25_thorton_colby_pickup_player', true, false) 54 | 55 | Utilities.FinishProtocol(moduleName) 56 | end 57 | 58 | function Vehicles.GetThortonColbyCX410Red() 59 | local moduleName = "Adding Vehicle: Thorton - Colby CX 410 Butte (red)" 60 | 61 | vs = Game.GetVehicleSystem() 62 | vs:EnablePlayerVehicle('Vehicle.v_standard25_thorton_colby_pickup_02_player', true, false) 63 | 64 | Utilities.FinishProtocol(moduleName) 65 | end 66 | 67 | function Vehicles.GetThortonColbyLittleMule() 68 | local moduleName = "Adding Vehicle: Thorton - Colby 'Little Mule'" 69 | 70 | vs = Game.GetVehicleSystem() 71 | vs:EnablePlayerVehicle('Vehicle.v_standard25_thorton_colby_nomad_player', true, false) 72 | 73 | Utilities.FinishProtocol(moduleName) 74 | end 75 | 76 | function Vehicles.GetThortonGalenaG240() 77 | local moduleName = "Adding Vehicle: Thorton - Galena G240" 78 | 79 | vs = Game.GetVehicleSystem() 80 | vs:EnablePlayerVehicle('Vehicle.v_standard2_thorton_galena_player', true, false) 81 | 82 | Utilities.FinishProtocol(moduleName) 83 | end 84 | 85 | function Vehicles.GetThortonGalenaGecko() 86 | local moduleName = "Adding Vehicle: Thorton - Galena 'Gecko'" 87 | 88 | vs = Game.GetVehicleSystem() 89 | vs:EnablePlayerVehicle('Vehicle.v_standard2_thorton_galena_nomad_player', true, false) 90 | 91 | Utilities.FinishProtocol(moduleName) 92 | end 93 | 94 | function Vehicles.GetThortonGalenaRattler() 95 | local moduleName = "Adding Vehicle: Thorton - Galena 'Rattler'" 96 | 97 | vs = Game.GetVehicleSystem() 98 | vs:EnablePlayerVehicle('Vehicle.v_standard2_thorton_galena_bobas_player', true, false) 99 | 100 | Utilities.FinishProtocol(moduleName) 101 | end 102 | 103 | function Vehicles.GetThortonMackinawMTL1() 104 | local moduleName = "Adding Vehicle: Thorton - Mackinaw MTL1" 105 | 106 | vs = Game.GetVehicleSystem() 107 | vs:EnablePlayerVehicle('Vehicle.v_standard3_thorton_mackinaw_player', true, false) 108 | 109 | Utilities.FinishProtocol(moduleName) 110 | end 111 | 112 | function Vehicles.GetThortonMackinawBeast() 113 | local moduleName = "Adding Vehicle: Thorton - Mackinaw 'Beast'" 114 | 115 | vs = Game.GetVehicleSystem() 116 | vs:EnablePlayerVehicle('Vehicle.v_standard3_thorton_mackinaw_ncu_player', true, false) 117 | 118 | Utilities.FinishProtocol(moduleName) 119 | end 120 | 121 | function Vehicles.GetVillefortAlvaradoVato() 122 | local moduleName = "Adding Vehicle: Villefort - Alvarado 'Vato'" 123 | 124 | vs = Game.GetVehicleSystem() 125 | vs:EnablePlayerVehicle('Vehicle.v_sport2_villefort_alvarado_valentinos_player', true, false) 126 | 127 | Utilities.FinishProtocol(moduleName) 128 | end 129 | 130 | function Vehicles.GetVillefortAlvaradoV4F570Delegate() 131 | local moduleName = "Adding Vehicle: Villefort - Alvarado V4F 570 Delegate" 132 | 133 | vs = Game.GetVehicleSystem() 134 | vs:EnablePlayerVehicle('Vehicle.v_sport2_villefort_alvarado_player', true, false) 135 | 136 | Utilities.FinishProtocol(moduleName) 137 | end 138 | 139 | function Vehicles.GetVillefortColumbusV340FFreight() 140 | local moduleName = "Adding Vehicle: Villefort - Columbus V340-F Freight" 141 | 142 | vs = Game.GetVehicleSystem() 143 | vs:EnablePlayerVehicle('Vehicle.v_standard25_villefort_columbus_player', true, false) 144 | 145 | Utilities.FinishProtocol(moduleName) 146 | end 147 | 148 | function Vehicles.GetVillefortCortesV5000ValorPink() 149 | local moduleName = "Adding Vehicle: Villefort - Cortes V5000 Valor (pink)" 150 | 151 | vs = Game.GetVehicleSystem() 152 | vs:EnablePlayerVehicle('Vehicle.v_standard2_villefort_cortes_player', true, false) 153 | 154 | Utilities.FinishProtocol(moduleName) 155 | end 156 | 157 | function Vehicles.GetVillefortCortesDelaminNo21() 158 | local moduleName = "Adding Vehicle: Villefort - Cortes Delamain No.21" 159 | 160 | vs = Game.GetVehicleSystem() 161 | vs:EnablePlayerVehicle('Vehicle.v_standard2_villefort_cortes_delamain_player', true, false) 162 | 163 | Utilities.FinishProtocol(moduleName) 164 | end 165 | 166 | function Vehicles.GetChevalierEmperor620Ragnar() 167 | local moduleName = "Adding Vehicle: Chevalier - Emperor 620 Ragnar" 168 | 169 | vs = Game.GetVehicleSystem() 170 | vs:EnablePlayerVehicle('Vehicle.v_standard3_chevalier_emperor_player', true, false) 171 | 172 | Utilities.FinishProtocol(moduleName) 173 | end 174 | 175 | function Vehicles.GetChevalierThrax338Jefferson() 176 | local moduleName = "Adding Vehicle: Chevalier - Thrax 338 Jefferson" 177 | 178 | vs = Game.GetVehicleSystem() 179 | vs:EnablePlayerVehicle('Vehicle.v_standard2_chevalier_thrax_player', true, false) 180 | 181 | Utilities.FinishProtocol(moduleName) 182 | end 183 | 184 | function Vehicles.GetBrennanApollo() 185 | local moduleName = "Adding Vehicle: Brennan - Apollo" 186 | 187 | vs = Game.GetVehicleSystem() 188 | vs:EnablePlayerVehicle('Vehicle.v_sportbike3_brennan_apollo_player', true, false) 189 | 190 | Utilities.FinishProtocol(moduleName) 191 | end 192 | 193 | function Vehicles.GetBrennanApolloScorpion() 194 | local moduleName = "Adding Vehicle: Brennan - Apollo 'Scorpion'" 195 | 196 | vs = Game.GetVehicleSystem() 197 | vs:EnablePlayerVehicle('Vehicle.v_sportbike3_brennan_apollo_nomad_player', true, false) 198 | 199 | Utilities.FinishProtocol(moduleName) 200 | end 201 | 202 | function Vehicles.GetJackiesArch() 203 | local moduleName = "Adding Vehicle: Jackie's Arch" 204 | 205 | vs = Game.GetVehicleSystem() 206 | vs:EnablePlayerVehicle('Vehicle.v_sportbike2_arch_jackie_player', true, false) 207 | 208 | Utilities.FinishProtocol(moduleName) 209 | end 210 | 211 | function Vehicles.GetJackiesTunedArch() 212 | local moduleName = "Adding Vehicle: Jackie's Tuned Arch" 213 | 214 | vs = Game.GetVehicleSystem() 215 | vs:EnablePlayerVehicle('Vehicle.v_sportbike2_arch_jackie_tuned_player', true, false) 216 | 217 | Utilities.FinishProtocol(moduleName) 218 | end 219 | 220 | function Vehicles.GetArchNazare() 221 | local moduleName = "Adding Vehicle: Arch - Nazaré" 222 | 223 | vs = Game.GetVehicleSystem() 224 | vs:EnablePlayerVehicle('Vehicle.v_sportbike2_arch_player', true, false) 225 | 226 | Utilities.FinishProtocol(moduleName) 227 | end 228 | 229 | function Vehicles.GetArchNazareItsumade() 230 | local moduleName = "Adding Vehicle: Arch - Nazaré 'Itsumade'" 231 | 232 | vs = Game.GetVehicleSystem() 233 | vs:EnablePlayerVehicle('Vehicle.v_sportbike2_arch_tyger_player', true, false) 234 | 235 | Utilities.FinishProtocol(moduleName) 236 | end 237 | 238 | function Vehicles.GetYaibaKusanagiMizuchi() 239 | local moduleName = "Adding Vehicle: Yaiba - Kusanagi 'Mizuchi'" 240 | 241 | vs = Game.GetVehicleSystem() 242 | vs:EnablePlayerVehicle('Vehicle.v_sportbike1_yaiba_kusanagi_tyger_player', true, false) 243 | 244 | Utilities.FinishProtocol(moduleName) 245 | end 246 | 247 | function Vehicles.GetYaibaKusanagiCT3X() 248 | local moduleName = "Adding Vehicle: Yaiba - Kusanagi CT-3X" 249 | 250 | vs = Game.GetVehicleSystem() 251 | vs:EnablePlayerVehicle('Vehicle.v_sportbike1_yaiba_kusanagi_player', true, false) 252 | 253 | Utilities.FinishProtocol(moduleName) 254 | end 255 | 256 | function Vehicles.GetPorsche911Johnny() 257 | local moduleName = "Adding Vehicle: Porsche - 911 II (930) TURBO" 258 | 259 | vs = Game.GetVehicleSystem() 260 | vs:EnablePlayerVehicle('Vehicle.v_sport2_porsche_911turbo_player', true, false) 261 | 262 | Utilities.FinishProtocol(moduleName) 263 | end 264 | 265 | function Vehicles.GetArcherQuartzECT2R660() 266 | local moduleName = "Adding Vehicle: Archer - Quartz EC-T2 R660" 267 | 268 | vs = Game.GetVehicleSystem() 269 | vs:EnablePlayerVehicle('Vehicle.v_standard2_archer_quartz_player', true, false) 270 | 271 | Utilities.FinishProtocol(moduleName) 272 | end 273 | 274 | function Vehicles.GetMizutaniShionCoyote() 275 | local moduleName = "Adding Vehicle: Mizutani - Shion 'Coyote'" 276 | 277 | vs = Game.GetVehicleSystem() 278 | vs:EnablePlayerVehicle('Vehicle.v_sport2_mizutani_shion_nomad_player', true, false) 279 | 280 | Utilities.FinishProtocol(moduleName) 281 | end 282 | 283 | function Vehicles.GetMizutaniShionCoyoteRed() 284 | local moduleName = "Adding Vehicle: Mizutani - Shion 'Coyote' (Red)" 285 | 286 | vs = Game.GetVehicleSystem() 287 | vs:EnablePlayerVehicle('Vehicle.v_sport2_mizutani_shion_nomad_02_player', true, false) 288 | 289 | Utilities.FinishProtocol(moduleName) 290 | end 291 | 292 | function Vehicles.GetMizutaniShionMZ2() 293 | local moduleName = "Adding Vehicle: Mizutani - Shion MZ2" 294 | 295 | vs = Game.GetVehicleSystem() 296 | vs:EnablePlayerVehicle('Vehicle.v_sport2_mizutani_shion_player', true, false) 297 | 298 | Utilities.FinishProtocol(moduleName) 299 | end 300 | 301 | function Vehicles.GetQuadraTurboR740() 302 | local moduleName = "Adding Vehicle: Quadra - Turbo-R 740" 303 | 304 | vs = Game.GetVehicleSystem() 305 | vs:EnablePlayerVehicle('Vehicle.v_sport1_quadra_turbo_player', true, false) 306 | 307 | Utilities.FinishProtocol(moduleName) 308 | end 309 | 310 | function Vehicles.GetQuadraTurboRVTech() 311 | local moduleName = "Adding Vehicle: Quadra - Turbo-R V-Tech" 312 | 313 | vs = Game.GetVehicleSystem() 314 | vs:EnablePlayerVehicle('Vehicle.v_sport1_quadra_turbo_r_player', true, false) 315 | 316 | Utilities.FinishProtocol(moduleName) 317 | end 318 | 319 | function Vehicles.GetQuadraType66Cthulhu() 320 | local moduleName = "Adding Vehicle: Quadra - Type-66 'Cthulhu'" 321 | 322 | vs = Game.GetVehicleSystem() 323 | vs:EnablePlayerVehicle('Vehicle.v_sport2_quadra_type66_nomad_ncu_player', true, false) 324 | 325 | Utilities.FinishProtocol(moduleName) 326 | end 327 | 328 | function Vehicles.GetQuadraType66Javelina() 329 | local moduleName = "Adding Vehicle: Quadra - Type-66 'Javelina'" 330 | 331 | vs = Game.GetVehicleSystem() 332 | vs:EnablePlayerVehicle('Vehicle.v_sport2_quadra_type66_nomad_player', true, false) 333 | 334 | Utilities.FinishProtocol(moduleName) 335 | end 336 | 337 | function Vehicles.GetQuadraType66JenRowley() 338 | local moduleName = "Adding Vehicle: Quadra - Type-66 'Jen Rowley'" 339 | 340 | vs = Game.GetVehicleSystem() 341 | vs:EnablePlayerVehicle('Vehicle.v_sport2_quadra_type66_player', true, false) 342 | 343 | Utilities.FinishProtocol(moduleName) 344 | end 345 | 346 | function Vehicles.GetQuadraType66Avenger() 347 | local moduleName = "Adding Vehicle: Quadra - Type-66 Avenger" 348 | 349 | vs = Game.GetVehicleSystem() 350 | vs:EnablePlayerVehicle('Vehicle.v_sport2_quadra_type66_avenger_player', true, false) 351 | 352 | Utilities.FinishProtocol(moduleName) 353 | end 354 | 355 | function Vehicles.GetRayfieldAerondightGuinevere() 356 | local moduleName = "Adding Vehicle: Rayfield - Aerondight 'Guinevere'" 357 | 358 | vs = Game.GetVehicleSystem() 359 | vs:EnablePlayerVehicle('Vehicle.v_sport1_rayfield_aerondight_player', true, false) 360 | 361 | Utilities.FinishProtocol(moduleName) 362 | end 363 | 364 | function Vehicles.GetRayfieldCaliburn() 365 | local moduleName = "Adding Vehicle: Rayfield - Caliburn" 366 | 367 | vs = Game.GetVehicleSystem() 368 | vs:EnablePlayerVehicle('Vehicle.v_sport1_rayfield_caliburn_player', true, false) 369 | 370 | Utilities.FinishProtocol(moduleName) 371 | end 372 | 373 | function Vehicles.GetRayfieldCaliburnBlack() 374 | local moduleName = "Adding Vehicle: Rayfield - Caliburn (Black)" 375 | 376 | vs = Game.GetVehicleSystem() 377 | vs:EnablePlayerVehicle('Vehicle.v_sport1_rayfield_caliburn_02_player', true, false) 378 | 379 | Utilities.FinishProtocol(moduleName) 380 | end 381 | 382 | function Vehicles.GetHerreraOutlawGTS() 383 | local moduleName = "Adding Vehicle: Herrera - Outlaw GTS" 384 | 385 | vs = Game.GetVehicleSystem() 386 | vs:EnablePlayerVehicle('Vehicle.v_sport1_herrera_outlaw_player', true, false) 387 | 388 | Utilities.FinishProtocol(moduleName) 389 | end 390 | 391 | return Vehicles 392 | -------------------------------------------------------------------------------- /mods/braindance_protocol/cheats/ammo.lua: -------------------------------------------------------------------------------- 1 | local Ammo = { 2 | counter = 0, 3 | isInfiniteAmmo = false, 4 | isInfiniteAmmoNoReload = false, 5 | lastMagazineAmmoCount = 0, 6 | lastActiveWeapon = nil 7 | } 8 | 9 | local Utilities = require("utility") 10 | local Inventory = require("inventory") 11 | 12 | -- All credits to Nexusmods user "TheBs65422" for the infinite ammo script 13 | function Ammo.AddAmmo() 14 | local moduleName = "Refill All Ammunition" 15 | 16 | Game.AddToInventory("Ammo.HandgunAmmo", 1000) 17 | Game.AddToInventory("Ammo.ShotgunAmmo", 1000) 18 | Game.AddToInventory("Ammo.RifleAmmo", 1000) 19 | Game.AddToInventory("Ammo.SniperRifleAmmo", 1000) 20 | Game.AddToInventory("Ammo.Special", 1000) 21 | 22 | Utilities.FinishProtocol(moduleName) 23 | end 24 | 25 | function Ammo.GetHashAndLength(itemID) 26 | if itemID == nil then 27 | return nil 28 | end 29 | 30 | local hash = tostring(itemID):match("= (%g+),") 31 | local length = tostring(itemID):match("= (%g+) }") 32 | local result = nil 33 | 34 | if hash ~= nil and length ~= nil then 35 | result = { hash, length } 36 | end 37 | 38 | return result 39 | end 40 | 41 | function Ammo.IsNewWeapon(weapon) 42 | if weapon == nil then 43 | return false 44 | elseif Ammo.lastActiveWeapon == nil then 45 | return true 46 | else 47 | local currentWeaponData = Ammo.GetHashAndLength(weapon:GetItemID()) 48 | 49 | if currentWeaponData == nil then 50 | return false 51 | end 52 | 53 | local lastWeaponData = Ammo.GetHashAndLength(Ammo.lastActiveWeapon.itemID) 54 | 55 | if lastWeaponData == nil then 56 | return true 57 | end 58 | 59 | if currentWeaponData[1] ~= lastWeaponData[1] and currentWeaponData[2] ~= lastWeaponData[2] then 60 | return true 61 | else 62 | return false 63 | end 64 | end 65 | end 66 | 67 | function Ammo.SetNewWeapon(weapon) 68 | if weapon ~= nil and Game ~= nil then 69 | local statsSystem = Game.GetStatsSystem() 70 | local weaponItemData = weapon:GetItemData() 71 | 72 | if statsSystem ~= nil and weaponItemData ~= nil then 73 | local weaponStatsObjectID = weaponItemData:GetStatsObjectID() 74 | 75 | if weaponStatsObjectID ~= nil then 76 | Ammo.lastActiveWeapon = {} 77 | 78 | Ammo.lastActiveWeapon.statsObjectID = weaponStatsObjectID 79 | Ammo.lastActiveWeapon.itemID = weapon:GetItemID() 80 | Ammo.lastActiveWeapon.numShotsToFire = statsSystem:GetStatValue(weaponStatsObjectID, Enum.new("gamedataStatType", "NumShotsToFire")) 81 | end 82 | end 83 | end 84 | end 85 | 86 | function Ammo.RestoreLastWeaponStats(isModifiedStats) 87 | if Ammo.lastActiveWeapon ~= nil then 88 | if isModifiedStats then 89 | local statModifier = Game['gameRPGManager::CreateStatModifier;gamedataStatTypegameStatModifierTypeFloat'](Enum.new("gamedataStatType", "NumShotsToFire"), Enum.new("gameStatModifierType", "Additive"), Ammo.lastActiveWeapon.numShotsToFire) 90 | 91 | if statModifier ~= nil then 92 | local statsSystem = Game.GetStatsSystem() 93 | 94 | if statsSystem ~= nil then 95 | statsSystem:AddModifier(Ammo.lastActiveWeapon.statsObjectID, statModifier) 96 | end 97 | end 98 | end 99 | 100 | Ammo.lastActiveWeapon = nil 101 | Ammo.lastMagazineAmmoCount = 0 102 | end 103 | end 104 | 105 | function Ammo.RefillAmmo(weapon, amount) 106 | if weapon ~= nil then 107 | local ammoType = Game['gameweaponObject::GetAmmoType;WeaponObject'](weapon) 108 | 109 | if ammoType ~= nil and Game ~= nil then 110 | local transactionSystem = Game.GetTransactionSystem() 111 | local player = Game.GetPlayer() 112 | 113 | if transactionSystem ~= nil and player ~= nil then 114 | transactionSystem:GiveItem(player, ammoType, amount) 115 | end 116 | end 117 | end 118 | end 119 | 120 | function Ammo.InfiniteAmmoToggle() 121 | local moduleName = "Auto Refill Ammo Toggle" 122 | 123 | if Ammo.isInfiniteAmmo then 124 | Ammo.RestoreLastWeaponStats(false) 125 | end 126 | 127 | Ammo.isInfiniteAmmo = not Ammo.isInfiniteAmmo 128 | 129 | if Ammo.isInfiniteAmmo and Ammo.isInfiniteAmmoNoReload then 130 | Ammo.InfiniteAmmoNoReloadToggle() 131 | end 132 | print("Auto Refill:", Ammo.isInfiniteAmmo) 133 | Utilities.FinishProtocol(moduleName) 134 | end 135 | 136 | function Ammo.InfiniteAmmoNoReloadToggle() 137 | local moduleName = "No Reload Toggle" 138 | 139 | if Ammo.isInfiniteAmmoNoReload then 140 | Ammo.RestoreLastWeaponStats(true) 141 | end 142 | 143 | Ammo.isInfiniteAmmoNoReload = not Ammo.isInfiniteAmmoNoReload 144 | 145 | if Ammo.isInfiniteAmmoNoReload and Ammo.isInfiniteAmmo then 146 | Ammo.InfiniteAmmoToggle() 147 | end 148 | print("No Reload:", Ammo.isInfiniteAmmoNoReload) 149 | Utilities.FinishProtocol(moduleName) 150 | end 151 | 152 | function Ammo.OnUpdateAmmo(deltaTime) 153 | if (Ammo.isInfiniteAmmo or Ammo.isInfiniteAmmoNoReload) and Game ~= nil then 154 | Ammo.counter = Ammo.counter + deltaTime 155 | if (Ammo.counter > 0.5) then 156 | Ammo.counter = Ammo.counter - 0.5 157 | 158 | local player = Game.GetPlayer() 159 | 160 | if player ~= nil then 161 | local activeWeapon = Game.GetTransactionSystem():GetItemInSlot(player, TweakDBID.new('AttachmentSlots.WeaponRight')) 162 | 163 | if activeWeapon ~= nil and Game['gameweaponObject::IsRanged;ItemID'](activeWeapon:GetItemID()) then 164 | if Ammo.isInfiniteAmmo then 165 | Ammo.SetInfiniteAmmo(activeWeapon) 166 | elseif Ammo.isInfiniteAmmoNoReload then 167 | Ammo.SetInfiniteAmmoNoReload(activeWeapon) 168 | end 169 | end 170 | end 171 | end 172 | end 173 | end 174 | 175 | function Ammo.SetInfiniteAmmo(weapon) 176 | if weapon ~= nil and Game ~= nil then 177 | if Ammo.IsNewWeapon(weapon) then 178 | Ammo.RestoreLastWeaponStats(false) 179 | Ammo.SetNewWeapon(weapon) 180 | end 181 | 182 | if Ammo.lastMagazineAmmoCount < 1 then 183 | Ammo.lastMagazineAmmoCount = Game['gameweaponObject::GetMagazineCapacity;WeaponObject'](weapon) 184 | end 185 | 186 | local currentMagazineAmmoCount = Game['gameweaponObject::GetMagazineAmmoCount;WeaponObject'](weapon) 187 | 188 | if currentMagazineAmmoCount < Ammo.lastMagazineAmmoCount then 189 | Ammo.RefillAmmo(weapon, Ammo.lastMagazineAmmoCount - currentMagazineAmmoCount) 190 | 191 | Ammo.lastMagazineAmmoCount = currentMagazineAmmoCount 192 | end 193 | end 194 | end 195 | 196 | function Ammo.SetInfiniteAmmoNoReload(weapon) 197 | if weapon ~= nil and Ammo.IsNewWeapon(weapon) and Game ~= nil then 198 | Ammo.RestoreLastWeaponStats(true) 199 | Ammo.SetNewWeapon(weapon) 200 | 201 | if Ammo.lastActiveWeapon ~= nil then 202 | local statModifier = Game['gameRPGManager::CreateStatModifier;gamedataStatTypegameStatModifierTypeFloat'](Enum.new("gamedataStatType", "NumShotsToFire"), Enum.new("gameStatModifierType", "Additive"), -Ammo.lastActiveWeapon.numShotsToFire) 203 | local statsSystem = Game.GetStatsSystem() 204 | 205 | if statModifier ~= nil and statsSystem ~= nil then 206 | statsSystem:AddModifier(Ammo.lastActiveWeapon.statsObjectID, statModifier) 207 | end 208 | end 209 | end 210 | end 211 | 212 | return Ammo 213 | -------------------------------------------------------------------------------- /mods/braindance_protocol/cheats/cyberware.lua: -------------------------------------------------------------------------------- 1 | local Cyberware = {} 2 | 3 | local Utilities = require("utility") 4 | local Inventory = require("inventory") 5 | 6 | function Cyberware.AddIconicCW() 7 | local moduleName = "Add All Iconic Cyberware Items" 8 | 9 | -- All Iconic Cyberware Items 10 | -- Cyberdeck OS 11 | Inventory.AddItem("BerserkC3MK5") 12 | Inventory.AddItem("BerserkC4MK5") 13 | Inventory.AddItem("FuyutsuiTinkererLegendaryMKIII") 14 | Inventory.AddItem("NetwatchNetdriverLegendaryMKV") 15 | Inventory.AddItem("SandevistanC3MK5") 16 | Inventory.AddItem("SandevistanC4MK5") 17 | 18 | Utilities.FinishProtocol(moduleName) 19 | end 20 | 21 | 22 | function Cyberware.AddLegendaryCW() 23 | local moduleName = "Add All Legendary Cyberware Items" 24 | 25 | -- All Legendary Cyberware Items 26 | -- Arms 27 | Inventory.AddItem("MantisBladesLegendary") 28 | Inventory.AddItem("NanoWiresLegendary") 29 | Inventory.AddItem("ProjectileLauncherLegendary") 30 | Inventory.AddItem("StrongArmsLegendary") 31 | 32 | -- Circulatory System 33 | Inventory.AddItem("BioConductorsLegendary") 34 | Inventory.AddItem("BloodPumpLegendary") 35 | Inventory.AddItem("DischargeConnectorLegendary") 36 | Inventory.AddItem("EnhancedBloodVesselsLegendary") 37 | Inventory.AddItem("HealthMonitorLegendary") 38 | Inventory.AddItem("IronLungsLegendary") 39 | Inventory.AddItem("MicroGeneratorLegendary") 40 | Inventory.AddItem("SecondHeart") 41 | Inventory.AddItem("StaminaRegenBoosterLegendary") 42 | 43 | -- Cyberdeck OS 44 | Inventory.AddItem("ArasakaLegendaryMKIV") 45 | Inventory.AddItem("BerserkC2MK4") 46 | Inventory.AddItem("BerserkC3MK4") 47 | Inventory.AddItem("RavenLegendaryMKIV") 48 | Inventory.AddItem("SandevistanC2MK4") 49 | Inventory.AddItem("SandevistanC3MK4") 50 | Inventory.AddItem("StephensonLegendaryMKIV") 51 | Inventory.AddItem("TetratronicRipplerLegendaryMKIV") 52 | 53 | -- Frontal Cortex 54 | Inventory.AddItem("AntiVirus") 55 | Inventory.AddItem("BrainCapacityBoosterLegendary") 56 | Inventory.AddItem("HealOnKillLegendary") 57 | Inventory.AddItem("ImprovedPerceptionLegendary") 58 | Inventory.AddItem("LimbicSystemEnhancementLegendary") 59 | Inventory.AddItem("MemoryReplenishmentLegendary") 60 | Inventory.AddItem("RoboticCoreLegendary") 61 | 62 | -- Hands 63 | Inventory.AddItem("PowerGripLegendary") 64 | Inventory.AddItem("SmartLinkLegendary") 65 | 66 | -- Immune System 67 | Inventory.AddItem("ElectroshockMechanismLegendary") 68 | Inventory.AddItem("ResistancesBoosterLegendary") 69 | 70 | -- Integumentary System 71 | Inventory.AddItem("OpticalCamoLegendary") 72 | Inventory.AddItem("SubdermalArmorLegendary") 73 | 74 | -- Nervous System 75 | Inventory.AddItem("KerenzikovLegendary") 76 | Inventory.AddItem("NeoFiberLegendary") 77 | Inventory.AddItem("PainReductor") 78 | Inventory.AddItem("ReflexRecorderLegendary") 79 | Inventory.AddItem("SynapticAcceleratorLegendary") 80 | 81 | -- Quickhack Items (not recipes) 82 | Inventory.AddItem("BlindLvl4Program") 83 | Inventory.AddItem("BrainMeltLvl4Program") 84 | Inventory.AddItem("CommsNoiseLvl4Program") 85 | Inventory.AddItem("ContagionLvl4Program") 86 | Inventory.AddItem("EMPOverloadLvl4Program") 87 | Inventory.AddItem("GrenadeExplodeLvl4Program") 88 | Inventory.AddItem("LocomotionMalfunctionLvl4Program") 89 | Inventory.AddItem("MadnessLvl4Program") 90 | Inventory.AddItem("OverheatLvl4Program") 91 | Inventory.AddItem("PingLvl4Program") 92 | Inventory.AddItem("SuicideLvl4Program") 93 | Inventory.AddItem("SystemCollapseLvl4Program") 94 | Inventory.AddItem("WeaponMalfunctionLvl4Program") 95 | 96 | -- Skeleton 97 | Inventory.AddItem("CyberRotorsLegendary") 98 | Inventory.AddItem("EndoskeletonLegendary") 99 | Inventory.AddItem("EnhancedTissueLegendary") 100 | 101 | Utilities.FinishProtocol(moduleName) 102 | end 103 | 104 | function Cyberware.AddEpicCW() 105 | local moduleName = "Add All Epic Cyberware Items" 106 | 107 | -- All Epic Cyberware Items 108 | -- Arms 109 | Inventory.AddItem("MantisBladesEpic") 110 | Inventory.AddItem("NanoWiresEpic") 111 | Inventory.AddItem("ProjectileLauncherEpic") 112 | Inventory.AddItem("StrongArmsEpic") 113 | 114 | -- Circulatory System 115 | Inventory.AddItem("BioConductorsEpic") 116 | Inventory.AddItem("BloodPumpEpic") 117 | Inventory.AddItem("DischargeConnectorEpic") 118 | Inventory.AddItem("EnhancedBloodVesselsEpic") 119 | Inventory.AddItem("HealthMonitorEpic") 120 | Inventory.AddItem("IronLungsEpic") 121 | Inventory.AddItem("MicroGeneratorEpic") 122 | Inventory.AddItem("StaminaRegenBoosterEpic") 123 | 124 | -- Cyberdeck OS 125 | Inventory.AddItem("ArasakaEpicMKIII") 126 | Inventory.AddItem("BerserkC1MK3") 127 | Inventory.AddItem("BerserkC2MK3") 128 | Inventory.AddItem("BiotechEpicMKIII") 129 | Inventory.AddItem("RavenEpicMKIII") 130 | Inventory.AddItem("SandevistanC1MK3") 131 | Inventory.AddItem("SandevistanC2MK3") 132 | Inventory.AddItem("StephensonEpicMKIII") 133 | Inventory.AddItem("TetratronicEpicMKIII") 134 | 135 | -- Frontal Cortex 136 | Inventory.AddItem("BrainCapacityBoosterEpic") 137 | Inventory.AddItem("HealOnKillEpic") 138 | Inventory.AddItem("ImprovedPerceptionEpic") 139 | Inventory.AddItem("MemoryBoostEpic") 140 | Inventory.AddItem("MemoryReplenishmentEpic") 141 | Inventory.AddItem("RoboticCoreEpic") 142 | 143 | -- Hands 144 | Inventory.AddItem("PowerGripEpic") 145 | Inventory.AddItem("SmartLinkEpic") 146 | 147 | -- Immune System 148 | Inventory.AddItem("ElectroshockMechanismEpic") 149 | Inventory.AddItem("ResistancesBoosterEpic") 150 | Inventory.AddItem("ReverseMetabolicEnhancer") 151 | Inventory.AddItem("ReversePowerInductor") 152 | 153 | -- Integumentary System 154 | Inventory.AddItem("HeatUsingBooster") 155 | Inventory.AddItem("OpticalCamoEpic") 156 | Inventory.AddItem("SubdermalArmorEpic") 157 | 158 | -- Legs 159 | Inventory.AddItem("CatPaws") 160 | Inventory.AddItem("ReinforcedMusclesEpic") 161 | 162 | -- Nervous System 163 | Inventory.AddItem("ImprovedReactionEpic") 164 | Inventory.AddItem("KerenzikovEpic") 165 | Inventory.AddItem("NeoFiberEpic") 166 | Inventory.AddItem("SynapticAcceleratorEpic") 167 | 168 | -- Ocular System 169 | Inventory.AddItem("KiroshiOpticsEpic") 170 | 171 | -- Quickhack Items (not recipes) 172 | Inventory.AddItem("BlindLvl3Program") 173 | Inventory.AddItem("BrainMeltLvl3Program") 174 | Inventory.AddItem("CommsCallInLvl3Program") 175 | Inventory.AddItem("CommsNoiseLvl3Program") 176 | Inventory.AddItem("ContagionLvl3Program") 177 | Inventory.AddItem("DisableCyberwareLvl3Program") 178 | Inventory.AddItem("EMPOverloadLvl3Program") 179 | Inventory.AddItem("GrenadeExplodeLvl3Program") 180 | Inventory.AddItem("LocomotionMalfunctionLvl3Program") 181 | Inventory.AddItem("MadnessLvl3Program") 182 | Inventory.AddItem("MemoryWipeLvl3Program") 183 | Inventory.AddItem("OverheatLvl3Program") 184 | Inventory.AddItem("PingLvl3Program") 185 | Inventory.AddItem("SuicideLvl3Program") 186 | Inventory.AddItem("SystemCollapseLvl3Program") 187 | Inventory.AddItem("WeaponMalfunctionLvl3Program") 188 | Inventory.AddItem("WhistleLvl3Program") 189 | 190 | -- Skeleton 191 | Inventory.AddItem("CyberRotorsEpic") 192 | Inventory.AddItem("DenseMarrowEpic") 193 | Inventory.AddItem("EndoskeletonEpic") 194 | Inventory.AddItem("EnhancedTissueEpic") 195 | Inventory.AddItem("JointLockEpic") 196 | Inventory.AddItem("MicroVibrationsGeneratorEpic") 197 | 198 | Utilities.FinishProtocol(moduleName) 199 | end 200 | 201 | function Cyberware.AddRareCW() 202 | local moduleName = "Add All Rare Cyberware Items" 203 | 204 | -- Arms 205 | Inventory.AddItem("MantisBlades") 206 | Inventory.AddItem("NanoWires") 207 | Inventory.AddItem("ProjectileLauncher") 208 | Inventory.AddItem("StrongArms") 209 | 210 | -- Circulatory System 211 | Inventory.AddItem("BioConductorsRare") 212 | Inventory.AddItem("BloodPumpRare") 213 | Inventory.AddItem("DischargeConnectorRare") 214 | Inventory.AddItem("EnhancedBloodVesselsRare") 215 | Inventory.AddItem("HealthMonitorRare") 216 | Inventory.AddItem("IronLungsRare") 217 | Inventory.AddItem("MicroGeneratorRare") 218 | Inventory.AddItem("StaminaRegenBoosterRare") 219 | 220 | -- Cyberdeck OS 221 | Inventory.AddItem("BerserkC1MK2") 222 | Inventory.AddItem("BerserkC2MK2") 223 | Inventory.AddItem("BioDyneRareMKII") 224 | Inventory.AddItem("BiotechRareMKII") 225 | Inventory.AddItem("SandevistanC1MK2") 226 | Inventory.AddItem("SandevistanC2MK2") 227 | Inventory.AddItem("SeachoRareMKII") 228 | Inventory.AddItem("StephensonRareMKII") 229 | Inventory.AddItem("TetratronicRareMKII") 230 | 231 | -- Frontal Cortex 232 | Inventory.AddItem("BrainCapacityBoosterRare") 233 | Inventory.AddItem("FastAccessMemoryRare") 234 | Inventory.AddItem("LimbicSystemEnhancementRare") 235 | Inventory.AddItem("MemoryBoostRare") 236 | Inventory.AddItem("RoboticCoreRare") 237 | 238 | -- Hands 239 | Inventory.AddItem("PowerGripRare") 240 | Inventory.AddItem("SmartLinkRare") 241 | 242 | -- Immune System 243 | Inventory.AddItem("ToxinCleanser") 244 | 245 | -- Integumentary System 246 | Inventory.AddItem("FireproofSkin") 247 | Inventory.AddItem("GroundingPlating") 248 | Inventory.AddItem("MetalCoveredSkin") 249 | Inventory.AddItem("OpticalCamoRare") 250 | Inventory.AddItem("SubdermalArmorRare") 251 | 252 | -- Legs 253 | Inventory.AddItem("BoostedTendonsRare") 254 | Inventory.AddItem("ReinforcedMusclesRare") 255 | 256 | -- Nervous System 257 | Inventory.AddItem("ImprovedReactionRare") 258 | Inventory.AddItem("KerenzikovRare") 259 | Inventory.AddItem("NeoFiberRare") 260 | Inventory.AddItem("NervousSystemDischarge") 261 | Inventory.AddItem("ReflexRecorderRare") 262 | Inventory.AddItem("SynapticAcceleratorRare") 263 | 264 | -- Ocular System 265 | Inventory.AddItem("KiroshiOpticsRare") 266 | 267 | -- Quickhack Items (not recipes) 268 | Inventory.AddItem("BlindLvl2Program") 269 | Inventory.AddItem("BrainMeltLvl2Program") 270 | Inventory.AddItem("CommsNoiseLvl2Program") 271 | Inventory.AddItem("ContagionLvl2Program") 272 | Inventory.AddItem("DisableCyberwareLvl2Program") 273 | Inventory.AddItem("EMPOverloadLvl2Program") 274 | Inventory.AddItem("LocomotionMalfunctionLvl2Program") 275 | Inventory.AddItem("MemoryWipeLvl2Program") 276 | Inventory.AddItem("OverheatLvl2Program") 277 | Inventory.AddItem("PingLvl2Program") 278 | Inventory.AddItem("WeaponMalfunctionLvl2Program") 279 | Inventory.AddItem("WhistleLvl2Program") 280 | 281 | -- Skeleton 282 | Inventory.AddItem("CyberRotorsRare") 283 | Inventory.AddItem("DenseMarrowRare") 284 | Inventory.AddItem("EndoskeletonRare") 285 | Inventory.AddItem("EnhancedTissueRare") 286 | Inventory.AddItem("JointLockRare") 287 | Inventory.AddItem("MicroVibrationsGeneratorRare") 288 | Inventory.AddItem("TitaniumInfusedBonesRare") 289 | 290 | Utilities.FinishProtocol(moduleName) 291 | end 292 | 293 | function Cyberware.AddUncommonCW() 294 | local moduleName = "Add All Uncommon Cyberware Items" 295 | 296 | -- All Uncommon Cyberware Items 297 | -- Circulatory System 298 | Inventory.AddItem("BloodPumpUncommon") 299 | Inventory.AddItem("EnhancedBloodVesselsUncommon") 300 | Inventory.AddItem("HealthMonitorUncommon") 301 | Inventory.AddItem("IronLungsUncommon") 302 | Inventory.AddItem("MicroGeneratorUncommon") 303 | Inventory.AddItem("StaminaRegenBoosterUncommon") 304 | Inventory.AddItem("TyrosineInjector") 305 | 306 | -- Cyberdeck OS 307 | Inventory.AddItem("BerserkC1MK1") 308 | Inventory.AddItem("BerserkC2MK1") 309 | Inventory.AddItem("BioDyneUncommonMKI") 310 | Inventory.AddItem("BiotechUncommonMKI") 311 | Inventory.AddItem("SandevistanC1MK1") 312 | Inventory.AddItem("SandevistanC2MK1") 313 | Inventory.AddItem("SeachoUncommonMKI") 314 | Inventory.AddItem("TetratronicUncommonMKI") 315 | 316 | -- Frontal Cortex 317 | Inventory.AddItem("FastAccessMemoryUncommon") 318 | Inventory.AddItem("HealOnKillUncommon") 319 | Inventory.AddItem("ImprovedPerceptionUncommon") 320 | Inventory.AddItem("MemoryBoostUncommon") 321 | Inventory.AddItem("RoboticCoreUncommon") 322 | 323 | -- Immune System 324 | Inventory.AddItem("ElectroshockMechanismUncommon") 325 | Inventory.AddItem("ResistancesBoosterUncommon") 326 | 327 | -- Integumentary System 328 | Inventory.AddItem("SubdermalArmorUncommon") 329 | 330 | -- Nervous System 331 | Inventory.AddItem("ImprovedReactionUncommon") 332 | Inventory.AddItem("KerenzikovUncommon") 333 | Inventory.AddItem("NeoFiberUncommon") 334 | Inventory.AddItem("ReflexRecorderUncommon") 335 | Inventory.AddItem("SynapticAcceleratorUncommon") 336 | 337 | -- Quickhack Items (not recipes) 338 | Inventory.AddItem("BlindProgram") 339 | Inventory.AddItem("CommsCallInProgram") 340 | Inventory.AddItem("CommsNoiseProgram") 341 | Inventory.AddItem("ContagionProgram") 342 | Inventory.AddItem("DisableCyberwareProgram") 343 | Inventory.AddItem("EMPOverloadProgram") 344 | Inventory.AddItem("LocomotionMalfunctionProgram") 345 | Inventory.AddItem("OverheatProgram") 346 | Inventory.AddItem("PingProgram") 347 | Inventory.AddItem("WeaponMalfunctionProgram") 348 | Inventory.AddItem("WhistleProgram") 349 | 350 | -- Skeleton 351 | Inventory.AddItem("CyberRotorsUncommon") 352 | Inventory.AddItem("DenseMarrowUncommon") 353 | Inventory.AddItem("EndoskeletonUncommon") 354 | Inventory.AddItem("EnhancedTissueUncommon") 355 | Inventory.AddItem("MicroVibrationsGeneratorUncommon") 356 | Inventory.AddItem("TitaniumInfusedBonesUncommon") 357 | 358 | Utilities.FinishProtocol(moduleName) 359 | end 360 | 361 | function Cyberware.AddCommonCW() 362 | local moduleName = "Add All Common Cyberware Items" 363 | 364 | -- Circulatory System 365 | Inventory.AddItem("BloodPumpCommon") 366 | Inventory.AddItem("EnhancedBloodVesselsCommon") 367 | Inventory.AddItem("HealthMonitorCommon") 368 | Inventory.AddItem("IronLungsCommon") 369 | Inventory.AddItem("MicroGeneratorCommon") 370 | Inventory.AddItem("StaminaRegenBoosterCommon") 371 | 372 | -- Cyberdeck OS 373 | Inventory.AddItem("FuyutsuiCommonMKI") 374 | Inventory.AddItem("MilitechParaline") 375 | 376 | -- Frontal Cortex 377 | Inventory.AddItem("FastAccessMemoryCommon") 378 | Inventory.AddItem("HealOnKillCommon") 379 | Inventory.AddItem("ImprovedPerceptionCommon") 380 | Inventory.AddItem("LimbicSystemEnhancementCommon") 381 | Inventory.AddItem("MemoryBoostCommon") 382 | Inventory.AddItem("RoboticCoreCommon") 383 | 384 | -- Hands 385 | -- "Tattoo: Together Forever" 386 | Game.GetTransactionSystem():GiveItem(Game.GetPlayer(), 387 | GetSingleton("gameItemID"):FromTDBID(TweakDBID.new(0x15138755, 0x16)), 1) 388 | 389 | -- "Tattoo: Tyger Claws Dermal Imprint" 390 | Game.GetTransactionSystem():GiveItem(Game.GetPlayer(), 391 | GetSingleton("gameItemID"):FromTDBID(TweakDBID.new(0x18FD8A52, 0x12)), 1) 392 | 393 | -- "Tattoo: Johnny's Special" 394 | Game.GetTransactionSystem():GiveItem(Game.GetPlayer(), 395 | GetSingleton("gameItemID"):FromTDBID(TweakDBID.new(0xA93E60FD, 0x12)), 1) 396 | 397 | -- Immune System 398 | Inventory.AddItem("ElectroshockMechanismCommon") 399 | Inventory.AddItem("ResistancesBoosterCommon") 400 | 401 | -- Integumentary System 402 | Inventory.AddItem("SubdermalArmorCommon") 403 | 404 | -- Nervous System 405 | Inventory.AddItem("KerenzikovCommon") 406 | Inventory.AddItem("NeoFiberCommon") 407 | Inventory.AddItem("ReflexRecorderCommon") 408 | Inventory.AddItem("SynapticAcceleratorCommon") 409 | 410 | -- Ocular System 411 | Inventory.AddItem("KiroshiOptics") 412 | 413 | -- Skeleton 414 | Inventory.AddItem("CyberRotorsCommon") 415 | Inventory.AddItem("EndoskeletonCommon") 416 | Inventory.AddItem("EnhancedTissueCommon") 417 | Inventory.AddItem("TitaniumInfusedBonesCommon") 418 | 419 | Utilities.FinishProtocol(moduleName) 420 | end 421 | 422 | function Cyberware.AddAllCW() 423 | local moduleName = "Add All Cyberware Items" 424 | 425 | Cyberware.AddIconicCW() 426 | Cyberware.AddLegendaryCW() 427 | Cyberware.AddEpicCW() 428 | Cyberware.AddRareCW() 429 | Cyberware.AddUncommonCW() 430 | Cyberware.AddCommonCW() 431 | 432 | 433 | Utilities.FinishProtocol(moduleName) 434 | end 435 | 436 | return Cyberware 437 | -------------------------------------------------------------------------------- /mods/braindance_protocol/cheats/facts.lua: -------------------------------------------------------------------------------- 1 | local Facts = {} 2 | 3 | local Utilities = require("utility") 4 | local Inventory = require("inventory") 5 | 6 | -- Some Skippy Functions! 7 | function Facts.SetSkippyToSCK() 8 | local moduleName = "Skippy Mode: Stone Cold Killer" 9 | 10 | -- This will set the Skippy gun to "Stone Cold Killer" (headshots) 11 | Game.SetDebugFact("mq007_skippy_aim_at_head", 1) 12 | 13 | Utilities.FinishProtocol(moduleName) 14 | end 15 | 16 | function Facts.SetSkippyToPLP() 17 | local moduleName = "Skippy Mode: Puppy-Loving Pacifist" 18 | 19 | -- This will set the Skippy gun to "Puppy-Loving Pacifist" (knee-shots) 20 | Game.SetDebugFact("mq007_skippy_aim_at_head", 0) 21 | 22 | Utilities.FinishProtocol(moduleName) 23 | end 24 | 25 | function Facts.SetSkippyToFriendly() 26 | local moduleName = "Skippy Is Now Friendly" 27 | 28 | -- This will set the Skippy gun to be friendly 29 | Game.SetDebugFact("mq007_skippy_goes_emo", 0) 30 | 31 | Utilities.FinishProtocol(moduleName) 32 | end 33 | 34 | function Facts.SetSkippyToHostile() 35 | local moduleName = "Skippy Is Now Hostile" 36 | 37 | -- This will set the Skippy gun to be hostile 38 | Game.SetDebugFact("mq007_skippy_goes_emo", 1) 39 | 40 | Utilities.FinishProtocol(moduleName) 41 | end 42 | 43 | 44 | -- Jackie Facts 45 | function Facts.SendJackieToViktor() 46 | local moduleName = "You Sent Jackie To Viktor" 47 | 48 | Game.SetDebugFact("q005_jackie_stay_notell", 0) 49 | Game.SetDebugFact("q005_jackie_to_mama", 0) 50 | Game.SetDebugFact("q005_jackie_to_hospital", 1) 51 | 52 | Utilities.FinishProtocol(moduleName) 53 | end 54 | 55 | function Facts.SendJackieToWelles() 56 | local moduleName = "You Sent Jackie To Mama Welles" 57 | 58 | Game.SetDebugFact("q005_jackie_stay_notell", 0) 59 | Game.SetDebugFact("q005_jackie_to_hospital", 0) 60 | Game.SetDebugFact("q005_jackie_to_mama", 1) 61 | 62 | Utilities.FinishProtocol(moduleName) 63 | end 64 | 65 | function Facts.LeftJackieInCar() 66 | local moduleName = "You Left Jackie In The Car" 67 | 68 | Game.SetDebugFact("q005_jackie_to_hospital", 0) 69 | Game.SetDebugFact("q005_jackie_to_mama", 0) 70 | Game.SetDebugFact("q005_jackie_stay_notell", 1) 71 | 72 | Utilities.FinishProtocol(moduleName) 73 | end 74 | 75 | -- Takemura Facts 76 | function Facts.SetGoroAlive() 77 | local moduleName = "Takemura Is Now Alive" 78 | 79 | Game.SetDebugFact("q112_takemura_dead", 0) 80 | 81 | Utilities.FinishProtocol(moduleName) 82 | end 83 | 84 | function Facts.SetGoroDead() 85 | local moduleName = "Takemura Is Now Dead" 86 | 87 | Game.SetDebugFact("q112_takemura_dead", 1) 88 | 89 | Utilities.FinishProtocol(moduleName) 90 | end 91 | 92 | -- Dr. Fingers Facts 93 | function Facts.SetFingersToFriendly() 94 | local moduleName = "Fingers M.D. Is Now Friendly And Alive" 95 | 96 | Game.SetDebugFact("q105_fingers_dead", 0) 97 | Game.SetDebugFact("q105_fingers_beaten", 0) 98 | 99 | Utilities.FinishProtocol(moduleName) 100 | end 101 | 102 | -- Romance Facts 103 | -- Apparently these need to be set, after each save reload. 104 | -- Haven't tested that 105 | 106 | function Facts.SetJudyRomance() 107 | local moduleName = "Judy Is Now Romanceable" 108 | 109 | Game.GetQuestsSystem():SetFactStr("judy_romanceable", 1) 110 | Game.SetDebugFact("judy_romanceable", 1) 111 | 112 | Utilities.FinishProtocol(moduleName) 113 | end 114 | 115 | function Facts.SetRiverRomance() 116 | local moduleName = "River Is Now Romanceable" 117 | 118 | Game.GetQuestsSystem():SetFactStr("river_romanceable", 1) 119 | Game.SetDebugFact("river_romanceable", 1) 120 | 121 | Utilities.FinishProtocol(moduleName) 122 | end 123 | 124 | function Facts.SetPanamRomance() 125 | local moduleName = "Panam Is Now Romanceable" 126 | 127 | Game.GetQuestsSystem():SetFactStr("panam_romanceable", 1) 128 | Game.SetDebugFact("panam_romanceable", 1) 129 | 130 | Utilities.FinishProtocol(moduleName) 131 | end 132 | 133 | function Facts.SetKerryRomance() 134 | local moduleName = "Kerry Is Now Romanceable" 135 | 136 | Game.GetQuestsSystem():SetFactStr("kerry_romanceable", 1) 137 | Game.SetDebugFact("kerry_romanceable", 1) 138 | 139 | Utilities.FinishProtocol(moduleName) 140 | end 141 | 142 | -- Enable Johnny's Secret Ending 143 | function Facts.SetJohnnyAsFriend() 144 | local moduleName = "You Now Unlocked The Secret Ending" 145 | 146 | Game.SetDebugFact("sq032_johnny_friend", 1) 147 | 148 | Utilities.FinishProtocol(moduleName) 149 | end 150 | 151 | return Facts 152 | -------------------------------------------------------------------------------- /mods/braindance_protocol/cheats/itemsets.lua: -------------------------------------------------------------------------------- 1 | local ItemSets = {} 2 | 3 | local Utilities = require("utility") 4 | local Inventory = require("inventory") 5 | 6 | 7 | function ItemSets.AddSetCorpo() 8 | local moduleName = "Add Corpo Item Set" 9 | 10 | -- Corpo Set 11 | Inventory.AddItem("Corporate_01_Set_FormalJacket") 12 | Inventory.AddItem("Corporate_01_Set_FormalShirt") 13 | Inventory.AddItem("Corporate_01_Set_FormalShoes") 14 | Inventory.AddItem("Corporate_01_Set_Glasses") 15 | Inventory.AddItem("Corporate_01_Set_Pants") 16 | 17 | Utilities.FinishProtocol(moduleName) 18 | end 19 | 20 | function ItemSets.AddSetFixer() 21 | local moduleName = "Add Fixer Item Set" 22 | 23 | -- Fixer Set 24 | Inventory.AddItem("Fixer_01_Set_Coat") 25 | Inventory.AddItem("Fixer_01_Set_FormalShoes") 26 | Inventory.AddItem("Fixer_01_Set_Glasses") 27 | Inventory.AddItem("Fixer_01_Set_Pants") 28 | Inventory.AddItem("Fixer_01_Set_TShirt") 29 | 30 | Utilities.FinishProtocol(moduleName) 31 | end 32 | 33 | function ItemSets.AddSetMaxTac() 34 | local moduleName = "Add MaxTac Item Set" 35 | 36 | -- MaxTac Set 37 | Inventory.AddItem("SQ030_MaxTac_Chest") 38 | Inventory.AddItem("SQ030_MaxTac_Helmet") 39 | Inventory.AddItem("SQ030_MaxTac_Pants") 40 | 41 | Utilities.FinishProtocol(moduleName) 42 | end 43 | 44 | function ItemSets.AddSetMedia() 45 | local moduleName = "Add Media Item Set" 46 | 47 | -- Media Set 48 | Inventory.AddItem("Media_01_Set_Cap") 49 | Inventory.AddItem("Media_01_Set_Pants") 50 | Inventory.AddItem("Media_01_Set_Shirt") 51 | Inventory.AddItem("Media_01_Set_Shoes") 52 | Inventory.AddItem("Media_01_Set_Tech") 53 | Inventory.AddItem("Media_01_Set_Vest") 54 | 55 | Utilities.FinishProtocol(moduleName) 56 | end 57 | 58 | function ItemSets.AddSetNetrunner() 59 | local moduleName = "Add Netrunner Item Set" 60 | 61 | -- Netrunner Set 62 | Inventory.AddItem("Netrunner_01_Set_Jumpsuit") 63 | Inventory.AddItem("Netrunner_01_Set_Pants") 64 | Inventory.AddItem("Netrunner_01_Set_Shoes") 65 | Inventory.AddItem("Netrunner_01_Set_Visor") 66 | 67 | Utilities.FinishProtocol(moduleName) 68 | end 69 | 70 | function ItemSets.AddSetNomad() 71 | local moduleName = "Add Nomad Item Set" 72 | 73 | -- Nomad Set 74 | Inventory.AddItem("Nomad_01_Set_Boots") 75 | Inventory.AddItem("Nomad_01_Set_Jacket") 76 | Inventory.AddItem("Nomad_01_Set_Mask") 77 | Inventory.AddItem("Nomad_01_Set_Pants") 78 | Inventory.AddItem("Nomad_01_Set_TShirt") 79 | Inventory.AddItem("Q114_Aldecaldo_Jacket") 80 | 81 | Utilities.FinishProtocol(moduleName) 82 | end 83 | 84 | function ItemSets.AddSetPolice() 85 | local moduleName = "Add Police Item Set" 86 | 87 | -- Police Set 88 | Inventory.AddItem("Cop_01_Set_Boots") 89 | Inventory.AddItem("Cop_01_Set_Glasses") 90 | Inventory.AddItem("Cop_01_Set_Jacket") 91 | Inventory.AddItem("Cop_01_Set_Pants") 92 | Inventory.AddItem("Helmet_02_basic_01") 93 | 94 | Utilities.FinishProtocol(moduleName) 95 | end 96 | 97 | function ItemSets.AddSetRocker() 98 | local moduleName = "Add Rocker Item Set" 99 | 100 | -- Rocker Set 101 | Inventory.AddItem("Rockerboy_01_Set_Boots") 102 | Inventory.AddItem("Rockerboy_01_Set_Glasses") 103 | Inventory.AddItem("Rockerboy_01_Set_Jacket") 104 | Inventory.AddItem("Rockerboy_01_Set_Pants") 105 | Inventory.AddItem("Rockerboy_01_Set_TShirt") 106 | 107 | Utilities.FinishProtocol(moduleName) 108 | end 109 | 110 | function ItemSets.AddSetSolo() 111 | local moduleName = "Add Solo Item Set" 112 | 113 | -- Solo Set 114 | Inventory.AddItem("Solo_01_Set_Boots") 115 | Inventory.AddItem("Solo_01_Set_Jacket") 116 | Inventory.AddItem("Solo_01_Set_Pants") 117 | Inventory.AddItem("Solo_01_Set_TShirt") 118 | Inventory.AddItem("Solo_01_Set_Visor") 119 | 120 | Utilities.FinishProtocol(moduleName) 121 | end 122 | 123 | function ItemSets.AddSetTechie() 124 | local moduleName = "Add Techie Item Set" 125 | 126 | -- Techie Set 127 | Inventory.AddItem("Techie_01_Set_Cap") 128 | Inventory.AddItem("Techie_01_Set_Pants") 129 | Inventory.AddItem("Techie_01_Set_Shoes") 130 | Inventory.AddItem("Techie_01_Set_Tech") 131 | Inventory.AddItem("Techie_01_Set_TShirt") 132 | Inventory.AddItem("Techie_01_Set_Vest") 133 | 134 | Utilities.FinishProtocol(moduleName) 135 | end 136 | 137 | function ItemSets.AddSetVCorpo() 138 | local moduleName = "Add V's Corpo Set" 139 | 140 | -- V's Corpo Set 141 | Inventory.AddItem("Q000_Corpo_FormalJacket") 142 | Inventory.AddItem("Q000_Corpo_FormalPants") 143 | Inventory.AddItem("Q000_Corpo_FormalShoes") 144 | Inventory.AddItem("Q000_half_Corpo") 145 | 146 | Utilities.FinishProtocol(moduleName) 147 | end 148 | 149 | function ItemSets.AddSetVNomad() 150 | local moduleName = "Add V's Nomad Set" 151 | 152 | -- V's Nomad Set 153 | Inventory.AddItem("Q000_half_Nomad") 154 | Inventory.AddItem("Q000_Nomad_Boots") 155 | Inventory.AddItem("Q000_Nomad_noPatch_Vest") 156 | Inventory.AddItem("Q000_Nomad_Pants") 157 | Inventory.AddItem("Q000_Nomad_TShirt") 158 | Inventory.AddItem("Q000_Nomad_Vest") 159 | 160 | Utilities.FinishProtocol(moduleName) 161 | end 162 | 163 | function ItemSets.AddSetVStreetkid() 164 | local moduleName = "Add V's Streetkid Set" 165 | 166 | -- V's Streetkid Set 167 | Inventory.AddItem("Q000_half_StreetKid") 168 | Inventory.AddItem("Q000_StreetKid_Pants") 169 | Inventory.AddItem("Q000_StreetKid_Shoes") 170 | Inventory.AddItem("Q000_StreetKid_TShirt") 171 | 172 | Utilities.FinishProtocol(moduleName) 173 | end 174 | 175 | function ItemSets.AddSetVEpilogue() 176 | local moduleName = "Add V's Epilogue Set" 177 | 178 | -- Epilogue Gear 179 | Inventory.AddItem("Q203_Epilogue_Boots") 180 | Inventory.AddItem("Q203_Epilogue_Glasses") 181 | Inventory.AddItem("Q203_Epilogue_Pants") 182 | Inventory.AddItem("Q203_Epilogue_TShirt") 183 | 184 | Utilities.FinishProtocol(moduleName) 185 | end 186 | 187 | function ItemSets.AddSetVMisc() 188 | local moduleName = "Add V's Misc Set" 189 | 190 | -- Rest of V's Gear 191 | Inventory.AddItem("Q001_Pants") 192 | Inventory.AddItem("Q001_Shoes") 193 | Inventory.AddItem("Q001_TShirt") 194 | 195 | Utilities.FinishProtocol(moduleName) 196 | end 197 | 198 | function ItemSets.AddAllSets() 199 | local moduleName = "Add All Item Sets" 200 | 201 | ItemSets.AddSetCorpo() 202 | ItemSets.AddSetFixer() 203 | ItemSets.AddSetMaxTac() 204 | ItemSets.AddSetMedia() 205 | ItemSets.AddSetNetrunner() 206 | ItemSets.AddSetNomad() 207 | ItemSets.AddSetPolice() 208 | ItemSets.AddSetRocker() 209 | ItemSets.AddSetSolo() 210 | ItemSets.AddSetTechie() 211 | ItemSets.AddSetVCorpo() 212 | ItemSets.AddSetVNomad() 213 | ItemSets.AddSetVStreetkid() 214 | ItemSets.AddSetVEpilogue() 215 | ItemSets.AddSetVMisc() 216 | 217 | Utilities.FinishProtocol(moduleName) 218 | end 219 | 220 | return ItemSets 221 | -------------------------------------------------------------------------------- /mods/braindance_protocol/cheats/johnny.lua: -------------------------------------------------------------------------------- 1 | local Johnny = {} 2 | 3 | local Utilities = require("utility") 4 | local Inventory = require("inventory") 5 | 6 | function Johnny.AddItems() 7 | local moduleName = "Add Johnny's Items" 8 | 9 | Inventory.AddItem("Preset_Silverhand_3516") 10 | Inventory.AddItem("Q005_Johnny_Glasses") 11 | Inventory.AddItem("Q005_Johnny_Glasses") 12 | Inventory.AddItem("Q204_samurai_jacket") 13 | Inventory.AddItem("Q005_Johnny_Shirt") 14 | Inventory.AddItem("Q005_Johnny_Pants") 15 | Inventory.AddItem("Q005_Johnny_Shoes") 16 | Inventory.AddItem("PlayerSilverhandArm") 17 | 18 | vs = Game.GetVehicleSystem() 19 | vs:EnablePlayerVehicle("Vehicle.v_sport2_porsche_911turbo_player", true, false) 20 | 21 | Utilities.FinishProtocol(moduleName) 22 | end 23 | 24 | return Johnny 25 | -------------------------------------------------------------------------------- /mods/braindance_protocol/cheats/legend.lua: -------------------------------------------------------------------------------- 1 | local Legend = {} 2 | 3 | local Utilities = require("utility") 4 | 5 | function Legend.UpgradeWeapons() 6 | local moduleName = "All Equipped Weapons Are Now Legendary With Max Stats" 7 | 8 | player = Game.GetPlayer() 9 | ssc = Game.GetScriptableSystemsContainer() 10 | ts = Game.GetTransactionSystem() 11 | ss = Game.GetStatsSystem() 12 | es = ssc:Get(CName.new('EquipmentSystem')) 13 | espd = es:GetPlayerData(player) 14 | espd['GetItemInEquipSlot2'] = espd['GetItemInEquipSlot;gamedataEquipmentAreaInt32'] 15 | playerPLValue = ss:GetStatValue(player:GetEntityID(), 'PowerLevel') 16 | 17 | local slots = { 18 | Weapon = 3 19 | } 20 | 21 | for k,v in pairs(slots) do 22 | for i=1,v do 23 | print('Upgrading item in ' .. k .. ' slot ' .. (i - 1)) 24 | itemid = espd:GetItemInEquipSlot2(k, i - 1) 25 | if itemid.tdbid.hash ~= 0 then 26 | itemdata = ts:GetItemData(player, itemid) 27 | statObj = itemdata:GetStatsObjectID() end 28 | itemLevel = ss:GetStatValue(statObj, 'ItemLevel') 29 | powerLevel = ss:GetStatValue(statObj, 'PowerLevel') 30 | addItemLevel = 0 if itemLevel < math.floor(playerPLValue) * 10 then 31 | addItemLevel = math.floor(playerPLValue - powerLevel) * 10 + 5 32 | levelMod = Game['gameRPGManager::CreateStatModifier;gamedataStatTypegameStatModifierTypeFloat']('ItemLevel', 'Additive', addItemLevel) 33 | ss:AddSavedModifier(statObj, levelMod) end 34 | itemQuality = ss:GetStatValue(statObj, 'Quality') 35 | newItemQuality = itemQuality if itemQuality < 5 then 36 | newItemQuality = 4 ss:RemoveAllModifiers(statObj, 'Quality', true) 37 | qualityMod = Game['gameRPGManager::CreateStatModifier;gamedataStatTypegameStatModifierTypeFloat']('Quality', 'Additive', newItemQuality) 38 | ss:AddSavedModifier(statObj, qualityMod) 39 | end 40 | end 41 | end 42 | 43 | Utilities.FinishProtocol(moduleName) 44 | end 45 | 46 | 47 | function Legend.UpgradeArmor() 48 | local moduleName = "All Equipped Armor Are Now Legendary With Max Stats" 49 | 50 | player = Game.GetPlayer() 51 | ssc = Game.GetScriptableSystemsContainer() 52 | ts = Game.GetTransactionSystem() 53 | ss = Game.GetStatsSystem() 54 | es = ssc:Get(CName.new('EquipmentSystem')) 55 | espd = es:GetPlayerData(player) 56 | espd['GetItemInEquipSlot2'] = espd['GetItemInEquipSlot;gamedataEquipmentAreaInt32'] 57 | playerPLValue = ss:GetStatValue(player:GetEntityID(), 'PowerLevel') 58 | 59 | local slots = { 60 | Head = 1, 61 | Face = 1, 62 | InnerChest = 1, 63 | OuterChest = 1, 64 | Feet = 1, 65 | Legs = 1, 66 | Outfit = 1 67 | } 68 | 69 | for k,v in pairs(slots) do 70 | for i=1,v do 71 | print('Upgrading item in ' .. k .. ' slot ' .. (i - 1)) 72 | itemid = espd:GetItemInEquipSlot2(k, i - 1) 73 | if itemid.tdbid.hash ~= 0 then 74 | itemdata = ts:GetItemData(player, itemid) 75 | statObj = itemdata:GetStatsObjectID() end 76 | itemLevel = ss:GetStatValue(statObj, 'ItemLevel') 77 | powerLevel = ss:GetStatValue(statObj, 'PowerLevel') 78 | addItemLevel = 0 if itemLevel < math.floor(playerPLValue) * 10 then 79 | addItemLevel = math.floor(playerPLValue - powerLevel) * 10 + 5 80 | levelMod = Game['gameRPGManager::CreateStatModifier;gamedataStatTypegameStatModifierTypeFloat']('ItemLevel', 'Additive', addItemLevel) 81 | ss:AddSavedModifier(statObj, levelMod) end 82 | itemQuality = ss:GetStatValue(statObj, 'Quality') 83 | newItemQuality = itemQuality if itemQuality < 5 then 84 | newItemQuality = 4 ss:RemoveAllModifiers(statObj, 'Quality', true) 85 | qualityMod = Game['gameRPGManager::CreateStatModifier;gamedataStatTypegameStatModifierTypeFloat']('Quality', 'Additive', newItemQuality) 86 | ss:AddSavedModifier(statObj, qualityMod) 87 | end 88 | end 89 | end 90 | 91 | Utilities.FinishProtocol(moduleName) 92 | end 93 | 94 | 95 | function Legend.UpgradeMods() 96 | local moduleName = "All Non-Equipped Mods Are Now Legendary With Max Stats" 97 | 98 | player = Game.GetPlayer() 99 | ssc = Game.GetScriptableSystemsContainer() 100 | ts = Game.GetTransactionSystem() 101 | cs = ssc:Get(CName.new('CraftingSystem')) ok, 102 | backpack_items = ts:GetItemList(player) 103 | 104 | local modType = { 105 | Prt_FabricEnhancer = true, 106 | Prt_Mod = true, 107 | Prt_Fragment = true, 108 | Prt_Scope = true, 109 | Prt_Muzzle = true 110 | } 111 | 112 | for i, v in ipairs(backpack_items) do 113 | itemid = v:GetID() 114 | itemdata = ts:GetItemData(player, v:GetID()) 115 | vType = Game["gameRPGManager::GetItemType;ItemID"](itemid) if 116 | modType[vType.value] then 117 | cs['SetItemLevel2'] = cs['SetItemLevel;gameItemData'] 118 | cs:SetItemLevel2(itemdata) Game['gameRPGManager::ForceItemQuality;GameObjectgameItemDataCName'](player, itemdata, CName.new('Legendary')) 119 | end 120 | end 121 | 122 | Utilities.FinishProtocol(moduleName) 123 | end 124 | 125 | 126 | function Legend.UpgradeCW() 127 | local moduleName = "All Equipped Cyberware Are Now Legendary. NOTE: This is just for aesthetics. You should add the real items, from the other commands" 128 | 129 | player = Game.GetPlayer() 130 | ssc = Game.GetScriptableSystemsContainer() 131 | ts = Game.GetTransactionSystem() 132 | ss = Game.GetStatsSystem() 133 | es = ssc:Get(CName.new('EquipmentSystem')) 134 | espd = es:GetPlayerData(player) 135 | espd['GetItemInEquipSlot2'] = espd['GetItemInEquipSlot;gamedataEquipmentAreaInt32'] 136 | playerPLValue = ss:GetStatValue(player:GetEntityID(), 'PowerLevel') 137 | 138 | local slots = { 139 | FrontalCortexCW = 3, 140 | EyesCW = 1, 141 | CardiovascularSystemCW = 3, 142 | ImmuneSystemCW = 2, 143 | NervousSystemCW = 2, 144 | IntegumentarySystemCW = 3, 145 | SystemReplacementCW = 1, 146 | MusculoskeletalSystemCW = 2, 147 | HandsCW = 2, 148 | ArmsCW = 2, 149 | LegsCW = 3, 150 | PersonalLink = 1, 151 | Splinter = 1, 152 | Gadget = 1, 153 | AbilityCW = 6 154 | } 155 | 156 | for k,v in pairs(slots) do 157 | for i=1,v do 158 | print('Upgrading item in ' .. k .. ' slot ' .. (i - 1)) 159 | itemid = espd:GetItemInEquipSlot2(k, i - 1) 160 | if itemid.tdbid.hash ~= 0 then 161 | itemdata = ts:GetItemData(player, itemid) 162 | statObj = itemdata:GetStatsObjectID() end 163 | itemLevel = ss:GetStatValue(statObj, 'ItemLevel') 164 | powerLevel = ss:GetStatValue(statObj, 'PowerLevel') 165 | addItemLevel = 0 if itemLevel < math.floor(playerPLValue) * 10 166 | then addItemLevel = math.floor(playerPLValue - powerLevel) * 10 + 5 167 | levelMod = Game['gameRPGManager::CreateStatModifier;gamedataStatTypegameStatModifierTypeFloat']('ItemLevel', 'Additive', addItemLevel) 168 | ss:AddSavedModifier(statObj, levelMod) end 169 | itemQuality = ss:GetStatValue(statObj, 'Quality') 170 | newItemQuality = itemQuality if itemQuality < 5 then 171 | newItemQuality = 4 ss:RemoveAllModifiers(statObj, 'Quality', true) 172 | qualityMod = Game['gameRPGManager::CreateStatModifier;gamedataStatTypegameStatModifierTypeFloat']('Quality', 'Additive', newItemQuality) 173 | ss:AddSavedModifier(statObj, qualityMod) 174 | end 175 | end 176 | end 177 | 178 | Utilities.FinishProtocol(moduleName) 179 | end 180 | 181 | function Legend.UpgradeAll() 182 | local moduleName = "Make all equipped gear Legendary with max stats - except equipped mods" 183 | 184 | Legend.UpgradeWeapons() 185 | Legend.UpgradeArmor() 186 | Legend.UpgradeMods() 187 | --Legend.UpgradeCW() 188 | 189 | Utilities.FinishProtocol(moduleName) 190 | end 191 | 192 | return Legend 193 | -------------------------------------------------------------------------------- /mods/braindance_protocol/cheats/modify.lua: -------------------------------------------------------------------------------- 1 | local Modify = {} 2 | 3 | local Utilities = require("utility") 4 | 5 | function Modify.Set(cat, slot, rarity) 6 | local moduleName = "Modify." 7 | 8 | player = Game.GetPlayer() 9 | ssc = Game.GetScriptableSystemsContainer() 10 | ts = Game.GetTransactionSystem() 11 | es = ssc:Get(CName.new('EquipmentSystem')) 12 | cs = ssc:Get(CName.new('CraftingSystem')) 13 | 14 | espd = es:GetPlayerData(player) 15 | espd['GetItemInEquipSlot2'] = espd['GetItemInEquipSlot;gamedataEquipmentAreaInt32'] 16 | cs['SetItemLevel2'] = cs['SetItemLevel;gameItemData'] 17 | 18 | itemid = espd:GetItemInEquipSlot2(cat, slot) 19 | if itemid.tdbid.hash ~= 0 then 20 | itemdata = ts:GetItemData(player, itemid) 21 | cs:SetItemLevel2(itemdata) 22 | Game['gameRPGManager::ForceItemQuality;GameObjectgameItemDataCName'](player, itemdata, CName.new(rarity)) 23 | end 24 | 25 | Utilities.FinishProtocol(moduleName) 26 | end 27 | 28 | function Modify.RemoveQuestTags() 29 | local moduleName = "Removed Quest Tags From Items" 30 | 31 | player = Game.GetPlayer() 32 | ssc = Game.GetScriptableSystemsContainer() 33 | ts = Game.GetTransactionSystem() 34 | es = ssc:Get(CName.new('EquipmentSystem')) 35 | espd = es:GetPlayerData(player) 36 | espd['GetItemInEquipSlot2'] = espd['GetItemInEquipSlot;gamedataEquipmentAreaInt32'] 37 | local slots = { 38 | Face = 1, 39 | Feet = 1, 40 | Head = 1, 41 | InnerChest = 1, 42 | Legs = 1, 43 | OuterChest = 1, 44 | Weapon = 3 45 | } 46 | 47 | for k,v in pairs(slots) do 48 | for i=1,v do 49 | print('Removing quest tags ' .. k .. ' slot ' .. (i - 1)) 50 | itemid = espd:GetItemInEquipSlot2(k, i - 1) if itemid.tdbid.hash ~= 0 then 51 | itemdata = ts:GetItemData(player, itemid) if itemdata:HasTag("Quest") then 52 | itemdata:RemoveDynamicTag("Quest") end 53 | end 54 | end 55 | end 56 | 57 | Utilities.FinishProtocol(moduleName) 58 | end 59 | 60 | return Modify 61 | -------------------------------------------------------------------------------- /mods/braindance_protocol/cheats/platform.lua: -------------------------------------------------------------------------------- 1 | local Platform = {} 2 | 3 | local Utilities = require("utility") 4 | 5 | 6 | function Platform.UnlockAllAchievements() 7 | local moduleName = "Unlock All Achievements" 8 | Game.UnlockAllAchievements() 9 | Utilities.FinishProtocol(moduleName) 10 | end 11 | 12 | return Platform 13 | -------------------------------------------------------------------------------- /mods/braindance_protocol/cheats/player.lua: -------------------------------------------------------------------------------- 1 | local Player = { 2 | slowMotion = false, 3 | infiniteStamina = false, 4 | godMode = false 5 | } 6 | 7 | local Utilities = require("utility") 8 | local Inventory = require("inventory") 9 | 10 | local DEFAULT_ATTRIBUTE_LEVEL = 3 11 | local ATTRIBUTES = { 12 | "Strength", -- Body 13 | "Reflexes", 14 | "TechnicalAbility", 15 | "Intelligence", 16 | "Cool" 17 | } 18 | 19 | function Player.AddMoney(quantity) 20 | local moduleName = "l-o-a-d-s-a-m-o-n-e-y" 21 | 22 | quantity = quantity or 999999 23 | 24 | Inventory.AddItem("money", quantity) 25 | 26 | Utilities.FinishProtocol(moduleName) 27 | end 28 | 29 | 30 | function Player.MaxOut() 31 | local skills = 32 | { 33 | "Level", 34 | "StreetCred", 35 | 36 | "Assault", 37 | "Athletics", 38 | "Brawling", 39 | "ColdBlood", 40 | "CombatHacking", -- Quickhacks 41 | "Crafting", 42 | "Demolition", -- Annihilation 43 | "Engineering", 44 | "Gunslinger", 45 | "Hacking", 46 | "Kenjutsu", -- Blades 47 | "Stealth" 48 | } 49 | 50 | local moduleName = "Max out Level, Streetcred, Perk, and Attributes" 51 | 52 | for _, attribute in ipairs(ATTRIBUTES) do 53 | Game.SetAtt(attribute, 20) 54 | end 55 | 56 | for _, skill in ipairs(skills) do 57 | Game.AddExp(skill, 1000000000) 58 | end 59 | 60 | Player.AddMoney() 61 | 62 | Utilities.FinishProtocol(moduleName) 63 | end 64 | 65 | function Player.Respec() 66 | local moduleName = "Respec player perks and attributes" 67 | 68 | local playerID = Game.GetPlayer():GetEntityID() 69 | local statsSystem = Game.GetStatsSystem() 70 | local attributesPointsToAdd = 0 71 | 72 | -- reset each attribute to default level and compute how many attribute points the player get from the respect 73 | for _, attribute in ipairs(ATTRIBUTES) do 74 | local currentLevel = statsSystem:GetStatValue(playerID, attribute) 75 | attributesPointsToAdd = attributesPointsToAdd + (currentLevel - DEFAULT_ATTRIBUTE_LEVEL) 76 | Game.SetAtt(attribute, DEFAULT_ATTRIBUTE_LEVEL) 77 | end 78 | 79 | if attributesPointsToAdd > 0 then 80 | Game.GiveDevPoints("Attribute", attributesPointsToAdd) 81 | end 82 | 83 | -- reset perks using the tabula resa game item 84 | Game.AddToInventory("Items.PerkPointsResetter",1) 85 | 86 | Utilities.FinishProtocol(moduleName) 87 | end 88 | 89 | function Player.UnlockAllVehicles() 90 | local moduleName = "Unlock All Vehicles" 91 | Game.EnableAllPlayerVehicles() 92 | Utilities.FinishProtocol(moduleName) 93 | end 94 | 95 | -- Toggle Slow Motion 96 | -- Thanks to DankRafft on Nexusmods for these toggle things 97 | function Player.SlowMotionToggle() 98 | local moduleName = "Slow-Motion" 99 | 100 | Player.slowMotion = not Player.slowMotion 101 | if (Player.slowMotion) then 102 | Game.Slowmo() 103 | else 104 | Game.Noslowmo() 105 | end 106 | print("Status:", Player.slowMotion) 107 | Utilities.FinishProtocol(moduleName) 108 | end 109 | 110 | -- Toggle Infinte Stamina 111 | function Player.InfiniteStaminaToggle() 112 | local moduleName = "Infinite Stamina" 113 | 114 | Player.infiniteStamina = not Player.infiniteStamina 115 | Game.InfiniteStamina(Player.infiniteStamina) 116 | 117 | print("Status:", Player.infiniteStamina) 118 | Utilities.FinishProtocol(moduleName) 119 | end 120 | 121 | -- God Mode Toggle 122 | -- All credits to Willy-JL / Str8up Menu 123 | function Player.GodModeToggle() 124 | local moduleName = "God Mode" 125 | 126 | Player.godMode = not Player.godMode 127 | if (Player.godMode) then 128 | Game.GetGodModeSystem():EnableOverride(Game.GetPlayer():GetEntityID(), "Invulnerable", CName.new("SecondHeart")) 129 | if Game.GetWorkspotSystem():IsActorInWorkspot(Game.GetPlayer()) then 130 | veh = Game['GetMountedVehicle;GameObject'](Game.GetPlayer()) 131 | if veh then 132 | Game.GetGodModeSystem():AddGodMode(veh:GetEntityID(), "Invulnerable", CName.new("Default")) 133 | end 134 | end 135 | else 136 | ssc = Game.GetScriptableSystemsContainer() 137 | es = ssc:Get(CName.new('EquipmentSystem')) 138 | espd = es:GetPlayerData(Game.GetPlayer()) 139 | espd['GetItemInEquipSlot2'] = espd['GetItemInEquipSlot;gamedataEquipmentAreaInt32'] 140 | for i=0,2 do 141 | if espd:GetItemInEquipSlot2("CardiovascularSystemCW", i).tdbid.hash == 3619482064 then 142 | hasSecondHeart = true 143 | end 144 | end 145 | if hasSecondHeart then 146 | Game.GetGodModeSystem():EnableOverride(Game.GetPlayer():GetEntityID(), "Immortal", CName.new("SecondHeart")) 147 | else 148 | Game.GetGodModeSystem():DisableOverride(Game.GetPlayer():GetEntityID(), CName.new("SecondHeart")) 149 | end 150 | if Game.GetWorkspotSystem():IsActorInWorkspot(Game.GetPlayer()) then 151 | veh = Game['GetMountedVehicle;GameObject'](Game.GetPlayer()) 152 | if veh then 153 | Game.GetGodModeSystem():ClearGodMode(veh:GetEntityID(), CName.new("Default")) 154 | end 155 | end 156 | end 157 | 158 | print("Status:", Player.godMode) 159 | Utilities.FinishProtocol(moduleName) 160 | end 161 | 162 | -- Rocket Boots / Slow Fall 163 | function Player.RocketBootsOn() 164 | local moduleName = "Enables Rocket Boots (slow fall) - Reload Game To Disable" 165 | Game.ModStatPlayer("HasAirThrusters", "1") 166 | Utilities.FinishProtocol(moduleName) 167 | end 168 | 169 | -- Forced NPC Death 170 | function Player.ForceNPCDeath() 171 | local moduleName = "Kills The Targeted NPC" 172 | Game.ForcedNPCDeath() 173 | Utilities.FinishProtocol(moduleName) 174 | end 175 | 176 | -- Discover All Points Of Interest 177 | function Player.DiscoverAllPOI() 178 | local moduleName = "Reveals All Points Of Interests (All '?' Marks)" 179 | Game.GetMappinSystem():DebugDiscoverAllPoiMappins() 180 | Utilities.FinishProtocol(moduleName) 181 | end 182 | 183 | -- Infinite Oxygen 184 | function Player.InfiniteOxygenOn() 185 | local moduleName = "Enable Infine Oxygen - Reload Game To Disable" 186 | Game.ModStatPlayer("CanBreatheUnderwater", "1") 187 | Utilities.FinishProtocol(moduleName) 188 | end 189 | 190 | -- Player Stats (Cumulative Adding Of Stats) 191 | function Player.AddMaxHealth(quantity) 192 | local moduleName = "Add Max Health (cumulative)" 193 | 194 | quantity = quantity or 0 195 | 196 | Game.ModStatPlayer("Health", quantity) 197 | 198 | Utilities.FinishProtocol(moduleName) 199 | end 200 | 201 | function Player.AddMaxArmor(quantity) 202 | local moduleName = "Add Max Armor (cumulative)" 203 | 204 | quantity = quantity or 0 205 | 206 | Game.ModStatPlayer("Armor", quantity) 207 | 208 | Utilities.FinishProtocol(moduleName) 209 | end 210 | 211 | function Player.AddMaxStamina(quantity) 212 | local moduleName = "Add Max Stamina (cumulative)" 213 | 214 | quantity = quantity or 0 215 | 216 | Game.ModStatPlayer("Stamina", quantity) 217 | 218 | Utilities.FinishProtocol(moduleName) 219 | end 220 | 221 | function Player.AddMaxOxygen(quantity) 222 | local moduleName = "Add Max Oxygen (cumulative)" 223 | 224 | quantity = quantity or 0 225 | 226 | Game.ModStatPlayer("Oxygen", quantity) 227 | 228 | Utilities.FinishProtocol(moduleName) 229 | end 230 | 231 | function Player.AddMaxCritDamage(quantity) 232 | local moduleName = "Add Max Critical Damage (cumulative)" 233 | 234 | quantity = quantity or 0 235 | 236 | Game.ModStatPlayer("CritDamage", quantity) 237 | 238 | Utilities.FinishProtocol(moduleName) 239 | end 240 | 241 | function Player.AddMaxCarryCapacity(quantity) 242 | local moduleName = "Add Max Carry Capacity (cumulative)" 243 | 244 | quantity = quantity or 0 245 | 246 | Game.ModStatPlayer("CarryCapacity", quantity) 247 | 248 | Utilities.FinishProtocol(moduleName) 249 | end 250 | 251 | function Player.AddMaxMemorySlots(quantity) 252 | local moduleName = "Add Memory Slots (cumulative)" 253 | 254 | quantity = quantity or 0 255 | 256 | Game.ModStatPlayer("Memory", quantity) 257 | 258 | Utilities.FinishProtocol(moduleName) 259 | end 260 | 261 | function Player.AddMaxMovementSpeed(quantity) 262 | local moduleName = "Add Movement Speed (cumulative)" 263 | 264 | quantity = quantity or 0 265 | 266 | Game.ModStatPlayer("MaxSpeed", quantity) 267 | 268 | Utilities.FinishProtocol(moduleName) 269 | end 270 | 271 | return Player -------------------------------------------------------------------------------- /mods/braindance_protocol/engine/saves.lua: -------------------------------------------------------------------------------- 1 | local Saves = {} 2 | 3 | local Utilities = require("utility") 4 | 5 | function Saves.DisableAutosave() 6 | local moduleName = "Disable Autosave" 7 | GameOptions.SetBool("SaveConfig", "AutoSaveEnabled", false) 8 | Utilities.FinishProtocol(moduleName) 9 | end 10 | 11 | function Saves.DecreaseAutosaves() 12 | local moduleName = "Decrease Autosaves" 13 | GameOptions.SetBool("SaveConfig", "AutoSaveEnabled", true) 14 | GameOptions.SetInt("SaveConfig", "AutoSavePeriod", 600) 15 | Utilities.FinishProtocol(moduleName) 16 | end 17 | 18 | function Saves.IncreaseAutosaves() 19 | local moduleName = "Increase Autosaves" 20 | GameOptions.SetFloat("SaveConfig", "AutoSaveEnabled", true) 21 | GameOptions.SetInt("SaveConfig", "AutoSavePeriod", 100) 22 | Utilities.FinishProtocol(moduleName) 23 | end 24 | 25 | function Saves.IncreaseQuicksaves() 26 | local moduleName = "Increase Quicksaves" 27 | GameOptions.SetInt("Developer/SaveSlotsConfig", "NumQuickSaveSlots", 10) 28 | Utilities.FinishProtocol(moduleName) 29 | end 30 | 31 | return Saves 32 | -------------------------------------------------------------------------------- /mods/braindance_protocol/engine/time.lua: -------------------------------------------------------------------------------- 1 | local Time = { 2 | timeToggle = false 3 | } 4 | 5 | local Utilities = require("utility") 6 | 7 | function Time.SetTimeTo06AM() 8 | local moduleName = "Time is now 6AM" 9 | 10 | -- 6AM / 06:00 11 | Game.GetTimeSystem():SetGameTimeByHMS(6, 0, 0) 12 | 13 | Utilities.FinishProtocol(moduleName) 14 | end 15 | 16 | function Time.SetTimeTo10PM() 17 | local moduleName = "Time is now 10PM" 18 | 19 | -- 10PM / 22:00 20 | Game.GetTimeSystem():SetGameTimeByHMS(22, 0, 0) 21 | 22 | Utilities.FinishProtocol(moduleName) 23 | end 24 | 25 | function Time.SetTime(quantity) 26 | local moduleName = "Time Changed" 27 | 28 | quantity = quantity or 0 29 | 30 | Game.GetTimeSystem():SetGameTimeByHMS(quantity, 0, 0) 31 | 32 | Utilities.FinishProtocol(moduleName) 33 | end 34 | 35 | -- Toggle Time Stops 36 | function Time.TimeToggle() 37 | local moduleName = "Pause Time" 38 | 39 | Time.timeToggle = not Time.timeToggle 40 | Game.GetTimeSystem():SetPausedState(Time.timeToggle, CName.new()) 41 | 42 | print("Status:", Time.timeToggle) 43 | Utilities.FinishProtocol(moduleName) 44 | end 45 | 46 | return Time 47 | -------------------------------------------------------------------------------- /mods/braindance_protocol/engine/visual.lua: -------------------------------------------------------------------------------- 1 | local Utilities = require("utility") 2 | 3 | local Visual = {} 4 | 5 | function Visual.Rain(state) 6 | local moduleName = "Toggle Rain" 7 | state = state or true 8 | GameOptions.SetBool("Developer/FeatureToggles", "RainMap", state) 9 | Utilities.FinishProtocol(moduleName) 10 | end 11 | 12 | return Visual 13 | -------------------------------------------------------------------------------- /mods/braindance_protocol/examples/init.lua: -------------------------------------------------------------------------------- 1 | local Example = {} 2 | 3 | local Utilities = require("utility") 4 | 5 | local Example = {} 6 | 7 | function Example.Initialise() 8 | local moduleName = "Init" 9 | print("Initialising Braindance Protocol") 10 | Utilities.FinishProtocol(moduleName) 11 | end 12 | 13 | return Example 14 | -------------------------------------------------------------------------------- /mods/braindance_protocol/fact.lua: -------------------------------------------------------------------------------- 1 | local Fact = {} 2 | local protocols = require("protocols") 3 | 4 | local function getFact(fact) 5 | local factValue = Game.GetQuestsSystem():GetFactStr(fact) 6 | return factValue 7 | end 8 | 9 | -- Get fact values for the toggle and combobox 10 | local function getValue(id) 11 | local value, value2, value3 12 | if id == "Facts.SkippyMode" then 13 | value = getFact("mq007_skippy_aim_at_head") 14 | if value == 0 then return true else return false end 15 | elseif id == "Facts.SkippyAttitude" then 16 | value = getFact("mq007_skippy_goes_emo") 17 | if value == 0 then return true else return false end 18 | elseif id == "Facts.JackieBody" then 19 | value = getFact("q005_jackie_to_hospital") 20 | value2 = getFact("q005_jackie_to_mama") 21 | value3 = getFact("q005_jackie_stay_notell") 22 | if value == 1 and value2 == 0 and value3 == 0 then return 0 23 | elseif value == 0 and value2 == 1 and value3 == 0 then return 1 24 | elseif value == 0 and value2 == 0 and value3 == 1 then return 2 25 | else return -1 end 26 | elseif id == "Facts.GoroFate" then 27 | value = getFact("q112_takemura_dead") 28 | if value == 0 then return true else return false end 29 | end 30 | end 31 | 32 | function Fact.GetValue() 33 | for i in pairs(protocols.Items) do 34 | if protocols.Items[i].parent == "Facts" and protocols.Items[i].type ~= "Button" then 35 | protocols.Items[i].value = getValue(protocols.Items[i].id) 36 | end 37 | end 38 | end 39 | 40 | return Fact 41 | -------------------------------------------------------------------------------- /mods/braindance_protocol/hotkeys.lua: -------------------------------------------------------------------------------- 1 | local fact = require("fact") 2 | local BD = require("BD") 3 | local protocols = require("protocols") 4 | local ui = require("ui") 5 | local i18n = require("i18n") 6 | local Options = require("options") 7 | 8 | local hotkeys = {} 9 | 10 | hotkeys.bindings = { 11 | { 12 | ID = "hotkey_interface", 13 | Callback = function() 14 | if not ui.drawWindow then 15 | fact.GetValue() 16 | end 17 | ui.drawWindow = not ui.drawWindow 18 | end 19 | } 20 | } 21 | 22 | function hotkeys:Register() 23 | for _, v in ipairs(self.bindings) do 24 | registerHotkey(v.ID, i18n(v.ID), v.Callback) 25 | end 26 | for _, v in ipairs(Options.fav_value.hk) do 27 | for _, pv in ipairs(protocols.Items) do 28 | if pv.id == v then 29 | registerHotkey(pv.id:gsub(".","_"), i18n(pv.name), pv.cmd) 30 | end 31 | end 32 | end 33 | end 34 | 35 | return hotkeys 36 | -------------------------------------------------------------------------------- /mods/braindance_protocol/i18n/LICENSE: -------------------------------------------------------------------------------- 1 | MIT License Terms 2 | ================= 3 | 4 | Copyright (c) 2012 Enrique García Cota. 5 | 6 | Permission is hereby granted, free of charge, to any person obtaining a copy of 7 | this software and associated documentation files (the "Software"), to deal in 8 | the Software without restriction, including without limitation the rights to 9 | use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies 10 | of the Software, and to permit persons to whom the Software is furnished to do 11 | so, subject to the following conditions: 12 | 13 | The above copyright notice and this permission notice shall be included in all 14 | copies or substantial portions of the Software. 15 | 16 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 17 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 18 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 19 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 20 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 21 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 22 | SOFTWARE. 23 | -------------------------------------------------------------------------------- /mods/braindance_protocol/i18n/README.md: -------------------------------------------------------------------------------- 1 | Forked from https://github.com/kikito/i18n.lua 2 | 3 | i18n.lua 4 | ======== 5 | 6 | [![Build Status](https://travis-ci.org/kikito/i18n.lua.png?branch=master)](https://travis-ci.org/kikito/i18n.lua) 7 | 8 | A very complete i18n lib for Lua 9 | 10 | Description 11 | =========== 12 | 13 | ``` lua 14 | i18n = require 'i18n' 15 | 16 | -- loading stuff 17 | i18n.set('en.welcome', 'welcome to this program') 18 | i18n.load({ 19 | en = { 20 | good_bye = "good-bye!", 21 | age_msg = "your age is %{age}.", 22 | phone_msg = { 23 | one = "you have one new message.", 24 | other = "you have %{count} new messages." 25 | } 26 | } 27 | }) 28 | i18n.loadFile('path/to/your/project/i18n/de.lua') -- load German language file 29 | i18n.loadFile('path/to/your/project/i18n/fr.lua') -- load French language file 30 | … -- section 'using language files' below describes structure of files 31 | 32 | -- setting the translation context 33 | i18n.setLocale('en') -- English is the default locale anyway 34 | 35 | -- getting translations 36 | i18n.translate('welcome') -- Welcome to this program 37 | i18n('welcome') -- Welcome to this program 38 | i18n('age_msg', {age = 18}) -- Your age is 18. 39 | i18n('phone_msg', {count = 1}) -- You have one new message. 40 | i18n('phone_msg', {count = 2}) -- You have 2 new messages. 41 | i18n('good_bye') -- Good-bye! 42 | 43 | ``` 44 | 45 | Interpolation 46 | ============= 47 | 48 | You can interpolate variables in 3 different ways: 49 | 50 | ``` lua 51 | -- the most usual one 52 | i18n.set('variables', 'Interpolating variables: %{name} %{age}') 53 | i18n('variables', {name='john', 'age'=10}) -- Interpolating variables: john 10 54 | 55 | i18n.set('lua', 'Traditional Lua way: %d %s') 56 | i18n('lua', {1, 'message'}) -- Traditional Lua way: 1 message 57 | 58 | i18n.set('combined', 'Combined: %.q %.d %.o') 59 | i18n('combined', {name='john', 'age'=10}) -- Combined: john 10 12k 60 | ``` 61 | 62 | 63 | 64 | Pluralization 65 | ============= 66 | 67 | This lib implements the [unicode.org plural rules](http://cldr.unicode.org/index/cldr-spec/plural-rules). Just set the locale you want to use and it will deduce the appropiate pluralization rules: 68 | 69 | ``` lua 70 | i18n = require 'i18n' 71 | 72 | i18n.load({ 73 | en = { 74 | msg = { 75 | one = "one message", 76 | other = "%{count} messages" 77 | } 78 | }, 79 | ru = { 80 | msg = { 81 | one = "1 сообщение", 82 | few = "%{count} сообщения", 83 | many = "%{count} сообщений", 84 | other = "%{count} сообщения" 85 | } 86 | } 87 | }) 88 | 89 | i18n('msg', {count = 1}) -- one message 90 | i18n.setLocale('ru') 91 | i18n('msg', {count = 5}) -- 5 сообщений 92 | ``` 93 | 94 | The appropiate rule is chosen by finding the 'root' of the locale used: for example if the current locale is 'fr-CA', the 'fr' rules will be applied. 95 | 96 | If the provided functions are not enough (i.e. invented languages) it's possible to specify a custom pluralization function in the second parameter of setLocale. This function must return 'one', 'few', 'other', etc given a number. 97 | 98 | Fallbacks 99 | ========= 100 | 101 | When a value is not found, the lib has several fallback mechanisms: 102 | 103 | * First, it will look in the current locale's parents. For example, if the locale was set to 'en-US' and the key 'msg' was not found there, it will be looked over in 'en'. 104 | * Second, if the value is not found in the locale ancestry, a 'fallback locale' (by default: 'en') can be used. If the fallback locale has any parents, they will be looked over too. 105 | * Third, if all the locales have failed, but there is a param called 'default' on the provided data, it will be used. 106 | * Otherwise the translation will return nil. 107 | 108 | The parents of a locale are found by splitting the locale by its hyphens. Other separation characters (spaces, underscores, etc) are not supported. 109 | 110 | Using language files 111 | ==================== 112 | 113 | It might be a good idea to store each translation in a different file. This is supported via the 'i18n.loadFile' directive: 114 | 115 | ``` lua 116 | … 117 | i18n.loadFile('path/to/your/project/i18n/de.lua') -- German translation 118 | i18n.loadFile('path/to/your/project/i18n/en.lua') -- English translation 119 | i18n.loadFile('path/to/your/project/i18n/fr.lua') -- French translation 120 | … 121 | ``` 122 | 123 | The German language file 'de.lua' should read: 124 | 125 | ``` lua 126 | return { 127 | de = { 128 | good_bye = "Auf Wiedersehen!", 129 | age_msg = "Ihr Alter beträgt %{age}.", 130 | phone_msg = { 131 | one = "Sie haben eine neue Nachricht.", 132 | other = "Sie haben %{count} neue Nachrichten." 133 | } 134 | } 135 | } 136 | ``` 137 | 138 | If desired, you can also store all translations in one single file (eg. 'translations.lua'): 139 | 140 | ``` lua 141 | return { 142 | de = { 143 | good_bye = "Auf Wiedersehen!", 144 | age_msg = "Ihr Alter beträgt %{age}.", 145 | phone_msg = { 146 | one = "Sie haben eine neue Nachricht.", 147 | other = "Sie haben %{count} neue Nachrichten." 148 | } 149 | }, 150 | fr = { 151 | good_bye = "Au revoir !", 152 | age_msg = "Vous avez %{age} ans.", 153 | phone_msg = { 154 | one = "Vous avez une noveau message.", 155 | other = "Vous avez %{count} noveaux messages." 156 | } 157 | }, 158 | … 159 | } 160 | ``` 161 | 162 | Specs 163 | ===== 164 | This project uses [busted](https://github.com/Olivine-Labs/busted) for its specs. If you want to run the specs, you will have to install it first. Then just execute the following from the root inspect folder: 165 | 166 | busted 167 | -------------------------------------------------------------------------------- /mods/braindance_protocol/i18n/init.lua: -------------------------------------------------------------------------------- 1 | local i18n = {} 2 | 3 | local store 4 | local locale 5 | local pluralizeFunction 6 | local defaultLocale = 'en' 7 | local fallbackLocale = defaultLocale 8 | 9 | local currentFilePath = "i18n" 10 | 11 | local plural = require(currentFilePath .. '/plural') 12 | local interpolate = require(currentFilePath .. '/interpolate') 13 | local variants = require(currentFilePath .. '/variants') 14 | local version = require(currentFilePath .. '/version') 15 | 16 | i18n.plural, i18n.interpolate, i18n.variants, i18n.version, i18n._VERSION = 17 | plural, interpolate, variants, version, version 18 | 19 | -- private stuff 20 | 21 | local function dotSplit(str) 22 | local fields, length = {},0 23 | str:gsub("[^%.]+", function(c) 24 | length = length + 1 25 | fields[length] = c 26 | end) 27 | return fields, length 28 | end 29 | 30 | local function isPluralTable(t) 31 | return type(t) == 'table' and type(t.other) == 'string' 32 | end 33 | 34 | local function isPresent(str) 35 | return type(str) == 'string' and #str > 0 36 | end 37 | 38 | local function assertPresent(functionName, paramName, value) 39 | if isPresent(value) then return end 40 | 41 | local msg = "i18n.%s requires a non-empty string on its %s. Got %s (a %s value)." 42 | error(msg:format(functionName, paramName, tostring(value), type(value))) 43 | end 44 | 45 | local function assertPresentOrPlural(functionName, paramName, value) 46 | if isPresent(value) or isPluralTable(value) then return end 47 | 48 | local msg = "i18n.%s requires a non-empty string or plural-form table on its %s. Got %s (a %s value)." 49 | error(msg:format(functionName, paramName, tostring(value), type(value))) 50 | end 51 | 52 | local function assertPresentOrTable(functionName, paramName, value) 53 | if isPresent(value) or type(value) == 'table' then return end 54 | 55 | local msg = "i18n.%s requires a non-empty string or table on its %s. Got %s (a %s value)." 56 | error(msg:format(functionName, paramName, tostring(value), type(value))) 57 | end 58 | 59 | local function assertFunctionOrNil(functionName, paramName, value) 60 | if value == nil or type(value) == 'function' then return end 61 | 62 | local msg = "i18n.%s requires a function (or nil) on param %s. Got %s (a %s value)." 63 | error(msg:format(functionName, paramName, tostring(value), type(value))) 64 | end 65 | 66 | local function defaultPluralizeFunction(count) 67 | return plural.get(variants.root(i18n.getLocale()), count) 68 | end 69 | 70 | local function pluralize(t, data) 71 | assertPresentOrPlural('interpolatePluralTable', 't', t) 72 | data = data or {} 73 | local count = data.count or 1 74 | local plural_form = pluralizeFunction(count) 75 | return t[plural_form] 76 | end 77 | 78 | local function treatNode(node, data) 79 | if type(node) == 'string' then 80 | return interpolate(node, data) 81 | elseif isPluralTable(node) then 82 | return interpolate(pluralize(node, data), data) 83 | end 84 | return node 85 | end 86 | 87 | local function recursiveLoad(currentContext, data) 88 | local composedKey 89 | for k,v in pairs(data) do 90 | composedKey = (currentContext and (currentContext .. '.') or "") .. tostring(k) 91 | assertPresent('load', composedKey, k) 92 | assertPresentOrTable('load', composedKey, v) 93 | if type(v) == 'string' then 94 | i18n.set(composedKey, v) 95 | else 96 | recursiveLoad(composedKey, v) 97 | end 98 | end 99 | end 100 | 101 | local function localizedTranslate(key, loc, data) 102 | local path, length = dotSplit(loc .. "." .. key) 103 | local node = store 104 | 105 | for i=1, length do 106 | node = node[path[i]] 107 | if not node then return nil end 108 | end 109 | 110 | return treatNode(node, data) 111 | end 112 | 113 | -- public interface 114 | 115 | function i18n.set(key, value) 116 | assertPresent('set', 'key', key) 117 | assertPresentOrPlural('set', 'value', value) 118 | 119 | local path, length = dotSplit(key) 120 | local node = store 121 | 122 | for i=1, length-1 do 123 | key = path[i] 124 | node[key] = node[key] or {} 125 | node = node[key] 126 | end 127 | 128 | local lastKey = path[length] 129 | node[lastKey] = value 130 | end 131 | 132 | function i18n.translate(key, data) 133 | assertPresent('translate', 'key', key) 134 | 135 | data = data or {} 136 | local usedLocale = data.locale or locale 137 | 138 | local fallbacks = variants.fallbacks(usedLocale, fallbackLocale) 139 | for i=1, #fallbacks do 140 | local value = localizedTranslate(key, fallbacks[i], data) 141 | if value then return value end 142 | end 143 | 144 | return data.default 145 | end 146 | 147 | function i18n.setLocale(newLocale, newPluralizeFunction) 148 | assertPresent('setLocale', 'newLocale', newLocale) 149 | assertFunctionOrNil('setLocale', 'newPluralizeFunction', newPluralizeFunction) 150 | locale = newLocale 151 | pluralizeFunction = newPluralizeFunction or defaultPluralizeFunction 152 | end 153 | 154 | function i18n.setFallbackLocale(newFallbackLocale) 155 | assertPresent('setFallbackLocale', 'newFallbackLocale', newFallbackLocale) 156 | fallbackLocale = newFallbackLocale 157 | end 158 | 159 | function i18n.getFallbackLocale() 160 | return fallbackLocale 161 | end 162 | 163 | function i18n.getLocale() 164 | return locale 165 | end 166 | 167 | function i18n.reset() 168 | store = {} 169 | plural.reset() 170 | i18n.setLocale(defaultLocale) 171 | i18n.setFallbackLocale(defaultLocale) 172 | end 173 | 174 | function i18n.load(data) 175 | recursiveLoad(nil, data) 176 | end 177 | 178 | function i18n.loadFile(path) 179 | local chunk = assert(loadfile(path)) 180 | local data = chunk() 181 | i18n.load(data) 182 | end 183 | 184 | setmetatable(i18n, {__call = function(_, ...) return i18n.translate(...) end}) 185 | 186 | i18n.reset() 187 | 188 | return i18n 189 | -------------------------------------------------------------------------------- /mods/braindance_protocol/i18n/interpolate.lua: -------------------------------------------------------------------------------- 1 | local unpack = unpack or table.unpack -- lua 5.2 compat 2 | 3 | local FORMAT_CHARS = { c=1, d=1, E=1, e=1, f=1, g=1, G=1, i=1, o=1, u=1, X=1, x=1, s=1, q=1, ['%']=1 } 4 | 5 | -- matches a string of type %{age} 6 | local function interpolateValue(string, variables) 7 | return string:gsub("(.?)%%{%s*(.-)%s*}", 8 | function (previous, key) 9 | if previous == "%" then 10 | return 11 | else 12 | return previous .. tostring(variables[key]) 13 | end 14 | end) 15 | end 16 | 17 | -- matches a string of type %.d 18 | local function interpolateField(string, variables) 19 | return string:gsub("(.?)%%<%s*(.-)%s*>%.([cdEefgGiouXxsq])", 20 | function (previous, key, format) 21 | if previous == "%" then 22 | return 23 | else 24 | return previous .. string.format("%" .. format, variables[key] or "nil") 25 | end 26 | end) 27 | end 28 | 29 | local function escapePercentages(string) 30 | return string:gsub("(%%)(.?)", function(_, char) 31 | if FORMAT_CHARS[char] then 32 | return "%" .. char 33 | else 34 | return "%%" .. char 35 | end 36 | end) 37 | end 38 | 39 | local function unescapePercentages(string) 40 | return string:gsub("(%%%%)(.?)", function(_, char) 41 | if FORMAT_CHARS[char] then 42 | return "%" .. char 43 | else 44 | return "%%" .. char 45 | end 46 | end) 47 | end 48 | 49 | local function interpolate(pattern, variables) 50 | variables = variables or {} 51 | local result = pattern 52 | result = interpolateValue(result, variables) 53 | result = interpolateField(result, variables) 54 | result = escapePercentages(result) 55 | result = string.format(result, unpack(variables)) 56 | result = unescapePercentages(result) 57 | return result 58 | end 59 | 60 | return interpolate 61 | -------------------------------------------------------------------------------- /mods/braindance_protocol/i18n/plural.lua: -------------------------------------------------------------------------------- 1 | local plural = {} 2 | local defaultFunction = nil 3 | -- helper functions 4 | 5 | local function assertPresentString(functionName, paramName, value) 6 | if type(value) ~= 'string' or #value == 0 then 7 | local msg = "Expected param %s of function %s to be a string, but got %s (a value of type %s) instead" 8 | error(msg:format(paramName, functionName, tostring(value), type(value))) 9 | end 10 | end 11 | 12 | local function assertNumber(functionName, paramName, value) 13 | if type(value) ~= 'number' then 14 | local msg = "Expected param %s of function %s to be a number, but got %s (a value of type %s) instead" 15 | error(msg:format(paramName, functionName, tostring(value), type(value))) 16 | end 17 | end 18 | 19 | -- transforms "foo bar baz" into {'foo','bar','baz'} 20 | local function words(str) 21 | local result, length = {}, 0 22 | str:gsub("%S+", function(word) 23 | length = length + 1 24 | result[length] = word 25 | end) 26 | return result 27 | end 28 | 29 | local function isInteger(n) 30 | return n == math.floor(n) 31 | end 32 | 33 | local function between(value, min, max) 34 | return value >= min and value <= max 35 | end 36 | 37 | local function inside(v, list) 38 | for i=1, #list do 39 | if v == list[i] then return true end 40 | end 41 | return false 42 | end 43 | 44 | 45 | -- pluralization functions 46 | 47 | local pluralization = {} 48 | 49 | local f1 = function(n) 50 | return n == 1 and "one" or "other" 51 | end 52 | pluralization[f1] = words([[ 53 | af asa bem bez bg bn brx ca cgg chr da de dv ee el 54 | en eo es et eu fi fo fur fy gl gsw gu ha haw he is 55 | it jmc kaj kcg kk kl ksb ku lb lg mas ml mn mr nah 56 | nb nd ne nl nn no nr ny nyn om or pa pap ps pt rm 57 | rof rwk saq seh sn so sq ss ssy st sv sw syr ta te 58 | teo tig tk tn ts ur ve vun wae xh xog zu 59 | ]]) 60 | 61 | local f2 = function(n) 62 | return (n == 0 or n == 1) and "one" or "other" 63 | end 64 | pluralization[f2] = words("ak am bh fil guw hi ln mg nso ti tl wa") 65 | 66 | local f3 = function(n) 67 | if not isInteger(n) then return 'other' end 68 | return (n == 0 and "zero") or 69 | (n == 1 and "one") or 70 | (n == 2 and "two") or 71 | (between(n % 100, 3, 10) and "few") or 72 | (between(n % 100, 11, 99) and "many") or 73 | "other" 74 | end 75 | pluralization[f3] = {'ar'} 76 | 77 | local f4 = function() 78 | return "other" 79 | end 80 | pluralization[f4] = words([[ 81 | az bm bo dz fa hu id ig ii ja jv ka kde kea km kn 82 | ko lo ms my root sah ses sg th to tr vi wo yo zh 83 | ]]) 84 | 85 | local f5 = function(n) 86 | if not isInteger(n) then return 'other' end 87 | local n_10, n_100 = n % 10, n % 100 88 | return (n_10 == 1 and n_100 ~= 11 and 'one') or 89 | (between(n_10, 2, 4) and not between(n_100, 12, 14) and 'few') or 90 | ((n_10 == 0 or between(n_10, 5, 9) or between(n_100, 11, 14)) and 'many') or 91 | 'other' 92 | end 93 | pluralization[f5] = words('be bs hr ru sh sr uk') 94 | 95 | local f6 = function(n) 96 | if not isInteger(n) then return 'other' end 97 | local n_10, n_100 = n % 10, n % 100 98 | return (n_10 == 1 and not inside(n_100, {11,71,91}) and 'one') or 99 | (n_10 == 2 and not inside(n_100, {12,72,92}) and 'two') or 100 | (inside(n_10, {3,4,9}) and 101 | not between(n_100, 10, 19) and 102 | not between(n_100, 70, 79) and 103 | not between(n_100, 90, 99) 104 | and 'few') or 105 | (n ~= 0 and n % 1000000 == 0 and 'many') or 106 | 'other' 107 | end 108 | pluralization[f6] = {'br'} 109 | 110 | local f7 = function(n) 111 | return (n == 1 and 'one') or 112 | ((n == 2 or n == 3 or n == 4) and 'few') or 113 | 'other' 114 | end 115 | pluralization[f7] = {'cz', 'sk'} 116 | 117 | local f8 = function(n) 118 | return (n == 0 and 'zero') or 119 | (n == 1 and 'one') or 120 | (n == 2 and 'two') or 121 | (n == 3 and 'few') or 122 | (n == 6 and 'many') or 123 | 'other' 124 | end 125 | pluralization[f8] = {'cy'} 126 | 127 | local f9 = function(n) 128 | return (n >= 0 and n < 2 and 'one') or 129 | 'other' 130 | end 131 | pluralization[f9] = {'ff', 'fr', 'kab'} 132 | 133 | local f10 = function(n) 134 | return (n == 1 and 'one') or 135 | (n == 2 and 'two') or 136 | ((n == 3 or n == 4 or n == 5 or n == 6) and 'few') or 137 | ((n == 7 or n == 8 or n == 9 or n == 10) and 'many') or 138 | 'other' 139 | end 140 | pluralization[f10] = {'ga'} 141 | 142 | local f11 = function(n) 143 | return ((n == 1 or n == 11) and 'one') or 144 | ((n == 2 or n == 12) and 'two') or 145 | (isInteger(n) and (between(n, 3, 10) or between(n, 13, 19)) and 'few') or 146 | 'other' 147 | end 148 | pluralization[f11] = {'gd'} 149 | 150 | local f12 = function(n) 151 | local n_10 = n % 10 152 | return ((n_10 == 1 or n_10 == 2 or n % 20 == 0) and 'one') or 153 | 'other' 154 | end 155 | pluralization[f12] = {'gv'} 156 | 157 | local f13 = function(n) 158 | return (n == 1 and 'one') or 159 | (n == 2 and 'two') or 160 | 'other' 161 | end 162 | pluralization[f13] = words('iu kw naq se sma smi smj smn sms') 163 | 164 | local f14 = function(n) 165 | return (n == 0 and 'zero') or 166 | (n == 1 and 'one') or 167 | 'other' 168 | end 169 | pluralization[f14] = {'ksh'} 170 | 171 | local f15 = function(n) 172 | return (n == 0 and 'zero') or 173 | (n > 0 and n < 2 and 'one') or 174 | 'other' 175 | end 176 | pluralization[f15] = {'lag'} 177 | 178 | local f16 = function(n) 179 | if not isInteger(n) then return 'other' end 180 | if between(n % 100, 11, 19) then return 'other' end 181 | local n_10 = n % 10 182 | return (n_10 == 1 and 'one') or 183 | (between(n_10, 2, 9) and 'few') or 184 | 'other' 185 | end 186 | pluralization[f16] = {'lt'} 187 | 188 | local f17 = function(n) 189 | return (n == 0 and 'zero') or 190 | ((n % 10 == 1 and n % 100 ~= 11) and 'one') or 191 | 'other' 192 | end 193 | pluralization[f17] = {'lv'} 194 | 195 | local f18 = function(n) 196 | return((n % 10 == 1 and n ~= 11) and 'one') or 197 | 'other' 198 | end 199 | pluralization[f18] = {'mk'} 200 | 201 | local f19 = function(n) 202 | return (n == 1 and 'one') or 203 | ((n == 0 or 204 | (n ~= 1 and isInteger(n) and between(n % 100, 1, 19))) 205 | and 'few') or 206 | 'other' 207 | end 208 | pluralization[f19] = {'mo', 'ro'} 209 | 210 | local f20 = function(n) 211 | if n == 1 then return 'one' end 212 | if not isInteger(n) then return 'other' end 213 | local n_100 = n % 100 214 | return ((n == 0 or between(n_100, 2, 10)) and 'few') or 215 | (between(n_100, 11, 19) and 'many') or 216 | 'other' 217 | end 218 | pluralization[f20] = {'mt'} 219 | 220 | local f21 = function(n) 221 | if n == 1 then return 'one' end 222 | if not isInteger(n) then return 'other' end 223 | local n_10, n_100 = n % 10, n % 100 224 | 225 | return ((between(n_10, 2, 4) and not between(n_100, 12, 14)) and 'few') or 226 | ((n_10 == 0 or n_10 == 1 or between(n_10, 5, 9) or between(n_100, 12, 14)) and 'many') or 227 | 'other' 228 | end 229 | pluralization[f21] = {'pl'} 230 | 231 | local f22 = function(n) 232 | return (n == 0 or n == 1) and 'one' or 233 | 'other' 234 | end 235 | pluralization[f22] = {'shi'} 236 | 237 | local f23 = function(n) 238 | local n_100 = n % 100 239 | return (n_100 == 1 and 'one') or 240 | (n_100 == 2 and 'two') or 241 | ((n_100 == 3 or n_100 == 4) and 'few') or 242 | 'other' 243 | end 244 | pluralization[f23] = {'sl'} 245 | 246 | local f24 = function(n) 247 | return (isInteger(n) and (n == 0 or n == 1 or between(n, 11, 99)) and 'one') 248 | or 'other' 249 | end 250 | pluralization[f24] = {'tzm'} 251 | 252 | local pluralizationFunctions = {} 253 | for f,locales in pairs(pluralization) do 254 | for _,locale in ipairs(locales) do 255 | pluralizationFunctions[locale] = f 256 | end 257 | end 258 | 259 | -- public interface 260 | 261 | function plural.get(locale, n) 262 | assertPresentString('i18n.plural.get', 'locale', locale) 263 | assertNumber('i18n.plural.get', 'n', n) 264 | 265 | local f = pluralizationFunctions[locale] or defaultFunction 266 | 267 | return f(math.abs(n)) 268 | end 269 | 270 | function plural.setDefaultFunction(f) 271 | defaultFunction = f 272 | end 273 | 274 | function plural.reset() 275 | defaultFunction = pluralizationFunctions['en'] 276 | end 277 | 278 | plural.reset() 279 | 280 | return plural 281 | -------------------------------------------------------------------------------- /mods/braindance_protocol/i18n/variants.lua: -------------------------------------------------------------------------------- 1 | local variants = {} 2 | 3 | local function reverse(arr, length) 4 | local result = {} 5 | for i=1, length do result[i] = arr[length-i+1] end 6 | return result, length 7 | end 8 | 9 | local function concat(arr1, len1, arr2, len2) 10 | for i = 1, len2 do 11 | arr1[len1 + i] = arr2[i] 12 | end 13 | return arr1, len1 + len2 14 | end 15 | 16 | function variants.ancestry(locale) 17 | local result, length, accum = {},0,nil 18 | locale:gsub("[^%-]+", function(c) 19 | length = length + 1 20 | accum = accum and (accum .. '-' .. c) or c 21 | result[length] = accum 22 | end) 23 | return reverse(result, length) 24 | end 25 | 26 | function variants.isParent(parent, child) 27 | return not not child:match("^".. parent .. "%-") 28 | end 29 | 30 | function variants.root(locale) 31 | return locale:match("[^%-]+") 32 | end 33 | 34 | function variants.fallbacks(locale, fallbackLocale) 35 | if locale == fallbackLocale or 36 | variants.isParent(fallbackLocale, locale) then 37 | return variants.ancestry(locale) 38 | end 39 | if variants.isParent(locale, fallbackLocale) then 40 | return variants.ancestry(fallbackLocale) 41 | end 42 | 43 | local ancestry1, length1 = variants.ancestry(locale) 44 | local ancestry2, length2 = variants.ancestry(fallbackLocale) 45 | 46 | return concat(ancestry1, length1, ancestry2, length2) 47 | end 48 | 49 | return variants 50 | -------------------------------------------------------------------------------- /mods/braindance_protocol/i18n/version.lua: -------------------------------------------------------------------------------- 1 | return '0.9.2' 2 | -------------------------------------------------------------------------------- /mods/braindance_protocol/init.lua: -------------------------------------------------------------------------------- 1 | local BD = require("BD") 2 | local hotkeys = require("hotkeys") 3 | local ui = require("ui") 4 | local Options = require("options") 5 | Options:load() 6 | Options:loadfav() 7 | 8 | hotkeys:Register() 9 | ui:Update() 10 | ui:Draw() 11 | 12 | registerForEvent("onInit", function() 13 | ui.wWidth, ui.wHeight = GetDisplayResolution() 14 | print("[BD] Braindance Protocol Initialized!") 15 | end) 16 | 17 | registerForEvent("onShutdown", function() 18 | Options:savefav() 19 | end) 20 | 21 | return BD 22 | -------------------------------------------------------------------------------- /mods/braindance_protocol/inventory.lua: -------------------------------------------------------------------------------- 1 | local Inventory = {} 2 | 3 | local ItemHashes = "/data/ItemHashes.txt" 4 | 5 | function Inventory.AddItem(item, quantity) 6 | quantity = quantity or 1 7 | 8 | Game.AddToInventory(string.format("Items.%s", item), quantity) 9 | end 10 | 11 | function Inventory.AddAllItems(quantity) 12 | quantity = quantity or 1 13 | 14 | for line in io.lines(ItemHashes) do 15 | Game.AddToInventory(line, quantity) 16 | end 17 | end 18 | 19 | function Inventory.AddFilteredItems(filter, quantity) 20 | quantity = quantity or 1 21 | 22 | for line in io.lines(ItemHashes) do 23 | if string.match(line, filter) then 24 | Game.AddToInventory(line, quantity) 25 | end 26 | end 27 | end 28 | 29 | return Inventory 30 | -------------------------------------------------------------------------------- /mods/braindance_protocol/lang/README.md: -------------------------------------------------------------------------------- 1 | # How to add a language? 2 | 3 | 1. Edit `lang.lua`, add language *name* and it's *id*. For example 4 | ```lua 5 | { id = "ja", name = "日本語 (Japanese)"}, 6 | ``` 7 | Make sure to also write it's English name inside parentheses, because it may be rendered as ?? in a font that doesn't support it. 8 | 9 | 2. Duplicate `en.lua` and rename it into the *id* of the language that you want to translate into. (e.g. `ja.lua`) 10 | 11 | It must be the same as the *id* you added in `lang.lua` 12 | 13 | 3. Edit Line2 in the new language file you created (e.g. `ja.lua`). Replace `en` to the *id* of your language. 14 | 15 | ```lua 16 | en = { => ja = { 17 | ``` 18 | 19 | 4. Replace the English strings with your translation. 20 | 21 | ```lua 22 | window_title = "Braindance Protocol" , => window_title = "ブレインダンスプロトコル" , 23 | ``` 24 | 25 | 5. Save the files, launch the game, and *Braindance Protocol*. Switch the language to the new language you just added and debug it. 26 | 27 | 6. After double-checking your translation, make a pull request. 28 | 29 | # How to update existing language files? 30 | 31 | After adding more protocols into `protocols.lua`, we need to update the language files to match the new protocols. There is a function for you to do this automatically. 32 | 33 | 1. Add `"debug":true` into `config.json`. For example: 34 | ```json 35 | {"lang":"en", "debug":true} 36 | ``` 37 | 2. Start *Braindance Protocol*, press the Update language files button. 38 | 39 | ![Imgur](https://i.imgur.com/L4DRkfc.png) 40 | 41 | 3. Updated language files will be replacing the old language files. And backups of the old files will be created with "_old" suffix inside "lang/". (e.g. `en_old.lua`) 42 | 4. New strings will be commented inside the updated files. 43 | ```lua 44 | window_title = "Brandance Protocol", 45 | -- new_string = "" 46 | ``` 47 | 48 | ### How Update language files works? 49 | 1. It will scan `ui/*.lua` for strings inside `i18n("some_string")`, and strings from `protocols.lua`. 50 | 2. Then it will read and compare with the old language files. 51 | 3. If the translation of this string exists in the old language files, it will copy it over. 52 | 4. If the translation doesn't exist in the old language files, but exists in `en.lua`, it will copy it over from `en.lua` and comment it. 53 | 5. Else it will leave it blank and comment. (e.g. ` -- window_title = ""`) 54 | 6. Save into a new file with "_update" as the suffix. (e.g. en_update.lua) 55 | -------------------------------------------------------------------------------- /mods/braindance_protocol/lang/lang.lua: -------------------------------------------------------------------------------- 1 | return { 2 | { id = "en", name = "English" }, 3 | { id = "cn", name = "中文 (Chinese)"}, 4 | { id = "da", name = "Dansk (Danish)"}, 5 | { id = "ru", name = "Русский (Russian)"}, 6 | { id = "de", name = "Deutsch (German)"}, 7 | { id = "fr", name = "Français (French)"} 8 | } 9 | -------------------------------------------------------------------------------- /mods/braindance_protocol/lang/update.lua: -------------------------------------------------------------------------------- 1 | local function alignstr(str) -- for aligning the table in output files 2 | count = string.len(str) 3 | stime = 59 - count 4 | newstr = str 5 | for i = 1, stime do 6 | newstr = newstr.." " 7 | end 8 | return newstr 9 | end 10 | 11 | local function backup(lang) 12 | local filename = "lang/"..lang..".lua" 13 | local oldfile = "lang/"..lang.."_old.lua" 14 | local f = io.open(filename, "r") 15 | local data = f:read("*a") 16 | f:close() 17 | local f_backup = io.open(oldfile, "w") 18 | f_backup:write(data) 19 | f_backup:close() 20 | end 21 | 22 | local function update() 23 | local i18n_str = {} 24 | local i = 1 25 | -- read hotkeys.bindings into i18n_str 26 | local hotkeys = dofile("hotkeys") 27 | for _,v in ipairs(hotkeys.bindings) do 28 | i18n_str[i] = v.ID 29 | print(i..": "..i18n_str[i]) 30 | i = i + 1 31 | end 32 | 33 | -- scan ui for i18n strings 34 | local dir_content = dir("ui") 35 | for _,v in ipairs(dir_content) do 36 | if v.type == "file" and v.name:match(".lua$") then 37 | local ui_lua = io.open("ui/"..v.name, "r") 38 | local ui_lua_s = ui_lua:read("*a") 39 | for w in string.gmatch(ui_lua_s, [[i18n%("([^"]+)]]) do 40 | for t in pairs(i18n_str) do 41 | if w == i18n_str[t] then 42 | str_exsit = true 43 | else 44 | str_exsit = false 45 | end 46 | end 47 | if str_exsit ~= true then 48 | i18n_str[i] = w 49 | print(i..": "..i18n_str[i]) 50 | i = i + 1 51 | end 52 | end 53 | ui_lua:close() 54 | end 55 | end 56 | 57 | -- read protocols.Parents into i18n_str 58 | local protocols = dofile("protocols.lua") 59 | for t in pairs(protocols.Parents) do 60 | i18n_str[i] = "parent_"..protocols.Parents[t].id 61 | print(i..": "..i18n_str[i]) 62 | i = i + 1 63 | end 64 | -- read protocols.Items into i18n_str 65 | for t in pairs(protocols.Items) do 66 | i18n_str[i] = protocols.Items[t].name --name 67 | print(i..": "..i18n_str[i]) 68 | i = i + 1 69 | i18n_str[i] = protocols.Items[t].description --tip 70 | print(i..": "..i18n_str[i]) 71 | i = i + 1 72 | if protocols.Items[t].type == "Button" or protocols.Items[t].type == "Input" then --Button and Input 73 | i18n_str[i] = protocols.Items[t].button_label 74 | print(i..": "..i18n_str[i]) 75 | i = i + 1 76 | elseif protocols.Items[t].type == "Select" then --Select 77 | i18n_str[i] = protocols.Items[t].options 78 | print(i..": "..i18n_str[i]) 79 | i = i + 1 80 | elseif protocols.Items[t].type == "Toggle" then --Toggle 81 | i18n_str[i] = protocols.Items[t].button_label1 82 | print(i..": "..i18n_str[i]) 83 | i = i + 1 84 | i18n_str[i] = protocols.Items[t].button_label2 85 | print(i..": "..i18n_str[i]) 86 | i = i + 1 87 | end 88 | end 89 | --Done read all i18n strings into i18n_str 90 | 91 | -- Write into files. 92 | local languages = dofile("lang/lang.lua") 93 | for t in pairs(languages) do 94 | local lang = languages[t].id 95 | local old_en_file = dofile("lang/en.lua") 96 | local old_lang_file = dofile("lang/"..lang..".lua") 97 | backup(lang) 98 | local new_lang_file = io.open("lang/"..lang..".lua", "w") 99 | -- header 100 | new_lang_file:write("return {\n") 101 | new_lang_file:write(" "..lang.." = {\n") 102 | -- strings starts here 103 | for t in pairs(i18n_str) do 104 | if old_lang_file[lang][i18n_str[t]] then -- if this i18n string exists in the old lang file, copy it 105 | new_lang_file:write(" "..alignstr(i18n_str[t]).." = \"") 106 | new_lang_file:write(old_lang_file[lang][i18n_str[t]]:gsub("\"","\\\""):gsub("\0","\\0"):gsub("\n","\\n").."\"") 107 | elseif old_en_file.en[i18n_str[t]] then -- if this i18n string exists in the old en file, copy it and comment 108 | new_lang_file:write(" -- "..alignstr(i18n_str[t]).." = \"") 109 | new_lang_file:write(old_en_file.en[i18n_str[t]]:gsub("\"","\\\""):gsub("\0","\\0"):gsub("\n","\\n").."\"") 110 | else 111 | new_lang_file:write(" -- "..alignstr(i18n_str[t]).." = \"\"") -- else leave blank and comment 112 | end 113 | if t < i-1 then 114 | new_lang_file:write(" ,\n") 115 | else 116 | new_lang_file:write("\n") 117 | end 118 | end 119 | -- end 120 | new_lang_file:write(" }\n}") 121 | io.close(new_lang_file) 122 | end 123 | print("[BD] Language files updated..") 124 | end 125 | 126 | return update 127 | -------------------------------------------------------------------------------- /mods/braindance_protocol/options.lua: -------------------------------------------------------------------------------- 1 | local Options = { 2 | config_file = "config.json", 3 | fav_file = "favorites.json", 4 | config_value = {}, 5 | fav_value = {}, 6 | } 7 | local i18n = require("i18n") 8 | local protocols = require("protocols") 9 | 10 | function Options:loadfav() 11 | local f = io.open(self.fav_file, "r") 12 | if f then 13 | self.fav_value = json.decode(f:read("*a")) 14 | f:close() 15 | for _, v in ipairs(self.fav_value.hk) do 16 | for _, pv in ipairs(protocols.Items) do 17 | if pv.id == v then 18 | pv.hk = true 19 | end 20 | end 21 | end 22 | for _, v in ipairs(self.fav_value.fav) do 23 | for _, pv in ipairs(protocols.Items) do 24 | if pv.id == v then 25 | pv.fav = true 26 | end 27 | end 28 | end 29 | else 30 | self.fav_value = { 31 | hk = {}, 32 | fav = {} 33 | } 34 | self:savefav() 35 | end 36 | end 37 | 38 | function Options:savefav() 39 | local f = io.open(self.fav_file, "w") 40 | local jfav = json.encode(self.fav_value) 41 | f:write(jfav) 42 | f:close() 43 | end 44 | 45 | function Options:save() 46 | local f = io.open(self.config_file, "w") 47 | local jconfig = json.encode(self.config_value) 48 | f:write(jconfig) 49 | f:close() 50 | end 51 | 52 | function Options:load() 53 | local f = io.open(self.config_file, "r") 54 | if f then 55 | self.config_value = json.decode(f:read("*a")) 56 | f:close() 57 | if self.config_value.lang == nil then 58 | self.config_value.lang = "en" 59 | self:save() 60 | end 61 | else 62 | self.config_value = { lang = "en" } 63 | self:save() 64 | end 65 | if self.config_value.lang ~= "en" then 66 | i18n.loadFile("lang/en.lua") 67 | end 68 | i18n.loadFile("lang/"..self.config_value.lang..".lua") 69 | i18n.setLocale(self.config_value.lang) 70 | end 71 | 72 | function Options:setLang(language) 73 | i18n.loadFile("lang/"..language..".lua") 74 | i18n.setLocale(language) 75 | self.config_value.lang = language 76 | self:save() 77 | end 78 | 79 | function Options.removeOrinsert(tbl, value) 80 | local remove, pos 81 | for i, v in ipairs(tbl) do 82 | if v == value then 83 | remove = true 84 | pos = i 85 | end 86 | end 87 | if remove then 88 | table.remove(tbl, pos) 89 | else 90 | table.insert(tbl, value) 91 | end 92 | end 93 | 94 | return Options 95 | -------------------------------------------------------------------------------- /mods/braindance_protocol/player.lua: -------------------------------------------------------------------------------- 1 | local Player = {} 2 | 3 | function Player.SetLevel(name, value) 4 | Game.SetLevel(string.format("%s", name), value) 5 | end 6 | 7 | function Player.ModifyStat(name, value) 8 | Game.ModStatPlayer(string.format("%s", name), value) 9 | end 10 | 11 | function Player.AddStatModifier(name, value, modType) 12 | modType = modType or "Additive" 13 | 14 | Game.AddStatModifier(string.format("%s", name), value, modType) 15 | end 16 | 17 | return Player 18 | -------------------------------------------------------------------------------- /mods/braindance_protocol/ui/init.lua: -------------------------------------------------------------------------------- 1 | local ui = { 2 | search = require("ui/search"), 3 | searchbar = require("ui/searchbar"), 4 | searchlist = require("ui/searchlist"), 5 | list = require("ui/list") 6 | } 7 | local BD = require("BD") 8 | local fact = require("fact") 9 | local i18n = require("i18n") 10 | local CPS = require("CPStyling") 11 | 12 | function ui:Update() 13 | registerForEvent("onUpdate", function(deltaTime) 14 | 15 | self.searchbar.UpdateLang() 16 | 17 | self.list.UpdateItem() 18 | 19 | -- Ammo OnUpdate 20 | BD.Cheats.Ammo.OnUpdateAmmo(deltaTime) 21 | end) 22 | 23 | -- Open BDP with the CET console 24 | registerForEvent("onOverlayOpen", function() 25 | fact.GetValue() 26 | self.drawWindow = true 27 | end) 28 | 29 | registerForEvent("onOverlayClose", function() 30 | self.drawWindow = false 31 | end) 32 | 33 | end 34 | 35 | function ui:Draw() 36 | registerForEvent("onDraw", function() 37 | if self.drawWindow then 38 | CPS.setThemeBegin() 39 | CPS.styleBegin("WindowPadding", 5, 5) 40 | ImGui.SetNextWindowSize(400, 620) 41 | ImGui.SetNextWindowPos(self.wWidth-600, self.wHeight/2-180, ImGuiCond.FirstUseEver) 42 | self.drawWindow = ImGui.Begin(i18n("window_title"), true, ImGuiWindowFlags.NoResize) 43 | ImGui.Spacing() 44 | 45 | self.searchbar:Draw() 46 | self.searchbar.DrawLang() 47 | 48 | ImGui.Spacing() 49 | ImGui.Separator() 50 | 51 | -- List container 52 | local Childx, Childy = ImGui.GetContentRegionAvail() 53 | ImGui.BeginChild("List", Childx+6, Childy) 54 | 55 | if self.searchbar.text ~= "" then 56 | self.searchlist.Draw() 57 | elseif self.searchbar.draw_hklist then 58 | self.list.DrawHKlist() 59 | else 60 | self.list.DrawTree() 61 | end 62 | 63 | ImGui.EndChild() 64 | 65 | ImGui.End() 66 | CPS.styleEnd(1) 67 | CPS.setThemeEnd() 68 | end 69 | end) 70 | end 71 | 72 | return ui 73 | -------------------------------------------------------------------------------- /mods/braindance_protocol/ui/list.lua: -------------------------------------------------------------------------------- 1 | local i18n = require("i18n") 2 | local protocols = require("protocols") 3 | local widgets = require("ui/widgets") 4 | local Options = require("options") 5 | local CPS = require("CPStyling") 6 | local color = CPS.color 7 | 8 | local list = {} 9 | 10 | function list.DrawItem(item) 11 | local btnWidth = 135 12 | local text_hovered, fav_hovered, hk_hovered, list_hovered, fav_pressed, hk_pressed 13 | local draw_fav, draw_hk 14 | ImGui.Indent(3) 15 | ImGui.BeginGroup() 16 | if item.type == "Button" then 17 | item.press = CPS.CPButton(i18n(item.button_label), btnWidth, 0) 18 | elseif item.type == "Input" then 19 | ImGui.PushItemWidth(btnWidth*3/5-2) 20 | item.value = ImGui.InputInt("##input" , item.value, 0) 21 | ImGui.PopItemWidth() 22 | ImGui.SameLine(btnWidth*3/5) 23 | item.press = CPS.CPButton(i18n(item.button_label), btnWidth*2/5, 0) 24 | elseif item.type == "Toggle" then 25 | item.value, item.press = CPS.CPToggle( nil, i18n(item.button_label1), i18n(item.button_label2), item.value, btnWidth, 0) 26 | elseif item.type == "Select" then 27 | ImGui.PushItemWidth(btnWidth) 28 | item.value, item.press = ImGui.Combo("##select", item.value, i18n(item.options)) 29 | ImGui.PopItemWidth() 30 | end 31 | ImGui.SameLine() 32 | ImGui.Text(i18n(item.name)) 33 | text_hovered = ImGui.IsItemHovered() 34 | ImGui.EndGroup() 35 | ImGui.Unindent(3) 36 | 37 | local pminX, pminY = ImGui.GetItemRectMin() 38 | local pmaxX, pmaxY = ImGui.GetItemRectMax() 39 | local width = ImGui.GetWindowContentRegionWidth() 40 | local drawList = ImGui.GetForegroundDrawList() 41 | 42 | list_hovered = ImGui.IsMouseHoveringRect(pminX, pminY, pminX+width, pmaxY, true) 43 | 44 | if item.fav or list_hovered then 45 | draw_fav = true 46 | else 47 | draw_fav = false 48 | end 49 | if item.hk or list_hovered then 50 | draw_hk = true 51 | else 52 | draw_hk = false 53 | end 54 | 55 | if draw_hk then 56 | ImGui.SameLine(width - ImGui.GetFontSize()*2 -20) 57 | item.hk, hk_pressed = widgets.HKButton("hk", item.hk) 58 | hk_hovered = ImGui.IsItemHovered() 59 | end 60 | if draw_fav then 61 | ImGui.SameLine(width - ImGui.GetFontSize()- 15) 62 | item.fav, fav_pressed = widgets.StarButton("fav", item.fav) 63 | fav_hovered = ImGui.IsItemHovered() 64 | end 65 | 66 | if hk_pressed then Options.removeOrinsert(Options.fav_value.hk, item.id) end 67 | if fav_pressed then Options.removeOrinsert(Options.fav_value.fav, item.id) end 68 | 69 | if fav_hovered then 70 | ImGui.SetTooltip(i18n("button_addfav_tooltip")) 71 | elseif hk_hovered then 72 | ImGui.SetTooltip(i18n("button_addhk_tooltip")) 73 | elseif text_hovered then 74 | ImGui.SetTooltip(i18n(item.description)) 75 | end 76 | end 77 | 78 | function list.UpdateItem() 79 | for i in pairs(protocols.Items) do 80 | if protocols.Items[i].press then 81 | if protocols.Items[i].type ~= "Button" and protocols.Items[i].value ~= nil then 82 | protocols.Items[i].cmd(protocols.Items[i].value) 83 | else 84 | protocols.Items[i].cmd() 85 | end 86 | end 87 | end 88 | end 89 | 90 | function list.DrawTree() 91 | ImGui.SetNextItemOpen(true, ImGuiCond.FirstUseEver) 92 | CPS.colorBegin("Text" , color.white) 93 | CPS.colorBegin("Header", { 0.08, 0.08, 0.15, 0.8 }) 94 | local fav_open = ImGui.CollapsingHeader(i18n("header_fav")) 95 | CPS.colorEnd(2) 96 | if fav_open then 97 | for t,v in ipairs(protocols.Items) do 98 | if v.fav then 99 | ImGui.PushID("fav"..tostring(t)) 100 | list.DrawItem(v) 101 | ImGui.PopID() 102 | end 103 | end 104 | end 105 | 106 | for i,pv in ipairs(protocols.Parents) do 107 | if i < 2 then ImGui.SetNextItemOpen(true, ImGuiCond.FirstUseEver) end 108 | CPS.colorBegin("Text" , color.white) 109 | CPS.colorBegin("Header", { 0.08, 0.08, 0.15, 0.8 }) 110 | local headerOpen = ImGui.CollapsingHeader(i18n(pv.name)) 111 | CPS.colorEnd(2) 112 | if headerOpen then 113 | for t,iv in ipairs(protocols.Items) do 114 | if iv.parent == pv.id and iv.fav ~= true then 115 | ImGui.PushID(iv.parent..tostring(t)) 116 | list.DrawItem(iv) 117 | ImGui.PopID() 118 | end 119 | end 120 | end 121 | end 122 | end 123 | 124 | function list.DrawHKlist() 125 | local hk_list = {} 126 | for _,v in ipairs(protocols.Items) do 127 | if v.hk then 128 | table.insert(hk_list, v) 129 | end 130 | end 131 | if #hk_list == 0 then 132 | ImGui.Indent(3) 133 | ImGui.Text(i18n("text_hklist_none")) 134 | ImGui.Unindent(3) 135 | else 136 | for i,v in ipairs(hk_list) do 137 | ImGui.PushID(i) 138 | list.DrawItem(v) 139 | ImGui.PopID() 140 | end 141 | end 142 | end 143 | 144 | return list 145 | -------------------------------------------------------------------------------- /mods/braindance_protocol/ui/search.lua: -------------------------------------------------------------------------------- 1 | local protocols = require("protocols") 2 | local i18n = require("i18n") 3 | local search = { 4 | result = {} 5 | } 6 | 7 | function search:query(keyword) 8 | self.result = {} 9 | if string.len(keyword) >= 2 then 10 | for _,v in ipairs(protocols.Items) do 11 | local name = i18n(v.name):lower() 12 | local description = i18n(v.description):lower() 13 | local keyword = keyword:lower() 14 | if name:match(keyword) or description:match(keyword) then 15 | table.insert(self.result, v) 16 | end 17 | end 18 | end 19 | end 20 | 21 | function search:clear() 22 | self.result = {} 23 | end 24 | 25 | return search 26 | -------------------------------------------------------------------------------- /mods/braindance_protocol/ui/searchbar.lua: -------------------------------------------------------------------------------- 1 | local CPS = require("CPStyling") 2 | local theme = CPS.theme 3 | local search = require("ui/search") 4 | local i18n = require("i18n") 5 | local languages = require("lang/lang") 6 | local langUpdate = require("lang/update") 7 | local Options = require("options") 8 | local widgets = require("ui/widgets") 9 | 10 | local searchbar = { 11 | seleted = false, 12 | textbefore = "", 13 | text = "", 14 | draw_hklist = false, 15 | } 16 | 17 | function searchbar:onTextChange() 18 | if self.seleted and self.textbefore ~= self.text then 19 | self.textbefore = self.text 20 | return true 21 | else 22 | return false 23 | end 24 | end 25 | 26 | function searchbar:Draw() 27 | local winWidth = ImGui.GetWindowSize() 28 | ImGui.Indent(3) 29 | ImGui.PushItemWidth(winWidth*0.7) 30 | self.text, self.seleted = ImGui.InputTextWithHint("##searchbar", i18n("searchbar_hint"), self.text, 20) 31 | ImGui.PopItemWidth() 32 | if self.text ~= "" then 33 | ImGui.SetItemAllowOverlap() 34 | ImGui.SameLine(winWidth*0.7 - ImGui.CalcTextSize("X")-4) 35 | CPS.colorBegin("Button", theme.Hidden) 36 | if ImGui.Button("X") then 37 | self.text = "" 38 | search:clear() 39 | end 40 | CPS.colorEnd(1) 41 | end 42 | ImGui.SameLine(winWidth*0.7 + 15) 43 | self.draw_hklist = widgets.HKButton("hklist", self.draw_hklist) 44 | if ImGui.IsItemHovered() then 45 | ImGui.SetTooltip(i18n("button_toggle_hklist_tooltip")) 46 | end 47 | ImGui.Unindent(3) 48 | if self:onTextChange() then 49 | search:query(self.text) 50 | end 51 | end 52 | 53 | function searchbar.DrawLang() 54 | local winWidth = ImGui.GetWindowSize() 55 | ImGui.SameLine(winWidth - ImGui.CalcTextSize(i18n("button_language")) - 10) 56 | ImGui.Text(i18n("button_language")) 57 | if ImGui.IsItemHovered() then 58 | ImGui.SetTooltip(i18n("button_language_tooltip")) 59 | end 60 | if ImGui.IsItemClicked() then 61 | ImGui.OpenPopup("Language") 62 | end 63 | if ImGui.BeginPopup("Language") then 64 | if Options.config_value.debug then 65 | if ImGui.Button(i18n("button_update_lang")) then 66 | langUpdate() 67 | end 68 | end 69 | for l in pairs(languages) do 70 | languages[l].selLang = ImGui.Selectable(languages[l].name, false) 71 | end 72 | ImGui.EndPopup() 73 | end 74 | end 75 | 76 | function searchbar.UpdateLang() 77 | for l in pairs(languages) do 78 | if languages[l].selLang then 79 | Options:setLang(languages[l].id) 80 | languages[l].selLang = false 81 | end 82 | end 83 | end 84 | 85 | return searchbar 86 | -------------------------------------------------------------------------------- /mods/braindance_protocol/ui/searchlist.lua: -------------------------------------------------------------------------------- 1 | local i18n = require("i18n") 2 | local CPS = require("CPStyling") 3 | local search = require("ui/search") 4 | local list = require("ui/list") 5 | local searchlist = {} 6 | 7 | function searchlist:Update() 8 | for i,v in ipairs(search.result) do 9 | if v.press then 10 | if v.type ~= "Button" and v.value ~= nil then 11 | v.cmd(v.value) 12 | else 13 | v.cmd() 14 | end 15 | end 16 | end 17 | end 18 | 19 | function searchlist:Draw() 20 | if #search.result == 0 then 21 | ImGui.Indent(3) 22 | ImGui.Text(i18n("text_searchlist_no_result")) 23 | ImGui.Unindent(3) 24 | else 25 | for i,v in ipairs(search.result) do 26 | ImGui.PushID(i) 27 | list.DrawItem(v) 28 | ImGui.PopID() 29 | end 30 | end 31 | end 32 | 33 | return searchlist 34 | -------------------------------------------------------------------------------- /mods/braindance_protocol/ui/widgets.lua: -------------------------------------------------------------------------------- 1 | local widgets = {} -- Needs clean up 2 | 3 | local function getoutercorner(radius, centerX, centerY) 4 | local outer_corner = {} 5 | for i = 0, 4 do 6 | local angle = (2*i+1)*math.pi/5 7 | local x = radius * math.sin(angle) + centerX 8 | local y = radius * math.cos(angle) + centerY 9 | local point = {x = x, y = y} 10 | table.insert(outer_corner, point) 11 | end 12 | return outer_corner 13 | end 14 | 15 | local function getline(p1, p2) 16 | local a = (p2.y - p1.y) / (p2.x - p1.x) 17 | local b = p1.y - a * p1.x 18 | return {a = a, b = b} 19 | end 20 | 21 | local function getintersection(line1, line2) 22 | local x = (line2.b - line1.b) / (line1.a - line2.a) 23 | local y = line1.a * x + line1.b 24 | return {x = x, y = y} 25 | end 26 | 27 | local function getinnercorner(outer_corner) 28 | local innercorner = {} 29 | local function getnext(p) 30 | local p1, p2 31 | if p - 1 < 1 then 32 | p1 = p - 1 + 5 33 | else 34 | p1 = p - 1 35 | end 36 | if p1 + 2 > 5 then 37 | p2 = p1 + 2 - 5 38 | else 39 | p2 = p1 + 2 40 | end 41 | return p1, p2 42 | end 43 | 44 | for i = 1, 5 do 45 | local p1, p2, p3, p4, line1, line2 46 | p1, p2 = getnext(i) 47 | p3, p4 = getnext(i+1) 48 | line1 = getline(outer_corner[p1], outer_corner[p2]) 49 | line2 = getline(outer_corner[p3], outer_corner[p4]) 50 | point = getintersection(line1, line2) 51 | table.insert(innercorner, point) 52 | end 53 | return innercorner 54 | end 55 | 56 | local function AddStarFilled(drawList, radius, centerX, centerY, color) 57 | local outer_corner = getoutercorner(radius, centerX, centerY) 58 | local innercorner = getinnercorner(outer_corner) 59 | ImGui.ImDrawListAddTriangleFilled(drawList, outer_corner[1].x, outer_corner[1].y, outer_corner[3].x, outer_corner[3].y, innercorner[3].x, innercorner[3].y, color) 60 | ImGui.ImDrawListAddTriangleFilled(drawList, outer_corner[1].x, outer_corner[1].y, innercorner[3].x, innercorner[3].y, outer_corner[4].x, outer_corner[4].y, color) 61 | ImGui.ImDrawListAddTriangleFilled(drawList, innercorner[1].x, innercorner[1].y, outer_corner[2].x, outer_corner[2].y, innercorner[2].x, innercorner[2].y, color) 62 | ImGui.ImDrawListAddTriangleFilled(drawList, innercorner[5].x, innercorner[5].y, innercorner[4].x, innercorner[4].y, outer_corner[5].x, outer_corner[5].y, color) 63 | end 64 | 65 | local function AddStar(drawList, radius, centerX, centerY, color, thickness) 66 | local outer_corner = getoutercorner(radius, centerX, centerY) 67 | local innercorner = getinnercorner(outer_corner) 68 | for i = 1, 5 do 69 | local t 70 | if i + 1 > 5 then 71 | t = i - 4 72 | else 73 | t = i + 1 74 | end 75 | ImGui.ImDrawListAddLine(drawList, outer_corner[i].x, outer_corner[i].y, innercorner[i].x, innercorner[i].y, color, thickness) 76 | ImGui.ImDrawListAddLine(drawList, innercorner[i].x, innercorner[i].y, outer_corner[t].x, outer_corner[t].y, color, thickness) 77 | end 78 | end 79 | 80 | local function AddKeyPressIcon(drawList, size, posX, posY, color, thickness) 81 | local lines = { 82 | { {x = posX, y = posY - size * 0.2 + size}, {x = posX + size, y = posY - size * 0.2 + size} }, 83 | { {x = posX + size * 1/4, y = posY - size * 0.2 + size * 4/5}, {x = posX + size * 3/4, y = posY - size * 0.2 + size * 4/5} }, 84 | { {x = posX + size * 1/4, y = posY - size * 0.2 + size * 4/5}, {x = posX + size * 1/5, y = posY - size * 0.2 + size} }, 85 | { {x = posX + size * 3/4, y = posY - size * 0.2 + size * 4/5}, {x = posX + size * 4/5, y = posY - size * 0.2 + size} }, 86 | { {x = posX + size * 1/2, y = posY - size * 0.2 + size * 2/7}, {x = posX + size * 1/2, y = posY - size * 0.2 + size * 2/3} }, 87 | { {x = posX + size * 1/2, y = posY - size * 0.2 + size * 2/3}, {x = posX + size * 1/3, y = posY - size * 0.2 + size * 1/2} }, 88 | { {x = posX + size * 1/2, y = posY - size * 0.2 + size * 2/3}, {x = posX + size * 2/3, y = posY - size * 0.2 + size * 1/2} } 89 | } 90 | for _,v in ipairs(lines) do 91 | ImGui.ImDrawListAddLine(drawList, v[1].x, v[1].y, v[2].x, v[2].y, color, thickness) 92 | end 93 | end 94 | 95 | function widgets.HKButton(str_id, value, size) 96 | local drawList = ImGui.GetWindowDrawList() 97 | local winX, winY = ImGui.GetWindowPos() 98 | local cursorX, cursorY = ImGui.GetCursorPos() 99 | local scrollX = ImGui.GetScrollX() 100 | local scrollY = ImGui.GetScrollY() 101 | local color 102 | if size == 0 or size == nil then 103 | size = ImGui.GetFontSize() + 4 104 | end 105 | local posX = winX + cursorX - scrollX 106 | local posY = winY + cursorY - scrollY 107 | local pressed = ImGui.InvisibleButton(str_id, size, size) 108 | local active = ImGui.IsItemActive() 109 | local hovered = ImGui.IsItemHovered() 110 | if pressed then 111 | if value == nil then 112 | value = true 113 | else 114 | value = not value 115 | end 116 | end 117 | if active then 118 | color = 0xFF00FFFF 119 | elseif hovered then 120 | color = 0xFF009696 121 | elseif value then 122 | color = 0xFF00FFFF 123 | else 124 | color = 0xFF6B6B6B 125 | end 126 | AddKeyPressIcon(drawList, size, posX, posY, color, 2) 127 | return value, pressed 128 | end 129 | 130 | function widgets.StarButton(str_id, value, size) 131 | local drawList = ImGui.GetWindowDrawList() 132 | local winX, winY = ImGui.GetWindowPos() 133 | local cursorX, cursorY = ImGui.GetCursorPos() 134 | local scrollX = ImGui.GetScrollX() 135 | local scrollY = ImGui.GetScrollY() 136 | local color 137 | if size == 0 or size == nil then 138 | size = ImGui.GetFontSize() + 4 139 | end 140 | local posX = winX + cursorX + size/2 - scrollX 141 | local posY = winY + cursorY + size/2 - scrollY 142 | local pressed = ImGui.InvisibleButton(str_id, size, size) 143 | local active = ImGui.IsItemActive() 144 | local hovered = ImGui.IsItemHovered() 145 | if pressed then 146 | if value == nil then 147 | value = true 148 | else 149 | value = not value 150 | end 151 | end 152 | if active then 153 | color = 0xFF00FFFF 154 | elseif hovered then 155 | color = 0xFF009696 156 | elseif value then 157 | color = 0xFF00FFFF 158 | else 159 | color = 0xFF6B6B6B 160 | end 161 | AddStarFilled(drawList, size/2, posX, posY, color) 162 | return value, pressed 163 | end 164 | 165 | return widgets 166 | -------------------------------------------------------------------------------- /mods/braindance_protocol/utility.lua: -------------------------------------------------------------------------------- 1 | local Utilities = {} 2 | 3 | function Utilities.FinishProtocol(name) 4 | print(string.format("[BD] Finished Protocol: %s", name)) 5 | end 6 | 7 | function Utilities.DumpObject(obj, path) 8 | local dump = tostring(Dump(obj)) 9 | local output = io.open(path or "output.txt", "w") 10 | 11 | print(dump) 12 | 13 | output:write(dump) 14 | output:close() 15 | end 16 | 17 | return Utilities 18 | -------------------------------------------------------------------------------- /mods/braindance_protocol/utility/shopper.lua: -------------------------------------------------------------------------------- 1 | local Shopper = {} 2 | 3 | local Utilities = require("utility") 4 | local Inventory = require("inventory") 5 | 6 | -- Sell value is constant for each 'junk' item type available 7 | local price = { 8 | junk = 3, 9 | alcohol = 30, 10 | jewellery = 750 11 | } 12 | 13 | -- Temporary storage until proper collection of item hashes/names/etc. is added. 14 | local items = { 15 | alcohol = { 16 | "Items.Alcohol", -- Unnamed [generic alcohol] 17 | "Items.GoodQualityAlcohol", -- Unnamed [generic alcohol] 18 | "Items.GoodQualityAlcohol1", -- Donaghy's 19 | "Items.GoodQualityAlcohol2", -- Centzon Totochtin 20 | "Items.GoodQualityAlcohol3", -- Randver 21 | "Items.GoodQualityAlcohol4", -- AB-Synth 22 | "Items.GoodQualityAlcohol5", -- Champaradise 23 | "Items.GoodQualityAlcohol6", -- La Perle Des Alpes 24 | "Items.LowQualityAlcohol", -- Unnamed [generic alcohol] 25 | "Items.LowQualityAlcohol1", -- Abydos Classic 26 | "Items.LowQualityAlcohol2", -- Abydos King Size 27 | "Items.LowQualityAlcohol3", -- Broseph Ale 28 | "Items.LowQualityAlcohol4", -- Broseph Lager 29 | "Items.LowQualityAlcohol5", -- 21st Stout 30 | "Items.LowQualityAlcohol6", -- Bumelant 31 | "Items.LowQualityAlcohol7", -- Chirrisco 32 | "Items.LowQualityAlcohol8", -- Pitorro 33 | "Items.LowQualityAlcohol9", -- Tequila Especial 34 | "Items.MediumQualityAlcohol", -- Unnamed [generic alcohol] 35 | "Items.MediumQualityAlcohol1", -- Pingo Pálido 36 | "Items.MediumQualityAlcohol2", -- O'Dockin Whiskey 37 | "Items.MediumQualityAlcohol3", -- Bolshevik Vodka 38 | "Items.MediumQualityAlcohol4", -- Conine 39 | "Items.MediumQualityAlcohol5", -- Joe Tiel's Okie Hooch 40 | "Items.MediumQualityAlcohol6", -- Papa Garcin 41 | "Items.MediumQualityAlcohol7", -- Blue Grass 42 | "Items.NomadsAlcohol1", -- Moonshine 43 | "Items.NomadsAlcohol2", -- Trailerbrew Beer 44 | "Items.TopQualityAlcohol", -- Unnamed [generic alcohol] 45 | "Items.TopQualityAlcohol1", -- Calavera Feliz 46 | "Items.TopQualityAlcohol2", -- Chateau Delen 2012 47 | "Items.TopQualityAlcohol3", -- Armagnac Massy 48 | "Items.TopQualityAlcohol4", -- Sake Utagawa 49 | "Items.TopQualityAlcohol5", -- Baalbek Arak 50 | "Items.TopQualityAlcohol6", -- Romvlvs Gin 51 | "Items.TopQualityAlcohol7" -- Paul Night 52 | }, 53 | junk = { 54 | "Items.AnimalsJunkItem1", -- Broken Metal Fangs 55 | "Items.AnimalsJunkItem2", -- Grappling Gloves 56 | "Items.AnimalsJunkItem3", -- Jaguar Patch 57 | "Items.CasinoJunkItem1", -- Dice 58 | "Items.CasinoJunkItem2", -- Joker 59 | "Items.CasinoJunkItem3", -- Cards 60 | "Items.CasinoPoorJunkItem1", -- Damaged Poker Chip 61 | "Items.CasinoPoorJunkItem2", -- Drink Umbrella 62 | "Items.CasinoPoorJunkItem3", -- Ashtray 63 | "Items.CasinoRichJunkItem1", -- Cufflinks 64 | "Items.CasinoRichJunkItem2", -- NCU Signet Ring 65 | "Items.CasinoRichJunkItem3", -- Cigar 66 | "Items.GenericCorporationJunkItem1", -- Stress ball 67 | "Items.GenericCorporationJunkItem2", -- Stapler 68 | "Items.GenericCorporationJunkItem3", -- Hygiene Bag 69 | "Items.GenericCorporationJunkItem4", -- NDA 70 | "Items.GenericCorporationJunkItem5", -- Drip Coffee Maker 71 | "Items.GenericGangJunkItem1", -- Golden Chain 72 | "Items.GenericGangJunkItem2", -- Tatoo Needle 73 | "Items.GenericGangJunkItem3", -- Lighter 74 | "Items.GenericGangJunkItem4", -- Counterfit Documents 75 | "Items.GenericGangJunkItem5", -- Bloody Knife 76 | "Items.GenericJunkItem1", -- Vinyl Record 77 | "Items.GenericJunkItem10", -- Rosary 78 | "Items.GenericJunkItem11", -- Voodoo Rosary 79 | "Items.GenericJunkItem12", -- Spray Paint 80 | "Items.GenericJunkItem13", -- Spray Paint 81 | "Items.GenericJunkItem14", -- Lottery Scratchcard 82 | "Items.GenericJunkItem15", -- Hair Wax 83 | "Items.GenericJunkItem16", -- Perfume 84 | "Items.GenericJunkItem17", -- Perfume 85 | "Items.GenericJunkItem18", -- Medical Forceps 86 | "Items.GenericJunkItem19", -- Surgical Scissors 87 | "Items.GenericJunkItem2", -- Vinyl Record 88 | "Items.GenericJunkItem20", -- Pack of Cards 89 | "Items.GenericJunkItem21", -- Pack of Cards 90 | "Items.GenericJunkItem22", -- Pipe 91 | "Items.GenericJunkItem23", -- Pack of Cigarettes 92 | "Items.GenericJunkItem24", -- Pack of Cigarettes 93 | "Items.GenericJunkItem25", -- Cube 94 | "Items.GenericJunkItem26", -- Candles 95 | "Items.GenericJunkItem27", -- Incense 96 | "Items.GenericJunkItem28", -- Condoms 97 | "Items.GenericJunkItem29", -- Bubble Gum 98 | "Items.GenericJunkItem3", -- Vinyl Record 99 | "Items.GenericJunkItem30", -- Bubble Gum 100 | "Items.GenericJunkItem4", -- Medical Gauze 101 | "Items.GenericJunkItem5", -- Guitar Pick 102 | "Items.GenericJunkItem6", -- Ritual Bowl 103 | "Items.GenericJunkItem7", -- Flare 104 | "Items.GenericJunkItem8", -- Hand Fan 105 | "Items.GenericJunkItem9", -- Hand Fan 106 | "Items.GenericPoorJunkItem1", -- Disinfectant 107 | "Items.GenericPoorJunkItem2", -- Old Can 108 | "Items.GenericPoorJunkItem3", -- Glow Stick 109 | "Items.GenericPoorJunkItem4", -- Damaged Clothes 110 | "Items.GenericPoorJunkItem5", -- Spray Paint 111 | "Items.GenericRichJunkItem1", -- Champagne Bucket 112 | "Items.GenericRichJunkItem2", -- Abstract Painting 113 | "Items.GenericRichJunkItem3", -- Cashmere Wool 114 | "Items.GenericRichJunkItem4", -- Cheese Knives 115 | "Items.GenericRichJunkItem5", -- Crystal Decanter 116 | "Items.Junk", -- Moldy SYN-Cheese [generic junk] 117 | "Items.JunkLargeSize", -- Moldy SYN-Cheese [generic junk] 118 | "Items.JunkMediumSize", -- Moldy SYN-Cheese [generic junk] 119 | "Items.JunkSmallSize", -- Moldy SYN-Cheese [generic junk] 120 | "Items.MaelstromJunkItem1", -- Subdermal LED Diodes 121 | "Items.MaelstromJunkItem2", -- Soldering Iron 122 | "Items.MaelstromJunkItem3", -- Broken Eye Implant 123 | "Items.MilitechJunkItem1", -- Thigh Holster 124 | "Items.MilitechJunkItem2", -- Military Pocket Knife 125 | "Items.MilitechJunkItem3", -- Digital Compass 126 | "Items.MoxiesJunkItem1", -- Fluorescent Lipstick 127 | "Items.MoxiesJunkItem2", -- Torn Fishnets 128 | "Items.MoxiesJunkItem3", -- Condom 129 | "Items.NomadsJunkItem1", -- Brake Fluid 130 | "Items.NomadsJunkItem2", -- NUSA Map 131 | "Items.NomadsJunkItem3", -- Mess Kit 132 | "Items.ScavengersJunkItem1", -- Dull Scalpel 133 | "Items.ScavengersJunkItem2", -- Handcuffs 134 | "Items.ScavengersJunkItem3", -- Used AirHypo 135 | "Items.SexToyJunkItem1", -- Gag 136 | "Items.SexToyJunkItem2", -- Studded Dildo 137 | "Items.SexToyJunkItem3", -- Pilomancer 3000 138 | "Items.SexToyJunkItem4", -- Trans-Anal EXXXpress 139 | "Items.SexToyJunkItem5", -- Protector 140 | "Items.SexToyJunkItem6", -- Luv Compartment 141 | "Items.SixthStreetJunkItem1", -- NUSA Pin 142 | "Items.SixthStreetJunkItem2", -- Shortwave Transmitter 143 | "Items.SixthStreetJunkItem3", -- Military Canteen 144 | "Items.SouvenirJunkItem1", -- Postcard from Night City 145 | "Items.SouvenirJunkItem2", -- Souvenir Magnet 146 | "Items.SouvenirJunkItem3", -- Shell Casing Keychain 147 | "Items.SouvenirJunkItem4", -- Souvenir License Plate 148 | "Items.TygerClawsJunkItem1", -- Omamori 149 | "Items.TygerClawsJunkItem2", -- Chopsticks 150 | "Items.TygerClawsJunkItem3", -- Hanafuda Cards 151 | "Items.ValentinosJunkItem1", -- Hair Gel 152 | "Items.ValentinosJunkItem2", -- Calavera 153 | "Items.ValentinosJunkItem3", -- Decorative Spoon 154 | "Items.VoodooBoysJunkItem1", -- Shard with LOA Symbols 155 | "Items.VoodooBoysJunkItem2", -- Luminescent Chalk 156 | "Items.VoodooBoysJunkItem3", -- Candle 157 | "Items.WraithsJunkItem1", -- Tire Iron 158 | "Items.WraithsJunkItem2", -- Bloody Bandage 159 | "Items.WraithsJunkItem3" -- Turquoise Hair Dye 160 | }, 161 | jewellery = { 162 | "Items.AnimalsJewellery", -- Bottlecap on a String [generic jewellery] 163 | "Items.AnimalsJewellery1", -- Syn-Fang Necklace 164 | "Items.AnimalsJewellery2", -- Leather Bracelete 165 | "Items.AnimalsJewellery3", -- Studded Chocker 166 | "Items.HighQualityJewellery", -- Bottlecap on a String [generic jewellery] 167 | "Items.HighQualityJewellery1", -- Silver Watch 168 | "Items.HighQualityJewellery2", -- Raven Skull Pendant 169 | "Items.HighQualityJewellery3", -- Wooden Beads 170 | "Items.HighQualityJewellery4", -- Shell Ring 171 | "Items.HighQualityJewellery5", -- Titanium Ring 172 | "Items.Jewellery", -- Bottlecap on a String [generic jewellery] 173 | "Items.LowQualityJewellery", -- Bottlecap on a String [generic jewellery] 174 | "Items.LowQualityJewellery1", -- Bullet Pendant 175 | "Items.LowQualityJewellery2", -- Cable Necklace 176 | "Items.LowQualityJewellery3", -- Plastic Beads 177 | "Items.LowQualityJewellery4", -- Nut Ring 178 | "Items.LowQualityJewellery5", -- PCB Earrings 179 | "Items.MediumQualityJewellery", -- Bottlecap on a String [generic jewellery] 180 | "Items.MediumQualityJewellery1", -- Dog Tag 181 | "Items.MediumQualityJewellery2", -- Brass Earrings 182 | "Items.MediumQualityJewellery3", -- Led Bracelets 183 | "Items.MediumQualityJewellery4", -- Velver O'Ring Choker 184 | "Items.MediumQualityJewellery5", -- Hairpin with Bow 185 | "Items.TygerClawsJewellery", -- Bottlecap on a String [generic jewellery] 186 | "Items.TygerClawsJewellery1", -- Silver Wrap Earrings 187 | "Items.TygerClawsJewellery2", -- Yin Yang Medalion 188 | "Items.TygerClawsJewellery3", -- Kanji Pendant 189 | "Items.ValentinosJewellery", -- Bottlecap on a String [generic jewellery] 190 | "Items.ValentinosJewellery1", -- Santa Muerte Brooch 191 | "Items.ValentinosJewellery2", -- Unknown [Cannot be spawned] 192 | "Items.ValentinosJewellery3", -- Skull Ring 193 | "Items.ValentinosJewellery4", -- Gold Cross 194 | "Items.ValentinosJewellery5" -- Signet Ring with Initials 195 | } 196 | } 197 | 198 | local sellItems = function(verboseType) 199 | -- Get required utils 200 | local player = Game.GetPlayer() 201 | local transactionSystem = Game.GetTransactionSystem() 202 | 203 | -- Remove all provided items 204 | local totalItemCount = 0 205 | for _, item in ipairs(items[verboseType]) do 206 | local itemTDBID = TweakDBID.new(item) 207 | local itemID = ItemID.new(itemTDBID) 208 | local currentItemCount = transactionSystem:GetItemQuantity(player, itemID) 209 | transactionSystem:RemoveItem(player, itemID, currentItemCount) 210 | totalItemCount = totalItemCount + currentItemCount 211 | end 212 | 213 | -- Add appropriate amount of Eddies 214 | local moneyGained = 0 215 | if totalItemCount > 0 then 216 | moneyGained = (price[verboseType] or price["junk"]) * totalItemCount 217 | Inventory.AddItem("money", moneyGained) 218 | end 219 | 220 | -- Print debug info 221 | print("Sold", totalItemCount, verboseType, "items. Total amount sent to your account:", moneyGained, "Eddies!") 222 | end 223 | 224 | function Shopper.SellJunk() 225 | -- Initialize protocol 226 | local moduleName = "The Trash Man" 227 | 228 | -- Execute generic selling logic for selected item type 229 | sellItems("junk") 230 | 231 | -- End of protocol 232 | Utilities.FinishProtocol(moduleName) 233 | end 234 | 235 | function Shopper.SellAlcohol() 236 | -- Initialize protocol 237 | local moduleName = "Mercenaries Anonymous" 238 | 239 | -- Execute generic selling logic 240 | sellItems("alcohol") 241 | 242 | -- End of protocol 243 | Utilities.FinishProtocol(moduleName) 244 | end 245 | 246 | function Shopper.SellJewellery() 247 | -- Initialize protocol 248 | local moduleName = "The Jewel Store Job" 249 | 250 | -- Execute generic selling logic 251 | sellItems("jewellery") 252 | 253 | -- End of protocol 254 | Utilities.FinishProtocol(moduleName) 255 | end 256 | 257 | function Shopper.SellAllUselessItems() 258 | -- Initialize protocol 259 | local moduleName = "V's Cleanup Detail" 260 | 261 | -- Execute generic selling logic for selected item type 262 | sellItems("junk") 263 | sellItems("alcohol") 264 | sellItems("jewellery") 265 | 266 | -- End of protocol 267 | Utilities.FinishProtocol(moduleName) 268 | end 269 | 270 | return Shopper 271 | -------------------------------------------------------------------------------- /tools/cybermods.sh: -------------------------------------------------------------------------------- 1 | root=$PWD 2 | archive="bd_cybermods.zip" 3 | 4 | rm -f builds/$archive 5 | mkdir -p builds/ 6 | 7 | zip -r builds/$archive mods/braindance_protocol icon.png README.md manifest.json 8 | 9 | -------------------------------------------------------------------------------- /tools/nexus.sh: -------------------------------------------------------------------------------- 1 | root=$PWD 2 | tmp=".nexus" 3 | archive="bd_nexus.zip" 4 | nmm="bin/x64/plugins/cyber_engine_tweaks/mods" 5 | 6 | rm -f builds/$archive 7 | mkdir -p builds/$tmp/$nmm 8 | 9 | cp -r mods/braindance_protocol builds/$tmp/$nmm 10 | 11 | cd builds/$tmp && zip -r $root/builds/$archive $nmm 12 | cd $root && zip -r builds/$archive LICENSE 13 | 14 | # Cleanup 15 | rm -rf $root/builds/$tmp 16 | --------------------------------------------------------------------------------