forked from Bob-Murphy/A3-Antistasi-1.4
-
-
Notifications
You must be signed in to change notification settings - Fork 156
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Garage Sell Button #3237
Merged
Bob-Murphy
merged 14 commits into
official-antistasi-community:unstable
from
Tiny-DM:vehicle-sell-button
May 17, 2024
Merged
Garage Sell Button #3237
Changes from 13 commits
Commits
Show all changes
14 commits
Select commit
Hold shift + click to select a range
836a24f
initial commit (BROKEN)
Tiny-DM 9bc0b24
main dev done (BROKEN)
Tiny-DM 9562700
Merge remote-tracking branch 'upstream/unstable' into vehicle-sell-bu…
Tiny-DM 179f995
somewhat working now (BROKEN)
Tiny-DM df90bad
update (WORKING, MINOR BUGS)
Tiny-DM d52908e
Update .gitignore
Tiny-DM 8df99ed
completed (WORKING, RDY)
Tiny-DM e721688
Update fn_sellVehGRG.sqf
Tiny-DM ca4e864
updated all files according to John
Tiny-DM fbd973a
fix antistasi/garage seperation
Tiny-DM fea3471
add header + remove param
Tiny-DM 0f842cb
Merge branch 'unstable' into vehicle-sell-button
Tiny-DM 006b949
typo fixes
Tiny-DM 2d54a63
Remove dead code from garage sell vehicle display refresh
jaj22 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,94 @@ | ||
/* | ||
Author: Tiny | ||
Description | ||
Get a valid sell price for a given vehicle | ||
|
||
Arguments: | ||
0. <OBJECT, STRING> Vehicle object / vehicle class | ||
|
||
Return Value: | ||
<INT> Sell price. 0 if invalid or otherwise not found. | ||
|
||
Scope: Any | ||
Environment: Any | ||
Public: Yes | ||
Dependencies: | ||
|
||
Example: [_vehicle] call A3A_getVehicleSellPrice | ||
*/ | ||
|
||
#include "..\..\script_component.hpp" | ||
FIX_LINE_NUMBERS() | ||
|
||
#define OccAndInv(VAR) (FactionGet(occ, VAR) + FactionGet(inv, VAR)) | ||
|
||
params ["_veh"]; | ||
|
||
/* | ||
Blacklisted Assets | ||
|
||
The array below contains classnames of assets which are not allowed to be sold within Antistasi. | ||
Reason for this is that those items are one or more of the following: | ||
- can be aquired by means that don't cost anything and the ability to sell those would be an infinite money exploit. | ||
- are no proper "statics" in terms of weaponized statics but for example the ACE spotting scoped | ||
- something else | ||
*/ | ||
private _blacklistedAssets = [ | ||
"ACE_I_SpottingScope","ACE_O_SpottingScope","ACE_O_T_SpottingScope","ACE_B_SpottingScope","ACE_B_T_SpottingScope","ACE_SpottingScopeObject", | ||
"O_Static_Designator_02_F","B_Static_Designator_01_F","B_W_Static_Designator_01_F", | ||
"vn_o_nva_spiderhole_01","vn_o_nva_spiderhole_02","vn_o_nva_spiderhole_03", | ||
"vn_o_pl_spiderhole_01","vn_o_pl_spiderhole_02","vn_o_pl_spiderhole_03", | ||
"vn_o_vc_spiderhole_01","vn_o_vc_spiderhole_02","vn_o_vc_spiderhole_03"]; | ||
|
||
private _typeX = if (_veh isEqualType objNull) then {typeOf _veh} else {_veh}; | ||
|
||
if (_typeX in _blacklistedAssets) exitWith {0}; | ||
|
||
if (_veh isKindOf "StaticWeapon") exitWith {100}; // in case rebel static is same as enemy statics | ||
|
||
if (_typeX in FactionGet(all,"vehiclesReb")) exitWith { ([_typeX] call A3A_fnc_vehiclePrice) / 2 }; | ||
|
||
if ( | ||
(_typeX in arrayCivVeh) | ||
or (_typeX in civBoats) | ||
or (_typeX in (FactionGet(reb,"vehiclesCivBoat") + FactionGet(reb,"vehiclesCivCar") + FactionGet(reb,"vehiclesCivTruck"))) | ||
) exitWith {25}; | ||
|
||
if ( | ||
(_typeX in FactionGet(all,"vehiclesLight")) | ||
or (_typeX in OccAndInv("vehiclesTrucks")) | ||
or (_typeX in OccAndInv("vehiclesCargoTrucks")) | ||
or (_typeX in OccAndInv("vehiclesMilitiaTrucks")) | ||
or (_typeX in FactionGet(reb,"vehiclesTruck")) | ||
) exitWith {100}; | ||
|
||
if ( | ||
(_typeX in FactionGet(all,"vehiclesBoats")) | ||
or (_typeX in FactionGet(all,"vehiclesLightAPCs")) | ||
or (_typeX in OccAndInv("vehiclesAmmoTrucks")) | ||
or (_typeX in OccAndInv("vehiclesRepairTrucks")) | ||
or (_typeX in OccAndInv("vehiclesFuelTrucks")) | ||
or (_typeX in OccAndInv("vehiclesMedical")) | ||
) exitWith {200}; | ||
|
||
if (_typeX in (FactionGet(all,"vehiclesHelisLight") + FactionGet(reb,"vehiclesCivHeli"))) exitWith {500}; | ||
|
||
if ( | ||
(_typeX in FactionGet(all,"vehiclesAPCs")) | ||
|| (_typeX in FactionGet(all,"vehiclesIFVs")) | ||
|| (_typeX in FactionGet(all,"vehiclesLightTanks")) | ||
|| (_typeX in FactionGet(all,"vehiclesHelisLightAttack")) | ||
|| (_typeX in FactionGet(all,"vehiclesTransportAir")) | ||
|| (_typeX in FactionGet(all,"vehiclesUAVs")) | ||
) exitWith {1000}; | ||
|
||
if ( | ||
(_typeX in FactionGet(all,"vehiclesHelisAttack")) | ||
or (_typeX in FactionGet(all,"vehiclesTanks")) | ||
or (_typeX in FactionGet(all,"vehiclesAA")) | ||
or (_typeX in FactionGet(all,"vehiclesArtillery")) | ||
) exitWith {3000}; | ||
|
||
if (_typeX in (FactionGet(all,"vehiclesPlanesCAS") + FactionGet(all,"vehiclesPlanesAA"))) exitWith {4000}; | ||
|
||
0; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
/* | ||
Author: Tiny, parts of code ethically sourced from Håkon | ||
[Description] | ||
Attempts to sell currently selected vehicle | ||
|
||
Arguments: | ||
0. <String> player UID | ||
1. <Object> Player | ||
2. <Array> vehicle to sell (intended use with HR_GRG_SelectedVehicles) | ||
|
||
Return Value: | ||
n/A | ||
|
||
Scope: Server | ||
Environment: Unscheduled | ||
Public: [No] | ||
Dependencies: | ||
|
||
Example: [HR_GRG_PlayerUID, player, HR_GRG_SelectedVehicles] remoteExecCall ["HR_GRG_fnc_sellVehGRG",2]; | ||
|
||
License: APL-ND | ||
*/ | ||
|
||
#include "defines.inc" | ||
FIX_LINE_NUMBERS() | ||
params ["_UID", "_player", "_selectedVehicle"]; | ||
|
||
if (!isServer) exitWith {Error("Not server executed")}; | ||
if !(_player call HR_GRG_canSell) exitWith {["STR_HR_GRG_Feedback_sellVehicle_comOnly"] call HR_GRG_fnc_Hint;}; | ||
_selectedVehicle params [["_catIndex", -1], ["_vehUID", -1], ["_class", ""]]; | ||
if ( (_catIndex isEqualTo -1) || (_vehUID isEqualTo -1) ) exitWith {}; | ||
Trace_2("Attempting to sell vehicle at cat: %1 | Vehicle ID: %2 | Classname: %3", _catIndex, _vehUID, _class); | ||
|
||
private _refund = [_class] call HR_GRG_getVehicleSellPrice; | ||
if (_refund == 0) exitWith {["STR_HR_GRG_Feedback_sellVehicle_noPrice"] call HR_GRG_fnc_Hint;}; | ||
|
||
private _cat = HR_GRG_Vehicles#_catIndex; | ||
private _veh = _cat get _vehUID; | ||
private _lock = _veh#2; | ||
if !(_lock isEqualTo "") exitWith {["STR_HR_GRG_Feedback_sellVehicle_locked"] call HR_GRG_fnc_Hint;}; | ||
|
||
[_UID,_player,true] remoteExecCall ["HR_GRG_fnc_removeFromPool",HR_GRG_Users]; | ||
[] remoteExec ["HR_GRG_fnc_sellVehGRGLocal",_player]; | ||
|
||
[_refund] spawn HR_GRG_addResources; | ||
|
||
["STR_HR_GRG_Feedback_sellVehicle_sold",[str _refund]] call HR_GRG_fnc_Hint; | ||
Info_3("Vehicle UID %1 sold by %2 for %3.", _vehUID, name _player, _refund); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
/* | ||
Author: Tiny | ||
[Description] | ||
A helper script to fn_sellvehGRG, runs on the client to reset displays | ||
|
||
Arguments: | ||
1. The category to change selection to (default = -1) | ||
2. The vehicle UID to change selection to (default = -1) | ||
3. The classname of the selected vehicle (default = "") | ||
|
||
|
||
Return Value: | ||
<nil> | ||
|
||
Scope: Client | ||
Environment: Any | ||
Public: [No] | ||
|
||
License: APL-ND | ||
*/ | ||
#include "defines.inc" | ||
FIX_LINE_NUMBERS() | ||
|
||
if (isNull player) exitWith {Error("fn_sellVehGRGLocal was not executed by a client")}; | ||
params [["_catIndex",-1],["_vehUID",-1],["_class",""]]; | ||
HR_GRG_SelectedVehicles = [_catIndex, _vehUID,_class]; | ||
[] call HR_GRG_fnc_reloadPreview; | ||
[] call HR_GRG_fnc_reloadExtras; | ||
private _disp = findDisplay HR_GRG_IDD_Garage; | ||
|
||
{ | ||
private _ctrl = _disp displayCtrl _x; | ||
_ctrl ctrlEnable false; | ||
_ctrl ctrlShow false; | ||
} forEach [HR_GRG_IDC_ExtraMounts,HR_GRG_IDC_ExtraTexture,HR_GRG_IDC_ExtraAnim,HR_GRG_IDC_ExtraPylonsContainer]; | ||
|
||
[0] call HR_GRG_fnc_switchExtrasMenu; | ||
[] call HR_GRG_fnc_reloadPylons; | ||
[] call HR_GRG_fnc_updateVehicleCount; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I missed this one somehow.