@@ -11,6 +11,8 @@ local m_min = math.min
1111local m_max = math.max
1212local m_floor = math.floor
1313
14+ local gemTooltip = LoadModule (" Classes/GemTooltip" )
15+
1416local toolTipText = " Prefix tag searches with a colon and exclude tags with a dash. e.g. :fire:lightning:-cold:area"
1517
1618local GemSelectClass = newClass (" GemSelectControl" , " EditControl" , function (self , anchor , rect , skillsTab , index , changeFunc , forceTooltip )
@@ -43,7 +45,6 @@ local GemSelectClass = newClass("GemSelectControl", "EditControl", function(self
4345 self :BuildList (self .buf )
4446 self :UpdateGem ()
4547 end
46- self .costs = data .costs
4748end )
4849
4950function GemSelectClass :CalcOutputWithThisGem (calcFunc , gemData , useFullDPS )
@@ -539,224 +540,7 @@ function GemSelectClass:CheckSupporting(gemA, gemB)
539540end
540541
541542function GemSelectClass :AddGemTooltip (gemInstance )
542- local fontSizeBig = main .showFlavourText and 18 or 16
543- local fontSizeTitle = main .showFlavourText and 24 or 20
544- self .tooltip .center = true
545- self .tooltip .color = colorCodes .GEM
546- local grantedEffect = gemInstance .gemData .grantedEffect
547- local additionalEffects = gemInstance .gemData .additionalGrantedEffects
548- self .tooltip .tooltipHeader = " GEM"
549- if grantedEffect .name :match (" ^Spectre:" ) or grantedEffect .name :match (" ^Companion:" ) then
550- self .tooltip :AddLine (fontSizeTitle , colorCodes .GEM .. (gemInstance .displayEffect and gemInstance .displayEffect .nameSpec or gemInstance .gemData .name ), " FONTIN SC" )
551- else
552- self .tooltip :AddLine (fontSizeTitle , colorCodes .GEM .. gemInstance .gemData .name , " FONTIN SC" )
553- end
554- self .tooltip :AddSeparator (10 )
555- self .tooltip :AddLine (fontSizeBig , colorCodes .NORMAL .. gemInstance .gemData .gemType , " FONTIN SC" )
556- if gemInstance .gemData .tagString ~= " " then
557- self .tooltip :AddLine (fontSizeBig , " ^x7F7F7F" .. gemInstance .gemData .tagString , " FONTIN SC" )
558- end
559- if gemInstance .gemData .gemFamily then
560- self .tooltip :AddLine (fontSizeBig , " ^x7F7F7FCategory: ^7" .. gemInstance .gemData .gemFamily , " FONTIN SC" )
561- end
562- -- Will need rework if a gem can have 2+ additional supports
563- self :AddGrantedEffectInfo (gemInstance , grantedEffect , true )
564- for _ , statSet in ipairs (grantedEffect .statSets ) do
565- self :AddStatSetInfo (gemInstance , grantedEffect , statSet , nil , _ )
566- end
567-
568- for _ , additional in ipairs (additionalEffects or {}) do
569- if not additional .support then
570- if additional .name ~= " " then
571- self .tooltip :AddSeparator (10 )
572- self .tooltip :AddLine (fontSizeTitle , colorCodes .GEM .. additional .name , " FONTIN SC" )
573- end
574- self .tooltip :AddSeparator (10 )
575- self :AddGrantedEffectInfo (gemInstance , additional )
576- for _ , statSet in ipairs (additional .statSets ) do
577- self :AddStatSetInfo (gemInstance , additional , statSet , nil , _ )
578- end
579- else
580- for _ , statSet in ipairs (additional .statSets ) do
581- self :AddStatSetInfo (gemInstance , additional , statSet , true , _ )
582- end
583- end
584- end
585- if grantedEffect .flavourText and main .showFlavourText then
586- self .tooltip :AddSeparator (10 )
587- for _ , line in ipairs (grantedEffect .flavourText ) do
588- self .tooltip :AddLine (fontSizeBig , colorCodes .UNIQUE .. line , " FONTIN SC ITALIC" )
589- end
590- end
591- end
592-
593- function GemSelectClass :AddGrantedEffectInfo (gemInstance , grantedEffect , addReq )
594- local fontSizeBig = main .showFlavourText and 18 or 16
595- local displayInstance = gemInstance .displayEffect or gemInstance
596- local grantedEffectLevel = grantedEffect .levels [displayInstance .level ] or { }
597- if gemInstance .gemData .Tier and gemInstance .gemData .Tier > 0 and not grantedEffect .isLineage and not grantedEffect .hidden then
598- self .tooltip :AddLine (fontSizeBig , string.format (" ^x7F7F7FTier: ^7%d" , gemInstance .gemData .Tier ), " FONTIN SC" )
599- end
600- if addReq and not grantedEffect .support then
601- self .tooltip :AddLine (fontSizeBig , string.format (" ^x7F7F7FLevel: ^7%d%s%s" ,
602- gemInstance .level ,
603- ((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 " " ,
604- (gemInstance .level >= gemInstance .gemData .naturalMaxLevel ) and " (Max)" or " "
605- )," FONTIN SC" )
606- end
607- if grantedEffect .support then
608- if grantedEffectLevel .manaMultiplier and grantedEffectLevel .reservationMultiplier and grantedEffectLevel .manaMultiplier == grantedEffectLevel .reservationMultiplier then
609- self .tooltip :AddLine (fontSizeBig , string.format (" ^x7F7F7FCost & Reservation Multiplier: ^7%d%%" , grantedEffectLevel .manaMultiplier + 100 ), " FONTIN SC" )
610- elseif grantedEffectLevel .reservationMultiplier then
611- self .tooltip :AddLine (fontSizeBig , string.format (" ^x7F7F7FReservation Multiplier: ^7%d%%" , grantedEffectLevel .reservationMultiplier + 100 ), " FONTIN SC" )
612- elseif grantedEffectLevel .manaMultiplier then
613- self .tooltip :AddLine (fontSizeBig , string.format (" ^x7F7F7FCost Multiplier: ^7%d%%" , grantedEffectLevel .manaMultiplier + 100 ), " FONTIN SC" )
614- end
615- if grantedEffectLevel .spiritReservationFlat then
616- if grantedEffect .support then
617- self .tooltip :AddLine (fontSizeBig , string.format (" ^x7F7F7FAdditional Reservation: ^7%d Spirit" , grantedEffectLevel .spiritReservationFlat ), " FONTIN SC" )
618- else
619- self .tooltip :AddLine (fontSizeBig , string.format (" ^x7F7F7FReservation: ^7%d Spirit" , grantedEffectLevel .spiritReservationFlat ), " FONTIN SC" )
620- end
621- end
622- if grantedEffectLevel .cooldown then
623- local string = string.format (" ^x7F7F7FCooldown Time: ^7%.2f sec" , grantedEffectLevel .cooldown )
624- if grantedEffectLevel .storedUses and grantedEffectLevel .storedUses > 1 then
625- string = string .. string.format (" (%d uses)" , grantedEffectLevel .storedUses )
626- end
627- self .tooltip :AddLine (fontSizeBig , string , " FONTIN SC" )
628- end
629- else
630- if gemInstance .skillMinion then
631- if gemInstance .nameSpec :match (" ^Spectre:" ) then
632- grantedEffectLevel .spiritReservationFlat = data .spectres [gemInstance .skillMinion ].spectreReservation
633- elseif gemInstance .nameSpec :match (" ^Companion:" ) then
634- grantedEffectLevel .spiritReservationPercent = data .spectres [gemInstance .skillMinion ].companionReservation
635- end
636- end
637- if grantedEffectLevel .spiritReservationFlat then
638- self .tooltip :AddLine (fontSizeBig , string.format (" ^x7F7F7FReservation: ^7%d Spirit" , grantedEffectLevel .spiritReservationFlat ), " FONTIN SC" )
639- end
640- if grantedEffectLevel .spiritReservationPercent then
641- self .tooltip :AddLine (fontSizeBig , string.format (" ^x7F7F7FReservation: ^7%.1f%% Spirit" , grantedEffectLevel .spiritReservationPercent ), " FONTIN SC" )
642- end
643- local cost
644- for _ , res in ipairs (self .costs ) do
645- if grantedEffectLevel .cost and grantedEffectLevel .cost [res .Resource ] then
646- cost = (cost and (cost .. " , " ) or " " ) .. res .ResourceString :gsub (" {0}" , string.format (" %g" , round (grantedEffectLevel .cost [res .Resource ] / res .Divisor , 2 )))
647- end
648- end
649- if cost then
650- self .tooltip :AddLine (fontSizeBig , " ^x7F7F7FCost: ^7" .. cost , " FONTIN SC" )
651- end
652- if grantedEffectLevel .cooldown then
653- local string = string.format (" ^x7F7F7FCooldown Time: ^7%.2f sec" , grantedEffectLevel .cooldown )
654- if grantedEffectLevel .storedUses and grantedEffectLevel .storedUses > 1 then
655- string = string .. string.format (" (%d uses)" , grantedEffectLevel .storedUses )
656- end
657- self .tooltip :AddLine (fontSizeBig , string , " FONTIN SC" )
658- end
659- if grantedEffectLevel .vaalStoredUses then
660- self .tooltip :AddLine (fontSizeBig , string.format (" ^x7F7F7FCan Store ^7%d ^x7F7F7FUse (%d Souls)" , grantedEffectLevel .vaalStoredUses , grantedEffectLevel .vaalStoredUses * grantedEffectLevel .cost .Soul ), " FONTIN SC" )
661- end
662- if grantedEffectLevel .soulPreventionDuration then
663- self .tooltip :AddLine (fontSizeBig , string.format (" ^x7F7F7FSoul Gain Prevention: ^7%d sec" , grantedEffectLevel .soulPreventionDuration ), " FONTIN SC" )
664- end
665- if gemInstance .gemData .tags .attack then
666- if grantedEffectLevel .attackSpeedMultiplier then
667- self .tooltip :AddLine (fontSizeBig , string.format (" ^x7F7F7FAttack Speed: ^7%d%% of base" , grantedEffectLevel .attackSpeedMultiplier + 100 ), " FONTIN SC" )
668- end
669- if grantedEffectLevel .attackTime then
670- self .tooltip :AddLine (fontSizeBig , string.format (" ^x7F7F7FAttack Time: ^7%.2f sec" , grantedEffectLevel .attackTime / 1000 ), " FONTIN SC" )
671- end
672- if grantedEffectLevel .baseMultiplier then
673- self .tooltip :AddLine (fontSizeBig , string.format (" ^x7F7F7FAttack Damage: ^7%g%% of base" , grantedEffectLevel .baseMultiplier * 100 ), " FONTIN SC" )
674- end
675- elseif not grantedEffect .hidden then
676- if grantedEffect .castTime > 0 then
677- self .tooltip :AddLine (fontSizeBig , string.format (" ^x7F7F7FCast Time: ^7%.2f sec" , grantedEffect .castTime ), " FONTIN SC" )
678- else
679- self .tooltip :AddLine (fontSizeBig , " ^x7F7F7FCast Time: ^7Instant" , " FONTIN SC" )
680- end
681- end
682- if grantedEffectLevel .critChance then
683- self .tooltip :AddLine (fontSizeBig , string.format (" ^x7F7F7FCritical Hit Chance: ^7%.2f%%" , grantedEffectLevel .critChance ), " FONTIN SC" )
684- end
685- if gemInstance .gemData .weaponRequirements and not grantedEffect .hidden then
686- self .tooltip :AddLine (fontSizeBig , " ^x7F7F7F Requires: ^7" .. gemInstance .gemData .weaponRequirements , " FONTIN SC" )
687- end
688- end
689- if addReq and displayInstance .quality > 0 then
690- self .tooltip :AddLine (fontSizeBig , string.format (" ^x7F7F7FQuality: " .. colorCodes .MAGIC .. " +%d%%^7%s" ,
691- gemInstance .quality ,
692- (displayInstance .quality > gemInstance .quality ) and " (" .. colorCodes .MAGIC .. " +" .. (displayInstance .quality - gemInstance .quality ).. " ^7)" or " "
693- ), " FONTIN SC" )
694- end
695- self .tooltip :AddSeparator (10 )
696- if addReq then
697- local reqLevel = grantedEffect .levels [gemInstance .level ] and grantedEffect .levels [gemInstance .level ].levelRequirement or 1
698- local reqStr = calcLib .getGemStatRequirement (reqLevel , gemInstance .gemData .reqStr , grantedEffect .support )
699- local reqDex = calcLib .getGemStatRequirement (reqLevel , gemInstance .gemData .reqDex , grantedEffect .support )
700- local reqInt = calcLib .getGemStatRequirement (reqLevel , gemInstance .gemData .reqInt , grantedEffect .support )
701- self .skillsTab .build :AddRequirementsToTooltip (self .tooltip , reqLevel , reqStr , reqDex , reqInt )
702- end
703- if grantedEffect .description then
704- local wrap = main :WrapString (grantedEffect .description , 16 , m_max (DrawStringWidth (fontSizeBig , " VAR" , gemInstance .gemData .tagString ), 400 ))
705- for _ , line in ipairs (wrap ) do
706- self .tooltip :AddLine (fontSizeBig , colorCodes .GEMDESCRIPTION .. line , " FONTIN ITALIC" )
707- end
708- end
709- end
710- function GemSelectClass :AddStatSetInfo (gemInstance , grantedEffect , statSet , noLabel , index )
711- local fontSizeBig = main .showFlavourText and 18 or 16
712- local fontSizeTitle = main .showFlavourText and 24 or 20
713- local displayInstance = gemInstance .displayEffect or gemInstance
714- local statSetLevel = statSet .levels [displayInstance .level ] or statSet .levels [1 ] or { }
715- if not (index == 1 and statSet .label == grantedEffect .name ) and statSet .label ~= " " and not noLabel then
716- self .tooltip :AddSeparator (10 )
717- self .tooltip :AddLine (fontSizeTitle , colorCodes .GEM .. statSet .label , " FONTIN SC" )
718- self .tooltip :AddSeparator (10 )
719- end
720- if statSetLevel .critChance then
721- self .tooltip :AddLine (fontSizeBig , string.format (" ^x7F7F7FCritical Hit Chance: ^7%.2f%%" , statSetLevel .critChance ), " FONTIN SC" )
722- end
723- if statSetLevel .baseMultiplier then
724- self .tooltip :AddLine (fontSizeBig , string.format (" ^x7F7F7FAttack Damage: ^7%d%%" , statSetLevel .baseMultiplier * 100 ), " FONTIN SC" )
725- end
726- if self .skillsTab and self .skillsTab .build .data .describeStats then
727- if not noLabel then self .tooltip :AddSeparator (10 ) end
728- local stats = calcLib .buildSkillInstanceStats (displayInstance , grantedEffect , statSet )
729- -- if mergeStatsFrom then
730- -- for stat, val in pairs(calcLib.buildSkillInstanceStats(displayInstance, mergeStatsFrom)) do
731- -- stats[stat] = (stats[stat] or 0) + val
732- -- end
733- -- end
734- local descriptions , lineMap = self .skillsTab .build .data .describeStats (stats , statSet .statDescriptionScope )
735- for i , line in ipairs (descriptions ) do
736- local source = statSet .statMap [lineMap [line ]] or self .skillsTab .build .data .skillStatMap [lineMap [line ]]
737- local bg = (i % 2 == 0 ) and " GemHoverModBg" or nil -- every second line gets background
738- if source then
739- if launch .devModeAlt then
740- local devText = lineMap [line ]
741- if source [1 ] then
742- if not source [1 ].value then
743- source [1 ].value = lineMap [line ]
744- end
745- devText = modLib .formatMod (source [1 ])
746- end
747- line = line .. " ^2" .. devText
748- end
749- self .tooltip :AddLine (fontSizeBig , colorCodes .MAGIC .. line , " FONTIN SC" , bg )
750- else
751- if launch .devModeAlt then
752- line = line .. " ^1" .. lineMap [line ]
753- end
754- local line = colorCodes .UNSUPPORTED .. line
755- line = main .notSupportedModTooltips and (line .. main .notSupportedTooltipText ) or line
756- self .tooltip :AddLine (fontSizeBig , line , " FONTIN SC" , bg )
757- end
758- end
759- end
543+ gemTooltip .AddGemTooltip (self .tooltip , self .skillsTab .build , gemInstance )
760544end
761545function GemSelectClass :OnFocusGained ()
762546 self .EditControl :OnFocusGained ()
0 commit comments