Merge branch 'master' of git://github.com/JapaMala/dfhack

Conflicts:
	plugins/rendermax/renderer_light.cpp
develop
Warmist 2013-06-23 21:35:13 +03:00
commit 1361b38f27
67 changed files with 3424 additions and 5 deletions

@ -0,0 +1,968 @@
//------------------------------------------------------------------------------
// <auto-generated>
// This code was generated by a tool.
//
// Changes to this file may cause incorrect behavior and will be lost if
// the code is regenerated.
// </auto-generated>
//------------------------------------------------------------------------------
// Generated from: Basic.proto
namespace dfproto
{
[global::System.Serializable, global::ProtoBuf.ProtoContract(Name=@"EnumItemName")]
public partial class EnumItemName : global::ProtoBuf.IExtensible
{
public EnumItemName() {}
private int _value;
[global::ProtoBuf.ProtoMember(1, IsRequired = true, Name=@"value", DataFormat = global::ProtoBuf.DataFormat.TwosComplement)]
public int value
{
get { return _value; }
set { _value = value; }
}
private string _name = "";
[global::ProtoBuf.ProtoMember(2, IsRequired = false, Name=@"name", DataFormat = global::ProtoBuf.DataFormat.Default)]
[global::System.ComponentModel.DefaultValue("")]
public string name
{
get { return _name; }
set { _name = value; }
}
private int _bit_size = (int)1;
[global::ProtoBuf.ProtoMember(3, IsRequired = false, Name=@"bit_size", DataFormat = global::ProtoBuf.DataFormat.TwosComplement)]
[global::System.ComponentModel.DefaultValue((int)1)]
public int bit_size
{
get { return _bit_size; }
set { _bit_size = value; }
}
private global::ProtoBuf.IExtension extensionObject;
global::ProtoBuf.IExtension global::ProtoBuf.IExtensible.GetExtensionObject(bool createIfMissing)
{ return global::ProtoBuf.Extensible.GetExtensionObject(ref extensionObject, createIfMissing); }
}
[global::System.Serializable, global::ProtoBuf.ProtoContract(Name=@"BasicMaterialId")]
public partial class BasicMaterialId : global::ProtoBuf.IExtensible
{
public BasicMaterialId() {}
private int _type;
[global::ProtoBuf.ProtoMember(1, IsRequired = true, Name=@"type", DataFormat = global::ProtoBuf.DataFormat.TwosComplement)]
public int type
{
get { return _type; }
set { _type = value; }
}
private int _index;
[global::ProtoBuf.ProtoMember(2, IsRequired = true, Name=@"index", DataFormat = global::ProtoBuf.DataFormat.ZigZag)]
public int index
{
get { return _index; }
set { _index = value; }
}
private global::ProtoBuf.IExtension extensionObject;
global::ProtoBuf.IExtension global::ProtoBuf.IExtensible.GetExtensionObject(bool createIfMissing)
{ return global::ProtoBuf.Extensible.GetExtensionObject(ref extensionObject, createIfMissing); }
}
[global::System.Serializable, global::ProtoBuf.ProtoContract(Name=@"BasicMaterialInfo")]
public partial class BasicMaterialInfo : global::ProtoBuf.IExtensible
{
public BasicMaterialInfo() {}
private int _type;
[global::ProtoBuf.ProtoMember(1, IsRequired = true, Name=@"type", DataFormat = global::ProtoBuf.DataFormat.TwosComplement)]
public int type
{
get { return _type; }
set { _type = value; }
}
private int _index;
[global::ProtoBuf.ProtoMember(2, IsRequired = true, Name=@"index", DataFormat = global::ProtoBuf.DataFormat.ZigZag)]
public int index
{
get { return _index; }
set { _index = value; }
}
private string _token;
[global::ProtoBuf.ProtoMember(3, IsRequired = true, Name=@"token", DataFormat = global::ProtoBuf.DataFormat.Default)]
public string token
{
get { return _token; }
set { _token = value; }
}
private readonly global::System.Collections.Generic.List<int> _flags = new global::System.Collections.Generic.List<int>();
[global::ProtoBuf.ProtoMember(4, Name=@"flags", DataFormat = global::ProtoBuf.DataFormat.TwosComplement)]
public global::System.Collections.Generic.List<int> flags
{
get { return _flags; }
}
private int _subtype = (int)-1;
[global::ProtoBuf.ProtoMember(5, IsRequired = false, Name=@"subtype", DataFormat = global::ProtoBuf.DataFormat.TwosComplement)]
[global::System.ComponentModel.DefaultValue((int)-1)]
public int subtype
{
get { return _subtype; }
set { _subtype = value; }
}
private int _creature_id = (int)-1;
[global::ProtoBuf.ProtoMember(6, IsRequired = false, Name=@"creature_id", DataFormat = global::ProtoBuf.DataFormat.TwosComplement)]
[global::System.ComponentModel.DefaultValue((int)-1)]
public int creature_id
{
get { return _creature_id; }
set { _creature_id = value; }
}
private int _plant_id = (int)-1;
[global::ProtoBuf.ProtoMember(7, IsRequired = false, Name=@"plant_id", DataFormat = global::ProtoBuf.DataFormat.TwosComplement)]
[global::System.ComponentModel.DefaultValue((int)-1)]
public int plant_id
{
get { return _plant_id; }
set { _plant_id = value; }
}
private int _histfig_id = (int)-1;
[global::ProtoBuf.ProtoMember(8, IsRequired = false, Name=@"histfig_id", DataFormat = global::ProtoBuf.DataFormat.TwosComplement)]
[global::System.ComponentModel.DefaultValue((int)-1)]
public int histfig_id
{
get { return _histfig_id; }
set { _histfig_id = value; }
}
private string _name_prefix = "";
[global::ProtoBuf.ProtoMember(9, IsRequired = false, Name=@"name_prefix", DataFormat = global::ProtoBuf.DataFormat.Default)]
[global::System.ComponentModel.DefaultValue("")]
public string name_prefix
{
get { return _name_prefix; }
set { _name_prefix = value; }
}
private readonly global::System.Collections.Generic.List<uint> _state_color = new global::System.Collections.Generic.List<uint>();
[global::ProtoBuf.ProtoMember(10, Name=@"state_color", DataFormat = global::ProtoBuf.DataFormat.FixedSize)]
public global::System.Collections.Generic.List<uint> state_color
{
get { return _state_color; }
}
private readonly global::System.Collections.Generic.List<string> _state_name = new global::System.Collections.Generic.List<string>();
[global::ProtoBuf.ProtoMember(11, Name=@"state_name", DataFormat = global::ProtoBuf.DataFormat.Default)]
public global::System.Collections.Generic.List<string> state_name
{
get { return _state_name; }
}
private readonly global::System.Collections.Generic.List<string> _state_adj = new global::System.Collections.Generic.List<string>();
[global::ProtoBuf.ProtoMember(12, Name=@"state_adj", DataFormat = global::ProtoBuf.DataFormat.Default)]
public global::System.Collections.Generic.List<string> state_adj
{
get { return _state_adj; }
}
private readonly global::System.Collections.Generic.List<string> _reaction_class = new global::System.Collections.Generic.List<string>();
[global::ProtoBuf.ProtoMember(13, Name=@"reaction_class", DataFormat = global::ProtoBuf.DataFormat.Default)]
public global::System.Collections.Generic.List<string> reaction_class
{
get { return _reaction_class; }
}
private readonly global::System.Collections.Generic.List<dfproto.BasicMaterialInfo.Product> _reaction_product = new global::System.Collections.Generic.List<dfproto.BasicMaterialInfo.Product>();
[global::ProtoBuf.ProtoMember(14, Name=@"reaction_product", DataFormat = global::ProtoBuf.DataFormat.Default)]
public global::System.Collections.Generic.List<dfproto.BasicMaterialInfo.Product> reaction_product
{
get { return _reaction_product; }
}
private readonly global::System.Collections.Generic.List<int> _inorganic_flags = new global::System.Collections.Generic.List<int>();
[global::ProtoBuf.ProtoMember(15, Name=@"inorganic_flags", DataFormat = global::ProtoBuf.DataFormat.TwosComplement)]
public global::System.Collections.Generic.List<int> inorganic_flags
{
get { return _inorganic_flags; }
}
[global::System.Serializable, global::ProtoBuf.ProtoContract(Name=@"Product")]
public partial class Product : global::ProtoBuf.IExtensible
{
public Product() {}
private string _id;
[global::ProtoBuf.ProtoMember(1, IsRequired = true, Name=@"id", DataFormat = global::ProtoBuf.DataFormat.Default)]
public string id
{
get { return _id; }
set { _id = value; }
}
private int _type;
[global::ProtoBuf.ProtoMember(2, IsRequired = true, Name=@"type", DataFormat = global::ProtoBuf.DataFormat.TwosComplement)]
public int type
{
get { return _type; }
set { _type = value; }
}
private int _index;
[global::ProtoBuf.ProtoMember(3, IsRequired = true, Name=@"index", DataFormat = global::ProtoBuf.DataFormat.ZigZag)]
public int index
{
get { return _index; }
set { _index = value; }
}
private global::ProtoBuf.IExtension extensionObject;
global::ProtoBuf.IExtension global::ProtoBuf.IExtensible.GetExtensionObject(bool createIfMissing)
{ return global::ProtoBuf.Extensible.GetExtensionObject(ref extensionObject, createIfMissing); }
}
private global::ProtoBuf.IExtension extensionObject;
global::ProtoBuf.IExtension global::ProtoBuf.IExtensible.GetExtensionObject(bool createIfMissing)
{ return global::ProtoBuf.Extensible.GetExtensionObject(ref extensionObject, createIfMissing); }
}
[global::System.Serializable, global::ProtoBuf.ProtoContract(Name=@"BasicMaterialInfoMask")]
public partial class BasicMaterialInfoMask : global::ProtoBuf.IExtensible
{
public BasicMaterialInfoMask() {}
private readonly global::System.Collections.Generic.List<dfproto.BasicMaterialInfoMask.StateType> _states = new global::System.Collections.Generic.List<dfproto.BasicMaterialInfoMask.StateType>();
[global::ProtoBuf.ProtoMember(1, Name=@"states", DataFormat = global::ProtoBuf.DataFormat.TwosComplement)]
public global::System.Collections.Generic.List<dfproto.BasicMaterialInfoMask.StateType> states
{
get { return _states; }
}
private int _temperature = (int)10015;
[global::ProtoBuf.ProtoMember(4, IsRequired = false, Name=@"temperature", DataFormat = global::ProtoBuf.DataFormat.TwosComplement)]
[global::System.ComponentModel.DefaultValue((int)10015)]
public int temperature
{
get { return _temperature; }
set { _temperature = value; }
}
private bool _flags = (bool)false;
[global::ProtoBuf.ProtoMember(2, IsRequired = false, Name=@"flags", DataFormat = global::ProtoBuf.DataFormat.Default)]
[global::System.ComponentModel.DefaultValue((bool)false)]
public bool flags
{
get { return _flags; }
set { _flags = value; }
}
private bool _reaction = (bool)false;
[global::ProtoBuf.ProtoMember(3, IsRequired = false, Name=@"reaction", DataFormat = global::ProtoBuf.DataFormat.Default)]
[global::System.ComponentModel.DefaultValue((bool)false)]
public bool reaction
{
get { return _reaction; }
set { _reaction = value; }
}
[global::ProtoBuf.ProtoContract(Name=@"StateType")]
public enum StateType
{
[global::ProtoBuf.ProtoEnum(Name=@"Solid", Value=0)]
Solid = 0,
[global::ProtoBuf.ProtoEnum(Name=@"Liquid", Value=1)]
Liquid = 1,
[global::ProtoBuf.ProtoEnum(Name=@"Gas", Value=2)]
Gas = 2,
[global::ProtoBuf.ProtoEnum(Name=@"Powder", Value=3)]
Powder = 3,
[global::ProtoBuf.ProtoEnum(Name=@"Paste", Value=4)]
Paste = 4,
[global::ProtoBuf.ProtoEnum(Name=@"Pressed", Value=5)]
Pressed = 5
}
private global::ProtoBuf.IExtension extensionObject;
global::ProtoBuf.IExtension global::ProtoBuf.IExtensible.GetExtensionObject(bool createIfMissing)
{ return global::ProtoBuf.Extensible.GetExtensionObject(ref extensionObject, createIfMissing); }
}
[global::System.Serializable, global::ProtoBuf.ProtoContract(Name=@"JobSkillAttr")]
public partial class JobSkillAttr : global::ProtoBuf.IExtensible
{
public JobSkillAttr() {}
private int _id;
[global::ProtoBuf.ProtoMember(1, IsRequired = true, Name=@"id", DataFormat = global::ProtoBuf.DataFormat.TwosComplement)]
public int id
{
get { return _id; }
set { _id = value; }
}
private string _key;
[global::ProtoBuf.ProtoMember(2, IsRequired = true, Name=@"key", DataFormat = global::ProtoBuf.DataFormat.Default)]
public string key
{
get { return _key; }
set { _key = value; }
}
private string _caption = "";
[global::ProtoBuf.ProtoMember(3, IsRequired = false, Name=@"caption", DataFormat = global::ProtoBuf.DataFormat.Default)]
[global::System.ComponentModel.DefaultValue("")]
public string caption
{
get { return _caption; }
set { _caption = value; }
}
private string _caption_noun = "";
[global::ProtoBuf.ProtoMember(4, IsRequired = false, Name=@"caption_noun", DataFormat = global::ProtoBuf.DataFormat.Default)]
[global::System.ComponentModel.DefaultValue("")]
public string caption_noun
{
get { return _caption_noun; }
set { _caption_noun = value; }
}
private int _profession = default(int);
[global::ProtoBuf.ProtoMember(5, IsRequired = false, Name=@"profession", DataFormat = global::ProtoBuf.DataFormat.TwosComplement)]
[global::System.ComponentModel.DefaultValue(default(int))]
public int profession
{
get { return _profession; }
set { _profession = value; }
}
private int _labor = default(int);
[global::ProtoBuf.ProtoMember(6, IsRequired = false, Name=@"labor", DataFormat = global::ProtoBuf.DataFormat.TwosComplement)]
[global::System.ComponentModel.DefaultValue(default(int))]
public int labor
{
get { return _labor; }
set { _labor = value; }
}
private string _type = "";
[global::ProtoBuf.ProtoMember(7, IsRequired = false, Name=@"type", DataFormat = global::ProtoBuf.DataFormat.Default)]
[global::System.ComponentModel.DefaultValue("")]
public string type
{
get { return _type; }
set { _type = value; }
}
private global::ProtoBuf.IExtension extensionObject;
global::ProtoBuf.IExtension global::ProtoBuf.IExtensible.GetExtensionObject(bool createIfMissing)
{ return global::ProtoBuf.Extensible.GetExtensionObject(ref extensionObject, createIfMissing); }
}
[global::System.Serializable, global::ProtoBuf.ProtoContract(Name=@"ProfessionAttr")]
public partial class ProfessionAttr : global::ProtoBuf.IExtensible
{
public ProfessionAttr() {}
private int _id;
[global::ProtoBuf.ProtoMember(1, IsRequired = true, Name=@"id", DataFormat = global::ProtoBuf.DataFormat.TwosComplement)]
public int id
{
get { return _id; }
set { _id = value; }
}
private string _key;
[global::ProtoBuf.ProtoMember(2, IsRequired = true, Name=@"key", DataFormat = global::ProtoBuf.DataFormat.Default)]
public string key
{
get { return _key; }
set { _key = value; }
}
private string _caption = "";
[global::ProtoBuf.ProtoMember(3, IsRequired = false, Name=@"caption", DataFormat = global::ProtoBuf.DataFormat.Default)]
[global::System.ComponentModel.DefaultValue("")]
public string caption
{
get { return _caption; }
set { _caption = value; }
}
private bool _military = default(bool);
[global::ProtoBuf.ProtoMember(4, IsRequired = false, Name=@"military", DataFormat = global::ProtoBuf.DataFormat.Default)]
[global::System.ComponentModel.DefaultValue(default(bool))]
public bool military
{
get { return _military; }
set { _military = value; }
}
private bool _can_assign_labor = default(bool);
[global::ProtoBuf.ProtoMember(5, IsRequired = false, Name=@"can_assign_labor", DataFormat = global::ProtoBuf.DataFormat.Default)]
[global::System.ComponentModel.DefaultValue(default(bool))]
public bool can_assign_labor
{
get { return _can_assign_labor; }
set { _can_assign_labor = value; }
}
private int _parent = default(int);
[global::ProtoBuf.ProtoMember(6, IsRequired = false, Name=@"parent", DataFormat = global::ProtoBuf.DataFormat.TwosComplement)]
[global::System.ComponentModel.DefaultValue(default(int))]
public int parent
{
get { return _parent; }
set { _parent = value; }
}
private global::ProtoBuf.IExtension extensionObject;
global::ProtoBuf.IExtension global::ProtoBuf.IExtensible.GetExtensionObject(bool createIfMissing)
{ return global::ProtoBuf.Extensible.GetExtensionObject(ref extensionObject, createIfMissing); }
}
[global::System.Serializable, global::ProtoBuf.ProtoContract(Name=@"UnitLaborAttr")]
public partial class UnitLaborAttr : global::ProtoBuf.IExtensible
{
public UnitLaborAttr() {}
private int _id;
[global::ProtoBuf.ProtoMember(1, IsRequired = true, Name=@"id", DataFormat = global::ProtoBuf.DataFormat.TwosComplement)]
public int id
{
get { return _id; }
set { _id = value; }
}
private string _key;
[global::ProtoBuf.ProtoMember(2, IsRequired = true, Name=@"key", DataFormat = global::ProtoBuf.DataFormat.Default)]
public string key
{
get { return _key; }
set { _key = value; }
}
private string _caption = "";
[global::ProtoBuf.ProtoMember(3, IsRequired = false, Name=@"caption", DataFormat = global::ProtoBuf.DataFormat.Default)]
[global::System.ComponentModel.DefaultValue("")]
public string caption
{
get { return _caption; }
set { _caption = value; }
}
private global::ProtoBuf.IExtension extensionObject;
global::ProtoBuf.IExtension global::ProtoBuf.IExtensible.GetExtensionObject(bool createIfMissing)
{ return global::ProtoBuf.Extensible.GetExtensionObject(ref extensionObject, createIfMissing); }
}
[global::System.Serializable, global::ProtoBuf.ProtoContract(Name=@"NameInfo")]
public partial class NameInfo : global::ProtoBuf.IExtensible
{
public NameInfo() {}
private string _first_name = "";
[global::ProtoBuf.ProtoMember(1, IsRequired = false, Name=@"first_name", DataFormat = global::ProtoBuf.DataFormat.Default)]
[global::System.ComponentModel.DefaultValue("")]
public string first_name
{
get { return _first_name; }
set { _first_name = value; }
}
private string _nickname = "";
[global::ProtoBuf.ProtoMember(2, IsRequired = false, Name=@"nickname", DataFormat = global::ProtoBuf.DataFormat.Default)]
[global::System.ComponentModel.DefaultValue("")]
public string nickname
{
get { return _nickname; }
set { _nickname = value; }
}
private int _language_id = (int)-1;
[global::ProtoBuf.ProtoMember(3, IsRequired = false, Name=@"language_id", DataFormat = global::ProtoBuf.DataFormat.TwosComplement)]
[global::System.ComponentModel.DefaultValue((int)-1)]
public int language_id
{
get { return _language_id; }
set { _language_id = value; }
}
private string _last_name = "";
[global::ProtoBuf.ProtoMember(4, IsRequired = false, Name=@"last_name", DataFormat = global::ProtoBuf.DataFormat.Default)]
[global::System.ComponentModel.DefaultValue("")]
public string last_name
{
get { return _last_name; }
set { _last_name = value; }
}
private string _english_name = "";
[global::ProtoBuf.ProtoMember(5, IsRequired = false, Name=@"english_name", DataFormat = global::ProtoBuf.DataFormat.Default)]
[global::System.ComponentModel.DefaultValue("")]
public string english_name
{
get { return _english_name; }
set { _english_name = value; }
}
private global::ProtoBuf.IExtension extensionObject;
global::ProtoBuf.IExtension global::ProtoBuf.IExtensible.GetExtensionObject(bool createIfMissing)
{ return global::ProtoBuf.Extensible.GetExtensionObject(ref extensionObject, createIfMissing); }
}
[global::System.Serializable, global::ProtoBuf.ProtoContract(Name=@"NameTriple")]
public partial class NameTriple : global::ProtoBuf.IExtensible
{
public NameTriple() {}
private string _normal;
[global::ProtoBuf.ProtoMember(1, IsRequired = true, Name=@"normal", DataFormat = global::ProtoBuf.DataFormat.Default)]
public string normal
{
get { return _normal; }
set { _normal = value; }
}
private string _plural = "";
[global::ProtoBuf.ProtoMember(2, IsRequired = false, Name=@"plural", DataFormat = global::ProtoBuf.DataFormat.Default)]
[global::System.ComponentModel.DefaultValue("")]
public string plural
{
get { return _plural; }
set { _plural = value; }
}
private string _adjective = "";
[global::ProtoBuf.ProtoMember(3, IsRequired = false, Name=@"adjective", DataFormat = global::ProtoBuf.DataFormat.Default)]
[global::System.ComponentModel.DefaultValue("")]
public string adjective
{
get { return _adjective; }
set { _adjective = value; }
}
private global::ProtoBuf.IExtension extensionObject;
global::ProtoBuf.IExtension global::ProtoBuf.IExtensible.GetExtensionObject(bool createIfMissing)
{ return global::ProtoBuf.Extensible.GetExtensionObject(ref extensionObject, createIfMissing); }
}
[global::System.Serializable, global::ProtoBuf.ProtoContract(Name=@"UnitCurseInfo")]
public partial class UnitCurseInfo : global::ProtoBuf.IExtensible
{
public UnitCurseInfo() {}
private uint _add_tags1;
[global::ProtoBuf.ProtoMember(1, IsRequired = true, Name=@"add_tags1", DataFormat = global::ProtoBuf.DataFormat.FixedSize)]
public uint add_tags1
{
get { return _add_tags1; }
set { _add_tags1 = value; }
}
private uint _rem_tags1;
[global::ProtoBuf.ProtoMember(2, IsRequired = true, Name=@"rem_tags1", DataFormat = global::ProtoBuf.DataFormat.FixedSize)]
public uint rem_tags1
{
get { return _rem_tags1; }
set { _rem_tags1 = value; }
}
private uint _add_tags2;
[global::ProtoBuf.ProtoMember(3, IsRequired = true, Name=@"add_tags2", DataFormat = global::ProtoBuf.DataFormat.FixedSize)]
public uint add_tags2
{
get { return _add_tags2; }
set { _add_tags2 = value; }
}
private uint _rem_tags2;
[global::ProtoBuf.ProtoMember(4, IsRequired = true, Name=@"rem_tags2", DataFormat = global::ProtoBuf.DataFormat.FixedSize)]
public uint rem_tags2
{
get { return _rem_tags2; }
set { _rem_tags2 = value; }
}
private dfproto.NameTriple _name = null;
[global::ProtoBuf.ProtoMember(5, IsRequired = false, Name=@"name", DataFormat = global::ProtoBuf.DataFormat.Default)]
[global::System.ComponentModel.DefaultValue(null)]
public dfproto.NameTriple name
{
get { return _name; }
set { _name = value; }
}
private global::ProtoBuf.IExtension extensionObject;
global::ProtoBuf.IExtension global::ProtoBuf.IExtensible.GetExtensionObject(bool createIfMissing)
{ return global::ProtoBuf.Extensible.GetExtensionObject(ref extensionObject, createIfMissing); }
}
[global::System.Serializable, global::ProtoBuf.ProtoContract(Name=@"SkillInfo")]
public partial class SkillInfo : global::ProtoBuf.IExtensible
{
public SkillInfo() {}
private int _id;
[global::ProtoBuf.ProtoMember(1, IsRequired = true, Name=@"id", DataFormat = global::ProtoBuf.DataFormat.TwosComplement)]
public int id
{
get { return _id; }
set { _id = value; }
}
private int _level;
[global::ProtoBuf.ProtoMember(2, IsRequired = true, Name=@"level", DataFormat = global::ProtoBuf.DataFormat.TwosComplement)]
public int level
{
get { return _level; }
set { _level = value; }
}
private int _experience;
[global::ProtoBuf.ProtoMember(3, IsRequired = true, Name=@"experience", DataFormat = global::ProtoBuf.DataFormat.TwosComplement)]
public int experience
{
get { return _experience; }
set { _experience = value; }
}
private global::ProtoBuf.IExtension extensionObject;
global::ProtoBuf.IExtension global::ProtoBuf.IExtensible.GetExtensionObject(bool createIfMissing)
{ return global::ProtoBuf.Extensible.GetExtensionObject(ref extensionObject, createIfMissing); }
}
[global::System.Serializable, global::ProtoBuf.ProtoContract(Name=@"UnitMiscTrait")]
public partial class UnitMiscTrait : global::ProtoBuf.IExtensible
{
public UnitMiscTrait() {}
private int _id;
[global::ProtoBuf.ProtoMember(1, IsRequired = true, Name=@"id", DataFormat = global::ProtoBuf.DataFormat.TwosComplement)]
public int id
{
get { return _id; }
set { _id = value; }
}
private int _value;
[global::ProtoBuf.ProtoMember(2, IsRequired = true, Name=@"value", DataFormat = global::ProtoBuf.DataFormat.TwosComplement)]
public int value
{
get { return _value; }
set { _value = value; }
}
private global::ProtoBuf.IExtension extensionObject;
global::ProtoBuf.IExtension global::ProtoBuf.IExtensible.GetExtensionObject(bool createIfMissing)
{ return global::ProtoBuf.Extensible.GetExtensionObject(ref extensionObject, createIfMissing); }
}
[global::System.Serializable, global::ProtoBuf.ProtoContract(Name=@"BasicUnitInfo")]
public partial class BasicUnitInfo : global::ProtoBuf.IExtensible
{
public BasicUnitInfo() {}
private int _unit_id;
[global::ProtoBuf.ProtoMember(1, IsRequired = true, Name=@"unit_id", DataFormat = global::ProtoBuf.DataFormat.TwosComplement)]
public int unit_id
{
get { return _unit_id; }
set { _unit_id = value; }
}
private int _pos_x;
[global::ProtoBuf.ProtoMember(13, IsRequired = true, Name=@"pos_x", DataFormat = global::ProtoBuf.DataFormat.TwosComplement)]
public int pos_x
{
get { return _pos_x; }
set { _pos_x = value; }
}
private int _pos_y;
[global::ProtoBuf.ProtoMember(14, IsRequired = true, Name=@"pos_y", DataFormat = global::ProtoBuf.DataFormat.TwosComplement)]
public int pos_y
{
get { return _pos_y; }
set { _pos_y = value; }
}
private int _pos_z;
[global::ProtoBuf.ProtoMember(15, IsRequired = true, Name=@"pos_z", DataFormat = global::ProtoBuf.DataFormat.TwosComplement)]
public int pos_z
{
get { return _pos_z; }
set { _pos_z = value; }
}
private dfproto.NameInfo _name = null;
[global::ProtoBuf.ProtoMember(2, IsRequired = false, Name=@"name", DataFormat = global::ProtoBuf.DataFormat.Default)]
[global::System.ComponentModel.DefaultValue(null)]
public dfproto.NameInfo name
{
get { return _name; }
set { _name = value; }
}
private uint _flags1;
[global::ProtoBuf.ProtoMember(3, IsRequired = true, Name=@"flags1", DataFormat = global::ProtoBuf.DataFormat.FixedSize)]
public uint flags1
{
get { return _flags1; }
set { _flags1 = value; }
}
private uint _flags2;
[global::ProtoBuf.ProtoMember(4, IsRequired = true, Name=@"flags2", DataFormat = global::ProtoBuf.DataFormat.FixedSize)]
public uint flags2
{
get { return _flags2; }
set { _flags2 = value; }
}
private uint _flags3;
[global::ProtoBuf.ProtoMember(5, IsRequired = true, Name=@"flags3", DataFormat = global::ProtoBuf.DataFormat.FixedSize)]
public uint flags3
{
get { return _flags3; }
set { _flags3 = value; }
}
private int _race;
[global::ProtoBuf.ProtoMember(6, IsRequired = true, Name=@"race", DataFormat = global::ProtoBuf.DataFormat.TwosComplement)]
public int race
{
get { return _race; }
set { _race = value; }
}
private int _caste;
[global::ProtoBuf.ProtoMember(7, IsRequired = true, Name=@"caste", DataFormat = global::ProtoBuf.DataFormat.TwosComplement)]
public int caste
{
get { return _caste; }
set { _caste = value; }
}
private int _gender = (int)-1;
[global::ProtoBuf.ProtoMember(8, IsRequired = false, Name=@"gender", DataFormat = global::ProtoBuf.DataFormat.TwosComplement)]
[global::System.ComponentModel.DefaultValue((int)-1)]
public int gender
{
get { return _gender; }
set { _gender = value; }
}
private int _civ_id = (int)-1;
[global::ProtoBuf.ProtoMember(9, IsRequired = false, Name=@"civ_id", DataFormat = global::ProtoBuf.DataFormat.TwosComplement)]
[global::System.ComponentModel.DefaultValue((int)-1)]
public int civ_id
{
get { return _civ_id; }
set { _civ_id = value; }
}
private int _histfig_id = (int)-1;
[global::ProtoBuf.ProtoMember(10, IsRequired = false, Name=@"histfig_id", DataFormat = global::ProtoBuf.DataFormat.TwosComplement)]
[global::System.ComponentModel.DefaultValue((int)-1)]
public int histfig_id
{
get { return _histfig_id; }
set { _histfig_id = value; }
}
private int _death_id = (int)-1;
[global::ProtoBuf.ProtoMember(17, IsRequired = false, Name=@"death_id", DataFormat = global::ProtoBuf.DataFormat.TwosComplement)]
[global::System.ComponentModel.DefaultValue((int)-1)]
public int death_id
{
get { return _death_id; }
set { _death_id = value; }
}
private uint _death_flags = default(uint);
[global::ProtoBuf.ProtoMember(18, IsRequired = false, Name=@"death_flags", DataFormat = global::ProtoBuf.DataFormat.TwosComplement)]
[global::System.ComponentModel.DefaultValue(default(uint))]
public uint death_flags
{
get { return _death_flags; }
set { _death_flags = value; }
}
private int _squad_id = (int)-1;
[global::ProtoBuf.ProtoMember(19, IsRequired = false, Name=@"squad_id", DataFormat = global::ProtoBuf.DataFormat.TwosComplement)]
[global::System.ComponentModel.DefaultValue((int)-1)]
public int squad_id
{
get { return _squad_id; }
set { _squad_id = value; }
}
private int _squad_position = (int)-1;
[global::ProtoBuf.ProtoMember(20, IsRequired = false, Name=@"squad_position", DataFormat = global::ProtoBuf.DataFormat.TwosComplement)]
[global::System.ComponentModel.DefaultValue((int)-1)]
public int squad_position
{
get { return _squad_position; }
set { _squad_position = value; }
}
private int _profession = (int)-1;
[global::ProtoBuf.ProtoMember(22, IsRequired = false, Name=@"profession", DataFormat = global::ProtoBuf.DataFormat.TwosComplement)]
[global::System.ComponentModel.DefaultValue((int)-1)]
public int profession
{
get { return _profession; }
set { _profession = value; }
}
private string _custom_profession = "";
[global::ProtoBuf.ProtoMember(23, IsRequired = false, Name=@"custom_profession", DataFormat = global::ProtoBuf.DataFormat.Default)]
[global::System.ComponentModel.DefaultValue("")]
public string custom_profession
{
get { return _custom_profession; }
set { _custom_profession = value; }
}
private readonly global::System.Collections.Generic.List<int> _labors = new global::System.Collections.Generic.List<int>();
[global::ProtoBuf.ProtoMember(11, Name=@"labors", DataFormat = global::ProtoBuf.DataFormat.TwosComplement)]
public global::System.Collections.Generic.List<int> labors
{
get { return _labors; }
}
private readonly global::System.Collections.Generic.List<dfproto.SkillInfo> _skills = new global::System.Collections.Generic.List<dfproto.SkillInfo>();
[global::ProtoBuf.ProtoMember(12, Name=@"skills", DataFormat = global::ProtoBuf.DataFormat.Default)]
public global::System.Collections.Generic.List<dfproto.SkillInfo> skills
{
get { return _skills; }
}
private readonly global::System.Collections.Generic.List<dfproto.UnitMiscTrait> _misc_traits = new global::System.Collections.Generic.List<dfproto.UnitMiscTrait>();
[global::ProtoBuf.ProtoMember(24, Name=@"misc_traits", DataFormat = global::ProtoBuf.DataFormat.Default)]
public global::System.Collections.Generic.List<dfproto.UnitMiscTrait> misc_traits
{
get { return _misc_traits; }
}
private dfproto.UnitCurseInfo _curse = null;
[global::ProtoBuf.ProtoMember(16, IsRequired = false, Name=@"curse", DataFormat = global::ProtoBuf.DataFormat.Default)]
[global::System.ComponentModel.DefaultValue(null)]
public dfproto.UnitCurseInfo curse
{
get { return _curse; }
set { _curse = value; }
}
private readonly global::System.Collections.Generic.List<int> _burrows = new global::System.Collections.Generic.List<int>();
[global::ProtoBuf.ProtoMember(21, Name=@"burrows", DataFormat = global::ProtoBuf.DataFormat.TwosComplement)]
public global::System.Collections.Generic.List<int> burrows
{
get { return _burrows; }
}
private global::ProtoBuf.IExtension extensionObject;
global::ProtoBuf.IExtension global::ProtoBuf.IExtensible.GetExtensionObject(bool createIfMissing)
{ return global::ProtoBuf.Extensible.GetExtensionObject(ref extensionObject, createIfMissing); }
}
[global::System.Serializable, global::ProtoBuf.ProtoContract(Name=@"BasicUnitInfoMask")]
public partial class BasicUnitInfoMask : global::ProtoBuf.IExtensible
{
public BasicUnitInfoMask() {}
private bool _labors = (bool)false;
[global::ProtoBuf.ProtoMember(1, IsRequired = false, Name=@"labors", DataFormat = global::ProtoBuf.DataFormat.Default)]
[global::System.ComponentModel.DefaultValue((bool)false)]
public bool labors
{
get { return _labors; }
set { _labors = value; }
}
private bool _skills = (bool)false;
[global::ProtoBuf.ProtoMember(2, IsRequired = false, Name=@"skills", DataFormat = global::ProtoBuf.DataFormat.Default)]
[global::System.ComponentModel.DefaultValue((bool)false)]
public bool skills
{
get { return _skills; }
set { _skills = value; }
}
private bool _profession = (bool)false;
[global::ProtoBuf.ProtoMember(3, IsRequired = false, Name=@"profession", DataFormat = global::ProtoBuf.DataFormat.Default)]
[global::System.ComponentModel.DefaultValue((bool)false)]
public bool profession
{
get { return _profession; }
set { _profession = value; }
}
private bool _misc_traits = (bool)false;
[global::ProtoBuf.ProtoMember(4, IsRequired = false, Name=@"misc_traits", DataFormat = global::ProtoBuf.DataFormat.Default)]
[global::System.ComponentModel.DefaultValue((bool)false)]
public bool misc_traits
{
get { return _misc_traits; }
set { _misc_traits = value; }
}
private global::ProtoBuf.IExtension extensionObject;
global::ProtoBuf.IExtension global::ProtoBuf.IExtensible.GetExtensionObject(bool createIfMissing)
{ return global::ProtoBuf.Extensible.GetExtensionObject(ref extensionObject, createIfMissing); }
}
[global::System.Serializable, global::ProtoBuf.ProtoContract(Name=@"BasicSquadInfo")]
public partial class BasicSquadInfo : global::ProtoBuf.IExtensible
{
public BasicSquadInfo() {}
private int _squad_id;
[global::ProtoBuf.ProtoMember(1, IsRequired = true, Name=@"squad_id", DataFormat = global::ProtoBuf.DataFormat.TwosComplement)]
public int squad_id
{
get { return _squad_id; }
set { _squad_id = value; }
}
private dfproto.NameInfo _name = null;
[global::ProtoBuf.ProtoMember(2, IsRequired = false, Name=@"name", DataFormat = global::ProtoBuf.DataFormat.Default)]
[global::System.ComponentModel.DefaultValue(null)]
public dfproto.NameInfo name
{
get { return _name; }
set { _name = value; }
}
private string _alias = "";
[global::ProtoBuf.ProtoMember(3, IsRequired = false, Name=@"alias", DataFormat = global::ProtoBuf.DataFormat.Default)]
[global::System.ComponentModel.DefaultValue("")]
public string alias
{
get { return _alias; }
set { _alias = value; }
}
private readonly global::System.Collections.Generic.List<int> _members = new global::System.Collections.Generic.List<int>();
[global::ProtoBuf.ProtoMember(4, Name=@"members", DataFormat = global::ProtoBuf.DataFormat.ZigZag)]
public global::System.Collections.Generic.List<int> members
{
get { return _members; }
}
private global::ProtoBuf.IExtension extensionObject;
global::ProtoBuf.IExtension global::ProtoBuf.IExtensible.GetExtensionObject(bool createIfMissing)
{ return global::ProtoBuf.Extensible.GetExtensionObject(ref extensionObject, createIfMissing); }
}
[global::System.Serializable, global::ProtoBuf.ProtoContract(Name=@"UnitLaborState")]
public partial class UnitLaborState : global::ProtoBuf.IExtensible
{
public UnitLaborState() {}
private int _unit_id;
[global::ProtoBuf.ProtoMember(1, IsRequired = true, Name=@"unit_id", DataFormat = global::ProtoBuf.DataFormat.TwosComplement)]
public int unit_id
{
get { return _unit_id; }
set { _unit_id = value; }
}
private int _labor;
[global::ProtoBuf.ProtoMember(2, IsRequired = true, Name=@"labor", DataFormat = global::ProtoBuf.DataFormat.TwosComplement)]
public int labor
{
get { return _labor; }
set { _labor = value; }
}
private bool _value;
[global::ProtoBuf.ProtoMember(3, IsRequired = true, Name=@"value", DataFormat = global::ProtoBuf.DataFormat.Default)]
public bool value
{
get { return _value; }
set { _value = value; }
}
private global::ProtoBuf.IExtension extensionObject;
global::ProtoBuf.IExtension global::ProtoBuf.IExtensible.GetExtensionObject(bool createIfMissing)
{ return global::ProtoBuf.Extensible.GetExtensionObject(ref extensionObject, createIfMissing); }
}
}

@ -0,0 +1,460 @@
//------------------------------------------------------------------------------
// <auto-generated>
// This code was generated by a tool.
//
// Changes to this file may cause incorrect behavior and will be lost if
// the code is regenerated.
// </auto-generated>
//------------------------------------------------------------------------------
// Generated from: BasicApi.proto
// Note: requires additional types generated from: Basic.proto
namespace dfproto
{
[global::System.Serializable, global::ProtoBuf.ProtoContract(Name=@"GetWorldInfoOut")]
public partial class GetWorldInfoOut : global::ProtoBuf.IExtensible
{
public GetWorldInfoOut() {}
private dfproto.GetWorldInfoOut.Mode _mode;
[global::ProtoBuf.ProtoMember(1, IsRequired = true, Name=@"mode", DataFormat = global::ProtoBuf.DataFormat.TwosComplement)]
public dfproto.GetWorldInfoOut.Mode mode
{
get { return _mode; }
set { _mode = value; }
}
private string _save_dir;
[global::ProtoBuf.ProtoMember(2, IsRequired = true, Name=@"save_dir", DataFormat = global::ProtoBuf.DataFormat.Default)]
public string save_dir
{
get { return _save_dir; }
set { _save_dir = value; }
}
private dfproto.NameInfo _world_name = null;
[global::ProtoBuf.ProtoMember(3, IsRequired = false, Name=@"world_name", DataFormat = global::ProtoBuf.DataFormat.Default)]
[global::System.ComponentModel.DefaultValue(null)]
public dfproto.NameInfo world_name
{
get { return _world_name; }
set { _world_name = value; }
}
private int _civ_id = default(int);
[global::ProtoBuf.ProtoMember(4, IsRequired = false, Name=@"civ_id", DataFormat = global::ProtoBuf.DataFormat.TwosComplement)]
[global::System.ComponentModel.DefaultValue(default(int))]
public int civ_id
{
get { return _civ_id; }
set { _civ_id = value; }
}
private int _site_id = default(int);
[global::ProtoBuf.ProtoMember(5, IsRequired = false, Name=@"site_id", DataFormat = global::ProtoBuf.DataFormat.TwosComplement)]
[global::System.ComponentModel.DefaultValue(default(int))]
public int site_id
{
get { return _site_id; }
set { _site_id = value; }
}
private int _group_id = default(int);
[global::ProtoBuf.ProtoMember(6, IsRequired = false, Name=@"group_id", DataFormat = global::ProtoBuf.DataFormat.TwosComplement)]
[global::System.ComponentModel.DefaultValue(default(int))]
public int group_id
{
get { return _group_id; }
set { _group_id = value; }
}
private int _race_id = default(int);
[global::ProtoBuf.ProtoMember(7, IsRequired = false, Name=@"race_id", DataFormat = global::ProtoBuf.DataFormat.TwosComplement)]
[global::System.ComponentModel.DefaultValue(default(int))]
public int race_id
{
get { return _race_id; }
set { _race_id = value; }
}
private int _player_unit_id = default(int);
[global::ProtoBuf.ProtoMember(8, IsRequired = false, Name=@"player_unit_id", DataFormat = global::ProtoBuf.DataFormat.TwosComplement)]
[global::System.ComponentModel.DefaultValue(default(int))]
public int player_unit_id
{
get { return _player_unit_id; }
set { _player_unit_id = value; }
}
private int _player_histfig_id = default(int);
[global::ProtoBuf.ProtoMember(9, IsRequired = false, Name=@"player_histfig_id", DataFormat = global::ProtoBuf.DataFormat.TwosComplement)]
[global::System.ComponentModel.DefaultValue(default(int))]
public int player_histfig_id
{
get { return _player_histfig_id; }
set { _player_histfig_id = value; }
}
private readonly global::System.Collections.Generic.List<int> _companion_histfig_ids = new global::System.Collections.Generic.List<int>();
[global::ProtoBuf.ProtoMember(10, Name=@"companion_histfig_ids", DataFormat = global::ProtoBuf.DataFormat.TwosComplement)]
public global::System.Collections.Generic.List<int> companion_histfig_ids
{
get { return _companion_histfig_ids; }
}
[global::ProtoBuf.ProtoContract(Name=@"Mode")]
public enum Mode
{
[global::ProtoBuf.ProtoEnum(Name=@"MODE_DWARF", Value=1)]
MODE_DWARF = 1,
[global::ProtoBuf.ProtoEnum(Name=@"MODE_ADVENTURE", Value=2)]
MODE_ADVENTURE = 2,
[global::ProtoBuf.ProtoEnum(Name=@"MODE_LEGENDS", Value=3)]
MODE_LEGENDS = 3
}
private global::ProtoBuf.IExtension extensionObject;
global::ProtoBuf.IExtension global::ProtoBuf.IExtensible.GetExtensionObject(bool createIfMissing)
{ return global::ProtoBuf.Extensible.GetExtensionObject(ref extensionObject, createIfMissing); }
}
[global::System.Serializable, global::ProtoBuf.ProtoContract(Name=@"ListEnumsOut")]
public partial class ListEnumsOut : global::ProtoBuf.IExtensible
{
public ListEnumsOut() {}
private readonly global::System.Collections.Generic.List<dfproto.EnumItemName> _material_flags = new global::System.Collections.Generic.List<dfproto.EnumItemName>();
[global::ProtoBuf.ProtoMember(1, Name=@"material_flags", DataFormat = global::ProtoBuf.DataFormat.Default)]
public global::System.Collections.Generic.List<dfproto.EnumItemName> material_flags
{
get { return _material_flags; }
}
private readonly global::System.Collections.Generic.List<dfproto.EnumItemName> _inorganic_flags = new global::System.Collections.Generic.List<dfproto.EnumItemName>();
[global::ProtoBuf.ProtoMember(2, Name=@"inorganic_flags", DataFormat = global::ProtoBuf.DataFormat.Default)]
public global::System.Collections.Generic.List<dfproto.EnumItemName> inorganic_flags
{
get { return _inorganic_flags; }
}
private readonly global::System.Collections.Generic.List<dfproto.EnumItemName> _unit_flags1 = new global::System.Collections.Generic.List<dfproto.EnumItemName>();
[global::ProtoBuf.ProtoMember(3, Name=@"unit_flags1", DataFormat = global::ProtoBuf.DataFormat.Default)]
public global::System.Collections.Generic.List<dfproto.EnumItemName> unit_flags1
{
get { return _unit_flags1; }
}
private readonly global::System.Collections.Generic.List<dfproto.EnumItemName> _unit_flags2 = new global::System.Collections.Generic.List<dfproto.EnumItemName>();
[global::ProtoBuf.ProtoMember(4, Name=@"unit_flags2", DataFormat = global::ProtoBuf.DataFormat.Default)]
public global::System.Collections.Generic.List<dfproto.EnumItemName> unit_flags2
{
get { return _unit_flags2; }
}
private readonly global::System.Collections.Generic.List<dfproto.EnumItemName> _unit_flags3 = new global::System.Collections.Generic.List<dfproto.EnumItemName>();
[global::ProtoBuf.ProtoMember(5, Name=@"unit_flags3", DataFormat = global::ProtoBuf.DataFormat.Default)]
public global::System.Collections.Generic.List<dfproto.EnumItemName> unit_flags3
{
get { return _unit_flags3; }
}
private readonly global::System.Collections.Generic.List<dfproto.EnumItemName> _unit_labor = new global::System.Collections.Generic.List<dfproto.EnumItemName>();
[global::ProtoBuf.ProtoMember(6, Name=@"unit_labor", DataFormat = global::ProtoBuf.DataFormat.Default)]
public global::System.Collections.Generic.List<dfproto.EnumItemName> unit_labor
{
get { return _unit_labor; }
}
private readonly global::System.Collections.Generic.List<dfproto.EnumItemName> _job_skill = new global::System.Collections.Generic.List<dfproto.EnumItemName>();
[global::ProtoBuf.ProtoMember(7, Name=@"job_skill", DataFormat = global::ProtoBuf.DataFormat.Default)]
public global::System.Collections.Generic.List<dfproto.EnumItemName> job_skill
{
get { return _job_skill; }
}
private readonly global::System.Collections.Generic.List<dfproto.EnumItemName> _cie_add_tag_mask1 = new global::System.Collections.Generic.List<dfproto.EnumItemName>();
[global::ProtoBuf.ProtoMember(8, Name=@"cie_add_tag_mask1", DataFormat = global::ProtoBuf.DataFormat.Default)]
public global::System.Collections.Generic.List<dfproto.EnumItemName> cie_add_tag_mask1
{
get { return _cie_add_tag_mask1; }
}
private readonly global::System.Collections.Generic.List<dfproto.EnumItemName> _cie_add_tag_mask2 = new global::System.Collections.Generic.List<dfproto.EnumItemName>();
[global::ProtoBuf.ProtoMember(9, Name=@"cie_add_tag_mask2", DataFormat = global::ProtoBuf.DataFormat.Default)]
public global::System.Collections.Generic.List<dfproto.EnumItemName> cie_add_tag_mask2
{
get { return _cie_add_tag_mask2; }
}
private readonly global::System.Collections.Generic.List<dfproto.EnumItemName> _death_info_flags = new global::System.Collections.Generic.List<dfproto.EnumItemName>();
[global::ProtoBuf.ProtoMember(10, Name=@"death_info_flags", DataFormat = global::ProtoBuf.DataFormat.Default)]
public global::System.Collections.Generic.List<dfproto.EnumItemName> death_info_flags
{
get { return _death_info_flags; }
}
private readonly global::System.Collections.Generic.List<dfproto.EnumItemName> _profession = new global::System.Collections.Generic.List<dfproto.EnumItemName>();
[global::ProtoBuf.ProtoMember(11, Name=@"profession", DataFormat = global::ProtoBuf.DataFormat.Default)]
public global::System.Collections.Generic.List<dfproto.EnumItemName> profession
{
get { return _profession; }
}
private global::ProtoBuf.IExtension extensionObject;
global::ProtoBuf.IExtension global::ProtoBuf.IExtensible.GetExtensionObject(bool createIfMissing)
{ return global::ProtoBuf.Extensible.GetExtensionObject(ref extensionObject, createIfMissing); }
}
[global::System.Serializable, global::ProtoBuf.ProtoContract(Name=@"ListJobSkillsOut")]
public partial class ListJobSkillsOut : global::ProtoBuf.IExtensible
{
public ListJobSkillsOut() {}
private readonly global::System.Collections.Generic.List<dfproto.JobSkillAttr> _skill = new global::System.Collections.Generic.List<dfproto.JobSkillAttr>();
[global::ProtoBuf.ProtoMember(1, Name=@"skill", DataFormat = global::ProtoBuf.DataFormat.Default)]
public global::System.Collections.Generic.List<dfproto.JobSkillAttr> skill
{
get { return _skill; }
}
private readonly global::System.Collections.Generic.List<dfproto.ProfessionAttr> _profession = new global::System.Collections.Generic.List<dfproto.ProfessionAttr>();
[global::ProtoBuf.ProtoMember(2, Name=@"profession", DataFormat = global::ProtoBuf.DataFormat.Default)]
public global::System.Collections.Generic.List<dfproto.ProfessionAttr> profession
{
get { return _profession; }
}
private readonly global::System.Collections.Generic.List<dfproto.UnitLaborAttr> _labor = new global::System.Collections.Generic.List<dfproto.UnitLaborAttr>();
[global::ProtoBuf.ProtoMember(3, Name=@"labor", DataFormat = global::ProtoBuf.DataFormat.Default)]
public global::System.Collections.Generic.List<dfproto.UnitLaborAttr> labor
{
get { return _labor; }
}
private global::ProtoBuf.IExtension extensionObject;
global::ProtoBuf.IExtension global::ProtoBuf.IExtensible.GetExtensionObject(bool createIfMissing)
{ return global::ProtoBuf.Extensible.GetExtensionObject(ref extensionObject, createIfMissing); }
}
[global::System.Serializable, global::ProtoBuf.ProtoContract(Name=@"ListMaterialsIn")]
public partial class ListMaterialsIn : global::ProtoBuf.IExtensible
{
public ListMaterialsIn() {}
private dfproto.BasicMaterialInfoMask _mask = null;
[global::ProtoBuf.ProtoMember(1, IsRequired = false, Name=@"mask", DataFormat = global::ProtoBuf.DataFormat.Default)]
[global::System.ComponentModel.DefaultValue(null)]
public dfproto.BasicMaterialInfoMask mask
{
get { return _mask; }
set { _mask = value; }
}
private readonly global::System.Collections.Generic.List<dfproto.BasicMaterialId> _id_list = new global::System.Collections.Generic.List<dfproto.BasicMaterialId>();
[global::ProtoBuf.ProtoMember(2, Name=@"id_list", DataFormat = global::ProtoBuf.DataFormat.Default)]
public global::System.Collections.Generic.List<dfproto.BasicMaterialId> id_list
{
get { return _id_list; }
}
private bool _builtin = default(bool);
[global::ProtoBuf.ProtoMember(3, IsRequired = false, Name=@"builtin", DataFormat = global::ProtoBuf.DataFormat.Default)]
[global::System.ComponentModel.DefaultValue(default(bool))]
public bool builtin
{
get { return _builtin; }
set { _builtin = value; }
}
private bool _inorganic = default(bool);
[global::ProtoBuf.ProtoMember(4, IsRequired = false, Name=@"inorganic", DataFormat = global::ProtoBuf.DataFormat.Default)]
[global::System.ComponentModel.DefaultValue(default(bool))]
public bool inorganic
{
get { return _inorganic; }
set { _inorganic = value; }
}
private bool _creatures = default(bool);
[global::ProtoBuf.ProtoMember(5, IsRequired = false, Name=@"creatures", DataFormat = global::ProtoBuf.DataFormat.Default)]
[global::System.ComponentModel.DefaultValue(default(bool))]
public bool creatures
{
get { return _creatures; }
set { _creatures = value; }
}
private bool _plants = default(bool);
[global::ProtoBuf.ProtoMember(6, IsRequired = false, Name=@"plants", DataFormat = global::ProtoBuf.DataFormat.Default)]
[global::System.ComponentModel.DefaultValue(default(bool))]
public bool plants
{
get { return _plants; }
set { _plants = value; }
}
private global::ProtoBuf.IExtension extensionObject;
global::ProtoBuf.IExtension global::ProtoBuf.IExtensible.GetExtensionObject(bool createIfMissing)
{ return global::ProtoBuf.Extensible.GetExtensionObject(ref extensionObject, createIfMissing); }
}
[global::System.Serializable, global::ProtoBuf.ProtoContract(Name=@"ListMaterialsOut")]
public partial class ListMaterialsOut : global::ProtoBuf.IExtensible
{
public ListMaterialsOut() {}
private readonly global::System.Collections.Generic.List<dfproto.BasicMaterialInfo> _value = new global::System.Collections.Generic.List<dfproto.BasicMaterialInfo>();
[global::ProtoBuf.ProtoMember(1, Name=@"value", DataFormat = global::ProtoBuf.DataFormat.Default)]
public global::System.Collections.Generic.List<dfproto.BasicMaterialInfo> value
{
get { return _value; }
}
private global::ProtoBuf.IExtension extensionObject;
global::ProtoBuf.IExtension global::ProtoBuf.IExtensible.GetExtensionObject(bool createIfMissing)
{ return global::ProtoBuf.Extensible.GetExtensionObject(ref extensionObject, createIfMissing); }
}
[global::System.Serializable, global::ProtoBuf.ProtoContract(Name=@"ListUnitsIn")]
public partial class ListUnitsIn : global::ProtoBuf.IExtensible
{
public ListUnitsIn() {}
private dfproto.BasicUnitInfoMask _mask = null;
[global::ProtoBuf.ProtoMember(1, IsRequired = false, Name=@"mask", DataFormat = global::ProtoBuf.DataFormat.Default)]
[global::System.ComponentModel.DefaultValue(null)]
public dfproto.BasicUnitInfoMask mask
{
get { return _mask; }
set { _mask = value; }
}
private readonly global::System.Collections.Generic.List<int> _id_list = new global::System.Collections.Generic.List<int>();
[global::ProtoBuf.ProtoMember(2, Name=@"id_list", DataFormat = global::ProtoBuf.DataFormat.TwosComplement)]
public global::System.Collections.Generic.List<int> id_list
{
get { return _id_list; }
}
private bool _scan_all = default(bool);
[global::ProtoBuf.ProtoMember(5, IsRequired = false, Name=@"scan_all", DataFormat = global::ProtoBuf.DataFormat.Default)]
[global::System.ComponentModel.DefaultValue(default(bool))]
public bool scan_all
{
get { return _scan_all; }
set { _scan_all = value; }
}
private int _race = default(int);
[global::ProtoBuf.ProtoMember(3, IsRequired = false, Name=@"race", DataFormat = global::ProtoBuf.DataFormat.TwosComplement)]
[global::System.ComponentModel.DefaultValue(default(int))]
public int race
{
get { return _race; }
set { _race = value; }
}
private int _civ_id = default(int);
[global::ProtoBuf.ProtoMember(4, IsRequired = false, Name=@"civ_id", DataFormat = global::ProtoBuf.DataFormat.TwosComplement)]
[global::System.ComponentModel.DefaultValue(default(int))]
public int civ_id
{
get { return _civ_id; }
set { _civ_id = value; }
}
private bool _dead = default(bool);
[global::ProtoBuf.ProtoMember(6, IsRequired = false, Name=@"dead", DataFormat = global::ProtoBuf.DataFormat.Default)]
[global::System.ComponentModel.DefaultValue(default(bool))]
public bool dead
{
get { return _dead; }
set { _dead = value; }
}
private bool _alive = default(bool);
[global::ProtoBuf.ProtoMember(7, IsRequired = false, Name=@"alive", DataFormat = global::ProtoBuf.DataFormat.Default)]
[global::System.ComponentModel.DefaultValue(default(bool))]
public bool alive
{
get { return _alive; }
set { _alive = value; }
}
private bool _sane = default(bool);
[global::ProtoBuf.ProtoMember(8, IsRequired = false, Name=@"sane", DataFormat = global::ProtoBuf.DataFormat.Default)]
[global::System.ComponentModel.DefaultValue(default(bool))]
public bool sane
{
get { return _sane; }
set { _sane = value; }
}
private global::ProtoBuf.IExtension extensionObject;
global::ProtoBuf.IExtension global::ProtoBuf.IExtensible.GetExtensionObject(bool createIfMissing)
{ return global::ProtoBuf.Extensible.GetExtensionObject(ref extensionObject, createIfMissing); }
}
[global::System.Serializable, global::ProtoBuf.ProtoContract(Name=@"ListUnitsOut")]
public partial class ListUnitsOut : global::ProtoBuf.IExtensible
{
public ListUnitsOut() {}
private readonly global::System.Collections.Generic.List<dfproto.BasicUnitInfo> _value = new global::System.Collections.Generic.List<dfproto.BasicUnitInfo>();
[global::ProtoBuf.ProtoMember(1, Name=@"value", DataFormat = global::ProtoBuf.DataFormat.Default)]
public global::System.Collections.Generic.List<dfproto.BasicUnitInfo> value
{
get { return _value; }
}
private global::ProtoBuf.IExtension extensionObject;
global::ProtoBuf.IExtension global::ProtoBuf.IExtensible.GetExtensionObject(bool createIfMissing)
{ return global::ProtoBuf.Extensible.GetExtensionObject(ref extensionObject, createIfMissing); }
}
[global::System.Serializable, global::ProtoBuf.ProtoContract(Name=@"ListSquadsIn")]
public partial class ListSquadsIn : global::ProtoBuf.IExtensible
{
public ListSquadsIn() {}
private global::ProtoBuf.IExtension extensionObject;
global::ProtoBuf.IExtension global::ProtoBuf.IExtensible.GetExtensionObject(bool createIfMissing)
{ return global::ProtoBuf.Extensible.GetExtensionObject(ref extensionObject, createIfMissing); }
}
[global::System.Serializable, global::ProtoBuf.ProtoContract(Name=@"ListSquadsOut")]
public partial class ListSquadsOut : global::ProtoBuf.IExtensible
{
public ListSquadsOut() {}
private readonly global::System.Collections.Generic.List<dfproto.BasicSquadInfo> _value = new global::System.Collections.Generic.List<dfproto.BasicSquadInfo>();
[global::ProtoBuf.ProtoMember(1, Name=@"value", DataFormat = global::ProtoBuf.DataFormat.Default)]
public global::System.Collections.Generic.List<dfproto.BasicSquadInfo> value
{
get { return _value; }
}
private global::ProtoBuf.IExtension extensionObject;
global::ProtoBuf.IExtension global::ProtoBuf.IExtensible.GetExtensionObject(bool createIfMissing)
{ return global::ProtoBuf.Extensible.GetExtensionObject(ref extensionObject, createIfMissing); }
}
[global::System.Serializable, global::ProtoBuf.ProtoContract(Name=@"SetUnitLaborsIn")]
public partial class SetUnitLaborsIn : global::ProtoBuf.IExtensible
{
public SetUnitLaborsIn() {}
private readonly global::System.Collections.Generic.List<dfproto.UnitLaborState> _change = new global::System.Collections.Generic.List<dfproto.UnitLaborState>();
[global::ProtoBuf.ProtoMember(1, Name=@"change", DataFormat = global::ProtoBuf.DataFormat.Default)]
public global::System.Collections.Generic.List<dfproto.UnitLaborState> change
{
get { return _change; }
}
private global::ProtoBuf.IExtension extensionObject;
global::ProtoBuf.IExtension global::ProtoBuf.IExtensible.GetExtensionObject(bool createIfMissing)
{ return global::ProtoBuf.Extensible.GetExtensionObject(ref extensionObject, createIfMissing); }
}
}

@ -0,0 +1,119 @@
using System;
using UnityEngine;
using AT.MIN;
using dfproto;
namespace DFHack
{
public enum color_value
{
COLOR_RESET = -1,
COLOR_BLACK = 0,
COLOR_BLUE,
COLOR_GREEN,
COLOR_CYAN,
COLOR_RED,
COLOR_MAGENTA,
COLOR_BROWN,
COLOR_GREY,
COLOR_DARKGREY,
COLOR_LIGHTBLUE,
COLOR_LIGHTGREEN,
COLOR_LIGHTCYAN,
COLOR_LIGHTRED,
COLOR_LIGHTMAGENTA,
COLOR_YELLOW,
COLOR_WHITE,
COLOR_MAX = COLOR_WHITE
};
public class color_ostream
{
string buffer;
public void printerr(string Format, params object[] Parameters)
{
Debug.LogError(Tools.sprintf(Format, Parameters));
}
public void print(string Format, params object[] Parameters)
{
Debug.Log(Tools.sprintf(Format, Parameters));
}
public void begin_batch()
{
buffer = "";
}
public void end_batch()
{
Debug.Log(buffer);
buffer = null;
}
public void add_text(color_value color, string text)
{
//Debug.Log(text);
buffer += text;
}
}
public class buffered_color_ostream : color_ostream
{
//protected:
public new void add_text(color_value color, string text)
{
if (text.Length == 0)
return;
if (buffer.Length == 0)
{
buffer = text;
}
else
{
buffer += text;
}
}
// buffered_color_ostream() {}
// ~buffered_color_ostream() {}
// const std::list<fragment_type> &fragments() { return buffer; }
protected string buffer;
}
public class color_ostream_proxy : buffered_color_ostream
{
protected color_ostream target;
//virtual void flush_proxy();
public color_ostream_proxy(color_ostream targetIn)
{
target = targetIn;
}
public virtual color_ostream proxy_target() { return target; }
public void decode(dfproto.CoreTextNotification data)
{
int cnt = data.fragments.Count;
if (cnt > 0)
{
target.begin_batch();
for (int i = 0; i < cnt; i++)
{
var frag = data.fragments[i];
//color_value color = frag.has_color() ? color_value(frag.color()) : COLOR_RESET;
target.add_text(color_value.COLOR_RESET, frag.text);
//target.printerr(data.fragments[i].text);
}
target.end_batch();
}
}
}
}

@ -0,0 +1,311 @@
//------------------------------------------------------------------------------
// <auto-generated>
// This code was generated by a tool.
//
// Changes to this file may cause incorrect behavior and will be lost if
// the code is regenerated.
// </auto-generated>
//------------------------------------------------------------------------------
// Generated from: CoreProtocol.proto
namespace dfproto
{
[global::System.Serializable, global::ProtoBuf.ProtoContract(Name=@"CoreTextFragment")]
public partial class CoreTextFragment : global::ProtoBuf.IExtensible
{
public CoreTextFragment() {}
private string _text;
[global::ProtoBuf.ProtoMember(1, IsRequired = true, Name=@"text", DataFormat = global::ProtoBuf.DataFormat.Default)]
public string text
{
get { return _text; }
set { _text = value; }
}
private dfproto.CoreTextFragment.Color _color = dfproto.CoreTextFragment.Color.COLOR_BLACK;
[global::ProtoBuf.ProtoMember(2, IsRequired = false, Name=@"color", DataFormat = global::ProtoBuf.DataFormat.TwosComplement)]
[global::System.ComponentModel.DefaultValue(dfproto.CoreTextFragment.Color.COLOR_BLACK)]
public dfproto.CoreTextFragment.Color color
{
get { return _color; }
set { _color = value; }
}
[global::ProtoBuf.ProtoContract(Name=@"Color")]
public enum Color
{
[global::ProtoBuf.ProtoEnum(Name=@"COLOR_BLACK", Value=0)]
COLOR_BLACK = 0,
[global::ProtoBuf.ProtoEnum(Name=@"COLOR_BLUE", Value=1)]
COLOR_BLUE = 1,
[global::ProtoBuf.ProtoEnum(Name=@"COLOR_GREEN", Value=2)]
COLOR_GREEN = 2,
[global::ProtoBuf.ProtoEnum(Name=@"COLOR_CYAN", Value=3)]
COLOR_CYAN = 3,
[global::ProtoBuf.ProtoEnum(Name=@"COLOR_RED", Value=4)]
COLOR_RED = 4,
[global::ProtoBuf.ProtoEnum(Name=@"COLOR_MAGENTA", Value=5)]
COLOR_MAGENTA = 5,
[global::ProtoBuf.ProtoEnum(Name=@"COLOR_BROWN", Value=6)]
COLOR_BROWN = 6,
[global::ProtoBuf.ProtoEnum(Name=@"COLOR_GREY", Value=7)]
COLOR_GREY = 7,
[global::ProtoBuf.ProtoEnum(Name=@"COLOR_DARKGREY", Value=8)]
COLOR_DARKGREY = 8,
[global::ProtoBuf.ProtoEnum(Name=@"COLOR_LIGHTBLUE", Value=9)]
COLOR_LIGHTBLUE = 9,
[global::ProtoBuf.ProtoEnum(Name=@"COLOR_LIGHTGREEN", Value=10)]
COLOR_LIGHTGREEN = 10,
[global::ProtoBuf.ProtoEnum(Name=@"COLOR_LIGHTCYAN", Value=11)]
COLOR_LIGHTCYAN = 11,
[global::ProtoBuf.ProtoEnum(Name=@"COLOR_LIGHTRED", Value=12)]
COLOR_LIGHTRED = 12,
[global::ProtoBuf.ProtoEnum(Name=@"COLOR_LIGHTMAGENTA", Value=13)]
COLOR_LIGHTMAGENTA = 13,
[global::ProtoBuf.ProtoEnum(Name=@"COLOR_YELLOW", Value=14)]
COLOR_YELLOW = 14,
[global::ProtoBuf.ProtoEnum(Name=@"COLOR_WHITE", Value=15)]
COLOR_WHITE = 15
}
private global::ProtoBuf.IExtension extensionObject;
global::ProtoBuf.IExtension global::ProtoBuf.IExtensible.GetExtensionObject(bool createIfMissing)
{ return global::ProtoBuf.Extensible.GetExtensionObject(ref extensionObject, createIfMissing); }
}
[global::System.Serializable, global::ProtoBuf.ProtoContract(Name=@"CoreTextNotification")]
public partial class CoreTextNotification : global::ProtoBuf.IExtensible
{
public CoreTextNotification() {}
private readonly global::System.Collections.Generic.List<dfproto.CoreTextFragment> _fragments = new global::System.Collections.Generic.List<dfproto.CoreTextFragment>();
[global::ProtoBuf.ProtoMember(1, Name=@"fragments", DataFormat = global::ProtoBuf.DataFormat.Default)]
public global::System.Collections.Generic.List<dfproto.CoreTextFragment> fragments
{
get { return _fragments; }
}
private global::ProtoBuf.IExtension extensionObject;
global::ProtoBuf.IExtension global::ProtoBuf.IExtensible.GetExtensionObject(bool createIfMissing)
{ return global::ProtoBuf.Extensible.GetExtensionObject(ref extensionObject, createIfMissing); }
}
[global::System.Serializable, global::ProtoBuf.ProtoContract(Name=@"CoreErrorNotification")]
public partial class CoreErrorNotification : global::ProtoBuf.IExtensible
{
public CoreErrorNotification() {}
private dfproto.CoreErrorNotification.ErrorCode _code;
[global::ProtoBuf.ProtoMember(1, IsRequired = true, Name=@"code", DataFormat = global::ProtoBuf.DataFormat.TwosComplement)]
public dfproto.CoreErrorNotification.ErrorCode code
{
get { return _code; }
set { _code = value; }
}
[global::ProtoBuf.ProtoContract(Name=@"ErrorCode")]
public enum ErrorCode
{
[global::ProtoBuf.ProtoEnum(Name=@"CR_LINK_FAILURE", Value=-3)]
CR_LINK_FAILURE = -3,
[global::ProtoBuf.ProtoEnum(Name=@"CR_WOULD_BREAK", Value=-2)]
CR_WOULD_BREAK = -2,
[global::ProtoBuf.ProtoEnum(Name=@"CR_NOT_IMPLEMENTED", Value=-1)]
CR_NOT_IMPLEMENTED = -1,
[global::ProtoBuf.ProtoEnum(Name=@"CR_OK", Value=0)]
CR_OK = 0,
[global::ProtoBuf.ProtoEnum(Name=@"CR_FAILURE", Value=1)]
CR_FAILURE = 1,
[global::ProtoBuf.ProtoEnum(Name=@"CR_WRONG_USAGE", Value=2)]
CR_WRONG_USAGE = 2,
[global::ProtoBuf.ProtoEnum(Name=@"CR_NOT_FOUND", Value=3)]
CR_NOT_FOUND = 3
}
private global::ProtoBuf.IExtension extensionObject;
global::ProtoBuf.IExtension global::ProtoBuf.IExtensible.GetExtensionObject(bool createIfMissing)
{ return global::ProtoBuf.Extensible.GetExtensionObject(ref extensionObject, createIfMissing); }
}
[global::System.Serializable, global::ProtoBuf.ProtoContract(Name=@"EmptyMessage")]
public partial class EmptyMessage : global::ProtoBuf.IExtensible
{
public EmptyMessage() {}
private global::ProtoBuf.IExtension extensionObject;
global::ProtoBuf.IExtension global::ProtoBuf.IExtensible.GetExtensionObject(bool createIfMissing)
{ return global::ProtoBuf.Extensible.GetExtensionObject(ref extensionObject, createIfMissing); }
}
[global::System.Serializable, global::ProtoBuf.ProtoContract(Name=@"IntMessage")]
public partial class IntMessage : global::ProtoBuf.IExtensible
{
public IntMessage() {}
private int _value;
[global::ProtoBuf.ProtoMember(1, IsRequired = true, Name=@"value", DataFormat = global::ProtoBuf.DataFormat.TwosComplement)]
public int value
{
get { return _value; }
set { _value = value; }
}
private global::ProtoBuf.IExtension extensionObject;
global::ProtoBuf.IExtension global::ProtoBuf.IExtensible.GetExtensionObject(bool createIfMissing)
{ return global::ProtoBuf.Extensible.GetExtensionObject(ref extensionObject, createIfMissing); }
}
[global::System.Serializable, global::ProtoBuf.ProtoContract(Name=@"IntListMessage")]
public partial class IntListMessage : global::ProtoBuf.IExtensible
{
public IntListMessage() {}
private readonly global::System.Collections.Generic.List<int> _value = new global::System.Collections.Generic.List<int>();
[global::ProtoBuf.ProtoMember(1, Name=@"value", DataFormat = global::ProtoBuf.DataFormat.TwosComplement)]
public global::System.Collections.Generic.List<int> value
{
get { return _value; }
}
private global::ProtoBuf.IExtension extensionObject;
global::ProtoBuf.IExtension global::ProtoBuf.IExtensible.GetExtensionObject(bool createIfMissing)
{ return global::ProtoBuf.Extensible.GetExtensionObject(ref extensionObject, createIfMissing); }
}
[global::System.Serializable, global::ProtoBuf.ProtoContract(Name=@"StringMessage")]
public partial class StringMessage : global::ProtoBuf.IExtensible
{
public StringMessage() {}
private string _value;
[global::ProtoBuf.ProtoMember(1, IsRequired = true, Name=@"value", DataFormat = global::ProtoBuf.DataFormat.Default)]
public string value
{
get { return _value; }
set { _value = value; }
}
private global::ProtoBuf.IExtension extensionObject;
global::ProtoBuf.IExtension global::ProtoBuf.IExtensible.GetExtensionObject(bool createIfMissing)
{ return global::ProtoBuf.Extensible.GetExtensionObject(ref extensionObject, createIfMissing); }
}
[global::System.Serializable, global::ProtoBuf.ProtoContract(Name=@"StringListMessage")]
public partial class StringListMessage : global::ProtoBuf.IExtensible
{
public StringListMessage() {}
private readonly global::System.Collections.Generic.List<string> _value = new global::System.Collections.Generic.List<string>();
[global::ProtoBuf.ProtoMember(1, Name=@"value", DataFormat = global::ProtoBuf.DataFormat.Default)]
public global::System.Collections.Generic.List<string> value
{
get { return _value; }
}
private global::ProtoBuf.IExtension extensionObject;
global::ProtoBuf.IExtension global::ProtoBuf.IExtensible.GetExtensionObject(bool createIfMissing)
{ return global::ProtoBuf.Extensible.GetExtensionObject(ref extensionObject, createIfMissing); }
}
[global::System.Serializable, global::ProtoBuf.ProtoContract(Name=@"CoreBindRequest")]
public partial class CoreBindRequest : global::ProtoBuf.IExtensible
{
public CoreBindRequest() {}
private string _method;
[global::ProtoBuf.ProtoMember(1, IsRequired = true, Name=@"method", DataFormat = global::ProtoBuf.DataFormat.Default)]
public string method
{
get { return _method; }
set { _method = value; }
}
private string _input_msg;
[global::ProtoBuf.ProtoMember(2, IsRequired = true, Name=@"input_msg", DataFormat = global::ProtoBuf.DataFormat.Default)]
public string input_msg
{
get { return _input_msg; }
set { _input_msg = value; }
}
private string _output_msg;
[global::ProtoBuf.ProtoMember(3, IsRequired = true, Name=@"output_msg", DataFormat = global::ProtoBuf.DataFormat.Default)]
public string output_msg
{
get { return _output_msg; }
set { _output_msg = value; }
}
private string _plugin = "";
[global::ProtoBuf.ProtoMember(4, IsRequired = false, Name=@"plugin", DataFormat = global::ProtoBuf.DataFormat.Default)]
[global::System.ComponentModel.DefaultValue("")]
public string plugin
{
get { return _plugin; }
set { _plugin = value; }
}
private global::ProtoBuf.IExtension extensionObject;
global::ProtoBuf.IExtension global::ProtoBuf.IExtensible.GetExtensionObject(bool createIfMissing)
{ return global::ProtoBuf.Extensible.GetExtensionObject(ref extensionObject, createIfMissing); }
}
[global::System.Serializable, global::ProtoBuf.ProtoContract(Name=@"CoreBindReply")]
public partial class CoreBindReply : global::ProtoBuf.IExtensible
{
public CoreBindReply() {}
private int _assigned_id;
[global::ProtoBuf.ProtoMember(1, IsRequired = true, Name=@"assigned_id", DataFormat = global::ProtoBuf.DataFormat.TwosComplement)]
public int assigned_id
{
get { return _assigned_id; }
set { _assigned_id = value; }
}
private global::ProtoBuf.IExtension extensionObject;
global::ProtoBuf.IExtension global::ProtoBuf.IExtensible.GetExtensionObject(bool createIfMissing)
{ return global::ProtoBuf.Extensible.GetExtensionObject(ref extensionObject, createIfMissing); }
}
[global::System.Serializable, global::ProtoBuf.ProtoContract(Name=@"CoreRunCommandRequest")]
public partial class CoreRunCommandRequest : global::ProtoBuf.IExtensible
{
public CoreRunCommandRequest() {}
private string _command;
[global::ProtoBuf.ProtoMember(1, IsRequired = true, Name=@"command", DataFormat = global::ProtoBuf.DataFormat.Default)]
public string command
{
get { return _command; }
set { _command = value; }
}
private readonly global::System.Collections.Generic.List<string> _arguments = new global::System.Collections.Generic.List<string>();
[global::ProtoBuf.ProtoMember(2, Name=@"arguments", DataFormat = global::ProtoBuf.DataFormat.Default)]
public global::System.Collections.Generic.List<string> arguments
{
get { return _arguments; }
}
private global::ProtoBuf.IExtension extensionObject;
global::ProtoBuf.IExtension global::ProtoBuf.IExtensible.GetExtensionObject(bool createIfMissing)
{ return global::ProtoBuf.Extensible.GetExtensionObject(ref extensionObject, createIfMissing); }
}
}

@ -0,0 +1,720 @@
/*
https://github.com/peterix/dfhack
Copyright (c) 2009-2012 Petr Mrázek (peterix@gmail.com)
This software is provided 'as-is', without any express or implied
warranty. In no event will the authors be held liable for any
damages arising from the use of this software.
Permission is granted to anyone to use this software for any
purpose, including commercial applications, and to alter it and
redistribute it freely, subject to the following restrictions:
1. The origin of this software must not be misrepresented; you must
not claim that you wrote the original software. If you use this
software in a product, an acknowledgment in the product documentation
would be appreciated but is not required.
2. Altered source versions must be plainly marked as such, and
must not be misrepresented as being the original software.
3. This notice may not be removed or altered from any source
distribution.
*/
using dfproto;
using System;
using System.Net;
using System.Net.Sockets;
using System.IO;
using System.Text;
using System.Runtime.Serialization;
using System.Runtime.Serialization.Formatters.Binary;
using System.Collections.Generic;
using System.Diagnostics;
namespace DFHack
{
using message_type = ProtoBuf.IExtensible;
public enum command_result
{
CR_LINK_FAILURE = -3, // RPC call failed due to I/O or protocol error
CR_NEEDS_CONSOLE = -2, // Attempt to call interactive command without console
CR_NOT_IMPLEMENTED = -1, // Command not implemented, or plugin not loaded
CR_OK = 0, // Success
CR_FAILURE = 1, // Failure
CR_WRONG_USAGE = 2, // Wrong arguments or ui state
CR_NOT_FOUND = 3 // Target object not found (for RPC mainly)
}
public enum DFHackReplyCode
{
RPC_REPLY_RESULT = -1,
RPC_REPLY_FAIL = -2,
RPC_REPLY_TEXT = -3,
RPC_REQUEST_QUIT = -4
}
class RPCHandshakeHeader
{
public string magic;
public int version;
public static string REQUEST_MAGIC = "DFHack?\n";
public static string RESPONSE_MAGIC = "DFHack!\n";
}
struct RPCMessageHeader
{
public const int MAX_MESSAGE_SIZE = 8 * 1048576;
public Int16 id;
public Int32 size;
public byte[] ConvertToBtyes()
{
List<byte> output = new List<byte>();
output.AddRange(BitConverter.GetBytes(id));
output.AddRange(new byte[2]);
output.AddRange(BitConverter.GetBytes(size));
return output.ToArray();
}
string BytesToString(byte[] input)
{
string output = "";
foreach (byte item in input)
{
if (output.Length > 0)
output += ",";
output += item;
}
return output;
}
}
/* Protocol description:
*
* 1. Handshake
*
* Client initiates connection by sending the handshake
* request header. The server responds with the response
* magic. Currently both versions must be 1.
*
* 2. Interaction
*
* Requests are done by exchanging messages between the
* client and the server. Messages consist of a serialized
* protobuf message preceeded by RPCMessageHeader. The size
* field specifies the length of the protobuf part.
*
* NOTE: As a special exception, RPC_REPLY_FAIL uses the size
* field to hold the error code directly.
*
* Every callable function is assigned a non-negative id by
* the server. Id 0 is reserved for BindMethod, which can be
* used to request any other id by function name. Id 1 is
* RunCommand, used to call console commands remotely.
*
* The client initiates every call by sending a message with
* appropriate function id and input arguments. The server
* responds with zero or more RPC_REPLY_TEXT:CoreTextNotification
* messages, followed by RPC_REPLY_RESULT containing the output
* of the function if it succeeded, or RPC_REPLY_FAIL with the
* error code if it did not.
*
* 3. Disconnect
*
* The client terminates the connection by sending an
* RPC_REQUEST_QUIT header with zero size and immediately
* closing the socket.
*/
public class RPCFunctionBase
{
public message_type p_in_template;
public message_type p_out_template;
public message_type make_in()
{
return (message_type)Activator.CreateInstance(p_in_template.GetType());
}
public message_type input()
{
if (p_in == null) p_in = make_in();
return p_in;
}
public message_type make_out()
{
return (message_type)Activator.CreateInstance(p_out_template.GetType());
}
public message_type output()
{
if (p_out == null) p_out = make_out();
return p_out;
}
public void reset(bool free = false)
{
if (free)
{
p_in = null;
p_out = null;
}
else
{
if (p_in != null)
p_in = (message_type)Activator.CreateInstance(p_in.GetType());
if (p_out != null)
p_out = (message_type)Activator.CreateInstance(p_out.GetType());
}
}
public RPCFunctionBase(message_type input, message_type output)
{
p_in_template = input;
p_out_template = output;
p_in = null;
p_out = null;
}
~RPCFunctionBase()
{
p_in = null;
p_out = null;
}
message_type p_in;
message_type p_out;
}
public class RemoteFunctionBase : RPCFunctionBase
{
public bool bind(RemoteClient client, string name,
string proto = "")
{
return bind(client.default_output(), client, name, proto);
}
public bool bind(color_ostream output,
RemoteClient client, string name,
string proto = "")
{
if (isValid())
{
if (p_client == client && this.name == name && this.proto == proto)
return true;
output.printerr("Function already bound to %s::%s\n",
this.proto, this.name);
return false;
}
this.name = name;
this.proto = proto;
this.p_client = client;
return client.bind(output, this, name, proto);
}
public bool isValid() { return (id >= 0); }
public RemoteFunctionBase(message_type input, message_type output)
: base(input, output)
{
p_client = null;
id = -1;
}
protected color_ostream default_ostream()
{
return p_client.default_output();
}
bool sendRemoteMessage(Socket socket, Int16 id, MemoryStream msg)
{
List<byte> buffer = new List<byte>();
RPCMessageHeader header = new RPCMessageHeader();
header.id = id;
header.size = (Int32)msg.Length;
buffer.AddRange(header.ConvertToBtyes());
buffer.AddRange(msg.ToArray());
int fullsz = buffer.Count;
int got = socket.Send(buffer.ToArray());
return (got == fullsz);
}
protected command_result execute<Input, Output>(color_ostream outString, Input input, Output output)
where Input : message_type, new()
where Output : message_type, new()
{
if (!isValid())
{
outString.printerr("Calling an unbound RPC function %s::%s.\n",
this.proto, this.name);
return command_result.CR_NOT_IMPLEMENTED;
}
if (p_client.socket == null)
{
outString.printerr("In call to %s::%s: invalid socket.\n",
this.proto, this.name);
return command_result.CR_LINK_FAILURE;
}
MemoryStream sendStream = new MemoryStream();
ProtoBuf.Serializer.Serialize<Input>(sendStream, input);
long send_size = sendStream.Length;
if (send_size > RPCMessageHeader.MAX_MESSAGE_SIZE)
{
outString.printerr("In call to %s::%s: message too large: %d.\n",
this.proto, this.name, send_size);
return command_result.CR_LINK_FAILURE;
}
if (!sendRemoteMessage(p_client.socket, id, sendStream))
{
outString.printerr("In call to %s::%s: I/O error in send.\n",
this.proto, this.name);
return command_result.CR_LINK_FAILURE;
}
color_ostream_proxy text_decoder = new color_ostream_proxy(outString);
CoreTextNotification text_data;
output = new Output();
//return command_result.CR_OK;
while (true)
{
RPCMessageHeader header = new RPCMessageHeader();
byte[] buffer = new byte[8];
if (!RemoteClient.readFullBuffer(p_client.socket, buffer, 8))
{
outString.printerr("In call to %s::%s: I/O error in receive header.\n",
this.proto, this.name);
return command_result.CR_LINK_FAILURE;
}
header.id = BitConverter.ToInt16(buffer, 0);
header.size = BitConverter.ToInt32(buffer, 4); //because something, somewhere, is fucking retarded
//outString.print("Received %d:%d.\n", header.id, header.size);
if ((DFHackReplyCode)header.id == DFHackReplyCode.RPC_REPLY_FAIL)
if (header.size == (int)command_result.CR_OK)
return command_result.CR_FAILURE;
else
return (command_result)header.size;
if (header.size < 0 || header.size > RPCMessageHeader.MAX_MESSAGE_SIZE)
{
outString.printerr("In call to %s::%s: invalid received size %d.\n",
this.proto, this.name, header.size);
return command_result.CR_LINK_FAILURE;
}
byte[] buf = new byte[header.size];
if (!RemoteClient.readFullBuffer(p_client.socket, buf, header.size))
{
outString.printerr("In call to %s::%s: I/O error in receive %d bytes of data.\n",
this.proto, this.name, header.size);
return command_result.CR_LINK_FAILURE;
}
switch ((DFHackReplyCode)header.id)
{
case DFHackReplyCode.RPC_REPLY_RESULT:
output = ProtoBuf.Serializer.Deserialize<Output>(new MemoryStream(buf));
if (output == null)
{
outString.printerr("In call to %s::%s: error parsing received result.\n",
this.proto, this.name);
return command_result.CR_LINK_FAILURE;
}
return command_result.CR_OK;
case DFHackReplyCode.RPC_REPLY_TEXT:
text_data = ProtoBuf.Serializer.Deserialize<CoreTextNotification>(new MemoryStream(buf));
if (text_data != null)
{
text_decoder.decode(text_data);
}
else
outString.printerr("In call to %s::%s: received invalid text data.\n",
this.proto, this.name);
break;
default:
break;
}
}
return command_result.CR_OK;
}
public string name, proto;
public RemoteClient p_client;
public Int16 id;
}
public class RemoteFunction<Input, Output> : RemoteFunctionBase
where Input : message_type, new()
where Output : message_type, new()
{
public new Input make_in() { return (Input)(base.make_in()); }
public new Input input() { return (Input)(base.input()); }
public new Output make_out() { return (Output)(base.make_out()); }
public new Output output() { return (Output)(base.output()); }
public RemoteFunction() : base(new Input(), new Output()) { }
public command_result execute()
{
if (p_client == null)
return command_result.CR_NOT_IMPLEMENTED;
else
return base.execute<Input, Output>(default_ostream(), input(), output());
}
public command_result execute(color_ostream stream)
{
return base.execute<Input, Output>(stream, input(), output());
}
public command_result execute(Input input, Output output)
{
if (p_client == null)
return command_result.CR_NOT_IMPLEMENTED;
else
return base.execute<Input, Output>(default_ostream(), input, output);
}
public command_result execute(color_ostream stream, Input input, Output output)
{
return base.execute<Input, Output>(stream, input, output);
}
}
public class RemoteFunction<Input> : RemoteFunctionBase
where Input : message_type, new()
{
public new Input make_in() { return (Input)(base.make_in()); }
public new Input input() { return (Input)(base.input()); }
public RemoteFunction() : base(new Input(), new EmptyMessage()) { }
public command_result execute()
{
if (p_client == null)
return command_result.CR_NOT_IMPLEMENTED;
else
return base.execute<Input, EmptyMessage>(default_ostream(), input(), (EmptyMessage)output());
}
public command_result execute(color_ostream stream)
{
return base.execute<Input, EmptyMessage>(stream, input(), (EmptyMessage)output());
}
public command_result execute(Input input)
{
if (p_client == null)
return command_result.CR_NOT_IMPLEMENTED;
else
return base.execute<Input, EmptyMessage>(default_ostream(), input, (EmptyMessage)output());
}
public command_result execute(color_ostream stream, Input input)
{
return base.execute<Input, EmptyMessage>(stream, input, (EmptyMessage)output());
}
};
public class RemoteClient
{
public static bool readFullBuffer(Socket socket, byte[] buf, int size)
{
if (!socket.Connected)
return false;
if (size == 0)
return true;
int cnt = socket.Receive(buf, size, SocketFlags.None);
if (cnt <= 0) return false;
return true;
}
public bool bind(color_ostream outStream, RemoteFunctionBase function,
string name, string proto)
{
if (!active || socket == null)
return false;
bind_call.reset();
{
var input = bind_call.input();
input.method = name;
if (proto.Length == 0)
input.plugin = proto;
input.input_msg = function.p_in_template.GetType().ToString();
input.output_msg = function.p_out_template.GetType().ToString();
}
if (bind_call.execute(outStream) != command_result.CR_OK)
return false;
function.id = (Int16)bind_call.output().assigned_id;
return true;
}
public RemoteClient(color_ostream default_output = null)
{
p_default_output = default_output;
active = false;
socket = null;
suspend_ready = false;
if (p_default_output == null)
{
delete_output = true;
p_default_output = new color_ostream();
}
else
delete_output = false;
}
~RemoteClient()
{
disconnect();
socket = null;
if (delete_output)
p_default_output = null;
}
public static int GetDefaultPort()
{
string port = System.Environment.GetEnvironmentVariable("DFHACK_PORT");
if (port == null) port = "0";
int portval = Int32.Parse(port);
if (portval <= 0)
return 5000;
else
return portval;
}
public color_ostream default_output()
{
return p_default_output;
}
private static Socket ConnectSocket(string server, int port)
{
Socket s = null;
IPHostEntry hostEntry = null;
// Get host related information.
hostEntry = Dns.GetHostEntry(server);
// Loop through the AddressList to obtain the supported AddressFamily. This is to avoid
// an exception that occurs when the host IP Address is not compatible with the address family
// (typical in the IPv6 case).
foreach (IPAddress address in hostEntry.AddressList)
{
IPEndPoint ipe = new IPEndPoint(address, port);
Socket tempSocket =
new Socket(ipe.AddressFamily, SocketType.Stream, ProtocolType.Tcp);
tempSocket.Connect(ipe);
if (tempSocket.Connected)
{
s = tempSocket;
break;
}
else
{
continue;
}
}
return s;
}
static bool partialArrayCompare(byte[] A, byte[] B) //compares the intersection of the two arrays, ignoring the rest.
{
int size = A.Length;
if (size > B.Length) size = B.Length;
for (int i = 0; i < size; i++)
{
if (A[i] != B[i])
return false;
}
return true;
}
public bool connect(int port = -1)
{
Debug.Assert(!active);
if (port <= 0)
port = GetDefaultPort();
socket = ConnectSocket("localhost", port);
if (socket == null)
{
default_output().printerr("Could not connect to localhost: %d\n", port);
return false;
}
active = true;
List<byte> headerList = new List<byte>();
headerList.AddRange(Encoding.ASCII.GetBytes(RPCHandshakeHeader.REQUEST_MAGIC));
headerList.AddRange(BitConverter.GetBytes((Int32)1));
byte[] header = headerList.ToArray();
if (socket.Send(header) != header.Length)
{
default_output().printerr("Could not send handshake header.\n");
socket.Close();
socket = null;
return active = false;
}
if (!readFullBuffer(socket, header, header.Length))
{
default_output().printerr("Could not read handshake header.\n");
socket.Close();
socket = null;
return active = false;
}
if (!partialArrayCompare(header, Encoding.ASCII.GetBytes(RPCHandshakeHeader.RESPONSE_MAGIC)) ||
BitConverter.ToInt32(header, Encoding.ASCII.GetBytes(RPCHandshakeHeader.RESPONSE_MAGIC).Length) != 1)
{
default_output().printerr("Invalid handshake response: %s.\n", System.Text.Encoding.Default.GetString(header));
socket.Close();
socket = null;
return active = false;
}
if (bind_call == null) bind_call = new RemoteFunction<CoreBindRequest, CoreBindReply>();
bind_call.name = "BindMethod";
bind_call.p_client = this;
bind_call.id = 0;
if (runcmd_call == null) runcmd_call = new RemoteFunction<CoreRunCommandRequest>();
runcmd_call.name = "RunCommand";
runcmd_call.p_client = this;
runcmd_call.id = 1;
return true;
}
public void disconnect()
{
if (active && socket != null)
{
RPCMessageHeader header;
header.id = (Int16)DFHackReplyCode.RPC_REQUEST_QUIT;
header.size = 0;
if (socket.Send(header.ConvertToBtyes()) != header.ConvertToBtyes().Length)
default_output().printerr("Could not send the disconnect message.\n");
socket.Close();
}
socket = null;
}
public command_result run_command(string cmd, List<string> args)
{
return run_command(default_output(), cmd, args);
}
public command_result run_command(color_ostream output, string cmd, List<string> args)
{
if (!active || socket == null)
{
output.printerr("In RunCommand: client connection not valid.\n");
return command_result.CR_FAILURE;
}
runcmd_call.reset();
runcmd_call.input().command = cmd;
for (int i = 0; i < args.Count; i++)
runcmd_call.input().arguments.Add(args[i]);
return runcmd_call.execute(output);
}
// // For executing multiple calls in rapid succession.
// // Best used via RemoteSuspender.
public int suspend_game()
{
if (!active)
return -1;
if (!suspend_ready)
{
suspend_ready = true;
suspend_call.bind(this, "CoreSuspend");
resume_call.bind(this, "CoreResume");
}
if (suspend_call.execute(default_output()) == command_result.CR_OK)
return suspend_call.output().value;
else
return -1;
}
public int resume_game()
{
if (!suspend_ready)
return -1;
if (resume_call.execute(default_output()) == command_result.CR_OK)
return resume_call.output().value;
else
return -1;
}
//private:
bool active, delete_output;
public Socket socket;
color_ostream p_default_output;
RemoteFunction<dfproto.CoreBindRequest, dfproto.CoreBindReply> bind_call;
RemoteFunction<dfproto.CoreRunCommandRequest> runcmd_call;
bool suspend_ready;
RemoteFunction<EmptyMessage, IntMessage> suspend_call, resume_call;
}
class RemoteSuspender
{
RemoteClient client;
public RemoteSuspender(RemoteClient clientIn)
{
client = clientIn;
if (client == null || client.suspend_game() <= 0) client = null;
}
~RemoteSuspender()
{
if (client != null) client.resume_game();
}
};
}

@ -0,0 +1,690 @@
#region Usings
using System;
using System.IO;
using System.Text;
using System.Text.RegularExpressions;
#endregion
namespace AT.MIN
{
public static class Tools
{
#region Public Methods
#region IsNumericType
/// <summary>
/// Determines whether the specified value is of numeric type.
/// </summary>
/// <param name="o">The object to check.</param>
/// <returns>
/// <c>true</c> if o is a numeric type; otherwise, <c>false</c>.
/// </returns>
public static bool IsNumericType( object o )
{
return ( o is byte ||
o is sbyte ||
o is short ||
o is ushort ||
o is int ||
o is uint ||
o is long ||
o is ulong ||
o is float ||
o is double ||
o is decimal );
}
#endregion
#region IsPositive
/// <summary>
/// Determines whether the specified value is positive.
/// </summary>
/// <param name="Value">The value.</param>
/// <param name="ZeroIsPositive">if set to <c>true</c> treats 0 as positive.</param>
/// <returns>
/// <c>true</c> if the specified value is positive; otherwise, <c>false</c>.
/// </returns>
public static bool IsPositive( object Value, bool ZeroIsPositive )
{
switch ( Type.GetTypeCode( Value.GetType() ) )
{
case TypeCode.SByte:
return ( ZeroIsPositive ? (sbyte)Value >= 0 : (sbyte)Value > 0 );
case TypeCode.Int16:
return ( ZeroIsPositive ? (short)Value >= 0 : (short)Value > 0 );
case TypeCode.Int32:
return ( ZeroIsPositive ? (int)Value >= 0 : (int)Value > 0 );
case TypeCode.Int64:
return ( ZeroIsPositive ? (long)Value >= 0 : (long)Value > 0 );
case TypeCode.Single:
return ( ZeroIsPositive ? (float)Value >= 0 : (float)Value > 0 );
case TypeCode.Double:
return ( ZeroIsPositive ? (double)Value >= 0 : (double)Value > 0 );
case TypeCode.Decimal:
return ( ZeroIsPositive ? (decimal)Value >= 0 : (decimal)Value > 0 );
case TypeCode.Byte:
return ( ZeroIsPositive ? true : (byte)Value > 0 );
case TypeCode.UInt16:
return ( ZeroIsPositive ? true : (ushort)Value > 0 );
case TypeCode.UInt32:
return ( ZeroIsPositive ? true : (uint)Value > 0 );
case TypeCode.UInt64:
return ( ZeroIsPositive ? true : (ulong)Value > 0 );
case TypeCode.Char:
return ( ZeroIsPositive ? true : (char)Value != '\0' );
default:
return false;
}
}
#endregion
#region ToUnsigned
/// <summary>
/// Converts the specified values boxed type to its correpsonding unsigned
/// type.
/// </summary>
/// <param name="Value">The value.</param>
/// <returns>A boxed numeric object whos type is unsigned.</returns>
public static object ToUnsigned( object Value )
{
switch ( Type.GetTypeCode( Value.GetType() ) )
{
case TypeCode.SByte:
return (byte)( (sbyte)Value );
case TypeCode.Int16:
return (ushort)( (short)Value );
case TypeCode.Int32:
return (uint)( (int)Value );
case TypeCode.Int64:
return (ulong)( (long)Value );
case TypeCode.Byte:
return Value;
case TypeCode.UInt16:
return Value;
case TypeCode.UInt32:
return Value;
case TypeCode.UInt64:
return Value;
case TypeCode.Single:
return (UInt32)( (float)Value );
case TypeCode.Double:
return (ulong)( (double)Value );
case TypeCode.Decimal:
return (ulong)( (decimal)Value );
default:
return null;
}
}
#endregion
#region ToInteger
/// <summary>
/// Converts the specified values boxed type to its correpsonding integer
/// type.
/// </summary>
/// <param name="Value">The value.</param>
/// <returns>A boxed numeric object whos type is an integer type.</returns>
public static object ToInteger( object Value, bool Round )
{
switch ( Type.GetTypeCode( Value.GetType() ) )
{
case TypeCode.SByte:
return Value;
case TypeCode.Int16:
return Value;
case TypeCode.Int32:
return Value;
case TypeCode.Int64:
return Value;
case TypeCode.Byte:
return Value;
case TypeCode.UInt16:
return Value;
case TypeCode.UInt32:
return Value;
case TypeCode.UInt64:
return Value;
case TypeCode.Single:
return ( Round ? (int)Math.Round( (float)Value ) : (int)( (float)Value ) );
case TypeCode.Double:
return ( Round ? (long)Math.Round( (double)Value ) : (long)( (double)Value ) );
case TypeCode.Decimal:
return ( Round ? Math.Round( (decimal)Value ) : (decimal)Value );
default:
return null;
}
}
#endregion
#region UnboxToLong
public static long UnboxToLong( object Value, bool Round )
{
switch ( Type.GetTypeCode( Value.GetType() ) )
{
case TypeCode.SByte:
return (long)( (sbyte)Value );
case TypeCode.Int16:
return (long)( (short)Value );
case TypeCode.Int32:
return (long)( (int)Value );
case TypeCode.Int64:
return (long)Value;
case TypeCode.Byte:
return (long)( (byte)Value );
case TypeCode.UInt16:
return (long)( (ushort)Value );
case TypeCode.UInt32:
return (long)( (uint)Value );
case TypeCode.UInt64:
return (long)( (ulong)Value );
case TypeCode.Single:
return ( Round ? (long)Math.Round( (float)Value ) : (long)( (float)Value ) );
case TypeCode.Double:
return ( Round ? (long)Math.Round( (double)Value ) : (long)( (double)Value ) );
case TypeCode.Decimal:
return ( Round ? (long)Math.Round( (decimal)Value ) : (long)( (decimal)Value ) );
default:
return 0;
}
}
#endregion
#region ReplaceMetaChars
/// <summary>
/// Replaces the string representations of meta chars with their corresponding
/// character values.
/// </summary>
/// <param name="input">The input.</param>
/// <returns>A string with all string meta chars are replaced</returns>
public static string ReplaceMetaChars( string input )
{
return Regex.Replace( input, @"(\\)(\d{3}|[^\d])?", new MatchEvaluator( ReplaceMetaCharsMatch ) );
}
private static string ReplaceMetaCharsMatch( Match m )
{
// convert octal quotes (like \040)
if ( m.Groups[2].Length == 3 )
return Convert.ToChar( Convert.ToByte( m.Groups[2].Value, 8 ) ).ToString();
else
{
// convert all other special meta characters
//TODO: \xhhh hex and possible dec !!
switch ( m.Groups[2].Value )
{
case "0": // null
return "\0";
case "a": // alert (beep)
return "\a";
case "b": // BS
return "\b";
case "f": // FF
return "\f";
case "v": // vertical tab
return "\v";
case "r": // CR
return "\r";
case "n": // LF
return "\n";
case "t": // Tab
return "\t";
default:
// if neither an octal quote nor a special meta character
// so just remove the backslash
return m.Groups[2].Value;
}
}
}
#endregion
#region printf
public static void printf( string Format, params object[] Parameters )
{
Console.Write( Tools.sprintf( Format, Parameters ) );
}
#endregion
#region fprintf
public static void fprintf( TextWriter Destination, string Format, params object[] Parameters )
{
Destination.Write( Tools.sprintf( Format, Parameters ) );
}
#endregion
#region sprintf
public static string sprintf( string Format, params object[] Parameters )
{
#region Variables
StringBuilder f = new StringBuilder();
Regex r = new Regex( @"\%(\d*\$)?([\'\#\-\+ ]*)(\d*)(?:\.(\d+))?([hl])?([dioxXucsfeEgGpn%])" );
//"%[parameter][flags][width][.precision][length]type"
Match m = null;
string w = String.Empty;
int defaultParamIx = 0;
int paramIx;
object o = null;
bool flagLeft2Right = false;
bool flagAlternate = false;
bool flagPositiveSign = false;
bool flagPositiveSpace = false;
bool flagZeroPadding = false;
bool flagGroupThousands = false;
int fieldLength = 0;
int fieldPrecision = 0;
char shortLongIndicator = '\0';
char formatSpecifier = '\0';
char paddingCharacter = ' ';
#endregion
// find all format parameters in format string
f.Append( Format );
m = r.Match( f.ToString() );
while ( m.Success )
{
#region parameter index
paramIx = defaultParamIx;
if ( m.Groups[1] != null && m.Groups[1].Value.Length > 0 )
{
string val = m.Groups[1].Value.Substring( 0, m.Groups[1].Value.Length - 1 );
paramIx = Convert.ToInt32( val ) - 1;
};
#endregion
#region format flags
// extract format flags
flagAlternate = false;
flagLeft2Right = false;
flagPositiveSign = false;
flagPositiveSpace = false;
flagZeroPadding = false;
flagGroupThousands = false;
if ( m.Groups[2] != null && m.Groups[2].Value.Length > 0 )
{
string flags = m.Groups[2].Value;
flagAlternate = ( flags.IndexOf( '#' ) >= 0 );
flagLeft2Right = ( flags.IndexOf( '-' ) >= 0 );
flagPositiveSign = ( flags.IndexOf( '+' ) >= 0 );
flagPositiveSpace = ( flags.IndexOf( ' ' ) >= 0 );
flagGroupThousands = ( flags.IndexOf( '\'' ) >= 0 );
// positive + indicator overrides a
// positive space character
if ( flagPositiveSign && flagPositiveSpace )
flagPositiveSpace = false;
}
#endregion
#region field length
// extract field length and
// pading character
paddingCharacter = ' ';
fieldLength = int.MinValue;
if ( m.Groups[3] != null && m.Groups[3].Value.Length > 0 )
{
fieldLength = Convert.ToInt32( m.Groups[3].Value );
flagZeroPadding = ( m.Groups[3].Value[0] == '0' );
}
#endregion
if ( flagZeroPadding )
paddingCharacter = '0';
// left2right allignment overrides zero padding
if ( flagLeft2Right && flagZeroPadding )
{
flagZeroPadding = false;
paddingCharacter = ' ';
}
#region field precision
// extract field precision
fieldPrecision = int.MinValue;
if ( m.Groups[4] != null && m.Groups[4].Value.Length > 0 )
fieldPrecision = Convert.ToInt32( m.Groups[4].Value );
#endregion
#region short / long indicator
// extract short / long indicator
shortLongIndicator = Char.MinValue;
if ( m.Groups[5] != null && m.Groups[5].Value.Length > 0 )
shortLongIndicator = m.Groups[5].Value[0];
#endregion
#region format specifier
// extract format
formatSpecifier = Char.MinValue;
if ( m.Groups[6] != null && m.Groups[6].Value.Length > 0 )
formatSpecifier = m.Groups[6].Value[0];
#endregion
// default precision is 6 digits if none is specified except
if ( fieldPrecision == int.MinValue &&
formatSpecifier != 's' &&
formatSpecifier != 'c' &&
Char.ToUpper( formatSpecifier ) != 'X' &&
formatSpecifier != 'o' )
fieldPrecision = 6;
#region get next value parameter
// get next value parameter and convert value parameter depending on short / long indicator
if ( Parameters == null || paramIx >= Parameters.Length )
o = null;
else
{
o = Parameters[paramIx];
if ( shortLongIndicator == 'h' )
{
if ( o is int )
o = (short)( (int)o );
else if ( o is long )
o = (short)( (long)o );
else if ( o is uint )
o = (ushort)( (uint)o );
else if ( o is ulong )
o = (ushort)( (ulong)o );
}
else if ( shortLongIndicator == 'l' )
{
if ( o is short )
o = (long)( (short)o );
else if ( o is int )
o = (long)( (int)o );
else if ( o is ushort )
o = (ulong)( (ushort)o );
else if ( o is uint )
o = (ulong)( (uint)o );
}
}
#endregion
// convert value parameters to a string depending on the formatSpecifier
w = String.Empty;
switch ( formatSpecifier )
{
#region % - character
case '%': // % character
w = "%";
break;
#endregion
#region d - integer
case 'd': // integer
w = FormatNumber( ( flagGroupThousands ? "n" : "d" ), flagAlternate,
fieldLength, int.MinValue, flagLeft2Right,
flagPositiveSign, flagPositiveSpace,
paddingCharacter, o );
defaultParamIx++;
break;
#endregion
#region i - integer
case 'i': // integer
goto case 'd';
#endregion
#region o - octal integer
case 'o': // octal integer - no leading zero
w = FormatOct( "o", flagAlternate,
fieldLength, int.MinValue, flagLeft2Right,
paddingCharacter, o );
defaultParamIx++;
break;
#endregion
#region x - hex integer
case 'x': // hex integer - no leading zero
w = FormatHex( "x", flagAlternate,
fieldLength, fieldPrecision, flagLeft2Right,
paddingCharacter, o );
defaultParamIx++;
break;
#endregion
#region X - hex integer
case 'X': // same as x but with capital hex characters
w = FormatHex( "X", flagAlternate,
fieldLength, fieldPrecision, flagLeft2Right,
paddingCharacter, o );
defaultParamIx++;
break;
#endregion
#region u - unsigned integer
case 'u': // unsigned integer
w = FormatNumber( ( flagGroupThousands ? "n" : "d" ), flagAlternate,
fieldLength, int.MinValue, flagLeft2Right,
false, false,
paddingCharacter, ToUnsigned( o ) );
defaultParamIx++;
break;
#endregion
#region c - character
case 'c': // character
if ( IsNumericType( o ) )
w = Convert.ToChar( o ).ToString();
else if ( o is char )
w = ( (char)o ).ToString();
else if ( o is string && ( (string)o ).Length > 0 )
w = ( (string)o )[0].ToString();
defaultParamIx++;
break;
#endregion
#region s - string
case 's': // string
string t = "{0" + ( fieldLength != int.MinValue ? "," + ( flagLeft2Right ? "-" : String.Empty ) + fieldLength.ToString() : String.Empty ) + ":s}";
w = o.ToString();
if ( fieldPrecision >= 0 )
w = w.Substring( 0, fieldPrecision );
if ( fieldLength != int.MinValue )
if ( flagLeft2Right )
w = w.PadRight( fieldLength, paddingCharacter );
else
w = w.PadLeft( fieldLength, paddingCharacter );
defaultParamIx++;
break;
#endregion
#region f - double number
case 'f': // double
w = FormatNumber( ( flagGroupThousands ? "n" : "f" ), flagAlternate,
fieldLength, fieldPrecision, flagLeft2Right,
flagPositiveSign, flagPositiveSpace,
paddingCharacter, o );
defaultParamIx++;
break;
#endregion
#region e - exponent number
case 'e': // double / exponent
w = FormatNumber( "e", flagAlternate,
fieldLength, fieldPrecision, flagLeft2Right,
flagPositiveSign, flagPositiveSpace,
paddingCharacter, o );
defaultParamIx++;
break;
#endregion
#region E - exponent number
case 'E': // double / exponent
w = FormatNumber( "E", flagAlternate,
fieldLength, fieldPrecision, flagLeft2Right,
flagPositiveSign, flagPositiveSpace,
paddingCharacter, o );
defaultParamIx++;
break;
#endregion
#region g - general number
case 'g': // double / exponent
w = FormatNumber( "g", flagAlternate,
fieldLength, fieldPrecision, flagLeft2Right,
flagPositiveSign, flagPositiveSpace,
paddingCharacter, o );
defaultParamIx++;
break;
#endregion
#region G - general number
case 'G': // double / exponent
w = FormatNumber( "G", flagAlternate,
fieldLength, fieldPrecision, flagLeft2Right,
flagPositiveSign, flagPositiveSpace,
paddingCharacter, o );
defaultParamIx++;
break;
#endregion
#region p - pointer
case 'p': // pointer
if ( o is IntPtr )
w = "0x" + ( (IntPtr)o ).ToString( "x" );
defaultParamIx++;
break;
#endregion
#region n - number of processed chars so far
case 'n': // number of characters so far
w = FormatNumber( "d", flagAlternate,
fieldLength, int.MinValue, flagLeft2Right,
flagPositiveSign, flagPositiveSpace,
paddingCharacter, m.Index );
break;
#endregion
default:
w = String.Empty;
defaultParamIx++;
break;
}
// replace format parameter with parameter value
// and start searching for the next format parameter
// AFTER the position of the current inserted value
// to prohibit recursive matches if the value also
// includes a format specifier
f.Remove( m.Index, m.Length );
f.Insert( m.Index, w );
m = r.Match( f.ToString(), m.Index + w.Length );
}
return f.ToString();
}
#endregion
#endregion
#region Private Methods
#region FormatOCT
private static string FormatOct( string NativeFormat, bool Alternate,
int FieldLength, int FieldPrecision,
bool Left2Right,
char Padding, object Value )
{
string w = String.Empty;
string lengthFormat = "{0" + ( FieldLength != int.MinValue ?
"," + ( Left2Right ?
"-" :
String.Empty ) + FieldLength.ToString() :
String.Empty ) + "}";
if ( IsNumericType( Value ) )
{
w = Convert.ToString( UnboxToLong( Value, true ), 8 );
if ( Left2Right || Padding == ' ' )
{
if ( Alternate && w != "0" )
w = "0" + w;
w = String.Format( lengthFormat, w );
}
else
{
if ( FieldLength != int.MinValue )
w = w.PadLeft( FieldLength - ( Alternate && w != "0" ? 1 : 0 ), Padding );
if ( Alternate && w != "0" )
w = "0" + w;
}
}
return w;
}
#endregion
#region FormatHEX
private static string FormatHex( string NativeFormat, bool Alternate,
int FieldLength, int FieldPrecision,
bool Left2Right,
char Padding, object Value )
{
string w = String.Empty;
string lengthFormat = "{0" + ( FieldLength != int.MinValue ?
"," + ( Left2Right ?
"-" :
String.Empty ) + FieldLength.ToString() :
String.Empty ) + "}";
string numberFormat = "{0:" + NativeFormat + ( FieldPrecision != int.MinValue ?
FieldPrecision.ToString() :
String.Empty ) + "}";
if ( IsNumericType( Value ) )
{
w = String.Format( numberFormat, Value );
if ( Left2Right || Padding == ' ' )
{
if ( Alternate )
w = ( NativeFormat == "x" ? "0x" : "0X" ) + w;
w = String.Format( lengthFormat, w );
}
else
{
if ( FieldLength != int.MinValue )
w = w.PadLeft( FieldLength - ( Alternate ? 2 : 0 ), Padding );
if ( Alternate )
w = ( NativeFormat == "x" ? "0x" : "0X" ) + w;
}
}
return w;
}
#endregion
#region FormatNumber
private static string FormatNumber( string NativeFormat, bool Alternate,
int FieldLength, int FieldPrecision,
bool Left2Right,
bool PositiveSign, bool PositiveSpace,
char Padding, object Value )
{
string w = String.Empty;
string lengthFormat = "{0" + ( FieldLength != int.MinValue ?
"," + ( Left2Right ?
"-" :
String.Empty ) + FieldLength.ToString() :
String.Empty ) + "}";
string numberFormat = "{0:" + NativeFormat + ( FieldPrecision != int.MinValue ?
FieldPrecision.ToString() :
"0" ) + "}";
if ( IsNumericType( Value ) )
{
w = String.Format( numberFormat, Value );
if ( Left2Right || Padding == ' ' )
{
if ( IsPositive( Value, true ) )
w = ( PositiveSign ?
"+" : ( PositiveSpace ? " " : String.Empty ) ) + w;
w = String.Format( lengthFormat, w );
}
else
{
if ( w.StartsWith( "-" ) )
w = w.Substring( 1 );
if ( FieldLength != int.MinValue )
w = w.PadLeft( FieldLength - 1, Padding );
if ( IsPositive( Value, true ) )
w = ( PositiveSign ?
"+" : ( PositiveSpace ?
" " : ( FieldLength != int.MinValue ?
Padding.ToString() : String.Empty ) ) ) + w;
else
w = "-" + w;
}
}
return w;
}
#endregion
#endregion
}
}

@ -0,0 +1,21 @@
using DFHack;
using System.Collections.Generic;
using UnityEngine;
public class TestScript : MonoBehaviour {
RemoteClient remoteClient = new RemoteClient();
// Use this for initialization
void Start () {
if (!remoteClient.connect())
Debug.LogError("Could not connect");
else
{
remoteClient.run_command("ls", new List<string>());
}
}
// Update is called once per frame
void Update () {
}
}

@ -1 +1 @@
Subproject commit 24d29ef54a4f60efb26fd9608c5cb11dfcd4d940
Subproject commit 42736fe494e7edeb884caa45a8669996a0eafb11

@ -13,6 +13,7 @@ endif()
OPTION(BUILD_ISOWORLD "Build isoworld (needs a checkout first)." OFF)
if(BUILD_ISOWORLD)
DFHACK_PLUGIN(isoworldremote isoworldremote.cpp PROTOBUFS isoworldremote)
add_subdirectory (isoworld)
IF(UNIX)
if (APPLE)
@ -148,13 +149,13 @@ if (BUILD_SUPPORTED)
DFHACK_PLUGIN(trueTransformation trueTransformation.cpp)
DFHACK_PLUGIN(infiniteSky infiniteSky.cpp)
DFHACK_PLUGIN(createitem createitem.cpp)
DFHACK_PLUGIN(isoworldremote isoworldremote.cpp PROTOBUFS isoworldremote)
DFHACK_PLUGIN(buildingplan buildingplan.cpp)
DFHACK_PLUGIN(resume resume.cpp)
DFHACK_PLUGIN(dwarfmonitor dwarfmonitor.cpp)
DFHACK_PLUGIN(mousequery mousequery.cpp)
DFHACK_PLUGIN(autotrade autotrade.cpp)
DFHACK_PLUGIN(stocks stocks.cpp)
DFHACK_PLUGIN(cleanconst cleanconst.cpp)
endif()

@ -0,0 +1,87 @@
// Destroys items being used as part of constructions
// and flags the constructions to recreate their components upon disassembly
#include "Core.h"
#include "Console.h"
#include "Export.h"
#include "PluginManager.h"
#include "modules/Maps.h"
#include "DataDefs.h"
#include "df/item.h"
#include "df/world.h"
#include "df/construction.h"
#include "df/map_block.h"
using namespace std;
using namespace DFHack;
using df::global::world;
DFHACK_PLUGIN("cleanconst");
command_result df_cleanconst(color_ostream &out, vector <string> & parameters)
{
CoreSuspender suspend;
if (!Maps::IsValid())
{
out.printerr("Map is not available!\n");
return CR_FAILURE;
}
size_t numItems = world->items.all.size();
int cleaned_total = 0;
// proceed with the cleanup operation
for (size_t i = 0; i < numItems; i++)
{
df::item *item = world->items.all[i];
// only process items marked as "in construction"
if (!item->flags.bits.construction)
continue;
df::coord pos(item->pos.x, item->pos.y, item->pos.z);
df::construction *cons = df::construction::find(pos);
if (!cons)
{
out.printerr("Item at %i,%i,%i marked as construction but no construction is present!\n", pos.x, pos.y, pos.z);
continue;
}
// if the construction is already labeled as "no build item", then leave it alone
if (cons->flags.bits.no_build_item)
continue;
// only destroy the item if the construction claims to be made of the exact same thing
if (item->getType() != cons->item_type ||
item->getSubtype() != cons->item_subtype ||
item->getMaterial() != cons->mat_type ||
item->getMaterialIndex() != cons->mat_index)
continue;
item->flags.bits.garbage_collect = 1;
cons->flags.bits.no_build_item = 1;
cleaned_total++;
}
out.print("Done. %d construction items cleaned up.\n", cleaned_total);
return CR_OK;
}
DFhackCExport command_result plugin_init ( color_ostream &out, vector <PluginCommand> &commands)
{
commands.push_back(PluginCommand(
"cleanconst", "Cleans up construction materials.",
df_cleanconst, false,
" This utility alters all constructions on the map so that they spawn their\n"
" building component when they are disassembled, allowing their actual\n"
" build items to be safely deleted.\n"
));
return CR_OK;
}
DFhackCExport command_result plugin_shutdown ( color_ostream &out )
{
return CR_OK;
}

@ -1 +1 @@
Subproject commit aa3b1bd51f269c07b3235392fd7ed21fe9171f3f
Subproject commit 29fad1ef8e7e2aceb2e68c93a3993933168fe885

@ -11,6 +11,9 @@
#include "df/graphic.h"
#include "df/viewscreen_dwarfmodest.h"
#include "df/flow_info.h"
#include "df/world.h"
#include "df/building.h"
using df::global::gps;
using namespace DFHack;
@ -210,6 +213,7 @@ bool lightingEngineViewscreen::addLight(int tileId,const lightSource& light)
lights[tileId].flicker=true;
return wasLight;
}
static size_t max_list_size = 100000; // Avoid iterating over huge lists
void lightingEngineViewscreen::doOcupancyAndLights()
{
lightSource sun(lightCell(1,1,1),15);
@ -247,6 +251,41 @@ void lightingEngineViewscreen::doOcupancyAndLights()
{
curCell=lightCell(0,0,0);
}
else if(o->bits.building)
{
// Fixme: don't iterate the list every frame
size_t count = df::global::world->buildings.all.size();
if (count <= max_list_size)
{
for(size_t i = 0; i < count; i++)
{
df::building *bld = df::global::world->buildings.all[i];
if (window_z == bld->z &&
x >= bld->x1 && x <= bld->x2 &&
y >= bld->y1 && y <= bld->y2)
{
df::building_type type = bld->getType();
if (type == df::enums::building_type::WindowGlass)
{
if(bld->mat_type == 3)//green glass
{
curCell=lightCell(0.1f,0.9f,0.5f);
}
else if(bld->mat_type == 4)//clear glass
{
curCell=lightCell(0.5f,0.95f,0.9f);
}
else if(bld->mat_type == 5)//crystal glass
{
curCell=lightCell(0.75f,0.95f,0.95f);
}
}
}
}
}
}
else if(!d->bits.liquid_type && d->bits.flow_size>3 )
{
curCell=lightCell(0.5f,0.5f,0.6f);

@ -1 +1 @@
Subproject commit 0d41614ff3dae9245e786ad667b0e463fe0dea3e
Subproject commit bbbda97c1cdd3d2456097eca799cfc7cf3410aaf