Beispiel #1
0
        public static void Main(string[] args)
        {
            var arguments = ParseArguments(args);
            if (arguments == null)
            {
                return;
            }

            var engine = BuildEngine();

            var info = new StartInfo
            {
                Server = arguments.Server,
                Startup = arguments.Startup,
                OutputFile = arguments.OutputFile,
                Url = arguments.Url,
                Scheme = arguments.Scheme,
                Host = arguments.Host,
                Port = arguments.Port,
                Path = arguments.Path,
            };

            var server = engine.Start(info);

            info.Output.WriteLine("Started at {0}", info.Url);
            if (IsInputRedirected)
            {
                // read a single line that will never arrive, I guess...
                // what's the best way to signal userless console process to exit?

                Console.ReadLine();
            }
            else
            {
                HandleBreak(server.Dispose);

                while (true)
                {
                    var key = Console.ReadKey(true);
                    if (key.Key == ConsoleKey.Escape)
                    {
                        break;
                    }
                }
            }
            server.Dispose();
        }
Beispiel #2
0
        public override void Start(StartInfo startInfo = null)
        {
            base.Start();

            Log("Move cell selection...");

            Combat.MainMenu.Close();
            Combat.InfoPanel.Close();

            Combat.Cursor.Open();

            Combat.Cursor.OnValidation += new CombatCursorEventHandler(Cursor_OnValidation);
            Combat.Cursor.OnCancellation += new CombatCursorEventHandler(Cursor_OnCancellation);

            CurrentCellPosition = CurrentCombatant.CellPosition;

            Combat.AddCellColorEffect(new CellArea(CellAreaType.Circle, 1, (int)CurrentCombatant.Status[BaseCaracteristic.Mp]), CurrentCombatant.CellPosition, CellSelectionType.Move);
        }
Beispiel #3
0
        public override void Start(StartInfo startInfo = null)
        {
            SpellIsPerforming = false;

            Log("Spell cell selection... [" + startInfo.GetArg<string>("Spell") + "]");

            Combat.DesactivateMainMenu();

            Combat.Cursor.SetCellPosition(CurrentCombatant.CellPosition);

            Combat.Cursor.OnValidation += new CombatCursorEventHandler(Cursor_OnValidation);
            Combat.Cursor.OnCancellation += new CombatCursorEventHandler(Cursor_OnCancellation);
            Combat.Cursor.OnMove += new CombatCursorMoveEventHandler(Cursor_OnMove);

            CurrentSpell = CurrentCombatant.SpellPanoply.GetSpell(startInfo.GetArg<string>("Spell"));
            Combat.AddCellColorEffect(CurrentSpell.RangeArea, CurrentCombatant.CellPosition, CellSelectionType.SpellRange);

            if (Combat.GetCell(CurrentCombatant.CellPosition).IsWithinArea(CurrentSpell.RangeArea, CurrentCombatant.CellPosition))
                Combat.AddCellColorEffect(CurrentSpell.EffectArea, CurrentCombatant.CellPosition, CellSelectionType.SpellArea);
            else
                Combat.AddCellColorEffect(CurrentSpell.EffectArea, CurrentCombatant.CellPosition, CellSelectionType.OutOfRange);
        }
Beispiel #4
0
        public static void Main(string[] args)
        {
            var arguments = ParseArguments(args);
            if (arguments == null)
            {
                return;
            }

            var engine = BuildEngine();

            var info = new StartInfo
            {
                Server = arguments.Server,
                Startup = arguments.Startup,
                OutputFile = arguments.OutputFile,
                Url = arguments.Url,
                Scheme = arguments.Scheme,
                Host = arguments.Host,
                Port = arguments.Port,
                Path = arguments.Path,
            };

            var server = engine.Start(info);
            HandleBreak(server.Dispose);

            info.Output.WriteLine("Started at {0}", info.Url);
            while (true)
            {
                var key = Console.ReadKey(true);
                if (key.Key == ConsoleKey.Escape)
                {
                    break;
                }
            }
            server.Dispose();
        }
 public BlockSet(Field[,] FieldInfo, StartInfo Start)
 {
     Fields     = FieldInfo;
     this.Start = Start;
 }
Beispiel #6
0
 public override void Start(StartInfo startInfo = null)
 {
     Log("Fury");
 }
Beispiel #7
0
 public override void Start(StartInfo startInfo = null)
 {
     Log("Turn is over...");
     Combat.ChangeState(BlazeraLib.Combat.EState.TurnStart);
 }
 public void AddStartInfoCache(StartInfo StartInfo)
 {
     var key = string.Format("{0}_{1}", StartInfo.Race, StartInfo.Class);
     if (!StartInfoCache.ContainsKey(key)) StartInfoCache.Add(key, StartInfo);
 }
Beispiel #9
0
 public override void Start(StartInfo startInfo = null)
 {
     Log("Turn starts...");
     Combat.InfoPanel.BuildBox("Combatant", new InfoPanelBox.BuildInfo(new System.Collections.Generic.Dictionary<string, object>() { { "Combatant", CurrentCombatant } }));
     Combat.ChangeState(BlazeraLib.Combat.EState.ActionSelection);
 }
Beispiel #10
0
 public LogDialogFactory(StartInfo dialogStartInfo) : this()
 {
     SetDialogInfo(dialogStartInfo);
 }
Beispiel #11
0
 public override void Start(StartInfo startInfo = null)
 {
     Combat.Start();
     Combat.ChangeState(BlazeraLib.Combat.EState.TurnStart);
 }
        public override bool Parse()
        {
            ResetPosition();

            Core.Cache.CharacterInfoCache.Clear();

            var count = ReadByte("count");

            for (var i = 0; i < count; i++)
            {
                var guid = ReadWoWGuid("guid");
                var name = ReadCString("name");
                var race = Read<Race>("Race");
                var clss = ReadEnum<Class>("Class");
                var gender = ReadEnum<Gender>("Gender");
                var skin = ReadByte("skin");
                var face = ReadByte("face");
                var hairStyle = ReadByte("hairStyle");
                var hairColor = ReadByte("hairColor");
                var facialHair = ReadByte("facialHair");
                var level = ReadByte("level");
                var zone = ReadInt32("zone");
                var mapId = ReadInt32("mapId");
                var pos = ReadVector3("pos");
                var guild = ReadInt32("guild");
                var flags = ReadEnum<CharacterFlags>("CharacterFlags");
                var customize = ReadEnum<CharacterCustomizeFlags>("CharacterCustomizeFlags");
                var firstLogin = ReadBoolean("firstLogin");
                var petDispId = ReadInt32("petDispId");
                var petLevel = ReadInt32("petLevel");
                var petFamily = ReadEnum<CreatureFamily>("CreatureFamily", TypeCode.Int32);

                for (var j = 0; j < 19; j++)
                {
                    var dispId = ReadInt32("dispId");
                    var invType = ReadEnum<InventoryType>("invType");
                    var auraId = ReadInt32("auraId");
                }

                for (var j = 0; j < 4; j++)
                {
                    var bagDispId = ReadInt32("bagDispId");

                    var bagInvType = ReadEnum<InventoryType>("bagInvType");

                    var bagAuraId = ReadInt32("bagAuraId");
                }

                if (firstLogin)
                {
                    var key = string.Format("{0}_{1}", race, clss);

                    if (!Core.Cache.StartInfoCache.ContainsKey(key))
                    {
                        var startInfo = new StartInfo();

                        startInfo.Race = race;
                        startInfo.Class = clss;
                        startInfo.Position = pos;
                        startInfo.Map = mapId;
                        startInfo.Zone = zone;

                        Core.Cache.AddStartInfoCache(startInfo);

                        //Store.WriteData(Store.StartPositions.GetCommand(race, clss, mapId, zone, pos));
                    }
                }

                var chInfo = new CharacterInfo();
                chInfo.Guid = guid;
                chInfo.Race = race;
                chInfo.Class = clss;
                chInfo.Name = name;
                chInfo.FirstLogin = firstLogin;
                chInfo.Level = level;
                Core.Cache.AddCharacterInfo(chInfo);


            }

            return Validate();
        }
        public static void HandleCharEnum(Packet packet)
        {
            Characters.Clear();

            var count = packet.ReadByte("Count");

            for (var i = 0; i < count; i++)
            {
                var guid = packet.ReadGuid("GUID");
                var name = packet.ReadCString("Name");
                var race = packet.ReadEnum <Race>("Race", TypeCode.Byte);
                var clss = packet.ReadEnum <Class>("Class", TypeCode.Byte);
                packet.ReadEnum <Gender>("Gender", TypeCode.Byte);

                packet.ReadByte("Skin");
                packet.ReadByte("Face");
                packet.ReadByte("Hair Style");
                packet.ReadByte("Hair Color");
                packet.ReadByte("Facial Hair");

                var level = packet.ReadByte("Level");
                var zone  = packet.ReadInt32("Zone Id");
                var mapId = packet.ReadEntryWithName <Int32>(StoreNameType.Map, "Map ID");

                var pos = packet.ReadVector3("Position");
                packet.ReadInt32("Guild Id");
                packet.ReadEnum <CharacterFlag>("Character Flags", TypeCode.Int32);

                if (ClientVersion.AddedInVersion(ClientVersionBuild.V3_0_2_9056))
                {
                    packet.ReadEnum <CustomizationFlag>("Customization Flags", TypeCode.Int32);
                }

                var firstLogin = packet.ReadBoolean("First Login");
                packet.ReadInt32("Pet Display Id");
                packet.ReadInt32("Pet Level");
                packet.ReadEnum <CreatureFamily>("Pet Family", TypeCode.Int32);

                for (var j = 0; j < 19; j++)
                {
                    packet.ReadInt32("Equip Display Id");
                    packet.ReadEnum <InventoryType>("Equip Inventory Type", TypeCode.Byte);
                    packet.ReadInt32("Equip Aura Id");
                }

                int bagCount = ClientVersion.AddedInVersion(ClientVersionBuild.V3_3_3_11685) ? 4 : 1;
                for (var j = 0; j < bagCount; j++)
                {
                    packet.ReadInt32("Bag Display Id");
                    packet.ReadEnum <InventoryType>("Bag Inventory Type", TypeCode.Byte);
                    packet.ReadInt32("Bag Aura Id");
                }

                bool all = true;
                foreach (StartInfo info in StartInfos)
                {
                    if (info.Race == race || info.Class == clss)
                    {
                        all = false;
                        break;
                    }
                }
                if (firstLogin && all)
                {
                    var startInfo = new StartInfo
                    {
                        StartPos = new StartPos
                        {
                            Map      = mapId,
                            Position = pos,
                            Zone     = zone
                        }
                    };

                    Stuffing.StartInformation.TryAdd(new Tuple <Race, Class>(race, clss), startInfo);
                    SQLStore.WriteData(SQLStore.StartPositions.GetCommand(race, clss, mapId, zone, pos));
                }

                var chInfo = new Player
                {
                    Race       = race,
                    Class      = clss,
                    Name       = name,
                    FirstLogin = firstLogin,
                    Level      = level
                };

                Characters.Add(guid, chInfo); // TODO Remove when its usage is converted to Stuffing.Objects
                Stuffing.Objects.TryAdd(guid, chInfo);
            }
        }
Beispiel #14
0
 public override void Start(StartInfo startInfo = null)
 {
 }
        protected sealed override bool run()
        {
            var startInfo = StartInfo.GetValue();

            using (var process = new Process()
            {
                StartInfo = startInfo
            })
            {
                if (DataReceiveAction != null)
                {
                    process.OutputDataReceived += (_, e) => DataReceiveAction.GetValue()(e);
                }

                if (ErrorReceiveAction != null)
                {
                    process.ErrorDataReceived += (_, e) => ErrorReceiveAction.GetValue()(e);
                }

                if (!process.Start())
                {
                    return(false);
                }

                if (startInfo.RedirectStandardOutput)
                {
                    process.BeginOutputReadLine();
                }

                if (startInfo.RedirectStandardError)
                {
                    process.BeginErrorReadLine();
                }

                if (Timeout == null)
                {
                    process.WaitForExit();
                }
                else
                {
                    process.WaitForExit(Timeout.GetValue());
                }

                if (startInfo.RedirectStandardInput)
                {
                    process.CancelOutputRead();
                }

                if (startInfo.RedirectStandardError)
                {
                    process.CancelErrorRead();
                }

                var exitCode = process.ExitCode;

                if (ExitCode != null)
                {
                    ExitCode.SetValue <int>(exitCode);
                }

                if (StartTime != null)
                {
                    StartTime.SetValue <DateTime>(process.StartTime);
                }

                if (ExitTime != null)
                {
                    ExitTime.SetValue <DateTime>(process.ExitTime);
                }

                if (ResultConverter == null)
                {
                    return(exitCode == 0);
                }
                else
                {
                    return(ResultConverter.Convert(exitCode));
                }
            }
        }
    private void OnData(DataStreamReader stream)
    {
        NativeArray <byte> message = new NativeArray <byte>(stream.Length, Allocator.Temp);

        stream.ReadBytes(message);
        string returnData = Encoding.ASCII.GetString(message.ToArray());

        NetworkHeader header = new NetworkHeader();

        try
        {
            header = JsonUtility.FromJson <NetworkHeader>(returnData);
        }
        catch (System.ArgumentException e)
        {
            Debug.LogError(e.ToString() + "\nHeader loading failed. Disconnect");
            Disconnect();
            return;
        }

        try
        {
            switch (header.cmd)
            {
            case Command.Start:
                StartInfo startInfo = JsonUtility.FromJson <StartInfo>(returnData);
                GameManager.instance.CreatePlayer();
                break;

            case Command.Connect:
                ConnectInfo connectInfo = JsonUtility.FromJson <ConnectInfo>(returnData);
                ID = connectInfo.playerID;
                UIManager.instance.ChangeBackground(ID);
                Debug.Log(ID);
                break;

            case Command.Drop:
                DropInfo dropInfo = JsonUtility.FromJson <DropInfo>(returnData);
                //TODO Game end
                break;

            case Command.Turn:
                Turn turn = JsonUtility.FromJson <Turn>(returnData);
                GameManager.instance.Turn(turn.playerID == ID);
                break;

            case Command.Result:
                Result result = JsonUtility.FromJson <Result>(returnData);
                GridManager.instance.ReflectResult(result);
                break;

            case Command.Timer:
                Timer timer = JsonUtility.FromJson <Timer>(returnData);
                TimerScript.instance.UpdateTimer(timer.timer);
                break;

            case Command.Chat:
                Chat chat = JsonUtility.FromJson <Chat>(returnData);
                //chat.chatMessage = chat.RemoveQuestionMark(chat.chatMessage);
                Debug.Log("Chat " + chat.chatMessage);
                ChatScript.instance.AddText(chat.chatMessage);
                break;

            default:
                Debug.Log("Error");
                break;
            }
        }
        catch (System.Exception e)
        {
            Debug.LogError(e.ToString() + "\nMessage contents loading failed. Disconnecting.\nReturn Data : " + returnData);
            Disconnect();
            return;
        }
    }
Beispiel #17
0
 public static void StartDataSourceProccess(StartInfo info)
 {
     Start(FilePath, info.ToString());
 }
Beispiel #18
0
 public override void Start(StartInfo startInfo = null)
 {
     Log("Explore cell selection...");
 }