mirror of
https://github.com/OpenFusionProject/OpenFusion.git
synced 2026-06-15 06:10:02 +00:00
Nanocom Boosters and Authentic FM-Taro Scale Logic (#315)
* Groundwork for nanocom boosters * The item use handler now has a switch for multiple item types (currently gumballs, and a stub for boosters) * All item types are now checked for expiration, not just vehicles * implement nanocom booster helpers, save and expiry * implement authentic taro and fm modfication * magic number and code refactor * make sure only close by group members are counted * add safe taro fm handling, rate command, race and mission booster logic * add config option to disable authentic group scaling * rename for consistency * make rates percentages, fix chat message, add config options * add config option to the ini file * add index guard for hasBoost functions * reorder config ini options * add bank item expiry option * fix trade oversight --------- Co-authored-by: CakeLancelot <CakeLancelot@users.noreply.github.com>
This commit is contained in:
@@ -7,6 +7,7 @@
|
||||
#include "PlayerManager.hpp"
|
||||
#include "Missions.hpp"
|
||||
#include "Items.hpp"
|
||||
#include "Nanos.hpp"
|
||||
|
||||
using namespace Racing;
|
||||
|
||||
@@ -14,6 +15,15 @@ std::map<int32_t, EPInfo> Racing::EPData;
|
||||
std::map<CNSocket*, EPRace> Racing::EPRaces;
|
||||
std::map<int32_t, std::pair<std::vector<int>, std::vector<int>>> Racing::EPRewards;
|
||||
|
||||
static int32_t calculateFMReward(Player* plr, int32_t baseAmount) {
|
||||
double scavenge = plr->hasBuff(ECSB_REWARD_BLOB) ? (Nanos::getNanoBoost(plr) ? 1.23 : 1.2) : 1.0;
|
||||
double raceBoost = plr->hasRacerBoost() ? (plr->hasHunterBoost() && plr->hasQuestBoost() ? 1.75 : 1.5) : 1.0;
|
||||
|
||||
int32_t reward = baseAmount * plr->rateF[RATE_SLOT_RACING] * scavenge;
|
||||
reward *= raceBoost;
|
||||
return reward;
|
||||
}
|
||||
|
||||
static void racingStart(CNSocket* sock, CNPacketData* data) {
|
||||
auto req = (sP_CL2FE_REQ_EP_RACE_START*)data->buf;
|
||||
|
||||
@@ -155,7 +165,9 @@ static void racingEnd(CNSocket* sock, CNPacketData* data) {
|
||||
resp.iEPRaceMode = EPRaces[sock].mode;
|
||||
resp.iEPRewardFM = fm;
|
||||
|
||||
Missions::updateFusionMatter(sock, resp.iEPRewardFM);
|
||||
int32_t fmReward = calculateFMReward(plr, resp.iEPRewardFM);
|
||||
plr->addCapped(CappedValueType::FUSIONMATTER, fmReward);
|
||||
Missions::updateFusionMatter(sock);
|
||||
|
||||
resp.iFusionMatter = plr->fusionmatter;
|
||||
resp.iFatigue = 50;
|
||||
|
||||
Reference in New Issue
Block a user