Advertisement
Guest User

CharacterCreate.lua

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