Advertisement
Guest User

Untitled

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