code:
package classes.display
{
	import flash.display.MovieClip;
	import flash.text.Font;
	import flash.text.TextField;
	import coc.view.CoCButton;
	import flash.text.TextFormat;
	import flash.text.TextFormatAlign;
	import flash.text.AntiAliasType;

	import buttonBackground0;
	import ButtonLabelFont;

	/**
	 * Defines a composite display object of all the seperate components required to display a
	 * single BoundControlMethod, its associated primary and secondary bindings with the buttons
	 * used to bind methods to new keys.
	 * @author Gedan
	 */
	public class BindDisplay extends MovieClip
	{
		// Object components and settings
		private var _maxWidth:int;
		private var _nameLabel:TextField;
		private var _buttons:Array;
		private var _buttonBgs:Array;

		// Shared formatting information
		// TODO: this should probably be statically initialized. Global static formatting class?
		private var _textFormatLabel:TextFormat;
		private var _textFormatButton:TextFormat;
		private var _textFont:Font;

		// Storage attributes for the button text, so we can wrap it seperately in HTML tags
		// and store the raw value here, for return on demand.
		private var _button1Text:String;
		private var _button2Text:String;

		// Values for the contained button sizing/offsets
		private static const BUTTON_X_OFFSET :Number = 200;
		private static const BUTTON_Y_OFFSET :Number = 668;
		private static const BUTTON_X_DELTA :Number = 160;
		public static const BUTTON_Y_DELTA :Number = 52;
		private static const BUTTON_REAL_WIDTH :Number = 150;
		private static const BUTTON_REAL_HEIGHT :Number = 40;

		/**
		 * Create a new composite object, initilizing the label to be used for display, as well as the two
		 * buttons used for user interface.
		 *
		 * @param	maxWidth	Defines the maximum available width that the control can consume for positining math
		 */
		public function BindDisplay(maxWidth:int)
		{
			_maxWidth = maxWidth;

			// TODO: This is also the kind of thing that would be handy to stuff into a global static class
			// to init global formatting objects in a central location
			InitFormatting();
			InitButtons();
			InitLabel();
		}

		/**
		 * Init the shared formatting objects.
		 */
		private function InitFormatting():void
		{
			_textFont = new ButtonLabelFont();

			_textFormatLabel = new TextFormat();
			_textFormatLabel.font = _textFont.fontName; // Pulls in our embedded fonts from the swc to use dynamically!
			_textFormatLabel.size = 18;
			_textFormatLabel.align = TextFormatAlign.RIGHT;

			_textFormatButton = new TextFormat();
			_textFormatButton.font = _textFont.fontName;
			_textFormatButton.size = 18;
			_textFormatButton.align = TextFormatAlign.CENTER;
		}

		/**
		 * Create the button pair used for user input.
		 *
		 * TODO: This code does a lot of things that should realistically be rolled into the underlying
		 * CoCButton class, or at least, some kind of wrapper around it. The approach, combined with the
		 * shared text formatting, would probably allow us to move to having a properly contained button class
		 * without the need for seperate labels.
		 */
		private function InitButtons():void
		{
			_buttons = new Array();
			_buttonBgs = new Array();

			var b:MovieClip;
			var button:CoCButton;
			var tf:TextField;

			var xPos:int;
			xPos = (_maxWidth - 15) - ( 2 * BUTTON_X_DELTA);

			for (var i:int = 0; i < 2; i++)
			{
				b = new buttonBackground0();
				b.name = "ctrlBtn" + String(i);
				b.x = xPos;
				xPos += BUTTON_X_DELTA;
				b.y = 0;
				b.width = BUTTON_REAL_WIDTH;
				b.height = BUTTON_REAL_HEIGHT;

				tf = new TextField();
				tf.defaultTextFormat = _textFormatButton;
				tf.embedFonts = true;
				tf.antiAliasType = AntiAliasType.ADVANCED;
				tf.htmlText = "Unbound";

				button = new CoCButton(tf, b);

				_buttons.push(button);
				_buttonBgs.push(b);
				this.addChild(button);
			}
		}

		/**
		 * Create the primary label field used for text display outside of the buttons.
		 */
		private function InitLabel():void
		{
			_nameLabel = new TextField();
			_nameLabel.defaultTextFormat = _textFormatLabel;
			_nameLabel.embedFonts = true;
			_nameLabel.antiAliasType = AntiAliasType.ADVANCED;
			_nameLabel.text = "THIS IS SOME KINDA CRAZY LABEL";
			_nameLabel.width = _maxWidth - ( 2 * BUTTON_X_DELTA ) - 20;
			_nameLabel.y = _buttons[0].labelField.y;
			this.addChild(_nameLabel);
		}

		public function get text():String
		{
			return _nameLabel.text;
		}

		public function set text(value:String):void
		{
			_nameLabel.text = value;
		}

		public function get htmlText():String
		{
			return _nameLabel.htmlText;
		}

		public function set htmlText(value:String):void
		{
			_nameLabel.htmlText = value;
		}

		public function get button1Text():String
		{
			return _button1Text;
		}

		public function get button2Text():String
		{
			return _button2Text;
		}

		public function set button1Text(value:String):void
		{
			if (value != _button1Text)
			{
				_button1Text = value;
				_buttons[0].labelField.htmlText = "" + _button1Text + "";
			}
		}

		public function set button2Text(value:String):void
		{
			if (value != _button2Text)
			{
				_button2Text = value;
				_buttons[1].labelField.htmlText = "" + _button2Text + "";
			}
		}

		public function set button1Callback(callback:Function):void
		{
			_buttons[0].callback = callback;
		}

		public function set button2Callback(callback:Function):void
		{
			_buttons[1].callback = callback;
		}
	}

}


code:
package classes.display
{
	import classes.BoundControlMethod;
	import classes.InputManager;
	import fl.containers.ScrollPane;
	import flash.display.DisplayObject;
	import flash.display.MovieClip;
	import flash.display.Stage;
	import flash.events.Event;
	import flash.events.MouseEvent;
	import flash.text.TextField;
	import flash.text.TextFormat;
	import flash.utils.Dictionary;
	import flash.ui.Keyboard;
	import flash.utils.describeType;
	import classes.display.BindDisplay;
	import flash.text.TextFieldAutoSize;

	/**
	 * Defines a new UI element, providing a scrollable container to be used for display of bound
	 * keyboard controls.
	 * @author Gedan
	 */
	public class BindingPane extends ScrollPane
	{
		private var _inputManager:InputManager;
		private var _stage:Stage;

		// A lookup for integer keyCodes -> string representations
		private var _keyDict:Dictionary;

		private var _functions:Array;
		private var _newFuncs:Array;

		private var _content:MovieClip;
		private var _contentChildren:int;

		/**
		 * Initiate the BindingPane, setting the stage positioning and reference back to the input manager
		 * so we can generate function callbacks later.
		 *
		 * @param	inputManager	Reference to the game input manager for method access
		 * @param	xPos			X position on the stage for the top-left corner of the ScrollPane
		 * @param	yPos			Y position on the stage for the top-left corner of the ScrollPane
		 * @param	width			Fixed width of the containing ScrollPane
		 * @param	height			Fixed height of the containing ScrollPane
		 */
		public function BindingPane(inputManager:InputManager, xPos:int, yPos:int, width:int, height:int, uiscrollwidth:int)
		{
			_inputManager = inputManager;

			/* This is a super super fucking annoying fix. The TextField class, whilst it supports being bound to a
			*  doesn't include a scrollbar by default, it has to be attached as a sperate, distinct component. It's
			*  literally bolted onto the side, and isn't part of the sizing information of the TextField itself.
			*  ScrollPanes on the other hand, DO feature a scrollbar as a core part of their functionality. And
			*  for ScrollPanes, the UIScrollBar is included in the total sizing information. Whoever wrote this shit
			*  was literally on crack, I SWEAR TO GOD. */
			this.width = width + uiscrollwidth + 3;
			this.height = height - 3;

			this.x = xPos - 1;
			this.y = yPos;

			// Cheap hack to remove the stupid styling elements of the stock ScrollPane
			var blank:MovieClip = new MovieClip();
			this.setStyle("upSkin", blank);

			// Build the keyCode->string lookup object
			this.PopulateKeyboardDict();

			// Initiate a new container for content that will be placed in the scroll pane
			_content = new MovieClip();
			_content.name = "controlContent";
			_contentChildren = 0;

			// Hook into some stuff so that we can fix some bugs that ScrollPane has
			this.addEventListener(Event.ADDED_TO_STAGE, AddedToStage);
		}

		/**
		 * Cleanly get us a reference to the stage to add/remove other event listeners
		 * @param	e
		 */
		private function AddedToStage(e:Event):void
		{
			this.removeEventListener(Event.ADDED_TO_STAGE, AddedToStage);
			this.addEventListener(Event.REMOVED_FROM_STAGE, RemovedFromStage);

			_stage = this.stage;

			_stage.addEventListener(MouseEvent.MOUSE_WHEEL, MouseScrollEvent);
		}

		private function RemovedFromStage(e:Event):void
		{
			this.removeEventListener(Event.REMOVED_FROM_STAGE, RemovedFromStage);
			this.addEventListener(Event.ADDED_TO_STAGE, AddedToStage);

			_stage.removeEventListener(MouseEvent.MOUSE_WHEEL, MouseScrollEvent);
		}

		private function MouseScrollEvent(e:MouseEvent):void
		{
			this.verticalScrollPosition += -( e.delta * 8 );
		}

		public function ListBindingOptions():void
		{
			if (_contentChildren == 0)
			{
				InitContentObjects();
			}
			else
			{
				UpdateContentObjects();
			}

			this.source = _content;
		}

		/**
		 * Initiate the container used to display all of the available functions that can be bound,
		 * along with a pair of buttons representing primary and secondary keys.
		 * The buttons call back into the input manager to trigger the key binding mode, display object
		 * switches, and set state so the input manager knows what function to bind an incoming keyCode
		 * to.
		 * TODO: Shoot self in face.
		 */
		private function InitContentObjects():void
		{
			// Add a nice little instructional field at the top of the display.
			var _textFormatLabel:TextFormat = new TextFormat();
			_textFormatLabel.size = 20;

			var helpLabel:TextField = new TextField();
			helpLabel.name = "helpLabel";
			helpLabel.x = 10;
			helpLabel.width = this.width - 40;
			helpLabel.defaultTextFormat = _textFormatLabel;
			helpLabel.multiline = true;
			helpLabel.wordWrap = true;
			helpLabel.autoSize = TextFieldAutoSize.LEFT; // With multiline enabled, this SHOULD force the textfield to resize itself vertically dependent on content.
			helpLabel.htmlText = "Keyboard Control Bindings:\n\n";
			helpLabel.htmlText += "Click a button next to the action you wish to bind to a new key, then hit the key you want to bind the selected action to.\n\n"
			helpLabel.htmlText += "Custom bindings are stored inside your save game files.\n\n";
			helpLabel.htmlText += "Duplicate keys are automatically unbound from their old control action.\n\n";
			helpLabel.htmlText += "Reset Ctrls will reset all of the control bindings to their defaults.\n\n";
			helpLabel.htmlText += "Clear Ctrls will remove all of the current control bindings, leaving everything Unbound.\n\n";

			//helpLabel.height *= 2;

			_contentChildren++;
			_content.addChild(helpLabel);

			for (var i:int = 0; i < _functions.length; i++)
			{
				_contentChildren++;

				var newLabel:BindDisplay = new BindDisplay(this.width);
				newLabel.name = _functions[i].Name;
				newLabel.x = 2;
				newLabel.y = ( BindDisplay.BUTTON_Y_DELTA * i ) + ( 7 + helpLabel.textHeight );
				newLabel.htmlText = "" + _functions[i].Name + ":";
				newLabel.button1Text = _keyDict[_functions[i].PrimaryKey];
				newLabel.button2Text = _keyDict[_functions[i].SecondaryKey];

				// This is going to look crazy...
				var genPrimaryCallback:Function = function(funcName:String, inMan:InputManager):Function
				{
					return function():void
					{
						inMan.ListenForNewBind(funcName, InputManager.PRIMARYKEY);
						_stage.focus = _stage;
					}
				}

				var genSecondaryCallback:Function = function(funcName:String, inMan:InputManager):Function
				{
					return function():void
					{
						inMan.ListenForNewBind(funcName, InputManager.SECONDARYKEY);
						_stage.focus = _stage;
					}
				}
				// ... Warned you.

				newLabel.button1Callback = genPrimaryCallback(_functions[i].Name, _inputManager);
				newLabel.button2Callback = genSecondaryCallback(_functions[i].Name, _inputManager);

				_content.addChild(newLabel);
			}
		}

		/**
		 * Operating under the assumption that new control cannot be added once the game is running,
		 * ie we will never see new controls in the incoming function list versus what it contained
		 * when we initially created the display objects in the _content container.
		 */
		private function UpdateContentObjects():void
		{
			for (var i:int = 0; i < _functions.length; i++)
			{
				var currLabel:BindDisplay = _content.getChildByName(_functions[i].Name) as BindDisplay;

				currLabel.button1Text = _keyDict[_functions[i].PrimaryKey];
				currLabel.button2Text = _keyDict[_functions[i].SecondaryKey];
			}
		}

		/**
		 * Builds a dictionary to lookup keyCode values -> string representations of key names.
		 * Handles things like turning keyCode = 8 into "BACKSPACE" rather than an undisplayable
		 * character.
		 * TODO: Probably work out a good way of shortening some possibly long key names.
		 */
		private function PopulateKeyboardDict():void
		{

			var keyDescriptions:XML = describeType(Keyboard);
			var keyNames:XMLList = keyDescriptions..constant.@name;

			_keyDict = new Dictionary();

			for (var i:int = 0; i < keyNames.length(); i++)
			{
				_keyDict[Keyboard[keyNames[i]]] = keyNames[i];
			}

			_keyDict[ -1] = "Unbound";
		}

		public function set functions(funcs:Array):void
		{
			_functions = funcs;
		}

		public function get functions():Array
		{
			return _functions;
		}
	}
}

license: unknown


code:
/**
 * Created by aimozg on 11.01.14.
 */
package classes.internals
{
	import classes.CoC_Settings;

	public class ChainedDrop implements RandomDrop
	{
		private var items:Array = [];
		private var probs:Array = [];
		private var defaultItem:*;
		public function ChainedDrop(defaultItem:* = null)
		{
			this.defaultItem = defaultItem;
		}
		public function add(item:*,prob:Number):ChainedDrop{
			if (prob<0 || prob>1){
				CoC_Settings.error("Invalid probability value "+prob);
			}
			items.push(item);
			probs.push(prob);
			return this;
		}
		public function elseDrop(item:*):ChainedDrop{
			this.defaultItem = item;
			return this;
		}

		public function roll():*
		{
			for (var i:int = 0; i<items.length; i++){
				if (Math.random()<probs[i]) return items[i];
			}
			return defaultItem;
		}
	}
}


code:
/**
 * Created by aimozg on 11.01.14.
 */
package classes.internals
{
	public interface RandomDrop
	{
		function roll():*;
	}
}


code:
/**
 * Created by aimozg on 18.01.14.
 */
package classes.internals
{
	import classes.*;
	public class Utils extends Object
	{
		private static const NUMBER_WORDS_NORMAL:Array		= ["zero", "one", "two", "three", "four", "five", "six", "seven", "eight", "nine", "ten"];
		private static const NUMBER_WORDS_CAPITAL:Array		= ["Zero", "One", "Two", "Three", "Four", "Five", "Six", "Seven", "Eight", "Nine", "Ten"];
		private static const NUMBER_WORDS_POSITIONAL:Array	= ["zeroth", "first", "second", "third", "fourth", "fifth", "sixth", "seventh", "eighth", "ninth", "tenth"];

		public function Utils()
		{
		}

		// curryFunction(f,args1)(args2)=f(args1.concat(args2))
		// e.g. curryFunction(f,x,y)(z,w) = f(x,y,z,w)
		public static function curry(func:Function,...args):Function
		{
			if (func == null) CoC_Settings.error("carryFunction(null,"+args+")");
			return function (...args2):*{
				return func.apply(null,args.concat(args2));
			};
		}

		public static function formatStringArray(stringList:Array):String { //Changes an array of values into "1", "1 and 2" or "1, (x, )y and z"
			switch (stringList.length) {
				case  0: return "";
				case  1: return stringList[0];
				case  2: return stringList[0] + " and " + stringList[1];
				default:
			}
			var concat:String = stringList[0];
			for (var x:int = 1; x < stringList.length - 1; x++) concat += ", " + stringList[x];
			return concat + " and " + stringList[stringList.length - 1];
		}

		public static function num2Text(number:int):String {
			if (number >= 0 && number <= 10) return NUMBER_WORDS_NORMAL[number];
			return number.toString();
		}

		public static function num2Text2(number:int):String {
			if (number < 0) return number.toString(); //Can't really have the -10th of something
			if (number <= 10) return NUMBER_WORDS_POSITIONAL[number];
			// For (number > 10) the method would return 11st, 12nd, 13rd and so on with the switch-case below (Stadler76)
			/*switch (number % 10) {
				case 1: return number.toString() + "st";
				case 2: return number.toString() + "nd";
				case 3: return number.toString() + "rd";
				default:
			}*/
			return number.toString() + "th";
		}

		public static function Num2Text(number:int):String {
			if (number >= 0 && number <= 10) return NUMBER_WORDS_CAPITAL[number];
			return number.toString();
		}

		public static function addComma(num:int):String{
			var str:String = "";
			if (num <= 0) return "0";
			while (num>0){
				var tmp:uint = num % 1000;
				str = ( num > 999 ?"," + (tmp < 100 ? ( tmp < 10 ? "00": "0"): ""): "") + tmp + str;
				num = num / 1000;
			}
			return str;
		}

		public static function capitalizeFirstLetter(string:String):String {
			return (string.substr(0, 1).toUpperCase() + string.substr(1));
		}

		// Basically, you pass an arbitrary-length list of arguments, and it returns one of them at random.
		// Accepts any type.
		// Can also accept a *single* array of items, in which case it picks from the array instead.
		// This lets you pre-construct the argument, to make things cleaner
		public static function randomChoice(...args):*
		{
			var tar:Array;

			if (args.length == 1 && args[0] is Array) tar = args[0];
			else if (args.length > 1) tar = args;
			else throw new Error("RandomInCollection could not determine usage pattern.");

			return tar[rand(tar.length)];
		}

		/**
		 * Utility function to search for a specific value within a target array or collection of values.
		 * Collection can be supplied either as an existing array or as varargs:
		 * ex: 	InCollection(myValue, myArray)
		 * 		InCollection(myValue, myPossibleValue1, myPossibleValue2, myPossibleValue3)
		 * @param	tar			Target value to search for
		 * @param	... args	Collection to look in
		 * @return				Boolean true/false if found/not found.
		 */
		public function InCollection(tar:*, ... args):Boolean
		{
			if (args.length == 0) return false;

			var collection:*;

			for (var ii:int = 0; ii < args.length; ii++)
			{
				collection = args[ii];

				if (!(collection is Array))
				{
					if (tar == collection) return true;
				}
				else
				{
					for (var i:int = 0; i < collection.length; i++)
					{
						if (tar == collection[i]) return true;
					}
				}
			}

			return false;
		}

		public static function rand(max:Number):Number
		{
			return int(Math.random() * max);
		}

		public static function validateNonNegativeNumberFields(o:Object, func:String, nnf:Array):String
		{
			var error:String = "";
			for each (var field:String in nnf) {
				if (!o.hasOwnProperty(field) || !(o[field] is Number) && o[field] != null) error += "Misspelling in "+func+".nnf: '"+field+"'. ";
				else if (o[field] == null) error += "Null '"+field+"'. ";
				else if (o[field] < 0) error += "Negative '"+field+"'. ";
			}
			return error;
		}

		public static function validateNonEmptyStringFields(o:Object, func:String, nef:Array):String
		{
			var error:String = "";
			for each (var field:String in nef) {
				if (!o.hasOwnProperty(field) || !(o[field] is String) && o[field] != null) error += "Misspelling in "+func+".nef: '"+field+"'. ";
				else if (o[field] == null) error += "Null '"+field+"'. ";
				else if (o[field] == "") error += "Empty '"+field+"'. ";
			}
			return error;
		}

		/* None of these functions are called anymore
		// lazy(obj,arg1,...,argN)() = obj[arg1]...[argN]
		public static function lazyIndex(obj:*,...args):Function{
			return function():*{
				while(args.length>0)
					obj=obj[args.shift()];
				return obj;
			};
		}
		// lazy2(func,arg1,...,argN)() = func()[arg1]...[argN]
		public static function lazyCallIndex(func:Function,...args):Function{
			var _args:Array = args.slice();
			return function():*{
				var obj:*=func();
				var __args:Array = _args.slice();
				while(__args.length>0)
					obj=obj[__args.shift()];
				return obj
			};
		}
		// lazy2(func,arg1,...,argN)(args2) = func()[arg1]...[argN](args2)
		public static function lazyCallIndexCall(func:Function,...args):Function{
			var _args:Array = args.slice();
			return function (...fargs):*{
				var obj:*=func();
				var __args:Array = _args.slice();
				while(__args.length>0)
					obj=obj[__args.shift()];
				return obj.apply(null,fargs);
			};
		}
		*/
	}
}


code:
/**
 * Created by aimozg on 11.01.14.
 */
package classes.internals
{
	public class WeightedDrop implements RandomDrop
	{
		private var items:Array = [];
		private var sum:Number = 0;
		public function WeightedDrop(first:*=null,firstWeight:Number=0)
		{
			if (first != null){
				items.push([first,firstWeight]);
				sum += firstWeight;
			}
		}
		public function add(item:*,weight:Number=1):WeightedDrop
		{
			items.push([item,weight]);
			sum += weight;
			return this;
		}
		public function addMany(weight:Number,..._items):WeightedDrop
		{
			for each (var item:* in _items){
				items.push([item,weight]);
				sum += weight;
			}
			return this;
		}
		// you can pass your own random value from 0 to 1 (so you can use your own RNG)
		public function roll():*
		{
			var random:Number = Math.random()*sum;
			var item:* = null;
			while (random > 0 && items.length > 0) {
				var pair:Array = items.shift();
				item = pair[0];
				random -= pair[1];
			}
			return item;
		}

		public function clone():WeightedDrop
		{
			var other:WeightedDrop = new WeightedDrop();
			other.items = items.slice();
			other.sum = sum;
			return other;
		}
	}
}


code:
package classes
{
	/**
	 * ...
	 * @author Gedan
	 */
	public class room
	{
		public function room()
		{

		}

		public var RoomName:String; // Index name
		public var RoomDisplayName:String; // Header text

		public var NorthExit:String;
		public var NorthExitCondition:Function;

		public var EastExit:String;
		public var EastExitCondition:Function;

		public var SouthExit:String;
		public var SouthExitCondition:Function;

		public var WestExit:String;
		public var WestExitCondition:Function;

		public var RoomFunction:Function;
	}
}


code:
package coc.model {
	import classes.Player;
	import classes.DefaultDict;

	public class GameModel {
		public var player:Player;
		public var oldStats:Object;
		public var time:TimeModel;

		//public var debug:Boolean;
		// I think this is supposed to be a compile time constant, sorta...
		public var mobile:Boolean;
	}
}


code:
package coc.model
{
	public class TimeModel
	{
		private var _days:Number;
		private var _hours:Number;
		private var _minutes:Number;

		public function get days():Number
		{
			return _days;
		}

		public function set days(value:Number):void
		{
			_days = value;
		}

		public function get hours():Number
		{
			return _hours;
		}

		public function set hours(value:Number):void
		{
			_hours = value;
		}

		public function get minutes():Number
		{
			return _minutes;
		}

		public function set minutes(value:Number):void
		{
			_minutes = value;
		}

		public function get totalTime():Number
		{
			return (this._days * 24 + this._hours);
		}
	}
}


code:
//Copyright (c) 2010, Charles Strahan
//<http://www.charlesstrahan.com/>
//All rights reserved.
//
//	Original Showdown Copyright (c) 2007, John Fraser
//<http://www.attacklab.net/>
//All rights reserved.
//
//	Original Markdown copyright (c) 2004, John Gruber
//<http://daringfireball.net/>
//All rights reserved.
//
//	Redistribution and use in source and binary forms, with or without
//modification, are permitted provided that the following conditions are
//met:
//
//* Redistributions of source code must retain the above copyright notice,
//this list of conditions and the following disclaimer.
//
//	* Redistributions in binary form must reproduce the above copyright
//notice, this list of conditions and the following disclaimer in the
//documentation and/or other materials provided with the distribution.
//
//	* Neither the name "Markdown" nor the names of its contributors may
//be used to endorse or promote products derived from this software
//without specific prior written permission.
//
//	This software is provided by the copyright holders and contributors "as
//is" and any express or implied warranties, including, but not limited
//to, the implied warranties of merchantability and fitness for a
//particular purpose are disclaimed. In no event shall the copyright owner
//or contributors be liable for any direct, indirect, incidental, special,
//exemplary, or consequential damages (including, but not limited to,
//	procurement of substitute goods or services; loss of use, data, or
//	profits; or business interruption) however caused and on any theory of
//liability, whether in contract, strict liability, or tort (including
//	negligence or otherwise) arising in any way out of the use of this
//software, even if advised of the possibility of such damage.

//
// Showdown.as -- An ActionScript port of showdown.js
//
// Copyright (c) 2010 Charles Strahan.
//
// Original Showdown Copyright (c) 2007 John Fraser.
//   <http://attacklab.net/showdown/>
//
// Original Markdown Copyright (c) 2004-2005 John Gruber
//   <http://daringfireball.net/projects/markdown/>
//
// Redistributable under a BSD-style open source license.
// See license.txt for more information.
//
// Usage:
//
//   var text = "Markdown *rocks*.";
//   var html = Showdown.makeHtml(text);
//

package showdown {

	public class Showdown
	{
		// Global hashes, used by various utility routines
		private static var g_urls:Array;
		private static var g_titles:Array;
		private static var g_html_blocks:Array;

		// Used to track when we're inside an ordered or unordered list
		// (see _ProcessListItems() for details):
		private static var g_list_level:Number = 0;

		public static function makeHtml(text:String):String
		{
			// Clear the global hashes. If we don't clear these, you get conflicts
			// from other articles when generating a page which contains more than
			// one article (e.g. an index page that shows the N most recent
			// articles):
			g_urls = [];
			g_titles = [];
			g_html_blocks = [];

			// attacklab: Replace ~ with ~T
			// This lets us use tilde as an escape char to avoid md5 hashes
			// The choice of character is arbitray; anything that isn't
			// magic in Markdown will work.
			text = text.replace(/~/g,"~T");

			// attacklab: Replace $ with ~D
			// RegExp interprets $ as a special character
			// when it's in a replacement string
			text = text.replace(/\$/g,"~D");

			// Standardize line endings
			text = text.replace(/\r\n/g,"\n"); // DOS to Unix
			text = text.replace(/\r/g,"\n"); // Mac to Unix

			// Make sure text begins and ends with a couple of newlines:
			text = "\n\n" + text + "\n\n";

			// Convert all tabs to spaces.
			text = _Detab(text);

			// Strip any lines consisting only of spaces and tabs.
			// This makes subsequent regexen easier to write, because we can
			// match consecutive blank lines with /\n+/ instead of something
			// contorted like /[ \t]*\n+/ .
			text = text.replace(/^[ \t]+$/mg,"");

			// Turn block-level HTML blocks into hash entries
			text = _HashHTMLBlocks(text);

			// Strip link definitions, store in hashes.
			text = _StripLinkDefinitions(text);

			text = _RunBlockGamut(text);

			text = _UnescapeSpecialChars(text);

			// attacklab: Restore dollar signs
			text = text.replace(/~D/g,"$$");

			// attacklab: Restore tildes
			text = text.replace(/~T/g,"~");

			// unfortunately, because flash is on crack, the "htmlText" window still inserts breaks at "\n"
			// characters AS WELL AS
 tags. Therefore, we remove all the newline tags after parsing to HTML, and before
			// trying to display the contents.
			// FLASH: YOU CRAZY
			text = text.replace(/\n/g, "");

			// Finally, add a additional newline after each closing P tag, because flash only
			// outputs one newline per

 tag, apparently flash again feels the need to be a special snowflake
			// text = text.replace(/<\/p>/gi,"
\n");
			// aaaannnnd now it's properly producing two \n's between paragraphs. WTF, Flash?

			return text;
		}

		private static function _StripLinkDefinitions(text:String):String {
			//
			// Strips link definitions from text, stores the URLs and titles in
			// hash references.
			//

			// Link defs are in the form: ^[id]: url "optional title"

			/*
			var text = text.replace(/
			^[ ]{0,3}\[(.+)\]:  // id = $1  attacklab: g_tab_width - 1
			[ \t]*
			\n?				// maybe *one* newline
			[ \t]*
			<?(\S+?)>?			// url = $2
			[ \t]*
			\n?				// maybe one newline
			[ \t]*
			(?:
			(\n*)				// any lines skipped = $3 attacklab: lookbehind removed
			["(]
			(.+?)				// title = $4
			[")]
			[ \t]*
			)?					// title is optional
			(?:\n+|$)
			/gm,
			function(){...});
			*/
			text = text.replace(/^[ ]{0,3}\[(.+)\]:[ \t]*\n?[ \t]*<?(\S+?)>?[ \t]*\n?[ \t]*(?:(\n*)["(](.+?)[")][ \t]*)?(?:\n+|\Z)/gm,
				function (wholeMatch:String,m1:*,m2:*,m3:*,m4:*,...args):String {
					m1 = m1.toLowerCase();
					g_urls[m1] = _EncodeAmpsAndAngles(m2);  // Link IDs are case-insensitive
					if (m3) {
						// Oops, found blank lines, so it's not a title.
						// Put back the parenthetical statement we stole.
						return m3+m4;
					} else if (m4) {
						g_titles[m1] = m4.replace(/"/g,""");
					}

					// Completely remove the definition from the text
					return "";
				}
			);

			return text;
		}

		private static function _HashHTMLBlocks(text:String):String {
			// attacklab: Double up blank lines to reduce lookaround
			text = text.replace(/\n/g,"\n\n");

			// Hashify HTML blocks:
			// We only want to do this for block-level HTML tags, such as headers,
			// lists, and tables. That's because we still want to wrap
s around
			// "paragraphs" that are wrapped in non-block-level tags, such as anchors,
			// phrase emphasis, and spans. The list of tags we're looking for is
			// hard-coded:
			//noinspection JSUnusedLocalSymbols
			var block_tags_a:String = "p|div|h[1-6]|blockquote|pre|table|dl|ol|ul|script|noscript|form|fieldset|iframe|math|ins|del";
			//noinspection JSUnusedLocalSymbols
			var block_tags_b:String = "p|div|h[1-6]|blockquote|pre|table|dl|ol|ul|script|noscript|form|fieldset|iframe|math";

			// First, look for nested blocks, e.g.:
			//

			//

			//     tags for inner block must be indented.
			//

			//

			//
			// The outermost tags must start at the left margin for this to match, and
			// the inner nested divs must be indented.
			// We need to do this before the next, more liberal match, because the next
			// match will start at the first `<div>` and stop at the first `</div>`.

			// attacklab: This regex can be expensive when it fails.
			/*
			var text = text.replace(/
			(						// save in $1
			^					// start of line  (with /m)
			<($block_tags_a)	// start tag = $2
			\b					// word break
			// attacklab: hack around khtml/pcre bug...
			[^\r]*?\n			// any number of lines, minimally matching
			</\2>				// the matching end tag
			[ \t]*				// trailing spaces/tabs
			(?=\n+)				// followed by a newline
			)						// attacklab: there are sentinel newlines at end of document
			/gm,function(){...}};
			*/

			text = text.replace(/^(<(p|div|h[1-6]|blockquote|pre|table|dl|ol|ul|script|noscript|form|fieldset|iframe|math|ins|del)\b[^\r]*?\n<\/\2>[ \t]*(?=\n+))/gm,hashElement);

			//
			// Now match more liberally, simply from `\n<tag>` to `</tag>\n`
			//

			/*
			var text = text.replace(/
			(						// save in $1
			^					// start of line  (with /m)
			<($block_tags_b)	// start tag = $2
			\b					// word break
			// attacklab: hack around khtml/pcre bug...
			[^\r]*?				// any number of lines, minimally matching
			.*</\2>				// the matching end tag
			[ \t]*				// trailing spaces/tabs
			(?=\n+)				// followed by a newline
			)						// attacklab: there are sentinel newlines at end of document
			/gm,function(){...}};
			*/
			text = text.replace(/^(<(p|div|h[1-6]|blockquote|pre|table|dl|ol|ul|script|noscript|form|fieldset|iframe|math)\b[^\r]*?.*<\/\2>[ \t]*(?=\n+)\n)/gm,hashElement);

			// Special case just for
. It was easier to make a special case than
			// to make the other regex more complicated.

			/*
			text = text.replace(/
			(						// save in $1
			\n\n				// Starting after a blank line
			[ ]{0,3}
			(<(hr)				// start tag = $2
			\b					// word break
			([^<>])*?			//
			\/?>)				// the matching end tag
			[ \t]*
			(?=\n{2,})			// followed by a blank line
			)
			/g,hashElement);
			*/
			text = text.replace(/(\n[ ]{0,3}(<(hr)\b([^<>])*?\/?>)[ \t]*(?=\n{2,}))/g,hashElement);

			// Special case for standalone HTML comments:

			/*
			text = text.replace(/
			(						// save in $1
			\n\n				// Starting after a blank line
			[ ]{0,3}			// attacklab: g_tab_width - 1
			<!
			(--[^\r]*?--\s*)+
			>
			[ \t]*
			(?=\n{2,})			// followed by a blank line
			)
			/g,hashElement);
			*/
			text = text.replace(/(\n\n[ ]{0,3}<!(--[^\r]*?--\s*)+>[ \t]*(?=\n{2,}))/g,hashElement);

			// PHP and ASP-style processor instructions (<?...?> and <%...%>)

			/*
			text = text.replace(/
			(?:
			\n\n				// Starting after a blank line
			)
			(						// save in $1
			[ ]{0,3}			// attacklab: g_tab_width - 1
			(?:
			<([?%])			// $2
			[^\r]*?
			\2>
			)
			[ \t]*
			(?=\n{2,})			// followed by a blank line
			)
			/g,hashElement);
			*/
			text = text.replace(/(?:\n\n)([ ]{0,3}(?:<([?%])[^\r]*?\2>)[ \t]*(?=\n{2,}))/g,hashElement);

			// attacklab: Undo double lines (see comment at top of this function)
			text = text.replace(/\n\n/g,"\n");
			return text;
		}

		//noinspection JSUnusedLocalSymbols
		private static function hashElement(wholeMatch:String,m1:*,m2:*,m3:*,m4:*,...args):String {
			var blockText:String = m1;

			// Undo double lines
			blockText = blockText.replace(/\n\n/g,"\n");
			blockText = blockText.replace(/^\n/,"");

			// strip trailing blank lines
			blockText = blockText.replace(/\n+$/g,"");

			// Replace the element text with a marker ("~KxK" where x is its key)
			blockText = "\n\n~K" + (g_html_blocks.push(blockText)-1) + "K\n\n";

			return blockText;
		}

		private static function _RunBlockGamut(text:String):String {
			//
			// These are all the transformations that form block-level
			// tags like paragraphs, headers, and list items.
			//
			text = _DoHeaders(text);

			// Do Horizontal Rules:
			var key:String = hashBlock("
");
			text = text.replace(/^[ ]{0,2}([ ]?\*[ ]?){3,}[ \t]*$/gm,key);
			text = text.replace(/^[ ]{0,2}([ ]?\-[ ]?){3,}[ \t]*$/gm,key);
			text = text.replace(/^[ ]{0,2}([ ]?\_[ ]?){3,}[ \t]*$/gm,key);

			text = _DoTables(text);
			text = _DoLists(text);
			text = _DoCodeBlocks(text);
			text = _DoBlockQuotes(text);

			// We already ran _HashHTMLBlocks() before, in Markdown(), but that
			// was to escape raw HTML in the original Markdown source. This time,
			// we're escaping the markup we've just created, so that we don't wrap
			//
 tags around block-level tags.
			text = _HashHTMLBlocks(text);
			text = _FormParagraphs(text);

			return text;
		}

		private static function _RunSpanGamut(text:String):String {
			//
			// These are all the transformations that occur *within* block-level
			// tags like paragraphs, headers, and list items.
			//

			text = _DoCodeSpans(text);
			text = _EscapeSpecialCharsWithinTagAttributes(text);
			text = _EncodeBackslashEscapes(text);

			// Process anchor and image tags. Images must come first,
			// because ![foo][f] looks like an anchor.
			text = _DoImages(text);
			text = _DoAnchors(text);

			// Make links out of things like `<http://example.com/>`
			// Must come after _DoAnchors(), because you can use < and >
			// delimiters in inline links like [this](<url>).
			text = _DoAutoLinks(text);
			text = _EncodeAmpsAndAngles(text);
			text = _DoItalicsAndBold(text);

			// Do hard breaks:
			text = text.replace(/  +\n/g,"
\n");

			return text;
		}

		private static function _EscapeSpecialCharsWithinTagAttributes(text:String):String {
			//
			// Within tags -- meaning between < and > -- encode [\ ` * _] so they
			// don't conflict with their use in Markdown for code, italics and strong.
			//

			// Build a regex to find HTML tags and comments.  See Friedl's
			// "Mastering Regular Expressions", 2nd Ed., pp. 200-201.
			var regex:RegExp = /(<[a-z\/!$]("[^"]*"|'[^']*'|[^'">])*>|<!(--.*?--\s*)+>)/gi;

			text = text.replace(regex, function(wholeMatch:String,...args):String {
				var tag:String = wholeMatch.replace(/(.)<\/?code>(?=.)/g,"$1`");
				tag = escapeCharacters(tag,"\\`*_");
				return tag;
			});

			return text;
		}

		private static function _DoAnchors(text:String):String {
			//
			// Turn Markdown link shortcuts into XHTML  tags.
			//
			//
			// First, handle reference-style links: [link text] [id]
			//

			/*
			text = text.replace(/
			(							// wrap whole match in $1
			\[
			(
			(?:
			\[[^\]]*\]		// allow brackets nested one level
			|
			[^\[]			// or anything else
			)*
			)
			\]

			[ ]?					// one optional space
			(?:\n[ ]*)?				// one optional newline followed by spaces

			\[
			(.*?)					// id = $3
			\]
			)()()()()					// pad remaining backreferences
			/g,_DoAnchors_callback);
			*/
			text = text.replace(/(\[((?:\[[^\]]*\]|[^\[\]])*)\][ ]?(?:\n[ ]*)?\[(.*?)\])()()()()/g,writeAnchorTag);

			//
			// Next, inline-style links: [link text](url "optional title")
			//

			/*
			text = text.replace(/
			(						// wrap whole match in $1
			\[
			(
			(?:
			\[[^\]]*\]	// allow brackets nested one level
			|
			[^\[\]]			// or anything else
			)
			)
			\]
			\(						// literal paren
			[ \t]*
			()						// no id, so leave $3 empty
			<?(.*?)>?				// href = $4
			[ \t]*
			(						// $5
			(['"])				// quote char = $6
			(.*?)				// Title = $7
			\6					// matching quote
			[ \t]*				// ignore any spaces/tabs between closing quote and )
			)?						// title is optional
			\)
			)
			/g,writeAnchorTag);
			*/
			text = text.replace(/(\[((?:\[[^\]]*\]|[^\[\]])*)\]\([ \t]*()<?(.*?)>?[ \t]*((['"])(.*?)\6[ \t]*)?\))/g,writeAnchorTag);

			//
			// Last, handle reference-style shortcuts: [link text]
			// These must come last in case you've also got [link test][1]
			// or [link test](/foo)
			//

			/*
			text = text.replace(/
			(		 					// wrap whole match in $1
			\[
			([^\[\]]+)				// link text = $2; can't contain '[' or ']'
			\]
			)()()()()()					// pad rest of backreferences
			/g, writeAnchorTag);
			*/
			text = text.replace(/(\[([^\[\]]+)\])()()()()()/g, writeAnchorTag);

			return text;
		}

		//noinspection JSUnusedLocalSymbols
		private static function writeAnchorTag(wholeMatch:String,m1:*,m2:*,m3:*,m4:*,m5:*,m6:*,m7:*,m8:*,m9:*,...args):String {
			if (m7 == undefined) m7 = "";
			//noinspection UnnecessaryLocalVariableJS
			var whole_match:String = m1;
			//noinspection UnnecessaryLocalVariableJS
			var link_text:String   = m2;
			var link_id:String	 = m3.toLowerCase();
			var url:String		= m4;
			var title:String	= m7;

			if (url == "") {
				if (link_id == "") {
					// lower-case and turn embedded newlines into spaces
					link_id = link_text.toLowerCase().replace(/ ?\n/g," ");
				}
				url = "#"+link_id;

				if (g_urls[link_id] != undefined) {
					url = g_urls[link_id];
					if (g_titles[link_id] != undefined) {
						title = g_titles[link_id];
					}
				}
				else {
					if (whole_match.search(/\(\s*\)$/m)>-1) {
						// Special case for explicit empty url
						url = "";
					} else {
						return whole_match;
					}
				}
			}

			url = escapeCharacters(url,"*_");
			var result:String = "" + link_text + "";

			return result;
		}

		private static function _DoImages(text:String):String {
			//
			// Turn Markdown image shortcuts into  tags.
			//

			//
			// First, handle reference-style labeled images: ![alt text][id]
			//

			/*
			text = text.replace(/
			(						// wrap whole match in $1
			!\[
			(.*?)				// alt text = $2
			\]

			[ ]?				// one optional space
			(?:\n[ ]*)?			// one optional newline followed by spaces

			\[
			(.*?)				// id = $3
			\]
			)()()()()				// pad rest of backreferences
			/g,writeImageTag);
			*/
			text = text.replace(/(!\[(.*?)\][ ]?(?:\n[ ]*)?\[(.*?)\])()()()()/g,writeImageTag);

			//
			// Next, handle inline images:  ![alt text](url "optional title")
			// Don't forget: encode * and _

			/*
			text = text.replace(/
			(						// wrap whole match in $1
			!\[
			(.*?)				// alt text = $2
			\]
			\s?					// One optional whitespace character
			\(					// literal paren
			[ \t]*
			()					// no id, so leave $3 empty
			<?(\S+?)>?			// src url = $4
			[ \t]*
			(					// $5
			(['"])			// quote char = $6
			(.*?)			// title = $7
			\6				// matching quote
			[ \t]*
			)?					// title is optional
			\)
			)
			/g,writeImageTag);
			*/
			text = text.replace(/(!\[(.*?)\]\s?\([ \t]*()<?(\S+?)>?[ \t]*((['"])(.*?)\6[ \t]*)?\))/g,writeImageTag);

			return text;
		}

		//noinspection JSUnusedLocalSymbols
		private static function writeImageTag(wholeMatch:String,m1:*,m2:*,m3:*,m4:*,m5:*,m6:*,m7:*,m8:*,m9:*):String {
			//noinspection UnnecessaryLocalVariableJS
			var whole_match:String = m1;
			var alt_text:String   = m2;
			var link_id:String	 = m3.toLowerCase();
			var url:String		= m4;
			var title:String	= m7;

			if (!title) title = "";

			if (url == "") {
				if (link_id == "") {
					// lower-case and turn embedded newlines into spaces
					link_id = alt_text.toLowerCase().replace(/ ?\n/g," ");
				}
				url = "#"+link_id;

				if (g_urls[link_id] != undefined) {
					url = g_urls[link_id];
					if (g_titles[link_id] != undefined) {
						title = g_titles[link_id];
					}
				}
				else {
					return whole_match;
				}
			}

			alt_text = alt_text.replace(/"/g,""");
			url = escapeCharacters(url,"*_");
			var result:String = "";

			return result;
		}

		private static function _DoHeaders(text:String):String {

			// Setext-style headers:
			//	Header 1
			//	========
			//
			//	Header 2
			//	--------
			//
			text = text.replace(/^(.+)[ \t]*\n=+[ \t]*\n+/gm,
				function(wholeMatch:String,m1:String,...args):String{return hashBlock("
" + _RunSpanGamut(m1) + "
");});

			text = text.replace(/^(.+)[ \t]*\n-+[ \t]*\n+/gm,
				function(matchFound:String,m1:String,...args):String{return hashBlock("
" + _RunSpanGamut(m1) + "
");});

			// atx-style headers:
			//  # Header 1
			//  ## Header 2
			//  ## Header 2 with closing hashes ##
			//  ...
			//  ###### Header 6
			//

			/*
			text = text.replace(/
			^(\#{1,6})				// $1 = string of #'s
			[ \t]*
			(.+?)					// $2 = Header text
			[ \t]*
			\#*						// optional closing #'s (not counted)
			\n+
			/gm, function() {...});
			*/

			text = text.replace(/^(\#{1,6})[ \t]*(.+?)[ \t]*\#*\n+/gm,
				function(wholeMatch:String,m1:String,m2:String,...args):String {
					var h_level:int = m1.length;
					return hashBlock("<h" + h_level + ">" + _RunSpanGamut(m2) + "</h" + h_level + ">");
				});

			return text;
		}

		private static function _DoLists(text:String):String {
			//
			// Form HTML ordered (numbered) and unordered (bulleted) lists.
			//

			// attacklab: add sentinel to hack around khtml/safari bug:
			// http://bugs.webkit.org/show_bug.cgi?id=11231
			text += "~0";

			// Re-usable pattern to match any entirel ul or ol list:

			/*
			var whole_list = /
			(									// $1 = whole list
			(								// $2
			[ ]{0,3}					// attacklab: g_tab_width - 1
			([*+-]|\d+[.])				// $3 = first list item marker
			[ \t]+
			)
			[^\r]+?
			(								// $4
			~0							// sentinel for workaround; should be $
			|
			\n{2,}
			(?=\S)
			(?!							// Negative lookahead for another list item marker
			[ \t]*
			(?:[*+-]|\d+[.])[ \t]+
			)
			)
			)/g
			*/
			var whole_list:RegExp = /^(([ ]{0,3}([*+-]|\d+[.])[ \t]+)[^\r]+?(~0|\n{2,}(?=\S)(?![ \t]*(?:[*+-]|\d+[.])[ \t]+)))/gm;

			if (g_list_level) {
				text = text.replace(whole_list,function(wholeMatch:String,m1:String,m2:String,...args):String {
					var list:String = m1;
					var list_type:String = (m2.search(/[*+-]/g)>-1) ? "ul" : "ol";

					// Turn double returns into triple returns, so that we can make a
					// paragraph for the last item in a list, if necessary:
					list = list.replace(/\n{2,}/g,"\n\n\n");
					var result:String = _ProcessListItems(list);

					// Trim any trailing whitespace, to put the closing `</$list_type>`
					// up on the preceding line, to get it past the current stupid
					// HTML block parser. This is a hack to work around the terrible
					// hack that is the HTML block parser.
					result = result.replace(/\s+$/,"");
					result = "<"+list_type+">" + result + "</"+list_type+">\n";
					return result;
				});
			} else {
				whole_list = /(\n\n|^\n?)(([ ]{0,3}([*+-]|\d+[.])[ \t]+)[^\r]+?(~0|\n{2,}(?=\S)(?![ \t]*(?:[*+-]|\d+[.])[ \t]+)))/g;
				text = text.replace(whole_list,function(wholeMatch:String,m1:String,m2:String,m3:String,...args):String {
					//noinspection UnnecessaryLocalVariableJS
					var runup:String = m1;
					var list:String = m2;

					var list_type:String = (m3.search(/[*+-]/g)>-1) ? "ul" : "ol";
					// Turn double returns into triple returns, so that we can make a
					// paragraph for the last item in a list, if necessary:
					list = list.replace(/\n{2,}/g,"\n\n\n");
					var result:String = _ProcessListItems(list);
					result = runup + "<"+list_type+">\n" + result + "</"+list_type+">\n";
					return result;
				});
			}

			// attacklab: strip sentinel
			text = text.replace(/~0/,"");

			return text;
		}

		private static function _DoTables(text:String):String {
			text = text.replace(/(?:\|(?:[^\|\r\n]+\|)+\n)+/gm,
				function(wholeMatch:String,...args):String {
					return "
" + _DoTableRows(wholeMatch) + "
";
				});
			return text
		}

		private static function _DoTableRows(text:String):String {
			text = text.replace(/\|((?:[^\|\r\n]+\|)+)\n/gm,
				function(wholeMatch:String, g1:String,...args):String {
					return "
" + _DoTableCells(g1) + "
";
				});
			return text;
		}

		private static function _DoTableCells(text:String):String {
			text = text.replace(/([^\|\r\n]+)\|/gm,
				function(wholeMatch:String, g1:String,...args):String {
					return "" + _RunSpanGamut(g1) + "	";
				});
			return text;
		}

		private static function _ProcessListItems(list_str:String):String {
			//
			//  Process the contents of a single ordered or unordered list, splitting it
			//  into individual list items.
			//
			// The $g_list_level global keeps track of when we're inside a list.
			// Each time we enter a list, we increment it; when we leave a list,
			// we decrement. If it's zero, we're not in a list anymore.
			//
			// We do this because when we're not inside a list, we want to treat
			// something like this:
			//
			//    I recommend upgrading to version
			//    8. Oops, now this line is treated
			//    as a sub-list.
			//
			// As a single paragraph, despite the fact that the second line starts
			// with a digit-period-space sequence.
			//
			// Whereas when we're inside a list (or sub-list), that line will be
			// treated as the start of a sub-list. What a kludge, huh? This is
			// an aspect of Markdown's syntax that's hard to parse perfectly
			// without resorting to mind-reading. Perhaps the solution is to
			// change the syntax rules such that sub-lists must start with a
			// starting cardinal number; e.g. "1." or "a.".

			g_list_level++;

			// trim trailing blank lines:
			list_str = list_str.replace(/\n{2,}$/,"\n");

			// attacklab: add sentinel to emulate \z
			list_str += "~0";

			/*
			list_str = list_str.replace(/
			(\n)?							// leading line = $1
			(^[ \t]*)						// leading whitespace = $2
			([*+-]|\d+[.]) [ \t]+			// list marker = $3
			([^\r]+?						// list item text   = $4
			(\n{1,2}))
			(?= \n* (~0 | \2 ([*+-]|\d+[.]) [ \t]+))
			/gm, function(){...});
			*/
			list_str = list_str.replace(/(\n)?(^[ \t]*)([*+-]|\d+[.])[ \t]+([^\r]+?(\n{1,2}))(?=\n*(~0|\2([*+-]|\d+[.])[ \t]+))/gm,
				function(wholeMatch:String,m1:String,m2:String,m3:String,m4:String,...args):String{
					var item:String = m4;
					//noinspection UnnecessaryLocalVariableJS
					var leading_line:String = m1;
					//noinspection JSUnusedLocalSymbols
					var leading_space:String = m2;

					if (leading_line || (item.search(/\n{2,}/)>-1)) {
						item = _RunBlockGamut(_Outdent(item));
					}
					else {
						// Recursion for sub-lists:
						item = _DoLists(_Outdent(item));
						item = item.replace(/\n$/,""); // chomp(item)
						item = _RunSpanGamut(item);
					}

					return  "
" + item + "
\n";
				}
			);

			// attacklab: strip sentinel
			list_str = list_str.replace(/~0/g,"");

			g_list_level--;
			return list_str;
		}

		private static function _DoCodeBlocks(text:String):String {
			//
			//  Process Markdown `<pre><code>` blocks.
			//

			/*
			text = text.replace(text,
			/(?:\n\n|^)
			(								// $1 = the code block -- one or more lines, starting with a space/tab
			(?:
			(?:[ ]{4}|\t)			// Lines must start with a tab or a tab-width of spaces - attacklab: g_tab_width
			.*\n+
			)+
			)
			(\n*[ ]{0,3}[^ \t\n]|(?=~0))	// attacklab: g_tab_width
			/g,function(){...});
			*/

			// attacklab: sentinel workarounds for lack of \A and \Z, safari\khtml bug
			text += "~0";

			text = text.replace(/(?:\n\n|^)((?:(?:[ ]{4}|\t).*\n+)+)(\n*[ ]{0,3}[^ \t\n]|(?=~0))/g,
				function(wholeMatch:String,m1:String,m2:String,...args):String {
					var codeblock:String = m1;
					//noinspection UnnecessaryLocalVariableJS
					var nextChar:String = m2;

					codeblock = _EncodeCode( _Outdent(codeblock));
					codeblock = _Detab(codeblock);
					codeblock = codeblock.replace(/^\n+/g,""); // trim leading newlines
					codeblock = codeblock.replace(/\n+$/g,""); // trim trailing whitespace

					// disabling codeblocks, because they're not needed in CoC.
					codeblock = "
" + codeblock + "\n
";
					// codeblock = "
" + codeblock + "\n
";

					return hashBlock(codeblock) + nextChar;
				}
			);

			// attacklab: strip sentinel
			text = text.replace(/~0/,"");

			return text;
		}

		//noinspection JSUnusedLocalSymbols
		private static function hashBlock(text:String,...args):String {
			text = text.replace(/(^\n+|\n+$)/g,"");
			return "\n\n~K" + (g_html_blocks.push(text)-1) + "K\n\n";
		}

		private static function _DoCodeSpans(text:String):String {
			//
			//   *  Backtick quotes are used for  spans.
			//
			//   *  You can use multiple backticks as the delimiters if you want to
			//	 include literal backticks in the code span. So, this input:
			//
			//		 Just type ``foo `bar` baz`` at the prompt.
			//
			//	   Will translate to:
			//
			//
Just type foo `bar` baz at the prompt.

			//
			//	There's no arbitrary limit to the number of backticks you
			//	can use as delimters. If you need three consecutive backticks
			//	in your code, use four for delimiters, etc.
			//
			//  *  You can use spaces to get literal backticks at the edges:
			//
			//		 ... type `` `bar` `` ...
			//
			//	   Turns to:
			//
			//		 ... type `bar` ...
			//

			/*
			text = text.replace(/
			(^|[^\\])					// Character before opening ` can't be a backslash
			(`+)						// $2 = Opening run of `
			(							// $3 = The code block
			[^\r]*?
			[^`]					// attacklab: work around lack of lookbehind
			)
			\2							// Matching closer
			(?!`)
			/gm, function(){...});
			*/

			text = text.replace(/(^|[^\\])(`+)([^\r]*?[^`])\2(?!`)/gm,
				function(wholeMatch:String,m1:*,m2:*,m3:*,m4:*,...args):String {
					var c:String = m3;
					c = c.replace(/^([ \t]*)/g,"");	// leading whitespace
					c = c.replace(/[ \t]*$/g,"");	// trailing whitespace
					c = _EncodeCode(c);
					return m1+""+c+"";
				});

			return text;
		}

		private static function _EncodeCode(text:String):String {
			//
			// Encode/escape certain characters inside Markdown code runs.
			// The point is that in code, these characters are literals,
			// and lose their special Markdown meanings.
			//
			// Encode all ampersands; HTML entities are not
			// entities within a Markdown code span.
			text = text.replace(/&/g,"&");

			// Do the angle bracket song and dance:
			text = text.replace(/</g,"<");
			text = text.replace(/>/g,">");

			// Now, escape characters that are magic in Markdown:
			text = escapeCharacters(text,"*_{}[]\\",false);

			// jj the line above breaks this:
			//---

			//* Item

			//   1. Subitem

			//            special char: *
			//---

			return text;
		}

		private static function _DoItalicsAndBold(text:String):String {

			//  must go first:
			text = text.replace(/(\*\*|__)(?=\S)([^\r]*?\S[*_]*)\1/g,
				"$2");

			text = text.replace(/(\*|_)(?=\S)([^\r]*?\S)\1/g,
				"$2");

			return text;
		}

		private static function _DoBlockQuotes(text:String):String {

			/*
			text = text.replace(/
			(								// Wrap whole match in $1
			(
			^[ \t]*>[ \t]?			// '>' at the start of a line
			.+\n					// rest of the first line
			(.+\n)*					// subsequent consecutive lines
			\n*						// blanks
			)+
			)
			/gm, function(){...});
			*/

			text = text.replace(/((^[ \t]*>[ \t]?.+\n(.+\n)*\n*)+)/gm,
				function(wholeMatch:String,m1:*,...args):String {
					var bq:String = m1;

					// attacklab: hack around Konqueror 3.5.4 bug:
					// "----------bug".replace(/^-/g,"") == "bug"

					bq = bq.replace(/^[ \t]*>[ \t]?/gm,"~0");	// trim one level of quoting

					// attacklab: clean up hack
					bq = bq.replace(/~0/g,"");

					bq = bq.replace(/^[ \t]+$/gm,"");		// trim whitespace-only lines
					bq = _RunBlockGamut(bq);				// recurse

					bq = bq.replace(/(^|\n)/g,"$1  ");
					// These leading spaces screw with
 content, so we need to fix that:
					bq = bq.replace(
						/(\s*
[^\r]+?<\/pre>)/gm,
						function(wholeMatch:String,m1:String,...args):String {
							var pre:String = m1;
							// attacklab: hack around Konqueror 3.5.4 bug:
							pre = pre.replace(/^  /mg,"~0");
							pre = pre.replace(/~0/g,"");
							return pre;
						});

					return hashBlock("
\n" + bq + "\n
");
				});
			return text;
		}

		private static function _FormParagraphs(text:String):String {
			//
			//  Params:
			//    $text - string to process with html
 tags
			//

			// Strip leading and trailing lines:
			text = text.replace(/^\n+/g,"");
			text = text.replace(/\n+$/g,"");

			var grafs:Array = text.split(/\n{2,}/g);
			var grafsOut:Array = [];

			//
			// Wrap
 tags.
			//
			var i:Number;
			var end:int = grafs.length;
			for (i=0; i<end; i++) {
				var str:String = grafs[i];

				// if this is an HTML marker, copy it
				if (str.search(/~K(\d+)K/g) >= 0) {
					grafsOut.push(str);
				}
				else if (str.search(/\S/) >= 0) {
					str = _RunSpanGamut(str);
					str = str.replace(/^([ \t]*)/g,"
");
					str += "
";
					grafsOut.push(str);
				}

			}

			//
			// Unhashify HTML blocks
			//
			end = grafsOut.length;
			for (i=0; i<end; i++) {
				// if this is a marker for an html block...
				while (grafsOut[i].search(/~K(\d+)K/) >= 0) {
					var firstGroup:String = (/~K(\d+)K/).exec(grafsOut[i])[1];
					var blockText:String = g_html_blocks[firstGroup];
					blockText = blockText.replace(/\$/g,"$$$$"); // Escape any dollar signs
					grafsOut[i] = grafsOut[i].replace(/~K\d+K/,blockText);
				}
			}

			return grafsOut.join("\n\n");
		}

		private static function _EncodeAmpsAndAngles(text:String):String {
			// Smart processing for ampersands and angle brackets that need to be encoded.

			// Ampersand-encoding based entirely on Nat Irons's Amputator MT plugin:
			//   http://bumppo.net/projects/amputator/
			text = text.replace(/&(?!#?[xX]?(?:[0-9a-fA-F]+|\w+);)/g,"&");

			// Encode naked <'s
			text = text.replace(/<(?![a-z\/?\$!])/gi,"<");

			return text;
		}

		private static function _EncodeBackslashEscapes(text:String):String {
			//
			//   Parameter:  String.
			//   Returns:	The string, with after processing the following backslash
			//			   escape sequences.
			//

			// attacklab: The polite way to do this is with the new
			// escapeCharacters() function:
			//
			// 	text = escapeCharacters(text,"\\",true);
			// 	text = escapeCharacters(text,"`*_{}[]()>#+-.!",true);
			//
			// ...but we're sidestepping its use of the (slow) RegExp constructor
			// as an optimization for Firefox.  This function gets called a LOT.

			text = text.replace(/\\(\\)/g,escapeCharacters_callback);
			text = text.replace(/\\([`*_{}\[\]()>#+-.!])/g,escapeCharacters_callback);
			return text;
		}

		private static function _DoAutoLinks(text:String):String {

			text = text.replace(/<((https?|ftp|dict):[^'">\s]+)>/gi,"$1");

			// Email addresses: <address@domain.foo>

			/*
			text = text.replace(/
			<
			(?:mailto:)?
			(
			[-.\w]+
			\@
			[-a-z0-9]+(\.[-a-z0-9]+)*\.[a-z]+
			)
			>
			/gi, _DoAutoLinks_callback());
			*/
			text = text.replace(/<(?:mailto:)?([-.\w]+\@[-a-z0-9]+(\.[-a-z0-9]+)*\.[a-z]+)>/gi,
				function(wholeMatch:String,m1:*,...args):String {
					return _EncodeEmailAddress( _UnescapeSpecialChars(m1) );
				}
			);

			return text;
		}

		private static function _EncodeEmailAddress(addr:String):String {
			//
			//  Input: an email address, e.g. "foo@example.com"
			//
			//  Output: the email address as a mailto link, with each character
			//	of the address encoded as either a decimal or hex entity, in
			//	the hopes of foiling most address harvesting spam bots. E.g.:
			//
			//	foo
			//	   @example.com
			//
			//  Based on a filter by Matthew Wickline, posted to the BBEdit-Talk
			//  mailing list: <http://tinyurl.com/yu7ue>
			//

			// attacklab: why can't javascript speak hex?
			function char2hex(ch:String):String {
				var hexDigits:String = '0123456789ABCDEF';
				var dec:int = ch.charCodeAt(0);
				return(hexDigits.charAt(dec>>4) + hexDigits.charAt(dec&15));
			}

			var encode:Array = [
				function(ch:String):String{return "&#"+ch.charCodeAt(0)+";";},
				function(ch:String):String{return "&#x"+char2hex(ch)+";";},
				function(ch:String):String{return ch;}
			];

			addr = "mailto:" + addr;

			addr = addr.replace(/./g, function(ch:String,...args):String {
				if (ch == "@") {
					// this *must* be encoded. I insist.
					ch = encode[Math.floor(Math.random()*2)](ch);
				} else if (ch !=":") {
					// leave ':' alone (to spot mailto: later)
					var r:Number = Math.random();
					// roughly 10% raw, 45% hex, 45% dec
					ch =  (
						r > .9  ?	encode[2](ch)   :
						r > .45 ?	encode[1](ch)   :
						encode[0](ch)
					);
				}
				return ch;
			});

			addr = "" + addr + "";
			addr = addr.replace(/">.+:/g,"\">"); // strip the mailto: from the visible part

			return addr;
		}

		private static function _UnescapeSpecialChars(text:String):String {
			//
			// Swap back in all the special characters we've hidden.
			//
			text = text.replace(/~E(\d+)E/g,
				function(wholeMatch:String,m1:String,...args):String {
					var charCodeToReplace:int = parseInt(m1);
					return String.fromCharCode(charCodeToReplace);
				}
			);
			return text;
		}

		private static function _Outdent(text:String):String {
			//
			// Remove one level of line-leading tabs or spaces
			//

			// attacklab: hack around Konqueror 3.5.4 bug:
			// "----------bug".replace(/^-/g,"") == "bug"

			text = text.replace(/^(\t|[ ]{1,4})/gm,"~0"); // attacklab: g_tab_width

			// attacklab: clean up hack
			text = text.replace(/~0/g,"");

			return text;
		}

		private static function _Detab(text:String):String {
			// attacklab: Detab's completely rewritten for speed.
			// In perl we could fix it by anchoring the regexp with \G.
			// In javascript we're less fortunate.

			// expand first n-1 tabs
			text = text.replace(/\t(?=\t)/g,"    "); // attacklab: g_tab_width

			// replace the nth with two sentinels
			text = text.replace(/\t/g,"~A~B");

			// use the sentinel to anchor our regex so it doesn't explode
			text = text.replace(/~B(.+?)~A/g,
				function(wholeMatch:String,m1:String,m2:*,...args):String {
					var leadingText:String = m1;
					var numSpaces:int = 4 - leadingText.length % 4;  // attacklab: g_tab_width

					// there *must* be a better way to do this:
					for (var i:int=0; i<numSpaces; i++) leadingText+=" ";

					return leadingText;
				}
			);

			// clean up sentinels
			text = text.replace(/~A/g,"    ");  // attacklab: g_tab_width
			text = text.replace(/~B/g,"");

			return text;
		}

		//
		//  attacklab: Utility functions
		//

		private static function escapeCharacters(text:String, charsToEscape:String, afterBackslash:Boolean = false):String {
			// First we have to escape the escape characters so that
			// we can build a character class out of them
			var regexString:String = "([" + charsToEscape.replace(/([\[\]\\])/g,"\\$1") + "])";

			if (afterBackslash) {
				regexString = "\\\\" + regexString;
			}

			var regex:RegExp = new RegExp(regexString,"g");
			text = text.replace(regex,escapeCharacters_callback);

			return text;
		}

		//noinspection JSUnusedLocalSymbols
		private static function escapeCharacters_callback(wholeMatch:String,m1:*,m2:*,m3:*,...args):String {
			var charCodeToEscape:int = m1.charCodeAt(0);
			return "~E"+charCodeToEscape+"E";
		}
	}// end of Showdown.converter
}


code:
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Text;
using System.Text.RegularExpressions;
using System.Threading.Tasks;
using System.Xml;

namespace AvailableImagesDict
{
    class AvailableImagesDict
    {
        public static List<string> imageIDs = new List<string>();
        public static List<string> monsterNames = new List<string>();

        static void Main(string[] args)
        {
            DirSearch(@"../includes");
            File.WriteAllLines(@"./allImages.txt", imageIDs.Concat(monsterNames));

            BuildXMLFile();

            Console.WriteLine("Complete. Found {0} unique items. Press any key to exit.", imageIDs.Count);
            for (int i = 10; i > 0; i--)
            {
                Console.Write("\rAutomatically exiting in " + i + " seconds.");

                for (int j = 20; j > 0; j--)
                {
                    // If the user has pressed a key, break
                    if (Console.KeyAvailable)
                        break;
                    System.Threading.Thread.Sleep(50);
                }
            }

            Console.ReadKey();
        }

        static void DirSearch(string sDir)
        {
            try
            {
                foreach (string f in Directory.GetFiles(sDir, "*.as", SearchOption.AllDirectories))
                {
                    foreach (string line in File.ReadAllLines(f))
                    {
                        foreach (Match match in Regex.Matches(line, "images\\.showImage\\(\"([^\"]*)\""))
                        {
                            if (!imageIDs.Contains(match.Groups[1].Value))
                            {
                                Console.WriteLine("Found {0}", match.Groups[1].Value);
                                imageIDs.Add(match.Groups[1].Value);
                            }
                        }
                        //monster.imageName="sandwitch";
                        foreach (Match match in Regex.Matches(line, "monster\\.imageName\\s*=\\s*\"([^\"]*)\""))
                        {
                            if (!imageIDs.Contains(match.Groups[1].Value))
                            {
                                Console.WriteLine("Found {0}", match.Groups[1].Value);
                                monsterNames.Add("monster-" + match.Groups[1].Value);
                            }
                        }
                    }
                }
            }
            catch (System.Exception excpt)
            {
                Console.WriteLine(excpt.Message);
            }
        }

        public static void BuildXMLFile()
        {
            try
            {
                Directory.CreateDirectory("../img/");
                XmlWriterSettings settings = new XmlWriterSettings();
                settings.Indent = true;
                settings.IndentChars = "\t";
                XmlWriter writer = XmlWriter.Create("../img/images.xml", settings);
                var filters = new String[] { "jpg", "jpeg", "gif", "png" };

                writer.WriteStartDocument();
                writer.WriteStartElement("Images");

                for (int i = 0; i < imageIDs.Count; i++)
                {
                    foreach (string fileType in filters)
                    {
                        writer.WriteStartElement("Image");
                        writer.WriteAttributeString("id", imageIDs[i]);
                        writer.WriteString("./img/" + imageIDs[i] + "." + fileType);
                        writer.WriteEndElement();
                    }
                }

                for (int i = 0; i < monsterNames.Count; i++)
                {
                    foreach (string fileType in filters)
                    {
                        writer.WriteStartElement("Image");
                        writer.WriteAttributeString("id", monsterNames[i]);
                        writer.WriteString("./img/" + monsterNames[i] + "." + fileType);
                        writer.WriteEndElement();
                    }
                }

                writer.WriteEndElement();
                writer.WriteEndDocument();
                writer.Close();
            }
            catch (Exception e)
            {
                Console.WriteLine("Some broke while creating the XML file");
                Console.WriteLine(e.Message);
            }
        }
    }
}


code:
@echo off
set PAUSE_ERRORS=1
call bat\SetupSDK.bat
call bat\SetupApplication.bat

:menu
echo.
echo Package for target
echo.
echo Android:
echo.
echo  [1] normal       (apk)
echo  [2] debug        (apk-debug)
echo  [3] captive      (apk-captive-runtime)
echo.
echo iOS:
echo.
echo  [4] fast test    (ipa-test-interpreter)
echo  [5] fast debug   (ipa-debug-interpreter)
echo  [6] slow test    (ipa-test)
echo  [7] slow debug   (ipa-debug)
echo  [8] "ad-hoc"     (ipa-ad-hoc)
echo  [9] App Store    (ipa-app-store)
echo.

:choice
set /P C=[Choice]:
echo.

set PLATFORM=android
set OPTIONS=
if %C% GTR 3 set PLATFORM=ios
if %C% GTR 7 set PLATFORM=ios-dist

if "%C%"=="1" set TARGET=
if "%C%"=="2" set TARGET=-debug
if "%C%"=="2" set OPTIONS=-connect %DEBUG_IP%
if "%C%"=="3" set TARGET=-captive-runtime

if "%C%"=="4" set TARGET=-test-interpreter
if "%C%"=="5" set TARGET=-debug-interpreter
if "%C%"=="5" set OPTIONS=-connect %DEBUG_IP%
if "%C%"=="6" set TARGET=-test
if "%C%"=="7" set TARGET=-debug
if "%C%"=="7" set OPTIONS=-connect %DEBUG_IP%
if "%C%"=="8" set TARGET=-ad-hoc
if "%C%"=="9" set TARGET=-app-store

call bat\Packager.bat

if "%PLATFORM%"=="android" goto android-package

:ios-package
if "%AUTO_INSTALL_IOS%" == "yes" goto ios-install
echo Now manually install and start application on device
echo.
goto end

:ios-install
echo Installing application for testing on iOS (%DEBUG_IP%)
echo.
call adt -installApp -platform ios -package "%OUTPUT%"
if errorlevel 1 goto installfail

echo Now manually start application on device
echo.
goto end

:android-package
adb devices
echo.
echo Installing %OUTPUT% on the device...
echo.
adb -d install -r "%OUTPUT%"
if errorlevel 1 goto installfail
goto end

:installfail
echo.
echo Installing the app on the device failed

:end
pause


code:
@echo off
set PAUSE_ERRORS=1
call bat\SetupSDK.bat
call bat\SetupApplication.bat

:target
goto desktop
::goto android-debug
::goto android-test
set INTERPRETER=-interpreter
::goto ios-debug
::goto ios-test

:desktop
:: http://help.adobe.com/en_US/air/build/WSfffb011ac560372f-6fa6d7e0128cca93d31-8000.html

set SCREEN_SIZE=NexusOne
::set SCREEN_SIZE=iPhoneRetina

:desktop-run
echo.
echo Starting AIR Debug Launcher with screen size '%SCREEN_SIZE%'
echo.
echo (hint: edit 'Run.bat' to test on device or change screen size)
echo.
adl -screensize %SCREEN_SIZE% "%APP_XML%" "%APP_DIR%"
if errorlevel 1 goto end
goto end

:ios-debug
echo.
echo Packaging application for debugging on iOS %INTERPRETER%
if "%INTERPRETER%" == "" echo (this will take a while)
echo.
set TARGET=-debug%INTERPRETER%
set OPTIONS=-connect %DEBUG_IP%
goto ios-package

:ios-test
echo.
echo Packaging application for testing on iOS %INTERPRETER%
if "%INTERPRETER%" == "" echo (this will take a while)
echo.
set TARGET=-test%INTERPRETER%
set OPTIONS=
goto ios-package

:ios-package
set PLATFORM=ios
call bat\Packager.bat

if "%AUTO_INSTALL_IOS%" == "yes" goto ios-install
echo Now manually install and start application on device
echo.
goto end

:ios-install
echo Installing application for testing on iOS (%DEBUG_IP%)
echo.
call adt -installApp -platform ios -package "%OUTPUT%"
if errorlevel 1 goto installfail

echo Now manually start application on device
echo.
goto end

:android-debug
echo.
echo Packaging and installing application for debugging on Android (%DEBUG_IP%)
echo.
set TARGET=-debug
set OPTIONS=-connect %DEBUG_IP%
goto android-package

:android-test
echo.
echo Packaging and Installing application for testing on Android (%DEBUG_IP%)
echo.
set TARGET=
set OPTIONS=
goto android-package

:android-package
set PLATFORM=android
call bat\Packager.bat

adb devices
echo.
echo Installing %OUTPUT% on the device...
echo.
adb -d install -r "%OUTPUT%"
if errorlevel 1 goto installfail

echo.
echo Starting application on the device for debugging...
echo.
adb shell am start -n air.%APP_ID%/.AppEntry
exit

:installfail
echo.
echo Installing the app on the device failed

:end
pause


code:
akbal-deepwoods-naga-sumbitanal
akbal-deepwoods-taur-sumbitanal
akbal-deepwoods-sumbitanal
akbal-deepwoods-naga-forcedfemaleoral
akbal-deepwoods-taur-forcedfemaleoral
akbal-deepwoods-forcedfemaleoral
akbal-deepwoods-male-naga-rapeakbal
akbal-deepwoods-female-naga-rapeakbal
akbal-deepwoods-male-taur-rapeakbal
akbal-deepwoods-female-taur-rapeakbal
akbal-deepwoods-male-rapeakbal
akbal-deepwoods-female-rapeakbal
akbal-deepwoods-female-bindakbal
akbal-deepwoods-female-taur-bindakbal
akbal-deepwoods-losslust-analed
akbal-deepwoods-losslust-taur-analed
akbal-deepwoods-male-jojosex
akbal-deepwoods-bigbuttanaled
akbal-deepwoods-male-buttfuck
akbal-deepwoods-male-buttfuck2
akbal-deepwoods-male-akbalonback
akbal-deepwoods-male-akbalonback2
akbal-deepwoods-male-highstrength
akbal-deepwoods-female-highstrength
akbal-deepwoods-male-highspeed
akbal-deepwoods-female-highspeed
akbal-deepwoods-male-hightoughness
amily-forest-takecharge
amily-forest-plainfuck
amily-forest-kissingfuck
amily-forest-reverse-cowgirl
amily-forest-fuckpreg
anemone-getanal
anemone-male-fuck
anemone-female-fuck
anemone-bj
anemone-doggy
anemone-egg
anemone-kid-male-vagfuck
anemone-kid-male-bj
anemone-kid-female-sex
anemone-kid-male-masti
anemone-kid-female-masti
ants-desert-male-firstencounter
ants-desert-female-firstencounter
arianfemale-home-giveArianAnal
arianmale-home-giveArianAnal
arianfemale-home-getbj
arianmale-home-getbj
arianfemale-home-penetrate
arianfemale-home-getArianAnal
arianmale-home-getArianAnal
arianfemale-home-suckariandick
arianmale-home-suckariandick
arianfemale-home-getpenetrated
arianmale-home-getpenetrated
arianfemale-home-doublepenetrate
arianfemale-home-docking
arianmale-home-docking
arianfemale-home-mutualmasturbation
arianmale-home-mutualmasturbation
arianfemale-camp-dreamingArian
arianmale-camp-dreamingArian
brooke-gym-male-penetratebrooke
brooke-gym-male-analbrooke
brooke-gym-female-tribadism
brooke-gym-goDown
brooke-gym-male-getLaid
brooke-gym-female-getLaid
brooke-gym-male-doubledicked
brooke-gym-male-specialscene
brooke-gym-female-specialscene
brooke-gym-heckelbrooke3some
brooke-gym-heckelbrookedominance
camping
monster-
goblin-loss-female-bimbodildo
goblin-loss-male-raped
goblin-loss-female-raped
goblin-win-male-buttsex
goblin-win-female-taur-rapedfem
goblin-win-female-naga-rapedfem
goblin-win-female-rapedfem
goblin-win-male-corruptedfuck
goblin-win-male-corruptedbj
goblin-win-male-getridden
goblin-win-male-goblincondomed
goblin-win-male-goblinboners
goblin-win-drider-egged
imp-win-male-fuck
imp-win-female-fuck
imp-loss-female-fuck
imp-loss-male-fuck
implord-win-male-fuck
implord-win-male-bj
implord-win-female-fuck
implord-win-female-breastfeed
implord-loss-male
implord-loss-female
imp-egg
kelt-farm-shamefulbj
kelt-farm-eagerbj
kelt-farm-female-inheat
kelt-farm-smallbarn
kelt-farm-reluctantbj
kelt-farm-naga-subkelt
kelt-farm-subkelt
monster-ceraph
urta-bar
urta-behindbar-fuck
urta-behindbar-masti
urta-behindbar-masti-solo
urta-behindbar-masti-dual
urta-behindbar-female-fuckurta
urta-behindbar-male-fuckurta
urta-bar-bj
urta-public-fuck
urta-public-facial
urta-bukkake
urta-home-female-ride
urta-home-male-fuck
urta-home-anal
urta-bar-vag
urta-home-female-fuck
urta-home-anal-urta
urta-home-69
urta-scylla-masti
urta-scylla-lapfuck
urta-bar-male-spank
urta-egg-repeat
urta-home-pegurta
urta-home-female-fucked
urta-syclla-3some
urta-naga-fuck
urta-home-selfbj
urta-home-bj
urta-raphael-3some
urta-goo-fuck
urta-home-petplay-doggy
urta-home-petplay-reward
urta-home-petplay-walkies
monster-imp
monster-sandwidch
monster-sandwitch
monster-jojo
monster-minotaur
monster-beegirl
monster-greenslime
monster-demonmob
monster-worms
monster-fetishcultist
monster-hellhound
monster-secretarialsuccubus
monster-incubusmechanic
monster-omnibusoverseer
monster-tentaclebeast
monster-goblin
monster-marble
monster-tamani
monster-sharkgirl
monster-fetishzealot
monster-infestedhellhound
monster-naga
monster-akbal
monster-ceraph
monster-tamanisdaughters
monster-harpy
monster-sophie
monster-impmob
monster-pod
monster-anemone
monster-vala
monster-zetaz
monster-gnoll
monster-amily
monster-gnollspearthrower
monster-izma
monster-isabella
monster-femalespidermorph
monster-malespidermorph
monster-basilisk
monster-corrupteddrider
monster-minotaurmob
monster-kiha
monster-shouldra
monster-googirl
monster-hel
monster-spidermorphmob
monster-gooarmor
monster-harpymob
monster-brigid
monster-phoenixmob
monster-harpyqueen
monster-farmers
monster-ember
monster-chameleongirl
monster-sandtrap
monster-satyr
monster-kitsune
monster-sirius
monster-minotaurlord
monster-milkysuccubus
monster-kelt
monster-sheila
monster-minerva
monster-implord
monster-sandwitchmob
monster-cumwitch
monster-sandmother
monster-holli
monster-hollispawn


code:
@echo off
cd..
set PAUSE_ERRORS=1
call bat\SetupSDK.bat
call bat\SetupApplication.bat

:: Generate
echo.
echo Generating a self-signed certificate for Android packaging
call adt -certificate -validityPeriod 25 -cn %AND_CERT_NAME% 1024-RSA "%AND_CERT_FILE%" %AND_CERT_PASS%
if errorlevel 1 goto failed

:succeed
echo.
echo Certificate created: %AND_CERT_FILE% with password "%AND_CERT_PASS%"
echo.
if "%AND_CERT_PASS%" == "fd" echo (note: you did not change the default password)
echo.
echo HINTS:
echo - you only need to generate this certificate once,
echo - wait a minute before using this certificate to package your AIR application.
echo.
goto end

:failed
echo.
echo Certificate creation FAILED.
echo.

:end
pause


code:
@echo off
set PAUSE_ERRORS=1
call SetupSDK.bat

:: AIR runtime installer
set AIR_INSTALLER=%FLEX_SDK%\runtimes\air\android\device\runtime.apk

:: Install
adb devices
echo.
echo Installing AIR runtime on current device:
echo %AIR_INSTALLER%
echo.
adb install "%AIR_INSTALLER%"
echo.
if errorlevel 1 goto failed
goto end

:failed
echo Troubleshooting:
echo - one, and only one, Android device should be connected
echo - verify 'SetupSDK.bat'
echo.
goto end

:end
pause


code:
@echo off

if "%PLATFORM%"=="android" goto android-config
if "%PLATFORM%"=="ios" goto ios-config
if "%PLATFORM%"=="ios-dist" goto ios-dist-config
goto start

:android-config
set CERT_FILE=%AND_CERT_FILE%
set SIGNING_OPTIONS=%AND_SIGNING_OPTIONS%
set ICONS=%AND_ICONS%
set DIST_EXT=apk
set TYPE=apk
goto start

:ios-config
set CERT_FILE=%IOS_DEV_CERT_FILE%
set SIGNING_OPTIONS=%IOS_DEV_SIGNING_OPTIONS%
set ICONS=%IOS_ICONS%
set DIST_EXT=ipa
set TYPE=ipa
goto start

:ios-dist-config
set CERT_FILE=%IOS_DIST_CERT_FILE%
set SIGNING_OPTIONS=%IOS_DIST_SIGNING_OPTIONS%
set ICONS=%IOS_ICONS%
set DIST_EXT=ipa
set TYPE=ipa
goto start

:start
if not exist "%CERT_FILE%" goto certificate
:: Output file
set FILE_OR_DIR=%FILE_OR_DIR% -C "%ICONS%" .
if not exist "%DIST_PATH%" md "%DIST_PATH%"
set OUTPUT=%DIST_PATH%\%DIST_NAME%%TARGET%.%DIST_EXT%
:: Package
echo Packaging: %OUTPUT%
echo using certificate: %CERT_FILE%...
echo.
call adt -package -target %TYPE%%TARGET% %OPTIONS% %SIGNING_OPTIONS% "%OUTPUT%" "%APP_XML%" %FILE_OR_DIR%
echo.
if errorlevel 1 goto failed
goto end

:certificate
echo Certificate not found: %CERT_FILE%
echo.
echo Android:
echo - generate a default certificate using 'bat\CreateCertificate.bat'
echo   or configure a specific certificate in 'bat\SetupApplication.bat'.
echo.
echo iOS:
echo - configure your developer key and project's Provisioning Profile
echo   in 'bat\SetupApplication.bat'.
echo.
if %PAUSE_ERRORS%==1 pause
exit

:failed
echo APK setup creation FAILED.
echo.
echo Troubleshooting:
echo - did you build your project in FlashDevelop?
echo - verify AIR SDK target version in %APP_XML%
echo.
if %PAUSE_ERRORS%==1 pause
exit

:end


code:
:user_configuration

:: About AIR application packaging
:: http://livedocs.adobe.com/flex/3/html/help.html?content=CommandLineTools_5.html#1035959
:: http://livedocs.adobe.com/flex/3/html/distributing_apps_4.html#1037515

:: NOTICE: all paths are relative to project root

:: Android packaging
set AND_CERT_NAME="Corruption-of-Champions-AIR"
set AND_CERT_PASS=testpassword
set AND_CERT_FILE=cert\CorruptionofChampionsAIR.p12
set AND_ICONS=icons

set AND_SIGNING_OPTIONS=-storetype pkcs12 -keystore "%AND_CERT_FILE%" -storepass %AND_CERT_PASS%

:: iOS packaging
set IOS_DIST_CERT_FILE=
set IOS_DEV_CERT_FILE=
set IOS_DEV_CERT_PASS=
set IOS_PROVISION=cert\CorruptionofChampionsAIR.mobileprovision
set IOS_ICONS=icons

set IOS_DEV_SIGNING_OPTIONS=-storetype pkcs12 -keystore "%IOS_DEV_CERT_FILE%" -storepass %IOS_DEV_CERT_PASS% -provisioning-profile %IOS_PROVISION%
set IOS_DIST_SIGNING_OPTIONS=-storetype pkcs12 -keystore "%IOS_DIST_CERT_FILE%" -provisioning-profile %IOS_PROVISION%

:: Application descriptor
set APP_XML=..\application.xml

:: Files to package
set APP_DIR=bin
set FILE_OR_DIR=-C %APP_DIR% .

:: Your application ID (must match <id> of Application descriptor)
set APP_ID=com.fenoxo.coc

:: Output packages
set DIST_PATH=dist
set DIST_NAME=CorruptionofChampionsAIR

:: Debugging using a custom IP
set DEBUG_IP=

:validation
%SystemRoot%\System32\find /C "<id>%APP_ID%</id>" "%APP_XML%" > NUL
if errorlevel 1 goto badid
goto end

:badid
echo.
echo ERROR:
echo   Application ID in 'bat\SetupApplication.bat' (APP_ID)
echo   does NOT match Application descriptor '%APP_XML%' (id)
echo.
PAUSE
:end


code:
:user_configuration
set PAUSE_ERRORS=1
:: Path to Flex SDK
set FLEX_SDK=%~dp0\..\..\..\..\Adobe_Flex_SDK
set AUTO_INSTALL_IOS=yes

:: Path to Android SDK
set ANDROID_SDK=C:\Users\Sylvain\AppData\Local\Android\sdk

:validation
if not exist "%FLEX_SDK%\bin" goto flexsdk
if not exist "%ANDROID_SDK%\platform-tools" goto androidsdk
goto succeed

:flexsdk
echo.
echo ERROR: incorrect path to Flex SDK in 'bat\SetupSDK.bat'
echo.
echo Looking for: %FLEX_SDK%\bin
echo.
if %PAUSE_ERRORS%==1 pause
exit

:androidsdk
echo.
echo ERROR: incorrect path to Android SDK in 'bat\SetupSDK.bat'
echo.
echo Looking for: %ANDROID_SDK%\platform-tools
echo.
if %PAUSE_ERRORS%==1 pause
exit

:succeed
set PATH=%PATH%;%FLEX_SDK%\bin
set PATH=%PATH%;%ANDROID_SDK%\platform-tools


code:
#!/bin/bash

STAGE="$1"

DIRECTORY=../binRepo

if [ "$STAGE" = "setup" ]; then
	echo "Setup stage"

	if [ ! -d "$DIRECTORY" ]; then
		git clone "git@github.com:herp-a-derp/CoC-Alpha.git" ../binRepo
	else
		(cd ../binRepo && git fetch origin)
		(cd ../binRepo && git reset --hard origin/master)
		(cd ../binRepo && rm CoC*.swf)
		(cd ../binRepo && rm CoC*.apk)

	fi

fi

if [ "$STAGE" = "commit" ]; then
	echo "Commit stage"
	(cd ../binRepo && git add -u)
	(cd ../binRepo && git add CoC*.swf)
	(cd ../binRepo && git add CoC*.apk)
	(cd ../binRepo && git commit -m "Automated build commited by BuildBot CoC-Builder")
	(cd ../binRepo && git push)

fi

echo "Complete"


code:
#!/bin/bash

# This is one of several utility scripts used by Fake-Name's automated build setup
# to automatically create compiled versions of the CoC codebase
#
# this is the actual call to mxmlc that builds a complete swf

set -e

OS=$(uname -s)
FLEX_ROOT=/opt/flex
ADT=${FLEX_ROOT}/bin/adt
if [[ ${OS} =~ ^CYGWIN ]]; then
    FLEX_ROOT=/c/APPS/flex_4_6
    ADT="java -jar $(cygpath -w ${FLEX_ROOT})/lib/adt.jar"
fi

# pull out the version so we can use it for the filename.
COC_VERSION=$(gawk 'match($0, /^[\s\t]+ver = \"(.+)\";/, n) { print n[1] }' < classes/classes/CoC.as)
COC_VERSION_APK=$(echo ${COC_VERSION} | awk -F- '{ print $1 }')
SWF_NAME="CoC-${COC_VERSION}.swf"

echo "Build version = ${COC_VERSION}"

# Clean up old build-artifacts (probably unnecessary with buildbot's build mechanisms)
rm -f ../binRepo/CoC*.{apk,swf}

# ADT packages all files in dirs specified by '-C DIR' so always use clean dir
rm -rf tmp
mkdir tmp

# Force the submodules to be up to date.
git submodule update --init

# This is intended to be run from the root of the git repo as such:
# 'devTools/build.sh'
# the paths are all relative to the repo root.
COMMON_OPTS="\
-use-network=false \
-default-background-color=0x000000 \
-static-link-runtime-shared-libraries=true \
-strict=false \
-define+=CONFIG::release,false \
-define+=CONFIG::debug,true \
-source-path+=classes \
-library-path+=./lib/bin/MainView.swc \
-library-path+=./lib/bin/ScrollPane.swc \
"

# Build standalone SWF
echo "Build standalone ${SWF_NAME}"
${FLEX_ROOT}/bin/amxmlc \
${COMMON_OPTS} \
-debug \
-define+=CONFIG::AIR,false \
-define+=CONFIG::STANDALONE,true \
-o ../binRepo/CoC-${COC_VERSION}.swf \
classes/classes/CoC.as

# Build the Android package
# swf-version=14 == AIR 3.1
# swf-version=21 == AIR 3.8
# swf-version=24 == AIR 13.0
echo "Build AIR SWF ${SWF_NAME}"
${FLEX_ROOT}/bin/mxmlc \
${COMMON_OPTS} \
-define+=CONFIG::AIR,true \
-define+=CONFIG::STANDALONE,false \
-o tmp/CoC-${COC_VERSION}.swf \
+configname=airmobile \
-swf-version=14 \
classes/classes/CoC.as

echo "Setting Application Descriptor version number to ${COC_VERSION_APK}"
/bin/sed -r \
    -e "s@(<versionNumber>).*(<\/versionNumber>)@\1${COC_VERSION_APK}\2@" \
    -e "s@(<content>).*(<\/content>)@\1${SWF_NAME}\2@" \
    ./application.xml
# > ./tmp/application.xml

$ADT \
-package \
-target apk-debug \
-listen \
-storetype pkcs12 \
-keystore ./devTools/cert/CorruptionofChampionsAIR.p12 \
-storepass testpassword \
../binRepo/CoC-${COC_VERSION}.apk \
./tmp/application.xml \
-C tmp . \
-C ./devTools/icons .

rm -rf tmp

echo Done. Building android package.

## Fuck you Adobe. They no longer support air on linux. Assholes.
## If you uncomment the below, it *may* build a air iOS package.

# echo Android package built. Building iOS package.

# fyi, this takes 20+ minutes on a stock-clock i7 920.

# $ADT \
# -package \
# -target ipa-ad-hoc \
# -storetype pkcs12 \
# -keystore ./devTools/cert/CorruptionofChampionsAIR.p12 \
# -storepass testpassword \
# -provisioning-profile ./devTools/cert/Fake.mobileprovision \
# ../binRepo/CoC-${COC_VERSION}.ipa \
# ./application.xml \
# -C ../binRepo . \
# -C ./devTools/icons/ios .


code:
<?xml version="1.0"?>
<flash_profile version="1.0" name="Debug">
  <PublishFormatProperties enabled="true">
    <defaultNames>0</defaultNames>
    <flash>1</flash>
    <projectorWin>0</projectorWin>
    <projectorMac>0</projectorMac>
    <html>0</html>
    <gif>0</gif>
    <jpeg>0</jpeg>
    <png>0</png>
    <svg>0</svg>
    <rnwk>0</rnwk>
    <swc>0</swc>
    <flashDefaultName>1</flashDefaultName>
    <projectorWinDefaultName>1</projectorWinDefaultName>
    <projectorMacDefaultName>1</projectorMacDefaultName>
    <htmlDefaultName>1</htmlDefaultName>
    <gifDefaultName>1</gifDefaultName>
    <jpegDefaultName>1</jpegDefaultName>
    <pngDefaultName>1</pngDefaultName>
    <svgDefaultName>0</svgDefaultName>
    <rnwkDefaultName>1</rnwkDefaultName>
    <swcDefaultName>1</swcDefaultName>
    <flashFileName>CoC.swf</flashFileName>
    <projectorWinFileName>CoC.exe</projectorWinFileName>
    <projectorMacFileName>CoC.app</projectorMacFileName>
    <htmlFileName>CoC.html</htmlFileName>
    <gifFileName>CoC.gif</gifFileName>
    <jpegFileName>CoC.jpg</jpegFileName>
    <pngFileName>CoC.png</pngFileName>
    <svgFileName>CoC.svg</svgFileName>
    <rnwkFileName>CoC.smil</rnwkFileName>
    <swcFileName>CoC.swc</swcFileName>
  </PublishFormatProperties>
  <PublishHtmlProperties enabled="true">
    <VersionDetectionIfAvailable>0</VersionDetectionIfAvailable>
    <VersionInfo>11,8,0,0;11,7,0,0;11,6,0,0;11,5,0,0;11,4,0,0;11,3,0,0;11,2,0,0;11,1,0,0;10,3,0,0;10,2,153,0;10,1,52,0;9,0,124,0;8,0,24,0;7,0,14,0;6,0,79,0;5,0,58,0;4,0,32,0;3,0,8,0;2,0,1,12;1,0,0,1;</VersionInfo>
    <UsingDefaultContentFilename>1</UsingDefaultContentFilename>
    <UsingDefaultAlternateFilename>1</UsingDefaultAlternateFilename>
    <ContentFilename>CoC_content.html</ContentFilename>
    <AlternateFilename>CoC_alternate.html</AlternateFilename>
    <UsingOwnAlternateFile>0</UsingOwnAlternateFile>
    <OwnAlternateFilename></OwnAlternateFilename>
    <Width>1000</Width>
    <Height>800</Height>
    <Align>0</Align>
    <Units>0</Units>
    <Loop>1</Loop>
    <StartPaused>0</StartPaused>
    <Scale>0</Scale>
    <HorizontalAlignment>1</HorizontalAlignment>
    <VerticalAlignment>1</VerticalAlignment>
    <Quality>4</Quality>
    <DeblockingFilter>0</DeblockingFilter>
    <WindowMode>0</WindowMode>
    <DisplayMenu>1</DisplayMenu>
    <DeviceFont>0</DeviceFont>
    <TemplateFileName>C:\Users\Gedan\AppData\Local\Adobe\Flash CC\en_US\Configuration\HTML\Default.html</TemplateFileName>
    <showTagWarnMsg>1</showTagWarnMsg>
  </PublishHtmlProperties>
  <PublishFlashProperties enabled="true">
    <TopDown></TopDown>
    <FireFox></FireFox>
    <Report>0</Report>
    <Protect>0</Protect>
    <OmitTraceActions>0</OmitTraceActions>
    <Quality>80</Quality>
    <DeblockingFilter>0</DeblockingFilter>
    <StreamFormat>0</StreamFormat>
    <StreamCompress>7</StreamCompress>
    <EventFormat>0</EventFormat>
    <EventCompress>7</EventCompress>
    <OverrideSounds>0</OverrideSounds>
    <Version>12</Version>
    <ExternalPlayer>FlashPlayer10.3</ExternalPlayer>
    <ActionScriptVersion>3</ActionScriptVersion>
    <PackageExportFrame>1</PackageExportFrame>
    <PackagePaths></PackagePaths>
    <AS3PackagePaths>./classes</AS3PackagePaths>
    <AS3ConfigConst>CONFIG::FLASH_AUTHORING="true";CONFIG::release="false";CONFIG::debug="true";</AS3ConfigConst>
    <DebuggingPermitted>1</DebuggingPermitted>
    <DebuggingPassword></DebuggingPassword>
    <CompressMovie>1</CompressMovie>
    <CompressionType>0</CompressionType>
    <InvisibleLayer>1</InvisibleLayer>
    <DeviceSound>0</DeviceSound>
    <StreamUse8kSampleRate>0</StreamUse8kSampleRate>
    <EventUse8kSampleRate>0</EventUse8kSampleRate>
    <UseNetwork>0</UseNetwork>
    <DocumentClass>classes.CoC</DocumentClass>
    <AS3Strict>2</AS3Strict>
    <AS3Coach>4</AS3Coach>
    <AS3AutoDeclare>4096</AS3AutoDeclare>
    <AS3Dialect>AS3</AS3Dialect>
    <AS3ExportFrame>1</AS3ExportFrame>
    <AS3Optimize>1</AS3Optimize>
    <ExportSwc>0</ExportSwc>
    <ScriptStuckDelay>15</ScriptStuckDelay>
    <IncludeXMP>1</IncludeXMP>
    <HardwareAcceleration>0</HardwareAcceleration>
    <AS3Flags>4102</AS3Flags>
    <DefaultLibraryLinkage>rsl</DefaultLibraryLinkage>
    <RSLPreloaderMethod>wrap</RSLPreloaderMethod>
    <RSLPreloaderSWF>$(AppConfig)/ActionScript 3.0/rsls/loader_animation.swf</RSLPreloaderSWF>
    <LibraryPath>
      <library-path-entry>
        <swc-path>$(AppConfig)/ActionScript 3.0/libs</swc-path>
        <linkage>merge</linkage>
      </library-path-entry>
      <library-path-entry>
        <swc-path>./lib/bin</swc-path>
        <linkage>merge</linkage>
      </library-path-entry>
      <library-path-entry>
        <swc-path>$(FlexSDK)/frameworks/libs/core.swc</swc-path>
        <linkage>merge</linkage>
      </library-path-entry>
    </LibraryPath>
    <LibraryVersions>
    </LibraryVersions>
    <EnableTelemetry>1</EnableTelemetry>
    <TelemetryPassword></TelemetryPassword>
  </PublishFlashProperties>
  <PublishJpegProperties enabled="true">
    <Width>1000</Width>
    <Height>800</Height>
    <Progressive>0</Progressive>
    <DPI>4718592</DPI>
    <Size>0</Size>
    <Quality>80</Quality>
    <MatchMovieDim>1</MatchMovieDim>
  </PublishJpegProperties>
  <PublishRNWKProperties enabled="true">
    <exportFlash>1</exportFlash>
    <flashBitRate>0</flashBitRate>
    <exportAudio>1</exportAudio>
    <audioFormat>0</audioFormat>
    <singleRateAudio>0</singleRateAudio>
    <realVideoRate>100000</realVideoRate>
    <speed28K>1</speed28K>
    <speed56K>1</speed56K>
    <speedSingleISDN>0</speedSingleISDN>
    <speedDualISDN>0</speedDualISDN>
    <speedCorporateLAN>0</speedCorporateLAN>
    <speed256K>0</speed256K>
    <speed384K>0</speed384K>
    <speed512K>0</speed512K>
    <exportSMIL>1</exportSMIL>
  </PublishRNWKProperties>
  <PublishGifProperties enabled="true">
    <Width>1000</Width>
    <Height>800</Height>
    <Animated>0</Animated>
    <MatchMovieDim>1</MatchMovieDim>
    <Loop>1</Loop>
    <LoopCount>0</LoopCount>
    <Smooth>1</Smooth>
    <MaxColors>255</MaxColors>
  </PublishGifProperties>
  <PublishPNGProperties enabled="true">
    <MatchMovieDim>1</MatchMovieDim>
    <Smooth>1</Smooth>
    <BitDepth>24-bit with Alpha</BitDepth>
    <MaxColors>255</MaxColors>
  </PublishPNGProperties>
</flash_profile>


code:
<?xml version="1.0"?>
<flash_profile version="1.0" name="Release">
  <PublishFormatProperties enabled="true">
    <defaultNames>0</defaultNames>
    <flash>1</flash>
    <projectorWin>0</projectorWin>
    <projectorMac>0</projectorMac>
    <html>0</html>
    <gif>0</gif>
    <jpeg>0</jpeg>
    <png>0</png>
    <svg>0</svg>
    <rnwk>0</rnwk>
    <swc>0</swc>
    <flashDefaultName>1</flashDefaultName>
    <projectorWinDefaultName>1</projectorWinDefaultName>
    <projectorMacDefaultName>1</projectorMacDefaultName>
    <htmlDefaultName>1</htmlDefaultName>
    <gifDefaultName>1</gifDefaultName>
    <jpegDefaultName>1</jpegDefaultName>
    <pngDefaultName>1</pngDefaultName>
    <svgDefaultName>0</svgDefaultName>
    <rnwkDefaultName>1</rnwkDefaultName>
    <swcDefaultName>1</swcDefaultName>
    <flashFileName>CoC.swf</flashFileName>
    <projectorWinFileName>CoC.exe</projectorWinFileName>
    <projectorMacFileName>CoC.app</projectorMacFileName>
    <htmlFileName>CoC.html</htmlFileName>
    <gifFileName>CoC.gif</gifFileName>
    <jpegFileName>CoC.jpg</jpegFileName>
    <pngFileName>CoC.png</pngFileName>
    <svgFileName>CoC.svg</svgFileName>
    <rnwkFileName>CoC.smil</rnwkFileName>
    <swcFileName>CoC.swc</swcFileName>
  </PublishFormatProperties>
  <PublishHtmlProperties enabled="true">
    <VersionDetectionIfAvailable>0</VersionDetectionIfAvailable>
    <VersionInfo>11,8,0,0;11,7,0,0;11,6,0,0;11,5,0,0;11,4,0,0;11,3,0,0;11,2,0,0;11,1,0,0;10,3,0,0;10,2,153,0;10,1,52,0;9,0,124,0;8,0,24,0;7,0,14,0;6,0,79,0;5,0,58,0;4,0,32,0;3,0,8,0;2,0,1,12;1,0,0,1;</VersionInfo>
    <UsingDefaultContentFilename>1</UsingDefaultContentFilename>
    <UsingDefaultAlternateFilename>1</UsingDefaultAlternateFilename>
    <ContentFilename>CoC_content.html</ContentFilename>
    <AlternateFilename>CoC_alternate.html</AlternateFilename>
    <UsingOwnAlternateFile>0</UsingOwnAlternateFile>
    <OwnAlternateFilename></OwnAlternateFilename>
    <Width>1000</Width>
    <Height>800</Height>
    <Align>0</Align>
    <Units>0</Units>
    <Loop>1</Loop>
    <StartPaused>0</StartPaused>
    <Scale>0</Scale>
    <HorizontalAlignment>1</HorizontalAlignment>
    <VerticalAlignment>1</VerticalAlignment>
    <Quality>4</Quality>
    <DeblockingFilter>0</DeblockingFilter>
    <WindowMode>0</WindowMode>
    <DisplayMenu>1</DisplayMenu>
    <DeviceFont>0</DeviceFont>
    <TemplateFileName>C:\Users\Gedan\AppData\Local\Adobe\Flash CC\en_US\Configuration\HTML\Default.html</TemplateFileName>
    <showTagWarnMsg>1</showTagWarnMsg>
  </PublishHtmlProperties>
  <PublishFlashProperties enabled="true">
    <TopDown></TopDown>
    <FireFox></FireFox>
    <Report>0</Report>
    <Protect>0</Protect>
    <OmitTraceActions>1</OmitTraceActions>
    <Quality>80</Quality>
    <DeblockingFilter>0</DeblockingFilter>
    <StreamFormat>0</StreamFormat>
    <StreamCompress>7</StreamCompress>
    <EventFormat>0</EventFormat>
    <EventCompress>7</EventCompress>
    <OverrideSounds>0</OverrideSounds>
    <Version>12</Version>
    <ExternalPlayer>FlashPlayer10.3</ExternalPlayer>
    <ActionScriptVersion>3</ActionScriptVersion>
    <PackageExportFrame>1</PackageExportFrame>
    <PackagePaths></PackagePaths>
    <AS3PackagePaths>./classes</AS3PackagePaths>
    <AS3ConfigConst>CONFIG::FLASH_AUTHORING="true";CONFIG::release="true";CONFIG::debug="false";</AS3ConfigConst>
    <DebuggingPermitted>0</DebuggingPermitted>
    <DebuggingPassword></DebuggingPassword>
    <CompressMovie>1</CompressMovie>
    <CompressionType>0</CompressionType>
    <InvisibleLayer>1</InvisibleLayer>
    <DeviceSound>0</DeviceSound>
    <StreamUse8kSampleRate>0</StreamUse8kSampleRate>
    <EventUse8kSampleRate>0</EventUse8kSampleRate>
    <UseNetwork>0</UseNetwork>
    <DocumentClass>classes.CoC</DocumentClass>
    <AS3Strict>2</AS3Strict>
    <AS3Coach>4</AS3Coach>
    <AS3AutoDeclare>4096</AS3AutoDeclare>
    <AS3Dialect>AS3</AS3Dialect>
    <AS3ExportFrame>1</AS3ExportFrame>
    <AS3Optimize>1</AS3Optimize>
    <ExportSwc>0</ExportSwc>
    <ScriptStuckDelay>15</ScriptStuckDelay>
    <IncludeXMP>1</IncludeXMP>
    <HardwareAcceleration>0</HardwareAcceleration>
    <AS3Flags>4102</AS3Flags>
    <DefaultLibraryLinkage>rsl</DefaultLibraryLinkage>
    <RSLPreloaderMethod>wrap</RSLPreloaderMethod>
    <RSLPreloaderSWF>$(AppConfig)/ActionScript 3.0/rsls/loader_animation.swf</RSLPreloaderSWF>
    <LibraryPath>
      <library-path-entry>
        <swc-path>$(AppConfig)/ActionScript 3.0/libs</swc-path>
        <linkage>merge</linkage>
      </library-path-entry>
      <library-path-entry>
        <swc-path>./lib/bin</swc-path>
        <linkage>merge</linkage>
      </library-path-entry>
      <library-path-entry>
        <swc-path>$(FlexSDK)/frameworks/libs/core.swc</swc-path>
        <linkage>merge</linkage>
      </library-path-entry>
    </LibraryPath>
    <LibraryVersions>
    </LibraryVersions>
    <EnableTelemetry>0</EnableTelemetry>
    <TelemetryPassword></TelemetryPassword>
  </PublishFlashProperties>
  <PublishJpegProperties enabled="true">
    <Width>1000</Width>
    <Height>800</Height>
    <Progressive>0</Progressive>
    <DPI>4718592</DPI>
    <Size>0</Size>
    <Quality>80</Quality>
    <MatchMovieDim>1</MatchMovieDim>
  </PublishJpegProperties>
  <PublishRNWKProperties enabled="true">
    <exportFlash>1</exportFlash>
    <flashBitRate>0</flashBitRate>
    <exportAudio>1</exportAudio>
    <audioFormat>0</audioFormat>
    <singleRateAudio>0</singleRateAudio>
    <realVideoRate>100000</realVideoRate>
    <speed28K>1</speed28K>
    <speed56K>1</speed56K>
    <speedSingleISDN>0</speedSingleISDN>
    <speedDualISDN>0</speedDualISDN>
    <speedCorporateLAN>0</speedCorporateLAN>
    <speed256K>0</speed256K>
    <speed384K>0</speed384K>
    <speed512K>0</speed512K>
    <exportSMIL>1</exportSMIL>
  </PublishRNWKProperties>
  <PublishGifProperties enabled="true">
    <Width>1000</Width>
    <Height>800</Height>
    <Animated>0</Animated>
    <MatchMovieDim>1</MatchMovieDim>
    <Loop>1</Loop>
    <LoopCount>0</LoopCount>
    <Smooth>1</Smooth>
    <MaxColors>255</MaxColors>
  </PublishGifProperties>
  <PublishPNGProperties enabled="true">
    <MatchMovieDim>1</MatchMovieDim>
    <Smooth>1</Smooth>
    <BitDepth>24-bit with Alpha</BitDepth>
    <MaxColors>255</MaxColors>
  </PublishPNGProperties>
</flash_profile>


code:
#!/bin/bash

# This is one of several utility scripts used by Fake-Name's automated build setup
# to automatically create compiled versions of the CoC codebase
#
# This script modifies the main CoC.as file and inserts a notification that this is an
# alpha-release, as well as embeds the current time of compilation

echo Reverting any local changes to CoC.as file
git checkout -- ./classes/classes/CoC.as

export GIT_REV=`git rev-parse  --short HEAD`

echo Done. Splicing in release info
/bin/sed -i -r "s/^([\s\\t]+ver\s?=\s?\".+)\";/\1-A-${GIT_REV}\"\;/" ./classes/classes/CoC.as
/bin/sed -i -r "s/^([\s\\t]+version\s?=\s?\".+)\";/\1\\\\nALPHA RELEASE Rev: ${GIT_REV}\\\\n Compiled by buildbot\"\;/" ./classes/classes/CoC.as

#cat ./classes/classes/CoC.as
echo
echo File modified. Current version strings:
cat ./classes/classes/CoC.as | grep -E "ver\s?="
cat ./classes/classes/CoC.as | grep -E "version\s?="


caption: Fix Fancyquotes: Remove and replace fancyquotes with less fancy equivilents


to: bol

characters: outputText("

command: insert

to: hardeol