Advertisement
Guest User

Untitled

a guest
Feb 8th, 2019
196
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 6.91 KB | None | 0 0
  1. const User = require('../User');
  2.  
  3. class PartyMemberData {
  4.  
  5. constructor (communicator, data) {
  6.  
  7. this.communicator = communicator;
  8.  
  9. this.sender = new User(this.communicator.getClient(), data);
  10.  
  11. this.party_id = data.party_id;
  12.  
  13. // TODO: data.payload
  14. this.payload = data.payload || this.makePayload();
  15.  
  16. this.time = data.time;
  17.  
  18. }
  19.  
  20. send (to) {
  21.  
  22. return this.communicator.sendRequest({
  23.  
  24. to,
  25.  
  26. body: JSON.stringify({
  27.  
  28. type: 'com.epicgames.party.memberdata',
  29.  
  30. payload: {
  31. partyId: this.party_id,
  32. payload: this.payload
  33. },
  34.  
  35. timestamp: new Date()
  36.  
  37. })
  38.  
  39. });
  40.  
  41. }
  42.  
  43. sendPart (part, to) {
  44.  
  45. return this.communicator.sendRequest({
  46.  
  47. to,
  48.  
  49. body: JSON.stringify({
  50.  
  51. type: 'com.epicgames.party.memberdata',
  52.  
  53. payload: {
  54. partyId: this.party_id,
  55. payload: part
  56. },
  57.  
  58. timestamp: new Date()
  59.  
  60. })
  61.  
  62. });
  63.  
  64. }
  65.  
  66. setReady (is_ready, jid) {
  67.  
  68. this.payload.Attrs.FrontendEmote_j.IsReadyAthena_b = is_ready;
  69.  
  70. let part = {
  71.  
  72. Rev: 1,
  73.  
  74. Attrs: {
  75. IsReadyAthena_b: this.payload.Attrs.IsReadyAthena_b,
  76. ReadyInputType_s: this.payload.Attrs.ReadyInputType_s
  77. }
  78.  
  79. };
  80.  
  81. if(!jid)
  82. return false;
  83.  
  84. if(Array.isArray(jid)){
  85. jid.forEach(j => this.sendPart(part, j));
  86. }else this.sendPart(part, jid);
  87.  
  88. }
  89.  
  90. setEmote (emote_asset, jid) { // emote_asset e.g. /Game/Athena/Items/Cosmetics/Dances/EID_KPopDance01.EID_KPopDance01
  91.  
  92. this.payload.Attrs.FrontendEmote_j.FrontendEmote = {
  93. emoteItemDef: 'AthenaDanceItemDefinition\'' + emote_asset + '\'',
  94. emoteItemDefEncryptionKey: '',
  95. emoteSection: -2
  96. };
  97.  
  98. let part = {
  99.  
  100. Rev: 1,
  101.  
  102. Attrs: {
  103. FrontendEmote_j: this.payload.Attrs.FrontendEmote_j,
  104. }
  105.  
  106. };
  107.  
  108. if(!jid)
  109. return false;
  110.  
  111. if(Array.isArray(jid)){
  112. jid.forEach(j => this.sendPart(part, j));
  113. }else this.sendPart(part, jid);
  114.  
  115. }
  116.  
  117. clearEmote (jid) {
  118.  
  119. this.payload.Attrs.FrontendEmote_j.FrontendEmote = {
  120. emoteItemDef: 'None',
  121. emoteItemDefEncryptionKey: '',
  122. emoteSection: -1
  123. };
  124.  
  125. let part = {
  126.  
  127. Rev: 2,
  128.  
  129. Attrs: {
  130. FrontendEmote_j: this.payload.Attrs.FrontendEmote_j,
  131. }
  132.  
  133. };
  134.  
  135. if(!jid)
  136. return false;
  137.  
  138. if(Array.isArray(jid)){
  139. jid.forEach(j => this.sendPart(part, j));
  140. }else this.sendPart(part, jid);
  141.  
  142. }
  143.  
  144.  
  145. setBRCharacter (character_asset, jid) { // character_asset e.g. /Game/Athena/Items/Cosmetics/Characters/CID_342_Athena_Commando_M_StreetRacerMetallic.CID_342_Athena_Commando_M_StreetRacerMetallic
  146.  
  147. this.payload.Attrs.AthenaCosmeticLoadout_j.AthenaCosmeticLoadout.characterDefinition = '\AthenaCharacterItemDefinition\'' + character_asset + '\'';
  148.  
  149. let part = {
  150.  
  151. Rev: 3,
  152.  
  153. Attrs: {
  154. CampaignHero_j: this.payload.Attrs.CampaignHero_j,
  155. AthenaCosmeticLoadout_j: this.payload.Attrs.AthenaCosmeticLoadout_j
  156. }
  157.  
  158. };
  159.  
  160. if(!jid)
  161. return false;
  162.  
  163. if(Array.isArray(jid)){
  164. jid.forEach(j => this.sendPart(part, j));
  165. }else this.sendPart(part, jid);
  166.  
  167. }
  168.  
  169. setBackpack(backbling_asset, jid) { // character_asset e.g. /Game/Athena/Items/Cosmetics/Characters/CID_342_Athena_Commando_M_StreetRacerMetallic.CID_342_Athena_Commando_M_StreetRacerMetallic
  170.  
  171. this.payload.Attrs.AthenaCosmeticLoadout_j.AthenaCosmeticLoadout.backpackDefinition = '\AthenaBackblingItemDefinition\'' + backbling_asset + '\'';
  172.  
  173. let part = {
  174.  
  175. Rev: 3,
  176.  
  177. Attrs: {
  178. AthenaCosmeticLoadout_j: this.payload.Attrs.AthenaCosmeticLoadout_j
  179. }
  180.  
  181. };
  182.  
  183. if(!jid)
  184. return false;
  185.  
  186. if(Array.isArray(jid)){
  187. jid.forEach(j => this.sendPart(part, j));
  188. }else this.sendPart(part, jid);
  189.  
  190. }
  191.  
  192. makePayload () {
  193.  
  194. let default_characters = [
  195. 'CID_001_Athena_Commando_F_Default.CID_001_Athena_Commando_F_Default',
  196. 'CID_002_Athena_Commando_F_Default.CID_002_Athena_Commando_F_Default',
  197. 'CID_003_Athena_Commando_F_Default.CID_003_Athena_Commando_F_Default',
  198. 'CID_004_Athena_Commando_F_Default.CID_004_Athena_Commando_F_Default',
  199. 'CID_005_Athena_Commando_M_Default.CID_005_Athena_Commando_M_Default',
  200. 'CID_006_Athena_Commando_M_Default.CID_006_Athena_Commando_M_Default',
  201. 'CID_007_Athena_Commando_M_Default.CID_007_Athena_Commando_M_Default',
  202. 'CID_008_Athena_Commando_M_Default.CID_008_Athena_Commando_M_Default',
  203. ];
  204.  
  205. let default_backpacks = [
  206. 'BID_001_BlueSquire.BID_001_BlueSquire',
  207. 'BID_001_BlueSquire.BID_001_BlueSquire',
  208. 'BID_001_BlueSquire.BID_001_BlueSquire',
  209. 'BID_001_BlueSquire.BID_001_BlueSquire',
  210. 'BID_001_BlueSquire.BID_001_BlueSquire',
  211. 'BID_001_BlueSquire.BID_001_BlueSquire',
  212. 'BID_001_BlueSquire.BID_001_BlueSquire',
  213. 'BID_001_BlueSquire.BID_001_BlueSquire',
  214. ];
  215.  
  216. let character = default_characters[Math.floor(Math.random() * default_characters.length)];
  217. let backpack = default_backpacks[Math.floor(Math.random() * default_backpacks.length)];
  218.  
  219. return {
  220.  
  221. Rev: 4,
  222.  
  223. Attrs: {
  224.  
  225. Location_s: 'PreLobby',
  226.  
  227. CampaignHero_j: { // PVE CHARACTER LOADOUT
  228. CampaignHero: {
  229. heroItemInstanceId: '',
  230. heroType: 'AthenaCharacterItemDefinition\'/Game/Athena/Items/Cosmetics/Characters/' + character + '\''
  231. }
  232. },
  233.  
  234. MatchmakingLevel_U: '0',
  235. ZoneInstanceId_s: '',
  236. HomeBaseVersion_U: '1',
  237. HasPreloadedAthena_b: false,
  238.  
  239. FrontendEmote_j: {
  240.  
  241. FrontendEmote: {
  242.  
  243. emoteItemDef: 'None',
  244. emoteItemDefEncryptionKey: '',
  245. emoteSection:-1
  246.  
  247. }
  248.  
  249. },
  250.  
  251. NumAthenaPlayersLeft_U: '0',
  252. UtcTimeStartedMatchAthena_s: new Date('0001-01-01T00:00:00.000Z'),
  253. IsReadyAthena_b: false,
  254. HiddenMatchmakingDelayMax_U: '0',
  255. ReadyInputType_s: 'Count',
  256. CurrentInputType_s: 'MouseAndKeyboard',
  257.  
  258. AthenaCosmeticLoadout_j: { // BR CHARACTER LOADOUT
  259.  
  260. AthenaCosmeticLoadout: {
  261.  
  262. characterDefinition: '\AthenaCharacterItemDefinition\'/Game/Athena/Items/Cosmetics/Characters/' + character + '\'',
  263. characterDefinitionEncryptionKey: '',
  264.  
  265. backpackDefinition: '\AthenaBackpackItemDefinition\'/Game/Athena/Items/Cosmetics/Backpacks/' + backpack + '\'',
  266. backpackDefinitionEncryptionKey: '',
  267.  
  268. pickaxeDefinition: 'AthenaPickaxeItemDefinition\'/Game/Athena/Items/Cosmetics/Pickaxes/DefaultPickaxe.DefaultPickaxe\'',
  269. pickaxeDefinitionEncryptionKey: '',
  270.  
  271. cosmeticVariants: []
  272.  
  273. }
  274.  
  275. },
  276.  
  277. AthenaBannerInfo_j: {
  278.  
  279. AthenaBannerInfo: {
  280.  
  281. bannerIconId: 'OtherBanner28',
  282. bannerColorId: 'defaultcolor1',
  283. seasonLevel: 1
  284.  
  285. }
  286.  
  287. },
  288.  
  289. BattlePassInfo_j: {
  290.  
  291. BattlePassInfo: {
  292.  
  293. bHasPurchasedPass: true,
  294. passLevel: 999999999,
  295. selfBoostXp: 99999,
  296. friendBoostXp: 99999
  297.  
  298. }
  299. },
  300.  
  301. Platform_j: {
  302. Platform: {
  303. platformStr: 'WIN'
  304. }
  305. },
  306.  
  307. PlatformUniqueId_s: 'INVALID',
  308. PlatformSessionId_s: '',
  309. CrossplayPreference_s: 'OptedIn'
  310.  
  311. }
  312.  
  313. };
  314. }
  315.  
  316. }
  317.  
  318. module.exports = PartyMemberData;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement