increase casino shareholding earnings by a bit ... and exaggerate their price factor for every 100k earnings
This commit is contained in:
parent
54b05cf011
commit
6a297cd163
@ -23,8 +23,6 @@
|
||||
#define STOCK_MM_USER_ID ( 0 )
|
||||
|
||||
/* ** Constants ** */
|
||||
static const Float: STOCK_MARKET_POOL_FACTOR = 100000.0; // for every STOCK_MARKET_POOL_FACTOR ... STOCK_MARKET_PRICE_FACTOR added to the price
|
||||
static const Float: STOCK_MARKET_PRICE_FACTOR = 3.0; // for every STOCK_MARKET_POOL_FACTOR ... STOCK_MARKET_PRICE_FACTOR added to the price
|
||||
//static const Float: STOCK_MARKET_PRICE_FLOOR = 20.0; // the price in which the price will always be above or equal to
|
||||
|
||||
static const Float: STOCK_MARKET_TRADING_FEE = 0.01; // trading fee (buy/sell) percentage as decimal
|
||||
@ -36,6 +34,7 @@ static const Float: STOCK_DEFAULT_START_PRICE = 0.0; // the default starting p
|
||||
enum E_STOCK_MARKET_DATA
|
||||
{
|
||||
E_NAME[ 64 ], E_SYMBOL[ 4 ], Float: E_MAX_SHARES,
|
||||
Float: E_POOL_FACTOR, Float: E_PRICE_FACTOR,
|
||||
|
||||
// market maker
|
||||
Float: E_IPO_SHARES, Float: E_IPO_PRICE, Float: E_MAX_PRICE
|
||||
@ -74,16 +73,16 @@ hook OnScriptInit( )
|
||||
AddServerVariable( "stock_report_time", "0", GLOBAL_VARTYPE_INT );
|
||||
AddServerVariable( "stock_trading_fees", "0.0", GLOBAL_VARTYPE_FLOAT );
|
||||
|
||||
// create markets
|
||||
CreateStockMarket( E_STOCK_MINING_COMPANY, "The Mining Company", "MC", 100000.0, 25.0, 500.0 ); // 50m mcap max
|
||||
CreateStockMarket( E_STOCK_AMMUNATION, "Ammu-Nation", "A", 100000.0, 25.0, 250.0 ); // 25m mcap max
|
||||
CreateStockMarket( E_STOCK_VEHICLE_DEALERSHIP, "Vehicle Dealership", "VD", 100000.0, 100.0, 250.0 ); // 25m mcap max
|
||||
CreateStockMarket( E_STOCK_SUPA_SAVE, "Supa-Save", "SS", 100000.0, 25.0, 250.0 ); // 25m mcap max
|
||||
CreateStockMarket( E_STOCK_TRUCKING_COMPANY, "The Trucking Company", "TC", 100000.0, 50.0, 250.0 ); // 25m mcap max
|
||||
CreateStockMarket( E_STOCK_CLUCKIN_BELL, "Cluckin' Bell", "CB", 100000.0, 50.0, 250.0 ); // 25m mcap max
|
||||
CreateStockMarket( E_STOCK_PAWN_STORE, "Pawn Store", "PS", 100000.0, 50.0, 250.0 ); // 25m mcap max
|
||||
CreateStockMarket( E_STOCK_CASINO, "Casino", "CAS", 100000.0, 990.0, 5000.0 ); // 500m mcap max
|
||||
CreateStockMarket( E_STOCK_GOVERNMENT, "Government", "GOV", 100000.0, 750.0, 5000.0 ); // 500m mcap max
|
||||
// ID NAME SYMBOL MAX SHARES IPO_PRICE MAX_PRICE POOL_FACTOR PRICE_FACTOR
|
||||
CreateStockMarket( E_STOCK_MINING_COMPANY, "The Mining Company", "MC", 100000.0, 25.0, 500.0, 100000.0, 3.0 );
|
||||
CreateStockMarket( E_STOCK_AMMUNATION, "Ammu-Nation", "A", 100000.0, 25.0, 250.0, 100000.0, 3.0 );
|
||||
CreateStockMarket( E_STOCK_VEHICLE_DEALERSHIP, "Vehicle Dealership", "VD", 100000.0, 100.0, 250.0, 100000.0, 3.0 );
|
||||
CreateStockMarket( E_STOCK_SUPA_SAVE, "Supa-Save", "SS", 100000.0, 25.0, 250.0, 100000.0, 3.0 );
|
||||
CreateStockMarket( E_STOCK_TRUCKING_COMPANY, "The Trucking Company", "TC", 100000.0, 50.0, 250.0, 100000.0, 3.0 );
|
||||
CreateStockMarket( E_STOCK_CLUCKIN_BELL, "Cluckin' Bell", "CB", 100000.0, 50.0, 250.0, 100000.0, 3.0 );
|
||||
CreateStockMarket( E_STOCK_PAWN_STORE, "Pawn Store", "PS", 100000.0, 50.0, 250.0, 100000.0, 3.0 );
|
||||
CreateStockMarket( E_STOCK_CASINO, "Casino", "CAS", 100000.0, 990.0, 5000.0, 100000.0, 10.0 );
|
||||
CreateStockMarket( E_STOCK_GOVERNMENT, "Government", "GOV", 100000.0, 750.0, 5000.0, 100000.0, 10.0 );
|
||||
return 1;
|
||||
}
|
||||
|
||||
@ -250,7 +249,7 @@ thread StockMarket_InsertReport( stockid, Float: default_start_pool, Float: defa
|
||||
{
|
||||
// set the new price of the company
|
||||
new // TODO: use parabola for factor difficulty?
|
||||
Float: new_price = ( g_stockMarketReportData[ stockid ] [ 0 ] [ E_POOL ] / STOCK_MARKET_POOL_FACTOR) * STOCK_MARKET_PRICE_FACTOR + g_stockMarketData[ stockid ] [ E_IPO_PRICE ]; // STOCK_MARKET_PRICE_FLOOR;
|
||||
Float: new_price = ( g_stockMarketReportData[ stockid ] [ 0 ] [ E_POOL ] / g_stockMarketData[ stockid ] [ E_POOL_FACTOR ] ) * g_stockMarketData[ stockid ] [ E_PRICE_FACTOR ] + g_stockMarketData[ stockid ] [ E_IPO_PRICE ]; // STOCK_MARKET_PRICE_FLOOR;
|
||||
|
||||
if ( new_price > g_stockMarketData[ stockid ] [ E_MAX_PRICE ] ) { // dont want wild market caps
|
||||
new_price = g_stockMarketData[ stockid ] [ E_MAX_PRICE ];
|
||||
@ -571,7 +570,7 @@ CMD:shares( playerid, params[ ] )
|
||||
}
|
||||
|
||||
/* ** Functions ** */
|
||||
static stock CreateStockMarket( stockid, const name[ 64 ], const symbol[ 4 ], Float: ipo_shares, Float: ipo_price, Float: max_price )
|
||||
static stock CreateStockMarket( stockid, const name[ 64 ], const symbol[ 4 ], Float: ipo_shares, Float: ipo_price, Float: max_price, Float: pool_factor, Float: price_factor )
|
||||
{
|
||||
if ( ! Iter_Contains( stockmarkets, stockid ) )
|
||||
{
|
||||
@ -581,6 +580,8 @@ static stock CreateStockMarket( stockid, const name[ 64 ], const symbol[ 4 ], Fl
|
||||
g_stockMarketData[ stockid ] [ E_IPO_SHARES ] = ipo_shares;
|
||||
g_stockMarketData[ stockid ] [ E_IPO_PRICE ] = ipo_price;
|
||||
g_stockMarketData[ stockid ] [ E_MAX_PRICE ] = max_price;
|
||||
g_stockMarketData[ stockid ] [ E_POOL_FACTOR ] = pool_factor;
|
||||
g_stockMarketData[ stockid ] [ E_PRICE_FACTOR ] = price_factor;
|
||||
|
||||
// reset stock price information
|
||||
for ( new r = 0; r < sizeof( g_stockMarketReportData[ ] ); r ++ ) {
|
||||
|
@ -403,7 +403,7 @@ function BeginBlackJackTurn( tableid )
|
||||
|
||||
bet_amount += g_blackjackData[ tableid ] [ E_PAYOUT ];
|
||||
GivePlayerCash( gamerid, -g_blackjackData[ tableid ] [ E_PAYOUT ] );
|
||||
StockMarket_UpdateEarnings( E_STOCK_CASINO, g_blackjackData[ tableid ] [ E_PAYOUT ], 0.005 );
|
||||
StockMarket_UpdateEarnings( E_STOCK_CASINO, g_blackjackData[ tableid ] [ E_PAYOUT ], 0.025 );
|
||||
DrawPlayerBlackjackCard( tableid, player_index );
|
||||
if ( cardid < 1 ) { // distribute first two cards to players
|
||||
g_blackjackData[ tableid ] [ E_DRAW_CARD_TIMER ] = SetTimerEx( "DrawPlayerBlackjackCard", BLACKJACK_DEALER_WAIT, false, "dd", tableid, player_index );
|
||||
@ -574,7 +574,7 @@ stock CheckForBlackjack( tableid )
|
||||
GameTextForPlayer( playerid, sprintf( "~n~~n~~y~%s returned!", cash_format( payout ) ), 4000, 3 );
|
||||
GivePlayerCasinoRewardsPoints( playerid, g_blackjackData[ tableid ] [ E_PAYOUT ], .house_edge = 1.5 );
|
||||
GivePlayerCash( playerid, payout );
|
||||
StockMarket_UpdateEarnings( E_STOCK_CASINO, -payout, 0.005 );
|
||||
StockMarket_UpdateEarnings( E_STOCK_CASINO, -payout, 0.025 );
|
||||
}
|
||||
else if ( player_score == 21 ) {
|
||||
g_blackjackPlayerState[ tableid ] [ player_index ] = BLACKJACK_STATE_WIN;
|
||||
@ -587,7 +587,7 @@ stock CheckForBlackjack( tableid )
|
||||
GameTextForPlayer( playerid, sprintf( "~n~~n~~g~%s won!", cash_format( payout ) ), 4000, 3 );
|
||||
GivePlayerCasinoRewardsPoints( playerid, g_blackjackData[ tableid ] [ E_PAYOUT ], .house_edge = 1.5 );
|
||||
GivePlayerCash( playerid, payout );
|
||||
StockMarket_UpdateEarnings( E_STOCK_CASINO, -payout, 0.005 );
|
||||
StockMarket_UpdateEarnings( E_STOCK_CASINO, -payout, 0.025 );
|
||||
}
|
||||
else if ( dealer_score == 21 ) {
|
||||
GivePlayerCasinoRewardsPoints( playerid, g_blackjackData[ tableid ] [ E_PAYOUT ], .house_edge = 1.5 );
|
||||
@ -607,7 +607,7 @@ stock CheckForBlackjack( tableid )
|
||||
GameTextForPlayer( playerid, sprintf( "~n~~n~~g~%s won!", cash_format( payout ) ), 4000, 3 );
|
||||
GivePlayerCasinoRewardsPoints( playerid, g_blackjackData[ tableid ] [ E_PAYOUT ], .house_edge = 1.5 );
|
||||
GivePlayerCash( playerid, payout );
|
||||
StockMarket_UpdateEarnings( E_STOCK_CASINO, -payout, 0.005 );
|
||||
StockMarket_UpdateEarnings( E_STOCK_CASINO, -payout, 0.025 );
|
||||
}
|
||||
else if ( player_score < dealer_score && dealer_score >= 17 ) {
|
||||
GivePlayerCasinoRewardsPoints( playerid, g_blackjackData[ tableid ] [ E_PAYOUT ], .house_edge = 1.5 );
|
||||
@ -621,7 +621,7 @@ stock CheckForBlackjack( tableid )
|
||||
GameTextForPlayer( playerid, sprintf( "~n~~n~~g~%s won!", cash_format( payout ) ), 4000, 3 );
|
||||
GivePlayerCasinoRewardsPoints( playerid, g_blackjackData[ tableid ] [ E_PAYOUT ], .house_edge = 1.5 );
|
||||
GivePlayerCash( playerid, payout );
|
||||
StockMarket_UpdateEarnings( E_STOCK_CASINO, -payout, 0.005 );
|
||||
StockMarket_UpdateEarnings( E_STOCK_CASINO, -payout, 0.025 );
|
||||
}
|
||||
|
||||
// alert world
|
||||
|
@ -1980,7 +1980,7 @@ stock CheckShowdown(handle)
|
||||
new w_chips = floatround(float(TableData[handle][E_TABLE_POT_CHIPS][pot_id]) * (1.0 - T_POT_FEE_RATE));
|
||||
new fee_earned = floatround((float(TableData[handle][E_TABLE_POT_CHIPS][pot_id]) / 1000.0) * T_POT_FEE_RATE);
|
||||
UpdateServerVariable( "poker_fees", 0, GetGVarFloat( "poker_fees" ) + fee_earned, "", GLOBAL_VARTYPE_FLOAT );
|
||||
StockMarket_UpdateEarnings( E_STOCK_CASINO, fee_earned, 0.005 );
|
||||
StockMarket_UpdateEarnings( E_STOCK_CASINO, fee_earned, 0.2 );
|
||||
GivePlayerCasinoRewardsPoints(high_id, fee_earned, .house_edge = 100.0);
|
||||
SendTableMessage(handle, "{9FCF30}****************************************************************************************");
|
||||
SendTableMessage(handle, "{9FCF30}Player {FF8000}%s {9FCF30}has won with a {377CC8}%s", ReturnPlayerName(high_id), HAND_RANKS[highest_rank >> 12]);
|
||||
@ -1996,7 +1996,7 @@ stock CheckShowdown(handle)
|
||||
new w_chips = floatround(float(TableData[handle][E_TABLE_POT_CHIPS][pot_id]) * (1.0 - T_POT_FEE_RATE));
|
||||
new fee_earned = floatround((float(TableData[handle][E_TABLE_POT_CHIPS][pot_id]) / 1000.0) * T_POT_FEE_RATE);
|
||||
UpdateServerVariable( "poker_fees", 0, GetGVarFloat( "poker_fees" ) + fee_earned, "", GLOBAL_VARTYPE_FLOAT );
|
||||
StockMarket_UpdateEarnings( E_STOCK_CASINO, fee_earned, 0.005 );
|
||||
StockMarket_UpdateEarnings( E_STOCK_CASINO, fee_earned, 0.2 );
|
||||
new amount = w_chips / count;
|
||||
//new excess = TableData[handle][E_TABLE_POT_CHIPS][pot_id] % count
|
||||
foreach(new p: It_SidepotMembers[_IT[handle][pot_id]])
|
||||
|
@ -238,7 +238,7 @@ hook OnPlayerKeyStateChange( playerid, newkeys, oldkeys )
|
||||
|
||||
// deduct money
|
||||
GivePlayerCash( playerid, -totalBet );
|
||||
StockMarket_UpdateEarnings( E_STOCK_CASINO, totalBet, 0.005 );
|
||||
StockMarket_UpdateEarnings( E_STOCK_CASINO, totalBet, 0.025 );
|
||||
|
||||
// lock the player in
|
||||
p_rouletteBetLocked{ playerid } = true;
|
||||
@ -679,7 +679,7 @@ public OnRouletteWheelStop( rouletteid, winner )
|
||||
|
||||
// bet unlocked and paid
|
||||
GivePlayerCash( playerid, won );
|
||||
StockMarket_UpdateEarnings( E_STOCK_CASINO, -won, 0.005 );
|
||||
StockMarket_UpdateEarnings( E_STOCK_CASINO, -won, 0.025 );
|
||||
p_rouletteBetLocked{ playerid } = false;
|
||||
|
||||
new
|
||||
|
@ -297,7 +297,7 @@ public OnPlayerUseSlotMachine( playerid, slotid, first_combo, second_combo, thir
|
||||
|
||||
// give the cash
|
||||
GivePlayerCash( playerid, iNetWin );
|
||||
StockMarket_UpdateEarnings( E_STOCK_CASINO, -iNetWin, 0.005 );
|
||||
StockMarket_UpdateEarnings( E_STOCK_CASINO, -iNetWin, 0.025 );
|
||||
PlayerPlaySound( playerid, 4201, 0.0, 0.0, 0.0 ); // Coin fall
|
||||
GameTextForPlayer( playerid, "~w~~h~winner!", 5000, 6 );
|
||||
return 1;
|
||||
@ -512,7 +512,7 @@ stock TriggerPlayerSlotMachine( playerid, machineid )
|
||||
PlayerPlaySound( playerid, 4202, 0.0, 0.0, 0.0 );
|
||||
ApplyAnimation( playerid, "CASINO", "slot_plyr", 2.0, 0, 1, 1, 0, 0 );
|
||||
GivePlayerCash( playerid, -entryFee );
|
||||
StockMarket_UpdateEarnings( E_STOCK_CASINO, entryFee, 0.005 );
|
||||
StockMarket_UpdateEarnings( E_STOCK_CASINO, entryFee, 0.025 );
|
||||
return 1;
|
||||
}
|
||||
return 1;
|
||||
|
Loading…
Reference in New Issue
Block a user