diff --git a/README.md b/README.md index 80c4f537..bdc666f6 100644 --- a/README.md +++ b/README.md @@ -1,5 +1,3 @@ -# This is no longer being maintained. - # Worgoblin Module [![core-build](https://github.com/benjymansy123/mod-worgoblin/actions/workflows/core-build.yml/badge.svg)](https://github.com/benjymansy123/mod-worgoblin/actions/workflows/core-build.yml) @@ -26,9 +24,20 @@ Or you can do it manually through a text editor of your choice by changing the l Upon downloading the repo, you'll have the patch-contents file available to you. Copy all the contents of the DBFilesClient folder to your AzerothCore Data directory. Feel free to make a backup of the DBCs you'll be replacing, as backups never hurt. +If you have added existing custom content (Spells, Items, SkillLines..etc) to any of the DBC files listed in patch, you will want to merge and DBC file conflicts that happen. There are multiple paths of doing this easiest likely being using DBXeditor with import on any conflicting files. + +If you have added existing custom content (Spells, Items, SkillLines..etc) to any of the DBC files listed in patch, you will want to merge and DBC file conflicts that happen. There are multiple paths of doing this easiest likely being using DBXeditor with import on any conflicting files. + ### 3) Compile and install AzerothCore. -### 4) Move the [patch-contents](https://github.com/benjymansy123/mod-worgoblin/tree/master/patch-contents) folder to your Data folder in your WoW client and rename the folder to `patch-A.MPQ`. +### 4) **Non-HD** : Move the [patch-contents](https://github.com/benjymansy123/mod-worgoblin/tree/master/patch-contents) folder to your Data folder in your WoW client and rename the folder to `patch-A.MPQ`. + +> [!IMPORTANT] +> If you are running a patched HD Client support use the following instructions instead or you will have game crashes. + +1. Install the client file [patch-K.MPQ](https://github.com/araxiaonline/wow-client-patches/) in to your WoW Client folder C:/(path to World of Warcraft)/Data/ +2. Copy the files in patch-hd/DBFilesClient onto your server DBC location similar to NonHD version. +3. The character creation pages also are updated with a more modern look to incorporate the 2 new races. ### 5) Remove signature checks from your WoW executable. I recommend Windows users to use [this patcher](https://model-changing.net/index.php?app=downloads&module=downloads&controller=view&id=314&tab=details) created by kebabstorm to patch your Wow.exe file. I recommend macOS users to download this [pre-patched .app file](https://github.com/benjymansy123/custom-race-ac-12_6_21/releases/download/sig-check/WoW.app.zip), since no easy patcher exists for macOS. diff --git a/data/patch-hd/DBFilesClient/Achievement.dbc b/data/patch-hd/DBFilesClient/Achievement.dbc new file mode 100644 index 00000000..03dde87f Binary files /dev/null and b/data/patch-hd/DBFilesClient/Achievement.dbc differ diff --git a/data/patch-hd/DBFilesClient/Achievement_Criteria.dbc b/data/patch-hd/DBFilesClient/Achievement_Criteria.dbc new file mode 100644 index 00000000..82fd72ae Binary files /dev/null and b/data/patch-hd/DBFilesClient/Achievement_Criteria.dbc differ diff --git a/data/patch-hd/DBFilesClient/AnimationData.dbc b/data/patch-hd/DBFilesClient/AnimationData.dbc new file mode 100644 index 00000000..da98f5d1 Binary files /dev/null and b/data/patch-hd/DBFilesClient/AnimationData.dbc differ diff --git a/data/patch-hd/DBFilesClient/BarberShopStyle.dbc b/data/patch-hd/DBFilesClient/BarberShopStyle.dbc new file mode 100644 index 00000000..fc6c5e5d Binary files /dev/null and b/data/patch-hd/DBFilesClient/BarberShopStyle.dbc differ diff --git a/data/patch-hd/DBFilesClient/CharBaseInfo.dbc b/data/patch-hd/DBFilesClient/CharBaseInfo.dbc new file mode 100644 index 00000000..18048502 Binary files /dev/null and b/data/patch-hd/DBFilesClient/CharBaseInfo.dbc differ diff --git a/data/patch-hd/DBFilesClient/CharHairGeosets.dbc b/data/patch-hd/DBFilesClient/CharHairGeosets.dbc new file mode 100644 index 00000000..694d329d Binary files /dev/null and b/data/patch-hd/DBFilesClient/CharHairGeosets.dbc differ diff --git a/data/patch-hd/DBFilesClient/CharHairTextures.dbc b/data/patch-hd/DBFilesClient/CharHairTextures.dbc new file mode 100644 index 00000000..e48e5f1f Binary files /dev/null and b/data/patch-hd/DBFilesClient/CharHairTextures.dbc differ diff --git a/data/patch-hd/DBFilesClient/CharSections.dbc b/data/patch-hd/DBFilesClient/CharSections.dbc new file mode 100644 index 00000000..f5de874f Binary files /dev/null and b/data/patch-hd/DBFilesClient/CharSections.dbc differ diff --git a/data/patch-hd/DBFilesClient/CharStartOutfit.dbc b/data/patch-hd/DBFilesClient/CharStartOutfit.dbc new file mode 100644 index 00000000..2ff378f0 Binary files /dev/null and b/data/patch-hd/DBFilesClient/CharStartOutfit.dbc differ diff --git a/data/patch-hd/DBFilesClient/CharacterFacialHairStyles.dbc b/data/patch-hd/DBFilesClient/CharacterFacialHairStyles.dbc new file mode 100644 index 00000000..a68cb5e5 Binary files /dev/null and b/data/patch-hd/DBFilesClient/CharacterFacialHairStyles.dbc differ diff --git a/data/patch-hd/DBFilesClient/ChrRaces.dbc b/data/patch-hd/DBFilesClient/ChrRaces.dbc new file mode 100644 index 00000000..f5d2ca83 Binary files /dev/null and b/data/patch-hd/DBFilesClient/ChrRaces.dbc differ diff --git a/data/patch-hd/DBFilesClient/CreatureDisplayInfoExtra.dbc b/data/patch-hd/DBFilesClient/CreatureDisplayInfoExtra.dbc new file mode 100644 index 00000000..beca24c8 Binary files /dev/null and b/data/patch-hd/DBFilesClient/CreatureDisplayInfoExtra.dbc differ diff --git a/data/patch-hd/DBFilesClient/CreatureSoundData.dbc b/data/patch-hd/DBFilesClient/CreatureSoundData.dbc new file mode 100644 index 00000000..8f39941a Binary files /dev/null and b/data/patch-hd/DBFilesClient/CreatureSoundData.dbc differ diff --git a/data/patch-hd/DBFilesClient/Creaturedisplayinfo.dbc b/data/patch-hd/DBFilesClient/Creaturedisplayinfo.dbc new file mode 100644 index 00000000..f0e6c5b9 Binary files /dev/null and b/data/patch-hd/DBFilesClient/Creaturedisplayinfo.dbc differ diff --git a/data/patch-hd/DBFilesClient/Creaturemodeldata.dbc b/data/patch-hd/DBFilesClient/Creaturemodeldata.dbc new file mode 100644 index 00000000..17b894e3 Binary files /dev/null and b/data/patch-hd/DBFilesClient/Creaturemodeldata.dbc differ diff --git a/data/patch-hd/DBFilesClient/EmotesTextSound.dbc b/data/patch-hd/DBFilesClient/EmotesTextSound.dbc new file mode 100644 index 00000000..48d9c709 Binary files /dev/null and b/data/patch-hd/DBFilesClient/EmotesTextSound.dbc differ diff --git a/data/patch-hd/DBFilesClient/Faction.dbc b/data/patch-hd/DBFilesClient/Faction.dbc new file mode 100644 index 00000000..66a13aa8 Binary files /dev/null and b/data/patch-hd/DBFilesClient/Faction.dbc differ diff --git a/data/patch-hd/DBFilesClient/HelmetGeosetVisData.dbc b/data/patch-hd/DBFilesClient/HelmetGeosetVisData.dbc new file mode 100644 index 00000000..1e44d6d3 Binary files /dev/null and b/data/patch-hd/DBFilesClient/HelmetGeosetVisData.dbc differ diff --git a/data/patch-hd/DBFilesClient/Item.dbc b/data/patch-hd/DBFilesClient/Item.dbc new file mode 100644 index 00000000..c9bdb965 Binary files /dev/null and b/data/patch-hd/DBFilesClient/Item.dbc differ diff --git a/data/patch-hd/DBFilesClient/ItemDisplayInfo.dbc b/data/patch-hd/DBFilesClient/ItemDisplayInfo.dbc new file mode 100644 index 00000000..713627c3 Binary files /dev/null and b/data/patch-hd/DBFilesClient/ItemDisplayInfo.dbc differ diff --git a/data/patch-hd/DBFilesClient/NameGen.dbc b/data/patch-hd/DBFilesClient/NameGen.dbc new file mode 100644 index 00000000..138f0d62 Binary files /dev/null and b/data/patch-hd/DBFilesClient/NameGen.dbc differ diff --git a/data/patch-hd/DBFilesClient/SkillLine.dbc b/data/patch-hd/DBFilesClient/SkillLine.dbc new file mode 100644 index 00000000..daeb25aa Binary files /dev/null and b/data/patch-hd/DBFilesClient/SkillLine.dbc differ diff --git a/data/patch-hd/DBFilesClient/SkillLineAbility.dbc b/data/patch-hd/DBFilesClient/SkillLineAbility.dbc new file mode 100644 index 00000000..0a5c6295 Binary files /dev/null and b/data/patch-hd/DBFilesClient/SkillLineAbility.dbc differ diff --git a/data/patch-hd/DBFilesClient/SkillRaceClassInfo.dbc b/data/patch-hd/DBFilesClient/SkillRaceClassInfo.dbc new file mode 100644 index 00000000..2b3f77fa Binary files /dev/null and b/data/patch-hd/DBFilesClient/SkillRaceClassInfo.dbc differ diff --git a/data/patch-hd/DBFilesClient/SoundEntries.dbc b/data/patch-hd/DBFilesClient/SoundEntries.dbc new file mode 100644 index 00000000..9af17371 Binary files /dev/null and b/data/patch-hd/DBFilesClient/SoundEntries.dbc differ diff --git a/data/patch-hd/DBFilesClient/Spell.dbc b/data/patch-hd/DBFilesClient/Spell.dbc new file mode 100644 index 00000000..686ff4e6 Binary files /dev/null and b/data/patch-hd/DBFilesClient/Spell.dbc differ diff --git a/data/patch-hd/DBFilesClient/SpellIcon.dbc b/data/patch-hd/DBFilesClient/SpellIcon.dbc new file mode 100644 index 00000000..da5aa018 Binary files /dev/null and b/data/patch-hd/DBFilesClient/SpellIcon.dbc differ diff --git a/data/patch-hd/DBFilesClient/SummonProperties.dbc b/data/patch-hd/DBFilesClient/SummonProperties.dbc new file mode 100644 index 00000000..7da945f4 Binary files /dev/null and b/data/patch-hd/DBFilesClient/SummonProperties.dbc differ diff --git a/data/patch-hd/DBFilesClient/TalentTab.dbc b/data/patch-hd/DBFilesClient/TalentTab.dbc new file mode 100644 index 00000000..4b9674de Binary files /dev/null and b/data/patch-hd/DBFilesClient/TalentTab.dbc differ diff --git a/data/patch-hd/DBFilesClient/VocalUISounds.dbc b/data/patch-hd/DBFilesClient/VocalUISounds.dbc new file mode 100644 index 00000000..68c9cbcb Binary files /dev/null and b/data/patch-hd/DBFilesClient/VocalUISounds.dbc differ diff --git a/data/patch-hd/Interface/CharacterFrame/TemporaryPortrait-Female-Gilnean.blp b/data/patch-hd/Interface/CharacterFrame/TemporaryPortrait-Female-Gilnean.blp new file mode 100644 index 00000000..c5a036e7 Binary files /dev/null and b/data/patch-hd/Interface/CharacterFrame/TemporaryPortrait-Female-Gilnean.blp differ diff --git a/data/patch-hd/Interface/CharacterFrame/TemporaryPortrait-Female-Goblin.blp b/data/patch-hd/Interface/CharacterFrame/TemporaryPortrait-Female-Goblin.blp new file mode 100644 index 00000000..626bf990 Binary files /dev/null and b/data/patch-hd/Interface/CharacterFrame/TemporaryPortrait-Female-Goblin.blp differ diff --git a/data/patch-hd/Interface/CharacterFrame/TemporaryPortrait-Female-Worgen.blp b/data/patch-hd/Interface/CharacterFrame/TemporaryPortrait-Female-Worgen.blp new file mode 100644 index 00000000..7c12a721 Binary files /dev/null and b/data/patch-hd/Interface/CharacterFrame/TemporaryPortrait-Female-Worgen.blp differ diff --git a/data/patch-hd/Interface/CharacterFrame/TemporaryPortrait-Male-Gilnean.blp b/data/patch-hd/Interface/CharacterFrame/TemporaryPortrait-Male-Gilnean.blp new file mode 100644 index 00000000..9e90a4cc Binary files /dev/null and b/data/patch-hd/Interface/CharacterFrame/TemporaryPortrait-Male-Gilnean.blp differ diff --git a/data/patch-hd/Interface/CharacterFrame/TemporaryPortrait-Male-Goblin.blp b/data/patch-hd/Interface/CharacterFrame/TemporaryPortrait-Male-Goblin.blp new file mode 100644 index 00000000..9f466cef Binary files /dev/null and b/data/patch-hd/Interface/CharacterFrame/TemporaryPortrait-Male-Goblin.blp differ diff --git a/data/patch-hd/Interface/CharacterFrame/TemporaryPortrait-Male-Worgen.blp b/data/patch-hd/Interface/CharacterFrame/TemporaryPortrait-Male-Worgen.blp new file mode 100644 index 00000000..cc5b645f Binary files /dev/null and b/data/patch-hd/Interface/CharacterFrame/TemporaryPortrait-Male-Worgen.blp differ diff --git a/data/patch-hd/Interface/DialogFrame/UI-DialogBox-Background-Dark.blp b/data/patch-hd/Interface/DialogFrame/UI-DialogBox-Background-Dark.blp new file mode 100644 index 00000000..13e61d1f Binary files /dev/null and b/data/patch-hd/Interface/DialogFrame/UI-DialogBox-Background-Dark.blp differ diff --git a/data/patch-hd/Interface/FrameXML/PetPaperDollFrame.lua b/data/patch-hd/Interface/FrameXML/PetPaperDollFrame.lua new file mode 100644 index 00000000..89c6562f --- /dev/null +++ b/data/patch-hd/Interface/FrameXML/PetPaperDollFrame.lua @@ -0,0 +1,634 @@ +NUM_PET_RESISTANCE_TYPES = 5; +NUM_PET_STATS = 5; +NUM_COMPANIONS_PER_PAGE = 12; + +function PetPaperDollFrame_OnLoad (self) + self:RegisterEvent("PET_UI_UPDATE"); + self:RegisterEvent("PET_BAR_UPDATE"); + self:RegisterEvent("PET_UI_CLOSE"); + self:RegisterEvent("UNIT_NAME_UPDATE"); + self:RegisterEvent("UNIT_PET"); + self:RegisterEvent("UNIT_PET_EXPERIENCE"); + self:RegisterEvent("UNIT_MODEL_CHANGED"); + self:RegisterEvent("UNIT_LEVEL"); + self:RegisterEvent("UNIT_RESISTANCES"); + self:RegisterEvent("UNIT_STATS"); + self:RegisterEvent("UNIT_DAMAGE"); + self:RegisterEvent("UNIT_RANGEDDAMAGE"); + self:RegisterEvent("UNIT_ATTACK_SPEED"); + self:RegisterEvent("UNIT_ATTACK_POWER"); + self:RegisterEvent("UNIT_RANGED_ATTACK_POWER"); + self:RegisterEvent("UNIT_DEFENSE"); + self:RegisterEvent("UNIT_ATTACK"); + self:RegisterEvent("PLAYER_ENTERING_WORLD"); + self:RegisterEvent("COMPANION_LEARNED"); + self:RegisterEvent("COMPANION_UNLEARNED"); + self:RegisterEvent("COMPANION_UPDATE"); + self:RegisterEvent("SPELL_UPDATE_COOLDOWN"); + self:RegisterEvent("UNIT_ENTERED_VEHICLE"); + self:RegisterEvent("UNIT_EXITED_VEHICLE"); + self:RegisterEvent("PET_SPELL_POWER_UPDATE"); + + PetPaperDollFrameCompanionFrame.mode = "CRITTER"; + PetPaperDollFrameCompanionFrame.idMount = GetCompanionInfo("MOUNT", 1); + PetPaperDollFrameCompanionFrame.pageMount = 0; + PetPaperDollFrameCompanionFrame.idCritter = GetCompanionInfo("CRITTER", 1); + PetPaperDollFrameCompanionFrame.pageCritter = 0; + + PetDamageFrameLabel:SetText(format(STAT_FORMAT, DAMAGE)); + PetAttackPowerFrameLabel:SetText(format(STAT_FORMAT, ATTACK_POWER)); + PetArmorFrameLabel:SetText(format(STAT_FORMAT, ARMOR)); + SetTextStatusBarTextPrefix(PetPaperDollFrameExpBar, XP); + PetSpellDamageFrameLabel:SetText(format(STAT_FORMAT, SPELL_BONUS)); +end + +local tabPoints={ + [1]={ point="TOPLEFT", relativeTo="PetPaperDollFrameCompanionFrame", relativePoint="TOPLEFT", xoffset=70, yoffset=-39}, + [2]={ point="LEFT", relativePoint="RIGHT", xoffset=0, yoffset=0}, + [3]={ point="LEFT", relativePoint="RIGHT", xoffset=0, yoffset=0}, +} + +function PetPaperDollFrame_UpdateIsAvailable() + if ( (not HasPetUI()) and (GetNumCompanions("CRITTER") == 0) and (GetNumCompanions("MOUNT") == 0) ) then + PetPaperDollFrame.hidden = true; + CharacterFrameTab2:Hide(); + CharacterFrameTab3:SetPoint("LEFT", "CharacterFrameTab2", "LEFT", 0, 0); + if ( PetPaperDollFrame:IsVisible() ) then --We have the pet frame selected, but nothing to show on it + ToggleCharacter("PaperDollFrame"); + end + else + PetPaperDollFrame.hidden = false; + CharacterFrameTab2:Show(); + CharacterFrameTab3:SetPoint("LEFT", "CharacterFrameTab2", "RIGHT", -16, 0); + end +end + +function PetPaperDollFrame_UpdateTabs() + if ( not PetPaperDollFrame:IsVisible() ) then + -- There's no need to run this when the frame isn't shown (i.e. we're zoning), it causes problems with the subtabs (bug 145137) + PetPaperDollFrame_UpdateIsAvailable(); --But we still need to update the tabs on the CharacterFrame (bug 150500) + return; + end + + local currVal, currRef = 1, tabPoints[1]; + + --PetPaperDollFrameTab1:ClearAllPoints() --Never moved, just hidden + PetPaperDollFrameTab2:ClearAllPoints() + PetPaperDollFrameTab3:ClearAllPoints() + if ( HasPetUI() ) then + PetPaperDollFrameTab1:Show(); + PetPaperDollFrameTab1:SetPoint(currRef.point, currRef.relativeTo, currRef.relativePoint, currRef.xoffset, currRef.yoffset) + currVal = currVal + 1; + currRef = tabPoints[currVal]; + currRef.relativeTo = PetPaperDollFrameTab1; + else + PetPaperDollFrameTab1:Hide(); + end + + if ( GetNumCompanions("CRITTER") > 0 ) then + PetPaperDollFrameTab2:Show(); + PetPaperDollFrameTab2:SetPoint(currRef.point, currRef.relativeTo, currRef.relativePoint, currRef.xoffset, currRef.yoffset); + currVal = currVal + 1; + currRef = tabPoints[currVal]; + currRef.relativeTo = PetPaperDollFrameTab2; + else + PetPaperDollFrameTab2:Hide(); + end + + if ( GetNumCompanions("MOUNT") > 0 ) then + PetPaperDollFrameTab3:Show(); + PetPaperDollFrameTab3:SetPoint(currRef.point, currRef.relativeTo, currRef.relativePoint, currRef.xoffset, currRef.yoffset); + currVal = currVal + 1; + else + PetPaperDollFrameTab3:Hide(); + end + + PetPaperDollFrame_UpdateIsAvailable(); + + local selectedTab = PanelTemplates_GetSelectedTab(PetPaperDollFrame); + if ( (not PetPaperDollFrame.selectedTab) or (not PetPaperDollFrame_BeenViewed) or (not _G["PetPaperDollFrameTab"..selectedTab]:IsShown()) ) then + if ( PetPaperDollFrameTab1:IsShown() ) then + PetPaperDollFrame_SetTab(1); + elseif ( PetPaperDollFrameTab2:IsShown() ) then + PetPaperDollFrame_SetTab(2); + elseif ( PetPaperDollFrameTab3:IsShown() ) then + PetPaperDollFrame_SetTab(3); + else + if ( PetPaperDollFrame:IsVisible() ) then + ToggleCharacter("PaperDollFrame"); + end + end + end + + if ( currVal == 2 ) then --Only 1 tab shown, so no reason to make it visible. + PetPaperDollFrameTab1:Hide(); + PetPaperDollFrameTab2:Hide(); + PetPaperDollFrameTab3:Hide(); + end +end + +function PetPaperDollFrame_OnEvent (self, event, ...) + local arg1 = ...; + if ( event == "PET_UI_UPDATE" or event == "PET_UI_CLOSE" or event == "PET_BAR_UPDATE" or (event == "UNIT_PET" and arg1 == "player") or + (event == "UNIT_NAME_UPDATE" and arg1 == "pet") ) then + PetPaperDollFrame_UpdateTabs(); + PetPaperDollFrame_Update(); + elseif ( event == "UNIT_PET_EXPERIENCE" ) then + PetExpBar_Update(); + elseif ( event == "COMPANION_LEARNED" ) then + if ( not CharacterFrame:IsVisible() ) then + SetButtonPulse(CharacterMicroButton, 60, 1); + end + if ( not PetPaperDollFrame:IsVisible() ) then + SetButtonPulse(CharacterFrameTab2, 60, 1); + end + PetPaperDollFrame_UpdateTabs(); + --PetPaperDollFrame_UpdateCompanions(); --This is called in SetCompanionPage + PetPaperDollFrame_SetCompanionPage((PetPaperDollFrameCompanionFrame.mode=="MOUNT") and PetPaperDollFrameCompanionFrame.pageMount or PetPaperDollFrameCompanionFrame.pageCritter); + elseif ( event == "COMPANION_UNLEARNED" ) then + local page; + local numCompanions = GetNumCompanions(PetPaperDollFrameCompanionFrame.mode); + if ( PetPaperDollFrameCompanionFrame.mode=="MOUNT" ) then + page = PetPaperDollFrameCompanionFrame.pageMount; + if ( numCompanions > 0 ) then + PetPaperDollFrameCompanionFrame.idMount = GetCompanionInfo("MOUNT", 1); + PetPaperDollFrame_UpdateCompanionPreview(); + else + PetPaperDollFrameCompanionFrame.idMount = nil; + end + else + page = PetPaperDollFrameCompanionFrame.pageCritter; + if ( numCompanions > 0 ) then + PetPaperDollFrameCompanionFrame.idCritter = GetCompanionInfo("CRITTER", 1); + PetPaperDollFrame_UpdateCompanionPreview() + else + PetPaperDollFrameCompanionFrame.idCritter = nil; + end + end + page = min(ceil(numCompanions/NUM_COMPANIONS_PER_PAGE) - 1, page); + page = max(page, 0); + PetPaperDollFrame_SetCompanionPage(page); -- The pages are 0 based to make the mathematical calculations slightly faster. + PetPaperDollFrame_UpdateTabs(); + elseif ( event == "COMPANION_UPDATE" ) then + if ( not PetPaperDollFrameCompanionFrame.idMount ) then + PetPaperDollFrameCompanionFrame.idMount = GetCompanionInfo("MOUNT", 1); + end + if ( not PetPaperDollFrameCompanionFrame.idCritter ) then + PetPaperDollFrameCompanionFrame.idCritter = GetCompanionInfo("CRITTER", 1); + end + PetPaperDollFrame_UpdateCompanions(); + elseif ( event == "SPELL_UPDATE_COOLDOWN" ) then + if ( self:IsVisible() ) then + PetPaperDollFrame_UpdateCompanionCooldowns(); + end + elseif( event == "PET_SPELL_POWER_UPDATE" ) then + PetPaperDollFrame_SetSpellBonusDamage(); + elseif ( (event == "UNIT_ENTERED_VEHICLE" or event == "UNIT_EXITED_VEHICLE") and (arg1 == "player")) then + PetPaperDollFrame_UpdateCompanions(); + elseif ( arg1 == "pet" ) then + PetPaperDollFrame_Update(); + end +end + +function PetPaperDollFrame_SetTab(id) + if ( (id == 1) and HasPetUI() ) then --Pet Tab + PetPaperDollFrame.selectedTab=1; + PetPaperDollFramePetFrame:Show(); + PetPaperDollFrameCompanionFrame:Hide(); + PetNameText:SetText(UnitName("pet")); + elseif ( (id == 2) and (GetNumCompanions("CRITTER") > 0) ) then --Critter Tab + PetPaperDollFrame.selectedTab=2; + PetPaperDollFrameCompanionFrame.mode="CRITTER"; + PetPaperDollFramePetFrame:Hide(); + PetPaperDollFrameCompanionFrame:Show(); + PetPaperDollFrame_SetCompanionPage(PetPaperDollFrameCompanionFrame.pageCritter); + for i=1,NUM_COMPANIONS_PER_PAGE do + _G["CompanionButton"..i]:SetDisabledTexture([[Interface\PetPaperDollFrame\UI-PetFrame-Slots-Companions]]) + end + PetPaperDollFrame_UpdateCompanions(); + PetPaperDollFrame_UpdateCompanionPreview(); + PetNameText:SetText(COMPANIONS); + elseif ( (id == 3) and (GetNumCompanions("MOUNT") > 0) ) then --Mount Tab + PetPaperDollFrame.selectedTab=3; + PetPaperDollFrameCompanionFrame.mode="MOUNT"; + PetPaperDollFramePetFrame:Hide(); + PetPaperDollFrameCompanionFrame:Show(); + PetPaperDollFrame_SetCompanionPage(PetPaperDollFrameCompanionFrame.pageMount); + for i=1,NUM_COMPANIONS_PER_PAGE do + _G["CompanionButton"..i]:SetDisabledTexture([[Interface\PetPaperDollFrame\UI-PetFrame-Slots-Mounts]]); + end + PetPaperDollFrame_UpdateCompanions(); + PetPaperDollFrame_UpdateCompanionPreview(); + PetNameText:SetText(MOUNTS); + end + + for i=1,3 do + if ( i == id ) then + PanelTemplates_SelectTab(_G["PetPaperDollFrameTab"..i]); + else + PanelTemplates_DeselectTab(_G["PetPaperDollFrameTab"..i]); + end + end +end + +function PetPaperDollFrame_FindCompanionIndex(creatureID, mode) + if ( not mode ) then + mode = PetPaperDollFrameCompanionFrame.mode; + end + if (not creatureID ) then + creatureID = (PetPaperDollFrameCompanionFrame.mode=="MOUNT") and PetPaperDollFrameCompanionFrame.idMount or PetPaperDollFrameCompanionFrame.idCritter; + end + for i=1,GetNumCompanions(mode) do + if ( GetCompanionInfo(mode, i) == creatureID ) then + return i; + end + end + return 0 +end + +function CompanionSummonButton_OnClick() + local selected = PetPaperDollFrame_FindCompanionIndex(); + local creatureID, creatureName, spellID, icon, active = GetCompanionInfo(PetPaperDollFrameCompanionFrame.mode, selected); + if ( active ) then + DismissCompanion(PetPaperDollFrameCompanionFrame.mode); + PlaySound("igMainMenuOptionCheckBoxOn"); + else + CallCompanion(PetPaperDollFrameCompanionFrame.mode, selected); + PlaySound("igMainMenuOptionCheckBoxOff"); + end +end + +function CompanionButton_OnLoad(self) + self:RegisterForDrag("LeftButton"); + self:RegisterForClicks("LeftButtonUp", "RightButtonUp"); +end + +function CompanionButton_OnDrag(self) + local offset; + + if ( PetPaperDollFrameCompanionFrame.mode=="CRITTER" ) then + offset = (PetPaperDollFrameCompanionFrame.pageCritter or 0)*NUM_COMPANIONS_PER_PAGE; + elseif ( PetPaperDollFrameCompanionFrame.mode=="MOUNT" ) then + offset = (PetPaperDollFrameCompanionFrame.pageMount or 0)*NUM_COMPANIONS_PER_PAGE; + end + local dragged = self:GetID() + offset; + PickupCompanion( PetPaperDollFrameCompanionFrame.mode, dragged ); +end + +function CompanionButton_OnClick(self, button) + local selected, selectedID; + if ( PetPaperDollFrameCompanionFrame.mode == "CRITTER" ) then + selected = PetPaperDollFrame_FindCompanionIndex(PetPaperDollFrameCompanionFrame.idCritter); + selectedID = PetPaperDollFrameCompanionFrame.idCritter; + elseif ( PetPaperDollFrameCompanionFrame.mode == "MOUNT" ) then + selected = PetPaperDollFrame_FindCompanionIndex(PetPaperDollFrameCompanionFrame.idMount); + selectedID = PetPaperDollFrameCompanionFrame.idMount; + end + if ( button ~= "LeftButton" or ( selectedID == self.creatureID) ) then + local offset; + if ( PetPaperDollFrameCompanionFrame.mode == "CRITTER" ) then + offset = (PetPaperDollFrameCompanionFrame.pageCritter or 0) * NUM_COMPANIONS_PER_PAGE; + elseif ( PetPaperDollFrameCompanionFrame.mode == "MOUNT" ) then + offset = (PetPaperDollFrameCompanionFrame.pageMount or 0) * NUM_COMPANIONS_PER_PAGE; + end + local index = self:GetID() + offset; + if ( self.active ) then + DismissCompanion(PetPaperDollFrameCompanionFrame.mode); + else + CallCompanion(PetPaperDollFrameCompanionFrame.mode, index); + end + else + if ( PetPaperDollFrameCompanionFrame.mode == "CRITTER" ) then + PetPaperDollFrameCompanionFrame.idCritter = self.creatureID; + PetPaperDollFrame_UpdateCompanionPreview(); + elseif ( PetPaperDollFrameCompanionFrame.mode == "MOUNT" ) then + PetPaperDollFrameCompanionFrame.idMount = self.creatureID; + PetPaperDollFrame_UpdateCompanionPreview(); + end + end + + PetPaperDollFrame_UpdateCompanions(); +end + +function CompanionButton_OnModifiedClick(self) + local id = self.spellID; + if ( IsModifiedClick("CHATLINK") ) then + if ( MacroFrame and MacroFrame:IsShown() ) then + local spellName = GetSpellInfo(id); + ChatEdit_InsertLink(spellName); + else + local spellLink = GetSpellLink(id) + ChatEdit_InsertLink(spellLink); + end + elseif ( IsModifiedClick("PICKUPACTION") ) then + CompanionButton_OnDrag(self); + end + PetPaperDollFrame_UpdateCompanions(); --Set up the highlights again +end +function CompanionButton_OnEnter(self) + if ( GetCVar("UberTooltips") == "1" ) then + GameTooltip_SetDefaultAnchor(GameTooltip, self); + else + GameTooltip:SetOwner(self, "ANCHOR_LEFT"); + end + + if ( GameTooltip:SetHyperlink("spell:"..self.spellID) ) then + self.UpdateTooltip = CompanionButton_OnEnter; + else + self.UpdateTooltip = nil; + end + + GameTooltip:Show() +end + +function PetPaperDollFrame_SetCompanionPage(num) + if ( PetPaperDollFrameCompanionFrame.mode == "CRITTER" ) then + PetPaperDollFrameCompanionFrame.pageCritter = num; + elseif ( PetPaperDollFrameCompanionFrame.mode == "MOUNT" ) then + PetPaperDollFrameCompanionFrame.pageMount = num; + end + + num = num + 1; --For easier usage + local maxpage = ceil(GetNumCompanions(PetPaperDollFrameCompanionFrame.mode)/NUM_COMPANIONS_PER_PAGE); + CompanionPageNumber:SetFormattedText(MERCHANT_PAGE_NUMBER,num, maxpage); + if ( num <= 1 ) then + CompanionPrevPageButton:Disable(); + else + CompanionPrevPageButton:Enable(); + end + if ( num >= maxpage ) then + CompanionNextPageButton:Disable(); + else + CompanionNextPageButton:Enable(); + end + PetPaperDollFrame_UpdateCompanions(); + PetPaperDollFrame_UpdateCompanionCooldowns(); +end + +function PetPaperDollFrame_UpdateCompanions() + local button, iconTexture, id; + local creatureID, creatureName, spellID, icon, active; + local offset, selected; + + if ( PetPaperDollFrameCompanionFrame.mode == "CRITTER" ) then + offset = (PetPaperDollFrameCompanionFrame.pageCritter or 0)*NUM_COMPANIONS_PER_PAGE; + selected = PetPaperDollFrame_FindCompanionIndex(PetPaperDollFrameCompanionFrame.idCritter); + elseif ( PetPaperDollFrameCompanionFrame.mode == "MOUNT" ) then + offset = (PetPaperDollFrameCompanionFrame.pageMount or 0)*NUM_COMPANIONS_PER_PAGE; + selected = PetPaperDollFrame_FindCompanionIndex(PetPaperDollFrameCompanionFrame.idMount); + end + + for i = 1, NUM_COMPANIONS_PER_PAGE do + button = _G["CompanionButton"..i]; + id = i + (offset or 0); + creatureID, creatureName, spellID, icon, active = GetCompanionInfo(PetPaperDollFrameCompanionFrame.mode, id); + button.creatureID = creatureID; + button.spellID = spellID; + button.active = active; + if ( creatureID ) then + button:SetNormalTexture(icon); + button:Enable(); + else + button:Disable(); + end + if ( (id == selected) and creatureID ) then + button:SetChecked(true); + else + button:SetChecked(false); + end + + if ( active ) then + _G["CompanionButton"..i.."ActiveTexture"]:Show(); + else + _G["CompanionButton"..i.."ActiveTexture"]:Hide(); + end + end + + if ( selected > 0 ) then + creatureID, creatureName, spellID, icon, active = GetCompanionInfo(PetPaperDollFrameCompanionFrame.mode, selected); + if ( active and creatureID ) then + CompanionSummonButton:SetText(PetPaperDollFrameCompanionFrame.mode == "MOUNT" and BINDING_NAME_DISMOUNT or PET_DISMISS); + else + CompanionSummonButton:SetText(PetPaperDollFrameCompanionFrame.mode == "MOUNT" and MOUNT or SUMMON); + end + end +end + +function PetPaperDollFrame_UpdateCompanionCooldowns() + local offset; + if ( PetPaperDollFrameCompanionFrame.mode == "CRITTER" ) then + offset = (PetPaperDollFrameCompanionFrame.pageCritter or 0)*NUM_COMPANIONS_PER_PAGE; + elseif ( PetPaperDollFrameCompanionFrame.mode == "MOUNT" ) then + offset = (PetPaperDollFrameCompanionFrame.pageMount or 0)*NUM_COMPANIONS_PER_PAGE; + end + for i = 1, NUM_COMPANIONS_PER_PAGE do + local button = _G["CompanionButton"..i]; + local cooldown = _G[button:GetName().."Cooldown"]; + if ( button.creatureID ) then + local start, duration, enable = GetCompanionCooldown(PetPaperDollFrameCompanionFrame.mode, offset + button:GetID()); + if ( start and duration and enable ) then + CooldownFrame_SetTimer(cooldown, start, duration, enable); + end + else + cooldown:Hide(); + end + end +end + +function PetPaperDollFrame_UpdateCompanionPreview() + local selected = PetPaperDollFrame_FindCompanionIndex(); + + if (selected > 0) then + local creatureID, creatureName = GetCompanionInfo(PetPaperDollFrameCompanionFrame.mode, selected); + CompanionModelFrame:SetCreature(creatureID); + CompanionSelectedName:SetText(creatureName); + if ( creatureName == "Mountain Horse" or creatureName == "Swift Mountain Horse" ) then + CompanionModelFrame:SetPosition(0,-1,1.6); + end + end +end + +PetPaperDollFrame_BeenViewed = false; +function PetPaperDollFrame_OnShow(self) + if ( self:IsVisible() ) then + PetPaperDollFrame_BeenViewed = true; + end + SetButtonPulse(CharacterFrameTab2, 0, 1); --Stop the button pulse + CharacterNameText:Hide(); + PetNameText:Show(); + PetPaperDollFrame_Update(); + PetPaperDollFrame_UpdateTabs(); +end + +function PetPaperDollFrame_OnHide() + CharacterNameText:Show(); + PetNameText:Hide(); +end + +function PetPaperDollFrame_Update() + local hasPetUI, canGainXP = HasPetUI(); + if ( not hasPetUI ) then + return; + end + PetModelFrame:SetUnit("pet"); + if ( UnitCreatureFamily("pet") ) then + PetLevelText:SetFormattedText(UNIT_TYPE_LEVEL_TEMPLATE,UnitLevel("pet"),UnitCreatureFamily("pet")); + end + if ( PetPaperDollFramePetFrame:IsShown() ) then + PetNameText:SetText(UnitName("pet")); + end + PetExpBar_Update(); + PetPaperDollFrame_SetResistances(); + PetPaperDollFrame_SetStats(); + PaperDollFrame_SetDamage(PetDamageFrame, "Pet"); + PaperDollFrame_SetArmor(PetArmorFrame, "Pet"); + PaperDollFrame_SetAttackPower(PetAttackPowerFrame, "Pet"); + PetPaperDollFrame_SetSpellBonusDamage(); + + if ( canGainXP ) then + PetPaperDollPetInfo:Show(); + else + PetPaperDollPetInfo:Hide(); + end +end + +function PetPaperDollFrame_SetResistances() + local resistance; + local positive; + local negative; + local base; + local index; + local text; + local frame; + for i=1, NUM_PET_RESISTANCE_TYPES, 1 do + index = i + 1; + if ( i == NUM_PET_RESISTANCE_TYPES ) then + index = 1; + end + text = _G["PetMagicResText"..i]; + frame = _G["PetMagicResFrame"..i]; + + base, resistance, positive, negative = UnitResistance("pet", frame:GetID()); + + frame.tooltip = _G["RESISTANCE"..frame:GetID().."_NAME"]; + + -- resistances can now be negative. Show Red if negative, Green if positive, white otherwise + if( resistance < 0 ) then + text:SetText(RED_FONT_COLOR_CODE..resistance..FONT_COLOR_CODE_CLOSE); + elseif( resistance == 0 ) then + text:SetText(resistance); + else + text:SetText(GREEN_FONT_COLOR_CODE..resistance..FONT_COLOR_CODE_CLOSE); + end + + if ( positive ~= 0 or negative ~= 0 ) then + -- Otherwise build up the formula + frame.tooltip = frame.tooltip.. " ( "..HIGHLIGHT_FONT_COLOR_CODE..base; + if( positive > 0 ) then + frame.tooltip = frame.tooltip..GREEN_FONT_COLOR_CODE.." +"..positive; + end + if( negative < 0 ) then + frame.tooltip = frame.tooltip.." "..RED_FONT_COLOR_CODE..negative; + end + frame.tooltip = frame.tooltip..FONT_COLOR_CODE_CLOSE.." )"; + end + end +end + +function PetPaperDollFrame_SetStats() + for i=1, NUM_PET_STATS, 1 do + local label = _G["PetStatFrame"..i.."Label"]; + local text = _G["PetStatFrame"..i.."StatText"]; + local frame = _G["PetStatFrame"..i]; + local stat; + local effectiveStat; + local posBuff; + local negBuff; + label:SetText(format(STAT_FORMAT, _G["SPELL_STAT"..i.."_NAME"])); + stat, effectiveStat, posBuff, negBuff = UnitStat("pet", i); + -- Set the tooltip text + local tooltipText = HIGHLIGHT_FONT_COLOR_CODE..format(PAPERDOLLFRAME_TOOLTIP_FORMAT, _G["SPELL_STAT"..i.."_NAME"]).." "; + + if ( ( posBuff == 0 ) and ( negBuff == 0 ) ) then + text:SetText(effectiveStat); + frame.tooltip = tooltipText..effectiveStat..FONT_COLOR_CODE_CLOSE; + else + tooltipText = tooltipText..effectiveStat; + if ( posBuff > 0 or negBuff < 0 ) then + tooltipText = tooltipText.." ("..(stat - posBuff - negBuff)..FONT_COLOR_CODE_CLOSE; + end + if ( posBuff > 0 ) then + tooltipText = tooltipText..FONT_COLOR_CODE_CLOSE..GREEN_FONT_COLOR_CODE.."+"..posBuff..FONT_COLOR_CODE_CLOSE; + end + if ( negBuff < 0 ) then + tooltipText = tooltipText..RED_FONT_COLOR_CODE.." "..negBuff..FONT_COLOR_CODE_CLOSE; + end + if ( posBuff > 0 or negBuff < 0 ) then + tooltipText = tooltipText..HIGHLIGHT_FONT_COLOR_CODE..")"..FONT_COLOR_CODE_CLOSE; + end + frame.tooltip = tooltipText; + + -- If there are any negative buffs then show the main number in red even if there are + -- positive buffs. Otherwise show in green. + if ( negBuff < 0 ) then + text:SetText(RED_FONT_COLOR_CODE..effectiveStat..FONT_COLOR_CODE_CLOSE); + else + text:SetText(GREEN_FONT_COLOR_CODE..effectiveStat..FONT_COLOR_CODE_CLOSE); + end + end + + -- Second tooltip line + frame.tooltip2 = _G["DEFAULT_STAT"..i.."_TOOLTIP"]; + if ( i == 1 ) then + local attackPower = effectiveStat-20; + frame.tooltip2 = format(frame.tooltip2, attackPower); + elseif ( i == 2 ) then + local newLineIndex = strfind(frame.tooltip2, "|n")+1; + frame.tooltip2 = strsub(frame.tooltip2, 1, newLineIndex); + frame.tooltip2 = format(frame.tooltip2, GetCritChanceFromAgility("pet")); + elseif ( i == 3 ) then + local expectedHealthGain = (((stat - posBuff - negBuff)-20)*10+20)*GetUnitHealthModifier("pet"); + local realHealthGain = ((effectiveStat-20)*10+20)*GetUnitHealthModifier("pet"); + local healthGain = (realHealthGain - expectedHealthGain)*GetUnitMaxHealthModifier("pet"); + frame.tooltip2 = format(frame.tooltip2, healthGain); + elseif ( i == 4 ) then + if ( UnitHasMana("pet") ) then + local manaGain = ((effectiveStat-20)*15+20)*GetUnitPowerModifier("pet"); + frame.tooltip2 = format(frame.tooltip2, manaGain, GetSpellCritChanceFromIntellect("pet")); + else + local newLineIndex = strfind(frame.tooltip2, "|n")+2; + frame.tooltip2 = strsub(frame.tooltip2, newLineIndex); + frame.tooltip2 = format(frame.tooltip2, GetSpellCritChanceFromIntellect("pet")); + end + elseif ( i == 5 ) then + frame.tooltip2 = format(frame.tooltip2, GetUnitHealthRegenRateFromSpirit("pet")); + if ( UnitHasMana("pet") ) then + frame.tooltip2 = frame.tooltip2.."\n"..format(MANA_REGEN_FROM_SPIRIT, GetUnitManaRegenRateFromSpirit("pet")); + end + end + end +end + +function PetPaperDollFrame_SetSpellBonusDamage() + local spellDamageBonus = GetPetSpellBonusDamage(); + local spellDamageBonusText = format("%d",spellDamageBonus); + + PetSpellDamageFrameLabel:SetText(format(STAT_FORMAT, SPELL_BONUS)); + if ( spellDamageBonus > 0 ) then + spellDamageBonusText = GREEN_FONT_COLOR_CODE.."+"..spellDamageBonusText..FONT_COLOR_CODE_CLOSE; + elseif( spellDamageBonus < 0 ) then + spellDamageBonusText = RED_FONT_COLOR_CODE..spellDamageBonusText..FONT_COLOR_CODE_CLOSE; + end + + PetSpellDamageFrameStatText:SetText(spellDamageBonusText); + PetSpellDamageFrame.tooltip = HIGHLIGHT_FONT_COLOR_CODE..format(PAPERDOLLFRAME_TOOLTIP_FORMAT, SPELL_BONUS)..FONT_COLOR_CODE_CLOSE.." "..spellDamageBonusText; + PetSpellDamageFrame.tooltip2 = DEFAULT_STATSPELLBONUS_TOOLTIP; + + PetSpellDamageFrame:Show(); +end + +function PetExpBar_Update() + local currXP, nextXP = GetPetExperience(); + PetPaperDollFrameExpBar:SetMinMaxValues(min(0, currXP), nextXP); + PetPaperDollFrameExpBar:SetValue(currXP); +end diff --git a/data/patch-hd/Interface/FrameXML/UIPanelTemplates.lua b/data/patch-hd/Interface/FrameXML/UIPanelTemplates.lua new file mode 100644 index 00000000..468c50b2 --- /dev/null +++ b/data/patch-hd/Interface/FrameXML/UIPanelTemplates.lua @@ -0,0 +1,465 @@ +-- functions to manage tab interfaces where only one tab of a group may be selected +function PanelTemplates_Tab_OnClick(self, frame) + PanelTemplates_SetTab(frame, self:GetID()) +end + +function PanelTemplates_SetTab(frame, id) + frame.selectedTab = id; + PanelTemplates_UpdateTabs(frame); +end + +function PanelTemplates_GetSelectedTab(frame) + return frame.selectedTab; +end + +function PanelTemplates_UpdateTabs(frame) + if ( frame.selectedTab ) then + local tab; + for i=1, frame.numTabs, 1 do + tab = _G[frame:GetName().."Tab"..i]; + if ( tab.isDisabled ) then + PanelTemplates_SetDisabledTabState(tab); + elseif ( i == frame.selectedTab ) then + PanelTemplates_SelectTab(tab); + else + PanelTemplates_DeselectTab(tab); + end + end + end +end + +function PanelTemplates_GetTabWidth(tab) + local tabName = tab:GetName(); + + local sideWidths = 2 * _G[tabName.."Left"]:GetWidth(); + return tab:GetTextWidth() + sideWidths; +end + +function PanelTemplates_TabResize(tab, padding, absoluteSize, maxWidth, absoluteTextSize) + local tabName = tab:GetName(); + + local buttonMiddle = _G[tabName.."Middle"]; + local buttonMiddleDisabled = _G[tabName.."MiddleDisabled"]; + local sideWidths = 2 * _G[tabName.."Left"]:GetWidth(); + local tabText = _G[tab:GetName().."Text"]; + local width, tabWidth; + local textWidth; + if ( absoluteTextSize ) then + textWidth = absoluteTextSize; + else + textWidth = tabText:GetWidth(); + end + -- If there's an absolute size specified then use it + if ( absoluteSize ) then + if ( absoluteSize < sideWidths) then + width = 1; + tabWidth = sideWidths + else + width = absoluteSize - sideWidths; + tabWidth = absoluteSize + end + tabText:SetWidth(width); + else + -- Otherwise try to use padding + if ( padding ) then + width = textWidth + padding; + else + width = textWidth + 24; + end + -- If greater than the maxWidth then cap it + if ( maxWidth and width > maxWidth ) then + if ( padding ) then + width = maxWidth + padding; + else + width = maxWidth + 24; + end + tabText:SetWidth(width); + else + tabText:SetWidth(0); + end + tabWidth = width + sideWidths; + end + + if ( buttonMiddle ) then + buttonMiddle:SetWidth(width); + end + if ( buttonMiddleDisabled ) then + buttonMiddleDisabled:SetWidth(width); + end + + tab:SetWidth(tabWidth); + local highlightTexture = _G[tabName.."HighlightTexture"]; + if ( highlightTexture ) then + highlightTexture:SetWidth(tabWidth); + end +end + +function PanelTemplates_SetNumTabs(frame, numTabs) + frame.numTabs = numTabs; +end + +function PanelTemplates_DisableTab(frame, index) + _G[frame:GetName().."Tab"..index].isDisabled = 1; + PanelTemplates_UpdateTabs(frame); +end + +function PanelTemplates_EnableTab(frame, index) + local tab = _G[frame:GetName().."Tab"..index]; + tab.isDisabled = nil; + -- Reset text color + tab:SetDisabledFontObject(GameFontHighlightSmall); + PanelTemplates_UpdateTabs(frame); +end + +function PanelTemplates_DeselectTab(tab) + local name = tab:GetName(); + _G[name.."Left"]:Show(); + _G[name.."Middle"]:Show(); + _G[name.."Right"]:Show(); + --tab:UnlockHighlight(); + tab:Enable(); + _G[name.."LeftDisabled"]:Hide(); + _G[name.."MiddleDisabled"]:Hide(); + _G[name.."RightDisabled"]:Hide(); +end + +function PanelTemplates_SelectTab(tab) + local name = tab:GetName(); + _G[name.."Left"]:Hide(); + _G[name.."Middle"]:Hide(); + _G[name.."Right"]:Hide(); + --tab:LockHighlight(); + tab:Disable(); + tab:SetDisabledFontObject(GameFontHighlightSmall); + _G[name.."LeftDisabled"]:Show(); + _G[name.."MiddleDisabled"]:Show(); + _G[name.."RightDisabled"]:Show(); + + if ( GameTooltip:IsOwned(tab) ) then + GameTooltip:Hide(); + end +end + +function PanelTemplates_SetDisabledTabState(tab) + local name = tab:GetName(); + _G[name.."Left"]:Show(); + _G[name.."Middle"]:Show(); + _G[name.."Right"]:Show(); + --tab:UnlockHighlight(); + tab:Disable(); + tab.text = tab:GetText(); + -- Gray out text + tab:SetDisabledFontObject(GameFontDisableSmall); + _G[name.."LeftDisabled"]:Hide(); + _G[name.."MiddleDisabled"]:Hide(); + _G[name.."RightDisabled"]:Hide(); +end + +function ScrollFrameTemplate_OnMouseWheel(self, value, scrollBar) + scrollBar = scrollBar or _G[self:GetName() .. "ScrollBar"]; + if ( value > 0 ) then + scrollBar:SetValue(scrollBar:GetValue() - (scrollBar:GetHeight() / 2)); + else + scrollBar:SetValue(scrollBar:GetValue() + (scrollBar:GetHeight() / 2)); + end +end + +-- Function to handle the update of manually calculated scrollframes. Used mostly for listings with an indeterminate number of items +function FauxScrollFrame_Update(frame, numItems, numToDisplay, valueStep, button, smallWidth, bigWidth, highlightFrame, smallHighlightWidth, bigHighlightWidth, alwaysShowScrollBar ) + -- If more than one screen full of skills then show the scrollbar + local frameName = frame:GetName(); + local scrollBar = _G[ frameName.."ScrollBar" ]; + local showScrollBar; + if ( numItems > numToDisplay or alwaysShowScrollBar ) then + frame:Show(); + showScrollBar = 1; + else + scrollBar:SetValue(0); + frame:Hide(); + end + if ( frame:IsShown() ) then + local scrollChildFrame = _G[ frameName.."ScrollChildFrame" ]; + local scrollUpButton = _G[ frameName.."ScrollBarScrollUpButton" ]; + local scrollDownButton = _G[ frameName.."ScrollBarScrollDownButton" ]; + local scrollFrameHeight = 0; + local scrollChildHeight = 0; + + if ( numItems > 0 ) then + scrollFrameHeight = (numItems - numToDisplay) * valueStep; + scrollChildHeight = numItems * valueStep; + if ( scrollFrameHeight < 0 ) then + scrollFrameHeight = 0; + end + scrollChildFrame:Show(); + else + scrollChildFrame:Hide(); + end + scrollBar:SetMinMaxValues(0, scrollFrameHeight); + scrollBar:SetValueStep(valueStep); + scrollChildFrame:SetHeight(scrollChildHeight); + + -- Arrow button handling + if ( scrollBar:GetValue() == 0 ) then + scrollUpButton:Disable(); + else + scrollUpButton:Enable(); + end + if ((scrollBar:GetValue() - scrollFrameHeight) == 0) then + scrollDownButton:Disable(); + else + scrollDownButton:Enable(); + end + + -- Shrink because scrollbar is shown + if ( highlightFrame ) then + highlightFrame:SetWidth(smallHighlightWidth); + end + if ( button ) then + for i=1, numToDisplay do + _G[button..i]:SetWidth(smallWidth); + end + end + else + -- Widen because scrollbar is hidden + if ( highlightFrame ) then + highlightFrame:SetWidth(bigHighlightWidth); + end + if ( button ) then + for i=1, numToDisplay do + _G[button..i]:SetWidth(bigWidth); + end + end + end + return showScrollBar; +end + +function FauxScrollFrame_OnVerticalScroll(self, value, itemHeight, updateFunction) + local scrollbar = _G[self:GetName().."ScrollBar"]; + scrollbar:SetValue(value); + self.offset = floor((value / itemHeight) + 0.5); + if ( updateFunction ) then + updateFunction(self); + end +end + +function FauxScrollFrame_GetOffset(frame) + return frame.offset; +end + +function FauxScrollFrame_SetOffset(frame, offset) + frame.offset = offset; +end + +-- Scrollframe functions +function ScrollFrame_OnLoad(self) + _G[self:GetName().."ScrollBarScrollDownButton"]:Disable(); + _G[self:GetName().."ScrollBarScrollUpButton"]:Disable(); + + local scrollbar = _G[self:GetName().."ScrollBar"]; + scrollbar:SetMinMaxValues(0, 0); + scrollbar:SetValue(0); + self.offset = 0; +end + +function ScrollFrame_OnScrollRangeChanged(self, xrange, yrange) + local scrollbar = _G[self:GetName().."ScrollBar"]; + if ( not yrange ) then + yrange = self:GetVerticalScrollRange(); + end + local value = scrollbar:GetValue(); + if ( value > yrange ) then + value = yrange; + end + scrollbar:SetMinMaxValues(0, yrange); + scrollbar:SetValue(value); + if ( floor(yrange) == 0 ) then + if ( self.scrollBarHideable ) then + _G[self:GetName().."ScrollBar"]:Hide(); + _G[scrollbar:GetName().."ScrollDownButton"]:Hide(); + _G[scrollbar:GetName().."ScrollUpButton"]:Hide(); + else + _G[scrollbar:GetName().."ScrollDownButton"]:Disable(); + _G[scrollbar:GetName().."ScrollUpButton"]:Disable(); + _G[scrollbar:GetName().."ScrollDownButton"]:Show(); + _G[scrollbar:GetName().."ScrollUpButton"]:Show(); + end + _G[scrollbar:GetName().."ThumbTexture"]:Hide(); + else + _G[scrollbar:GetName().."ScrollDownButton"]:Show(); + _G[scrollbar:GetName().."ScrollUpButton"]:Show(); + _G[self:GetName().."ScrollBar"]:Show(); + _G[scrollbar:GetName().."ScrollDownButton"]:Enable(); + _G[scrollbar:GetName().."ThumbTexture"]:Show(); + end + + -- Hide/show scrollframe borders + local top = _G[self:GetName().."Top"]; + local bottom = _G[self:GetName().."Bottom"]; + local middle = _G[self:GetName().."Middle"]; + if ( top and bottom and self.scrollBarHideable ) then + if ( self:GetVerticalScrollRange() == 0 ) then + top:Hide(); + bottom:Hide(); + else + top:Show(); + bottom:Show(); + end + end + if ( middle and self.scrollBarHideable ) then + if ( self:GetVerticalScrollRange() == 0 ) then + middle:Hide(); + else + middle:Show(); + end + end +end + +function ScrollingEdit_OnTextChanged(self, scrollFrame) + -- force an update when the text changes + self.handleCursorChange = true; + ScrollingEdit_OnUpdate(self, 0, scrollFrame); +end + +function ScrollingEdit_OnCursorChanged(self, x, y, w, h) + self.cursorOffset = y; + self.cursorHeight = h; + self.handleCursorChange = true; +end + +-- NOTE: If your edit box never shows partial lines of text, then this function will not work when you use +-- your mouse to move the edit cursor. You need the edit box to cut lines of text so that you can use your +-- mouse to highlight those partially-seen lines; otherwise you won't be able to use the mouse to move the +-- cursor above or below the current scroll area of the edit box. +function ScrollingEdit_OnUpdate(self, elapsed, scrollFrame) +local height, range, scroll, size, cursorOffset; + if ( self.handleCursorChange ) then + if ( not scrollFrame ) then + scrollFrame = self:GetParent(); + end + height = scrollFrame:GetHeight(); + range = scrollFrame:GetVerticalScrollRange(); + scroll = scrollFrame:GetVerticalScroll(); + size = height + range; + cursorOffset = -self.cursorOffset; + + if ( math.floor(height) <= 0 or math.floor(range) <= 0 ) then + --Frame has no area, nothing to calculate. + return; + end + + while ( cursorOffset < scroll ) do + scroll = (scroll - (height / 2)); + if ( scroll < 0 ) then + scroll = 0; + end + scrollFrame:SetVerticalScroll(scroll); + end + + while ( (cursorOffset + self.cursorHeight) > (scroll + height) and scroll < range ) do + scroll = (scroll + (height / 2)); + if ( scroll > range ) then + scroll = range; + end + scrollFrame:SetVerticalScroll(scroll); + end + + self.handleCursorChange = false; + end +end + +function EditBox_HandleTabbing(self, tabList) + local editboxName = self:GetName(); + local index; + for i=1, #tabList do + if ( editboxName == tabList[i] ) then + index = i; + break; + end + end + if ( IsShiftKeyDown() ) then + index = index - 1; + else + index = index + 1; + end + + if ( index == 0 ) then + index = #tabList; + elseif ( index > #tabList ) then + index = 1; + end + + local target = tabList[index]; + _G[target]:SetFocus(); +end + +function EditBox_ClearFocus (self) + self:ClearFocus(); +end + +function EditBox_SetFocus (self) + self:SetFocus(); +end + +function EditBox_HighlightText (self) + self:HighlightText(); +end + +function EditBox_ClearHighlight (self) + self:HighlightText(0, 0); +end + +UIFrameCache = CreateFrame("FRAME"); +local caches = {}; +function UIFrameCache:New (frameType, baseName, parent, template) + if ( self ~= UIFrameCache ) then + error("Attempt to run factory method on class member"); + end + + local frameCache = {}; + + setmetatable(frameCache, self); + self.__index = self; + + frameCache.frameType = frameType; + frameCache.baseName = baseName; + frameCache.parent = parent; + frameCache.template = template; + frameCache.frames = {}; + frameCache.usedFrames = {}; + frameCache.numFrames = 0; + + tinsert(caches, frameCache); + + return frameCache; +end + +function UIFrameCache:GetFrame () + local frame = self.frames[1]; + if ( frame ) then + tremove(self.frames, 1); + tinsert(self.usedFrames, frame); + return frame; + end + + frame = CreateFrame(self.frameType, self.baseName .. self.numFrames + 1, self.parent, self.template); + frame.frameCache = self; + self.numFrames = self.numFrames + 1; + tinsert(self.usedFrames, frame); + return frame; +end + +function UIFrameCache:ReleaseFrame (frame) + for k, v in next, self.frames do + if ( v == frame ) then + return; + end + end + + for k, v in next, self.usedFrames do + if ( v == frame ) then + tinsert(self.frames, frame); + tremove(self.usedFrames, k); + break; + end + end +end diff --git a/data/patch-hd/Interface/FrameXML/UIPanelTemplates.xml b/data/patch-hd/Interface/FrameXML/UIPanelTemplates.xml new file mode 100644 index 00000000..e574138d --- /dev/null +++ b/data/patch-hd/Interface/FrameXML/UIPanelTemplates.xml @@ -0,0 +1,1028 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + self:GetParent():SetVerticalScroll(value); + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + self:SetBackdropBorderColor(TOOLTIP_DEFAULT_COLOR.r, TOOLTIP_DEFAULT_COLOR.g, TOOLTIP_DEFAULT_COLOR.b, 0.5); + + + + + + + self:GetParent():SetVerticalScroll(value); + + + + + + + + + + + + + + + + + + + + + + + + + + + + + ScrollFrame_OnLoad(self); + + + ScrollFrame_OnScrollRangeChanged(self, xrange, yrange); + + + + local scrollbar = _G[self:GetName().."ScrollBar"]; + scrollbar:SetValue(offset); + local min; + local max; + min, max = scrollbar:GetMinMaxValues(); + if ( offset == 0 ) then + _G[scrollbar:GetName().."ScrollUpButton"]:Disable(); + else + _G[scrollbar:GetName().."ScrollUpButton"]:Enable(); + end + if ((scrollbar:GetValue() - max) == 0) then + _G[scrollbar:GetName().."ScrollDownButton"]:Disable(); + else + _G[scrollbar:GetName().."ScrollDownButton"]:Enable(); + end + + + ScrollFrameTemplate_OnMouseWheel(self, delta); + + + + + + + + + + + + + + + + + + + + + + + + + + + + + ScrollFrame_OnLoad(self); + _G[self:GetName().."Top"]:SetPoint("TOPLEFT", _G[self:GetName().."ScrollBar".."ScrollUpButton"], "TOPLEFT", -8, 5); + _G[self:GetName().."Bottom"]:SetPoint("BOTTOMLEFT", _G[self:GetName().."ScrollBar".."ScrollDownButton"], "BOTTOMLEFT", -8, -2); + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + ScrollFrame_OnLoad(self); + + + + local scrollbar = _G[self:GetName().."ScrollBar"]; + scrollbar:SetValue(offset); + local min; + local max; + min, max = scrollbar:GetMinMaxValues(); + if ( offset == 0 ) then + _G[scrollbar:GetName().."ScrollUpButton"]:Disable(); + else + _G[scrollbar:GetName().."ScrollUpButton"]:Enable(); + end + if ((scrollbar:GetValue() - max) == 0) then + _G[scrollbar:GetName().."ScrollDownButton"]:Disable(); + else + _G[scrollbar:GetName().."ScrollDownButton"]:Enable(); + end + + + ScrollFrameTemplate_OnMouseWheel(self, delta); + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + EditBox_ClearFocus(self); + + + EditBox_ClearHighlight(self); + + + EditBox_HighlightText(self); + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + AutoCastShine_OnLoad(self); + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/data/patch-hd/Interface/FrameXML/UIParent.xml b/data/patch-hd/Interface/FrameXML/UIParent.xml new file mode 100644 index 00000000..caa8345a --- /dev/null +++ b/data/patch-hd/Interface/FrameXML/UIParent.xml @@ -0,0 +1,39 @@ + +