Advertisement
Guest User

Untitled

a guest
Jul 27th, 2017
94
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 8.39 KB | None | 0 0
  1. //----- (005076B0) --------------------------------------------------------
  2. signed int __cdecl sub_5076B0(char *src, int a2, char a3, char a4, char a5, unsigned int a6)
  3. {
  4. signed int result; // eax@2
  5. int v7; // edx@6
  6. unsigned int v8; // edi@6
  7. unsigned int v9; // eax@12
  8. int v10; // ecx@13
  9. int v11; // esi@20
  10. int v12; // esi@23
  11.  
  12. if ( GetChannelByName((int)src) )
  13. return 0;
  14. if ( a2 && GetChannelById(a2) )
  15. return 0;
  16. v7 = dword_BCF094;
  17. v8 = dword_BCF090;
  18. if ( a6 && a6 <= 0xA )
  19. {
  20. if ( a6 > dword_BCF090 )
  21. {
  22. sub_506210((int)&unk_BCF08C, a6);
  23. v8 = a6 - 1;
  24. LABEL_22:
  25. v7 = dword_BCF094;
  26. goto LABEL_23;
  27. }
  28. if ( !*(_DWORD *)(168 * a6 + dword_BCF094 - 168) )
  29. {
  30. v8 = a6 - 1;
  31. LABEL_23:
  32. v12 = 168 * v8;
  33. *(_DWORD *)(168 * v8 + v7) = v8 + 1;
  34. SStrCopy((char *)(168 * v8 + dword_BCF094 + 4), src, 128);
  35. *(_DWORD *)(v12 + dword_BCF094 + 148) = a2;
  36. result = 1;
  37. *(_DWORD *)(v12 + dword_BCF094 + 156) = 1;
  38. *(_DWORD *)(v12 + dword_BCF094 + 160) = 0;
  39. *(_BYTE *)(v12 + dword_BCF094 + 164) = a4;
  40. *(_BYTE *)(v12 + dword_BCF094 + 165) = a5;
  41. return result;
  42. }
  43. }
  44. v9 = 0;
  45. if ( dword_BCF090 )
  46. {
  47. v10 = dword_BCF094;
  48. while ( *(_DWORD *)v10 )
  49. {
  50. ++v9;
  51. v10 += 168;
  52. if ( v9 >= dword_BCF090 )
  53. goto LABEL_16;
  54. }
  55. v11 = 168 * v9;
  56. *(_DWORD *)(168 * v9 + dword_BCF094) = v9 + 1;
  57. SStrCopy((char *)(168 * v9 + dword_BCF094 + 4), src, 128);
  58. *(_DWORD *)(v11 + dword_BCF094 + 148) = a2;
  59. result = 1;
  60. *(_DWORD *)(v11 + dword_BCF094 + 156) = 1;
  61. *(_DWORD *)(v11 + dword_BCF094 + 160) = 0;
  62. *(_BYTE *)(v11 + dword_BCF094 + 164) = a4;
  63. *(_BYTE *)(v11 + dword_BCF094 + 165) = a5;
  64. }
  65. else
  66. {
  67. LABEL_16:
  68. if ( dword_BCF090 != 10 )
  69. {
  70. sub_506210((int)&unk_BCF08C, dword_BCF090 + 1);
  71. goto LABEL_22;
  72. }
  73. if ( !a3 )
  74. CGGameUI::DisplayError(GERR_TOO_MANY_CHAT_CHANNELS);
  75. result = 0;
  76. }
  77. return result;
  78. }
  79.  
  80. //----- (00507880) --------------------------------------------------------
  81. int __cdecl sub_507880(int a1, char *src, int a3, char a4)
  82. {
  83. int result; // eax@2
  84. int v5; // esi@4
  85. int v6; // eax@6
  86.  
  87. if ( a1 )
  88. result = GetChannelById(a1);
  89. else
  90. result = GetChannelByName((int)src);
  91. v5 = result;
  92. if ( result && *(_DWORD *)result )
  93. {
  94. v6 = *(_DWORD *)(result + 148);
  95. *(_DWORD *)(v5 + 156) = 0;
  96. if ( v6 )
  97. {
  98. dword_BCF010 |= 1 << (v6 - 1);
  99. SStrCopy((char *)(v5 + 4), src, 128);
  100. }
  101. *(_DWORD *)(v5 + 152) = a3;
  102. *(_BYTE *)(v5 + 144) = a4;
  103. result = sub_505D40();
  104. }
  105. return result;
  106. }
  107.  
  108. //----- (00507900) --------------------------------------------------------
  109. int __cdecl sub_507900(int a1, int a2)
  110. {
  111. int result; // eax@2
  112. int v3; // esi@4
  113. int v4; // eax@6
  114.  
  115. if ( a1 )
  116. result = GetChannelById(a1);
  117. else
  118. result = GetChannelByName(a2);
  119. v3 = result;
  120. if ( result )
  121. {
  122. *(_DWORD *)(result + 156) = 1;
  123. if ( dword_B743CC )
  124. {
  125. v4 = sub_4FE1C0(dword_B743CC, (int)&a1);
  126. if ( !a1 && v3 != -4 && v4 && !SStrCmpUTF8I(v3 + 4, v4, 0x7FFFFFFF) )
  127. {
  128. if ( dword_B7447C[8 * dword_B743CC] )
  129. FrameScript::SignalEvent(EVENT_CHANNEL_VOICE_UPDATE, "%d%d", dword_B743CC + 1, dword_B7447C[8 * dword_B743CC]);
  130. else
  131. FrameScript::SignalEvent(EVENT_CHANNEL_VOICE_UPDATE, "%d", dword_B743CC + 1);
  132. dword_B743CC = 0;
  133. }
  134. }
  135. if ( !dword_B743DC && v3 != -4 && !SStrCmpUTF8I(v3 + 4, (int)byte_B743E0, 0x7FFFFFFF) )
  136. {
  137. memset(byte_B743E0, 0, 0x80u);
  138. dword_B743DC = 4;
  139. sub_502360((int)&dword_BCFB68);
  140. dword_BCFB68 = 0;
  141. dword_BCFB6C = 0;
  142. dword_BCFB70 = 0;
  143. dword_B743D4 = 0;
  144. }
  145. result = sub_505D40();
  146. }
  147. return result;
  148. }
  149.  
  150. //----- (00507A30) --------------------------------------------------------
  151. signed int __cdecl sub_507A30(int a1, int a2)
  152. {
  153. unsigned int v2; // eax@2
  154.  
  155. if ( a1 )
  156. v2 = GetChannelById(a1);
  157. else
  158. v2 = GetChannelByName(a2);
  159. if ( v2 )
  160. {
  161. *(_DWORD *)v2 = 0;
  162. *(_BYTE *)(v2 + 4) = 0;
  163. *(_DWORD *)(v2 + 148) = 0;
  164. *(_DWORD *)(v2 + 156) = 1;
  165. *(_DWORD *)(v2 + 160) = 1;
  166. }
  167. return sub_505D40();
  168. }
  169.  
  170. //----- (00507A80) --------------------------------------------------------
  171. char __cdecl sub_507A80(char *src, char *a2, unsigned int a3, char a4, int *a5, int *a6, char a7, int a8, int a9, unsigned int a10)
  172. {
  173. int v10; // edi@1
  174. int v11; // ebx@1
  175. int *v12; // esi@9
  176. unsigned int v13; // eax@14
  177. int v14; // ecx@15
  178. void *v15; // eax@23
  179. unsigned int v17; // eax@31
  180. int *v18; // eax@38
  181. int a1; // [sp+Ch] [bp-124h]@1
  182. void *v20; // [sp+10Ch] [bp-24h]@1
  183. int v21; // [sp+110h] [bp-20h]@3
  184. int v22; // [sp+114h] [bp-1Ch]@35
  185. int v23; // [sp+118h] [bp-18h]@35
  186. int v24; // [sp+11Ch] [bp-14h]@35
  187. int v25; // [sp+120h] [bp-10h]@35
  188. int v26; // [sp+124h] [bp-Ch]@35
  189. int v27; // [sp+128h] [bp-8h]@35
  190. unsigned int v28; // [sp+12Ch] [bp-4h]@6
  191.  
  192. v10 = 0;
  193. *a5 = 0;
  194. *a6 = 0;
  195. SStrCopy((char *)&a1, src, 256);
  196. v11 = g_ChatChannelsDB.numRows;
  197. v20 = dword_BD0780;
  198. if ( dword_BD080C < g_AreaTableDB.minIndex || dword_BD080C > g_AreaTableDB.maxIndex )
  199. v21 = 0;
  200. else
  201. v21 = g_AreaTableDB.Rows[dword_BD080C - g_AreaTableDB.minIndex];
  202. if ( g_ChatChannelsDB.numRows > 0u )
  203. {
  204. v28 = 0;
  205. while ( 1 )
  206. {
  207. v12 = v10 < 0 || v10 >= g_ChatChannelsDB.numRows ? 0 : &g_ChatChannelsDB.FirstRow[v28 / 4];
  208. if ( !SStrCmpUTF8I(v12[4], (int)src, 0x7FFFFFFF) )
  209. break;
  210. v28 += 20;
  211. ++v10;
  212. if ( v10 >= (unsigned int)v11 )
  213. goto LABEL_13;
  214. }
  215. if ( v21 && *((_BYTE *)v12 + 4) & 0x20 && *(_DWORD *)(v21 + 16) & 0x100 && dword_B74464[0] )
  216. v15 = *(void **)(dword_B74464[0] + 44);
  217. else
  218. v15 = v20;
  219. if ( !v15 || !*(_BYTE *)v15 )
  220. return 0;
  221. *a5 = v12[4];
  222. *a6 = *v12;
  223. SStrPrintf((char *)&a1, 256, (char *)v12[3], v15);
  224. a2 = &byte_9E14FF;
  225. if ( a4 && v12[1] & 0x20000 )
  226. sub_508260(0, 1);
  227. }
  228. LABEL_13:
  229. if ( *a6 )
  230. {
  231. v13 = 0;
  232. if ( !dword_BCF090 )
  233. goto LABEL_34;
  234. v14 = dword_BCF094 + 148;
  235. while ( *(_DWORD *)v14 != *a6 )
  236. {
  237. ++v13;
  238. v14 += 168;
  239. if ( v13 >= dword_BCF090 )
  240. goto LABEL_34;
  241. }
  242. v17 = dword_BCF094 + 168 * v13;
  243. }
  244. else
  245. {
  246. v17 = GetChannelByName((int)&a1);
  247. }
  248. if ( !v17 )
  249. {
  250. LABEL_34:
  251. if ( sub_5076B0((char *)&a1, *a6, a7, a8 != 0, a9 != 0, a10) )
  252. {
  253. v22 = (int)off_9E0E24;
  254. v23 = 0;
  255. v24 = 0;
  256. v25 = 0;
  257. v26 = 0;
  258. v27 = -1;
  259. CDataStore::PutInt32((CDataStore *)&v22, 151);
  260. CDataStore::PutInt32((CDataStore *)&v22, *a6);
  261. CDataStore::PutInt8((CDataStore *)&v22, a7);
  262. CDataStore::PutInt8((CDataStore *)&v22, a8);
  263. CDataStore::PutCString((CDataStore *)&v22, (char *)&a1);
  264. CDataStore::PutCString((CDataStore *)&v22, a2);
  265. v27 = 0;
  266. ClientServices::SendPacket_1((CDataStore *)&v22);
  267. v22 = (int)off_9E0E24;
  268. if ( v25 != -1 )
  269. CDataStore::InternalDestroy((void **)&v23, (int)&v24, (int)&v25);
  270. goto LABEL_37;
  271. }
  272. return 0;
  273. }
  274. LABEL_37:
  275. if ( a3 < 0xA )
  276. {
  277. v18 = (int *)*a5;
  278. if ( !*a5 )
  279. v18 = &a1;
  280. sub_501A70((int)&byte_BCF0B0[256 * a3], (int)v18, *a6);
  281. dword_BCEFE0 = 1;
  282. }
  283. return 1;
  284. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement