Modcraft - The community dedicated to quality WoW modding!

Content creation => Modelling and Animation => Topic started by: Razstah on August 31, 2011, 05:04:06 pm

Title: [QUESTION] Adding a race
Post by: Razstah on August 31, 2011, 05:04:06 pm
I followed Khira's tut on making a race, i've done everything , but the only thing that happend was that the orc went from horde spot on top to alliance spot on left ( creating a char) and ..well i wanted a forest troll..Don't understand what went wrong..:|
Title: Re: [QUESTION] Adding a race
Post by: Everon Mightbane on August 31, 2011, 05:17:04 pm
From my understanding, Your problem is within what you have done inside the GlueXML folder, Try doing the part where you have to edit CharacterCreate.xml again and it should work.
Title: Re: [QUESTION] Adding a race
Post by: Razstah on August 31, 2011, 05:23:05 pm
I knew it, but I have no idea how to do it..:| I just followed the tutorial and copied :D
Title: Re: [QUESTION] Adding a race
Post by: Everon Mightbane on August 31, 2011, 06:02:27 pm
Could you post the whole of your charactercreate.xml in code in a spoiler?
Title: Re: [QUESTION] Adding a race
Post by: Razstah on August 31, 2011, 06:37:56 pm
[spoiler:2ihtxdlx]<Ui xmlns="http://www.blizzard.com/wow/ui/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.blizzard.com/wow/ui/
..FrameXMLUI.xsd">
   <Script file="CharacterCreate.lua"/>
   <Frame name="CharacterCreateTooltip" frameStrata="TOOLTIP" hidden="true" parent="GlueParent" inherits="GlueTooltipTemplate">
      <Scripts>
         <OnLoad>
            GlueTooltip_SetFont(self, CharacterCreateTooltipFont);
            self:SetBackdropBorderColor(1.0, 1.0, 1.0);
            self:SetBackdropColor(0.09, 0.09, 0.19 );
         </OnLoad>
      </Scripts>
   </Frame>
   <CheckButton name="CharacterCreateIconButtonTemplate" virtual="true" motionScriptsWhileDisabled="true">
      <Size x="38" y="38"/>
      <Layers>
         <Layer level="BACKGROUND">
            <Texture name="$parentShadow" file="InterfaceGluesCharacterCreateUI-CharacterCreate-IconShadow">
               <Size x="58" y="58"/>
               <Anchors>
                  <Anchor point="CENTER" x="0" y="0"/>
               </Anchors>
               <Color r="1.0" g="1.0" b="1.0" a="0.85"/>
            </Texture>
         </Layer>
         <Layer level="OVERLAY">
            <Texture name="$parentBevelEdge" file="InterfaceGluesCharacterCreateUI-CharacterCreate-Highlights">
               <Size x="38" y="38"/>
               <Anchors>
                  <Anchor point="CENTER" x="0" y="0"/>
               </Anchors>
               <TexCoords left="0" right="0.5" top="0.5" bottom="1.0"/>
            </Texture>
            <Texture name="$parentDisableTexture" hidden="true">
               <Size x="38" y="38"/>
               <Anchors>
                  <Anchor point="CENTER" x="0" y="0"/>
               </Anchors>
               <Color r="0.0" g="0.0" b="0.0" a="0.75"/>
            </Texture>
         </Layer>
      </Layers>
      <Scripts>
         <OnMouseDown>
            if( self:IsEnabled() == 1 ) then
               _G[self:GetName().."BevelEdge"]:SetPoint("CENTER", self, "CENTER", 2, -2);
               _G[self:GetName().."Shadow"]:SetSize(52, 52);
            end
         </OnMouseDown>
         <OnMouseUp>
            if( self:IsEnabled() == 1 ) then
               _G[self:GetName().."BevelEdge"]:SetPoint("CENTER", self, "CENTER", 0, 0);
               _G[self:GetName().."Shadow"]:SetSize(58, 58);
            end
         </OnMouseUp>
      </Scripts>
      <HighlightTexture file="InterfaceGluesCharacterCreateUI-CharacterCreate-Highlights" alphaMode="ADD">
         <TexCoords left="0" right="0.5" top="0" bottom="0.5"/>
      </HighlightTexture>
      <CheckedTexture file="InterfaceGluesCharacterCreateUI-CharacterCreate-Highlights" alphaMode="ADD">
         <TexCoords left="0.5" right="1" top="0" bottom="0.5"/>
      </CheckedTexture>
   </CheckButton>
   <CheckButton name="CharacterCreateRaceButtonTemplate" inherits="CharacterCreateIconButtonTemplate" virtual="true">
      <Layers>
         <Layer level="ARTWORK">
            <FontString name="$parentText" inherits="GlueFontNormalSmall">
               <Anchors>
                  <Anchor point="BOTTOM" relativePoint="TOP" x="0" y="2"/>
               </Anchors>
            </FontString>
         </Layer>
      </Layers>
      <Scripts>
         <OnClick>
            if( self.enable ) then
               CharacterRace_OnClick(self, self:GetID());
               CharacterCreateTooltip:Hide();
            end
         </OnClick>
         <OnEnter>
            GlueTooltip_SetOwner(self, CharacterCreateTooltip, -3, -5);
            GlueTooltip_SetText(self.tooltip, CharacterCreateTooltip);
         </OnEnter>
         <OnLeave>
            CharacterCreateTooltip:Hide();
         </OnLeave>
      </Scripts>
      <NormalTexture name="$parentNormalTexture" file="InterfaceGluesCharacterCreateUI-CharacterCreate-Races"/>
      <PushedTexture name="$parentPushedTexture" file="InterfaceGluesCharacterCreateUI-CharacterCreate-Races">
         <Size x="38" y="38"/>
         <Anchors>
            <Anchor point="CENTER" x="2" y="-2"/>
         </Anchors>
      </PushedTexture>
   </CheckButton>
   <CheckButton name="CharacterCreateClassButtonTemplate" inherits="CharacterCreateIconButtonTemplate" virtual="true">
      <Scripts>
         <OnClick>
            if( self.enable ) then
               CharacterClass_OnClick(self:GetID());   
               CharacterCreateTooltip:Hide();
            end
         </OnClick>
         <OnEnter>
            GlueTooltip_SetOwner(self, CharacterCreateTooltip, -3, -5);
            GlueTooltip_SetText(self.tooltip, CharacterCreateTooltip);
         </OnEnter>
         <OnLeave>
            CharacterCreateTooltip:Hide();
         </OnLeave>
      </Scripts>
      <NormalTexture name="$parentNormalTexture" file="InterfaceGluesCharacterCreateUI-CharacterCreate-Classes"/>
      <PushedTexture name="$parentPushedTexture" file="InterfaceGluesCharacterCreateUI-CharacterCreate-Classes">
         <Size x="38" y="38"/>
         <Anchors>
            <Anchor point="CENTER" x="2" y="-2"/>
         </Anchors>
      </PushedTexture>
   </CheckButton>
   <CheckButton name="CharacterCreateGenderButtonTemplate" inherits="CharacterCreateIconButtonTemplate" virtual="true">
      <Scripts>
         <OnLeave>
            CharacterCreateTooltip:Hide();
         </OnLeave>
      </Scripts>
      <NormalTexture name="$parentNormalTexture" file="InterfaceGluesCharacterCreateUI-CharacterCreate-Gender"/>
      <PushedTexture name="$parentPushedTexture" file="InterfaceGluesCharacterCreateUI-CharacterCreate-Gender">
         <Size x="38" y="38"/>
         <Anchors>
            <Anchor point="CENTER" x="2" y="-2"/>
         </Anchors>
      </PushedTexture>
   </CheckButton>
   <Frame name="CharacterCustomizationFrameTemplate" virtual="true">
      <Size>
         <AbsDimension x="230" y="32"/>
      </Size>
      <Layers>
         <Layer level="BACKGROUND">
            <Texture name="$parentLeft" file="InterfaceGluesCharacterCreateCharacterCreate-LabelFrame">
               <Size x="25" y="64"/>
               <Anchors>
                  <Anchor point="LEFT" x="-5" y="0"/>
               </Anchors>
               <TexCoords left="0" right="0.1953125" top="0" bottom="1"/>
            </Texture>
            <Texture name="$parentRight" file="InterfaceGluesCharacterCreateCharacterCreate-LabelFrame">
               <Size x="25" y="64"/>
               <Anchors>
                  <Anchor point="RIGHT" x="-44" y="0"/>
               </Anchors>
               <TexCoords left="0.8046875" right="1" top="0" bottom="1"/>
            </Texture>
            <Texture name="$parentMiddle" file="InterfaceGluesCharacterCreateCharacterCreate-LabelFrame">
               <Size x="40" y="64"/>
               <Anchors>
                  <Anchor point="LEFT" relativeTo="$parentLeft" relativePoint="RIGHT"/>
                  <Anchor point="RIGHT" relativeTo="$parentRight" relativePoint="LEFT"/>
               </Anchors>
               <TexCoords left="0.1953125" right="0.8046875" top="0" bottom="1"/>
            </Texture>
            <FontString name="$parentText" inherits="GlueFontHighlightSmall">
               <Anchors>
                  <Anchor point="CENTER" relativeTo="$parentMiddle" x="0" y="2"/>
               </Anchors>
            </FontString>
         </Layer>
      </Layers>
      <Frames>
         <Button name="$parentRightButton">
            <Size x="32" y="32"/>
            <Anchors>
               <Anchor point="RIGHT"/>
            </Anchors>
            <Scripts>
               <OnClick>
                  CharacterCustomization_Right(self:GetParent():GetID());
               </OnClick>
            </Scripts>
            <NormalTexture file="InterfaceGluesCommonGlue-RightArrow-Button-Up"/>
            <PushedTexture file="InterfaceGluesCommonGlue-RightArrow-Button-Down"/>
            <HighlightTexture file="InterfaceGluesCommonGlue-RightArrow-Button-Highlight" alphaMode="ADD"/>
         </Button>
         <Button name="$parentLeftButton">
            <Size x="32" y="32"/>
            <Anchors>
               <Anchor point="RIGHT" relativeTo="$parentRightButton" relativePoint="LEFT" x="3" y="0"/>
            </Anchors>
            <Scripts>
               <OnClick>
                  CharacterCustomization_Left(self:GetParent():GetID());
               </OnClick>
            </Scripts>
            <NormalTexture file="InterfaceGluesCommonGlue-LeftArrow-Button-Up"/>
            <PushedTexture file="InterfaceGluesCommonGlue-LeftArrow-Button-Down"/>
            <HighlightTexture file="InterfaceGluesCommonGlue-LeftArrow-Button-Highlight" alphaMode="ADD"/>
         </Button>
      </Frames>
   </Frame>
   <ModelFFX name="CharacterCreate" toplevel="true" parent="GlueParent" setAllPoints="true" enableKeyboard="true" hidden="true">
      <Frames>
         <Frame name="CharacterCreateFrame" setAllPoints="true" enableMouse="true">
            <Frames>
               <Frame name="CharacterCreateWoWLogo">
                  <Size x="256" y="128"/>
                  <Anchors>
                     <Anchor point="TOPRIGHT" x="-9" y="0"/>
                  </Anchors>
                  <Layers>
                     <Layer level="ARTWORK">
                        <Texture name="CharacterCreateLogo" file="InterfaceGluesCommonGlues-WoW-WotLKLogo">
                           <Size x="256" y="128"/>
                           <Anchors>
                              <Anchor point="TOP" relativePoint="TOPLEFT" x="128" y="0"/>
                           </Anchors>
                        </Texture>
                     </Layer>
                  </Layers>
               </Frame>
               <Frame name="CharacterCreateCharacterRace">
                  <Size x="267" y="287"/>
                  <Anchors>
                     <Anchor point="TOP" relativeTo="CharacterCreateWoWLogo" relativePoint="BOTTOM" x="-5" y="5"/>
                  </Anchors>
                  <Layers>
                     <Layer level="BORDER">
                        <Texture name="CharacterCreateRaceIcon" file="InterfaceGluesCharacterCreateUI-CharacterCreate-RacesRound">
                           <Size x="48" y="48"/>
                           <Anchors>
                              <Anchor point="TOPLEFT" x="4" y="-4"/>
                           </Anchors>
                           <TexCoords left="0" right="0.375" top="0" bottom="0.75"/>
                        </Texture>
                     </Layer>
                     <Layer level="ARTWORK">
                        <Texture file="InterfaceGluesCharacterCreateUI-CharacterCreate-InfoBox" setAllPoints="true">
                           <TexCoords left="0.005859375" right="0.52734375" top="0.005859375" bottom="0.56640625"/>
                        </Texture>
                     </Layer>
                     <Layer level="OVERLAY">
                        <FontString name="CharacterCreateRaceLabel" inherits="FactionName_Shadow_Huge" justifyH="LEFT" text="RACE">
                           <Size x="220" y="0"/>
                           <Anchors>
                              <Anchor point="TOP" x="40" y="-10"/>
                           </Anchors>
                        </FontString>
                     </Layer>
                  </Layers>
                  <Backdrop bgFile="InterfaceTooltipsUI-Tooltip-Background">
                     <BackgroundInsets>
                        <AbsInset left="12" right="3" top="20" bottom="6"/>
                     </BackgroundInsets>
                  </Backdrop>
                  <Frames>
                     <ScrollFrame name="CharacterCreateRaceScrollFrame" inherits="GlueScrollFrameTemplate">
                        <Size x="220" y="220"/>
                        <Anchors>
                           <Anchor point="TOPLEFT" x="20" y="-55"/>
                        </Anchors>
                        <Scripts>
                           <OnLoad>
                              CharacterCreateRaceScrollFrameScrollBar:ClearAllPoints();
                              CharacterCreateRaceScrollFrameScrollBar:SetPoint("TOPLEFT", CharacterCreateRaceScrollFrame, "TOPRIGHT", 7, 4);
                              CharacterCreateRaceScrollFrameScrollBar:SetPoint("BOTTOMLEFT", CharacterCreateRaceScrollFrame, "BOTTOMRIGHT", 7, 12);
                              GlueScrollFrame_OnScrollRangeChanged(self, yrange);
                           </OnLoad>
                           <OnScrollRangeChanged>
                              GlueScrollFrame_OnScrollRangeChanged(self, yrange);
                           </OnScrollRangeChanged>
                        </Scripts>
                        <ScrollChild>
                           <Frame name="CharacterCreateRaceScrollChild">
                              <Size x="220" y="10"/>
                              <Layers>
                                 <Layer level="BACKGROUND">
                                    <FontString name="CharacterCreateRaceAbilityText" inherits="GlueFontNormalSmall" justifyH="LEFT">
                                       <Size x="220" y="0"/>
                                       <Anchors>
                                          <Anchor point="TOPLEFT" x="0" y="0"/>
                                       </Anchors>
                                    </FontString>
                                    <FontString name="CharacterCreateRaceText" inherits="GlueFontCharacterCreate" justifyH="LEFT">
                                       <Size x="220" y="0"/>
                                       <Anchors>
                                          <Anchor point="TOPLEFT" relativeTo="CharacterCreateRaceAbilityText" relativePoint="BOTTOMLEFT" x="0" y="-2"/>
                                       </Anchors>
                                    </FontString>
                                 </Layer>
                              </Layers>
                           </Frame>
                        </ScrollChild>
                     </ScrollFrame>
                  </Frames>
               </Frame>
               <Frame name="CharacterCreateCharacterClass">
                  <Size x="267" y="287"/>
                  <Anchors>
                     <Anchor point="TOP" relativeTo="CharacterCreateCharacterRace" relativePoint="BOTTOM" x="-5" y="-5"/>
                  </Anchors>
                  <Layers>
                     <Layer level="BORDER">
                        <Texture name="CharacterCreateClassIcon" file="InterfaceTargetingFrameUI-Classes-Circles">
                           <Size x="48" y="48"/>
                           <Anchors>
                              <Anchor point="TOPLEFT" x="4" y="-4"/>
                           </Anchors>
                           <TexCoords left="0" right="0.375" top="0" bottom="0.75"/>
                        </Texture>
                     </Layer>
                     <Layer level="ARTWORK">
                        <Texture file="InterfaceGluesCharacterCreateUI-CharacterCreate-InfoBox" setAllPoints="true">
                           <TexCoords left="0.005859375" right="0.52734375" top="0.005859375" bottom="0.56640625"/>
                        </Texture>
                     </Layer>
                     <Layer level="OVERLAY">
                        <FontString name="CharacterCreateClassLabel" inherits="FactionName_Shadow_Huge" justifyH="LEFT" text="RACE">
                           <Size x="220" y="0"/>
                           <Anchors>
                              <Anchor point="TOP" x="40" y="-10"/>
                           </Anchors>
                        </FontString>
                     </Layer>
                  </Layers>
                  <Backdrop bgFile="InterfaceTooltipsUI-Tooltip-Background">
                     <BackgroundInsets>
                        <AbsInset left="12" right="3" top="20" bottom="6"/>
                     </BackgroundInsets>
                  </Backdrop>
                  <Frames>
                     <ScrollFrame name="CharacterCreateClassScrollFrame" inherits="GlueScrollFrameTemplate">
                        <Size x="220" y="220"/>
                        <Anchors>
                           <Anchor point="TOPLEFT" x="20" y="-55"/>
                        </Anchors>
                        <Scripts>
                           <OnLoad>
                              CharacterCreateClassScrollFrameScrollBar:ClearAllPoints();
                              CharacterCreateClassScrollFrameScrollBar:SetPoint("TOPLEFT", CharacterCreateClassScrollFrame, "TOPRIGHT", 7, 4);
                              CharacterCreateClassScrollFrameScrollBar:SetPoint("BOTTOMLEFT", CharacterCreateClassScrollFrame, "BOTTOMRIGHT", 7, 12);
                              GlueScrollFrame_OnScrollRangeChanged(self, yrange);
                           </OnLoad>
                           <OnScrollRangeChanged>
                              GlueScrollFrame_OnScrollRangeChanged(self, yrange);
                           </OnScrollRangeChanged>
                        </Scripts>
                        <ScrollChild>
                           <Frame name="CharacterCreateClassScrollChild">
                              <Size x="220" y="10"/>
                              <Layers>
                                 <Layer level="BACKGROUND">
                                    <FontString name="CharacterCreateClassRolesText" inherits="GlueFontNormalSmall" justifyH="LEFT">
                                       <Size x="220" y="0"/>
                                       <Anchors>
                                          <Anchor point="TOPLEFT" x="0" y="0"/>
                                       </Anchors>
                                    </FontString>
                                    <FontString name="CharacterCreateClassText" inherits="GlueFontCharacterCreate" justifyH="LEFT">
                                       <Size x="220" y="0"/>
                                       <Anchors>
                                          <Anchor point="TOPLEFT" relativeTo="CharacterCreateClassRolesText" relativePoint="BOTTOMLEFT" x="0" y="-2"/>
                                       </Anchors>
                                    </FontString>
                                 </Layer>
                              </Layers>
                           </Frame>
                        </ScrollChild>
                     </ScrollFrame>
                  </Frames>
               </Frame>
               <Frame name="CharacterCreateConfigurationFrame">
                  <Size x="256" y="758"/>
                  <Anchors>
                     <Anchor point="TOPLEFT" relativeTo="CharacterCreateFrame" relativePoint="TOPLEFT" x="9" y="-5"/>
                  </Anchors>
                  <Layers>
                     <Layer level="ARTWORK">
                        <Texture name="CharacterCreateOuterBorder1" file="InterfaceGluesCharacterCreateUI-CharacterCreate-OuterBorder">
                           <Size x="256" y="256"/>
                           <Anchors>
                              <Anchor point="TOP" x="0" y="0"/>
                           </Anchors>
                           <TexCoords left="0" right="1" top="1" bottom="0"/>
                        </Texture>
                        <Texture name="CharacterCreateOuterBorder2" file="InterfaceGluesCharacterCreateUI-CharacterCreate-OuterBorder">
                           <Size x="256" y="246"/>
                           <Anchors>
                              <Anchor point="TOP" relativeTo="CharacterCreateOuterBorder1" relativePoint="BOTTOM" x="0" y="0"/>
                           </Anchors>
                           <TexCoords left="0" right="1" top="0" bottom="0.9609375"/>
                        </Texture>
                        <Texture name="CharacterCreateOuterBorder3" file="InterfaceGluesCharacterCreateUI-CharacterCreate-OuterBorder">
                           <Size x="256" y="256"/>
                           <Anchors>
                              <Anchor point="TOP" relativeTo="CharacterCreateOuterBorder2" relativePoint="BOTTOM" x="0" y="0"/>
                           </Anchors>
                        </Texture>
                     </Layer>
                     <Layer level="BACKGROUND">
                        <Texture name="CharacterCreateConfigurationBackground" file="InterfaceTooltipsUI-Tooltip-Background">
                           <Anchors>
                              <Anchor point="TOPLEFT" relativeTo="CharacterCreateOuterBorder1" relativePoint="TOPLEFT" x="10" y="-8"/>
                              <Anchor point="BOTTOMRIGHT" relativeTo="CharacterCreateOuterBorder3" relativePoint="BOTTOMRIGHT" x="-10" y="8"/>
                           </Anchors>
                        </Texture>
                     </Layer>
                     <Layer level="BORDER">
                        <Texture name="CharacterCreateBanners" file="InterfaceGluesCharacterCreateUI-CharacterCreate-Banners">
                           <Size x="256" y="512"/>
                           <Anchors>
                              <Anchor point="TOP" relativeTo="CharacterCreateOuterBorder1" relativePoint="TOP" x="0" y="-5"/>
                           </Anchors>
                        </Texture>
                     </Layer>
                     <Layer level="OVERLAY">
                        <FontString name="CharacterCreateAllianceLabel" inherits="FactionName_Shadow_Huge" text="ALLIANCE">
                           <Anchors>
                              <Anchor point="TOP" relativePoint="TOP" x="-50" y="-20"/>
                           </Anchors>
                        </FontString>
                        <FontString name="CharacterCreateHordeLabel" inherits="FactionName_Shadow_Huge" text="HORDE">
                           <Anchors>
                              <Anchor point="TOP" relativePoint="TOP" x="50" y="-20"/>
                           </Anchors>
                        </FontString>
<!--

                        <FontString name="CharacterCreateAllianceRaceLabel" inherits="OptionsFontSmall"/>
                        <FontString name="CharacterCreateHordeRaceLabel" inherits="OptionsFontSmall"/>
-->
                        <FontString name="CharacterCreateGender" inherits="CharacterCreateTooltipFont">
                           <Anchors>
                              <Anchor point="BOTTOM" relativePoint="TOP" x="0" y="-388"/>
                           </Anchors>
                           <Color r="1.0" g="0.78" b="0"/>
                        </FontString>
                        <FontString name="CharacterCreateClassName" inherits="CharacterCreateTooltipFont">
                           <Anchors>
                              <Anchor point="BOTTOM" relativePoint="TOP" x="0" y="-456"/>
                           </Anchors>
                           <Color r="1.0" g="0.78" b="0"/>
                        </FontString>
                     </Layer>
                  </Layers>
                  <Frames>
                     <CheckButton name="CharacterCreateRaceButton1" inherits="CharacterCreateRaceButtonTemplate" id="1">
    <Anchors>
        <Anchor point="TOP" relativePoint="TOP" x="-50" y="-50"/>
    </Anchors>
</CheckButton>
<CheckButton name="CharacterCreateRaceButton2" inherits="CharacterCreateRaceButtonTemplate" id="2">
    <Anchors>
        <Anchor point="TOPLEFT" relativeTo="CharacterCreateRaceButton1" relativePoint="BOTTOMLEFT" x="0" y="-10"/>
    </Anchors>
</CheckButton>
<CheckButton name="CharacterCreateRaceButton3" inherits="CharacterCreateRaceButtonTemplate" id="3">
    <Anchors>
        <Anchor point="TOPLEFT" relativeTo="CharacterCreateRaceButton2" relativePoint="BOTTOMLEFT" x="0" y="-10"/>
    </Anchors>
</CheckButton>
<CheckButton name="CharacterCreateRaceButton4" inherits="CharacterCreateRaceButtonTemplate" id="4">
    <Anchors>
        <Anchor point="TOPLEFT" relativeTo="CharacterCreateRaceButton3" relativePoint="BOTTOMLEFT" x="0" y="-10"/>
    </Anchors>
</CheckButton>
<CheckButton name="CharacterCreateRaceButton5" inherits="CharacterCreateRaceButtonTemplate" id="5">
    <Anchors>
        <Anchor point="TOPLEFT" relativeTo="CharacterCreateRaceButton4" relativePoint="BOTTOMLEFT" x="0" y="-10"/>
    </Anchors>
</CheckButton>

<CheckButton name="CharacterCreateRaceButton7" inherits="CharacterCreateRaceButtonTemplate" id="7">
    <Anchors>
        <Anchor point="TOP" relativePoint="TOP" x="50" y="-50"/>
    </Anchors>
</CheckButton>
<CheckButton name="CharacterCreateRaceButton8" inherits="CharacterCreateRaceButtonTemplate" id="8">
    <Anchors>
        <Anchor point="TOPLEFT" relativeTo="CharacterCreateRaceButton7" relativePoint="BOTTOMLEFT" x="0" y="-10"/>
    </Anchors>
</CheckButton>
<CheckButton name="CharacterCreateRaceButton9" inherits="CharacterCreateRaceButtonTemplate" id="9">
    <Anchors>
        <Anchor point="TOPLEFT" relativeTo="CharacterCreateRaceButton8" relativePoint="BOTTOMLEFT" x="0" y="-10"/>
    </Anchors>
</CheckButton>
<CheckButton name="CharacterCreateRaceButton10" inherits="CharacterCreateRaceButtonTemplate" id="10">
    <Anchors>
        <Anchor point="TOPLEFT" relativeTo="CharacterCreateRaceButton9" relativePoint="BOTTOMLEFT" x="0" y="-10"/>
    </Anchors>
</CheckButton>
<CheckButton name="CharacterCreateRaceButton12" inherits="CharacterCreateRaceButtonTemplate" id="12">
    <Anchors>
        <Anchor point="TOPLEFT" relativeTo="CharacterCreateRaceButton10" relativePoint="BOTTOMLEFT" x="0" y="-10"/>
    </Anchors>
</CheckButton>
<CheckButton name="CharacterCreateRaceButton11" inherits="CharacterCreateRaceButtonTemplate" id="11">
    <Anchors>
        <Anchor point="TOPLEFT" relativeTo="CharacterCreateRaceButton12" relativePoint="BOTTOMLEFT" x="0" y="-10"/>
    </Anchors>
</CheckButton>
<CheckButton name="CharacterCreateRaceButton6" inherits="CharacterCreateRaceButtonTemplate" id="6">
    <Anchors>
        <Anchor point="TOPLEFT" relativeTo="CharacterCreateRaceButton5" relativePoint="BOTTOMLEFT" x="0" y="-10"/>
    </Anchors>
</CheckButton>
                     <CheckButton name="CharacterCreateGenderButtonMale" inherits="CharacterCreateGenderButtonTemplate">
                        <Anchors>
                           <Anchor point="TOP" x="-20" y="-392"/>
                        </Anchors>
                        <Scripts>
                           <OnLoad>
                              _G[self:GetName().."NormalTexture"]:SetTexCoord(0, 0.5, 0, 1.0);
                              _G[self:GetName().."PushedTexture"]:SetTexCoord(0, 0.5, 0, 1.0);
                           </OnLoad>
                           <OnClick>
                              PlaySound("gsCharacterCreationClass");
                              if ( GetSelectedSex() ~= SEX_MALE ) then
                                 SetCharacterGender(SEX_MALE);
                              end
                           </OnClick>
                           <OnEnter>
                              GlueTooltip_SetOwner(self, CharacterCreateTooltip, -3, -5);
                              GlueTooltip_SetText(MALE, CharacterCreateTooltip);
                           </OnEnter>
                        </Scripts>
                     </CheckButton>
                     <CheckButton name="CharacterCreateGenderButtonFemale" inherits="CharacterCreateGenderButtonTemplate">
                        <Anchors>
                           <Anchor point="TOP" x="20" y="-392"/>
                        </Anchors>
                        <Scripts>
                           <OnLoad>
                              _G[self:GetName().."NormalTexture"]:SetTexCoord(0.5, 1.0, 0, 1.0);
                              _G[self:GetName().."PushedTexture"]:SetTexCoord(0.5, 1.0, 0, 1.0);
                           </OnLoad>
                           <OnClick>
                              PlaySound("gsCharacterCreationClass");
                              if ( GetSelectedSex() ~= SEX_FEMALE ) then
                                 SetCharacterGender(SEX_FEMALE);
                              end
                           </OnClick>
                           <OnEnter>
                              GlueTooltip_SetOwner(self, CharacterCreateTooltip, -3, -5);
                              GlueTooltip_SetText(FEMALE, CharacterCreateTooltip);
                           </OnEnter>
                        </Scripts>
                     </CheckButton>
                     <CheckButton name="CharacterCreateClassButton1" inherits="CharacterCreateClassButtonTemplate" id="1">
                        <Anchors>
                           <Anchor point="TOP" x="-90" y="-463"/>
                        </Anchors>
                     </CheckButton>
                     <CheckButton name="CharacterCreateClassButton2" inherits="CharacterCreateClassButtonTemplate" id="2">
                        <Anchors>
                           <Anchor point="LEFT" relativeTo="CharacterCreateClassButton1" relativePoint="RIGHT" x="6" y="0"/>
                        </Anchors>
                     </CheckButton>
                     <CheckButton name="CharacterCreateClassButton3" inherits="CharacterCreateClassButtonTemplate" id="3">
                        <Anchors>
                           <Anchor point="LEFT" relativeTo="CharacterCreateClassButton2" relativePoint="RIGHT" x="6" y="0"/>
                        </Anchors>
                     </CheckButton>
                     <CheckButton name="CharacterCreateClassButton4" inherits="CharacterCreateClassButtonTemplate" id="4">
                        <Anchors>
                           <Anchor point="LEFT" relativeTo="CharacterCreateClassButton3" relativePoint="RIGHT" x="6" y="0"/>
                        </Anchors>
                     </CheckButton>
                     <CheckButton name="CharacterCreateClassButton5" inherits="CharacterCreateClassButtonTemplate" id="5">
                        <Anchors>
                           <Anchor point="LEFT" relativeTo="CharacterCreateClassButton4" relativePoint="RIGHT" x="6" y="0"/>
                        </Anchors>
                     </CheckButton>
                     <CheckButton name="CharacterCreateClassButton6" inherits="CharacterCreateClassButtonTemplate" id="6">
                        <Anchors>
                           <Anchor point="TOP" relativeTo="CharacterCreateClassButton1" relativePoint="BOTTOM" x="0" y="-6"/>
                        </Anchors>
                     </CheckButton>
                     <CheckButton name="CharacterCreateClassButton7" inherits="CharacterCreateClassButtonTemplate" id="7">
                        <Anchors>
                           <Anchor point="TOP" relativeTo="CharacterCreateClassButton2" relativePoint="BOTTOM" x="0" y="-6"/>
                        </Anchors>
                     </CheckButton>
                     <CheckButton name="CharacterCreateClassButton8" inherits="CharacterCreateClassButtonTemplate" id="8">
                        <Anchors>
                           <Anchor point="TOP" relativeTo="CharacterCreateClassButton3" relativePoint="BOTTOM" x="0" y="-6"/>
                        </Anchors>
                     </CheckButton>
                     <CheckButton name="CharacterCreateClassButton9" inherits="CharacterCreateClassButtonTemplate" id="9">
                        <Anchors>
                           <Anchor point="TOP" relativeTo="CharacterCreateClassButton4" relativePoint="BOTTOM" x="0" y="-6"/>
                        </Anchors>
                     </CheckButton>
                     <CheckButton name="CharacterCreateClassButton10" inherits="CharacterCreateClassButtonTemplate" id="10">
                        <Anchors>
                           <Anchor point="TOP" relativeTo="CharacterCreateClassButton5" relativePoint="BOTTOM" x="0" y="-6"/>
                        </Anchors>
                     </CheckButton>
                     <Button name="CharCreateRandomizeButton" inherits="GlueButtonSmallTemplate" text="RANDOMIZE">
                        <Size x="146" y="30"/>
                        <Anchors>
                           <Anchor point="BOTTOM" x="0" y="10"/>
                        </Anchors>
                        <Scripts>
                           <OnLoad>
                              self:SetWidth(self:GetTextWidth() + 50);
                           </OnLoad>
                           <OnClick>
                              CharacterCreate_Randomize();
                           </OnClick>
                           <OnUpdate>
                              CharacterCreate_DeathKnightSwap(self);
                           </OnUpdate>
                        </Scripts>
                     </Button>
                     <Frame name="CharacterCustomizationButtonFrame5" inherits="CharacterCustomizationFrameTemplate" id="5">
                        <Anchors>
                           <Anchor point="BOTTOM" relativeTo="CharCreateRandomizeButton" relativePoint="TOP" x="-6" y="3"/>
                        </Anchors>
                     </Frame>
                     <Frame name="CharacterCustomizationButtonFrame4" inherits="CharacterCustomizationFrameTemplate" id="4">
                        <Anchors>
                           <Anchor point="BOTTOM" relativeTo="CharacterCustomizationButtonFrame5" relativePoint="TOP" x="0" y="0"/>
                        </Anchors>
                     </Frame>
                     <Frame name="CharacterCustomizationButtonFrame3" inherits="CharacterCustomizationFrameTemplate" id="3">
                        <Anchors>
                           <Anchor point="BOTTOM" relativeTo="CharacterCustomizationButtonFrame4" relativePoint="TOP" x="0" y="0"/>
                        </Anchors>
                     </Frame>
                     <Frame name="CharacterCustomizationButtonFrame2" inherits="CharacterCustomizationFrameTemplate" id="2">
                        <Anchors>
                           <Anchor point="BOTTOM" relativeTo="CharacterCustomizationButtonFrame3" relativePoint="TOP" x="0" y="0"/>
                        </Anchors>
                     </Frame>
                     <Frame name="CharacterCustomizationButtonFrame1" inherits="CharacterCustomizationFrameTemplate" id="1">
                        <Anchors>
                           <Anchor point="BOTTOM" relativeTo="CharacterCustomizationButtonFrame2" relativePoint="TOP" x="0" y="0"/>
                        </Anchors>
                     </Frame>
                  </Frames>
               </Frame>
               <EditBox name="CharacterCreateNameEdit" letters="12">
                  <Size x="156" y="40"/>
                  <Anchors>
                     <Anchor point="BOTTOM" x="0" y="55"/>
                  </Anchors>
                  <Layers>
                     <Layer level="BACKGROUND">
                        <FontString inherits="GlueFontNormalLarge" text="NAME">
                           <Size x="256" y="64"/>
                           <Anchors>
                              <Anchor point="BOTTOM" relativePoint="TOP" x="0" y="-23"/>
                           </Anchors>
                        </FontString>
                     </Layer>
                  </Layers>
                  <Backdrop bgFile="InterfaceTooltipsUI-Tooltip-Background" edgeFile="InterfaceGluesCommonGlue-Tooltip-Border" tile="true">
                     <BackgroundInsets>
                        <AbsInset left="10" right="5" top="4" bottom="9"/>
                     </BackgroundInsets>
                     <TileSize>
                        <AbsValue val="16"/>
                     </TileSize>
                     <EdgeSize>
                        <AbsValue val="16"/>
                     </EdgeSize>
                  </Backdrop>
                  <Scripts>
                     <OnEscapePressed>
                        CharacterCreate_Back();
                     </OnEscapePressed>
                     <OnEnterPressed>
                        CharacterCreate_Okay();
                     </OnEnterPressed>
                  </Scripts>
                  <FontString inherits="GlueEditBoxFont"/>
                  <TextInsets>
                     <AbsInset left="15"/>
                  </TextInsets>
               </EditBox>
               <Button name="CharacterCreateRandomName" inherits="GlueButtonSmallTemplate" text="RANDOMIZE" hidden="true">
                  <Size x="146" y="30"/>
                  <Anchors>
                     <Anchor point="TOP" relativeTo="CharacterCreateNameEdit" relativePoint="BOTTOM" x="0" y="7"/>
                  </Anchors>
                  <Scripts>
                     <OnLoad>
                        self:SetWidth(self:GetTextWidth() + 50);
                     </OnLoad>
                     <OnClick>
                        CharacterCreateNameEdit:SetText(GetRandomName());
                        PlaySound("gsCharacterCreationLook");
                     </OnClick>
                     <OnUpdate>
                        CharacterCreate_DeathKnightSwap(self);
                     </OnUpdate>
                  </Scripts>
               </Button>
               <Button name="CharacterCreateRotateLeft">
                  <Size x="50" y="50"/>
                  <Anchors>
                     <Anchor point="BOTTOM" x="-16" y="-5"/>
                  </Anchors>
                  <HitRectInsets>
                     <AbsInset left="13" right="13" top="10" bottom="13"/>
                  </HitRectInsets>
                  <Scripts>
                     <OnLoad>
                        self:RegisterForClicks("LeftButtonDown", "LeftButtonUp");
                     </OnLoad>
                     <OnClick>
                        PlaySound("igInventoryRotateCharacter");
                     </OnClick>
                     <OnUpdate>
                        CharacterCreateRotateLeft_OnUpdate(self);
                     </OnUpdate>
                  </Scripts>
                  <NormalTexture file="InterfaceGluesCharacterCreateUI-RotationRight-Big-Up">
                     <TexCoords left="1.0" right="0" top="0" bottom="1.0"/>
                  </NormalTexture>
                  <PushedTexture file="InterfaceGluesCharacterCreateUI-RotationRight-Big-Down">
                     <TexCoords left="1.0" right="0" top="0" bottom="1.0"/>
                  </PushedTexture>
                  <HighlightTexture file="InterfaceButtonsUI-Common-MouseHilight" alphaMode="ADD">
                     <Size x="30" y="30"/>
                     <Anchors>
                        <Anchor point="CENTER" x="0" y="0"/>
                     </Anchors>
                  </HighlightTexture>
               </Button>
               <Button name="CharacterCreateRotateRight">
                  <Size x="50" y="50"/>
                  <Anchors>
                     <Anchor point="BOTTOM" x="16" y="-5"/>
                  </Anchors>
                  <HitRectInsets>
                     <AbsInset left="13" right="13" top="10" bottom="13"/>
                  </HitRectInsets>
                  <Scripts>
                     <OnLoad>
                        self:RegisterForClicks("LeftButtonDown", "LeftButtonUp");
                     </OnLoad>
                     <OnClick>
                        PlaySound("igInventoryRotateCharacter");
                     </OnClick>
                     <OnUpdate>
                        CharacterCreateRotateRight_OnUpdate(self);
                     </OnUpdate>
                  </Scripts>
                  <NormalTexture file="InterfaceGluesCharacterCreateUI-RotationRight-Big-Up"/>
                  <PushedTexture file="InterfaceGluesCharacterCreateUI-RotationRight-Big-Down"/>
                  <HighlightTexture file="InterfaceButtonsUI-Common-MouseHilight" alphaMode="ADD">
                     <Size x="30" y="30"/>
                     <Anchors>
                        <Anchor point="CENTER" x="0" y="0"/>
                     </Anchors>
                  </HighlightTexture>
               </Button>
               <Button name="CharCreateOkayButton" inherits="GlueButtonTemplate" text="CHARACTER_CREATE_ACCEPT">
                  <Size x="160" y="35"/>
                  <Anchors>
                     <Anchor point="TOP" relativeTo="CharacterCreateCharacterClass" relativePoint="BOTTOM" x="4" y="-3"/>
                  </Anchors>
                  <Scripts>
                     <OnClick>
                        CharacterCreate_Okay();
                     </OnClick>
                     <OnUpdate>
                        CharacterCreate_DeathKnightSwap(self);
                     </OnUpdate>
                  </Scripts>
               </Button>
               <Button name="CharCreateBackButton" inherits="GlueButtonSmallTemplate" text="BACK">
                  <Size x="120" y="30"/>
                  <Anchors>
                     <Anchor point="TOP" relativeTo="CharCreateOkayButton" relativePoint="BOTTOM" x="4" y="3"/>
                  </Anchors>
                  <Scripts>
                     <OnClick>
                        CharacterCreate_Back();
                     </OnClick>
                     <OnUpdate>
                        CharacterCreate_DeathKnightSwap(self);
                     </OnUpdate>
                  </Scripts>
               </Button>
            </Frames>
            <Scripts>
               <OnMouseDown>
                  CharacterCreateFrame_OnMouseDown(button);
               </OnMouseDown>
               <OnMouseUp>
                  CharacterCreateFrame_OnMouseUp(button);
               </OnMouseUp>
               <OnUpdate>
                  CharacterCreateFrame_OnUpdate();
               </OnUpdate>
            </Scripts>
         </Frame>
      </Frames>
      <Scripts>
         <OnLoad>
            CharacterCreate_OnLoad(self);
         </OnLoad>
         <OnShow>
            CharacterCreate_OnShow();
         </OnShow>
         <OnHide>
            CharacterCreate_OnHide();
         </OnHide>
         <OnChar>
            CharacterCreate_OnChar();
         </OnChar>
         <OnKeyDown>
            CharacterCreate_OnKeyDown(key);
         </OnKeyDown>
         <OnUpdateModel>
            CharacterCreate_UpdateModel(self);
         </OnUpdateModel>
      </Scripts>
   </ModelFFX>
</Ui>[/spoiler:2ihtxdlx]
CHARACTERCREATE XML



[spoiler:2ihtxdlx]CHARACTER_FACING_INCREMENT = 2;
MAX_RACES = 11;
MAX_CLASSES_PER_RACE = 10;
NUM_CHAR_CUSTOMIZATIONS = 5;
MIN_CHAR_NAME_LENGTH = 2;
CHARACTER_CREATE_ROTATION_START_X = nil;
CHARACTER_CREATE_INITIAL_FACING = nil;

PAID_CHARACTER_CUSTOMIZATION = 1;
PAID_RACE_CHANGE = 2;
PAID_FACTION_CHANGE = 3;
PAID_SERVICE_CHARACTER_ID = nil;
PAID_SERVICE_TYPE = nil;

FACTION_BACKDROP_COLOR_TABLE = {
   ["Alliance"] = {0.5, 0.5, 0.5, 0.09, 0.09, 0.19},
   ["Horde"] = {0.5, 0.2, 0.2, 0.19, 0.05, 0.05},
};
FRAMES_TO_BACKDROP_COLOR = {
   "CharacterCreateCharacterRace",
   "CharacterCreateCharacterClass",
--   "CharacterCreateCharacterFaction",
   "CharacterCreateNameEdit",
};
RACE_ICON_TCOORDS = {
   ["HUMAN_MALE"]      = {0, 0.125, 0, 0.25},
   ["DWARF_MALE"]      = {0.125, 0.25, 0, 0.25},
   ["GNOME_MALE"]      = {0.25, 0.375, 0, 0.25},
   ["NIGHTELF_MALE"]   = {0.375, 0.5, 0, 0.25},
   
   ["TAUREN_MALE"]      = {0, 0.125, 0.25, 0.5},
   ["SCOURGE_MALE"]   = {0.125, 0.25, 0.25, 0.5},
   ["TROLL_MALE"]      = {0.25, 0.375, 0.25, 0.5},
   ["ORC_MALE"]      = {0.375, 0.5, 0.25, 0.5},

   ["HUMAN_FEMALE"]   = {0, 0.125, 0.5, 0.75},  
   ["DWARF_FEMALE"]   = {0.125, 0.25, 0.5, 0.75},
   ["GNOME_FEMALE"]   = {0.25, 0.375, 0.5, 0.75},
   ["NIGHTELF_FEMALE"]   = {0.375, 0.5, 0.5, 0.75},
   
   ["TAUREN_FEMALE"]   = {0, 0.125, 0.75, 1.0},  
   ["SCOURGE_FEMALE"]   = {0.125, 0.25, 0.75, 1.0},
   ["TROLL_FEMALE"]   = {0.25, 0.375, 0.75, 1.0},
   ["ORC_FEMALE"]      = {0.375, 0.5, 0.75, 1.0},

   ["BLOODELF_MALE"]   = {0.5, 0.625, 0.25, 0.5},
   ["BLOODELF_FEMALE"]   = {0.5, 0.625, 0.75, 1.0},

   ["DRAENEI_MALE"]   = {0.5, 0.625, 0, 0.25},
   ["DRAENEI_FEMALE"]   = {0.5, 0.625, 0.5, 0.75},

   ["FORESTTROLL_MALE"]        = {0.5, 0.625, 0, 0.25},
   ["FORESTTROLL_FEMALE"]    = {0.5, 0.625, 0, 0.25},
};
CLASS_ICON_TCOORDS = {
   ["WARRIOR"]   = {0, 0.25, 0, 0.25},
   ["MAGE"]   = {0.25, 0.49609375, 0, 0.25},
   ["ROGUE"]   = {0.49609375, 0.7421875, 0, 0.25},
   ["DRUID"]   = {0.7421875, 0.98828125, 0, 0.25},
   ["HUNTER"]   = {0, 0.25, 0.25, 0.5},
   ["SHAMAN"]   = {0.25, 0.49609375, 0.25, 0.5},
   ["PRIEST"]   = {0.49609375, 0.7421875, 0.25, 0.5},
   ["WARLOCK"]   = {0.7421875, 0.98828125, 0.25, 0.5},
   ["PALADIN"]   = {0, 0.25, 0.5, 0.75},
   ["DEATHKNIGHT"]   = {0.25, 0.49609375, 0.5, 0.75},
};

function CharacterCreate_OnLoad(self)
   self:SetSequence(0);
   self:SetCamera(0);

   CharacterCreate.numRaces = 0;
   CharacterCreate.selectedRace = 0;
   CharacterCreate.numClasses = 0;
   CharacterCreate.selectedClass = 0;
   CharacterCreate.selectedGender = 0;

   SetCharCustomizeFrame("CharacterCreate");

   for i=1, NUM_CHAR_CUSTOMIZATIONS, 1 do
      _G["CharacterCustomizationButtonFrame"..i.."Text"]:SetText(_G["CHAR_CUSTOMIZATION"..i.."_DESC"]);
   end

   -- Color edit box backdrop
   local backdropColor = FACTION_BACKDROP_COLOR_TABLE["Alliance"];
   CharacterCreateNameEdit:SetBackdropBorderColor(backdropColor[1], backdropColor[2], backdropColor[3]);
   CharacterCreateNameEdit:SetBackdropColor(backdropColor[4], backdropColor[5], backdropColor[6]);
end

function CharacterCreate_OnShow()
   for i=1, MAX_CLASSES_PER_RACE, 1 do
      local button = _G["CharacterCreateClassButton"..i];
      button:Enable();
      SetButtonDesaturated(button, false)
   end
   for i=1, MAX_RACES, 1 do
      local button = _G["CharacterCreateRaceButton"..i];
      button:Enable();
      SetButtonDesaturated(button, false)
   end

   if ( PAID_SERVICE_TYPE ) then
      CustomizeExistingCharacter( PAID_SERVICE_CHARACTER_ID );
      CharacterCreateNameEdit:SetText( PaidChange_GetName() );
   else
      --randomly selects a combination
      ResetCharCustomize();
      CharacterCreateNameEdit:SetText("");
      CharCreateRandomizeButton:Show();
   end

   CharacterCreateEnumerateRaces(GetAvailableRaces());
   SetCharacterRace(GetSelectedRace());
   
   CharacterCreateEnumerateClasses(GetAvailableClasses());
   local_,_,index = GetSelectedClass();
   SetCharacterClass(index);

   SetCharacterGender(GetSelectedSex())
   
   -- Hair customization stuff
   CharacterCreate_UpdateHairCustomization();

   SetCharacterCreateFacing(-15);
   
   if ( ALLOW_RANDOM_NAME_BUTTON ) then
      CharacterCreateRandomName:Show();
   end
   
   -- setup customization
   CharacterChangeFixup();
end

function CharacterCreate_OnHide()
   PAID_SERVICE_CHARACTER_ID = nil;
   PAID_SERVICE_TYPE = nil;
end

function CharacterCreateFrame_OnMouseDown(button)
   if ( button == "LeftButton" ) then
      CHARACTER_CREATE_ROTATION_START_X = GetCursorPosition();
      CHARACTER_CREATE_INITIAL_FACING = GetCharacterCreateFacing();
   end
end

function CharacterCreateFrame_OnMouseUp(button)
   if ( button == "LeftButton" ) then
      CHARACTER_CREATE_ROTATION_START_X = nil
   end
end

function CharacterCreateFrame_OnUpdate()
   if ( CHARACTER_CREATE_ROTATION_START_X ) then
      local x = GetCursorPosition();
      local diff = (x - CHARACTER_CREATE_ROTATION_START_X) * CHARACTER_ROTATION_CONSTANT;
      CHARACTER_CREATE_ROTATION_START_X = GetCursorPosition();
      SetCharacterCreateFacing(GetCharacterCreateFacing() + diff);
   end
end

function CharacterCreateEnumerateRaces(...)
   CharacterCreate.numRaces = select("#", ...)/3;
   if ( CharacterCreate.numRaces > MAX_RACES ) then
      message("Too many races!  Update MAX_RACES");
      return;
   end
   local coords;
   local index = 1;
   local button;
   local gender;
   local selectedSex = GetSelectedSex();
   if ( selectedSex == SEX_MALE ) then
      gender = "MALE";
   elseif ( selectedSex == SEX_FEMALE ) then
      gender = "FEMALE";
   end
   for i=1, select("#", ...), 3 do
      coords = RACE_ICON_TCOORDS[strupper(select(i+1, ...).."_"..gender)];
      _G["CharacterCreateRaceButton"..index.."NormalTexture"]:SetTexCoord(coords[1], coords[2], coords[3], coords[4]);
      _G["CharacterCreateRaceButton"..index.."PushedTexture"]:SetTexCoord(coords[1], coords[2], coords[3], coords[4]);
      button = _G["CharacterCreateRaceButton"..index];
      button:Show();
      if ( select(i+2, ...) == 1 ) then
         button.enable = true;
         SetButtonDesaturated(button);
         button.name = select(i, ...)
         button.tooltip = select(i, ...);
      else
         button.enable = false;
         SetButtonDesaturated(button, 1);
         button.name = select(i, ...)
         button.tooltip = _G[strupper(select(i+1, ...).."_".."DISABLED")];
      end
      index = index + 1;
   end
   for i=CharacterCreate.numRaces + 1, MAX_RACES, 1 do
      _G["CharacterCreateRaceButton"..i]:Hide();
   end
end

function CharacterCreateEnumerateClasses(...)
   CharacterCreate.numClasses = select("#", ...)/3;
   if ( CharacterCreate.numClasses > MAX_CLASSES_PER_RACE ) then
      message("Too many classes!  Update MAX_CLASSES_PER_RACE");
      return;
   end
   local coords;
   local index = 1;
   local button;
   for i=1, select("#", ...), 3 do
      coords = CLASS_ICON_TCOORDS[strupper(select(i+1, ...))];
      _G["CharacterCreateClassButton"..index.."NormalTexture"]:SetTexCoord(coords[1], coords[2], coords[3], coords[4]);
      _G["CharacterCreateClassButton"..index.."PushedTexture"]:SetTexCoord(coords[1], coords[2], coords[3], coords[4]);
      button = _G["CharacterCreateClassButton"..index];
      button:Show();
      if ( (select(i+2, ...) == 1) and (IsRaceClassValid(CharacterCreate.selectedRace, index)) ) then
         button.enable = true;
         button:Enable();
         SetButtonDesaturated(button);
         button.name = select(i, ...)
         button.tooltip = select(i, ...);
         _G["CharacterCreateClassButton"..index.."DisableTexture"]:Hide();
      else
         button.enable = false;
         button:Disable();
         SetButtonDesaturated(button, 1);
         button.name = select(i, ...)
         button.tooltip = _G[strupper(select(i+1, ...).."_".."DISABLED")];
         _G["CharacterCreateClassButton"..index.."DisableTexture"]:Show();
      end
      index = index + 1;
   end
   for i=CharacterCreate.numClasses + 1, MAX_CLASSES_PER_RACE, 1 do
      _G["CharacterCreateClassButton"..i]:Hide();
   end
end

function SetCharacterRace(id)
   CharacterCreate.selectedRace = id;
   local selectedButton;
   for i=1, CharacterCreate.numRaces, 1 do
      local button = _G["CharacterCreateRaceButton"..i];
      if ( i == id ) then
         _G["CharacterCreateRaceButton"..i.."Text"]:SetText(button.name);
         button:SetChecked(1);
         selectedButton = button;
      else
         _G["CharacterCreateRaceButton"..i.."Text"]:SetText("");
         button:SetChecked(0);
      end
   end

   -- Set Faction
   local name, faction = GetFactionForRace(CharacterCreate.selectedRace);

   -- Set Race
   local race, fileString = GetNameForRace();

   CharacterCreateRaceLabel:SetText(race);
   fileString = strupper(fileString);
   if ( GetSelectedSex() == SEX_MALE ) then
      gender = "MALE";
   else
      gender = "FEMALE";
   end
   local coords = RACE_ICON_TCOORDS[fileString.."_"..gender];
   CharacterCreateRaceIcon:SetTexCoord(coords[1], coords[2], coords[3], coords[4]);
   local raceText = _G["RACE_INFO_"..fileString];
   local abilityIndex = 1;
   local tempText = _G["ABILITY_INFO_"..fileString..abilityIndex];
   abilityText = "";
   while ( tempText ) do
      abilityText = abilityText..tempText.."nn";
      abilityIndex = abilityIndex + 1;
      tempText = _G["ABILITY_INFO_"..fileString..abilityIndex];
   end

   CharacterCreateRaceScrollFrameScrollBar:SetValue(0);
   CharacterCreateRaceText:SetText(GetFlavorText("RACE_INFO_"..strupper(fileString), GetSelectedSex()).."|n|n");
   if ( abilityText and abilityText ~= "" ) then
      CharacterCreateRaceAbilityText:SetText(abilityText);
   else
      CharacterCreateRaceAbilityText:SetText("");
   end

   -- Set backdrop colors based on faction
   local backdropColor = FACTION_BACKDROP_COLOR_TABLE[faction];
   local frame;
   for index, value in pairs(FRAMES_TO_BACKDROP_COLOR) do
      frame = _G[value];
      frame:SetBackdropColor(backdropColor[4], backdropColor[5], backdropColor[6]);
   end
   CharacterCreateConfigurationBackground:SetVertexColor(backdropColor[4], backdropColor[5], backdropColor[6]);

   local backgroundFilename = GetCreateBackgroundModel();
   SetBackgroundModel(CharacterCreate, backgroundFilename);
end

function SetCharacterClass(id)
   CharacterCreate.selectedClass = id;
   for i=1, CharacterCreate.numClasses, 1 do
      local button = _G["CharacterCreateClassButton"..i];
      if ( i == id ) then
         CharacterCreateClassName:SetText(button.name);
         button:SetChecked(1);
      else
         button:SetChecked(0);
      end
   end
   
   local className, classFileName, _, tank, healer, damage = GetSelectedClass();
   local abilityIndex = 0;
   local tempText = _G["CLASS_INFO_"..classFileName..abilityIndex];
   abilityText = "";
   while ( tempText ) do
      abilityText = abilityText..tempText.."nn";
      abilityIndex = abilityIndex + 1;
      tempText = _G["CLASS_INFO_"..classFileName..abilityIndex];
   end
   local coords = CLASS_ICON_TCOORDS[classFileName];
   CharacterCreateClassIcon:SetTexCoord(coords[1], coords[2], coords[3], coords[4]);
   CharacterCreateClassLabel:SetText(className);
   CharacterCreateClassRolesText:SetText(abilityText);   
   CharacterCreateClassText:SetText(GetFlavorText("CLASS_"..strupper(classFileName), GetSelectedSex()).."|n|n");
   CharacterCreateClassScrollFrameScrollBar:SetValue(0);
end

function CharacterCreate_OnChar()
end

function CharacterCreate_OnKeyDown(key)
   if ( key == "ESCAPE" ) then
      CharacterCreate_Back();
   elseif ( key == "ENTER" ) then
      CharacterCreate_Okay();
   elseif ( key == "PRINTSCREEN" ) then
      Screenshot();
   end
end

function CharacterCreate_UpdateModel(self)
   UpdateCustomizationScene();
   self:AdvanceTime();
end

function CharacterCreate_Okay()
   if ( PAID_SERVICE_TYPE ) then
      GlueDialog_Show("CONFIRM_PAID_SERVICE");
   else
      CreateCharacter(CharacterCreateNameEdit:GetText());
   end
   PlaySound("gsCharacterCreationCreateChar");
end

function CharacterCreate_Back()
   PlaySound("gsCharacterCreationCancel");
   SetGlueScreen("charselect");
end

function CharacterClass_OnClick(id)
   PlaySound("gsCharacterCreationClass");
   local _,_,currClass = GetSelectedClass();
   if ( currClass ~= id and IsRaceClassValid(GetSelectedRace(), id) ) then
      SetSelectedClass(id);
      SetCharacterClass(id);
       SetCharacterRace(GetSelectedRace());
      CharacterChangeFixup();
   end
end

function CharacterRace_OnClick(self, id)
   PlaySound("gsCharacterCreationClass");
   if ( not self:GetChecked() ) then
      self:SetChecked(1);
      return;
   end
   if ( GetSelectedRace() ~= id ) then
      SetSelectedRace(id);
      SetCharacterRace(id);
      SetSelectedSex(GetSelectedSex());
      SetCharacterCreateFacing(-15);
      CharacterCreateEnumerateClasses(GetAvailableClasses());
      local _,_,classIndex = GetSelectedClass();
      if ( PAID_SERVICE_TYPE ) then
         classIndex = PaidChange_GetCurrentClassIndex();
      end
      SetCharacterClass(classIndex);
      
      -- Hair customization stuff
      CharacterCreate_UpdateHairCustomization();
         
      CharacterChangeFixup();
   end
end

function SetCharacterGender(sex)
   local gender;
   SetSelectedSex(sex);
   if ( sex == SEX_MALE ) then
      gender = "MALE";
      CharacterCreateGender:SetText(MALE);
      CharacterCreateGenderButtonMale:SetChecked(1);
      CharacterCreateGenderButtonFemale:SetChecked(nil);
   elseif ( sex == SEX_FEMALE ) then
      gender = "FEMALE";
      CharacterCreateGender:SetText(FEMALE);
      CharacterCreateGenderButtonMale:SetChecked(nil);
      CharacterCreateGenderButtonFemale:SetChecked(1);
   end

   -- Update race images to reflect gender
   CharacterCreateEnumerateRaces(GetAvailableRaces());
   CharacterCreateEnumerateClasses(GetAvailableClasses());
    SetCharacterRace(GetSelectedRace());
   
   local _,_,classIndex = GetSelectedClass();
   if ( PAID_SERVICE_TYPE ) then
      classIndex = PaidChange_GetCurrentClassIndex();
   end
   SetCharacterClass(classIndex);

   CharacterCreate_UpdateHairCustomization();

   -- Update right hand race portrait to reflect gender change
   -- Set Race
   local race, fileString = GetNameForRace();
   CharacterCreateRaceLabel:SetText(race);
   fileString = strupper(fileString);
   local coords = RACE_ICON_TCOORDS[fileString.."_"..gender];
   CharacterCreateRaceIcon:SetTexCoord(coords[1], coords[2], coords[3], coords[4]);
   
   CharacterChangeFixup();
end

function CharacterCustomization_Left(id)
   PlaySound("gsCharacterCreationLook");
   CycleCharCustomization(id, -1);
end

function CharacterCustomization_Right(id)
   PlaySound("gsCharacterCreationLook");
   CycleCharCustomization(id, 1);
end

function CharacterCreate_Randomize()
   PlaySound("gsCharacterCreationLook");
   RandomizeCharCustomization();
end

function CharacterCreateRotateRight_OnUpdate(self)
   if ( self:GetButtonState() == "PUSHED" ) then
      SetCharacterCreateFacing(GetCharacterCreateFacing() + CHARACTER_FACING_INCREMENT);
   end
end

function CharacterCreateRotateLeft_OnUpdate(self)
   if ( self:GetButtonState() == "PUSHED" ) then
      SetCharacterCreateFacing(GetCharacterCreateFacing() - CHARACTER_FACING_INCREMENT);
   end
end

function CharacterCreate_UpdateHairCustomization()
   CharacterCustomizationButtonFrame3Text:SetText(_G["HAIR_"..GetHairCustomization().."_STYLE"]);
   CharacterCustomizationButtonFrame4Text:SetText(_G["HAIR_"..GetHairCustomization().."_COLOR"]);
   CharacterCustomizationButtonFrame5Text:SetText(_G["FACIAL_HAIR_"..GetFacialHairCustomization()]);      
end

function SetButtonDesaturated(button, desaturated, r, g, b)
   if ( not button ) then
      return;
   end
   local icon = button:GetNormalTexture();
   if ( not icon ) then
      return;
   end
   local shaderSupported = icon:SetDesaturated(desaturated);

   if ( not desaturated ) then
      r = 1.0;
      g = 1.0;
      b = 1.0;
   elseif ( not r or not shaderSupported ) then
      r = 0.5;
      g = 0.5;
      b = 0.5;
   end
   
   icon:SetVertexColor(r, g, b);
end

function GetFlavorText(tagname, sex)
   local primary, secondary;
   if ( sex == SEX_MALE ) then
      primary = "";
      secondary = "_FEMALE";
   else
      primary = "_FEMALE";
      secondary = "";
   end
   local text = _G[tagname..primary];
   if ( (text == nil) or (text == "") ) then
      text = _G[tagname..secondary];
   end
   return text;
end

function CharacterCreate_DeathKnightSwap(self)
   local _, classFilename = GetSelectedClass();
   if ( classFilename == "DEATHKNIGHT" ) then
      if (self.currentModel ~= "DEATHKNIGHT") then
         self.currentModel = "DEATHKNIGHT";
         self:SetNormalTexture("Interface\Glues\Common\Glue-Panel-Button-Up-Blue");
         self:SetPushedTexture("Interface\Glues\Common\Glue-Panel-Button-Down-Blue");
         self:SetHighlightTexture("Interface\Glues\Common\Glue-Panel-Button-Highlight-Blue");
      end
   else
      if (self.currentModel == "DEATHKNIGHT") then
         self.currentModel = nil;
         self:SetNormalTexture("Interface\Glues\Common\Glue-Panel-Button-Up");
         self:SetPushedTexture("Interface\Glues\Common\Glue-Panel-Button-Down");
         self:SetHighlightTexture("Interface\Glues\Common\Glue-Panel-Button-Highlight");
      end
   end
end

function CharacterChangeFixup()
   if ( PAID_SERVICE_TYPE ) then
      for i=1, MAX_CLASSES_PER_RACE, 1 do
         if (CharacterCreate.se
Title: Re: [QUESTION] Adding a race
Post by: Steff on August 31, 2011, 09:24:58 pm
Please USE  pastbin!
Title: Re: [QUESTION] Adding a race
Post by: Razstah on August 31, 2011, 10:47:56 pm
Quote from: "Steff"
Please USE  pastbin!
http://pastebin.com/LDDjZJKg (http://pastebin.com/LDDjZJKg" onclick="window.open(this.href);return false;)
Title: Re: [QUESTION] Adding a race
Post by: Gurluas on November 10, 2013, 11:41:12 am
I have a similar issue.
The tutorial does not explain at all how to edit the xml.
I need to add more buttons, I tried adding new button entries but all it did was remove Blood elves.
I need to have 4 new races.

Broken, Goblin, Forest Troll, and Taunka, the last 3 are Horde.
Yet I can't make it work, does anyone have any idea on how to add a button?