منتدي اكواد

منتدي اكواد (https://code.vpscairo.com/index.php)
-   مشكلات السيرفيرات كونكر الشخصيه (https://code.vpscairo.com/forumdisplay.php?f=12)
-   -   مشكله في الاليت بيكي (https://code.vpscairo.com/showthread.php?t=2684)

سمير 2019-10-26 10:51 AM

مشكله في الاليت بيكي
 
دلوقتي الاليت بيكي بيشتغل وكل حاجه اجي ادخل اهوه كلو بيجهز ويكون فيها 15 واحد اول ما الدقيقه تيجي بالظبط بيطرد كلو بره ممكن حل

Rider 2019-10-26 03:57 PM

رد: مشكله في الاليت بيكي
 
جرب @start elitepk

او شوف شفره ايه ف سرفرك + سستم اليت بيكيه مش كامل عندك

سمير 2019-10-26 05:48 PM

رد: مشكله في الاليت بيكي
 
اعتقد مشكله اللي مش كامله مشكله البوتات اللي بتنزل لو محدش نزلك

Rider 2019-10-26 08:24 PM

رد: مشكله في الاليت بيكي
 
معتقدش ان بوتات متضافه ف سورس الي معاك

سمير 2019-10-31 12:03 AM

رد: مشكله في الاليت بيكي
 
اقتباس:

المشاركة الأصلية كتبت بواسطة rider (المشاركة 19662)
معتقدش ان بوتات متضافه ف سورس الي معاك

طب اجيب اضافه البوتات منين

Hassan Emprator 2019-10-31 12:12 AM

رد: مشكله في الاليت بيكي
 
اقتباس:

المشاركة الأصلية كتبت بواسطة سمير (المشاركة 20099)
طب اجيب اضافه البوتات منين

ابحث عن

كود PHP:


Class Lobby 

بدل الكلاس كامل بي دا

كود PHP:

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using MrHassan.Game;
using MrHassan.Game.ConquerStructures;
using MrHassan.Client;
using System.Threading.Generic;
using MrHassan.Network.GamePackets;
using MrHassan.Database;
using System.Collections.Concurrent;
using System.IO;
using MrHassan.Interfaces;

namespace 
MrHassan.MaTrix
{
    public class 
AI
    
{
        
#region Static Actions
        
public static SafeConcurrentDictionary<uintAIAis = new SafeConcurrentDictionary<uintAI>();
        private static 
TimerRule<GameStateAIAction;
        public static 
void CreateTimerFactories()
        {
            
AIAction = new TimerRule<GameState>(AisActionCallback500);
        }
        private static 
void AisActionCallback(GameState clientint time)
        {
            try
            {
                if (!
client.Socket.Alive)
                {
                    
client.AI.DisposeTimers();
                    return;
                }
                if (
client.Entity == null)
                    return;
                if (
client.Map == null)
                    return;
                
Time32 Now Time32.Now;
                foreach (var 
ai in Ais.Values)
                {
                    if (
ai.Bot == null)
                        continue;
                    if (
ai.Bot.Entity == null)
                        continue;
                    if (
ai.Loaded)
                    {
                        if (
client.Entity.MapID == ai.Bot.Entity.MapID || ai.selectFunc != null)
                        {
                            
#region Check Target
                            
if (ai.Target == null)
                            {
                                switch (
ai.Type)
                                {
                                    case 
BotType.MyAi:
                                        {
                                            
client.AI.Dispose(client);
                                        }
                                        break;
                                    case 
BotType.AI:
                                        {
                                            foreach (var 
obj in ai.Bot.Screen.Objects)
                                            {
                                                if (
obj.MapObjType == MapObjectType.Monster || obj.MapObjType == MapObjectType.Entity)
                                                {
                                                    if (
Kernel.GetDistance(ai.Bot.Entity.Xai.Bot.Entity.Yobj.Xobj.Y) < 18)
                                                    {
                                                        var 
entity obj as Entity;
                                                        if (
entity.Dead) continue;
                                                        if (
obj.MapObjType == MapObjectType.Entity)
                                                            if (
entity.Owner.Fake)
                                                                continue;
                                                        
ai.Target entity;
                                                        if (
obj.MapObjType == MapObjectType.Entity)
                                                            
ai.Disguise(ai.Target.Owner);
                                                    }

                                                }
                                            }

                                        }
                                        break;
                                    case 
BotType.MatrixAI:
                                        {
                                            foreach (var 
obj in ai.Bot.Screen.Objects)
                                            {
                                                if (
obj.MapObjType == MapObjectType.Entity || obj.MapObjType == MapObjectType.Monster)
                                                {
                                                    var 
entity obj as Entity;
                                                    if (
entity.Dead)
                                                        continue;
                                                    if (
entity.UID == ai.Bot.Entity.UID)
                                                        continue;
                                                    if (
obj.MapObjType == MapObjectType.Entity)
                                                    {
                                                        if (
entity.MapID == ai.Bot.Entity.MapID)
                                                        
// if (Kernel.GetDistance(ai.Bot.Entity.X, ai.Bot.Entity.Y, obj.X, obj.Y) < 18)
                                                        
{
                                                            if (
ai.selectFunc(entity.Owner))
                                                            {
                                                                
ai.Target entity;
                                                                if (
ai.Disguisefun)
                                                                {
                                                                    
ai.Disguise(ai.Target.Owner);
                                                                }
                                                            }
                                                        }
                                                    }
                                                }
                                            }
                                            if (
ai.Target == null)
                                            {
                                                var 
ais_in_map GetAiinMap(ai);
                                                if (
ais_in_map != null)
                                                {
                                                    
ai.Target ais_in_map.Bot.Entity;
                                                }
                                                else
                                                {
                                                    
ai.Bot.Screen.Reload();
                                                }

                                            }
                                        }
                                        break;
                                }
                                if (
Now >= ai.LastTalk.AddSeconds(60))
                                {
                                    
ai.LastTalk Time32.Now;
                                    if (
ai.Target == null)
                                        
ai.Bot.SendScreen(new Message("Idle Mode | No Target!""ALL"ai.Bot.Entity.NameSystem.Drawing.Color.WhiteMessage.Talk), false);
                                    else
                                        
ai.Bot.SendScreen(new Message("Found Target! : " ai.Target.Name"ALL"ai.Bot.Entity.NameSystem.Drawing.Color.WhiteMessage.Talk), false);
                                }

                            }
                            
#endregion Check Target
                            
else
                            {
                                if (
ai.Type == BotType.MatrixAI)
                                {
                                    if (
ai.selectFunc != null)
                                    {
                                        if (!
ai.selectFunc(ai.Target.Owner))
                                        {
                                            
ai.Target null;
                                            return;
                                        }
                                    }
                                }
                                var 
Bot ai.Bot;
                                var 
Target ai.Target;
                                if (!
Target.Dead)
                                {
                                    
#region Death Actions
                                    
if (Bot.Entity.Dead)
                                    {
                                        
#region Die Delay

                                        
if (Bot.Entity.Hitpoints == && Bot.Entity.ContainsFlag(Network.GamePackets.Update.Flags.Dead) && !Bot.Entity.ContainsFlag(Network.GamePackets.Update.Flags.Ghost))
                                        {
                                            if (
Now Bot.Entity.DeathStamp.AddSeconds(2))
                                            {
                                                
Bot.Entity.AddFlag(Network.GamePackets.Update.Flags.Ghost);
                                                if (
Bot.Entity.Body 10 3)
                                                    
Bot.Entity.TransformationID 99;
                                                else
                                                    
Bot.Entity.TransformationID 98;

                                                
Bot.SendScreenSpawn(Bot.Entitytrue);
                                            }
                                        }
                                        
#endregion
                                        
if (Now >= Bot.Entity.DeathStamp.AddSeconds(18))
                                        {
                                            
Bot.Entity.BringToLife();
                                            
SpellUse use = new SpellUse(true)
                                            {
                                                
Attacker Bot.Entity.UID,
                                                
SpellID 0x44c,
                                                
Bot.Entity.X,
                                                
Bot.Entity.Y
                                            
};
                                            
Bot.SendScreen(use, true);
                                            
Bot.SendScreenSpawn(Bot.Entitytrue);
                                            
Bot.SendScreen(new Message("Reviving!"Target.NameBot.Entity.NameSystem.Drawing.Color.WhiteMessage.Talk), false);
                                            return;
                                        }
                                    }
                                    
#endregion
                                    
else
                                    {
                                        var 
allspells Bot.Spells.Values.ToArray();
                                        var 
rnd Kernel.Random.Next(Bot.Spells.Count);
                                        var 
spell allspells[rnd];
                                        switch (
ai.Skill)
                                        {
                                            case 
BotSkill.FB:
                                                
spell Bot.Spells[1045];
                                                break;
                                            case 
BotSkill.SS:
                                                
spell Bot.Spells[1046];
                                                break;
                                            case 
BotSkill.FBSS:
                                                {
                                                    if (
Kernel.Rate(50))
                                                        
spell Bot.Spells[1046];
                                                    else
                                                        
spell Bot.Spells[1045];
                                                }
                                                break;

                                        }
                                        if (
SpellTable.SpellInformations.ContainsKey(spell.ID))
                                        {
                                            if (!
SpellTable.SpellInformations[spell.ID].ContainsKey(spell.Level))
                                                return;
                                        }
                                        else
                                            return;

                                        if (
Ais.ContainsKey(Target.UID))
                                        {
                                            if (
Kernel.Rate((double)50.0))
                                            {
                                                
ai.Bot.Entity.Die(Target);
                                            }
                                            else
                                            {
                                                
Target.Die(ai.Bot.Entity);
                                            }
                                        }

                                        
#region Stamina Check
                                        
if (Bot.Entity.Action == Enums.ConquerAction.Sit)
                                        {
                                            
Bot.Entity.Stamina += (byte)Kernel.Random.Next(10);
                                        }
                                        else
                                        {
                                            if (
Bot.Entity.Stamina SpellTable.SpellInformations[spell.ID][spell.Level].UseStamina)
                                            {
                                                
Bot.Entity.Action Enums.ConquerAction.Sit;
                                                
MrHassan.Network.GamePackets.Data buffer = new MrHassan.Network.GamePackets.Data(true)
                                                {
                                                    
UID Bot.Entity.UID,
                                                    
dwParam Bot.Entity.Action
                                                
};
                                                
Bot.Entity.SendScreen(buffer);

                                                
Bot.SendScreenSpawn(Bot.Entitytrue);
                                                
Target.Owner.SendScreenSpawn(Bot.Entitytrue);
                                                return;
                                            }
                                        }
                                        
#endregion Stamina Check
                                        #region Jump
                                        
if (Now >= ai.LastBotJump.AddMilliseconds(ai.JumpSpeed))
                                        {
                                            
ushort X Bot.Entity.X;
                                            
ushort Y Bot.Entity.Y;
                                            var 
dist Kernel.GetDistance(Bot.Entity.XBot.Entity.YTarget.XTarget.Y);
                                            
int count = (int)Math.Ceiling((double)dist 16);
                                            var 
path Pathfinding.AStar.Calculate.FindWay(Target.XTarget.YBot.Entity.XBot.Entity.YBot.Map);
                                            if (
path != null)
                                            {

                                                var 
point Math.Ceiling((double)path.Count count);
                                                if (
point 0)
                                                {
                                                    
point Math.Min(path.Count 1point);
                                                    
path[(int)point].X;
                                                    
path[(int)point].Y;
                                                }
                                                else
                                                {
                                                    
path[path.Count 1].X;
                                                    
path[path.Count 1].Y;
                                                }
                                            }
                                            
//  var angel = Kernel.GetAngle(Bot.Entity.X, Bot.Entity.Y, Target.X, Target.Y);
                                            // Bot.Entity.Move(angel);
                                            
Data buffer = new Data(true)
                                            {
                                                
ID MrHassan.Network.GamePackets.Data.Jump,
                                                
dwParam = (uint)((<< 0x10) | X),
                                                
wParam1 X,
                                                
wParam2 Y,
                                                
UID Bot.Entity.UID
                                            
};
                                            
Bot.Entity.SendScreen(buffer);
                                            
ai.LastBotJump Time32.Now;
                                        }
                                        
#endregion
                                        #region Attack


                                        
if (Now client.Entity.AttackStamp.AddSeconds(1))
                                        {
                                            if (
MrHassan.MyMath.Success(ai.ShootChance))
                                            {
                                                var 
dist Kernel.GetDistance(Bot.Entity.XBot.Entity.YTarget.XTarget.Y);
                                                var 
spelldist SpellTable.SpellInformations[spell.ID][spell.Level].Range;
                                                if (
dist spelldist)
                                                {
                                                    var 
interact = new Attack(true);
                                                    
interact.AttackType Attack.Magic;
                                                    
interact.MagicType spell.ID;
                                                    
interact.Attacker Bot.Entity.UID;
                                                    
interact.Attacked Target.UID;
                                                    
interact.MagicLevel spell.Level;
                                                    
interact.Decoded true;
                                                    if (
MrHassan.MyMath.Success(ai.Accuracy))
                                                    {
                                                        
interact.Target.X;
                                                        
interact.Target.Y;
                                                    }
                                                    else
                                                    {
                                                        
interact.= (ushort)(Target.1);
                                                        
interact.= (ushort)(Target.1);
                                                    }
                                                    
Bot.Entity.MinAttack 5000;
                                                    
Bot.Entity.MaxAttack 7300;
                                                    
Bot.Entity.AttackPacket interact;
                                                    
interact.Damage 7000;
                                                    new 
MrHassan.Game.Attacking.Handle(interactBot.EntityTarget);


                                                }
                                                
//if (dist < 2)
                                                //{
                                                //    var interact = new Attack(true);
                                                //    interact.AttackType = Attack.Melee;
                                                //    interact.Attacker = Bot.Entity.UID;
                                                //    interact.Attacked = Target.UID;
                                                //    if (Kernel.ChanceSuccess(ai.Accuracy))
                                                //    {
                                                //        interact.X = Target.X;
                                                //        interact.Y = Target.Y;
                                                //    }
                                                //    else
                                                //    {
                                                //        interact.X = (ushort)(Target.X + 1);
                                                //        interact.Y = (ushort)(Target.Y + 1);
                                                //    }
                                                //    Bot.Entity.AttackPacket = interact;
                                                //    new MrHassan.Game.Attacking.Handle(interact, Bot.Entity, Target);
                                                //}
                                            
}
                                        }
                                        
#endregion

                                    
}
                                }
                                else
                                {
                                    if (
Bot.Entity.Action != Enums.ConquerAction.Cool && Time32.Now >= Bot.CoolStamp.AddSeconds(10))
                                    {
                                        
Bot.Entity.Action Enums.ConquerAction.Cool;
                                        
MrHassan.Network.GamePackets.Data generalData = new MrHassan.Network.GamePackets.Data(true);
                                        
generalData.UID Bot.Entity.UID;
                                        
generalData.dwParam Bot.Entity.Action;
                                        
generalData.dwParam |= (uint)((Bot.Entity.Class * 0x10000) + 0x1000000);
                                        
Bot.Entity.SendScreen(generalData);
                                        
Bot.CoolStamp Time32.Now;

                                        
Bot.SendScreenSpawn(Bot.Entitytrue);
                                        
Target.Owner.SendScreenSpawn(Bot.Entitytrue);
                                        
Bot.SendScreen(new Message("Die Noob :P , HHHHHHHHHHH!"Target.NameBot.Entity.NameSystem.Drawing.Color.WhiteMessage.Talk), false);
                                        return;
                                    }
                                    if (
ai.Type == BotType.AI || ai.Type == BotType.MatrixAI)
                                    {
                                        
ai.Target null;
                                        return;
                                    }
                                }
                            }
                        }
                        
//else
                        
else if (client.Entity.MapID != ai.Bot.Entity.MapID)
                        {
                            if (
client.AI == ai)
                            {
                                
client.AI.Dispose(client);
                            }
                        }
                    }
                }
                if (
Ais.Count 0)
                {
                    List<
AI> array = new List<AI>();
                    foreach (var 
item in Ais.Values)
                    {
                        if (
item.Bot == null)
                            array.
Add(item);

                    }
                    
// var array = Ais.Values.Where(ai => ai.Bot == null).ToArray();
                    
if (array != null)
                    {
                        for (
int i 0< array.Counti++)
                        {
                            var 
ai = array[i];
                            
Ais.Remove(ai.UID);
                        }
                    }
                }
            }
            catch (
Exception e)
            {
                
Console.WriteLine(e);
            }
        }
        
#endregion
        
private static AI GetAiinMap(AI ai)
        {
            if (
ai.Bot == null)
                return 
null;
            if (
ai.Bot.Entity == null)
                return 
null;

            var array = 
Ais.Values.Where(=> i.UID != ai.UID && i.Bot.Entity.MapID == ai.Bot.Entity.MapID).ToArray();
            for (
int i 0< array.Lengthi++)
            {
                if (
ai.selectFunc != null)
                    if (
ai.selectFunc(array[i].Bot))
                        return array[
i];
            }
            return 
null;
        }
        
#region Timers
        
private IDisposable[] TimerSubscriptions;
        private 
object DisposalSyncRoot;
        ~
AI()
        {
            
DisposeTimers();
            
Target null;
            
Bot null;
        }
        public 
void Dispose(GameState client)
        {
            
DisposeTimers();
            
Bot null;
            
Target null;
            
// Ais.Remove(this);
            
Join(client);
            
client.Entity.OnDeath null;
        }
        private 
void DisposeTimers()
        {
            if (
DisposalSyncRoot == null)
                return;
            
lock (DisposalSyncRoot)
            {
                if (
TimerSubscriptions == null) return;
                for (
int i 0TimerSubscriptions.Lengthi++)
                {
                    if (
TimerSubscriptions[i] != null)
                    {
                        
TimerSubscriptions[i].Dispose();
                        
TimerSubscriptions[i] = null;
                    }
                }
            }
        }
        
#endregion
        
public enum BotSkill
        
{
            
FB,
            
SS,
            
FBSS,
            
All
        
}
        public 
enum BotType
        
{
            
MyAi,
            
AI,
            
MatrixAI
        
}
        public 
enum BotLevel
        
{
            
Noob 0,
            
Easy 1,
            
Normal 2,
            
Medium 3,
            
Hard 4,
            
Insane 5,
            
MaTrix 6
        
}
        private 
BotSkill Skill;
        private 
BotType Type;
        public 
GameState Bot;
        private 
Entity Target;
        private 
int JumpSpeed 0;
        private 
int ShootChance 0;
        private 
int Accuracy 0;
        private 
Time32 LastBotJump;
        private 
Time32 LastTalk;
        private 
bool Loaded;
        private 
Func<GameStateboolselectFunc;
        private 
bool Disguisefun;
        public 
Counter UIDCounter = new MrHassan.Counter(60000000);
        private 
uint UID;

        public 
AI(ushort Mapushort xushort yBotLevel LevelBotSkill skill BotSkill.SS)
        {
            
Bot = new GameState(null);
            
Type BotType.AI;
            
Skill skill;
            
SetLevel(Level);
            
LoadAI(Mapxy);
            do
            {
                
Bot.Entity.UID UIDCounter.Next;
            }
            while (
Ais.ContainsKey(Bot.Entity.UID));
            
UID Bot.Entity.UID;
            
Ais.Add(Bot.Entity.UIDthis);
        }
        public 
AI(ushort Mapushort xushort yBotLevel LevelFunc<GameStateboolFuncbool Func2 true)
        {
            
Bot = new GameState(null);
            
Type BotType.MatrixAI;
            
Skill BotSkill.SS;
            
selectFunc Func;
            
Disguisefun Func2;
            
SetLevel(Level);
            
LoadAI(Mapxy);
            do
            {
                
Bot.Entity.UID UIDCounter.Next;
            }
            while (
Ais.ContainsKey(Bot.Entity.UID));
            
Ais.Add(Bot.Entity.UIDthis);
            
UID Bot.Entity.UID;
        }
        public 
AI(GameState client)
        {
            
Join(client);
        }
        public 
AI(GameState clientBotLevel LevelBotSkill skill BotSkill.SS)
        {
            
Target client.Entity;
            
Bot = new GameState(null);
            
Type BotType.MyAi;
            
Skill skill;
            
SetLevel(Level);
            
LoadAI();
            
Join(client);
            do
            {
                
Bot.Entity.UID UIDCounter.Next;
            }
            while (
Ais.ContainsKey(Bot.Entity.UID));
            
Ais.Add(Bot.Entity.UIDthis);
            
UID Bot.Entity.UID;
        }
        public 
void Join(GameState client)
        {
            
TimerSubscriptions = new IDisposable[] 
            {
                
AIAction.Add(client)
            };
            
DisposalSyncRoot = new object();
        }
        public 
void SetLevel(BotLevel Level)
        {
            switch (
Level)
            {
                case 
BotLevel.Noob:
                    
JumpSpeed 3000;
                    
ShootChance 10;
                    
Accuracy 5;
                    break;

                case 
BotLevel.Easy:
                    
JumpSpeed 1500;
                    
ShootChance 25;
                    
Accuracy 10;
                    break;

                case 
BotLevel.Normal:
                    
JumpSpeed 1250;
                    
ShootChance 33;
                    
Accuracy 20;
                    break;

                case 
BotLevel.Medium:
                    
JumpSpeed 1000;
                    
ShootChance 50;
                    
Accuracy 33;
                    break;

                case 
BotLevel.Hard:
                    
JumpSpeed 1000;
                    
ShootChance 75;
                    
Accuracy 50;
                    break;

                case 
BotLevel.Insane:
                    
JumpSpeed 1000;
                    
ShootChance 90;
                    
Accuracy 80;
                    break;
                case 
BotLevel.MaTrix:
                    
JumpSpeed 1000;
                    
ShootChance 100;
                    
Accuracy 100;
                    break;
            }
        }
        public 
void LoadAI(ushort MapID 0ushort X 0ushort Y 0)
        {
            
Bot.ReadyToPlay();
            
Bot.Entity = new Entity(EntityFlag.Entityfalse);
            
Bot.Entity.Owner Bot;
            
Bot.Entity.MapObjType MapObjectType.Entity;
            
Bot.Variables = new VariableVault();
            
Bot.Friends = new SafeDictionary<uintGame.ConquerStructures.Society.Friend>();
            
Bot.Enemy = new SafeDictionary<uintGame.ConquerStructures.Society.Enemy>();
            
Bot.ChiData = new ChiTable.ChiData();
            
Bot.ChiPowers = new List<ChiPowerStructure>();
            
Bot.Entity.Vitality 537;
            if (
Target != null)
            {
                
Target.OnDeath =>
                {
                    
p.Owner.MessageBox("Do You Want To Quit?"=> { c.AI.Dispose(c); c.Entity.Teleport(1002301266); });
                };
            }
            
Bot.Entity.OnDeath =>
            {
                if (
p.Owner.Team != null)
                {
                    if (
p.Owner.Team.EliteMatch != null)
                    {
                        
p.Owner.Team.EliteMatch.End(p.Owner.Team);
                    }
                }
                
p.Owner.SendScreen(new Message("Reviving in 18 seconds!""ALL"p.NameSystem.Drawing.Color.WhiteMessage.Talk), false);
                foreach (var 
obj in p.Owner.Screen.Objects)
                    if (
obj.MapObjType == MapObjectType.Entity)
                    {
                        (
obj as Entity).Owner.Time(10);
                        if ((
obj as Entity).Owner.AI.Bot == p.Owner)
                        {
                            (
obj as Entity).Owner.MessageBox("Do You Want To Quit?"=> { c.AI.Dispose(c); c.Entity.Teleport(1002301266); });
                        }
                    }
            };
            switch (
Type)
            {
                case 
BotType.MyAi:
                    {
                        var 
client Target.Owner;
                        
Bot.Entity.Name "InFerno" "[BoT]";
                        
Bot.Entity.Face client.Entity.Face;
                        
Bot.Entity.Body client.Entity.Body;
                        
Bot.Entity.HairStyle client.Entity.HairStyle;
                        
Bot.Entity.Level client.Entity.Level;
                        
Bot.Entity.Class = client.Entity.Class;
                        
Bot.Entity.Reborn client.Entity.Reborn;
                        
Bot.Entity.Level client.Entity.Level;
                        
Bot.Entity.MapID client.Entity.MapID;
                        
Bot.Entity.= (ushort)(client.Entity.Kernel.Random.Next(5));
                        
Bot.Entity.= (ushort)(client.Entity.Kernel.Random.Next(5));
                        
Bot.Entity.MinAttack client.Entity.MinAttack;
                        
Bot.Entity.MaxAttack client.Entity.MagicAttack;
                        
uint UID 70000000;
                        
UID += Target.UID;


                        
Bot.Entity.MaxHitpoints client.Entity.MaxHitpoints;
                        
Bot.Entity.Hitpoints Bot.Entity.MaxHitpoints;
                        
Bot.Entity.Mana Bot.Entity.MaxMana;

                        
Bot.Entity.Agility client.Entity.Agility;
                        
Bot.Entity.Spirit client.Entity.Spirit;
                        
Bot.Entity.Strength client.Entity.Strength;
                        
Bot.Entity.Vitality client.Entity.Vitality;

                        
Bot.Entity.UID UID;
                        
Bot.Entity.Stamina 150;
                        
Bot.Equipment.ForceEquipments(Target.Owner.Equipment);

                        
Bot.ChiData client.ChiData;
                        
Bot.ChiPowers client.ChiPowers;

                        
Bot.LoadItemStats();
                        
Bot.Equipment.UpdateEntityPacket();
                        
ClientEquip equips = new ClientEquip();
                        
equips.DoEquips(Bot);
                        
Bot.Send(equips);

                        
Bot.Spells client.Spells;
                        
Bot.Proficiencies client.Proficiencies;
                    }
                    break;
                case 
BotType.MatrixAI:
                case 
BotType.AI:
                    {
                        
Bot.Entity.Name "Inferno[" Kernel.Random.Next(20) + "][BoT]";
                        
Bot.Entity.Face 37;
                        
Bot.Entity.Body 1003;
                        
Bot.Entity.HairStyle 630;
                        
Bot.Entity.Level 140;
                        
Bot.Entity.Class = 15;
                        
Bot.Entity.Reborn 2;
                        
Bot.Entity.MapID MapID;
                        
Bot.Entity.= (ushort)(Kernel.Random.Next(5));
                        
Bot.Entity.= (ushort)(Kernel.Random.Next(5));
                        
uint UID UIDCounter.Next;

                        
Bot.Entity.MaxHitpoints 20000;
                        
Bot.Entity.Hitpoints Bot.Entity.MaxHitpoints;
                        
Bot.Entity.Mana 800;

                        
Bot.Entity.UID UID;
                        
Bot.Entity.Stamina 150;

                        
Bot.Spells = new SafeDictionary<ushortInterfaces.ISkill>();
                        
Bot.Proficiencies = new SafeDictionary<ushortInterfaces.IProf>();
                    }
                    break;
            }
            if (
Skill == BotSkill.FBSS || Skill == BotSkill.FB || Skill == BotSkill.SS)
            {
                if (!
Bot.Proficiencies.ContainsKey(410))
                    
Bot.AddProficiency(new Proficiency(true) { ID 410Level 20 });
                if (!
Bot.Proficiencies.ContainsKey(420))
                    
Bot.AddProficiency(new Proficiency(true) { ID 420Level 20 });
                if (!
Bot.Spells.ContainsKey(1045))
                    
Bot.AddSpell(Npcs.LearnableSpell(10454));
                if (!
Bot.Spells.ContainsKey(1046))
                    
Bot.AddSpell(Npcs.LearnableSpell(10464));
                var 
weapons Bot.Weapons;
                if (
weapons.Item1 != null)
                {
                    if (
weapons.Item1.ID 1000 != 410 && weapons.Item1.ID 1000 != 420)
                    {
                        if (
weapons.Item2 != null)
                        {
                            if (
weapons.Item2.ID 1000 != 410 && weapons.Item2.ID 1000 != 420)
                            {
                                
weapons.Item1.ID 420439;
                            }
                        }
                    }
                }
                else
                {
                    if (
Bot.Equipment == nullBot.Equipment = new Equipment(Bot);
                    
Bot.Equipment.Add(new ConquerItem(true) { ID 420439Plus 12Position });
                }
            }
            
this.LastBotJump Time32.Now;
            
Loaded true;
        }
        public 
void Disguise(GameState client)
        {
            
Bot.Entity.Face client.Entity.Face;
            
Bot.Entity.Body client.Entity.Body;
            
Bot.Entity.HairStyle client.Entity.HairStyle;
            
Bot.Entity.Level client.Entity.Level;
            
Bot.Entity.Class = client.Entity.Class;
            
Bot.Entity.Reborn client.Entity.Reborn;
            
Bot.Entity.Level client.Entity.Level;
            
Bot.Entity.MapID client.Entity.MapID;
            
Bot.Entity.= (ushort)(client.Entity.Kernel.Random.Next(5));
            
Bot.Entity.= (ushort)(client.Entity.Kernel.Random.Next(5));
            
Bot.Entity.MinAttack client.Entity.MinAttack;
            
Bot.Entity.MaxAttack client.Entity.MagicAttack;

            
Bot.Entity.MaxHitpoints client.Entity.MaxHitpoints;
            
Bot.Entity.Hitpoints Bot.Entity.MaxHitpoints;
            
Bot.Entity.Mana Bot.Entity.MaxMana;

            
Bot.Entity.Agility client.Entity.Agility;
            
Bot.Entity.Spirit client.Entity.Spirit;
            
Bot.Entity.Strength client.Entity.Strength;
            
Bot.Entity.Vitality client.Entity.Vitality;


            
Bot.Entity.Stamina 150;
            
Bot.Equipment.ForceEquipments(client.Equipment);

            if (
client.ChiData != null)
                
Bot.ChiData client.ChiData;
            
Bot.ChiPowers client.ChiPowers;
            
Bot.Entity.MyJiang client.Entity.MyJiang;
            
Bot.Entity.SubClasses client.Entity.SubClasses;

            
Bot.LoadItemStats();

            
Bot.Equipment.UpdateEntityPacket();
            
ClientEquip equips = new ClientEquip();
            
equips.DoEquips(Bot);
            
Bot.Send(equips);

            
Bot.Spells client.Spells;
            
Bot.Proficiencies client.Proficiencies;
            if (
Skill == BotSkill.FBSS || Skill == BotSkill.FB || Skill == BotSkill.SS)
            {
                if (!
Bot.Proficiencies.ContainsKey(410))
                    
Bot.AddProficiency(new Proficiency(true) { ID 410Level 20 });
                if (!
Bot.Proficiencies.ContainsKey(420))
                    
Bot.AddProficiency(new Proficiency(true) { ID 420Level 20 });
                if (!
Bot.Spells.ContainsKey(1045))
                    
Bot.AddSpell(Npcs.LearnableSpell(10454));
                if (!
Bot.Spells.ContainsKey(1046))
                    
Bot.AddSpell(Npcs.LearnableSpell(10464));
                var 
weapons Bot.Weapons;
                if (
weapons.Item1 != null)
                {
                    if (
weapons.Item1.ID 1000 != 410 && weapons.Item1.ID 1000 != 420)
                    {
                        if (
weapons.Item2 != null)
                        {
                            if (
weapons.Item2.ID 1000 != 410 && weapons.Item2.ID 1000 != 420)
                            {
                                
weapons.Item1.ID 420439;
                            }
                        }
                    }
                }
            }
            
this.LastBotJump Time32.Now;
            
Loaded true;
            
Bot.SendScreenSpawn(Bot.Entitytrue);
        }

        public static 
void CheckScreen(GameState OwnerInterfaces.IPacket spawnWith null)
        {
            
// if (Owner.Fake) return;
            
foreach (var ai in MaTrix.AI.Ais.Values)
            {
                if (
ai.Bot == null)
                    continue;
                if (
ai.Bot.Entity == null)
                    continue;

                if (
Owner.Entity.MapID == ai.Bot.Entity.MapID)
                {
                    var 
pClient ai.Bot;
                    
short dist Kernel.GetDistance(ai.Bot.Entity.Xai.Bot.Entity.YOwner.Entity.XOwner.Entity.Y);
                    if (
dist <= Constants.pScreenDistance)
                    {
                        
Owner.Entity.SendSpawn(pClient);
                        
pClient.Entity.SendSpawn(Owner);

                        if (
pClient.Guild != null)
                            
Owner.Entity.SendSpawn(pClientfalse);
                        if (
Owner.Guild != null)
                            
pClient.Entity.SendSpawn(Ownerfalse);

                        if (
spawnWith != null)
                            
pClient.Send(spawnWith);

                    }
                    else if (
Owner.Fake)
                    {
                        
Owner.Entity.SendSpawn(pClient);
                        
pClient.Entity.SendSpawn(Owner);

                        if (
pClient.Guild != null)
                            
Owner.Entity.SendSpawn(pClientfalse);
                        if (
Owner.Guild != null)
                            
pClient.Entity.SendSpawn(Ownerfalse);

                        if (
spawnWith != null)
                            
pClient.Send(spawnWith);
                    }
                }
            }
        }
    }
    public class 
Lobby
    
{
        public 
enum MatchType
        
{
            
AllSkills,
            
FBSS
        
}
        public static 
uint cpsFee 100000;
        public static 
INpc Npc;
        public static 
Map Map;
        public 
Lobby()
        {
            
Map Kernel.Maps[700].MakeDynamicMap();
            
Npc = new NpcSpawn();
            
Npc.UID 3;
            
Npc.50;
            
Npc.50;
            
Npc.MapID Map.ID;
            
Npc.Mesh 20880;
            
Npc.Type = (Enums.NpcType)32;
            
Npc.Name "Lobby";
            
Map.AddNpc(Npc);
            
World.Subscribe(Functions1000);
        }

        private 
void Functions(int time)
        {
            
EngageEntitys();
            
CheckGroups();
        }
        public static 
void EngageEntitys()
        {
            var 
Entitys Program.Values.Where(=> c.LobbySignup == true && c.Entity.MapID == Map.ID).ToArray();
            if (
Entitys.Length 2)
                return;
            
int ij;
            
int iPlusjPlus;
            
int iEndjEnd;
            
iPlus Kernel.Random.Next(2);
            
jPlus Kernel.Random.Next(2);
            if (
iPlus == 0) { 0iPlus 1iEnd Entitys.Length; } else { Entitys.Length 1iPlus = -1iEnd = -1; }
            if (
jPlus == 0) { 0jPlus 1jEnd Entitys.Length; } else { Entitys.Length 1jPlus = -1jEnd = -1; }
            
Time32 Now Time32.Now;
            for (; 
!= iEnd+= iPlus)
            {
                var 
Challanger Entitys[i];

                if (
Challanger.Entity.MapID == Map.ID && Challanger.LobbySignup == true)
                {
                    for (; 
!= jEnd+= jPlus)
                    {
                        var 
Challanged Entitys[j];
                        if (
Challanged.Entity.MapID == Map.ID && Challanged.LobbySignup == true)
                        {
                            if (
Challanger.MatchType == Challanged.MatchType)
                            {
                                if (
Challanger.MatchType == MatchType.FBSS)
                                {
                                    var 
weapons Challanger.Weapons;
                                    if (
weapons.Item1 != null)
                                    {
                                        if (!
SpellTable.SpellInformations[1045][0].WeaponSubtype.Contains((ushort)(weapons.Item1.ID 1000)) && !SpellTable.SpellInformations[1045][0].WeaponSubtype.Contains((ushort)(Challanger.WeaponLook 1000)) && !SpellTable.SpellInformations[1046][0].WeaponSubtype.Contains((ushort)(weapons.Item1.ID 1000)) && !SpellTable.SpellInformations[1046][0].WeaponSubtype.Contains((ushort)(Challanger.WeaponLook 1000)))
                                        {
                                            if (
weapons.Item2 != null)
                                            {
                                                if (!
SpellTable.SpellInformations[1045][0].WeaponSubtype.Contains((ushort)(weapons.Item2.ID 1000)) && !SpellTable.SpellInformations[1045][0].WeaponSubtype.Contains((ushort)(Challanger.WeaponLook2 1000)) && !SpellTable.SpellInformations[1046][0].WeaponSubtype.Contains((ushort)(weapons.Item2.ID 1000)) && !SpellTable.SpellInformations[1046][0].WeaponSubtype.Contains((ushort)(Challanger.WeaponLook2 1000)))
                                                {
                                                    
Challanger.MessageBox("You Had to Wear Blade Or Sword.");
                                                    return;
                                                }
                                            }
                                            else
                                            {
                                                
Challanger.MessageBox("You Had to Wear Blade Or Sword.");
                                                return;
                                            }
                                        }
                                    }
                                    else
                                    {
                                        
Challanger.MessageBox("You Had to Wear Blade Or Sword.");
                                        return;
                                    }
                                }
                                if (
Challanged.MatchType == MatchType.FBSS)
                                {
                                    var 
weapons Challanged.Weapons;
                                    if (
weapons.Item1 != null)
                                    {
                                        if (!
SpellTable.SpellInformations[1045][0].WeaponSubtype.Contains((ushort)(weapons.Item1.ID 1000)) && !SpellTable.SpellInformations[1045][0].WeaponSubtype.Contains((ushort)(Challanged.WeaponLook 1000)) && !SpellTable.SpellInformations[1046][0].WeaponSubtype.Contains((ushort)(weapons.Item1.ID 1000)) && !SpellTable.SpellInformations[1046][0].WeaponSubtype.Contains((ushort)(Challanged.WeaponLook 1000)))
                                        {
                                            if (
weapons.Item2 != null)
                                            {
                                                if (!
SpellTable.SpellInformations[1045][0].WeaponSubtype.Contains((ushort)(weapons.Item2.ID 1000)) && !SpellTable.SpellInformations[1045][0].WeaponSubtype.Contains((ushort)(Challanged.WeaponLook2 1000)) && !SpellTable.SpellInformations[1046][0].WeaponSubtype.Contains((ushort)(weapons.Item2.ID 1000)) && !SpellTable.SpellInformations[1046][0].WeaponSubtype.Contains((ushort)(Challanged.WeaponLook2 1000)))
                                                {
                                                    
Challanged.MessageBox("You Had to Wear Blade Or Sword.");
                                                    return;
                                                }
                                            }
                                            else
                                            {
                                                
Challanged.MessageBox("You Had to Wear Blade Or Sword.");
                                                return;
                                            }
                                        }
                                    }
                                    else
                                    {
                                        
Challanged.MessageBox("You Had to Wear Blade Or Sword.");
                                        return;
                                    }
                                }
                                if (
Challanger.Entity.UID != Challanged.Entity.UID)
                                {
                                    if (
Challanger.LobbyGroup == null && Challanged.LobbyGroup == null)
                                    {
                                        
Challanger.MessageBox("You Will Enter The  Fight soon. Wanna Quit?"=>
                                        {
                                            if (
p.LobbyGroup != null)
                                            {
                                                
p.LobbyGroup.End(p);
                                                var 
winner p.LobbyGroup.Winner;
                                                var 
loser p.LobbyGroup.Loser;
                                                
p.LobbyGroup.Export();
                                                
Win(winnerloser);
                                            }
                                        });
                                        
Challanged.MessageBox("You Will Enter The  Fight soon. Wanna Quit?"=>
                                        {
                                            if (
p.LobbyGroup != null)
                                            {
                                                
p.LobbyGroup.End(p);
                                                var 
winner p.LobbyGroup.Winner;
                                                var 
loser p.LobbyGroup.Loser;
                                                
p.LobbyGroup.Export();
                                                
Win(winnerloser);
                                            }
                                        });

                                        
MaTrix.Lobby.QualifierGroup group = new MaTrix.Lobby.QualifierGroup(ChallangerChallanged);
                                        
Program.World.DelayedTask.StartDelayedTask(() =>
                                        {
                                            if (
Challanger.LobbyGroup == null || Challanged.LobbyGroup == null)
                                                return;
                                            if (!
Challanger.LobbySignup || !Challanged.LobbySignup)
                                                return;
                                            if (
group.Done)
                                                return;
                                            
group.Import();

                                        }, 
6000);
                                    }
                                    else
                                    {
                                        if (
Challanger.LobbyGroup != null)
                                        {
                                            if (
Challanger.LobbyGroup.Done)
                                            {
                                                
Challanger.LobbyGroup.Export();
                                            }
                                        }
                                        if (
Challanged.LobbyGroup != null)
                                        {
                                            if (
Challanged.LobbyGroup.Done)
                                            {
                                                
Challanger.LobbyGroup.Export();
                                            }
                                        }
                                    }
                                }
                            }
                        }
                    }
                }
            }
        }

        public static 
void CheckGroups()
        {
            if (
Groups.Count 0)
            {
                foreach (var 
group in Groups.Values)
                {
                    if (
Time32.Now group.CreateTime.AddSeconds(5))
                    {
                        if (!
group.Done)
                        {
                            if (
Time32.Now group.CreateTime.AddMinutes(3))
                            {
                                
group.End();
                            }
                        }
                        else
                        {
                            if (
Time32.Now group.DoneStamp.AddSeconds(4))
                            {
                                
group.DoneStamp Time32.Now.AddDays(1);
                                
group.Export();
                                
Win(group.Winnergroup.Loser);
                            }
                        }
                    }
                }
            }
        }

        public static 
void Win(Client.GameState winnerClient.GameState loser)
        {
            
StringBuilder builder = new StringBuilder();
            
builder.Append(winner.Entity.Name);
            
builder.Append(" has defeated ");
            
builder.Append(loser.Entity.Name);
            
builder.Append(" in the Lobby Challange");
            
builder.Append(".");

            
Kernel.SendWorldMessage(new Message(builder.ToString(), System.Drawing.Color.RedMessage.ArenaQualifier), Program.ValuesMap.ID);

            
winner.LobbyGroup null;
            
loser.LobbyGroup null;

            if (
winner.LobbyPlayWith == null)
                
winner.Entity.ConquerPoints += cpsFee;

            
loser.LobbySignup false;

            
QualifierGroup.ArenaSignup sign = new QualifierGroup.ArenaSignup();
            
sign.Stats loser.Entity;
            
sign.DialogID QualifierGroup.ArenaSignup.MainIDs.Dialog2;
            
loser.Send(sign.BuildPacket());
            
sign.Stats winner.Entity;
            
sign.OptionID QualifierGroup.ArenaSignup.DialogButton.Win;
            
winner.Send(sign.BuildPacket());

            
loser.Send(loser.ArenaStatistic);
            
winner.Send(winner.ArenaStatistic);

            if (
winner.LobbyPlayWith != null)
                
winner.LobbyPlayWith null;
            if (
loser.LobbyPlayWith != null)
                
loser.LobbyPlayWith null;

        }

        public static 
ConcurrentDictionary<uintGameStateWaitingEntitysList = new ConcurrentDictionary<uintGameState>();
        public static 
ConcurrentDictionary<uintQualifierGroupGroups = new ConcurrentDictionary<uintQualifierGroup>();
        public static 
Counter GroupCounter = new MrHassan.Counter();
        public class 
QualifierGroup
        
{
            public class 
GroupMatch
            
{
                public 
ushort Type 2210;
                public 
QualifierGroup Group;
                public 
byte[] BuildPacket()
                {
                    
MemoryStream strm = new MemoryStream();
                    
BinaryWriter wtr = new BinaryWriter(strm);
                    
wtr.Write((ushort)56);
                    
wtr.Write((ushort)Type);
                    
wtr.Write((uint)Group.Entitys1.Entity.UID);
                    
byte[] array = Encoding.Default.GetBytes(Group.Entitys1.Entity.Name);
                    for (
int i 016i++)
                    {
                        if (
Group.Entitys1.Entity.Name.Length)
                        {
                            
wtr.Write(array[i]);
                        }
                        else
                            
wtr.Write((byte)0);
                    }
                    
wtr.Write((uint)Group.Entitys1Damage);
                    
wtr.Write((uint)Group.Entitys2.Entity.UID);
                    
byte[] array2 Encoding.Default.GetBytes(Group.Entitys2.Entity.Name);
                    for (
int i 016i++)
                    {
                        if (
Group.Entitys2.Entity.Name.Length)
                        {
                            
wtr.Write(array2[i]);
                        }
                        else
                            
wtr.Write((byte)0);
                    }
                    
wtr.Write((uint)Group.Entitys2Damage);
                    
wtr.Write((uint)1);
                    
wtr.Write(Encoding.Default.GetBytes("TQServer"));
                    
strm.Position 0;
                    
byte[] buf = new byte[strm.Length];
                    
strm.Read(buf0buf.Length);
                    
wtr.Close();
                    
strm.Close();
                    return 
buf;
                }
            }
            public 
Time32 CreateTime;
            public 
Time32 DoneStamp;

            public 
uint Entitys1DamageEntitys2Damage;
            public 
uint Entitys1CheersEntitys2Cheers;

            public 
bool Done;

            private 
Game.Enums.PKMode P1ModeP2Mode;

            public 
uint ID;

            public 
GroupMatch match = new GroupMatch();

            public 
Client.GameState WinnerLoser;
            public 
Client.GameState Entitys1Entitys2;

            public 
Map dynamicMap;
            public 
Time32 ImportTime;
            public 
MatchType MatchType MatchType.AllSkills;
            public 
QualifierGroup(Client.GameState Entitys1Client.GameState Entitys2MatchType matchtype MatchType.AllSkills)
            {
                
CreateTime Time32.Now;
                
Entitys1Damage 0;
                
Entitys2Damage 0;
                
Done false;
                
ID GroupCounter.Next;
                
match.Group this;
                
Done false;
                
MatchType matchtype;
                
Groups.Add(IDthis);

                
Entitys1.LobbyGroup this;
                
Entitys2.LobbyGroup this;
            }

            public 
GameState OppositeClient(GameState client)
            {
                if (
client == Entitys1)
                    return 
Entitys2;
                else
                    return 
Entitys1;
            }

            public 
void Import()
            {
                
//Entitys1.LobbyGroup = this;
                //Entitys2.LobbyGroup = this;

                
if (!Kernel.Maps.ContainsKey(700))
                    new 
Map(700Database.DMaps.MapPaths[700]);
                
Map origMap Kernel.Maps[700];
                
dynamicMap origMap.MakeDynamicMap();
                
Entitys1.Entity.Teleport(origMap.IDdynamicMap.ID, (ushort)Kernel.Random.Next(3570), (ushort)Kernel.Random.Next(3570));
                
Entitys2.Entity.Teleport(origMap.IDdynamicMap.ID, (ushort)Kernel.Random.Next(3570), (ushort)Kernel.Random.Next(3570));
                
ImportTime Time32.Now;
                if (
Entitys1.Map.ID == Entitys2.Map.ID)
                {
                    
Entitys1.Send(match.BuildPacket());
                    
Entitys2.Send(match.BuildPacket());
                    
Entitys1.Entity.BringToLife();
                    
Entitys2.Entity.BringToLife();
                    if (
Entitys1.Entity.ContainsFlag(Update.Flags.Ride))
                        
Entitys1.Entity.RemoveFlag(Update.Flags.Ride);
                    if (
Entitys2.Entity.ContainsFlag(Update.Flags.Ride))
                        
Entitys2.Entity.RemoveFlag(Update.Flags.Ride);
                    
Entitys1.Entity.RemoveFlag(Network.GamePackets.Update.Flags.Ride);
                    
Entitys2.Entity.RemoveFlag(Network.GamePackets.Update.Flags.Ride);
                    
P1Mode Entitys1.Entity.PKMode;
                    
Entitys1.Entity.PKMode MrHassan.Game.Enums.PKMode.PK;
                    
Entitys1.Send(new Data(true) { UID Entitys1.Entity.UIDID Data.ChangePKModedwParam = (uint)Entitys1.Entity.PKMode });
                    
P2Mode Entitys2.Entity.PKMode;
                    
Entitys2.Entity.PKMode MrHassan.Game.Enums.PKMode.PK;
                    
Entitys2.Send(new Data(true) { UID Entitys2.Entity.UIDID Data.ChangePKModedwParam = (uint)Entitys2.Entity.PKMode });
                    
Entitys1.Screen.FullWipe();
                    
Entitys1.Screen.Reload();
                    
Entitys2.Screen.FullWipe();
                    
Entitys2.Screen.Reload();
                }
                else
                    
End();
            }

            public 
void Export()
            {
                
Groups.Remove(ID);

                if (
dynamicMap != null)
                    
dynamicMap.Dispose();


                
Entitys1.Entity.Teleport(Lobby.Map.ID, (ushort)Kernel.Random.Next(3570), (ushort)Kernel.Random.Next(3570));
                
Entitys2.Entity.Teleport(Lobby.Map.ID, (ushort)Kernel.Random.Next(3570), (ushort)Kernel.Random.Next(3570));


                
Entitys1.Entity.Ressurect();
                
Entitys2.Entity.Ressurect();

                
Entitys1.Entity.PKMode P1Mode;
                
Entitys1.Send(new Data(true) { UID Entitys1.Entity.UIDID Data.ChangePKModedwParam = (uint)Entitys1.Entity.PKMode });
                
Entitys2.Entity.PKMode P2Mode;
                
Entitys2.Send(new Data(true) { UID Entitys2.Entity.UIDID Data.ChangePKModedwParam = (uint)Entitys2.Entity.PKMode });
                
Entitys1.LobbyGroup null;
                
Entitys2.LobbyGroup null;

                
Entitys1.Entity.ToxicFogLeft 0;
                
Entitys1.Entity.NoDrugsTime 0;
                
Entitys1.Entity.RemoveFlag(Update.Flags.Poisoned);
                
Entitys2.Entity.ToxicFogLeft 0;
                
Entitys2.Entity.NoDrugsTime 0;
                
Entitys2.Entity.RemoveFlag(Update.Flags.Poisoned);

                
Entitys1.endarena false;
                
Entitys2.endarena false;
            }

            public 
void End()
            {
                if (
Done) return;
                
Entitys1.endarena true;
                
Entitys2.endarena true;
                if (
Entitys1Damage Entitys2Damage)
                {
                    
Winner Entitys1;
                    
Loser Entitys2;
                }
                else
                {
                    
Winner Entitys2;
                    
Loser Entitys1;
                }
                var 
sign = new ArenaSignup();
                
sign.Stats Loser.Entity;
                
sign.DialogID ArenaSignup.MainIDs.Dialog;
                
sign.OptionID ArenaSignup.DialogButton.Lose;
                
Loser.Send(sign.BuildPacket());
                
sign.OptionID ArenaSignup.DialogButton.Win;
                
sign.Stats Winner.Entity;
                
Winner.Send(sign.BuildPacket());
                
Done true;
                
DoneStamp Time32.Now;
            }

            public 
void End(GameState loser)
            {
                if (
Done) return;
                
Entitys1.endarena true;
                
Entitys2.endarena true;
                if (
Entitys1.Entity.UID == loser.Entity.UID)
                {
                    
Winner Entitys2;
                    
Loser Entitys1;
                }
                else
                {
                    
Winner Entitys1;
                    
Loser Entitys2;
                }
                var 
sign = new ArenaSignup();
                
sign.Stats Loser.Entity;
                
sign.DialogID ArenaSignup.MainIDs.Dialog;
                
sign.OptionID ArenaSignup.DialogButton.Lose;
                
Loser.Send(sign.BuildPacket());
                
sign.OptionID ArenaSignup.DialogButton.Win;
                
sign.Stats Winner.Entity;
                
Winner.Send(sign.BuildPacket());
                
Done true;
                
DoneStamp Time32.Now;
            }
            public class 
ArenaSignup
            
{
                public abstract class 
MainIDs
                
{
                    public const 
uint ArenaIconOn 0,
                                        
ArenaIconOff 1,
                                        
StartCountDown 2,
                                        
OpponentGaveUp 4,
                                        
Match 6,
                                        
YouAreKicked 7,
                                        
StartTheFight 8,
                                        
Dialog 9,
                                        
Dialog2 10;
                }
                public abstract class 
DialogButton
                
{
                    public const 
uint Lose 3,
                                        
Win 1,
                                        
MatchOff 3,
                                        
MatchOn 5;
                }


                public 
ushort Type 2205;
                public 
uint DialogID;
                public 
uint OptionID;
                public 
Entity Stats;
                public 
byte[] BuildPacket()
                {
                    
MemoryStream strm = new MemoryStream();
                    
BinaryWriter wtr = new BinaryWriter(strm);
                    
wtr.Write((ushort)0);
                    
wtr.Write((ushort)Type);
                    
wtr.Write((uint)DialogID);
                    
wtr.Write((uint)OptionID);
                    
wtr.Write((uint)Stats.UID);
                    
byte[] array = Encoding.Default.GetBytes(Stats.Name);
                    for (
int i 020i++)
                    {
                        if (
Stats.Name.Length)
                        {
                            
wtr.Write(array[i]);
                        }
                        else
                            
wtr.Write((byte)0);
                    }
                    
wtr.Write((uint)Stats.Class);
                    
wtr.Write((uint)1);
                    
wtr.Write((uint)1000);
                    
wtr.Write((uint)Stats.Level);
                    
int packetlength = (int)strm.Length;
                    
strm.Position 0;
                    
wtr.Write((ushort)packetlength);
                    
strm.Position strm.Length;
                    
wtr.Write(Encoding.Default.GetBytes("TQServer"));
                    
strm.Position 0;
                    
byte[] buf = new byte[strm.Length];
                    
strm.Read(buf0buf.Length);
                    
wtr.Close();
                    
strm.Close();
                    return 
buf;
                }
            }
            public 
void UpdateDamage(GameState clientuint damage)
            {
                if (
client != null && Entitys1 != null)
                {
                    if (
client.Entity.UID == Entitys1.Entity.UID)
                    {
                        
Entitys1Damage += damage;
                    }
                    else
                    {
                        
Entitys2Damage += damage;
                    }
                    
Entitys1.Send(match.BuildPacket());
                    
Entitys2.Send(match.BuildPacket());
                }
            }
        }
    }


وجرب


الساعة الآن 12:29 AM

مرحبا بكم في منتدي اكواد لتطوير الالعاب