text:
var assert = require('assert')
var base85 = require('base85')

exports.pack = function(packSpec) {
    return Buffer.concat(packSpec.map(function(pair) {
        return packSingle[pair[0]](pair[1])
    }))
}

var packSingle = {}

packSingle.I = function(data) {
    var b = new Buffer(4)
    b.writeUInt32BE(data, 0)
    return b
}

packSingle.S = function(data) {
    var b = new Buffer(2)
    b.writeInt16BE(data.length, 0)
    return Buffer.concat([b, new Buffer(data)])
}

packSingle.G = function(data) {
    assert.ok(Buffer.isBuffer(data))
    assert.equal(data.length, 5)
    return data
}

exports.unpack = function(b) {
    //console.log("Unpack!")
    var off = 0

    var id = []
    off = unpackSingle.i(b, 0, id)

    var name = []
    off = unpackSingle.s(b, off, name)

    var level = []
    off = unpackSingle.i(b, off, level)
    var online = []
    off = unpackSingle.i(b, off, online)

    assert.equal(off, b.length)

    assert.equal(id.length, name.length)
    assert.equal(id.length, level.length)
    assert.equal(id.length, level.length)
    assert.equal(id.length, online.length)

    var chars = {}

    for (var i = 0; i < id.length; i++) {
        chars[name[i]] = {
            name: name[i],
            id: id[i],
            level: level[i],
            online: online[i]
        }
    }
    return chars
}

exports.unpackError = function(b) {
    var out = []
    unpackSingle.S(b, 0, out)
    console.log(out[0])
}

function Unpacker(b) {
    this.off = 0
    this.b = b
}

exports.Unpacker = Unpacker

Unpacker.prototype.I = function() {
    var ret = this.b.readInt32BE(this.off)
    this.off += 4
    return ret
}

Unpacker.prototype.S = function() {
    var len = this.b.readInt16BE(this.off)
    this.off += 2
    var ret = this.b.slice(this.off, this.off + len).toString()
    this.off += len
    return ret
}

Unpacker.prototype.eS = function() {
    var len = this.b.readUInt8(this.off)
    this.off += 1
    var ret = this.b.slice(this.off, this.off + len - 1).toString()
    this.off += len
    assert.ok(this.off <= this.b.length, JSON.stringify({
        off: this.off,
        length: this.b.length
    }))
    return ret
}

Unpacker.prototype.extMsg = function(ootext) {
    assert.ok(ootext.length > 0)

    if (String.fromCharCode(ootext[0]) != '~') {
        return {
            text: ootext.toString()
        }
    }

    assert.ok(ootext.length > 3)

    assert.equal(String.fromCharCode(ootext[1]), '&')
    assert.equal(String.fromCharCode(ootext[ootext.length - 1]), '~')

    var text = '<~' + ootext.slice(2, 12).toString() + '~>'

    var uu = new Unpacker(base85.decode(text, 'ascii85'))
    var cat = uu.I()

    var instance = uu.I().toString(16)

    return {
        category: cat,
        instance: instance,
        u: new Unpacker(ootext.slice(13))
    }

}

Unpacker.prototype.E = function() {
    var len = this.b.readInt16BE(this.off)
    this.off += 2
    var ret = this.b.slice(this.off, this.off + len)
    this.off += len

    return ret
}

Unpacker.prototype.G = function() {
    var ret = this.b.slice(this.off, this.off + 5)
    this.off += 5
    return ret
}

Unpacker.prototype.done = function() {
    assert.equal(this.off, this.b.length)
}

var unpackSingle = {}

unpackSingle.i = function(b, off, out) {
    var len = b.readInt16BE(off)
    off += 2

    for (var i = 0; i < len; i++) {
        out.push(b.readInt32BE(off))
        off += 4
    }

    return off
}

unpackSingle.s = function(b, off, out) {
    var len = b.readInt16BE(off)
    off += 2

    var slen

    for (var i = 0; i < len; i++) {
        slen = b.readInt16BE(off)
        off += 2

        out.push(b.slice(off, off + slen).toString())
        off += slen
    }

    return off
}

unpackSingle.S = function(b, off, out) {
    var len = b.readInt16BE(off)
    off += 2
    out.push(b.slice(off, off + len).toString())
    off += len
}

unpackSingle.I = function(b, off, out) {

}


text:
<?php

namespace Nails\Cms\Factory\Monitor;

/**
 * Class Item
 *
 * @package Nails\Cms\Factory\Monitor
 */
class Item
{
    /** @var string */
    public $slug;

    /** @var string */
    public $label;

    /** @var string */
    public $description;

    /** @var int */
    public $usages;

    /** @var bool */
    public $is_deprecated;

    /** @var string */
    public $alternative;

    // --------------------------------------------------------------------------

    /**
     * Item constructor.
     *
     * @param string $sSlug
     * @param string $sLabel
     * @param string $sDescription
     */
    public function __construct(
        string $sSlug,
        string $sLabel,
        string $sDescription,
        int $iUsages,
        bool $bIsDeprecated = false,
        string $sAlternative = ''
    ) {
        $this->slug          = $sSlug;
        $this->label         = $sLabel;
        $this->description   = $sDescription;
        $this->usages        = $iUsages;
        $this->is_deprecated = $bIsDeprecated;
        $this->alternative   = $sAlternative;
    }
}

redpajama_set_name: RedPajamaGithub


text:
export class RioLoginForm {

  static selector = 'rioLoginForm';

  static options: ng.IComponentOptions = {
    bindings: {
      onSubmit: '&',
      hasError: '<',
      isPending: '<',
    },
    controller: RioLoginForm,
    controllerAs: 'loginFormCtrl',
    template: `
      <rio-form
        name="loginFormCtrl.loginForm"
        on-submit="loginFormCtrl.handleSubmit(form)">

        <rio-alert
          status="error"
          testid="alert-pending"
          ng-if="loginFormCtrl.isPending">
          Loading...
        </rio-alert>

        <rio-alert
          qaid="qa-alert"
          testid="alert-error"
          status="error"
          ng-if="loginFormCtrl.hasError">
          Invalid username and password
        </rio-alert>

        <rio-form-group testid="login-username">
          <rio-label qaid="qa-uname-label">Username</rio-label>
          <rio-input
            qaid="qa-uname-input"
            type="text"
            placeholder="Username"
            input-name="username"
            ng-model="loginFormCtrl.credentials.username"
            required="true">
          </rio-input>
          <rio-form-error
            qaid="qa-uname-validation"
            ng-if="loginFormCtrl.showNameWarning()">
            Username is required.
          </rio-form-error>
        </rio-form-group>

        <rio-form-group testid="login-password">
          <rio-label qaid="qa-password-label">Password</rio-label>
          <rio-input
            qaid="qa-password-input"
            type="password"
            input-name="password"
            placeholder="Password"
            ng-model="loginFormCtrl.credentials.password"
            required="true">
          </rio-input>
          <rio-form-error
            qaid="qa-password-validation"
            ng-if="loginFormCtrl.showPasswordWarning()">
            <div ng-if="loginFormCtrl.loginForm.password.$error.required">
              Password is required.
            </div>
          </rio-form-error>
        </rio-form-group>

        <rio-form-group testid="login-submit">
          <rio-button
            qaid="qa-login-button"
            type="submit"
            class-name="mr2">Login</rio-button>
          <rio-button
            qiad="qa-clear-button"
            type="reset"
            class-name="bg-red"
            ng-click="loginFormCtrl.clear()">
            Clear
          </rio-button>
        </rio-form-group>
      </rio-form>
    `
  };

  private onSubmit: Function;
  private credentials;
  private loginForm: any;

  constructor() {
    this.clear();
  }

  showNameWarning() {
    return this.loginForm.username.$touched
      && !this.loginForm.username.$valid
      && this.loginForm.username.$error.required;
  }

  showPasswordWarning() {
    return this.loginForm.password.$touched
      && !this.loginForm.password.$valid
      && this.loginForm.password.$error.required;
  }

  handleSubmit() {
    this.loginForm.username.$setTouched(true);
    this.loginForm.password.$setTouched(true);

    if (this.credentials.username && this.credentials.password) {
      this.onSubmit({
        credentials: this.credentials
      });
    }
  }

  clear() {
    if (this.loginForm) {
      this.loginForm.$setPristine();
      this.loginForm.$setUntouched();
    }
    this.credentials = {
      username: '',
      password: ''
    };
  }
}


text:
define({
  "_widgetLabel": "Notificação Pública",
  "groupingLabels": {
    "searchHeaderText": "Selecione ou pesquise um elemento no mapa.",
    "addresseeSource": "Camadas de Destinatário",
    "formatHeaderText": "Formato"
  },
  "numAddresseesFound": "${count} endereços encontrados; pretende continuar?",
  "tooltips": {
    "drawByPoint": "Clique numa localização no mapa.",
    "drawByExtent": "Desenhe uma caixa em volta de uma área de interesse",
    "invalidBufferDistance": "Por favor, introduza um valor superior ou igual a zero",
    "printSuggestion": "Imprima com a definição \"Tamanho real\" do Adobe® Reader®",
    "nothingConfigured": "Não foram configuradas quaisquer camadas com janelas pop-up de modelos de endereços"
  },
  "formats": {
    "descriptionCSV": "Valores separados por vírgulas",
    "hintCSV": "Ficheiro de valores separados por vírgulas",
    "descriptionPDF": "Rótulo PDF ${heightLabelIn} x ${widthLabelIn} polegadas; ${labelsPerPage} por páginas",
    "hintPDF": "Ex. Rótulo Avery(r) ${averyPartNumber}"
  }
});


text:
param($installPath, $toolsPath, $package, $project)

Import-Module (Join-Path $toolsPath Resolve-RootFolder.psm1)

function Setup-FolderStructure {
    Write-Debug "First time setup of documentation"
}

function Upgrade-FolderStructure {
    Write-Debug "Existing documentation folder already found"
}

$project_root = Resolve-RootFolder($toolsPath);

$docs_folder = Join-Path -Path $project_root "docs"
$configFile = Join-Path -Path $docs_folder "scribble.json"
$version = $package.ToString()

$startBrowser = $false

$directory_exists = [IO.Directory]::Exists($docs_folder)
$config_exists = [IO.File]::Exists($configFile)

# if this is the first time we run the package
if ($config_exists -eq $false) {

    Write-Host "Adding docs folder into folder $project_root"
    Setup-FolderStructure

    # create folder
	$templatePath = Join-Path -Path $toolsPath "template\*"

	# populate folder with template contents
    if ($directory_exists -eq $false) {
        New-Item -ItemType directory -Path $docs_folder
    }
	Copy-Item -Path $templatePath -Destination $docs_folder -Recurse | Out-Null

    $port = Get-Random -Minimum 30000 -Maximum 50000

	# dump the version and created port to the config file
    $properties = @{}
    $properties.Add('version',$version)
    $properties.Add('port',$port)
    ConvertTo-Json $properties | Out-File $configFile

    # open the file in Visual Studio
    $index_file = Join-Path -Path $docs_folder "index.md"

    # update template references based on dynamic port
    $template = Get-Content $index_file
    $template -replace "localhost:XXXXX", "localhost:$port" | out-file $index_file

	$dte.ItemOperations.OpenFile($index_file)

    $startBrowser = $true

    $dte.ItemOperations.Navigate("http://localhost:$port/")

} else {

    Write-Host "Checking version of Scribble found locally"

	$installed_version = $null
    $port = 40000

	if ([IO.File]::Exists($configFile) -eq $true) {
        $json = Get-Content $configFile | Out-String
        $properties = ConvertFrom-Json $json
		$installed_version = $properties.version
        $port = $properties.port
    }

	if ($installed_version -ne $package) {

        Upgrade-FolderStructure

		# update the version stored in configuration
        if ([IO.File]::Exists($configFile) -eq $true) {
            Remove-Item $configFile
        }

        $properties = @{}
        $properties.Add('version',$version)
        $properties.Add('port',$port)
        ConvertTo-Json $properties | Out-File $configFile
	} else {
        Write-Debug "No changes necessary, you've got the latest code"
    }
}

$assemblyPath = Join-Path $toolsPath "codesnippets\Scribble.CodeSnippets.dll"
[void][Reflection.Assembly]::LoadFile($assemblyPath)

Import-Module (Join-Path $toolsPath Update-Snippets.psm1) -ArgumentList @($project_root, $toolsPath)
Import-Module (Join-Path $toolsPath Start-Preview.psm1) -ArgumentList @($project_root, $docs_folder, $port)

if ($startBrowser) {
    Start-Preview
}


text:
SELECT
 test_cal_dt.week_beg_dt
 ,test_category_groupings.meta_categ_name
 ,test_category_groupings.categ_lvl2_name
 ,test_category_groupings.categ_lvl3_name
 ,sum(price) as GMV, count(*) as TRANS_CNT
 FROM test_kylin_fact
 inner JOIN edw.test_cal_dt as test_cal_dt
 ON test_kylin_fact.cal_dt = test_cal_dt.cal_dt
 inner JOIN test_category_groupings
 ON test_kylin_fact.leaf_categ_id = test_category_groupings.leaf_categ_id AND test_kylin_fact.lstg_site_id = test_category_groupings.site_id
 where test_cal_dt.week_beg_dt between DATE '2013-09-01' and DATE '2013-10-01'
 and test_category_groupings.meta_categ_name='Collectibles'
 group by test_cal_dt.week_beg_dt
 ,test_category_groupings.meta_categ_name
 ,test_category_groupings.categ_lvl2_name
 ,test_category_groupings.categ_lvl3_name


text:
<?php
include_once "../../database/files.php";
include_once "../../config/init.php";

if(isset($_POST['file_id'])){

    $file = getFileDetails($_POST['file_id']);
    print json_encode($file);
}


text:
ActiveRecord::Schema.define(:version => 20110330124725) do

  create_table "facebook_accounts", :force => true do |t|
    t.string   "first_name"
    t.string   "last_name"
    t.integer  "user_id"
    t.string   "email"
    t.string   "facebook_uid"
    t.datetime "created_at"
    t.datetime "updated_at"
  end

  create_table "users", :force => true do |t|
    t.datetime "created_at"
    t.datetime "updated_at"
  end

  create_table "website_accounts", :force => true do |t|
    t.string   "first_name"
    t.string   "last_name"
    t.integer  "user_id"
    t.string   "email"
    t.string   "encrypted_password"
    t.datetime "created_at"
    t.datetime "updated_at"
  end

end


text:
using System;

namespace MYOB.AccountRight.SDK.Contracts.Version2.Contact
{
    /// <summary>
    /// Describes additional terms for a purchase
    /// </summary>
    public class PurchaseTerms : Terms
    {
        /// <summary>
        /// The date the discount (if exists) will expire.
        /// </summary>
        public DateTime? DiscountExpiryDate { get; set; }

        /// <summary>
        /// The discount applicable if the amount if paid before the discount expiry date
        /// </summary>
        public decimal? Discount { get; set; }

        /// <summary>
        /// Date the balance is due.
        /// </summary>
        public DateTime? DueDate { get; set; }
    }
}


text:
require "spec_helper"

describe Mongoid::Timestamps::Created do

  describe ".included" do

    let(:quiz) do
      Quiz.new
    end

    let(:fields) do
      Quiz.fields
    end

    before do
      quiz.run_callbacks(:create)
      quiz.run_callbacks(:save)
    end

    it "adds created_at to the document" do
      expect(fields["created_at"]).to_not be_nil
    end

    it "does not add updated_at to the document" do
      expect(fields["updated_at"]).to be_nil
    end

    it "forces the created_at timestamps to UTC" do
      expect(quiz.created_at).to be_within(10).of(Time.now.utc)
    end
  end

  context "when the document is created" do

    let(:quiz) do
      Quiz.create!
    end

    it "runs the created callbacks" do
      expect(quiz.created_at).to_not be_nil
      expect(quiz.created_at).to be_within(10).of(Time.now.utc)
    end
  end
end


text:
'strict'

var fs    = require('fs')
  , path  = require('path')
  , gutil = require('gulp-util')
  , _     = require('lodash');

function BowerPackage (name, collection) {

    this.name                = name;
    this.collection          = collection;

    this.path                = collection.opts.bowerDirectory;
    this.id                  = name;

    this.files               = null;
    this.config              = null;
    this.json                = null;
    this.main                = null;
    this.self                = this;

    this.configure();
    this.getFiles();
}

_.extend(BowerPackage.prototype, {
    'configure': function() {
        if (this._json) return;

        this.path = path.resolve(path.join(this.path.toString(), this.name.toString()));
        this.config = path.resolve(path.join(this.path, 'bower.json'));

        if (!fs.existsSync(this.config))
            this.config = path.resolve(path.join(this.path, '.bower.json'));

        this.json = JSON.parse(fs.readFileSync(this.config, "utf8"));

        this.name = this.json.name;
        this.main = Array.isArray(this.json.main) ? this.json.main : [this.json.main];

        for(var pkg in this.json.dependencies) {
            this.collection.addPackage(pkg);
        }
    },

    'getFiles': function() {
        if (this.files) return this.files;
        this.files = [];

        var file, self = this;
        _.forEach(this.main, function(f){
            file = path.join(self.path.toString(), f.toString());

            if (path.extname(file) == '.js') {
                self.files.push(path.resolve(file));
                self.collection.log(self.name + ' - ' + gutil.colors.green(file));
            }
        })

        return this.files;
    }
});

module.exports = BowerPackage;


text:
package org.gradoop.flink.model.impl.operators.sampling.statistics;

import org.apache.flink.api.java.DataSet;
import org.apache.flink.api.java.tuple.Tuple2;
import org.gradoop.flink.algorithms.gelly.connectedcomponents.ValueWeaklyConnectedComponents;
import org.gradoop.flink.model.impl.epgm.LogicalGraph;
import org.gradoop.flink.model.api.operators.UnaryGraphToValueOperator;

/**
 * Computes the weakly connected components of a graph structure. Uses the gradoop wrapper
 * {@link ValueWeaklyConnectedComponents} of Flinks ConnectedComponents.
 *
 * Returns a mapping of VertexId -> ComponentId
 */
public class ValueConnectedComponentsDistribution
  implements UnaryGraphToValueOperator<DataSet<Tuple2<Long, Long>>> {

  /**
   * Max iterations.
   */
  private final int maxIteration;

  /**
   * Creates an instance of this operator to calculate the connected components distribution.
   *
   * @param maxiIteration max iteration count.
   */
  public ValueConnectedComponentsDistribution(int maxiIteration) {
    this.maxIteration = maxiIteration;
  }

  /**
   * {@inheritDoc}
   */
  @Override
  public DataSet<Tuple2<Long, Long>> execute(LogicalGraph graph) {
    return new ValueWeaklyConnectedComponents(maxIteration).execute(graph);
  }

  /**
   * {@inheritDoc}
   */
  @Override
  public String getName() {
    return ValueConnectedComponentsDistribution.class.getName();
  }
}


text:
namespace LostTech.App
{
    using System;
    using System.Linq;
    using System.Reflection;
    using LostTech.App.DataBinding;

    /// <summary>
    /// An <see cref="IFreezerFactory"/> for types, that implement <see cref="ICopyable{T}"/>
    /// </summary>
    public sealed class ClonableFreezerFactory : IFreezerFactory
    {
        private ClonableFreezerFactory() { }

        /// <summary>
        /// Singleton of the <see cref="ClonableFreezerFactory"/>
        /// </summary>
        public static IFreezerFactory Instance { get; } = new ClonableFreezerFactory();

        /// <inheritdoc/>
        public Func<T, TFrozen> MakeFreezer<T, TFrozen>()
        {
            if (!typeof(T).GetTypeInfo().ImplementedInterfaces.Any(@interface => @interface == typeof(ICopyable<TFrozen>)))
                throw new NotSupportedException($"This factory requires {nameof(T)} to implement {nameof(ICopyable<TFrozen>)}");

            return value => value is null
                                ? throw new ArgumentNullException(nameof(value))
                                : ((ICopyable<TFrozen>)value).Copy();
        }
    }
}


text:
var vows = require('vows'),
    path = require('path'),
    assert = require('assert'),
    parse = require('../lib'),
    yuiFile = path.join(__dirname, 'info/parts.info');

var tests = {
    'Should be loaded': {
        topic: function() {
            return parse;
        },
        'should be a function': function(topic) {
            assert.isFunction(topic);
        }
    },
    'Catch bad file passing': {
        topic: function() {
            parse('foobar', this.callback);
        },
        'should return an error': function(err, data) {
            assert.isUndefined(data);
            assert.isString(err);
        }
    },
    'Parse as a string': {
        topic: function() {
            parse('TN:TestName\nSF:foobar.js\nend_of_record\n', this.callback);
        },
        'should parse': function(err, data) {
            assert.isArray(data);
            assert.equal('TestName', data[0].title);
            assert.equal('foobar.js', data[0].file);
        }
    },
    'parse the file': {
        topic: function() {
            parse(yuiFile, this.callback);
        },
        'should return an array': function(err, data) {
            assert.isNull(err);
            assert.isArray(data);
        },
        'should contain 2 keys': function(err, data) {
            assert.equal(data.length, 2);
        },
        'first key should have 4 properties': function(err, data) {
            var d = data[0];
            assert.deepEqual(Object.keys(d), [ 'title', 'file', 'functions', 'lines' ]);
        },
        'verify test titles': function(err, data) {
            assert.equal(data[0].title, 'Test #1');
            assert.equal(data[1].title, 'Test #2');
        },
        'verify test files': function(err, data) {
            assert.equal(data[0].file, 'anim-base/anim-base-coverage.js');
            assert.equal(data[1].file, 'anim-easing/anim-easing-coverage.js');
        },
        'verify number of functions': function(err, data) {
            assert.equal(data[0].functions.found, 29);
            assert.equal(data[0].functions.hit, 23);
            assert.equal(data[1].functions.found, 17);
            assert.equal(data[1].functions.hit, 17);
        },
        'verify number of branches': function(err, data) {
            assert.equal(data[1].branches.found, 23);
            assert.equal(data[1].branches.hit, 22);
            assert.equal(data[1].branches.found, data[1].branches.details.length);
            assert.equal(data[1].branches.details[data[1].branches.details.length - 1].taken, 0);
        },
        'verify function details': function(err, data) {
            assert.equal(data[0].functions.details.length, 29);
            assert.equal(data[1].functions.details.length, 17);
            assert.deepEqual(data[0].functions.details[0], { name: '(anonymous 1)', line: 7, hit: 6 });
            assert.deepEqual(data[0].functions.details[11], { name: '_start', line: 475, hit: 231 });

            assert.deepEqual(data[0].functions.details[27], { name: 'stop', line: 466, hit: 9 });
            assert.deepEqual(data[0].functions.details[28], { name: 'stop', line: 389, hit: 0 });

            assert.deepEqual(data[1].functions.details[4], { name: 'bounceBoth', line: 345, hit: 36 });

        },
        'verify number of lines': function(err, data) {
            assert.equal(data[0].lines.found, 181);
            assert.equal(data[0].lines.hit, 143);
            assert.equal(data[1].lines.found, 76);
            assert.equal(data[1].lines.hit, 70);
        },
        'verify line details': function(err, data) {
            assert.equal(data[0].lines.details.length, 181);
            assert.equal(data[1].lines.details.length, 76);
            assert.deepEqual(data[0].lines.details[0], { line: 7, hit: 6 });
            assert.deepEqual(data[0].lines.details[10], { line: 91, hit: 6 });

            assert.deepEqual(data[1].lines.details[20], { line: 157, hit: 32 });
            assert.deepEqual(data[1].lines.details[64], { line: 313, hit: 51 });
        },

    }
};

vows.describe('Test Loading and Bindings').addBatch(tests)['export'](module);


text:
{% load jet_tags %}
<fieldset class="module aligned {{ fieldset.classes }}">
    {% if fieldset.name %}
{{ fieldset.name }}
{% endif %}
    {% if fieldset.description %}

{{ fieldset.description|safe }}

    {% endif %}
    {% for line in fieldset %}

            {% if line.fields|length_is:'1' %}{{ line.errors }}{% endif %}
            {% for field in line %}

                    {% if not line.fields|length_is:'1' and not field.is_readonly %}{{ field.errors }}{% endif %}
                    {% if field.is_checkbox %}

                                {{ field.field.label }}

                            {{ field.field }}
                            {{ field.field.help_text|safe }}

                    {% else %}
                        {{ field.label_tag }}
                        {% if field.is_readonly and field.contents %}
                            {{ field.contents }}
                        {% else %}
                            {{ field.field|jet_select2_lookups }}
                        {% endif %}
                    {% endif %}
                    {% if field.field.help_text and not field.is_checkbox %}

{{ field.field.help_text|safe }}

                    {% endif %}

            {% endfor %}

    {% endfor %}
</fieldset>


text:
/**
 * @file Geometry Group
 * @author Alexander Rose <alexander.rose@weirdbyte.de>
 * @private
 */

import { Box3 } from '../../lib/three.es6.js'

class GeometryGroup {
  constructor (geometryList) {
    this.geometryList = geometryList
    this.boundingBox = null
  }

  computeBoundingBox () {
    if (!this.boundingBox) {
      this.boundingBox = new Box3()
    } else {
      this.boundingBox.empty()
    }

    this.geometryList.forEach(geo => {
      if (!geo.boundingBox) geo.computeBoundingBox()
      this.boundingBox.union(geo.boundingBox)
    })
  }
}

export default GeometryGroup


text:
<?php

namespace AppBundle\Service\ImportWorkflow;

use AppBundle\Service\Helper\Headers;
use Ddeboer\DataImport\Reader\CsvReader;
use Ddeboer\DataImport\Workflow\StepAggregator;

abstract class ImportWorkflow implements ImportWorkflowInterface
{
    protected $workflow;
    protected $reader;
    protected $writer;
    protected $file;
    protected $testMode = false;
    protected $steps = [];
    protected $dataLog = [];

    /**
     * Initializes the workflow.
     *
     * @param $filePath
     *
     * @return $this
     */
    public function initialize($filePath)
    {
        $this->setResourceFile($filePath);
        $this->initializeWorkflow();

        return $this;
    }

    abstract public function getRequiredHeaders();

    /**
     * Enables "test" mode: data is processed in the same way, but not inserted into a database.
     *
     * @param $mode
     *
     * @return $this
     */
    public function setTestMode($mode)
    {
        $this->testMode = $mode;

        return $this;
    }

    /**
     * Sets import source file.
     *
     * @param $filePath
     *
     * @throws \Exception
     */
    protected function setResourceFile($filePath)
    {
        $fileInfo = new \SplFileInfo($filePath);
        if (!$fileInfo->isFile()) {
            throw new \Exception('This .csv file is not valid or does not exist.');
        }
        $this->file = new \SplFileObject($filePath);
    }

    /**
     * Initializes importer workflow(source reader, database writer and steps of processing: filtering, conversion, etc.).
     */
    protected function initializeWorkflow()
    {
        $this->initializeReader();
        $this->workflow = new StepAggregator($this->reader);
        $this->initializeWriter();
        $this->initializeSteps();
    }

    protected function initializeSteps()
    {
        foreach ($this->steps as $step) {
            $this->workflow->addStep($step);
        }
    }

    /**
     * Sets the reader of the workflow.
     */
    protected function initializeReader()
    {
        $this->reader = new CsvReader($this->file);
        $this->reader->setHeaderRowNumber(0);
        $this->reader->setStrict(false);
        $this->reader->setColumnHeaders($this->getRequiredHeaders());
    }

    abstract protected function initializeWriter();

    /**
     * @return int
     */
    public function getTotalRowsCount()
    {
        $number = count($this->reader);

        return $number;
    }

    /**
     * @return array
     */
    public function getDataLog()
    {
        return $this->dataLog;
    }

    /**
     * Executes import process.
     *
     * @return mixed
     */
    public function process()
    {
        $this->workflow->setSkipItemOnFailure(false);
        $result = $this->workflow->process();

        return $result;
    }
}


text:
var searchData=
[
  ['navigationmesh',['NavigationMesh',['../class_engine_1_1_core_1_1_navigation_mesh.html',1,'Engine::Core']]],
  ['navigationnode',['NavigationNode',['../struct_engine_1_1_core_1_1_navigation_node.html',1,'Engine::Core']]],
  ['node',['Node',['../class_a_star_search_1_1_node.html',1,'AStarSearch']]]
];


text:
package minefantasy.mf2.mechanics;

import java.util.Map;
import java.util.Random;

import minefantasy.mf2.api.armour.CogworkArmour;
import minefantasy.mf2.api.armour.IElementalResistance;
import minefantasy.mf2.api.helpers.ArmourCalculator;
import minefantasy.mf2.api.helpers.ArrowEffectsMF;
import minefantasy.mf2.api.helpers.CustomToolHelper;
import minefantasy.mf2.api.helpers.TacticalManager;
import minefantasy.mf2.api.knowledge.ResearchLogic;
import minefantasy.mf2.api.material.CustomMaterial;
import minefantasy.mf2.api.rpg.RPGElements;
import minefantasy.mf2.api.rpg.SkillList;
import minefantasy.mf2.api.stamina.StaminaBar;
import minefantasy.mf2.api.tier.IToolMaterial;
import minefantasy.mf2.api.weapon.IDamageModifier;
import minefantasy.mf2.api.weapon.IKnockbackWeapon;
import minefantasy.mf2.api.weapon.IParryable;
import minefantasy.mf2.api.weapon.IPowerAttack;
import minefantasy.mf2.api.weapon.ISpecialEffect;
import minefantasy.mf2.api.weapon.IWeaponSpeed;
import minefantasy.mf2.api.weapon.IWeightedWeapon;
import minefantasy.mf2.config.ConfigArmour;
import minefantasy.mf2.config.ConfigExperiment;
import minefantasy.mf2.config.ConfigStamina;
import minefantasy.mf2.config.ConfigWeapon;
import minefantasy.mf2.entity.Shockwave;
import minefantasy.mf2.item.weapon.ItemBattleaxeMF;
import minefantasy.mf2.item.weapon.ItemDagger;
import minefantasy.mf2.item.weapon.ItemKatanaMF;
import minefantasy.mf2.item.weapon.ItemWaraxeMF;
import minefantasy.mf2.item.weapon.ItemWeaponMF;
import minefantasy.mf2.knowledge.KnowledgeListMF;
import minefantasy.mf2.material.BaseMaterialMF;
import minefantasy.mf2.network.packet.ParryPacket;
import minefantasy.mf2.util.MFLogUtil;
import net.minecraft.entity.Entity;
import net.minecraft.entity.EntityLiving;
import net.minecraft.entity.EntityLivingBase;
import net.minecraft.entity.item.EntityEnderPearl;
import net.minecraft.entity.monster.EntitySkeleton;
import net.minecraft.entity.monster.EntityZombie;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.entity.projectile.EntityArrow;
import net.minecraft.init.Items;
import net.minecraft.item.Item.ToolMaterial;
import net.minecraft.item.ItemStack;
import net.minecraft.potion.Potion;
import net.minecraft.potion.PotionEffect;
import net.minecraft.util.DamageSource;
import net.minecraft.util.EntityDamageSource;
import net.minecraft.util.EntityDamageSourceIndirect;
import net.minecraft.world.World;
import net.minecraft.world.WorldServer;
import net.minecraftforge.common.ISpecialArmor;
import net.minecraftforge.event.entity.living.LivingAttackEvent;
import net.minecraftforge.event.entity.living.LivingEvent.LivingJumpEvent;
import net.minecraftforge.event.entity.living.LivingEvent.LivingUpdateEvent;
import net.minecraftforge.event.entity.living.LivingHurtEvent;
import cpw.mods.fml.common.eventhandler.SubscribeEvent;

public class CombatMechanics
{
	public static final String parryCooldownNBT = "MF_Parry_Cooldown";
	public static final String posthitCooldownNBT = "MF_PostHit";
	private static Random rand = new Random();
	public static final float	specialUndeadModifier	= 2.0F;
	public static final float	specialDragonModifier	= 0.5F;
	public static final float	specialWerewolfModifier	= 8.0F;
	public static boolean	swordSkeleton	= true;

	protected float jumpEvade_cost = 30;
	protected float evade_cost = 10;

	@SubscribeEvent
	public void initAttack(LivingAttackEvent event)
	{
		/*
		if(event.source == DamageSource.fall && event.entityLiving instanceof EntityPlayer && RPGElements.isSystemActive)
		{
			SkillList.acrobatics.addXP((EntityPlayer) event.entityLiving, (int)event.ammount+1);
		}

		if(RPGElements.isSystemActive && event.entityLiving instanceof EntityPlayer && !event.source.isUnblockable())
		{
			for(int a = 0; a < 4; a++)
			{
				ItemStack piece = event.entityLiving.getEquipmentInSlot(a+1);
				if(piece != null)
				{
					int AC = ArmourCalculator.getArmourClass(piece).equalsIgnoreCase("heavy") ? 2 : ArmourCalculator.getArmourClass(piece).equalsIgnoreCase("light") ? 0 : 1;

					Skill skill = (AC == 2) ? SkillList.heavyarmour : (AC == 0) ? SkillList.lightarmour : SkillList.mediumarmour;
					skill.addXP((EntityPlayer) event.entityLiving, (int)(event.ammount/5F));
				}
			}
		}
		*/

		EntityLivingBase hitter = getHitter(event.source);
		int spd = EventManagerMF.getHitspeedTime(hitter);
		if(hitter != null && !hitter.worldObj.isRemote)
		{
			if(spd > 0 && !(event.entityLiving instanceof EntityPlayer))
			{	event.setCanceled(true);
				return;
			}
		}
		DamageSource src = event.source;
		EntityLivingBase hit = event.entityLiving;
		World world = hit.worldObj;
		float damage = modifyDamage(src, world, hit, event.ammount, false);

		if(event.source.isProjectile() && !event.source.isFireDamage() && damage < event.ammount && hit.getTotalArmorValue() > 0)//only if dam has been reduced
    	{
    		if(ConfigArmour.resistArrow && !event.isCanceled() && damage <= 0)//TacticalManager.resistArrow(event.entityLiving, event.source, damage))
    		{
    			if(event.source.getSourceOfDamage() != null && !event.source.getSourceOfDamage().getEntityData().hasKey("arrowDeflectMF") && !(event.source.getEntity() instanceof EntityEnderPearl))
    			{
    				event.source.getSourceOfDamage().getEntityData().setBoolean("arrowDeflectMF", true);
    				event.entityLiving.worldObj.playSoundAtEntity(event.entityLiving, "random.break", 1.0F, 0.5F);
    			}
    			event.setCanceled(true);
    		}
    	}

		if(damage <= 0)
		{
			event.setCanceled(true);
		}
		if(hitter != null && hitter instanceof EntityLivingBase)
		{
			int hitTime = 5;
			if(hitter.getHeldItem() != null)
			{
				ItemStack weapon = hitter.getHeldItem();
				if(weapon.getItem() instanceof IWeaponSpeed)
				{
					hitTime += ((IWeaponSpeed)weapon.getItem()).modifyHitTime(hitter, weapon);
				}
			}
			if(hitTime > 0)
			EventManagerMF.setHitTime(hitter, hitTime);
		}
	}

	/**
	 * gets the melee hitter
	 */
	private EntityLivingBase getHitter(DamageSource source)
	{
		if(source != null && source.getEntity() != null && source.getEntity() == source.getSourceOfDamage() && source.getEntity() instanceof EntityLivingBase)
		{
			return (EntityLivingBase) source.getEntity();
		}
		return null;
	}

	@SubscribeEvent
    public void onHit(LivingHurtEvent event)
    {
		DamageSource src = event.source;
		EntityLivingBase hit = event.entityLiving;
		if(src != null && src == DamageSource.fall)
		{
			onFall(hit, event.ammount);
		}
		World world = hit.worldObj;
		float damage = modifyDamage(src, world, hit, event.ammount, true);

		if(damage > 0 && hit.isSprinting())
		{
			hit.setSprinting(false);
		}
		//TODO: Zombie armour
    	if(event.entityLiving.getEntityData().hasKey(MonsterUpgrader.zombieArmourNBT) && event.entityLiving instanceof EntityZombie)
    	{
    		float percent = 1.0F;
    		ItemStack[] armours = new ItemStack[4];
    		for(int a = 1; a < 5; a ++)
    		{
    			armours[a-1]=event.entityLiving.getEquipmentInSlot(a);
    		}
    		damage = ISpecialArmor.ArmorProperties.ApplyArmor(event.entityLiving, armours, event.source, damage);
    	}
    	//TODO: Stick arrows (EXPERIMENTAL)
    	if(ConfigExperiment.stickArrows && event.source.getSourceOfDamage() != null && event.source.getSourceOfDamage() instanceof EntityArrow)
    	{
    		if(!event.entity.worldObj.isRemote)
    		{
    			ArrowEffectsMF.stickArrowIn(event.entity, ArrowEffectsMF.getDroppedArrow(event.source.getSourceOfDamage()), event.source.getSourceOfDamage());
    		}
    	}
    	if(damage > 0)
    	{
    		onOfficialHit(src, hit, damage);

	    	if (event.source instanceof EntityDamageSource && !(event.source instanceof EntityDamageSourceIndirect)  && !event.source.damageType.equals("battlegearExtra"))
			{
				Entity entityHitter = ((EntityDamageSource) event.source).getEntity();

				if (entityHitter instanceof EntityLivingBase)
				{
					EntityLivingBase attacker = (EntityLivingBase) entityHitter;
					StaminaMechanics.onAttack(attacker, hit);
					ItemStack weapon = attacker.getHeldItem();
					HitSoundGenerator.makeHitSound(weapon, event.entityLiving);
				}
			}
    	}
		event.ammount = damage;
    }

	private void onFall(EntityLivingBase fallen, float height)
	{
		float weight = ArmourCalculator.getTotalWeightOfWorn(fallen, false);
		if(weight > 100)
		{
			weight -= 100F;
			float power = (height/4F) * (weight/100F);
			newShockwave(fallen, fallen.posX, fallen.posY, fallen.posZ, power, false, true);
		}
	}
	public Shockwave newShockwave(Entity source, double x, double y, double z, float power, boolean fire, boolean smoke)
    {
    	Shockwave explosion = new Shockwave("humanstomp", source.worldObj, source, x, y, z, power);
        explosion.isFlaming = fire;
        explosion.isSmoking = smoke;
        explosion.initiate();
        explosion.decorateWave(true);
        return explosion;
    }

	private float modifyDamage(DamageSource src, World world, EntityLivingBase hit, float dam, boolean properHit)
	{
		Entity source = src.getSourceOfDamage();
		Entity hitter = src.getEntity();

		if(properHit && hit instanceof EntityPlayer)
		{
			dam = modifyPlayerDamage((EntityPlayer)hit, dam);
		}

		if(source != null && hitter != null && hitter instanceof EntityLivingBase)
		{
			dam = modifyUserHitDamage(dam, (EntityLivingBase)hitter, source, hitter == source, hit, properHit);
		}
		if(src.isExplosion() && isSkeleton(hit))
		{
			dam *= 5F;
		}

		//TODO: Elemental resistance
    	dam *= TacticalManager.getResistance(hit, src);
    	if(src.isFireDamage())
    	{
    		if(dam <= 0.0F)
    		{
    			hit.extinguish();
    		}
    	}
    	dam = onUserHit(hit, hitter, src, dam, properHit);
		return dam;
	}

	private boolean isSkeleton(Entity target)
	{
		return target instanceof EntitySkeleton;
	}

	//TODO: damage modifier
	private float modifyUserHitDamage(float dam, EntityLivingBase user, Entity source, boolean melee, Entity target, boolean properHit)
	{
		dam = modifyMobDamage(user, dam);
		//Power Attack
		if(melee)
		{
			int powerAttack = initPowerAttack(user, target, properHit);
			if(powerAttack == 1)
			{
				dam *= (2F/1.5F);
				onPowerAttack(dam, user, target, properHit);

				if(isSkeleton(target))
				{
					dam *= 1.5F;
					if(properHit)
					{
						if(rand.nextInt(2) == 0)
						{
							target.entityDropItem(new ItemStack(Items.bone), 0.5F);
						}
					}
				}
			}
			if(powerAttack == -1)
			{
				dam /= 2F;
			}
			/*
			if(RPGElements.isSystemActive && user instanceof EntityPlayer)
			{
				WeaponClass WC = WeaponClass.findClassForAny(user.getHeldItem());
				if(WC != null)
				{
					float mod = RPGElements.getWeaponModifier((EntityPlayer) user, WC.parentSkill);
					MFLogUtil.logDebug("Weapon Class: " + WC.name + ", mod = " + mod);
					dam *= mod;
				}
			}
			*/
		}
		if(user instanceof EntityLivingBase)
		{
			EntityLivingBase player = user;

			//TODO: Stamina Traits
			if(StaminaBar.isSystemActive)
			{
				if(StaminaBar.getStaminaValue(player) <= 0)
				{
					dam *= ConfigStamina.weaponDrain;
				}
			}
		}
		if(user.hurtResistantTime > 12)
		{
			dam *= 0.5F;
		}

		ItemStack weapon = user.getHeldItem();
    	if(weapon != null)
    	{
    		if(weapon.getItem() instanceof IDamageModifier)
    		{
    			//TODO: IDamageModifier, this mods the damage for weapons
    			dam = ((IDamageModifier)weapon.getItem()).modifyDamage(weapon, user, target, dam, properHit);
    		}
    		CustomMaterial material = CustomToolHelper.getCustomMetalMaterial(weapon);
    		if(material != null && material.name.equalsIgnoreCase("silver"))
    		{
    			dam = hurtUndead(user, target, dam, properHit);
    		}
    		if(!weapon.getUnlocalizedName().contains("dragonforged") && target instanceof EntityLivingBase && TacticalManager.isDragon((EntityLivingBase)target))
    		{
    			dam *= specialDragonModifier;
    		}
    	}

		return dam;
	}

	private void onPowerAttack(float dam, EntityLivingBase user, Entity target, boolean properHit)
	{
		ItemStack weapon = user.getHeldItem();
		int ticks = 20;
		if(weapon != null && weapon.getItem() instanceof IPowerAttack)
		{
			((IPowerAttack)weapon.getItem()).onPowerAttack(dam, user, target, properHit);
			ticks = ((IPowerAttack)weapon.getItem()).getParryModifier(weapon, user, target);
		}
	   if(target instanceof EntityLivingBase)
	   {
	 	   if(ticks > getParryCooldown((EntityLivingBase)target))
	 	   {
	 		   setParryCooldown((EntityLivingBase)target, ticks);
	 	   }
	   }
	   if(!user.worldObj.isRemote)
	   {
		   user.addPotionEffect(new PotionEffect(Potion.digSlowdown.id, 20, 5));
		   user.addPotionEffect(new PotionEffect(Potion.moveSlowdown.id, 20, 10));
	   }
	   if(user instanceof EntityPlayer)
	   {
		   TacticalManager.lungeEntity(user, target, 0.5F, 0F);
		   TacticalManager.throwPlayerOffBalance((EntityPlayer) user, 0.5F, true);
	   }

	   target.worldObj.playSoundAtEntity(target, "minefantasy2:weapon.critical", 1.0F, 1.0F);
	}

	private static final float power_attack_base = 25F;
	/**
	 * 0 = false
	 * 1 = true
	 * -1 = failure
	 */
	private static int initPowerAttack(EntityLivingBase user, Entity target, boolean properHit)
	{
		if(!canExecutePower(user))
		{
			return 0;
		}
		if(StaminaBar.isSystemActive && StaminaBar.doesAffectEntity(user))
		{
			float points = power_attack_base * (StaminaBar.getBaseDecayModifier(user, true, true)*0.5F + 0.5F);
			if(StaminaBar.isStaminaAvailable(user, points, properHit))
			{
				if(properHit)
				{
					ItemWeaponMF.applyFatigue(user, points);
				}
				return getPostHitCooldown(user) > 0 ? -1 : 1;
			}
			else
			{
				return 0;
			}
		}
		return 1;
	}

	private static boolean canExecutePower(EntityLivingBase user)
	{
		if(user.isInWater())
		{
			return false;
		}
		if(user instanceof EntityPlayer)
		{
			if(!isFightStance(user))return false;
		}
		return user.fallDistance > 0 && !user.isOnLadder();
	}

	private static boolean isFightStance(EntityLivingBase user)
	{
		return user.isSneaking();
	}

	private float modifyMobDamage(EntityLivingBase user, float dam)
	{
		if(user instanceof EntityZombie && user.isChild())
		{
			dam *= 0.65F;
		}
		return dam + getStrengthEnhancement(user);
	}

	private boolean isMaterialUndeadKiller(ItemStack weapon, ToolMaterial material)
    {
		CustomMaterial mat = CustomToolHelper.getCustomMetalMaterial(weapon);
		if(mat != null && mat.name.equalsIgnoreCase("silver"))
		{
			return true;
		}
		return material == BaseMaterialMF.silver.getToolConversion() || material == BaseMaterialMF.ornate.getToolConversion();
	}
	private float hurtUndead(Entity entityHitting, Entity entityHit, float dam, boolean properHit)
    {
    	if(entityHit instanceof EntityLivingBase && TacticalManager.isUnholyCreature((EntityLivingBase)entityHit))
		{
    		EntityLivingBase living = (EntityLivingBase)entityHit;
    		dam *= specialUndeadModifier;
    		if(properHit)
			{
	    		entityHit.playSound("random.fizz", 0.5F, 0.5F);
	    		living.addPotionEffect(new PotionEffect(Potion.weakness.id, 1200, 2));
	    		if(rand.nextInt(10) == 0)
	    		{
	    			living.setFire(3);
	    		}
	    		if(living.getHealth() <= living.getHealth()/2F && rand.nextInt(20) == 0)
	    		{
	    			dam *= 100F;
	    			living.worldObj.createExplosion(living, living.posX, living.posY+living.getEyeHeight(), living.posZ, 0.0F, false);
	    		}
			}
		}
		if(entityHit.getClass().getName().contains("Werewolf"))
		{
			dam *= specialWerewolfModifier;

			if(properHit)
			{
	    		entityHit.playSound("random.fizz", 0.6F, 0.5F);
			}
		}
    	return dam;
	}

	private void onOfficialHit(DamageSource src, EntityLivingBase target, float damage)
	{
		Entity source = src.getSourceOfDamage();
		Entity hitter = src.getEntity();

		if(source != null && hitter != null && hitter instanceof EntityLivingBase)
		{
			if(source == hitter)
			{
				EntityLivingBase user = (EntityLivingBase)hitter;
				ItemStack weapon = user.getHeldItem();
				if(weapon != null)
				{
					onWeaponHit(user, weapon, target, damage);
				}
				if(RPGElements.isSystemActive && user instanceof EntityPlayer )
				{
					SkillList.combat.addXP((EntityPlayer)user, (int)(damage/5F));
				}
			}
			else
			{
				if(source instanceof EntityArrow && src.isProjectile())
				{
					onArrowHit(source, target, hitter, damage);
				}
			}
		}
		CombatMechanics.setPostHitCooldown(target, 10);
	}
	private void onWeaponHit(EntityLivingBase user, ItemStack weapon, Entity target, float dam)
	{
		if(target instanceof EntityLivingBase && weapon.getItem() instanceof ISpecialEffect)
		{
			((ISpecialEffect)weapon.getItem()).onProperHit(user, weapon, target, dam);
		}

		if(weapon.getItem() instanceof IWeaponSpeed)
		{
			target.hurtResistantTime += ((IWeaponSpeed)weapon.getItem()).modifyHitTime(user, weapon);
		}
		if(weapon.getItem() instanceof IKnockbackWeapon)
		{
			float kb = ((IKnockbackWeapon)weapon.getItem()).getAddedKnockback(user, weapon);

			if(kb > 0)
			{
				TacticalManager.knockbackEntity(target, user, kb, 0F);
			}
		}
		if (ConfigWeapon.useBalance && user instanceof EntityPlayer)
        {
			applyBalance((EntityPlayer)user);
        }
	}
	private void onArrowHit(Entity arrow, Entity target, Entity shooter, float damage)
	{
		/*
		if(RPGElements.isSystemActive && shooter instanceof EntityPlayer)
		{
			SkillList.archery.addXP((EntityPlayer) shooter, (int)damage);
		}
		*/
	}

	protected static void performEffects(Map<PotionEffect, Float> map, EntityLivingBase entityHit)
    {
        double roll = Math.random();
        if(map == null || map.isEmpty())
        {
        	return;
        }

        for(PotionEffect effect:map.keySet())
        {
            //add effects if they aren't already applied, with corresponding chance factor
            if(!entityHit.isPotionActive(effect.getPotionID()) && map.get(effect) > roll)
            {
                entityHit.addPotionEffect(new PotionEffect(effect));
            }
        }
    }

	private static boolean debugParry = true;
	private static final float	parryFatigue	= 5F;
	private float onUserHit(EntityLivingBase user, Entity entityHitting, DamageSource source, float dam, boolean properHit)
    {
    	ItemStack weapon = user.getHeldItem();
    	if((properHit || source.isProjectile()) && weapon != null && !source.isUnblockable() &&!source.isExplosion())
    	{
    		float threshold = 10;//DEFAULT PARRY THRESHOLD
    		float weaponFatigue = 2.0F;//DEFAULT FATIGUE
    		int ticks = 18;//DEFAULT TICKS
    		IParryable parry = null;

    		if(weapon.getItem() instanceof IParryable)
    		{
    			parry = (IParryable)weapon.getItem();

    			ticks = parry.getParryCooldown(source, dam, weapon);
    			threshold = parry.getMaxDamageParry(user, weapon);
    			weaponFatigue = parry.getParryStaminaDecay(source, weapon);
    		}
    		if(StaminaBar.isSystemActive && !StaminaBar.isAnyStamina(user, false))
    		{
    			threshold /= 2;
    		}
    	    threshold *= TacticalManager.getHighgroundModifier(user, entityHitting, 1.15F);

    	    if(ArmourCalculator.advancedDamageTypes && !user.worldObj.isRemote)
    		{
    	    	threshold = ArmourCalculator.adjustACForDamage(source, threshold, 1.0F, 0.75F, 0.5F);
    		}

    	    if(debugParry && !user.worldObj.isRemote){MFLogUtil.logDebug("Init Parry: Damage = " + dam + " Threshold = " + threshold);}

    	    //USED FOR PARRYING its harder to block arrows
           if(TacticalManager.canParry(source, user, entityHitting, weapon))
           {
        	   float previousDam = dam;
        	   dam = Math.max(0F, dam - threshold);

        	   if(debugParry && !user.worldObj.isRemote){MFLogUtil.logDebug("Parried: dam = " + dam);}

        	   if(properHit || dam <= 0)
        	   {
	        	   user.hurtResistantTime = user.maxHurtResistantTime;
	        	   user.hurtTime = 0;

        		   int result = onParry(source, user, entityHitting, dam, previousDam, parry);

        		   if(result == 1)
        		   {
        			   dam = 0;
        		   }

        		   if(StaminaBar.isSystemActive && StaminaBar.doesAffectEntity(user) && !StaminaBar.isAnyStamina(user, false))
	        	   {
	        		   ticks *= 3;
	        	   }
	        	   if(ticks > getParryCooldown(user))
	        	   {
	        		   setParryCooldown(user, ticks);
	        	   }

	        	   ItemWeaponMF.applyFatigue(user, TacticalManager.getHighgroundModifier(user, entityHitting, 2.0F)*(dam+1F)*parryFatigue*weaponFatigue);
	        	   if(parry == null)
		    	   {
		    		   user.worldObj.playSoundAtEntity(user, getDefaultParrySound(weapon), 1.0F, 1.25F + (rand.nextFloat()*0.5F));
		    	   }
	        	   else if(!parry.playCustomParrySound(user, entityHitting, weapon))
		    	   {
		    		   user.worldObj.playSoundAtEntity(user, "mob.zombie.metal", 1.0F, 1.25F + (rand.nextFloat()*0.5F));
		    	   }
		    	   if(user instanceof EntityPlayer)
		    	   {
		   			   ((EntityPlayer)user).stopUsingItem();
		    		   ItemWeaponMF.setParry(weapon, 20);
		    	   }

		    	   	if(entityHitting != null && entityHitting instanceof EntityLivingBase)
			   		{
		    	   		EntityLivingBase hitter = (EntityLivingBase)entityHitting;
			   			int hitTime = 5;
			   			if(hitter.getHeldItem() != null)
			   			{
			   				ItemStack attackingWep = hitter.getHeldItem();
			   				if(attackingWep.getItem() instanceof IWeaponSpeed)
			   				{
			   					hitTime += ((IWeaponSpeed)attackingWep.getItem()).modifyHitTime(hitter, weapon);
			   				}
			   			}
			   			if(hitTime > 0)
			   			{
			   				MFLogUtil.logDebug("Recoil hitter: " + hitter.getCommandSenderName() + " for " + hitTime*3 + " ticks.");
			   				EventManagerMF.setHitTime(hitter, hitTime * 3);
			   			}
			   		}
        	   }
           }
    	}
    	if(StaminaBar.isSystemActive && StaminaBar.doesAffectEntity(user) && !StaminaBar.isAnyStamina(user, false))
    	{
    		dam *= Math.max(1.0F, ConfigStamina.exhaustDamage);
    	}

    	//Fire dura degrade
    	if(properHit && source.isFireDamage() && dam > 0)
    	{
    		for(int a = 0; a < 4; a++)
			{
				ItemStack armour = user.getEquipmentInSlot(a+1);
				if(armour != null)
				{
					int dura = (int)(dam)+1;
					if(!user.worldObj.isRemote && !isArmourFireImmune(armour, source))
					{
						MFLogUtil.logDebug("Armour Flame Damage: " + dura);
						if(armour.getItemDamage() + dura < armour.getMaxDamage())
						{
							armour.damageItem(dura, user);
						}
						else
						{
							armour.setItemDamage(armour.getMaxDamage());
						}
					}
					if(armour.getItemDamage() >= armour.getMaxDamage())
					{
						user.setCurrentItemOrArmor(a+1, null);
						user.worldObj.playSoundEffect(user.posX, user.posY+user.getEyeHeight() - (0.4F*a), user.posZ, "random.break", 1.0F, 1.0F);
					}
				}
			}
    	}

    	if(!source.isUnblockable() && (properHit || source.isProjectile()) && dam > 0 && ArmourCalculator.useThresholdSystem)//THRESHOLD SYSTEM
    	{
	    	float AC = ArmourCalculator.getACThreshold(user, source);
	    	if(source.isFireDamage())
	    	{
	    		AC *= 0.5F;
	    	}
	    	if(AC > 0)
	    	{
	    		if(dam > 0)
	    		{
	    			for(int a = 0; a < 4; a++)
	    			{
	    				ItemStack armour = user.getEquipmentInSlot(a+1);
	    				if(armour != null)
	    				{
	    					int dura = ArmourCalculator.getDamageToDura(user, source, armour, dam);
	    					if(!user.worldObj.isRemote)
	    					{
	    						if(armour.getItemDamage() + dura < armour.getMaxDamage())
	    						{
	    							armour.damageItem(dura, user);
	    						}
	    						else
	    						{
	    							armour.setItemDamage(armour.getMaxDamage());
	    						}
	    					}
	    					if(armour.getItemDamage() >= armour.getMaxDamage())
	    					{
	    						user.setCurrentItemOrArmor(a+1, null);
	    						user.worldObj.playSoundEffect(user.posX, user.posY+user.getEyeHeight() - (0.4F*a), user.posZ, "random.break", 1.0F, 1.0F);
	    					}
	    				}
	    			}
	    		}

	    		MFLogUtil.logDebug("Init AC Reduction: " + AC);
	    		dam -= AC;
	    		if(dam < 0)dam = 0;
	    	}
    	}

    	if(dam > 0 && user instanceof EntityPlayer || (entityHitting != null && entityHitting instanceof EntityPlayer))
    	{
    		if(!user.worldObj.isRemote)
    		{
    			String type = "Mixed";
    			float[] f = ArmourCalculator.getRatioForSource(source);
    			if(f == null)
    			{
    				type = "Basic";
    			}
    			else
    			{
	    			if(f[0] > f[1] && f[0] > f[2])type = "Cutting";
	    			if(f[2] > f[1] && f[2] > f[0])type = "Piercing";
	    			if(f[1] > f[0] && f[1] > f[2])type = "Blunt";
    			}

    			MFLogUtil.logDebug(dam + "x "+ type +" Damage inflicted to: " + user.getCommandSenderName() + " (" + user.getEntityId() + ")");
    		}
    	}
		return dam;
	}
	private boolean isArmourFireImmune(ItemStack armour, DamageSource src)
	{
		if(armour != null && armour.getItem() instanceof IElementalResistance)
		{
			return ((IElementalResistance)armour.getItem()).getFireResistance(armour, src) >= 100F;
		}
		return false;
	}

	private String getDefaultParrySound(ItemStack weapon)
	{
		if(weapon.getUnlocalizedName().contains("wood") || weapon.getUnlocalizedName().contains("Wood") || weapon.getUnlocalizedName().contains("stone") || weapon.getUnlocalizedName().contains("Stone"))
		{
			return "minefantasy2:weapon.wood_parry";
		}
		return "mob.zombie.metal";
	}

	/**
	 * @return 0 for normal parry and 1 for evade
	 */
	private int onParry(DamageSource source, EntityLivingBase user, Entity attacker, float dam, float prevDam, IParryable parry)
	{
		/*
		if(RPGElements.isSystemActive && user instanceof EntityPlayer)
		{
			SkillList.block.addXP((EntityPlayer)user, 10 + (int)prevDam*2);
		}
		*/
		if(RPGElements.isSystemActive && user instanceof EntityPlayer )
		{
			SkillList.combat.addXP((EntityPlayer)user, (int)(prevDam/3F));
		}
		if(parry != null)
		{
			parry.onParry(source, user, attacker, dam);
		}

		boolean groundBlock = user.onGround;
		ItemStack weapon = user.getHeldItem();

		//Redirect
		if(!user.worldObj.isRemote && !TacticalManager.isRanged(source))
		{
			if(canEvade(user))
			{
				float powerMod = attacker.isSprinting() ? 4.0F : 2.5F;

				attacker.setSprinting(false);
				TacticalManager.lungeEntity(attacker, user, powerMod, 0.0F);
				TacticalManager.lungeEntity(user, attacker, 3F, 0.0F);
				return 1;
			}
		}
		return 0;
	}

	/**
	 * Determines if an evade can be made (jump or normal)
	 */
	private boolean canEvade(EntityLivingBase user)
	{
		float stamModifier = 1.0F;
		if(user instanceof EntityPlayer)
		{
			if(!ResearchLogic.hasInfoUnlocked((EntityPlayer)user, "parrypro"))
			{
				return false;
			}

			if(!isFightStance(user))
			{
				return false;
			}
		}
		else
		{
			if(rand.nextInt(10) != 0)//Mobs can evade
			{
				return false;
			}
		}

		if(!user.onGround && !tryJumpEvade(user, stamModifier))
		{
			return false;
		}
		return tryGroundEvade(user, stamModifier);
	}
	/**
	 * If the player can slip past enemies
	 * Should be any armour but heavy
	 */
	private boolean tryGroundEvade(EntityLivingBase user, float cost)
	{
		return ItemWeaponMF.tryPerformAbility(user, evade_cost*cost, true, false);
	}

	/**
	 * If the player can jump over enemies in evading
	 * Only ment for unarmoured/Lightarmour
	 */
	private boolean tryJumpEvade(EntityLivingBase user, float cost)
	{
		return ItemWeaponMF.tryPerformAbility(user, jumpEvade_cost*cost, true, false);
	}

	@SubscribeEvent
	public void updateLiving(LivingUpdateEvent event)
	{
		EntityLivingBase living = event.entityLiving;

		tickParryCooldown(living);
		tickPostHitCooldown(living);
		if(living instanceof EntityLiving)
		{
			EntityLiving mob = (EntityLiving)living;
			ItemStack held = mob.getHeldItem();

			{
				EntityLivingBase tar = mob.getAttackTarget();

				if(tar != null && tar instanceof EntityPlayer && ((EntityPlayer)tar).isBlocking())
				{
					double dist = mob.getDistanceSqToEntity(tar);

					if(tar instanceof EntityZombie && mob.onGround && mob.getRNG().nextInt(10) == 0 &&  dist > 1D && dist < 4D)
					{
						mob.motionY = 0.5F;
					}
				}
			}
			if(isAxe(held))
			{
				EntityLivingBase tar = mob.getAttackTarget();

				if(tar != null)
				{
					double dist = mob.getDistanceSqToEntity(tar);

					if(mob.onGround && mob.getRNG().nextInt(5) == 0 &&  dist > 1D && dist < 4.0D)
					{
						mob.motionY = 0.5F;
					}
				}
				if(mob.getRNG().nextInt(100) == 0 && !mob.isSprinting() && !mob.isChild())
				{
					mob.setSprinting(true);
				}
			}
			if(isFastblade(held))
			{
				EntityLivingBase tar = mob.getAttackTarget();

				if(tar != null)
				{
					double dist = mob.getDistanceSqToEntity(tar);

					if(mob.onGround && mob.getRNG().nextInt(20) == 0 &&  dist > 1D && dist < 4.0D)
					{
						mob.motionY = 0.5F;
					}
				}
				if(mob.getRNG().nextInt(20) == 0 && !mob.isSprinting() && !mob.isChild())
				{
					mob.setSprinting(true);
				}
			}
			if(living.isBurning() && !living.isImmuneToFire())
			{
				panic(living, 0.25F, 5);
			}
		}
	}
	private boolean isAxe(ItemStack held)
	{
		return held != null && held.getItem() instanceof ItemWaraxeMF || held != null && held.getItem() instanceof ItemBattleaxeMF;
	}
	private boolean isFastblade(ItemStack held)
	{
		return held != null && held.getItem() instanceof ItemDagger || held != null && held.getItem() instanceof ItemKatanaMF;
	}

	private void applyBalance(EntityPlayer entityPlayer)
	{
		MFLogUtil.logDebug("Weapon Balance Init");
		ItemStack weapon = entityPlayer.getHeldItem();
        float balance = 0.0F;

        if(weapon != null && weapon.getItem() instanceof IWeightedWeapon)
        {
        	balance = ((IWeightedWeapon)weapon.getItem()).getBalance(entityPlayer);
        }

        if (ConfigWeapon.useBalance && balance > 0 && entityPlayer != null)
        {
        	TacticalManager.throwPlayerOffBalance(entityPlayer, balance, true);
        }
	}

	public static void setParryCooldown(EntityLivingBase user, int ticks)
	{
		user.getEntityData().setInteger(parryCooldownNBT, ticks);

		if(!user.worldObj.isRemote && user instanceof EntityPlayer)
		{
			EntityPlayer player = (EntityPlayer)user;
			((WorldServer)player.worldObj).getEntityTracker().func_151248_b(player, new ParryPacket(ticks, player).generatePacket());
		}
	}
	public static int getParryCooldown(EntityLivingBase user)
	{
		if(user.getEntityData().hasKey(parryCooldownNBT))
		{
			return user.getEntityData().getInteger(parryCooldownNBT);
		}
		return 0;
	}
	public static void tickParryCooldown(EntityLivingBase user)
	{
		int ticks = getParryCooldown(user);
		if(ticks > 0)
		{
			setParryCooldown(user, ticks-1);
		}
	}
	public static boolean isParryAvailable(EntityLivingBase user)
	{
		return getParryCooldown(user)<= 0;
	}

	public static void setPostHitCooldown(EntityLivingBase user, int ticks)
	{
		user.getEntityData().setInteger(posthitCooldownNBT, ticks);
	}
	public static int getPostHitCooldown(EntityLivingBase user)
	{
		if(user.getEntityData().hasKey(posthitCooldownNBT))
		{
			return user.getEntityData().getInteger(posthitCooldownNBT);
		}
		return 0;
	}
	public static void tickPostHitCooldown(EntityLivingBase user)
	{
		int ticks = getPostHitCooldown(user);
		if(ticks > 0)
		{
			setPostHitCooldown(user, ticks-1);
		}
	}
	@SubscribeEvent
	public void jump(LivingJumpEvent event)
	{
		if(event.entityLiving instanceof EntityPlayer)
		{
			if(StaminaBar.isSystemActive && StaminaBar.doesAffectEntity(event.entityLiving))
			{
				StaminaMechanics.onJump(event.entityLiving);
			}
		}
	}

	/*
	 * Causes the victim to 'Spaz out' which never stops being funny (Apply every tick)
	 */
	public static void panic(EntityLivingBase victim, float speed, int directionTimer)
	{
		double moveX = victim.getEntityData().getDouble("MF2_PanicX");
		double moveZ = victim.getEntityData().getDouble("MF2_PanicZ");
    	victim.setJumping(true);

    	if((moveX == 0 && moveZ == 0) || rand.nextInt(directionTimer) == 0)
    	{
    		 moveX = (rand.nextDouble()-0.5D)*0.85D * speed;
    		 moveZ = (rand.nextDouble()-0.5D)*0.85D * speed;

    		 victim.getEntityData().setDouble("MF2_PanicX", moveX);
    		 victim.getEntityData().setDouble("MF2_PanicZ", moveZ);
    		 if(victim.onGround)victim.motionY = 0.25F;
    		 victim.rotationYaw = (float)(Math.atan2(moveX, moveZ));
    	}
    	victim.swingItem();
    	victim.limbSwing = 1.0F;
    	victim.moveEntity(moveX, 0D, moveZ);
	}

	private float modifyPlayerDamage(EntityPlayer hit, float dam)
	{
		if(ResearchLogic.hasInfoUnlocked(hit, KnowledgeListMF.toughness))
		{
			dam *= 0.75F;//25% Resist
		}
		return dam;
	}

	/**
	 * How much strength is added (directly adds to melee dmg)
	 */
	public static float getStrengthEnhancement(EntityLivingBase user)
	{
		float dam = 0F;
		if(CogworkArmour.hasPoweredSuit(user))
		{
			dam += 3F;
		}
		return Math.max(-0.5F, dam);
	}
}


text:
import Icon from 'app/components/Icon';
import { lookupContext, contextRender } from '../context';
import styles from '../context.css';
import type { AggregatedActivity, TagInfo } from '../types';
import type { Element } from 'react';

/**
 * Group by object
 */
export function activityHeader(
  aggregatedActivity: AggregatedActivity,
  htmlTag: (arg0: TagInfo) => Element<any>
) {
  const latestActivity = aggregatedActivity.lastActivity;
  const actor = lookupContext(aggregatedActivity, latestActivity.actor);
  const object = lookupContext(aggregatedActivity, latestActivity.object);
  return (

      {object.fromGroup ? (
        {object.fromGroup.name}
      ) : (
        htmlTag(contextRender[actor.contentType](actor))
      )}
      {' sendte ut en kunngjøring:'}

      {htmlTag(contextRender[object.contentType](object))}

  );
}
export function activityContent() {
  return null;
}
export function icon() {
  return <Icon name="chatbubbles" />;
}
export function getURL(aggregatedActivity: AggregatedActivity) {
  return '/timeline';
}


text:
        Nome
        Sono
        Pregio

        <input class="infoNamesInput1" type="text" name="attr_characterName" />
        <input class="infoNamesInput1" type="text" name="attr_race_and_role" />
        <input class="infoNamesInput1" type="text" name="attr_merit" />

      Punti Avventura<input type="number" name="attr_character_pa"
        class="pa_input" min="0" />

      Fiorini<input type="number" name="attr_florins" class="florins_input" min="0" />

      <input type="checkbox" class="sheet-toggle-show" />
      Mostra/Nascondi suggerimenti Caratteristiche Personaggio e Bestie
        Sovrane

Caratteristiche Personaggio: mettere a sinistra il numero di
        dadi (2 o 1) e a destra
        il modificatore con il simbolo (+1 o -1), come nella scheda originale.

Bestie Sovrane: negli
        spazi appositi, inserire i dadi da usare completi di numero, D e facce del dado (2D10 o
        2d10).

IMPORTANTE: le caselle di selezione a sinistra delle Caratteristiche Personaggio e a
        destra del nome delle Bestie Sovrane, servono solo a ricordare quale Pregio si possiede e quale
        trasformazione si possiede e non vanno a modificare il lancio dei dadi. Dovrete ricordarvi di ritirare
        il Pregio se il dado o i dadi fanno 1 o 2 su quella caratteristica.

        <input type="checkbox" name="attr_agility_merit">
        <input type="checkbox" name="attr_courage_merit">
        <input type="checkbox" name="attr_strength_merit">
        <input type="checkbox" name="attr_intelligence_merit">
        <input type="checkbox" name="attr_magic_merit">
        <input type="checkbox" name="attr_perception_merit">
        <input type="checkbox" name="attr_dexterity_merit">
        <input type="checkbox" name="attr_presence_merit">

        Agilità
        Coraggio
        Forza
        Intelligenza
        Magia
        Percezione
        Manualità
        Socialità

        <input class="ability_input_dice" type="text" name="attr_agility_dices">
        <input class="ability_input_dice" type="text" name="attr_courage_dices">
        <input class="ability_input_dice" type="text" name="attr_strength_dices">
        <input class="ability_input_dice" type="text" name="attr_intelligence_dices">
        <input class="ability_input_dice" type="text" name="attr_magic_dices">
        <input class="ability_input_dice" type="text" name="attr_perception_dices">
        <input class="ability_input_dice" type="text" name="attr_dexterity_dices">
        <input class="ability_input_dice" type="text" name="attr_presence_dices">

        D
        D
        D
        D
        D
        D
        D
        D

        <input class="ability_input_mod" type="text" name="attr_agility_mod">
        <input class="ability_input_mod" type="text" name="attr_courage_mod">
        <input class="ability_input_mod" type="text" name="attr_strength_mod">
        <input class="ability_input_mod" type="text" name="attr_intelligence_mod">
        <input class="ability_input_mod" type="text" name="attr_magic_mod">
        <input class="ability_input_mod" type="text" name="attr_perception_mod">
        <input class="ability_input_mod" type="text" name="attr_dexterity_mod">
        <input class="ability_input_mod" type="text" name="attr_presence_mod">

        <button type="roll"
          value="&{template:default} {{name=@{characterName}, Agilità}} {{Agilità=[[@{agility_dices}d10skh1 @{agility_mod}]]}}"></button>
        <button type="roll"
          value="&{template:default} {{name=@{characterName}, Coraggio}} {{Coraggio=[[@{courage_dices}d10skh1 @{courage_mod}]]}}"></button>
        <button type="roll"
          value="&{template:default} {{name=@{characterName}, Forza}} {{Forza=[[@{strength_dices}d10skh1 @{strength_mod}]]}}"></button>
        <button type="roll"
          value="&{template:default} {{name=@{characterName}, Intelligenza}} {{Intelligenza=[[@{intelligence_dices}d10skh1 @{intelligence_mod}]]}}"></button>
        <button type="roll"
          value="&{template:default} {{name=@{characterName}, Magia}} {{Magia=[[@{magic_dices}d10skh1 @{magic_mod}]]}}"></button>
        <button type="roll"
          value="&{template:default} {{name=@{characterName}, Percezione}} {{Percezione=[[@{perception_dices}d10skh1 @{perception_mod}]]}}"></button>
        <button type="roll"
          value="&{template:default} {{name=@{characterName}, Manualità}} {{Manualità=[[@{dexterity_dices}d10skh1 @{dexterity_mod}]]}}"></button>
        <button type="roll"
          value="&{template:default} {{name=@{characterName}, Socialità}} {{Socialità=[[@{presence_dices}d10skh1 @{presence_mod}]]}}"></button>

          Orso
          <input class="bsCheckbox" type="checkbox">

          Cervo
          <input class="bsCheckbox" type="checkbox">

          Aquila
          <input class="bsCheckbox" type="checkbox">

          Serpente
          <input class="bsCheckbox" type="checkbox">

        <input class="inputBs" name="attr_bear_agility" type="text">
        <button type="roll"
          value="&{template:default} {{name=@{characterName}, Orso}} {{Agilità=[[@{bear_agility}skh1]]}}"></button>
        <input class="inputBs" name="attr_deer_agility" type="text">
        <button type="roll"
          value="&{template:default} {{name=@{characterName}, Cervo}} {{Agilità=[[@{deer_agility}skh1]]}}"></button>
        <input class="inputBs" name="attr_eagle_agility" type="text">
        <button type="roll"
          value="&{template:default} {{name=@{characterName}, Aquila}} {{Agilità=[[@{eagle_agility}skh1]]}}"></button>
        <input class="inputBs" name="attr_snake_agility" type="text">
        <button type="roll"
          value="&{template:default} {{name=@{characterName}, Serpente}} {{Agilità=[[@{snake_agility}skh1]]}}"></button>

        <input class="inputBs" name="attr_bear_courage" type="text">
        <button type="roll"
          value="&{template:default} {{name=@{characterName}, Orso}} {{Coraggio=[[@{bear_courage}skh1]]}}"></button>
        <input class="inputBs" name="attr_deer_courage" type="text">
        <button type="roll"
          value="&{template:default} {{name=@{characterName}, Cervo}} {{Coraggio=[[@{deer_courage}skh1]]}}"></button>
        <input class="inputBs" name="attr_eagle_courage" type="text">
        <button type="roll"
          value="&{template:default} {{name=@{characterName}, Aquila}} {{Coraggio=[[@{eagle_courage}skh1]]}}"></button>
        <input class="inputBs" name="attr_snake_courage" type="text">
        <button type="roll"
          value="&{template:default} {{name=@{characterName}, Serpente}} {{Coraggio=[[@{snake_courage}skh1]]}}"></button>

        <input class="inputBs" name="attr_bear_strength" type="text">
        <button type="roll"
          value="&{template:default} {{name=@{characterName}, Orso}} {{Forza=[[@{bear_strength}skh1]]}}"></button>
        <input class="inputBs" name="attr_deer_strength" type="text">
        <button type="roll"
          value="&{template:default} {{name=@{characterName}, Cervo}} {{Forza=[[@{deer_strength}skh1]]}}"></button>
        <input class="inputBs" name="attr_eagle_strength" type="text">
        <button type="roll"
          value="&{template:default} {{name=@{characterName}, Aquila}} {{Forza=[[@{eagle_strength}skh1]]}}"></button>
        <input class="inputBs" name="attr_snake_strength" type="text">
        <button type="roll"
          value="&{template:default} {{name=@{characterName}, Serpente}} {{Forza=[[@{snake_strength}skh1]]}}"></button>

        <input class="inputBs" name="attr_bear_intelligence" type="text">
        <button type="roll"
          value="&{template:default} {{name=@{characterName}, Orso}} {{Intelligenza=[[@{bear_intelligence}skh1]]}}"></button>
        <input class="inputBs" name="attr_deer_intelligence" type="text">
        <button type="roll"
          value="&{template:default} {{name=@{characterName}, Cervo}} {{Intelligenza=[[@{deer_intelligence}skh1]]}}"></button>
        <input class="inputBs" name="attr_eagle_intelligence" type="text">
        <button type="roll"
          value="&{template:default} {{name=@{characterName}, Aquila}} {{Intelligenza=[[@{eagle_intelligence}skh1]]}}"></button>
        <input class="inputBs" name="attr_snake_intelligence" type="text">
        <button type="roll"
          value="&{template:default} {{name=@{characterName}, Serpente}} {{Intelligenza=[[@{snake_intelligence}skh1]]}}"></button>

        <input class="inputBs" name="attr_bear_magic" type="text">
        <button type="roll"
          value="&{template:default} {{name=@{characterName}, Orso}} {{Magia=[[@{bear_magic}skh1]]}}"></button>
        <input class="inputBs" name="attr_deer_magic" type="text">
        <button type="roll"
          value="&{template:default} {{name=@{characterName}, Cervo}} {{Magia=[[@{deer_magic}skh1]]}}"></button>
        <input class="inputBs" name="attr_eagle_magic" type="text">
        <button type="roll"
          value="&{template:default} {{name=@{characterName}, Aquila}} {{Magia=[[@{eagle_magic}skh1]]}}"></button>
        <input class="inputBs" name="attr_snake_magic" type="text">
        <button type="roll"
          value="&{template:default} {{name=@{characterName}, Serpente}} {{Magia=[[@{snake_magic}skh1]]}}"></button>

        <input class="inputBs" name="attr_bear_perception" type="text">
        <button type="roll"
          value="&{template:default} {{name=@{characterName}, Orso}} {{Percezione=[[@{bear_perception}skh1]]}}"></button>
        <input class="inputBs" name="attr_deer_perception" type="text">
        <button type="roll"
          value="&{template:default} {{name=@{characterName}, Cervo}} {{Percezione=[[@{deer_perception}skh1]]}}"></button>
        <input class="inputBs" name="attr_eagle_perception" type="text">
        <button type="roll"
          value="&{template:default} {{name=@{characterName}, Aquila}} {{Percezione=[[@{eagle_perception}skh1]]}}"></button>
        <input class="inputBs" name="attr_snake_perception" type="text">
        <button type="roll"
          value="&{template:default} {{name=@{characterName}, Serpente}} {{Percezione=[[@{snake_perception}skh1]]}}"></button>

        <input class="inputBs" name="attr_bear_dexterity" type="text">
        <button type="roll"
          value="&{template:default} {{name=@{characterName}, Orso}} {{Manualità=[[@{bear_dexterity}skh1]]}}"></button>
        <input class="inputBs" name="attr_deer_dexterity" type="text">
        <button type="roll"
          value="&{template:default} {{name=@{characterName}, Cervo}} {{Manualità=[[@{deer_dexterity}skh1]]}}"></button>
        <input class="inputBs" name="attr_eagle_dexterity" type="text">
        <button type="roll"
          value="&{template:default} {{name=@{characterName}, Aquila}} {{Manualità=[[@{eagle_dexterity}skh1]]}}"></button>
        <input class="inputBs" name="attr_snake_dexterity" type="text">
        <button type="roll"
          value="&{template:default} {{name=@{characterName}, Serpente}} {{Manualità=[[@{snake_dexterity}skh1]]}}"></button>

        <input class="inputBs" name="attr_bear_presence" type="text">
        <button type="roll"
          value="&{template:default} {{name=@{characterName}, Orso}} {{Socialità=[[@{bear_presence}skh1]]}}"></button>
        <input class="inputBs" name="attr_deer_presence" type="text">
        <button type="roll"
          value="&{template:default} {{name=@{characterName}, Cervo}} {{Socialità=[[@{deer_presence}skh1]]}}"></button>
        <input class="inputBs" name="attr_eagle_presence" type="text">
        <button type="roll"
          value="&{template:default} {{name=@{characterName}, Aquila}} {{Socialità=[[@{eagle_presence}skh1]]}}"></button>
        <input class="inputBs" name="attr_snake_presence" type="text">
        <button type="roll"
          value="&{template:default} {{name=@{characterName}, Serpente}} {{Socialità=[[@{snake_presence}skh1]]}}"></button>

      <input type="checkbox" class="sheet-toggle-show" />
      Mostra/Nascondi suggerimenti Armi e Abilità

Armi e Abilità: inserire il nome dell'arma o dell'abilità nella parte di sopra.
        Nella parte di sotto, a sinistra i dadi da usare completi di numero, D e facce del dado (2D10 o 2d10) e
        a destra il modificatore (+1 o -1), poi premere il bottone adiacente che li tirerà. Si possono mettere
        fino a tre tiri di dado per abilità (esempio: Getto di Fiamme ha bersagli, tiro per colpire e danno)

          Salute

              Attuale<input class="inputStats" type="number" name="attr_character_life">

              Massima<input class="inputStats" type="number" name="attr_character_life_max">

          Mana

              Attuale<input class="inputStats" type="number" name="attr_character_mana" min="0">

              Massimo<input class="inputStats" type="number" name="attr_character_mana_max" min="0">

          Armatura

              <input class="inputStats" type="number" name="attr_character_armor" min="0">

Arma<input type="text" class="weaponInput" name="attr_firstWeaponName">

              Attacco

              <input class="inputWeaponDice" type="text" name="attr_attackDice">
              <input class="inputWeaponDiceMod" type="text" name="attr_attackDiceMod">

              <button type="roll" name="attackRoll"
                value="&{template:default} {{name=@{characterName}, @{firstWeaponName}}} {{Attacco=[[@{attackDice}skh1 @{attackDiceMod}]]}}"></button>

              Danno

              <input class="inputWeaponDice" type="text" name="attr_damageDice">
              <input class="inputWeaponDiceMod" type="text" name="attr_damageDiceMod">

              <button type="roll" name="damageRoll"
                value="&{template:default} {{name=@{characterName}, @{firstWeaponName}}} {{Danno=[[@{damageDice}skh1 @{damageDiceMod}]]}}"></button>

Arma<input type="text" class="weaponInput" name="attr_secondWeaponName">

              Attacco

              <input class="inputWeaponDice" type="text" name="attr_attackDice2">
              <input class="inputWeaponDiceMod" type="text" name="attr_attackDiceMod2">

              <button type="roll" name="attr_attackRoll2"
                value="&{template:default} {{name=@{characterName}, @{secondWeaponName}}} {{Attacco=[[@{attackDice2}skh1 @{attackDiceMod2}]]}}"></button>

              Danno

              <input class="inputWeaponDice" type="text" name="attr_damageDice2">
              <input class="inputWeaponDiceMod" type="text" name="attr_damageDiceMod2">

              <button type="roll" name="damageRoll2"
                value="&{template:default} {{name=@{characterName}, @{secondWeaponName}}} {{Danno=[[@{damageDice2}skh1 @{damageDiceMod2}]]}}"></button>

Arma<input type="text" class="weaponInput" name="attr_thirdWeaponName">

              Attacco

              <input class="inputWeaponDice" type="text" name="attr_attackDice3">
              <input class="inputWeaponDiceMod" type="text" name="attr_attackDiceMod3">

              <button type="roll" name="attackRoll2"
                value="&{template:default} {{name=@{characterName}, @{thirdWeaponName}}} {{Attacco=[[@{attackDice3}skh1 @{attackDiceMod3}]]}}"></button>

              Danno

              <input class="inputWeaponDice" type="text" name="attr_damageDice3">
              <input class="inputWeaponDiceMod" type="text" name="attr_damageDiceMod3">

              <button type="roll" name="damageRoll3"
                value="&{template:default} {{name=@{characterName}, @{thirdWeaponName}}} {{Danno=[[@{damageDice3}skh1 @{damageDiceMod3}]]}}"></button>

Arma<input type="text" class="weaponInput" name="attr_fourthWeaponName">

              Attacco

              <input class="inputWeaponDice" type="text" name="attr_attackDice4">
              <input class="inputWeaponDiceMod" type="text" name="attr_attackDiceMod4">

              <button type="roll" name="attackRoll4"
                value="&{template:default} {{name=@{characterName}, @{fourthWeaponName}}} {{Attacco=[[@{attackDice4}skh1 @{attackDiceMod4}]]}}"></button>

              Danno

              <input class="inputWeaponDice" type="text" name="attr_damageDice4">
              <input class="inputWeaponDiceMod" type="text" name="attr_damageDiceMod4">

              <button type="roll" name="damageRoll4"
                value="&{template:default} {{name=@{characterName}, @{fourthWeaponName}}} {{Danno=[[@{damageDice4}skh1 @{damageDiceMod4}]]}}"></button>

          Freccie/Dardi

            <input class="inputStats" type="number" max="20" min="0" name="attr_ammo">

          Razioni

            <input class="inputStats" type="number" max="20" min="0" name="attr_rations">

          Borraccia

            <input class="inputStats" type="number" max="7" min="0" name="attr_water">

Abilità<input type="text" class="abilityInput" name="attr_ability_name">

          <input type="text" class="extraAbilityInput2" name="attr_ability_roll_cx">
          <input type="text" class="extraAbilityInput3" name="attr_ability_roll_mod_cx">
          <button type="roll"
            value="&{template:default} {{name=@{characterName}, @{ability_name}}} {{Roll=[[@{ability_roll_cx}skh1 @{ability_roll_mod_cx}]]}}"></button>
          <input type="text" class="extraAbilityInput2" name="attr_ability_roll_sx">
          <input type="text" class="extraAbilityInput3" name="attr_ability_roll_mod_sx">
          <button type="roll"
            value="&{template:default} {{name=@{characterName}, @{ability_name}}} {{Roll=[[@{ability_roll_sx}skh1 @{ability_roll_mod_sx}]]}}"></button>
          <input type="text" class="extraAbilityInput2" name="attr_ability_roll_dx">
          <input type="text" class="extraAbilityInput3" name="attr_ability_roll_mod_dx">
          <button type="roll"
            value="&{template:default} {{name=@{characterName}, @{ability_name}}} {{Roll=[[@{ability_roll_dx}skh1 @{ability_roll_mod_dx}]]}}"></button>

Abilità<input type="text" class="abilityInput" name="attr_ability_name2">

          <input type="text" class="extraAbilityInput2" name="attr_ability_roll_cx2">
          <input type="text" class="extraAbilityInput3" name="attr_ability_roll_mod_cx2">
          <button type="roll"
            value="&{template:default} {{name=@{characterName}, @{ability_name2}}} {{Roll=[[@{ability_roll_cx2}skh1 @{ability_roll_mod_cx2}]]}}"></button>
          <input type="text" class="extraAbilityInput2" name="attr_ability_roll_sx2">
          <input type="text" class="extraAbilityInput3" name="attr_ability_roll_mod_sx2">
          <button type="roll"
            value="&{template:default} {{name=@{characterName}, @{ability_name2}}} {{Roll=[[@{ability_roll_sx2}skh1 @{ability_roll_mod_sx2}]]}}"></button>
          <input type="text" class="extraAbilityInput2" name="attr_ability_roll_dx2">
          <input type="text" class="extraAbilityInput3" name="attr_ability_roll_mod_dx2">
          <button type="roll"
            value="&{template:default} {{name=@{characterName}, @{ability_name2}}} {{Roll=[[@{ability_roll_dx2}skh1 @{ability_roll_mod_dx2}]]}}"></button>

Abilità<input type="text" class="abilityInput" name="attr_ability_name3">

          <input type="text" class="extraAbilityInput2" name="attr_ability_roll_cx3">
          <input type="text" class="extraAbilityInput3" name="attr_ability_roll_mod_cx3">
          <button type="roll"
            value="&{template:default} {{name=@{characterName}, @{ability_name3}}} {{Roll=[[@{ability_roll_cx3}skh1 @{ability_roll_mod_cx3}]]}}"></button>
          <input type="text" class="extraAbilityInput2" name="attr_ability_roll_sx3">
          <input type="text" class="extraAbilityInput3" name="attr_ability_roll_mod_sx3">
          <button type="roll"
            value="&{template:default} {{name=@{characterName}, @{ability_name3}}} {{Roll=[[@{ability_roll_sx3}skh1 @{ability_roll_mod_sx3}]]}}"></button>
          <input type="text" class="extraAbilityInput2" name="attr_ability_roll_dx3">
          <input type="text" class="extraAbilityInput3" name="attr_ability_roll_mod_dx3">
          <button type="roll"
            value="&{template:default} {{name=@{characterName}, @{ability_name3}}} {{Roll=[[@{ability_roll_dx3}skh1 @{ability_roll_mod_dx3}]]}}"></button>

Abilità<input type="text" class="abilityInput" name="attr_ability_name4">

          <input type="text" class="extraAbilityInput2" name="attr_ability_roll_cx4">
          <input type="text" class="extraAbilityInput3" name="attr_ability_roll_mod_cx4">
          <button type="roll"
            value="&{template:default} {{name=@{characterName}, @{ability_name4}}} {{Roll=[[@{ability_roll_cx4}skh1 @{ability_roll_mod_cx4}]]}}"></button>
          <input type="text" class="extraAbilityInput2" name="attr_ability_roll_sx4">
          <input type="text" class="extraAbilityInput3" name="attr_ability_roll_mod_sx4">
          <button type="roll"
            value="&{template:default} {{name=@{characterName}, @{ability_name4}}} {{Roll=[[@{ability_roll_sx4}skh1 @{ability_roll_mod_sx4}]]}}"></button>
          <input type="text" class="extraAbilityInput2" name="attr_ability_roll_dx4">
          <input type="text" class="extraAbilityInput3" name="attr_ability_roll_mod_dx4">
          <button type="roll"
            value="&{template:default} {{name=@{characterName}, @{ability_name4}}} {{Roll=[[@{ability_roll_dx4}skh1 @{ability_roll_mod_dx4}]]}}"></button>

Abilità<input type="text" class="abilityInput" name="attr_ability_name5">

          <input type="text" class="extraAbilityInput2" name="attr_ability_roll_cx5">
          <input type="text" class="extraAbilityInput3" name="attr_ability_roll_mod_cx5">
          <button type="roll"
            value="&{template:default} {{name=@{characterName}, @{ability_name5}}} {{Roll=[[@{ability_roll_cx5}skh1 @{ability_roll_mod_cx5}]]}}"></button>
          <input type="text" class="extraAbilityInput2" name="attr_ability_roll_sx5">
          <input type="text" class="extraAbilityInput3" name="attr_ability_roll_mod_sx5">
          <button type="roll"
            value="&{template:default} {{name=@{characterName}, @{ability_name5}}} {{Roll=[[@{ability_roll_sx5}skh1 @{ability_roll_mod_sx5}]]}}"></button>
          <input type="text" class="extraAbilityInput2" name="attr_ability_roll_dx5">
          <input type="text" class="extraAbilityInput3" name="attr_ability_roll_mod_dx5">
          <button type="roll"
            value="&{template:default} {{name=@{characterName}, @{ability_name5}}} {{Roll=[[@{ability_roll_dx5}skh1 @{ability_roll_mod_dx5}]]}}"></button>

      Orso

          Attuale<input class="inputStats" type="number" name="attr_bear_healt">

          Massima<input class="inputStats" type="number" name="attr_bear_healt_max">

      Cervo

          Attuale<input class="inputStats" type="number" name="attr_deer_healt">

          Massima<input class="inputStats" type="number" name="attr_deer_healt_max">

      Aquila

          Attuale<input class="inputStats" type="number" name="attr_eagle_healt">

          Massima<input class="inputStats" type="number" name="attr_eagle_healt_max">

      Serpente

          Attuale<input class="inputStats" type="number" name="attr_snake_healt">

          Massima<input class="inputStats" type="number" name="attr_snake_healt_max">

Abilità di razza

      <textarea class="equipAbilityInputLeft" name="attr_race_abilites"></textarea>

Equipaggiamento

      <textarea class="equipAbilityInputLeft" name="attr_equip"></textarea>

Abilità di ruolo

      <textarea class="equipAbilityInputRight" name="attr_role_abilites"></textarea>