示例#1
0
    //public static readonly ulong FirstPart = 0x50;

    private static void readMonster(ulong monsterAddress, MonsterList list)
    {
        ulong  modelPtr = MemoryHelper.read_ulong(game.Handle, (UIntPtr)(monsterAddress + MONSTER_MODEL_OFFSET));
        string id       = MemoryHelper.read_string(game.Handle, (UIntPtr)(modelPtr + MONSTER_MODEL_ID_OFFSET), MONSTER_MODEL_ID_LENGTH); //TODO null byte

        if (id == "")
        {
            return;
        }


        id = id.Split('\\').Last();
        if (!isMonsterIDValid(id))
        {
            return;
        }

        ulong healthComponentAddress = MemoryHelper.read_ulong(game.Handle, (UIntPtr)(monsterAddress + MONSTER_PARTS_OFFSET + MONSTER_PART_HEALTH_OFFSET));
        float maxHealth = MemoryHelper.read_float(game.Handle, (UIntPtr)(healthComponentAddress + MONSTER_MAX_HEALTH_OFFSET));

        if (maxHealth <= 0)
        {
            return;
        }

        float currentHealth = MemoryHelper.read_float(game.Handle, (UIntPtr)(healthComponentAddress + MONSTER_CURRENT_HEALTH_OFFSET));
        float sizeScale     = MemoryHelper.read_float(game.Handle, (UIntPtr)(monsterAddress + MONSTER_SIZE_SCALE_OFFSET));


        list.updateOrAdd(monsterAddress, id, maxHealth, currentHealth, sizeScale);

        //monster = OverlayViewModel.Instance.MonsterWidget.Context.UpdateAndGetMonster(monsterAddress, id, maxHealth, currentHealth, sizeScale);

        //UpdateMonsterParts(process, monster);
        //UpdateMonsterRemovableParts(process, monster);
        //UpdateMonsterStatusEffects(process, monster);
    } // todo overflow