Advertisement
Guest User

Untitled

a guest
Jul 11th, 2014
35
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 17.48 KB | None | 0 0
  1. CHARACTER_FACING_INCREMENT = 2;
  2. MAX_RACES = 10;
  3. MAX_CLASSES_PER_RACE = 10;
  4. NUM_CHAR_CUSTOMIZATIONS = 5;
  5. MIN_CHAR_NAME_LENGTH = 2;
  6. CHARACTER_CREATE_ROTATION_START_X = nil;
  7. CHARACTER_CREATE_INITIAL_FACING = nil;
  8.  
  9. PAID_CHARACTER_CUSTOMIZATION = 1;
  10. PAID_RACE_CHANGE = 2;
  11. PAID_FACTION_CHANGE = 3;
  12. PAID_SERVICE_CHARACTER_ID = nil;
  13. PAID_SERVICE_TYPE = nil;
  14.  
  15. FACTION_BACKDROP_COLOR_TABLE = {
  16.     ["Alliance"] = {0.5, 0.5, 0.5, 0.09, 0.09, 0.19},
  17.     ["Horde"] = {0.5, 0.2, 0.2, 0.19, 0.05, 0.05},
  18. };
  19. FRAMES_TO_BACKDROP_COLOR = {
  20.     "CharacterCreateCharacterRace",
  21.     "CharacterCreateCharacterClass",
  22. --  "CharacterCreateCharacterFaction",
  23.     "CharacterCreateNameEdit",
  24. };
  25. RACE_ICON_TCOORDS = {
  26.     ["HUMAN_MALE"]      = {0, 0.125, 0, 0.25},
  27.     ["DWARF_MALE"]      = {0.125, 0.25, 0, 0.25},
  28.     ["GNOME_MALE"]      = {0.25, 0.375, 0, 0.25},
  29.     ["NIGHTELF_MALE"]   = {0.375, 0.5, 0, 0.25},
  30.    
  31.     ["TAUREN_MALE"]     = {0, 0.125, 0.25, 0.5},
  32.     ["SCOURGE_MALE"]    = {0.125, 0.25, 0.25, 0.5},
  33.     ["TROLL_MALE"]      = {0.25, 0.375, 0.25, 0.5},
  34.     ["ORC_MALE"]        = {0.375, 0.5, 0.25, 0.5},
  35.  
  36.     ["HUMAN_FEMALE"]    = {0, 0.125, 0.5, 0.75},  
  37.     ["DWARF_FEMALE"]    = {0.125, 0.25, 0.5, 0.75},
  38.     ["GNOME_FEMALE"]    = {0.25, 0.375, 0.5, 0.75},
  39.     ["NIGHTELF_FEMALE"] = {0.375, 0.5, 0.5, 0.75},
  40.    
  41.     ["TAUREN_FEMALE"]   = {0, 0.125, 0.75, 1.0},  
  42.     ["SCOURGE_FEMALE"]  = {0.125, 0.25, 0.75, 1.0},
  43.     ["TROLL_FEMALE"]    = {0.25, 0.375, 0.75, 1.0},
  44.     ["ORC_FEMALE"]      = {0.375, 0.5, 0.75, 1.0},
  45.  
  46.     ["BLOODELF_MALE"]   = {0.5, 0.625, 0.25, 0.5},
  47.     ["BLOODELF_FEMALE"] = {0.5, 0.625, 0.75, 1.0},
  48.  
  49.     ["DRAENEI_MALE"]    = {0.5, 0.625, 0, 0.25},
  50.     ["DRAENEI_FEMALE"]  = {0.5, 0.625, 0.5, 0.75},
  51. };
  52. CLASS_ICON_TCOORDS = {
  53.     ["WARRIOR"] = {0, 0.25, 0, 0.25},
  54.     ["MAGE"]    = {0.25, 0.49609375, 0, 0.25},
  55.     --["ROGUE"] = {0.49609375, 0.7421875, 0, 0.25},
  56.     --["DRUID"] = {0.7421875, 0.98828125, 0, 0.25},
  57.     --["HUNTER"]    = {0, 0.25, 0.25, 0.5},
  58.     --["SHAMAN"]    = {0.25, 0.49609375, 0.25, 0.5},
  59.     ["PRIEST"]  = {0.49609375, 0.7421875, 0.25, 0.5},
  60.     --["WARLOCK"]   = {0.7421875, 0.98828125, 0.25, 0.5},
  61.     --["PALADIN"]   = {0, 0.25, 0.5, 0.75},
  62.     --["DEATHKNIGHT"]   = {0.25, 0.49609375, 0.5, 0.75},
  63. };
  64.  
  65. function CharacterCreate_OnLoad(self)
  66.     self:SetSequence(0);
  67.     self:SetCamera(0);
  68.  
  69.     CharacterCreate.numRaces = 0;
  70.     CharacterCreate.selectedRace = 0;
  71.     CharacterCreate.numClasses = 0;
  72.     CharacterCreate.selectedClass = 0;
  73.     CharacterCreate.selectedGender = 0;
  74.  
  75.     SetCharCustomizeFrame("CharacterCreate");
  76.  
  77.     for i=1, NUM_CHAR_CUSTOMIZATIONS, 1 do
  78.         _G["CharacterCustomizationButtonFrame"..i.."Text"]:SetText(_G["CHAR_CUSTOMIZATION"..i.."_DESC"]);
  79.     end
  80.  
  81.     -- Color edit box backdrop
  82.     local backdropColor = FACTION_BACKDROP_COLOR_TABLE["Alliance"];
  83.     CharacterCreateNameEdit:SetBackdropBorderColor(backdropColor[1], backdropColor[2], backdropColor[3]);
  84.     CharacterCreateNameEdit:SetBackdropColor(backdropColor[4], backdropColor[5], backdropColor[6]);
  85. end
  86.  
  87. function CharacterCreate_OnShow()
  88.     for i=1, MAX_CLASSES_PER_RACE, 1 do
  89.         local button = _G["CharacterCreateClassButton"..i];
  90.         button:Enable();
  91.         SetButtonDesaturated(button, false)
  92.     end
  93.     for i=1, MAX_RACES, 1 do
  94.         local button = _G["CharacterCreateRaceButton"..i];
  95.         button:Enable();
  96.         SetButtonDesaturated(button, false)
  97.     end
  98.  
  99.     if ( PAID_SERVICE_TYPE ) then
  100.         CustomizeExistingCharacter( PAID_SERVICE_CHARACTER_ID );
  101.         CharacterCreateNameEdit:SetText( PaidChange_GetName() );
  102.     else
  103.         --randomly selects a combination
  104.         ResetCharCustomize();
  105.         CharacterCreateNameEdit:SetText("");
  106.         CharCreateRandomizeButton:Show();
  107.     end
  108.  
  109.     CharacterCreateEnumerateRaces(GetAvailableRaces());
  110.     SetCharacterRace(GetSelectedRace());
  111.    
  112.     CharacterCreateEnumerateClasses(GetAvailableClasses());
  113.     local_,_,index = GetSelectedClass();
  114.     SetCharacterClass(index);
  115.  
  116.     SetCharacterGender(GetSelectedSex())
  117.    
  118.     -- Hair customization stuff
  119.     CharacterCreate_UpdateHairCustomization();
  120.  
  121.     SetCharacterCreateFacing(-15);
  122.    
  123.     if ( ALLOW_RANDOM_NAME_BUTTON ) then
  124.         CharacterCreateRandomName:Show();
  125.     end
  126.    
  127.     -- setup customization
  128.     CharacterChangeFixup();
  129. end
  130.  
  131. function CharacterCreate_OnHide()
  132.     PAID_SERVICE_CHARACTER_ID = nil;
  133.     PAID_SERVICE_TYPE = nil;
  134. end
  135.  
  136. function CharacterCreateFrame_OnMouseDown(button)
  137.     if ( button == "LeftButton" ) then
  138.         CHARACTER_CREATE_ROTATION_START_X = GetCursorPosition();
  139.         CHARACTER_CREATE_INITIAL_FACING = GetCharacterCreateFacing();
  140.     end
  141. end
  142.  
  143. function CharacterCreateFrame_OnMouseUp(button)
  144.     if ( button == "LeftButton" ) then
  145.         CHARACTER_CREATE_ROTATION_START_X = nil
  146.     end
  147. end
  148.  
  149. function CharacterCreateFrame_OnUpdate()
  150.     if ( CHARACTER_CREATE_ROTATION_START_X ) then
  151.         local x = GetCursorPosition();
  152.         local diff = (x - CHARACTER_CREATE_ROTATION_START_X) * CHARACTER_ROTATION_CONSTANT;
  153.         CHARACTER_CREATE_ROTATION_START_X = GetCursorPosition();
  154.         SetCharacterCreateFacing(GetCharacterCreateFacing() + diff);
  155.     end
  156. end
  157.  
  158. function CharacterCreateEnumerateRaces(...)
  159.     CharacterCreate.numRaces = select("#", ...)/3;
  160.     if ( CharacterCreate.numRaces > MAX_RACES ) then
  161.         message("Too many races!  Update MAX_RACES");
  162.         return;
  163.     end
  164.     local coords;
  165.     local index = 1;
  166.     local button;
  167.     local gender;
  168.     local selectedSex = GetSelectedSex();
  169.     if ( selectedSex == SEX_MALE ) then
  170.         gender = "MALE";
  171.     elseif ( selectedSex == SEX_FEMALE ) then
  172.         gender = "FEMALE";
  173.     end
  174.     for i=1, select("#", ...), 3 do
  175.         coords = RACE_ICON_TCOORDS[strupper(select(i+1, ...).."_"..gender)];
  176.         _G["CharacterCreateRaceButton"..index.."NormalTexture"]:SetTexCoord(coords[1], coords[2], coords[3], coords[4]);
  177.         _G["CharacterCreateRaceButton"..index.."PushedTexture"]:SetTexCoord(coords[1], coords[2], coords[3], coords[4]);
  178.         button = _G["CharacterCreateRaceButton"..index];
  179.         button:Show();
  180.         if ( select(i+2, ...) == 1 ) then
  181.             button.enable = true;
  182.             SetButtonDesaturated(button);
  183.             button.name = select(i, ...)
  184.             button.tooltip = select(i, ...);
  185.         else
  186.             button.enable = false;
  187.             SetButtonDesaturated(button, 1);
  188.             button.name = select(i, ...)
  189.             button.tooltip = _G[strupper(select(i+1, ...).."_".."DISABLED")];
  190.         end
  191.         index = index + 1;
  192.     end
  193.     for i=CharacterCreate.numRaces + 1, MAX_RACES, 1 do
  194.         _G["CharacterCreateRaceButton"..i]:Hide();
  195.     end
  196. end
  197.  
  198. function CharacterCreateEnumerateClasses(...)
  199.     CharacterCreate.numClasses = select("#", ...)/3;
  200.     if ( CharacterCreate.numClasses > MAX_CLASSES_PER_RACE ) then
  201.         message("Too many classes!  Update MAX_CLASSES_PER_RACE");
  202.         return;
  203.     end
  204.     local coords;
  205.     local index = 1;
  206.     local button;
  207.     for i=1, select("#", ...), 3 do
  208.         coords = CLASS_ICON_TCOORDS[strupper(select(i+1, ...))];
  209.         _G["CharacterCreateClassButton"..index.."NormalTexture"]:SetTexCoord(coords[1], coords[2], coords[3], coords[4]);
  210.         _G["CharacterCreateClassButton"..index.."PushedTexture"]:SetTexCoord(coords[1], coords[2], coords[3], coords[4]);
  211.         button = _G["CharacterCreateClassButton"..index];
  212.         button:Show();
  213.         if ( (select(i+2, ...) == 1) and (IsRaceClassValid(CharacterCreate.selectedRace, index)) ) then
  214.             button.enable = true;
  215.             button:Enable();
  216.             SetButtonDesaturated(button);
  217.             button.name = select(i, ...)
  218.             button.tooltip = select(i, ...);
  219.             _G["CharacterCreateClassButton"..index.."DisableTexture"]:Hide();
  220.         else
  221.             button.enable = false;
  222.             button:Disable();
  223.             SetButtonDesaturated(button, 1);
  224.             button.name = select(i, ...)
  225.             button.tooltip = _G[strupper(select(i+1, ...).."_".."DISABLED")];
  226.             _G["CharacterCreateClassButton"..index.."DisableTexture"]:Show();
  227.         end
  228.         index = index + 1;
  229.     end
  230.     for i=CharacterCreate.numClasses + 1, MAX_CLASSES_PER_RACE, 1 do
  231.         _G["CharacterCreateClassButton"..i]:Hide();
  232.     end
  233. end
  234.  
  235. function SetCharacterRace(id)
  236.     CharacterCreate.selectedRace = id;
  237.     local selectedButton;
  238.     for i=1, CharacterCreate.numRaces, 1 do
  239.         local button = _G["CharacterCreateRaceButton"..i];
  240.         if ( i == id ) then
  241.             _G["CharacterCreateRaceButton"..i.."Text"]:SetText(button.name);
  242.             button:SetChecked(1);
  243.             selectedButton = button;
  244.         else
  245.             _G["CharacterCreateRaceButton"..i.."Text"]:SetText("");
  246.             button:SetChecked(0);
  247.         end
  248.     end
  249.  
  250.     -- Set Faction
  251.     local name, faction = GetFactionForRace(CharacterCreate.selectedRace);
  252.  
  253.     -- Set Race
  254.     local race, fileString = GetNameForRace();
  255.  
  256.     CharacterCreateRaceLabel:SetText(race);
  257.     fileString = strupper(fileString);
  258.     if ( GetSelectedSex() == SEX_MALE ) then
  259.         gender = "MALE";
  260.     else
  261.         gender = "FEMALE";
  262.     end
  263.     local coords = RACE_ICON_TCOORDS[fileString.."_"..gender];
  264.     CharacterCreateRaceIcon:SetTexCoord(coords[1], coords[2], coords[3], coords[4]);
  265.     local raceText = _G["RACE_INFO_"..fileString];
  266.     local abilityIndex = 1;
  267.     local tempText = _G["ABILITY_INFO_"..fileString..abilityIndex];
  268.     abilityText = "";
  269.     while ( tempText ) do
  270.         abilityText = abilityText..tempText.."\n\n";
  271.         abilityIndex = abilityIndex + 1;
  272.         tempText = _G["ABILITY_INFO_"..fileString..abilityIndex];
  273.     end
  274.  
  275.     CharacterCreateRaceScrollFrameScrollBar:SetValue(0);
  276.     CharacterCreateRaceText:SetText(GetFlavorText("RACE_INFO_"..strupper(fileString), GetSelectedSex()).."|n|n");
  277.     if ( abilityText and abilityText ~= "" ) then
  278.         CharacterCreateRaceAbilityText:SetText(abilityText);
  279.     else
  280.         CharacterCreateRaceAbilityText:SetText("");
  281.     end
  282.  
  283.     -- Set backdrop colors based on faction
  284.     local backdropColor = FACTION_BACKDROP_COLOR_TABLE[faction];
  285.     local frame;
  286.     for index, value in pairs(FRAMES_TO_BACKDROP_COLOR) do
  287.         frame = _G[value];
  288.         frame:SetBackdropColor(backdropColor[4], backdropColor[5], backdropColor[6]);
  289.     end
  290.     CharacterCreateConfigurationBackground:SetVertexColor(backdropColor[4], backdropColor[5], backdropColor[6]);
  291.  
  292.     local backgroundFilename = GetCreateBackgroundModel();
  293.     SetBackgroundModel(CharacterCreate, backgroundFilename);
  294. end
  295.  
  296. function SetCharacterClass(id)
  297.     CharacterCreate.selectedClass = id;
  298.     for i=1, CharacterCreate.numClasses, 1 do
  299.         local button = _G["CharacterCreateClassButton"..i];
  300.         if ( i == id ) then
  301.             CharacterCreateClassName:SetText(button.name);
  302.             button:SetChecked(1);
  303.         else
  304.             button:SetChecked(0);
  305.         end
  306.     end
  307.    
  308.     local className, classFileName, _, tank, healer, damage = GetSelectedClass();
  309.     local abilityIndex = 0;
  310.     local tempText = _G["CLASS_INFO_"..classFileName..abilityIndex];
  311.     abilityText = "";
  312.     while ( tempText ) do
  313.         abilityText = abilityText..tempText.."\n\n";
  314.         abilityIndex = abilityIndex + 1;
  315.         tempText = _G["CLASS_INFO_"..classFileName..abilityIndex];
  316.     end
  317.     local coords = CLASS_ICON_TCOORDS[classFileName];
  318.     CharacterCreateClassIcon:SetTexCoord(coords[1], coords[2], coords[3], coords[4]);
  319.     CharacterCreateClassLabel:SetText(className);
  320.     CharacterCreateClassRolesText:SetText(abilityText);
  321.     CharacterCreateClassText:SetText(GetFlavorText("CLASS_"..strupper(classFileName), GetSelectedSex()).."|n|n");
  322.     CharacterCreateClassScrollFrameScrollBar:SetValue(0);
  323. end
  324.  
  325. function CharacterCreate_OnChar()
  326. end
  327.  
  328. function CharacterCreate_OnKeyDown(key)
  329.     if ( key == "ESCAPE" ) then
  330.         CharacterCreate_Back();
  331.     elseif ( key == "ENTER" ) then
  332.         CharacterCreate_Okay();
  333.     elseif ( key == "PRINTSCREEN" ) then
  334.         Screenshot();
  335.     end
  336. end
  337.  
  338. function CharacterCreate_UpdateModel(self)
  339.     UpdateCustomizationScene();
  340.     self:AdvanceTime();
  341. end
  342.  
  343. function CharacterCreate_Okay()
  344.     if ( PAID_SERVICE_TYPE ) then
  345.         GlueDialog_Show("CONFIRM_PAID_SERVICE");
  346.     else
  347.         CreateCharacter(CharacterCreateNameEdit:GetText());
  348.     end
  349.     PlaySound("gsCharacterCreationCreateChar");
  350. end
  351.  
  352. function CharacterCreate_Back()
  353.     PlaySound("gsCharacterCreationCancel");
  354.     SetGlueScreen("charselect");
  355. end
  356.  
  357. function CharacterClass_OnClick(id)
  358.     PlaySound("gsCharacterCreationClass");
  359.     local _,_,currClass = GetSelectedClass();
  360.     if ( currClass ~= id and IsRaceClassValid(GetSelectedRace(), id) ) then
  361.         SetSelectedClass(id);
  362.         SetCharacterClass(id);
  363.         SetCharacterRace(GetSelectedRace());
  364.         CharacterChangeFixup();
  365.     end
  366. end
  367.  
  368. function CharacterRace_OnClick(self, id)
  369.     PlaySound("gsCharacterCreationClass");
  370.     if ( not self:GetChecked() ) then
  371.         self:SetChecked(1);
  372.         return;
  373.     end
  374.     if ( GetSelectedRace() ~= id ) then
  375.         SetSelectedRace(id);
  376.         SetCharacterRace(id);
  377.         SetSelectedSex(GetSelectedSex());
  378.         SetCharacterCreateFacing(-15);
  379.         CharacterCreateEnumerateClasses(GetAvailableClasses());
  380.         local _,_,classIndex = GetSelectedClass();
  381.         if ( PAID_SERVICE_TYPE ) then
  382.             classIndex = PaidChange_GetCurrentClassIndex();
  383.         end
  384.         SetCharacterClass(classIndex);
  385.        
  386.         -- Hair customization stuff
  387.         CharacterCreate_UpdateHairCustomization();
  388.            
  389.         CharacterChangeFixup();
  390.     end
  391. end
  392.  
  393. function SetCharacterGender(sex)
  394.     local gender;
  395.     SetSelectedSex(sex);
  396.     if ( sex == SEX_MALE ) then
  397.         gender = "MALE";
  398.         CharacterCreateGender:SetText(MALE);
  399.         CharacterCreateGenderButtonMale:SetChecked(1);
  400.         CharacterCreateGenderButtonFemale:SetChecked(nil);
  401.     elseif ( sex == SEX_FEMALE ) then
  402.         gender = "FEMALE";
  403.         CharacterCreateGender:SetText(FEMALE);
  404.         CharacterCreateGenderButtonMale:SetChecked(nil);
  405.         CharacterCreateGenderButtonFemale:SetChecked(1);
  406.     end
  407.  
  408.     -- Update race images to reflect gender
  409.     CharacterCreateEnumerateRaces(GetAvailableRaces());
  410.     CharacterCreateEnumerateClasses(GetAvailableClasses());
  411.     SetCharacterRace(GetSelectedRace());
  412.    
  413.     local _,_,classIndex = GetSelectedClass();
  414.     if ( PAID_SERVICE_TYPE ) then
  415.         classIndex = PaidChange_GetCurrentClassIndex();
  416.     end
  417.     SetCharacterClass(classIndex);
  418.  
  419.     CharacterCreate_UpdateHairCustomization();
  420.  
  421.     -- Update right hand race portrait to reflect gender change
  422.     -- Set Race
  423.     local race, fileString = GetNameForRace();
  424.     CharacterCreateRaceLabel:SetText(race);
  425.     fileString = strupper(fileString);
  426.     local coords = RACE_ICON_TCOORDS[fileString.."_"..gender];
  427.     CharacterCreateRaceIcon:SetTexCoord(coords[1], coords[2], coords[3], coords[4]);
  428.    
  429.     CharacterChangeFixup();
  430. end
  431.  
  432. function CharacterCustomization_Left(id)
  433.     PlaySound("gsCharacterCreationLook");
  434.     CycleCharCustomization(id, -1);
  435. end
  436.  
  437. function CharacterCustomization_Right(id)
  438.     PlaySound("gsCharacterCreationLook");
  439.     CycleCharCustomization(id, 1);
  440. end
  441.  
  442. function CharacterCreate_Randomize()
  443.     PlaySound("gsCharacterCreationLook");
  444.     RandomizeCharCustomization();
  445. end
  446.  
  447. function CharacterCreateRotateRight_OnUpdate(self)
  448.     if ( self:GetButtonState() == "PUSHED" ) then
  449.         SetCharacterCreateFacing(GetCharacterCreateFacing() + CHARACTER_FACING_INCREMENT);
  450.     end
  451. end
  452.  
  453. function CharacterCreateRotateLeft_OnUpdate(self)
  454.     if ( self:GetButtonState() == "PUSHED" ) then
  455.         SetCharacterCreateFacing(GetCharacterCreateFacing() - CHARACTER_FACING_INCREMENT);
  456.     end
  457. end
  458.  
  459. function CharacterCreate_UpdateHairCustomization()
  460.     CharacterCustomizationButtonFrame3Text:SetText(_G["HAIR_"..GetHairCustomization().."_STYLE"]);
  461.     CharacterCustomizationButtonFrame4Text:SetText(_G["HAIR_"..GetHairCustomization().."_COLOR"]);
  462.     CharacterCustomizationButtonFrame5Text:SetText(_G["FACIAL_HAIR_"..GetFacialHairCustomization()]);      
  463. end
  464.  
  465. function SetButtonDesaturated(button, desaturated, r, g, b)
  466.     if ( not button ) then
  467.         return;
  468.     end
  469.     local icon = button:GetNormalTexture();
  470.     if ( not icon ) then
  471.         return;
  472.     end
  473.     local shaderSupported = icon:SetDesaturated(desaturated);
  474.  
  475.     if ( not desaturated ) then
  476.         r = 1.0;
  477.         g = 1.0;
  478.         b = 1.0;
  479.     elseif ( not r or not shaderSupported ) then
  480.         r = 0.5;
  481.         g = 0.5;
  482.         b = 0.5;
  483.     end
  484.    
  485.     icon:SetVertexColor(r, g, b);
  486. end
  487.  
  488. function GetFlavorText(tagname, sex)
  489.     local primary, secondary;
  490.     if ( sex == SEX_MALE ) then
  491.         primary = "";
  492.         secondary = "_FEMALE";
  493.     else
  494.         primary = "_FEMALE";
  495.         secondary = "";
  496.     end
  497.     local text = _G[tagname..primary];
  498.     if ( (text == nil) or (text == "") ) then
  499.         text = _G[tagname..secondary];
  500.     end
  501.     return text;
  502. end
  503.  
  504. function CharacterCreate_DeathKnightSwap(self)
  505.     local _, classFilename = GetSelectedClass();
  506.     if ( classFilename == "DEATHKNIGHT" ) then
  507.         if (self.currentModel ~= "DEATHKNIGHT") then
  508.             self.currentModel = "DEATHKNIGHT";
  509.             self:SetNormalTexture("Interface\\Glues\\Common\\Glue-Panel-Button-Up-Blue");
  510.             self:SetPushedTexture("Interface\\Glues\\Common\\Glue-Panel-Button-Down-Blue");
  511.             self:SetHighlightTexture("Interface\\Glues\\Common\\Glue-Panel-Button-Highlight-Blue");
  512.         end
  513.     else
  514.         if (self.currentModel == "DEATHKNIGHT") then
  515.             self.currentModel = nil;
  516.             self:SetNormalTexture("Interface\\Glues\\Common\\Glue-Panel-Button-Up");
  517.             self:SetPushedTexture("Interface\\Glues\\Common\\Glue-Panel-Button-Down");
  518.             self:SetHighlightTexture("Interface\\Glues\\Common\\Glue-Panel-Button-Highlight");
  519.         end
  520.     end
  521. end
  522.  
  523. function CharacterChangeFixup()
  524.     if ( PAID_SERVICE_TYPE ) then
  525.         for i=1, MAX_CLASSES_PER_RACE, 1 do
  526.             if (CharacterCreate.selectedClass ~= i) then
  527.                 local button = _G["CharacterCreateClassButton"..i];
  528.                 button:Disable();
  529.                 SetButtonDesaturated(button, true)
  530.             end
  531.         end
  532.  
  533.         for i=1, MAX_RACES, 1 do
  534.             local allow = false;
  535.             if ( PAID_SERVICE_TYPE == PAID_FACTION_CHANGE ) then
  536.                 local faction = GetFactionForRace(PaidChange_GetCurrentRaceIndex());
  537.                 if ( (i == PaidChange_GetCurrentRaceIndex()) or ((GetFactionForRace(i) ~= faction) and (IsRaceClassValid(i,CharacterCreate.selectedClass))) ) then
  538.                     allow = true;
  539.                 end
  540.             elseif ( PAID_SERVICE_TYPE == PAID_RACE_CHANGE ) then
  541.                 local faction = GetFactionForRace(PaidChange_GetCurrentRaceIndex());
  542.                 if ( (i == PaidChange_GetCurrentRaceIndex()) or ((GetFactionForRace(i) == faction) and (IsRaceClassValid(i,CharacterCreate.selectedClass))) ) then
  543.                     allow = true
  544.                 end
  545.             elseif ( PAID_SERVICE_TYPE == PAID_CHARACTER_CUSTOMIZATION ) then
  546.                 if ( i == CharacterCreate.selectedRace ) then
  547.                     allow = true
  548.                 end
  549.             end
  550.             if (not allow) then
  551.                 local button = _G["CharacterCreateRaceButton"..i];
  552.                 button:Disable();
  553.                 SetButtonDesaturated(button, true)
  554.             end
  555.         end
  556.     end
  557. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement