오윤석

아바타, 서버(명, 아이콘), 주스탯명, 공/마 정보 추가 전달

...@@ -27,7 +27,16 @@ const getCharacterInfo = async function(nickname, characterCode) { ...@@ -27,7 +27,16 @@ const getCharacterInfo = async function(nickname, characterCode) {
27 27
28 const character = { 28 const character = {
29 nickname: nickname, 29 nickname: nickname,
30 - characterCode: characterCode 30 + characterCode: characterCode,
31 + job: null,
32 + level: null,
33 + avatar: null,
34 + server: {
35 + icon: null,
36 + name: null
37 + },
38 + majorName: null,
39 + attackPowerName: null
31 }; 40 };
32 const stats = { 41 const stats = {
33 major: 0, 42 major: 0,
...@@ -49,6 +58,13 @@ const getCharacterInfo = async function(nickname, characterCode) { ...@@ -49,6 +58,13 @@ const getCharacterInfo = async function(nickname, characterCode) {
49 58
50 character.job = $(".tab01_con_wrap .table_style01:eq(0) tbody tr:eq(0) td:eq(1) span").text(); 59 character.job = $(".tab01_con_wrap .table_style01:eq(0) tbody tr:eq(0) td:eq(1) span").text();
51 character.level = parseInt($(".char_info dl:eq(0) dd").text().substring(3)); 60 character.level = parseInt($(".char_info dl:eq(0) dd").text().substring(3));
61 + character.avatar = $(".char_img img").attr("src");
62 + character.server = {
63 + name: $(".char_info dl:eq(2) dd").text(),
64 + icon: $(".char_info dl:eq(2) dd img").attr("src")
65 + };
66 + character.majorName = jobModel[character.job].major;
67 + character.attackPowerName = character.majorName == "INT" ? "마력" : "공격력";
52 68
53 const $statInfo = $(".tab01_con_wrap .table_style01:eq(1)"); 69 const $statInfo = $(".tab01_con_wrap .table_style01:eq(1)");
54 $("tbody tr", $statInfo).each(function() { 70 $("tbody tr", $statInfo).each(function() {
...@@ -56,7 +72,7 @@ const getCharacterInfo = async function(nickname, characterCode) { ...@@ -56,7 +72,7 @@ const getCharacterInfo = async function(nickname, characterCode) {
56 if ($("th span", this).text() == "하이퍼스탯") { 72 if ($("th span", this).text() == "하이퍼스탯") {
57 const values = $("td span", this).html().split("<br>"); 73 const values = $("td span", this).html().split("<br>");
58 74
59 - const regexMajor = new RegExp(`${statModel[jobModel[character.job].major].korean} (\\d+) 증가`); 75 + const regexMajor = new RegExp(`${statModel[character.majorName].korean} (\\d+) 증가`);
60 const regexDamage = new RegExp(`^데미지 (\\d+)% 증가`); 76 const regexDamage = new RegExp(`^데미지 (\\d+)% 증가`);
61 77
62 let regexResult; 78 let regexResult;
...@@ -73,7 +89,7 @@ const getCharacterInfo = async function(nickname, characterCode) { ...@@ -73,7 +89,7 @@ const getCharacterInfo = async function(nickname, characterCode) {
73 const value = $(`td:eq(${i}) span`, this).text().replace(/\,/g, ""); 89 const value = $(`td:eq(${i}) span`, this).text().replace(/\,/g, "");
74 90
75 switch (statName) { 91 switch (statName) {
76 - case jobModel[character.job].major: 92 + case character.majorName:
77 stats['major'] = parseInt(value); 93 stats['major'] = parseInt(value);
78 break; 94 break;
79 case jobModel[character.job].minor: 95 case jobModel[character.job].minor:
...@@ -379,6 +395,8 @@ module.exports = { ...@@ -379,6 +395,8 @@ module.exports = {
379 const buffEfficiency = calculateEfficiency(buffStats, characterInfo.character.job, analysisEquipment.weapon); 395 const buffEfficiency = calculateEfficiency(buffStats, characterInfo.character.job, analysisEquipment.weapon);
380 396
381 res.send({ 397 res.send({
398 + info: characterInfo.character,
399 + analysis: {
382 default: { 400 default: {
383 stats: stats, 401 stats: stats,
384 efficiency: efficiency 402 efficiency: efficiency
...@@ -387,6 +405,7 @@ module.exports = { ...@@ -387,6 +405,7 @@ module.exports = {
387 stats: buffStats, 405 stats: buffStats,
388 efficiency: buffEfficiency 406 efficiency: buffEfficiency
389 } 407 }
408 + }
390 }); 409 });
391 } 410 }
392 }; 411 };
...\ No newline at end of file ...\ No newline at end of file
......