void CalculateMedicalDepositRefund( SOLDIERTYPE *pSoldier ) { INT32 iRefundAmount=0; //if the merc didnt have any medical deposit, exit if( !gMercProfiles[ pSoldier->ubProfile ].bMedicalDeposit ) return; //if the merc is at full health, refund the full medical deposit if( pSoldier->bLife == pSoldier->bLifeMax ) { //add an entry in the finacial page for the FULL refund of the medical deposit // use the medical deposit in pSoldier, not in profile, which goes up with leveling AddTransactionToPlayersBook(FULL_MEDICAL_REFUND, pSoldier->ubProfile, GetWorldTotalMin(), pSoldier->usMedicalDeposit ); //add an email AddEmailWithSpecialData( AIM_MEDICAL_DEPOSIT_REFUND, AIM_MEDICAL_DEPOSIT_REFUND_LENGTH, AIM_SITE, GetWorldTotalMin(), pSoldier->usMedicalDeposit, pSoldier->ubProfile ); } //else if the merc is a dead, refund NOTHING!! else if( pSoldier->bLife <= 0 ) { //add an entry in the finacial page for NO refund of the medical deposit //AddTransactionToPlayersBook( NO_MEDICAL_REFUND, pSoldier->ubProfile, GetWorldTotalMin(), 0 ); //add an email AddEmailWithSpecialData( AIM_MEDICAL_DEPOSIT_NO_REFUND, AIM_MEDICAL_DEPOSIT_NO_REFUND_LENGTH, AIM_SITE, GetWorldTotalMin(), pSoldier->usMedicalDeposit, pSoldier->ubProfile ); } //else the player is injured, refund a partial amount else { // use the medical deposit in pSoldier, not in profile, which goes up with leveling iRefundAmount = (INT32) ( ( pSoldier->bLife / ( FLOAT ) pSoldier->bLifeMax ) * pSoldier->usMedicalDeposit + 0.5 ); //add an entry in the finacial page for a PARTIAL refund of the medical deposit AddTransactionToPlayersBook( PARTIAL_MEDICAL_REFUND, pSoldier->ubProfile, GetWorldTotalMin(), iRefundAmount ); //add an email AddEmailWithSpecialData( AIM_MEDICAL_DEPOSIT_PARTIAL_REFUND, AIM_MEDICAL_DEPOSIT_PARTIAL_REFUND_LENGTH, AIM_SITE, GetWorldTotalMin(), iRefundAmount, pSoldier->ubProfile ); } }
void CalculateMedicalDepositRefund( SOLDIERTYPE *pSoldier ) { INT32 iRefundAmount=0; //if the merc didnt have any medical deposit, exit if( !gMercProfiles[ pSoldier->ubProfile ].bMedicalDeposit ) return; //if the merc is at full health, refund the full medical deposit if( pSoldier->stats.bLife == pSoldier->stats.bLifeMax ) { //add an entry in the finacial page for the FULL refund of the medical deposit // use the medical deposit in pSoldier, not in profile, which goes up with leveling AddTransactionToPlayersBook(FULL_MEDICAL_REFUND, pSoldier->ubProfile, GetWorldTotalMin(), pSoldier->usMedicalDeposit ); //add an email #ifdef JA2UB //no UB if( gubQuest[ QUEST_FIX_LAPTOP ] == QUESTDONE || gGameUBOptions.LaptopQuestEnabled == FALSE ) { if ( gGameUBOptions.fDeadMerc == TRUE ) AddEmailWithSpecialData( 27, AIM_MEDICAL_DEPOSIT_REFUND_LENGTH, AIM_SITE, GetWorldTotalMin(), pSoldier->usMedicalDeposit, pSoldier->ubProfile, TYPE_EMAIL_DEAD_MERC_AIM_SITE_EMAIL_JA2_EDT, TYPE_E_AIM_L2 ); } #else AddEmailWithSpecialData( AIM_MEDICAL_DEPOSIT_REFUND, AIM_MEDICAL_DEPOSIT_REFUND_LENGTH, AIM_SITE, GetWorldTotalMin(), pSoldier->usMedicalDeposit, pSoldier->ubProfile, TYPE_EMAIL_EMAIL_EDT, TYPE_E_NONE ); #endif } //else if the merc is a dead, refund NOTHING!! else if( pSoldier->stats.bLife <= 0 ) { //add an entry in the finacial page for NO refund of the medical deposit //AddTransactionToPlayersBook( NO_MEDICAL_REFUND, pSoldier->ubProfile, GetWorldTotalMin(), 0 ); //add an email #ifdef JA2UB //no UB if( gubQuest[ QUEST_FIX_LAPTOP ] == QUESTDONE || gGameUBOptions.LaptopQuestEnabled == FALSE ) { if ( gGameUBOptions.fDeadMerc == TRUE ) AddEmailWithSpecialData( 217, AIM_MEDICAL_DEPOSIT_NO_REFUND_LENGTH, AIM_SITE, GetWorldTotalMin(), pSoldier->usMedicalDeposit, pSoldier->ubProfile, TYPE_EMAIL_DEAD_MERC_AIM_SITE_EMAIL_JA2_EDT, TYPE_E_AIM_L3 ); } #else AddEmailWithSpecialData( AIM_MEDICAL_DEPOSIT_NO_REFUND, AIM_MEDICAL_DEPOSIT_NO_REFUND_LENGTH, AIM_SITE, GetWorldTotalMin(), pSoldier->usMedicalDeposit, pSoldier->ubProfile, TYPE_EMAIL_EMAIL_EDT, TYPE_E_NONE ); #endif } //else the player is injured, refund a partial amount else { // use the medical deposit in pSoldier, not in profile, which goes up with leveling iRefundAmount = (INT32) ( ( pSoldier->stats.bLife / ( FLOAT ) pSoldier->stats.bLifeMax ) * pSoldier->usMedicalDeposit + 0.5 ); //add an entry in the finacial page for a PARTIAL refund of the medical deposit AddTransactionToPlayersBook( PARTIAL_MEDICAL_REFUND, pSoldier->ubProfile, GetWorldTotalMin(), iRefundAmount ); //add an email #ifdef JA2UB // no UB if( gubQuest[ QUEST_FIX_LAPTOP ] == QUESTDONE || gGameUBOptions.LaptopQuestEnabled == FALSE ) { if ( gGameUBOptions.fDeadMerc == TRUE ) AddEmailWithSpecialData( 214, AIM_MEDICAL_DEPOSIT_PARTIAL_REFUND_LENGTH, AIM_SITE, GetWorldTotalMin(), iRefundAmount, pSoldier->ubProfile, TYPE_EMAIL_DEAD_MERC_AIM_SITE_EMAIL_JA2_EDT, TYPE_E_AIM_L4 ); } #else AddEmailWithSpecialData( AIM_MEDICAL_DEPOSIT_PARTIAL_REFUND, AIM_MEDICAL_DEPOSIT_PARTIAL_REFUND_LENGTH, AIM_SITE, GetWorldTotalMin(), iRefundAmount, pSoldier->ubProfile, TYPE_EMAIL_EMAIL_EDT, TYPE_E_NONE ); #endif } }