@@ -11,6 +11,7 @@ local m_min = math.min
1111local m_max = math.max
1212local m_floor = math.floor
1313
14+ local gemTooltip = LoadModule (" Classes/GemTooltip" )
1415local toolTipText = " Prefix tag searches with a colon and exclude tags with a dash. e.g. :fire:lightning:-cold:area"
1516local imbuedTooltipText = " \" Socketed in\" item must be set in order to add an imbued support.\n Only one imbued support is allowed per item."
1617
@@ -595,178 +596,7 @@ function GemSelectClass:CheckSupporting(gemA, gemB)
595596end
596597
597598function GemSelectClass :AddGemTooltip (gemInstance )
598- local fontSizeBig = main .showFlavourText and 18 or 16
599- local fontSizeTitle = main .showFlavourText and 24 or 20
600- self .tooltip .center = true
601- self .tooltip .color = colorCodes .GEM
602- self .tooltip .tooltipHeader = " GEM"
603- local primary = gemInstance .gemData .grantedEffect
604- local secondary = gemInstance .gemData .secondaryGrantedEffect
605- if secondary and (not secondary .support or gemInstance .gemData .secondaryEffectName ) then
606- local grantedEffect = gemInstance .gemData .VaalGem and secondary or primary
607- local grantedEffectSecondary = gemInstance .gemData .VaalGem and primary or secondary
608- self .tooltip :AddLine (fontSizeTitle , colorCodes .GEM .. grantedEffect .name , " FONTIN SC" )
609- self .tooltip :AddSeparator (10 )
610- self .tooltip :AddLine (fontSizeBig , " ^x7F7F7F" .. gemInstance .gemData .tagString , " FONTIN SC" )
611- self :AddCommonGemInfo (gemInstance , grantedEffect , true )
612- self .tooltip :AddSeparator (10 )
613- self .tooltip :AddLine (fontSizeTitle , colorCodes .GEM .. (gemInstance .gemData .secondaryEffectName or grantedEffectSecondary .name ), " FONTIN SC" )
614- self .tooltip :AddSeparator (10 )
615- self :AddCommonGemInfo (gemInstance , grantedEffectSecondary )
616- else
617- local grantedEffect = gemInstance .gemData .grantedEffect
618- self .tooltip :AddLine (fontSizeTitle , colorCodes .GEM .. grantedEffect .name , " FONTIN SC" )
619- self .tooltip :AddSeparator (10 )
620- if grantedEffect .legacy then
621- self .tooltip :AddLine (fontSizeTitle , colorCodes .WARNING .. " Legacy Gem" , " FONTIN SC" )
622- self .tooltip :AddLine (fontSizeBig , colorCodes .WARNING .. " Gem only exists in Standard League" , " FONTIN SC" )
623- self .tooltip :AddSeparator (10 )
624- end
625- self .tooltip :AddLine (fontSizeBig , " ^x7F7F7F" .. gemInstance .gemData .tagString , " FONTIN SC" )
626- self :AddCommonGemInfo (gemInstance , grantedEffect , true , secondary and secondary .support and secondary )
627- end
628- end
629-
630- function GemSelectClass :AddCommonGemInfo (gemInstance , grantedEffect , addReq , mergeStatsFrom )
631- local fontSizeBig = main .showFlavourText and 18 or 16
632- local displayInstance = gemInstance .displayEffect or gemInstance
633- local grantedEffectLevel = grantedEffect .levels [displayInstance .level ] or { }
634- if addReq then
635- self .tooltip :AddLine (fontSizeBig , string.format (" ^x7F7F7FLevel: ^7%d%s%s" ,
636- gemInstance .level ,
637- ((displayInstance .level > gemInstance .level ) and " (" .. colorCodes .MAGIC .. " +" .. (displayInstance .level - gemInstance .level ) .. " ^7)" ) or ((displayInstance .level < gemInstance .level ) and " (" .. colorCodes .WARNING .. " -" .. (gemInstance .level - displayInstance .level ) .. " ^7)" ) or " " ,
638- (gemInstance .level >= gemInstance .gemData .naturalMaxLevel ) and " (Max)" or " "
639- ), " FONTIN SC" )
640- end
641- if grantedEffect .support then
642- if grantedEffectLevel .manaMultiplier then
643- self .tooltip :AddLine (fontSizeBig , string.format (" ^x7F7F7FCost & Reservation Multiplier: ^7%d%%" , grantedEffectLevel .manaMultiplier + 100 ), " FONTIN SC" )
644- end
645- local reservation
646- for name , res in pairs (self .reservationMap ) do
647- if grantedEffectLevel [name ] then
648- reservation = (reservation and (reservation .. " , " ) or " " ) .. self .costs [isValueInArrayPred (self .costs , function (v ) return v .Resource == res end )].ResourceString :gsub (" {0}" , string.format (" %d" , grantedEffectLevel [name ]))
649- end
650- end
651- if reservation then
652- self .tooltip :AddLine (fontSizeBig , " ^x7F7F7FReservation Override: ^7" .. reservation , " FONTIN SC" )
653- end
654- if grantedEffectLevel .cooldown then
655- local string = string.format (" ^x7F7F7FCooldown Time: ^7%.2f sec" , grantedEffectLevel .cooldown )
656- if grantedEffectLevel .storedUses and grantedEffectLevel .storedUses > 1 then
657- string = string .. string.format (" (%d uses)" , grantedEffectLevel .storedUses )
658- end
659- self .tooltip :AddLine (fontSizeBig , string , " FONTIN SC" )
660- end
661- else
662- local reservation
663- for name , res in pairs (self .reservationMap ) do
664- if grantedEffectLevel [name ] then
665- reservation = (reservation and (reservation .. " , " ) or " " ) .. self .costs [isValueInArrayPred (self .costs , function (v ) return v .Resource == res end )].ResourceString :gsub (" {0}" , string.format (" %d" , grantedEffectLevel [name ]))
666- end
667- end
668- if reservation then
669- self .tooltip :AddLine (fontSizeBig , " ^x7F7F7FReservation: ^7" .. reservation , " FONTIN SC" )
670- end
671- local cost
672- for _ , res in ipairs (self .costs ) do
673- if grantedEffectLevel .cost and grantedEffectLevel .cost [res .Resource ] then
674- cost = (cost and (cost .. " , " ) or " " ) .. res .ResourceString :gsub (" {0}" , string.format (" %g" , round (grantedEffectLevel .cost [res .Resource ] / res .Divisor , 2 )))
675- end
676- end
677- if cost then
678- self .tooltip :AddLine (fontSizeBig , " ^x7F7F7FCost: ^7" .. cost , " FONTIN SC" )
679- end
680- if grantedEffectLevel .cooldown then
681- local string = string.format (" ^x7F7F7FCooldown Time: ^7%.2f sec" , grantedEffectLevel .cooldown , " FONTIN SC" )
682- if grantedEffectLevel .storedUses and grantedEffectLevel .storedUses > 1 then
683- string = string .. string.format (" (%d uses)" , grantedEffectLevel .storedUses )
684- end
685- self .tooltip :AddLine (fontSizeBig , string , " FONTIN SC" )
686- end
687- if grantedEffectLevel .vaalStoredUses then
688- self .tooltip :AddLine (fontSizeBig , string.format (" ^x7F7F7FCan Store ^7%d ^x7F7F7FUse (%d Souls)" , grantedEffectLevel .vaalStoredUses , grantedEffectLevel .vaalStoredUses * grantedEffectLevel .cost .Soul ), " FONTIN SC" )
689- end
690- if grantedEffectLevel .soulPreventionDuration then
691- self .tooltip :AddLine (fontSizeBig , string.format (" ^x7F7F7FSoul Gain Prevention: ^7%d sec" , grantedEffectLevel .soulPreventionDuration ), " FONTIN SC" )
692- end
693- if gemInstance .gemData .tags .attack then
694- if grantedEffectLevel .attackSpeedMultiplier then
695- self .tooltip :AddLine (fontSizeBig , string.format (" ^x7F7F7FAttack Speed: ^7%d%% of base" , grantedEffectLevel .attackSpeedMultiplier + 100 ), " FONTIN SC" )
696- end
697- if grantedEffectLevel .attackTime then
698- self .tooltip :AddLine (fontSizeBig , string.format (" ^x7F7F7FAttack Time: ^7%.2f sec" , grantedEffectLevel .attackTime / 1000 ), " FONTIN SC" )
699- end
700- if grantedEffectLevel .baseMultiplier then
701- self .tooltip :AddLine (fontSizeBig , string.format (" ^x7F7F7FAttack Damage: ^7%g%% of base" , grantedEffectLevel .baseMultiplier * 100 ), " FONTIN SC" )
702- end
703- else
704- if grantedEffect .castTime > 0 then
705- self .tooltip :AddLine (fontSizeBig , string.format (" ^x7F7F7FCast Time: ^7%.2f sec" , grantedEffect .castTime ), " FONTIN SC" )
706- else
707- self .tooltip :AddLine (fontSizeBig , " ^x7F7F7FCast Time: ^7Instant" , " FONTIN SC" )
708- end
709- end
710- if grantedEffectLevel .critChance then
711- self .tooltip :AddLine (fontSizeBig , string.format (" ^x7F7F7FCritical Strike Chance: ^7%.2f%%" , grantedEffectLevel .critChance ), " FONTIN SC" )
712- end
713- if grantedEffectLevel .damageEffectiveness then
714- self .tooltip :AddLine (fontSizeBig , string.format (" ^x7F7F7FEffectiveness of Added Damage: ^7%d%%" , grantedEffectLevel .damageEffectiveness * 100 ), " FONTIN SC" )
715- end
716- end
717- if addReq and displayInstance .quality > 0 then
718- self .tooltip :AddLine (fontSizeBig , string.format (" ^x7F7F7FQuality: " .. colorCodes .MAGIC .. " +%d%%^7%s" ,
719- gemInstance .quality ,
720- (displayInstance .quality > gemInstance .quality ) and " (" .. colorCodes .MAGIC .. " +" .. (displayInstance .quality - gemInstance .quality ).. " ^7)" or " "
721- ), " FONTIN SC" )
722- end
723- self .tooltip :AddSeparator (10 )
724- if addReq then
725- local reqLevel = grantedEffect .levels [gemInstance .level ] and grantedEffect .levels [gemInstance .level ].levelRequirement or 1
726- local reqStr = calcLib .getGemStatRequirement (reqLevel , grantedEffect .support , gemInstance .gemData .reqStr )
727- local reqDex = calcLib .getGemStatRequirement (reqLevel , grantedEffect .support , gemInstance .gemData .reqDex )
728- local reqInt = calcLib .getGemStatRequirement (reqLevel , grantedEffect .support , gemInstance .gemData .reqInt )
729- self .skillsTab .build :AddRequirementsToTooltip (self .tooltip , reqLevel , reqStr , reqDex , reqInt )
730- end
731- if grantedEffect .description then
732- local wrap = main :WrapString (grantedEffect .description , 16 , m_max (DrawStringWidth (16 , " VAR" , gemInstance .gemData .tagString ), 400 ))
733- for _ , line in ipairs (wrap ) do
734- self .tooltip :AddLine (fontSizeBig , colorCodes .GEM .. line , " FONTIN SC" )
735- end
736- end
737- if self .skillsTab .build .data .describeStats then
738- self .tooltip :AddSeparator (10 )
739- local stats = calcLib .buildSkillInstanceStats (displayInstance , grantedEffect )
740- if mergeStatsFrom then
741- for stat , val in pairs (calcLib .buildSkillInstanceStats (displayInstance , mergeStatsFrom )) do
742- stats [stat ] = (stats [stat ] or 0 ) + val
743- end
744- end
745- local descriptions , lineMap = self .skillsTab .build .data .describeStats (stats , grantedEffect .statDescriptionScope )
746- for _ , line in ipairs (descriptions ) do
747- local source = grantedEffect .statMap [lineMap [line ]] or self .skillsTab .build .data .skillStatMap [lineMap [line ]]
748- if source then
749- if launch .devModeAlt then
750- local devText = lineMap [line ]
751- if source [1 ] then
752- if not source [1 ].value then
753- source [1 ].value = lineMap [line ]
754- end
755- devText = modLib .formatMod (source [1 ])
756- end
757- line = line .. " ^2" .. devText
758- end
759- self .tooltip :AddLine (fontSizeBig , colorCodes .MAGIC .. line , " FONTIN SC" )
760- else
761- if launch .devModeAlt then
762- line = line .. " ^1" .. lineMap [line ]
763- end
764- local line = colorCodes .UNSUPPORTED .. line
765- line = main .notSupportedModTooltips and (line .. main .notSupportedTooltipText ) or line
766- self .tooltip :AddLine (fontSizeBig , line , " FONTIN SC" )
767- end
768- end
769- end
599+ gemTooltip .AddGemTooltip (self .tooltip , self .skillsTab .build , gemInstance )
770600end
771601
772602function GemSelectClass :OnFocusGained ()
0 commit comments