Advertisement
Guest User

Untitled

a guest
May 23rd, 2018
78
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 21.31 KB | None | 0 0
  1. باكت هندلر ابحث عن الباكت دا بتاع الارينا العادية و بدله
  2. 2211
  3. case PacketID.ArenaWatch:
  4. {
  5. if (client.Entity.MapID == 8881 || client.Entity.MapID == 8880 || client.Entity.MapID == 1858)
  6. return;
  7. if (client.Entity.MapID == 601 || client.Entity.MapID == 3846) return;
  8. if (client.Map.BaseID >= 6000 && client.Map.BaseID <= 6003) return;
  9. ushort Type = BitConverter.ToUInt16(packet, 4);
  10. ushort SubType = BitConverter.ToUInt16(packet, 6);
  11. uint Fighter = BitConverter.ToUInt32(packet, 10);
  12. Console.WriteLine(Fighter);
  13. if (Type == 0)
  14. {
  15. {
  16. if (Kernel.GamePool.ContainsKey(Fighter))
  17. {
  18. Client.GameState Client = Kernel.GamePool[Fighter];
  19. if (Client.Team != null)
  20. {
  21. if (Client.Team.TeamMatch != null)
  22. {
  23. if (Client.Team.TeamMatch.OnGoing)
  24. {
  25. Client.Team.TeamMatch.BeginWatch(client);
  26. }
  27. }
  28. else if (Client.Team.SkillMatch != null)
  29. {
  30. if (Client.Team.SkillMatch.OnGoing)
  31. {
  32. Client.Team.SkillMatch.BeginWatch(client);
  33. }
  34. }
  35. }
  36. else if (Client.ElitePKMatch != null)
  37. {
  38. if (Client.ElitePKMatch.OnGoing)
  39. {
  40. Client.ElitePKMatch.BeginWatch(client);
  41. }
  42. }
  43. else if (Client.InQualifier())
  44. {
  45. if (Client.QualifierGroup != null)
  46. {
  47. if (!Client.QualifierGroup.Done)
  48. {
  49. Client.QualifierGroup.BeginWatching(client);
  50. }
  51. }
  52. else if (Client.TeamQualifierGroup != null)
  53. {
  54. if (!Client.TeamQualifierGroup.Done)
  55. {
  56. Client.TeamQualifierGroup.BeginWatching(client);
  57. }
  58. }
  59. }
  60. }
  61. else if (MaTrix.AI.Ais.ContainsKey(Fighter))
  62. {
  63. Console.WriteLine("Contaied");
  64. Client.GameState Client = MaTrix.AI.Ais[Fighter].Bot;
  65. if (Client == null)
  66. return;
  67. if (Client.Team != null)
  68. {
  69. if (Client.Team.TeamMatch != null)
  70. {
  71. if (Client.Team.TeamMatch.OnGoing)
  72. {
  73. Client.Team.TeamMatch.BeginWatch(client);
  74. }
  75. }
  76. if (Client.Team.SkillMatch != null)
  77. {
  78. if (Client.Team.SkillMatch.OnGoing)
  79. {
  80. Client.Team.SkillMatch.BeginWatch(client);
  81. }
  82. }
  83. }
  84. else if (Client.ElitePKMatch != null)
  85. {
  86. if (Client.ElitePKMatch.OnGoing)
  87. {
  88. Client.ElitePKMatch.BeginWatch(client);
  89. }
  90. }
  91. else if (Client.TeamQualifierGroup != null)
  92. {
  93. if (!Client.TeamQualifierGroup.Done)
  94. {
  95. Client.TeamQualifierGroup.BeginWatching(client);
  96. }
  97. }
  98. }
  99. }
  100. }
  101. else if (Type == 1)
  102. {
  103. if (client.Entity.TeamWatchingMatch != null)
  104. client.Entity.TeamWatchingMatch.LeaveWatch(client);
  105. else if (client.Entity.SkillWatchingMatch != null)
  106. client.Entity.SkillWatchingMatch.LeaveWatch(client);
  107. else if (client.WatchingElitePKMatch != null)
  108. client.WatchingElitePKMatch.LeaveWatch(client);
  109. else if (client.WatchingGroup != null)
  110. Game.Qualifier.QualifyEngine.DoLeave(client);
  111. else
  112. if (client.TeamWatchingGroup != null)
  113. Game.TeamQualifier.QualifyEngine.DoLeave(client);
  114. }
  115. else if (Type == 4)
  116. {
  117. uint fighter = BitConverter.ToUInt32(packet, 10);
  118. if (client.Entity.TeamWatchingMatch != null)
  119. client.Entity.TeamWatchingMatch.Cheer(client, fighter);
  120. else if (client.Entity.SkillWatchingMatch != null)
  121. client.Entity.SkillWatchingMatch.Cheer(client, fighter);
  122. else if (client.WatchingElitePKMatch != null)
  123. client.WatchingElitePKMatch.Cheer(client, fighter);
  124. else if (client.WatchingGroup != null)
  125. Game.Qualifier.QualifyEngine.DoCheer(client, fighter);
  126. else
  127. if (client.TeamWatchingGroup != null)
  128. Game.TeamQualifier.QualifyEngine.DoCheer(client, fighter);
  129. }
  130. break;
  131. }
  132. __________________________________
  133. #region Team Tournament & Skill Elite Pk
  134. case 2232:
  135. {
  136. client.Send(packet);
  137. TeamPkBrackets brackets = new TeamPkBrackets(0);
  138. brackets.Deserialize(packet);
  139. if (brackets.Type == TeamPkBrackets.RequestInformation || brackets.Type == TeamPkBrackets.UpdateList || brackets.Type == TeamPkBrackets.InitialList)
  140. {
  141. TeamPk.TeamTournament.Tournaments[brackets.Group].Update(client, brackets.Page);
  142. }
  143. break;
  144. }
  145. case 2233:
  146. {
  147. client.Send(packet);
  148. Game.Features.Tournaments.TeamPk.TeamTournament.Tournaments[packet[8]].Rankings(client);
  149. break;
  150. }
  151. case 2260:
  152. {
  153. string TeamName = GeneralData.ReadString(packet, 12, 32);// packet.ReadString(12, 32);
  154. byte Mode = packet[4];
  155. if (client.Team != null)
  156. {
  157. if (client.Team.TeamFighterStats != null)
  158. {
  159. client.Team.TeamFighterStats.Name = TeamName;
  160.  
  161. client.Send(packet);
  162. }
  163.  
  164. }
  165. break;
  166. }
  167. case 2240:
  168. {
  169. string TeamName = GeneralData.ReadString(packet, 12, 32);// packet.ReadString(12, 32);
  170. byte Mode = packet[4];
  171. if (client.Team != null)
  172. {
  173. if (client.Team.SkillFighterStats != null)
  174. {
  175. client.Team.SkillFighterStats.Name = TeamName;
  176.  
  177. client.Send(packet);
  178. }
  179.  
  180. }
  181. break;
  182. }
  183. case 2252:
  184. {
  185. client.Send(packet);
  186. SkillPkBrackets brackets = new SkillPkBrackets(0);
  187. brackets.Deserialize(packet);
  188. if (brackets.Type == SkillPkBrackets.RequestInformation || brackets.Type == SkillPkBrackets.UpdateList || brackets.Type == SkillPkBrackets.InitialList)
  189. {
  190. SkillPk.SkillTournament.Tournaments[brackets.Group].Update(client, brackets.Page);
  191. }
  192. break;
  193. }
  194. case 2253:
  195. {
  196. client.Send(packet);
  197. Game.Features.Tournaments.SkillPk.SkillTournament.Tournaments[packet[8]].Rankings(client);
  198. break;
  199. }
  200. #endregion
  201. #region ElitePk Tournament
  202. case 2223:
  203. {
  204. client.Send(packet);
  205. ElitePKRanking ranks = new ElitePKRanking(false);
  206. ranks.Deserialize(packet);
  207. ElitePKTournament.Tournaments[ranks.Group].Rankings(client);
  208. break;
  209. }
  210. case 2219:
  211. {
  212. ElitePKBrackets brackets = new ElitePKBrackets(false);
  213. brackets.Deserialize(packet);
  214. if (brackets.Type == ElitePKBrackets.RequestInformation)
  215. {
  216. if (!ElitePKTournament.Tournaments[brackets.Group].Organization && ElitePKTournament.Tournaments[brackets.Group].EliteStarted)
  217. {
  218. brackets.GUIType = (ushort)ElitePKTournament.Tournaments[brackets.Group].State;
  219. brackets.TimeLeft = 1;
  220. client.Send(brackets);
  221. }
  222. else if (ElitePKTournament.Tournaments[brackets.Group].Organization && !ElitePKTournament.Tournaments[brackets.Group].EliteStarted)
  223. {
  224. client.Send(brackets);
  225. }
  226. else if (!ElitePKTournament.Tournaments[brackets.Group].EliteStarted && !ElitePKTournament.Tournaments[brackets.Group].Organization)
  227. {
  228. brackets.TimeLeft = 0;
  229. client.Send(brackets);
  230. }
  231. }
  232. if (brackets.Type == ElitePKBrackets.InitialList)
  233. {
  234. if (ElitePKTournament.Tournaments[brackets.Group].EliteStarted || ElitePKTournament.Tournaments[brackets.Group].Organization)
  235. {
  236. brackets.GUIType = (ushort)ElitePKTournament.Tournaments[brackets.Group].State;
  237. brackets.TimeLeft = 1;
  238. client.Send(brackets);
  239. ElitePKTournament.Tournaments[brackets.Group].FireArena(true);
  240. ElitePKTournament.Tournaments[brackets.Group].Update(client, brackets.Page, brackets);
  241. }
  242. }
  243. break;
  244. }
  245. case 2239:
  246. {
  247. //PrintPacket(packet);
  248. var tourment = ElitePKTournament.Tournaments[packet[6]];
  249. Kernel.SendWorldMessage(tourment.CreateBrackets(tourment.MatchArray, 0, packet[4]));
  250. break;
  251. }
  252. case 1064:
  253. {
  254. ElitePKWager wager = new ElitePKWager();
  255. wager.Deserialize(packet);
  256. GameState pClient = null;
  257. if (!Kernel.GamePool.TryGetValue(wager.WagedUID, out pClient))
  258. {
  259. return;
  260. }
  261. if (pClient != null)
  262. {
  263. if (pClient.ElitePKMatch != null)
  264. {
  265. if (pClient.ElitePKMatch.Flag == ElitePK.Match.StatusFlag.AcceptingWagers)
  266. {
  267. if (client.Entity.Money >= wager.Wager * 100000)
  268. {
  269. client.Entity.Money -= wager.Wager * 100000;
  270. if (!pClient.ElitePKStats.Wagers.ContainsKey(client.Entity.UID))
  271. pClient.ElitePKStats.Wagers[client.Entity.UID] = wager.Wager;
  272. else
  273. pClient.ElitePKStats.Wagers[client.Entity.UID] += wager.Wager;
  274. pClient.ElitePKStats.Wager += wager.Wager;
  275. pClient.ElitePKMatch.TotalWagers += wager.Wager;
  276. var epk = ElitePKTournament.Tournaments[pClient.ElitePKMatch.GroupID];
  277. epk.Update(client, 0, null, true);
  278. }
  279. }
  280. }
  281. }
  282. break;
  283. }
  284. case 1065:
  285. {
  286. ElitePKWagersList wager = new ElitePKWagersList(false);
  287. wager.Deserialize(packet);
  288. var epk = ElitePKTournament.Tournaments[wager.Group];
  289. int count = epk.Matches.Values.Count(p => p.TotalWagers != 0);
  290. wager = new ElitePKWagersList(true, count);
  291. wager.TotalMatches = (uint)count;
  292. int i = 0;
  293. foreach (var match in epk.Matches.Values)
  294. if (match.TotalWagers != 0)
  295. wager.Append(match, i++);
  296. client.Send(wager);
  297. break;
  298. }
  299. case 1130:
  300. {
  301. MsgTitle.Handler(client, packet);
  302. break;
  303. }
  304. #endregion
  305. ____________________________
  306. جيم ستاتس
  307. public uint ClaimedElitePk
  308. {
  309. get { return this["ClaimedElitePk"]; }
  310. set { this["ClaimedElitePk"] = value; }
  311. }
  312. public uint ClaimedTeampk
  313. {
  314. get { return this["ClaimedTeampk"]; }
  315. set { this["ClaimedTeampk"] = value; }
  316. }
  317. public uint ClaimedSkillTeam
  318. {
  319. get { return this["ClaimedSkillTeam"]; }
  320. set { this["ClaimedSkillTeam"] = value; }
  321. }
  322. public unsafe void Send(ServerSockets.Packet packet)
  323. {
  324. Send(packet.Memory);
  325. }
  326. private object synroot = new object();
  327. public unsafe void Send(byte* buffer)
  328. {
  329. lock (synroot)
  330. {
  331. int Size = *(ushort*)(buffer + 0);
  332. byte[] packet = new byte[Size + 8];
  333.  
  334. fixed (byte* dst = packet)
  335. {
  336. memcpy(dst, buffer, Size);
  337. Send(packet);
  338. }
  339. }
  340. }
  341. public unsafe void memcpy(void* dest, void* src, Int32 size)
  342. {
  343. Int32 count = size / sizeof(long);
  344. for (Int32 i = 0; i < count; i++)
  345. *(((long*)dest) + i) = *(((long*)src) + i);
  346.  
  347. Int32 pos = size - (size % sizeof(long));
  348. for (Int32 i = 0; i < size % sizeof(long); i++)
  349. *(((Byte*)dest) + pos + i) = *(((Byte*)src) + pos + i);
  350. }
  351. public bool InTeamPK = false;
  352. public void RemoveFromTeamPK()
  353. {
  354. if (Team.TeamLeader)
  355. Game.Features.Tournaments.TeamPk.TeamTournament.Tournaments[3].Teams.Remove(Team.UID);
  356. else Team.Remove(this, false);
  357. }
  358. public bool InSkillPK = false;
  359. public Lobby.MatchType MatchType;
  360. public Game.Features.Tournaments.SkillPk.Match Match;
  361. public void RemoveFromSkillPK()
  362. {
  363. if (Team.TeamLeader)
  364. Game.Features.Tournaments.SkillPk.SkillTournament.Tournaments[3].Teams.Remove(Team.UID);
  365. else Team.Remove(this, false);
  366. }
  367. public byte GetEliteGroup()
  368. {
  369. var p = Entity.Level;
  370. if (p <= 99)
  371. return 0;
  372. if (p >= 100 && p <= 119)
  373. return 1;
  374. if (p >= 120 && p <= 130)
  375. return 2;
  376. return 3;
  377. }
  378. public bool InElitePK()
  379. {
  380. if (ElitePKMatch != null)
  381. {
  382. var tournment = ElitePKTournament.Tournaments[ElitePKMatch.GroupID];
  383. if (tournment.Players.ContainsKey(Entity.UID))
  384. {
  385. if (Entity.MapID == tournment.WaitingArea.ID)
  386. return true;
  387. if (Entity.MapID == ElitePKMatch.Map.ID)
  388. return true;
  389. }
  390. return false;
  391. }
  392. else
  393. {
  394. var tournment = ElitePKTournament.Tournaments[GetEliteGroup()];
  395. if (Entity.MapID == tournment.WaitingArea.ID)
  396. return true;
  397. }
  398. return false;
  399. }
  400. _____________________________________
  401. انتيتي
  402. public Game.Features.Tournaments.TeamPk.Match TeamWatchingMatch;
  403. public Game.Features.Tournaments.SkillPk.Match SkillWatchingMatch;
  404. public bool InSkillPk = false;
  405. public bool WasSend = false;
  406. public void Teleport()
  407. {
  408. Owner.InTeamPK = false;
  409. Owner.InSkillPK = false;
  410. Teleport(1002, 257, 253);
  411. }
  412. public byte WatchingArena
  413. {
  414. set
  415. {
  416. SpawnPacket[207] = (byte)(Owner.IsWatching() ? 1 : 0);
  417. }
  418. }
  419. public List<byte> Titlesx = new List<byte>();
  420. public unsafe byte MyTitlex;
  421. public unsafe void AddTitle(byte _title, bool aSwitch)
  422. {
  423. if (!Titlesx.Contains(_title))
  424. {
  425. Titlesx.Add(_title);
  426. using (var rec = new ServerSockets.RecycledPacket())
  427. {
  428. var stream = rec.GetStream();
  429.  
  430. Owner.Send(stream.TitleCreate(UID, _title, MsgTitle.QueueTitle.Enqueue));
  431. }
  432.  
  433. if (aSwitch)
  434. SwitchTitle(_title);
  435. }
  436. }
  437. public unsafe void SwitchTitle(byte ntitle)
  438. {
  439. if (Titlesx.Contains(ntitle) || ntitle == 0)
  440. {
  441. MyTitlex = ntitle;
  442. using (var rec = new ServerSockets.RecycledPacket())
  443. {
  444. var stream = rec.GetStream();
  445.  
  446. Owner.Send(stream.TitleCreate(UID, ntitle, MsgTitle.QueueTitle.Change));
  447. }
  448. }
  449. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement