/
Economy.pwn
159 lines (150 loc) · 6.75 KB
/
Economy.pwn
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
// Copyright 2006-2016 Las Venturas Playground. All rights reserved.
// Use of this source code is governed by the GPLv2 license, a copy of which can
// be found in the LICENSE file.
// TODO(Russell): The economy should be driven from JavaScript, not Pawn. This will be moved over
// before too long, consider this as an intermediary step.
enum EconomyValueType {
AirportCustomsTax,
AirportCustomsTaxMax,
AirportCustomsTaxMin,
AirportCustomsTaxOwnersShare,
AirportFlight,
AlcoholicDrink,
AlcoholicDrinkOwnerShare,
BitchSlapCommand,
BombExplosionExtreme,
BombExplosionLarge,
BombExplosionMedium,
BombTypeCountdown,
BombTypeCountdownOwnersShare,
BombTypeDetonator,
BombTypeDetonatorOwnersShare,
BombTypeEngine,
BombTypeEngineOwnersShare,
BonusExport,
BonusKill,
BonusMinigame,
CarDiveCommand,
ChaseEscaped,
ChaseWinner,
CustomizationShopOwnerShare,
DeathDropMoneyPercentage,
DeathmatchChampion,
DeliveryDistanceReward,
DeliveryTimeReward,
DiveCommand,
GiftHuntLargePrize,
GiftHuntMediumPrize,
GiftHuntSmallPrize,
GrandTheftAutoRandomVehicleValue,
MapZoneReward,
MapZoneSpeedBonus,
MinigameParticipation,
MinigameVictory,
MoneyStatue,
NitroTwoShot,
NitroFiveShot,
NitroTenShot,
NitroInfinite,
ReactionTest,
ShipIdleMoney,
SlapCommand,
TaxiPerKilometer,
TaxiRide,
TaxiRideOwnerShare,
TeleportWithVehicle,
TeleportWithoutVehicle,
TuneCommand,
VehicleCrusherReward,
VehicleExportReward,
VehicleExportRewardOwnerShare,
WantedLevelAward,
WantedLevelOwnerShare
};
new customsTax = 150;
// Features to manually update:
// - Property pricing
// - Weapons price (//data/ammunation.json)
GetEconomyValue(EconomyValueType: type, inputValue = 0) {
switch (type) {
case AirportCustomsTax: return customsTax;
case AirportCustomsTaxMax: return 500;
case AirportCustomsTaxMin: return 50;
case AirportCustomsTaxOwnersShare: return customsTax / 2;
case AirportFlight: return 750;
case AlcoholicDrink: return 100 * inputValue /* units [1-8] */;
case AlcoholicDrinkOwnerShare: return 10 * inputValue /* units [1-8] */;
case BitchSlapCommand: return 1000;
case BombExplosionExtreme: return 4500;
case BombExplosionLarge: return 3000;
case BombExplosionMedium: return 2000;
case BombTypeCountdown: return 5000;
case BombTypeCountdownOwnersShare: return 1000;
case BombTypeDetonator: return 5000;
case BombTypeDetonatorOwnersShare: return 1000;
case BombTypeEngine: return 6000;
case BombTypeEngineOwnersShare: return 2300;
case BonusExport: return 5000;
case BonusKill: return 7500;
case BonusMinigame: return 7500;
case CarDiveCommand: return 1000;
case ChaseEscaped: return 5000;
case ChaseWinner: return 10000;
case CustomizationShopOwnerShare: return 150;
case DeathDropMoneyPercentage: return 50;
case DeathmatchChampion: return 25000;
case DeliveryDistanceReward: return 190 * inputValue /* distance in units */;
case DeliveryTimeReward: return 80 * inputValue /* seconds left */;
case DiveCommand: return 500;
case GiftHuntLargePrize: return 50000;
case GiftHuntMediumPrize: return 25000;
case GiftHuntSmallPrize: return 10000;
case GrandTheftAutoRandomVehicleValue: return random(78000 /* max */ - 45000 /* min */) + 45000 /* min */;
case MapZoneReward: return 2000 - 10 * inputValue /* time taken (seconds) */;
case MapZoneSpeedBonus: return 2 * inputValue /* high-speed streak count */;
case MinigameParticipation: return 250;
case MinigameVictory: return 7500 * (inputValue /* participant count */ + 1);
case MoneyStatue: return 500 * inputValue /* statue kill count */;
case NitroTwoShot: return 200;
case NitroFiveShot: return 500;
case NitroTenShot: return 1000;
case NitroInfinite: return 5000;
case ReactionTest: return 5000;
case ShipIdleMoney: return 25 * inputValue /* VIP multiplier */;
case SlapCommand: return 500;
case TaxiPerKilometer: return 15;
case TaxiRide: return GetEconomyValue(TaxiPerKilometer) * inputValue /* distance */;
case TaxiRideOwnerShare: return floatround(GetEconomyValue(TaxiPerKilometer) * inputValue /* distance */ * 0.1);
case TeleportWithVehicle: return 2500;
case TeleportWithoutVehicle: return 1000;
case TuneCommand: return 1250;
case VehicleCrusherReward: return 42000;
case VehicleExportReward: return floatround(inputValue /* vehicle health [371-1000] */ * 45 * 1.45);
case VehicleExportRewardOwnerShare: return floatround(inputValue /* vehicle health [371-1000] */ * 45 * 1.45 * 0.1);
case WantedLevelAward: return 4775 * inputValue /* wanted level stars */;
case WantedLevelOwnerShare: return 48 * inputValue /* wanted level stars */;
}
return 0;
}
SetEconomyValue(EconomyValueType: type, value) {
switch (type) {
case AirportCustomsTax:
customsTax = value;
default:
printf("WARNING: Tried to update immutable economy value %d to %d.", _: type, value);
}
}
GiveRegulatedMoney(playerId, EconomyValueType: type, inputValue = 0) {
new const amount = GetEconomyValue(type, inputValue);
if (amount)
GivePlayerMoney(playerId, amount);
else
printf("WARNING: Unable to grant money to %d: invalid amount (type %d).", playerId, _: type);
}
TakeRegulatedMoney(playerId, EconomyValueType: type, inputValue = 0) {
new const amount = GetEconomyValue(type, inputValue);
if (amount)
GivePlayerMoney(playerId, -amount);
else
printf("WARNING: Unable to take money from %d: invalid amount (type %d).", playerId, _: type);
}