Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- باكت هندلر ابحث عن الباكت دا بتاع الارينا العادية و بدله
- 2211
- case PacketID.ArenaWatch:
- {
- if (client.Entity.MapID == 8881 || client.Entity.MapID == 8880 || client.Entity.MapID == 1858)
- return;
- if (client.Entity.MapID == 601 || client.Entity.MapID == 3846) return;
- if (client.Map.BaseID >= 6000 && client.Map.BaseID <= 6003) return;
- ushort Type = BitConverter.ToUInt16(packet, 4);
- ushort SubType = BitConverter.ToUInt16(packet, 6);
- uint Fighter = BitConverter.ToUInt32(packet, 10);
- Console.WriteLine(Fighter);
- if (Type == 0)
- {
- {
- if (Kernel.GamePool.ContainsKey(Fighter))
- {
- Client.GameState Client = Kernel.GamePool[Fighter];
- if (Client.Team != null)
- {
- if (Client.Team.TeamMatch != null)
- {
- if (Client.Team.TeamMatch.OnGoing)
- {
- Client.Team.TeamMatch.BeginWatch(client);
- }
- }
- else if (Client.Team.SkillMatch != null)
- {
- if (Client.Team.SkillMatch.OnGoing)
- {
- Client.Team.SkillMatch.BeginWatch(client);
- }
- }
- }
- else if (Client.ElitePKMatch != null)
- {
- if (Client.ElitePKMatch.OnGoing)
- {
- Client.ElitePKMatch.BeginWatch(client);
- }
- }
- else if (Client.InQualifier())
- {
- if (Client.QualifierGroup != null)
- {
- if (!Client.QualifierGroup.Done)
- {
- Client.QualifierGroup.BeginWatching(client);
- }
- }
- else if (Client.TeamQualifierGroup != null)
- {
- if (!Client.TeamQualifierGroup.Done)
- {
- Client.TeamQualifierGroup.BeginWatching(client);
- }
- }
- }
- }
- else if (MaTrix.AI.Ais.ContainsKey(Fighter))
- {
- Console.WriteLine("Contaied");
- Client.GameState Client = MaTrix.AI.Ais[Fighter].Bot;
- if (Client == null)
- return;
- if (Client.Team != null)
- {
- if (Client.Team.TeamMatch != null)
- {
- if (Client.Team.TeamMatch.OnGoing)
- {
- Client.Team.TeamMatch.BeginWatch(client);
- }
- }
- if (Client.Team.SkillMatch != null)
- {
- if (Client.Team.SkillMatch.OnGoing)
- {
- Client.Team.SkillMatch.BeginWatch(client);
- }
- }
- }
- else if (Client.ElitePKMatch != null)
- {
- if (Client.ElitePKMatch.OnGoing)
- {
- Client.ElitePKMatch.BeginWatch(client);
- }
- }
- else if (Client.TeamQualifierGroup != null)
- {
- if (!Client.TeamQualifierGroup.Done)
- {
- Client.TeamQualifierGroup.BeginWatching(client);
- }
- }
- }
- }
- }
- else if (Type == 1)
- {
- if (client.Entity.TeamWatchingMatch != null)
- client.Entity.TeamWatchingMatch.LeaveWatch(client);
- else if (client.Entity.SkillWatchingMatch != null)
- client.Entity.SkillWatchingMatch.LeaveWatch(client);
- else if (client.WatchingElitePKMatch != null)
- client.WatchingElitePKMatch.LeaveWatch(client);
- else if (client.WatchingGroup != null)
- Game.Qualifier.QualifyEngine.DoLeave(client);
- else
- if (client.TeamWatchingGroup != null)
- Game.TeamQualifier.QualifyEngine.DoLeave(client);
- }
- else if (Type == 4)
- {
- uint fighter = BitConverter.ToUInt32(packet, 10);
- if (client.Entity.TeamWatchingMatch != null)
- client.Entity.TeamWatchingMatch.Cheer(client, fighter);
- else if (client.Entity.SkillWatchingMatch != null)
- client.Entity.SkillWatchingMatch.Cheer(client, fighter);
- else if (client.WatchingElitePKMatch != null)
- client.WatchingElitePKMatch.Cheer(client, fighter);
- else if (client.WatchingGroup != null)
- Game.Qualifier.QualifyEngine.DoCheer(client, fighter);
- else
- if (client.TeamWatchingGroup != null)
- Game.TeamQualifier.QualifyEngine.DoCheer(client, fighter);
- }
- break;
- }
- __________________________________
- #region Team Tournament & Skill Elite Pk
- case 2232:
- {
- client.Send(packet);
- TeamPkBrackets brackets = new TeamPkBrackets(0);
- brackets.Deserialize(packet);
- if (brackets.Type == TeamPkBrackets.RequestInformation || brackets.Type == TeamPkBrackets.UpdateList || brackets.Type == TeamPkBrackets.InitialList)
- {
- TeamPk.TeamTournament.Tournaments[brackets.Group].Update(client, brackets.Page);
- }
- break;
- }
- case 2233:
- {
- client.Send(packet);
- Game.Features.Tournaments.TeamPk.TeamTournament.Tournaments[packet[8]].Rankings(client);
- break;
- }
- case 2260:
- {
- string TeamName = GeneralData.ReadString(packet, 12, 32);// packet.ReadString(12, 32);
- byte Mode = packet[4];
- if (client.Team != null)
- {
- if (client.Team.TeamFighterStats != null)
- {
- client.Team.TeamFighterStats.Name = TeamName;
- client.Send(packet);
- }
- }
- break;
- }
- case 2240:
- {
- string TeamName = GeneralData.ReadString(packet, 12, 32);// packet.ReadString(12, 32);
- byte Mode = packet[4];
- if (client.Team != null)
- {
- if (client.Team.SkillFighterStats != null)
- {
- client.Team.SkillFighterStats.Name = TeamName;
- client.Send(packet);
- }
- }
- break;
- }
- case 2252:
- {
- client.Send(packet);
- SkillPkBrackets brackets = new SkillPkBrackets(0);
- brackets.Deserialize(packet);
- if (brackets.Type == SkillPkBrackets.RequestInformation || brackets.Type == SkillPkBrackets.UpdateList || brackets.Type == SkillPkBrackets.InitialList)
- {
- SkillPk.SkillTournament.Tournaments[brackets.Group].Update(client, brackets.Page);
- }
- break;
- }
- case 2253:
- {
- client.Send(packet);
- Game.Features.Tournaments.SkillPk.SkillTournament.Tournaments[packet[8]].Rankings(client);
- break;
- }
- #endregion
- #region ElitePk Tournament
- case 2223:
- {
- client.Send(packet);
- ElitePKRanking ranks = new ElitePKRanking(false);
- ranks.Deserialize(packet);
- ElitePKTournament.Tournaments[ranks.Group].Rankings(client);
- break;
- }
- case 2219:
- {
- ElitePKBrackets brackets = new ElitePKBrackets(false);
- brackets.Deserialize(packet);
- if (brackets.Type == ElitePKBrackets.RequestInformation)
- {
- if (!ElitePKTournament.Tournaments[brackets.Group].Organization && ElitePKTournament.Tournaments[brackets.Group].EliteStarted)
- {
- brackets.GUIType = (ushort)ElitePKTournament.Tournaments[brackets.Group].State;
- brackets.TimeLeft = 1;
- client.Send(brackets);
- }
- else if (ElitePKTournament.Tournaments[brackets.Group].Organization && !ElitePKTournament.Tournaments[brackets.Group].EliteStarted)
- {
- client.Send(brackets);
- }
- else if (!ElitePKTournament.Tournaments[brackets.Group].EliteStarted && !ElitePKTournament.Tournaments[brackets.Group].Organization)
- {
- brackets.TimeLeft = 0;
- client.Send(brackets);
- }
- }
- if (brackets.Type == ElitePKBrackets.InitialList)
- {
- if (ElitePKTournament.Tournaments[brackets.Group].EliteStarted || ElitePKTournament.Tournaments[brackets.Group].Organization)
- {
- brackets.GUIType = (ushort)ElitePKTournament.Tournaments[brackets.Group].State;
- brackets.TimeLeft = 1;
- client.Send(brackets);
- ElitePKTournament.Tournaments[brackets.Group].FireArena(true);
- ElitePKTournament.Tournaments[brackets.Group].Update(client, brackets.Page, brackets);
- }
- }
- break;
- }
- case 2239:
- {
- //PrintPacket(packet);
- var tourment = ElitePKTournament.Tournaments[packet[6]];
- Kernel.SendWorldMessage(tourment.CreateBrackets(tourment.MatchArray, 0, packet[4]));
- break;
- }
- case 1064:
- {
- ElitePKWager wager = new ElitePKWager();
- wager.Deserialize(packet);
- GameState pClient = null;
- if (!Kernel.GamePool.TryGetValue(wager.WagedUID, out pClient))
- {
- return;
- }
- if (pClient != null)
- {
- if (pClient.ElitePKMatch != null)
- {
- if (pClient.ElitePKMatch.Flag == ElitePK.Match.StatusFlag.AcceptingWagers)
- {
- if (client.Entity.Money >= wager.Wager * 100000)
- {
- client.Entity.Money -= wager.Wager * 100000;
- if (!pClient.ElitePKStats.Wagers.ContainsKey(client.Entity.UID))
- pClient.ElitePKStats.Wagers[client.Entity.UID] = wager.Wager;
- else
- pClient.ElitePKStats.Wagers[client.Entity.UID] += wager.Wager;
- pClient.ElitePKStats.Wager += wager.Wager;
- pClient.ElitePKMatch.TotalWagers += wager.Wager;
- var epk = ElitePKTournament.Tournaments[pClient.ElitePKMatch.GroupID];
- epk.Update(client, 0, null, true);
- }
- }
- }
- }
- break;
- }
- case 1065:
- {
- ElitePKWagersList wager = new ElitePKWagersList(false);
- wager.Deserialize(packet);
- var epk = ElitePKTournament.Tournaments[wager.Group];
- int count = epk.Matches.Values.Count(p => p.TotalWagers != 0);
- wager = new ElitePKWagersList(true, count);
- wager.TotalMatches = (uint)count;
- int i = 0;
- foreach (var match in epk.Matches.Values)
- if (match.TotalWagers != 0)
- wager.Append(match, i++);
- client.Send(wager);
- break;
- }
- case 1130:
- {
- MsgTitle.Handler(client, packet);
- break;
- }
- #endregion
- ____________________________
- جيم ستاتس
- public uint ClaimedElitePk
- {
- get { return this["ClaimedElitePk"]; }
- set { this["ClaimedElitePk"] = value; }
- }
- public uint ClaimedTeampk
- {
- get { return this["ClaimedTeampk"]; }
- set { this["ClaimedTeampk"] = value; }
- }
- public uint ClaimedSkillTeam
- {
- get { return this["ClaimedSkillTeam"]; }
- set { this["ClaimedSkillTeam"] = value; }
- }
- public unsafe void Send(ServerSockets.Packet packet)
- {
- Send(packet.Memory);
- }
- private object synroot = new object();
- public unsafe void Send(byte* buffer)
- {
- lock (synroot)
- {
- int Size = *(ushort*)(buffer + 0);
- byte[] packet = new byte[Size + 8];
- fixed (byte* dst = packet)
- {
- memcpy(dst, buffer, Size);
- Send(packet);
- }
- }
- }
- public unsafe void memcpy(void* dest, void* src, Int32 size)
- {
- Int32 count = size / sizeof(long);
- for (Int32 i = 0; i < count; i++)
- *(((long*)dest) + i) = *(((long*)src) + i);
- Int32 pos = size - (size % sizeof(long));
- for (Int32 i = 0; i < size % sizeof(long); i++)
- *(((Byte*)dest) + pos + i) = *(((Byte*)src) + pos + i);
- }
- public bool InTeamPK = false;
- public void RemoveFromTeamPK()
- {
- if (Team.TeamLeader)
- Game.Features.Tournaments.TeamPk.TeamTournament.Tournaments[3].Teams.Remove(Team.UID);
- else Team.Remove(this, false);
- }
- public bool InSkillPK = false;
- public Lobby.MatchType MatchType;
- public Game.Features.Tournaments.SkillPk.Match Match;
- public void RemoveFromSkillPK()
- {
- if (Team.TeamLeader)
- Game.Features.Tournaments.SkillPk.SkillTournament.Tournaments[3].Teams.Remove(Team.UID);
- else Team.Remove(this, false);
- }
- public byte GetEliteGroup()
- {
- var p = Entity.Level;
- if (p <= 99)
- return 0;
- if (p >= 100 && p <= 119)
- return 1;
- if (p >= 120 && p <= 130)
- return 2;
- return 3;
- }
- public bool InElitePK()
- {
- if (ElitePKMatch != null)
- {
- var tournment = ElitePKTournament.Tournaments[ElitePKMatch.GroupID];
- if (tournment.Players.ContainsKey(Entity.UID))
- {
- if (Entity.MapID == tournment.WaitingArea.ID)
- return true;
- if (Entity.MapID == ElitePKMatch.Map.ID)
- return true;
- }
- return false;
- }
- else
- {
- var tournment = ElitePKTournament.Tournaments[GetEliteGroup()];
- if (Entity.MapID == tournment.WaitingArea.ID)
- return true;
- }
- return false;
- }
- _____________________________________
- انتيتي
- public Game.Features.Tournaments.TeamPk.Match TeamWatchingMatch;
- public Game.Features.Tournaments.SkillPk.Match SkillWatchingMatch;
- public bool InSkillPk = false;
- public bool WasSend = false;
- public void Teleport()
- {
- Owner.InTeamPK = false;
- Owner.InSkillPK = false;
- Teleport(1002, 257, 253);
- }
- public byte WatchingArena
- {
- set
- {
- SpawnPacket[207] = (byte)(Owner.IsWatching() ? 1 : 0);
- }
- }
- public List<byte> Titlesx = new List<byte>();
- public unsafe byte MyTitlex;
- public unsafe void AddTitle(byte _title, bool aSwitch)
- {
- if (!Titlesx.Contains(_title))
- {
- Titlesx.Add(_title);
- using (var rec = new ServerSockets.RecycledPacket())
- {
- var stream = rec.GetStream();
- Owner.Send(stream.TitleCreate(UID, _title, MsgTitle.QueueTitle.Enqueue));
- }
- if (aSwitch)
- SwitchTitle(_title);
- }
- }
- public unsafe void SwitchTitle(byte ntitle)
- {
- if (Titlesx.Contains(ntitle) || ntitle == 0)
- {
- MyTitlex = ntitle;
- using (var rec = new ServerSockets.RecycledPacket())
- {
- var stream = rec.GetStream();
- Owner.Send(stream.TitleCreate(UID, ntitle, MsgTitle.QueueTitle.Change));
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement