New option BOBBY_RAY_TOOLTIPS_SHOW_LBE_DETAILS.
Stop Speck from spamming your email when multiple new mercs are available on the same day.

git-svn-id: https://ja2svn.mooo.com/source/ja2/trunk/GameSource/ja2_v1.13/Build@8926 3b4a5df2-a311-0410-b5c6-a8a6f20db521
This commit is contained in:
Sevenfm
2021-02-01 08:25:59 +00:00
parent f8768a557d
commit 0abc2bf31f
14 changed files with 325 additions and 16 deletions
+132
View File
@@ -4329,6 +4329,138 @@ void GetHelpTextForItemInLaptop( STR16 pzStr, UINT16 usItemNumber )
}
break;
// rftr: better LBE tooltips
case IC_LBEGEAR:
if(gGameExternalOptions.fBobbyRayTooltipsShowLBEDetails)
{
CHAR16 lbeStr[1000];
CHAR16 temp[1000];
swprintf(lbeStr, L"");
swprintf(temp, L"");
if (UsingNewInventorySystem())
{
INVTYPE item = Item[usItemNumber];
LBETYPE lbe = LoadBearingEquipment[item.ubClassIndex];
if (lbe.lbeAvailableVolume > 0) // if this item is a MOLLE carrier (thigh rig, vest, combat pack, backpack)
{
swprintf(temp, L"\n \n%s\n%s %d", gLbeStatsDesc[6 + lbe.lbeClass], gLbeStatsDesc[0], lbe.lbeAvailableVolume);
wcscat(lbeStr, temp);
UINT8 molleSmallCount = 0;
UINT8 molleMediumCount = 0;
for (UINT32 sCount = 1; sCount < gMAXITEMS_READ; ++sCount)
{
AttachmentSlotStruct attachmentSlot = AttachmentSlots[sCount];
if (attachmentSlot.uiSlotIndex == 0)
break;
// count MOLLE slots for this carrier
if (attachmentSlot.nasLayoutClass == ((UINT64)1 << (lbe.lbeClass + 1)))
{
if (lbe.lbePocketsAvailable & (1 << (attachmentSlot.ubPocketMapping - 1)))
{
// seems to be equivalent to checking attachmentSlot.fBigSlot
if (attachmentSlot.nasAttachmentClass == MOLLE_SMALL)
{
molleSmallCount++;
}
else if (attachmentSlot.nasAttachmentClass == MOLLE_MEDIUM)
{
molleMediumCount++;
}
}
}
}
if (molleSmallCount > 0)
{
swprintf(temp, L"\n%s %d", gLbeStatsDesc[2], molleSmallCount);
wcscat(lbeStr, temp);
}
if (molleMediumCount > 0)
{
swprintf(temp, L"\n%s %d", gLbeStatsDesc[3], molleMediumCount);
wcscat(lbeStr, temp);
}
}
else if (item.nasAttachmentClass == MOLLE_SMALL)
{
swprintf(temp, L"\n \n%s\n%s\n%s %d", gLbeStatsDesc[11], gLbeStatsDesc[4], gLbeStatsDesc[1], LBEPocketType[GetFirstPocketOnItem(usItemNumber)].pVolume);
wcscat(lbeStr, temp);
}
else if (item.nasAttachmentClass == MOLLE_MEDIUM)
{
// special case for hydration pack (see AttachmentPoint.xml)
swprintf(temp, L"\n \n%s\n%s\n%s %d", gLbeStatsDesc[11], item.ulAttachmentPoint == 4 ? gLbeStatsDesc[6] : gLbeStatsDesc[5], gLbeStatsDesc[1], LBEPocketType[GetFirstPocketOnItem(usItemNumber)].pVolume);
wcscat(lbeStr, temp);
}
else // non-MOLLE LBE
{
swprintf(temp, L"\n \n%s", gLbeStatsDesc[6 + lbe.lbeClass]);
wcscat(lbeStr, temp);
}
// check for combat pack/backpack combos
if (lbe.lbeCombo > 0)
{
bool foundCombo = false;
CHAR16 lbeComboStr[1000];
swprintf(lbeComboStr, L"");
for (UINT32 itemIndex = 0; itemIndex < gMAXITEMS_READ; ++itemIndex)
{
INVTYPE otherItem = Item[itemIndex];
if (otherItem.usItemClass != IC_LBEGEAR)
continue;
if (itemIndex == usItemNumber)
continue;
LBETYPE otherLbe = LoadBearingEquipment[otherItem.ubClassIndex];
if (lbe.lbeClass == otherLbe.lbeClass)
continue;
if (lbe.lbeCombo == otherLbe.lbeCombo)
{
foundCombo = true;
if (wcslen(lbeComboStr) + wcslen(otherItem.szBRName) < 800)
{
swprintf(temp, L"\n%s", otherItem.szBRName);
wcscat(lbeComboStr, temp);
}
else
{
wcscat(lbeComboStr, L"\n...");
break;
}
}
}
if (foundCombo)
{
// only combat packs and backpacks will have lbeCombo
swprintf(temp, L"\n \n%s\n%s", gLbeStatsDesc[lbe.lbeClass == COMBAT_PACK ? 12 : 13], lbeComboStr);
wcscat(lbeStr, temp);
}
}
}
swprintf(pzStr, L"%s\n%s %1.1f %s%s",
ItemNames[usItemNumber], //Item long name
gWeaponStatsDesc[12], //Weight String
fWeight, //Weight
GetWeightUnitString(), //Weight units
lbeStr
);
}
break;
case IC_MISC:
case IC_MEDKIT:
case IC_KIT:
+23 -12
View File
@@ -3172,25 +3172,28 @@ BOOLEAN CanMercBeAvailableYet( UINT8 ubMercToCheck )
return( FALSE );
}
void NewMercsAvailableAtMercSiteCallBack( )
void NewMercsAvailableAtMercSiteCallBack()
{
for(UINT8 i=0; i<NUM_PROFILES; i++)
{
if ( gConditionsForMercAvailability[i].ProfilId != 0 && gConditionsForMercAvailability[i].NewMercsAvailable == FALSE && gConditionsForMercAvailability[i].StartMercsAvailable == FALSE )
// rftr: don't spam the user's email when MERC has multiple new personnel available on the same day
bool sentNewMercsEmail = false;
for (UINT8 i = 0; i < NUM_PROFILES; i++)
{
if (gConditionsForMercAvailability[i].ProfilId != 0 && gConditionsForMercAvailability[i].NewMercsAvailable == FALSE && gConditionsForMercAvailability[i].StartMercsAvailable == FALSE)
{
if( CanMercBeAvailableYet( gConditionsForMercAvailability[i].uiIndex ) )
if (CanMercBeAvailableYet(gConditionsForMercAvailability[i].uiIndex))
{
gConditionsForMercAvailability[i].NewMercsAvailable = TRUE;
//if ( gConditionsForMercAvailability[ gConditionsForMercAvailability[i].uiIndex ].Drunk == TRUE )
if ( gConditionsForMercAvailability[i].Drunk == TRUE )
if (gConditionsForMercAvailability[i].Drunk == TRUE)
{
LaptopSaveInfo.gubLastMercIndex = gConditionsForMercAvailability[gConditionsForMercAvailability[i].uiAlternateIndex].uiIndex;
}
else
{
// If Previous merc has alternate index
if (i > 0 && gConditionsForMercAvailability[ gConditionsForMercAvailability[i - 1].uiIndex ].uiAlternateIndex != 255)
if (i > 0 && gConditionsForMercAvailability[gConditionsForMercAvailability[i - 1].uiIndex].uiAlternateIndex != 255)
{
// Previous merc has alternate (drunk) merc, skip his one!
//LaptopSaveInfo.gubLastMercIndex = LaptopSaveInfo.gubLastMercIndex + 2;
@@ -3205,14 +3208,22 @@ void NewMercsAvailableAtMercSiteCallBack( )
gConditionsForMercAvailability[i].StartMercsAvailable = TRUE;
#ifdef JA2UB
AddEmail( NEW_MERCS_AT_MERC, NEW_MERCS_AT_MERC_LENGTH, SPECK_FROM_MERC, GetWorldTotalMin(), -1, -1, TYPE_EMAIL_EMAIL_EDT);
if (!sentNewMercsEmail)
{
sentNewMercsEmail = true;
AddEmail(NEW_MERCS_AT_MERC, NEW_MERCS_AT_MERC_LENGTH, SPECK_FROM_MERC, GetWorldTotalMin(), -1, -1, TYPE_EMAIL_EMAIL_EDT);
}
//new mercs are available
LaptopSaveInfo.fNewMercsAvailableAtMercSite = TRUE;
#else
if( IsSpeckComAvailable() )
if (IsSpeckComAvailable())
{
AddEmail( NEW_MERCS_AT_MERC, NEW_MERCS_AT_MERC_LENGTH, SPECK_FROM_MERC, GetWorldTotalMin(), -1, -1, TYPE_EMAIL_EMAIL_EDT);
if (!sentNewMercsEmail)
{
sentNewMercsEmail = true;
AddEmail(NEW_MERCS_AT_MERC, NEW_MERCS_AT_MERC_LENGTH, SPECK_FROM_MERC, GetWorldTotalMin(), -1, -1, TYPE_EMAIL_EMAIL_EDT);
}
//new mercs are available
LaptopSaveInfo.fNewMercsAvailableAtMercSite = TRUE;
@@ -3220,7 +3231,7 @@ void NewMercsAvailableAtMercSiteCallBack( )
else
{
// anv: Have speck inform player personally
TacticalCharacterDialogue( FindSoldierByProfileID( SPECK_PLAYABLE, TRUE ), SPECK_PLAYABLE_QUOTE_NEW_MERCS_AVAILABLE );
TacticalCharacterDialogue(FindSoldierByProfileID(SPECK_PLAYABLE, TRUE), SPECK_PLAYABLE_QUOTE_NEW_MERCS_AVAILABLE);
}
#endif
}