Example #1
0
        public void ProcessRequest(HttpContext context)
        {
            context.Response.Clear();
            using (Bitmap b = new Bitmap(95, 40, PixelFormat.Format32bppArgb))
            {
                using (Graphics g = Graphics.FromImage(b))
                {
                    Rectangle rect = new Rectangle(0, 0, 94, 39);
                    g.FillRectangle(Brushes.White, rect);

                    String drawCaptchaString = CharacterUtility.GenerateRandomString();
                    HttpContext.Current.Session["CAPTCHA_Contact"] = drawCaptchaString;

                    Font drawFont = new Font("Arial", 16, FontStyle.Italic | FontStyle.Strikeout);
                    using (SolidBrush drawBrush = new SolidBrush(Color.Black))
                    {
                        PointF drawPoint = new PointF(15, 10);

                        g.DrawRectangle(new Pen(Color.Red, 0), rect);
                        g.DrawString(drawCaptchaString, drawFont, drawBrush, drawPoint);
                    }
                    b.Save(context.Response.OutputStream, ImageFormat.Jpeg);
                    context.Response.ContentType = "image/jpeg";
                    context.Response.End();
                }
            }
        }
Example #2
0
 public virtual void UpdateState(Character c, UserInput input, RaycastHit2D[] info)
 {
     yCorr = 0;
     CharacterUtility.CastRayAndOrientPlayer(c, info, out angle, out yCorr);
     c.groundCollisionCorrection = yCorr;
     //Animation for touching the ground is false by default
     c.playerSprite.GetComponent <Animator>().SetFloat("JumpSpeed", c.currentJumpSpeed);
 }
Example #3
0
 public MainClass(DalamudPluginInterface pluginInterface)
 {
     Dalamud.Initialize(pluginInterface);
     DevPenumbraExists      = CheckDevPluginPenumbra();
     IsNotInstalledPenumbra = CheckIsNotInstalled();
     GameData.GameData.GetIdentifier(Dalamud.GameData, Dalamud.ClientState.ClientLanguage);
     _characterUtility = new CharacterUtility();
     _characterUtility.LoadingFinished += ()
                                          => _penumbra = new Penumbra(_characterUtility);
 }
Example #4
0
 public virtual void BlockInputs(float duration, bool horizontal, bool vertical)
 {
     //Debug.Log("meh");
     if (blockRoutine != null)
     {
         StopCoroutine(blockRoutine);
         blockRoutine = null;
     }
     blockRoutine = StartCoroutine(CharacterUtility.BlockInputs(this, horizontal, vertical, true, duration));
 }
Example #5
0
 public virtual void BlockInputs()
 {
     //Debug.Log("meh");
     if (blockRoutine != null)
     {
         StopCoroutine(blockRoutine);
         blockRoutine = null;
     }
     blockRoutine = StartCoroutine(CharacterUtility.BlockInputs(this, true, true, true, 0.3f));
 }
    private void SetSkillModificators(CharacteristicType characteristic, int value)
    {
        SkillType skills = CharacterUtility.GetSkillsByCharacteristic(characteristic);

        foreach (var skillHolder in characterHolder.skills)
        {
            if ((skills & skillHolder.type) == skillHolder.type)
            {
                SetSkillModificator(skillHolder);
            }
        }
    }
Example #7
0
    private void SetHitDices()
    {
        var sheet = characterSheetController.Character;

        characterHolder.diceTypeText.text = TextUtility.GetDiceValueString(1, CharacterUtility.GetDiceTypeByClass(sheet.Type));

        int level = CharacterValuesUtility.CalculateLevel(sheet.ExpiriencePoints);

        if (sheet.HitDiceCount > level)
        {
            sheet.HitDiceCount = level;
        }
        characterHolder.dicesValueText.text = TextUtility.GetValueAndMaxString(sheet.HitDiceCount, level);
    }
Example #8
0
    public ExpandedEqdpFile(GenderRace raceCode, bool accessory)
        : base(CharacterUtility.EqdpIdx(raceCode, accessory))
    {
        var def             = ( byte * )DefaultData.Data;
        var blockSize       = *( ushort * )(def + IdentifierSize);
        var totalBlockCount = *( ushort * )(def + IdentifierSize + 2);
        var totalBlockSize  = blockSize * EqdpEntrySize;

        DataOffset = IdentifierSize + PreambleSize + totalBlockCount * BlockHeaderSize;

        var fullLength = DataOffset + totalBlockCount * totalBlockSize;

        fullLength += (FileAlignment - (fullLength & (FileAlignment - 1))) & (FileAlignment - 1);
        AllocateData(fullLength);
        Reset();
    }
Example #9
0
    public bool Disable()
    {
        if (!Config.EnableMods)
        {
            return(false);
        }

        Config.EnableMods = false;
        ResourceLoader.DisableReplacements();
        CharacterUtility.ResetAll();
        ResidentResources.Reload();
        PathResolver.Disable();

        Config.Save();
        ObjectReloader.RedrawAll(RedrawType.Redraw);
        return(true);
    }
    private void SetSkillModificator(SkillHolder skillHolder)
    {
        var sheet = characterSheetController.Character;

        var  skillCharacteristic = CharacterUtility.GetCharacteristicBySkill(skillHolder.type);
        int  characteristicValue = sheet[skillCharacteristic];
        bool isOwned             = (sheet.PersonalSkills & skillHolder.type) == skillHolder.type;
        int  modificator         = CharacterValuesUtility.GetCharacteristicModificator(characteristicValue);

        if (isOwned)
        {
            int level = CharacterValuesUtility.CalculateLevel(sheet.ExpiriencePoints);
            modificator += CharacterValuesUtility.GetMasteryBonus(level);
        }

        skillHolder.valueText.text    = TextUtility.GetSignedValueString(modificator);
        skillHolder.toggleButton.isOn = isOwned;
    }
Example #11
0
    private void SetSavingThrowModificator(SavingThrowHolder savingThrow)
    {
        var sheet = characterSheetController.Character;

        int characteristicValue = sheet[savingThrow.characteristic];
        int modificator         = CharacterValuesUtility.GetCharacteristicModificator(characteristicValue);

        var  baseSavingThrows = CharacterUtility.GetSavingThrowsByClass(sheet.Type);
        bool isOwned          = baseSavingThrows.Contains(savingThrow.characteristic);

        if (isOwned)
        {
            int level = CharacterValuesUtility.CalculateLevel(sheet.ExpiriencePoints);
            modificator += CharacterValuesUtility.GetMasteryBonus(level);
        }

        savingThrow.valueText.text = TextUtility.GetSignedValueString(modificator);
        savingThrow.toggle.isOn    = isOwned;
    }
Example #12
0
    public void Dispose()
    {
        DisposeInterface();
        Ipc.Dispose();
        Api.Dispose();
        ObjectReloader.Dispose();
        ModFileSystem.Dispose();
        CollectionManager.Dispose();

        Dalamud.Commands.RemoveHandler(CommandName);

        PathResolver.Dispose();
        ResourceLogger.Dispose();
        MetaFileManager.Dispose();
        ResourceLoader.Dispose();
        CharacterUtility.Dispose();

        ShutdownWebServer();
    }
    public void Show(CharacterSheet sheet)
    {
        diceTypeText.text = TextUtility.GetDiceValueString(1, CharacterUtility.GetDiceTypeByClass(sheet.Type));
        SetHitDicesCount(sheet);

        okButton.onClick.AddListener(() =>
        {
            OnOkPressed?.Invoke();
            Destroy(this.gameObject);
        });
        useDiceButton.onClick.AddListener(() =>
        {
            OnUseDicePressed?.Invoke();
            SetHitDicesCount(sheet);
        });
        resetDicesButton.onClick.AddListener(() =>
        {
            OnResetDicesPressed?.Invoke();
            SetHitDicesCount(sheet);
        });
    }
Example #14
0
    public Penumbra(CharacterUtility characterUtility)
    {
        CharacterUtility = characterUtility;

        Framework = new FrameworkManager();
        Backup.CreateBackup(PenumbraBackupFiles());
        Config = Configuration.Load();

        MusicManager = new MusicManager();
        if (Config.DisableSoundStreaming)
        {
            MusicManager.DisableStreaming();
        }

        ResidentResources = new ResidentResourceManager();
        Redirects         = new SimpleRedirectManager();
        MetaFileManager   = new MetaFileManager();
        ResourceLoader    = new ResourceLoader(this);
        ResourceLogger    = new ResourceLogger(ResourceLoader);
        ModManager        = new Mod.Manager(Config.ModDirectory);
        ModManager.DiscoverMods();
        CollectionManager = new ModCollection.Manager(ModManager);
        ModFileSystem     = ModFileSystem.Load();
        ObjectReloader    = new ObjectReloader();
        PathResolver      = new PathResolver(ResourceLoader);

        Dalamud.Commands.AddHandler(CommandName, new CommandInfo(OnCommand)
        {
            HelpMessage = "/penumbra - toggle ui\n/penumbra reload - reload mod file lists & discover any new mods",
        });

        ResidentResources.Reload();

        SetupInterface(out _configWindow, out _launchButton, out _windowSystem);

        if (Config.EnableHttpApi)
        {
            CreateWebServer();
        }

        ResourceLoader.EnableHooks();
        if (Config.EnableMods)
        {
            ResourceLoader.EnableReplacements();
            PathResolver.Enable();
        }

        if (Config.DebugMode)
        {
            ResourceLoader.EnableDebug();
            _configWindow.IsOpen = true;
        }

        if (Config.EnableFullResourceLogging)
        {
            ResourceLoader.EnableFullLogging();
        }

        ResidentResources.Reload();

        Api = new PenumbraApi(this);
        Ipc = new PenumbraIpc(Dalamud.PluginInterface, Api);
        SubscribeItemLinks();
        if (ImcExceptions > 0)
        {
            PluginLog.Error($"{ImcExceptions} IMC Exceptions thrown. Please repair your game files.");
        }
        else
        {
            PluginLog.Information($"Penumbra Version {Version}, Commit #{CommitHash} successfully Loaded.");
        }
    }
Example #15
0
        public ContentResult GetRandomString()
        {
            string rndStr = CharacterUtility.GenerateRandomString().ToString();

            return(Content(rndStr));
        }
Example #16
0
 public ExpandedEqdpFile?File(GenderRace race, bool accessory)
 => Files[Array.IndexOf(CharacterUtility.EqdpIndices, CharacterUtility.EqdpIdx(race, accessory))];           // TODO: female Hrothgar
Example #17
0
 public static EqdpEntry GetDefault(GenderRace raceCode, bool accessory, int setIdx)
 => GetDefault(CharacterUtility.EqdpIdx(raceCode, accessory), setIdx);
Example #18
0
        public Character GetCharacter(Region region, string realm, string name, CharacterOptions characterOptions)
        {
            Character character;

            TryGetData <Character>(
                string.Format(@"{0}/wow/character/{1}/{2}?locale={3}{4}&apikey={5}", Host, realm, name, Locale, CharacterUtility.buildOptionalQuery(characterOptions), APIKey),
                out character);

            return(character);
        }
Example #19
0
    private void SetSpeed()
    {
        var sheet = characterSheetController.Character;

        characterHolder.speedValueText.text = CharacterUtility.GetSpeedByRace(sheet.Race).ToString();
    }