Beispiel #1
0
        public static void HandleDebugEchoFlags(Session session, params string[] parameters)
        {
            try
            {
                string debugOutput = "";
                if (parameters?.Length == 2)
                {
                    switch (parameters[0].ToLower())
                    {
                    case "descriptionflags":
                        ObjectDescriptionFlag objectDescFlag = new ObjectDescriptionFlag();
                        objectDescFlag = (ObjectDescriptionFlag)Convert.ToUInt32(parameters[1]);

                        debugOutput = $"{objectDescFlag.GetType().Name} = {objectDescFlag.ToString()}" + " (" + (uint)objectDescFlag + ")";
                        break;

                    case "weenieflags":
                        WeenieHeaderFlag weenieHdr = new WeenieHeaderFlag();
                        weenieHdr = (WeenieHeaderFlag)Convert.ToUInt32(parameters[1]);

                        debugOutput = $"{weenieHdr.GetType().Name} = {weenieHdr.ToString()}" + " (" + (uint)weenieHdr + ")";
                        break;

                    case "weenieflags2":
                        WeenieHeaderFlag2 weenieHdr2 = new WeenieHeaderFlag2();
                        weenieHdr2 = (WeenieHeaderFlag2)Convert.ToUInt32(parameters[1]);

                        debugOutput = $"{weenieHdr2.GetType().Name} = {weenieHdr2.ToString()}" + " (" + (uint)weenieHdr2 + ")";
                        break;

                    case "positionflag":
                        UpdatePositionFlag posFlag = new UpdatePositionFlag();
                        posFlag = (UpdatePositionFlag)Convert.ToUInt32(parameters[1]);

                        debugOutput = $"{posFlag.GetType().Name} = {posFlag.ToString()}" + " (" + (uint)posFlag + ")";
                        break;

                    case "type":
                        ItemType objectType = new ItemType();
                        objectType = (ItemType)Convert.ToUInt32(parameters[1]);

                        debugOutput = $"{objectType.GetType().Name} = {objectType.ToString()}" + " (" + (uint)objectType + ")";
                        break;

                    case "containertype":
                        ContainerType contType = new ContainerType();
                        contType = (ContainerType)Convert.ToUInt32(parameters[1]);

                        debugOutput = $"{contType.GetType().Name} = {contType.ToString()}" + " (" + (uint)contType + ")";
                        break;

                    case "usable":
                        Usable usableType = new Usable();
                        usableType = (Usable)Convert.ToInt64(parameters[1]);

                        debugOutput = $"{usableType.GetType().Name} = {usableType.ToString()}" + " (" + (Int64)usableType + ")";
                        break;

                    case "radarbehavior":
                        RadarBehavior radarBeh = new RadarBehavior();
                        radarBeh = (RadarBehavior)Convert.ToUInt32(parameters[1]);

                        debugOutput = $"{radarBeh.GetType().Name} = {radarBeh.ToString()}" + " (" + (uint)radarBeh + ")";
                        break;

                    case "physicsdescriptionflags":
                        PhysicsDescriptionFlag physicsDescFlag = new PhysicsDescriptionFlag();
                        physicsDescFlag = (PhysicsDescriptionFlag)Convert.ToUInt32(parameters[1]);

                        debugOutput = $"{physicsDescFlag.GetType().Name} = {physicsDescFlag.ToString()}" + " (" + (uint)physicsDescFlag + ")";
                        break;

                    case "physicsstate":
                        PhysicsState physState = new PhysicsState();
                        physState = (PhysicsState)Convert.ToUInt32(parameters[1]);

                        debugOutput = $"{physState.GetType().Name} = {physState.ToString()}" + " (" + (uint)physState + ")";
                        break;

                    case "validlocations":
                        EquipMask locFlags = new EquipMask();
                        locFlags = (EquipMask)Convert.ToUInt32(parameters[1]);

                        debugOutput = $"{locFlags.GetType().Name} = {locFlags.ToString()}" + " (" + (uint)locFlags + ")";
                        break;

                    case "currentwieldedlocation":
                        EquipMask locFlags2 = new EquipMask();
                        locFlags2 = (EquipMask)Convert.ToUInt32(parameters[1]);

                        debugOutput = $"{locFlags2.GetType().Name} = {locFlags2.ToString()}" + " (" + (uint)locFlags2 + ")";
                        break;

                    case "priority":
                        CoverageMask covMask = new CoverageMask();
                        covMask = (CoverageMask)Convert.ToUInt32(parameters[1]);

                        debugOutput = $"{covMask.GetType().Name} = {covMask.ToString()}" + " (" + (uint)covMask + ")";
                        break;

                    case "radarcolor":
                        RadarColor radarBlipColor = new RadarColor();
                        radarBlipColor = (RadarColor)Convert.ToUInt32(parameters[1]);

                        debugOutput = $"{radarBlipColor.GetType().Name} = {radarBlipColor.ToString()}" + " (" + (uint)radarBlipColor + ")";
                        break;

                    default:
                        debugOutput = "No valid type to test";
                        break;
                    }

                    if (session == null)
                    {
                        Console.WriteLine(debugOutput.Replace(", ", " | "));
                    }
                    else
                    {
                        session.Network.EnqueueSend(new GameMessageSystemChat(debugOutput, ChatMessageType.System));
                    }
                }
            }
            catch (Exception)
            {
                string debugOutput = "Exception Error, check input and try again";
                if (session == null)
                {
                    Console.WriteLine(debugOutput.Replace(", ", " | "));
                }
                else
                {
                    session.Network.EnqueueSend(new GameMessageSystemChat(debugOutput, ChatMessageType.System));
                }
            }
        }