Merge pull request #22 from ItsStev/roleplay-experience

Roleplay experience
This commit is contained in:
Lorenc Pekaj 2019-06-02 16:25:36 +10:00 committed by GitHub
commit f14dfe8951
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
6 changed files with 18 additions and 15 deletions

View File

@ -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!" ); //SendServerMessage( playerid, "You've made "COL_GOLD"%s"COL_WHITE" from exporting. Go and pick another box up!" );
GivePlayerCash( playerid, cash ); GivePlayerCash( playerid, cash );
GivePlayerScore( playerid, 5 ); GivePlayerScore( playerid, 5 );
GivePlayerExperience( playerid, E_ROLEPLAY );
DestroyDynamicMapIcon( p_LumberjackMapIcon[ playerid ] ); DestroyDynamicMapIcon( p_LumberjackMapIcon[ playerid ] );
p_LumberjackMapIcon[ playerid ] = CreateDynamicMapIconEx( -2330.8535, -113.9084, 34.00, 51, 0, MAPICON_GLOBAL, 6000.0, { -1 }, { -1 }, aPlayer ); p_LumberjackMapIcon[ playerid ] = CreateDynamicMapIconEx( -2330.8535, -113.9084, 34.00, 51, 0, MAPICON_GLOBAL, 6000.0, { -1 }, { -1 }, aPlayer );

View File

@ -155,22 +155,17 @@ hook OnProgressCompleted( playerid, progressid, params )
if ( progressid == PROGRESS_MINING ) if ( progressid == PROGRESS_MINING )
{ {
new m = p_MiningOre{ playerid }; new m = p_MiningOre{ playerid };
new iRandom = random( 101 ); new iRandom = random( 100 );
p_isMining{ playerid } = false; p_isMining{ playerid } = false;
g_miningData[ m ] [ E_MINING ] = INVALID_PLAYER_ID; g_miningData[ m ] [ E_MINING ] = INVALID_PLAYER_ID;
if ( ( g_miningData[ m ] [ E_ORE ] == ORE_IRON && iRandom > 80 ) || new Float: random_chance = fRandomEx( 0.0, 101.0 );
( g_miningData[ m ] [ E_ORE ] == ORE_BAUXITE && iRandom > 85 ) ||
( g_miningData[ m ] [ E_ORE ] == ORE_GOLD && iRandom > 45 ) || random_chance += GetPlayerLevel( playerid, E_ROLEPLAY ) * 0.2;
( g_miningData[ m ] [ E_ORE ] == ORE_COAL && iRandom > 90 ||
( g_miningData[ m ] [ E_ORE ] == ORE_DIAMOND && iRandom > 30 ) || // potential for a 20% success rate
( g_miningData[ m ] [ E_ORE ] == ORE_RUBY && iRandom > 35 ) || if ( random_chance < 20.0 )
( 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 ) )
)
{ {
SetPlayerMineOre( playerid, m ); SetPlayerMineOre( playerid, m );
return SendError( playerid, "You did not find any ore. Mining again." ); return SendError( playerid, "You did not find any ore. Mining again." );
@ -209,6 +204,7 @@ hook OnPlayerEnterDynamicCP( playerid, checkpointid )
new earned_money = floatround( float( g_orePrices[ g_miningData[ ore ] [ E_ORE ] ] ) * 0.5 ); new earned_money = floatround( float( g_orePrices[ g_miningData[ ore ] [ E_ORE ] ] ) * 0.5 );
GivePlayerExperience( playerid, E_ROLEPLAY );
GivePlayerCash( playerid, earned_money ); GivePlayerCash( playerid, earned_money );
StockMarket_UpdateEarnings( E_STOCK_MINING_COMPANY, earned_money, 0.5 ); 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 ) ); 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 ) );
@ -383,7 +379,7 @@ hook OnPlayerEnterDynRaceCP( playerid, checkpointid )
GivePlayerCash( playerid, cashEarned ); GivePlayerCash( playerid, cashEarned );
StockMarket_UpdateEarnings( E_STOCK_MINING_COMPANY, cashEarned, 0.5 ); 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 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 ) ); 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; return Y_HOOKS_BREAK_RETURN_1;

View File

@ -185,6 +185,7 @@ hook OnPlayerEnterDynRaceCP( playerid, checkpointid )
GivePlayerScore( playerid, 1 + floatround( p_PilotDistance[ playerid ] / 1000.0 ) ); GivePlayerScore( playerid, 1 + floatround( p_PilotDistance[ playerid ] / 1000.0 ) );
StockMarket_UpdateEarnings( E_STOCK_AVIATION, cash_earned, stock_dividend_allocation ); StockMarket_UpdateEarnings( E_STOCK_AVIATION, cash_earned, stock_dividend_allocation );
GivePlayerCash( playerid, cash_earned ); 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 ] ] ); ShowPlayerHelpDialog( playerid, 5000, "You have earned ~y~%s ~w~for exporting %s!", cash_format( cash_earned ), g_CargoName[ p_PilotCargo[ playerid ] ] );
StopPlayerPilotWork( playerid ); StopPlayerPilotWork( playerid );

View File

@ -134,6 +134,7 @@ hook OnPlayerEnterDynRaceCP( playerid, checkpointid )
GivePlayerScore( playerid, 1 + floatround( p_TrainDistance[ playerid ] / 1000.0 ) ); GivePlayerScore( playerid, 1 + floatround( p_TrainDistance[ playerid ] / 1000.0 ) );
GivePlayerCash( playerid, iCashEarned ); GivePlayerCash( playerid, iCashEarned );
GivePlayerExperience( playerid, E_ROLEPLAY );
ach_HandleTrainMissions( playerid ); ach_HandleTrainMissions( playerid );

View File

@ -181,6 +181,7 @@ hook OnPlayerEnterDynRaceCP( playerid, checkpointid )
GivePlayerScore( playerid, 1 + floatround( p_TruckingDistance[ playerid ] / 1000.0 ) ); GivePlayerScore( playerid, 1 + floatround( p_TruckingDistance[ playerid ] / 1000.0 ) );
StockMarket_UpdateEarnings( E_STOCK_TRUCKING_COMPANY, iCashEarned, .factor = 1.0 ); StockMarket_UpdateEarnings( E_STOCK_TRUCKING_COMPANY, iCashEarned, .factor = 1.0 );
GivePlayerCash( playerid, iCashEarned ); GivePlayerCash( playerid, iCashEarned );
GivePlayerExperience( playerid, E_ROLEPLAY );
p_TruckingDistance [ playerid ] = 0.0; p_TruckingDistance [ playerid ] = 0.0;
p_hasTruckingJob { playerid } = false; p_hasTruckingJob { playerid } = false;

View File

@ -19,6 +19,7 @@ enum E_LEVELS {
E_POLICE, E_POLICE,
E_ROBBERY, E_ROBBERY,
E_DEATHMATCH, E_DEATHMATCH,
E_ROLEPLAY
/*E_FIREMAN, /*E_FIREMAN,
E_PARAMEDIC, E_PARAMEDIC,
@ -51,8 +52,10 @@ static const
{ {
// Level Name Bar Color Level 100 Req. XP Dilation Sell Value // Level Name Bar Color Level 100 Req. XP Dilation Sell Value
{ "Police", 0x3E7EFFFF, 7500.0, 20.0, 10.0 }, // 7.5k arrests { "Police", 0x3E7EFFFF, 7500.0, 20.0, 10.0 }, // 7.5k arrests
{ "Robbery", 0xF83245FF, 30000.0, 15.0, 10.0 }, // 30K robberies { "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, 75000.0, 10.0, 12.0 } // 75k minijob
/* /*
{ "Fireman", 10000.0, 9.0 }, // 10k fires { "Fireman", 10000.0, 9.0 }, // 10k fires
{ "Hitman", 1500.0, 4.5 }, // 1.5k contracts { "Hitman", 1500.0, 4.5 }, // 1.5k contracts