From ccfaca5b483c0f304dedf6f2b48c994611c946cc Mon Sep 17 00:00:00 2001 From: Stev Date: Sat, 1 Jun 2019 14:58:56 +0100 Subject: [PATCH 1/5] starting roleplay level array --- gamemodes/irresistible/cnr/features/player/experience.pwn | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/gamemodes/irresistible/cnr/features/player/experience.pwn b/gamemodes/irresistible/cnr/features/player/experience.pwn index 14bdb05..ca8a0ce 100644 --- a/gamemodes/irresistible/cnr/features/player/experience.pwn +++ b/gamemodes/irresistible/cnr/features/player/experience.pwn @@ -19,6 +19,7 @@ enum E_LEVELS { E_POLICE, E_ROBBERY, E_DEATHMATCH, + E_ROLEPLAY /*E_FIREMAN, E_PARAMEDIC, @@ -52,7 +53,9 @@ static const // Level Name Bar Color Level 100 Req. XP Dilation Sell Value { "Police", 0x3E7EFFFF, 7500.0, 20.0, 10.0 }, // 7.5k arrests { "Robbery", 0xF83245FF, 30000.0, 15.0, 10.0 }, // 30K robberies - { "Deathmatch", 0xFF9233FF, 75000.0, 10.0, 5.0 } // 75K kills + { "Deathmatch", 0xFF9233FF, 75000.0, 10.0, 5.0 }, // 75K kills + { "Roleplay", 0x33FF50FF, 14000.0, 7.0, 7.0 } // 14K minijob + /* { "Fireman", 10000.0, 9.0 }, // 10k fires { "Hitman", 1500.0, 4.5 }, // 1.5k contracts From 8d1486ae4db514ca84251ddd171f85acdec36c92 Mon Sep 17 00:00:00 2001 From: Stev Date: Sat, 1 Jun 2019 15:09:15 +0100 Subject: [PATCH 2/5] giving experince for minijobs --- gamemodes/irresistible/cnr/features/minijobs/lumberjack.pwn | 1 + gamemodes/irresistible/cnr/features/minijobs/mining.pwn | 1 + gamemodes/irresistible/cnr/features/minijobs/pilot.pwn | 1 + gamemodes/irresistible/cnr/features/minijobs/traindriver.pwn | 1 + gamemodes/irresistible/cnr/features/minijobs/trucking.pwn | 1 + 5 files changed, 5 insertions(+) diff --git a/gamemodes/irresistible/cnr/features/minijobs/lumberjack.pwn b/gamemodes/irresistible/cnr/features/minijobs/lumberjack.pwn index fb7ed85..7805aa7 100644 --- a/gamemodes/irresistible/cnr/features/minijobs/lumberjack.pwn +++ b/gamemodes/irresistible/cnr/features/minijobs/lumberjack.pwn @@ -171,6 +171,7 @@ hook OnPlayerEnterDynRaceCP( playerid, checkpointid ) //SendServerMessage( playerid, "You've made "COL_GOLD"%s"COL_WHITE" from exporting. Go and pick another box up!" ); GivePlayerCash( playerid, cash ); GivePlayerScore( playerid, 5 ); + GivePlayerExperience( playerid, E_ROLEPLAY ); DestroyDynamicMapIcon( p_LumberjackMapIcon[ playerid ] ); p_LumberjackMapIcon[ playerid ] = CreateDynamicMapIconEx( -2330.8535, -113.9084, 34.00, 51, 0, MAPICON_GLOBAL, 6000.0, { -1 }, { -1 }, aPlayer ); diff --git a/gamemodes/irresistible/cnr/features/minijobs/mining.pwn b/gamemodes/irresistible/cnr/features/minijobs/mining.pwn index bf4fa91..eb9ed66 100644 --- a/gamemodes/irresistible/cnr/features/minijobs/mining.pwn +++ b/gamemodes/irresistible/cnr/features/minijobs/mining.pwn @@ -209,6 +209,7 @@ hook OnPlayerEnterDynamicCP( playerid, checkpointid ) new earned_money = floatround( float( g_orePrices[ g_miningData[ ore ] [ E_ORE ] ] ) * 0.5 ); + GivePlayerExperience( playerid, E_ROLEPLAY ); GivePlayerCash( playerid, earned_money ); StockMarket_UpdateEarnings( E_STOCK_MINING_COMPANY, earned_money, 0.5 ); SendServerMessage( playerid, "You have crushed a "COL_GREY"%s"COL_WHITE" Ore and earned "COL_GOLD"%s"COL_WHITE".", getOreName( g_miningData[ ore ] [ E_ORE ] ), cash_format( earned_money ) ); diff --git a/gamemodes/irresistible/cnr/features/minijobs/pilot.pwn b/gamemodes/irresistible/cnr/features/minijobs/pilot.pwn index 872a1a8..1cb242f 100644 --- a/gamemodes/irresistible/cnr/features/minijobs/pilot.pwn +++ b/gamemodes/irresistible/cnr/features/minijobs/pilot.pwn @@ -185,6 +185,7 @@ hook OnPlayerEnterDynRaceCP( playerid, checkpointid ) GivePlayerScore( playerid, 1 + floatround( p_PilotDistance[ playerid ] / 1000.0 ) ); StockMarket_UpdateEarnings( E_STOCK_AVIATION, cash_earned, stock_dividend_allocation ); GivePlayerCash( playerid, cash_earned ); + GivePlayerExperience( playerid, E_ROLEPLAY ); ShowPlayerHelpDialog( playerid, 5000, "You have earned ~y~%s ~w~for exporting %s!", cash_format( cash_earned ), g_CargoName[ p_PilotCargo[ playerid ] ] ); StopPlayerPilotWork( playerid ); diff --git a/gamemodes/irresistible/cnr/features/minijobs/traindriver.pwn b/gamemodes/irresistible/cnr/features/minijobs/traindriver.pwn index 877e499..be6cbb4 100644 --- a/gamemodes/irresistible/cnr/features/minijobs/traindriver.pwn +++ b/gamemodes/irresistible/cnr/features/minijobs/traindriver.pwn @@ -134,6 +134,7 @@ hook OnPlayerEnterDynRaceCP( playerid, checkpointid ) GivePlayerScore( playerid, 1 + floatround( p_TrainDistance[ playerid ] / 1000.0 ) ); GivePlayerCash( playerid, iCashEarned ); + GivePlayerExperience( playerid, E_ROLEPLAY ); ach_HandleTrainMissions( playerid ); diff --git a/gamemodes/irresistible/cnr/features/minijobs/trucking.pwn b/gamemodes/irresistible/cnr/features/minijobs/trucking.pwn index ae8874d..56cbae5 100644 --- a/gamemodes/irresistible/cnr/features/minijobs/trucking.pwn +++ b/gamemodes/irresistible/cnr/features/minijobs/trucking.pwn @@ -181,6 +181,7 @@ hook OnPlayerEnterDynRaceCP( playerid, checkpointid ) GivePlayerScore( playerid, 1 + floatround( p_TruckingDistance[ playerid ] / 1000.0 ) ); StockMarket_UpdateEarnings( E_STOCK_TRUCKING_COMPANY, iCashEarned, .factor = 1.0 ); GivePlayerCash( playerid, iCashEarned ); + GivePlayerExperience( playerid, E_ROLEPLAY ); p_TruckingDistance [ playerid ] = 0.0; p_hasTruckingJob { playerid } = false; From a27e3fbc67d5d6936bad329c59a7b2615505643b Mon Sep 17 00:00:00 2001 From: Stev Date: Sat, 1 Jun 2019 15:12:25 +0100 Subject: [PATCH 3/5] changing level array --- gamemodes/irresistible/cnr/features/player/experience.pwn | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gamemodes/irresistible/cnr/features/player/experience.pwn b/gamemodes/irresistible/cnr/features/player/experience.pwn index ca8a0ce..2a6994a 100644 --- a/gamemodes/irresistible/cnr/features/player/experience.pwn +++ b/gamemodes/irresistible/cnr/features/player/experience.pwn @@ -54,7 +54,7 @@ static const { "Police", 0x3E7EFFFF, 7500.0, 20.0, 10.0 }, // 7.5k arrests { "Robbery", 0xF83245FF, 30000.0, 15.0, 10.0 }, // 30K robberies { "Deathmatch", 0xFF9233FF, 75000.0, 10.0, 5.0 }, // 75K kills - { "Roleplay", 0x33FF50FF, 14000.0, 7.0, 7.0 } // 14K minijob + { "Roleplay", 0x33FF50FF, 75000.0, 10.0, 12.0 } // 14K minijob /* { "Fireman", 10000.0, 9.0 }, // 10k fires From 040c4684b01da75abe0f1da59408eeb71e93021e Mon Sep 17 00:00:00 2001 From: Stev Date: Sat, 1 Jun 2019 17:26:09 +0100 Subject: [PATCH 4/5] success rate depending on roleplay level --- .../cnr/features/minijobs/mining.pwn | 22 ++++++++----------- .../cnr/features/player/experience.pwn | 6 ++--- 2 files changed, 12 insertions(+), 16 deletions(-) diff --git a/gamemodes/irresistible/cnr/features/minijobs/mining.pwn b/gamemodes/irresistible/cnr/features/minijobs/mining.pwn index eb9ed66..ada9bd3 100644 --- a/gamemodes/irresistible/cnr/features/minijobs/mining.pwn +++ b/gamemodes/irresistible/cnr/features/minijobs/mining.pwn @@ -44,6 +44,7 @@ static stock g_orePrices [ ] = { 675, 900, 600, 2750, 3000, 3500, 4000, 2200, 2300, 1200 }, g_oreMiningTime [ ] = { 2000, 2800, 1600, 6800, 7200, 7600, 8000, 6400, 6560, 4000 }, g_oreQuanities [ ] = { 8, 8, 8, 8, 5, 3, 3, 5, 5, 6 }, + g_oreProbability [ ] = { 85, 80, 90, 45, 35, 30, 25, 52, 30, 75 }, // Iterator Iterator: miningrock < MAX_ROCKS > @@ -155,22 +156,17 @@ hook OnProgressCompleted( playerid, progressid, params ) if ( progressid == PROGRESS_MINING ) { new m = p_MiningOre{ playerid }; - new iRandom = random( 101 ); + new iRandom = random( 100 ); p_isMining{ playerid } = false; g_miningData[ m ] [ E_MINING ] = INVALID_PLAYER_ID; - if ( ( g_miningData[ m ] [ E_ORE ] == ORE_IRON && iRandom > 80 ) || - ( g_miningData[ m ] [ E_ORE ] == ORE_BAUXITE && iRandom > 85 ) || - ( g_miningData[ m ] [ E_ORE ] == ORE_GOLD && iRandom > 45 ) || - ( g_miningData[ m ] [ E_ORE ] == ORE_COAL && iRandom > 90 || - ( g_miningData[ m ] [ E_ORE ] == ORE_DIAMOND && iRandom > 30 ) || - ( g_miningData[ m ] [ E_ORE ] == ORE_RUBY && iRandom > 35 ) || - ( g_miningData[ m ] [ E_ORE ] == ORE_SAPHHIRE && iRandom > 30 ) || - ( g_miningData[ m ] [ E_ORE ] == ORE_EMERALD && iRandom > 52 ) || - ( g_miningData[ m ] [ E_ORE ] == ORE_PLATINUM && iRandom > 25 ) || - ( g_miningData[ m ] [ E_ORE ] == ORE_AMETHYST && iRandom > 75 ) ) - ) + new Float: random_chance = fRandomEx( 0.0, 101.0 ); + + random_chance += GetPlayerLevel( playerid, E_ROLEPLAY ) * 0.2; + + // potential for a 20% success rate + if ( random_chance < 20.0 ) { SetPlayerMineOre( playerid, m ); return SendError( playerid, "You did not find any ore. Mining again." ); @@ -384,7 +380,7 @@ hook OnPlayerEnterDynRaceCP( playerid, checkpointid ) GivePlayerCash( playerid, cashEarned ); StockMarket_UpdateEarnings( E_STOCK_MINING_COMPANY, cashEarned, 0.5 ); GivePlayerScore( playerid, floatround( oresExported / 2 ) ); // 16 score is a bit too much for ore... so half that = 8 - //GivePlayerExperience( playerid, E_MINING, float( oresExported ) * 0.2 ); + GivePlayerExperience( playerid, E_ROLEPLAY, float( oresExported ) * 0.2 ); SendServerMessage( playerid, "You have exported %d rock ore(s) to an industry, earning you "COL_GOLD"%s"COL_WHITE".", oresExported, cash_format( cashEarned ) ); } return Y_HOOKS_BREAK_RETURN_1; diff --git a/gamemodes/irresistible/cnr/features/player/experience.pwn b/gamemodes/irresistible/cnr/features/player/experience.pwn index 2a6994a..d1aa8a1 100644 --- a/gamemodes/irresistible/cnr/features/player/experience.pwn +++ b/gamemodes/irresistible/cnr/features/player/experience.pwn @@ -52,9 +52,9 @@ static const { // Level Name Bar Color Level 100 Req. XP Dilation Sell Value { "Police", 0x3E7EFFFF, 7500.0, 20.0, 10.0 }, // 7.5k arrests - { "Robbery", 0xF83245FF, 30000.0, 15.0, 10.0 }, // 30K robberies - { "Deathmatch", 0xFF9233FF, 75000.0, 10.0, 5.0 }, // 75K kills - { "Roleplay", 0x33FF50FF, 75000.0, 10.0, 12.0 } // 14K minijob + { "Robbery", 0xF83245FF, 30000.0, 15.0, 10.0 }, // 30k robberies + { "Deathmatch", 0xFF9233FF, 75000.0, 10.0, 5.0 }, // 75k kills + { "Roleplay", 0x33FF50FF, 75000.0, 10.0, 12.0 } // 75k minijob /* { "Fireman", 10000.0, 9.0 }, // 10k fires From 2a5fdb24e0b25bec679fda86541ca6fe948c1b8e Mon Sep 17 00:00:00 2001 From: Stev Date: Sun, 2 Jun 2019 07:23:04 +0100 Subject: [PATCH 5/5] remove pointless variable --- gamemodes/irresistible/cnr/features/minijobs/mining.pwn | 1 - 1 file changed, 1 deletion(-) diff --git a/gamemodes/irresistible/cnr/features/minijobs/mining.pwn b/gamemodes/irresistible/cnr/features/minijobs/mining.pwn index ada9bd3..e79a19b 100644 --- a/gamemodes/irresistible/cnr/features/minijobs/mining.pwn +++ b/gamemodes/irresistible/cnr/features/minijobs/mining.pwn @@ -44,7 +44,6 @@ static stock g_orePrices [ ] = { 675, 900, 600, 2750, 3000, 3500, 4000, 2200, 2300, 1200 }, g_oreMiningTime [ ] = { 2000, 2800, 1600, 6800, 7200, 7600, 8000, 6400, 6560, 4000 }, g_oreQuanities [ ] = { 8, 8, 8, 8, 5, 3, 3, 5, 5, 6 }, - g_oreProbability [ ] = { 85, 80, 90, 45, 35, 30, 25, 52, 30, 75 }, // Iterator Iterator: miningrock < MAX_ROCKS >