|
|
|
@ -26,11 +26,11 @@ distribution.
|
|
|
|
|
#ifndef CL_MOD_CREATURES
|
|
|
|
|
#define CL_MOD_CREATURES
|
|
|
|
|
/*
|
|
|
|
|
* Creatures
|
|
|
|
|
*/
|
|
|
|
|
* Creatures
|
|
|
|
|
*/
|
|
|
|
|
#include "Export.h"
|
|
|
|
|
#include "Module.h"
|
|
|
|
|
#include "modules/Items.h"
|
|
|
|
|
#include "DataDefs.h"
|
|
|
|
|
#include "df/unit.h"
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
@ -39,118 +39,53 @@ distribution.
|
|
|
|
|
*/
|
|
|
|
|
namespace DFHack
|
|
|
|
|
{
|
|
|
|
|
// FIXME: WTF IS THIS SHIT?
|
|
|
|
|
/*
|
|
|
|
|
struct t_labor
|
|
|
|
|
{
|
|
|
|
|
string name;
|
|
|
|
|
uint8_t value;
|
|
|
|
|
t_labor() {
|
|
|
|
|
value =0;
|
|
|
|
|
}
|
|
|
|
|
t_labor(const t_labor & b){
|
|
|
|
|
name=b.name;
|
|
|
|
|
value=b.value;
|
|
|
|
|
}
|
|
|
|
|
t_labor & operator=(const t_labor &b){
|
|
|
|
|
name=b.name;
|
|
|
|
|
value=b.value;
|
|
|
|
|
return *this;
|
|
|
|
|
}
|
|
|
|
|
};
|
|
|
|
|
struct t_skill
|
|
|
|
|
{
|
|
|
|
|
string name;
|
|
|
|
|
uint16_t id;
|
|
|
|
|
uint32_t experience;
|
|
|
|
|
uint16_t rating;
|
|
|
|
|
t_skill(){
|
|
|
|
|
id=rating=0;
|
|
|
|
|
experience=0;
|
|
|
|
|
}
|
|
|
|
|
t_skill(const t_skill & b)
|
|
|
|
|
{
|
|
|
|
|
name=b.name;
|
|
|
|
|
id=b.id;
|
|
|
|
|
experience=b.experience;
|
|
|
|
|
rating=b.rating;
|
|
|
|
|
}
|
|
|
|
|
t_skill & operator=(const t_skill &b)
|
|
|
|
|
{
|
|
|
|
|
name=b.name;
|
|
|
|
|
id=b.id;
|
|
|
|
|
experience=b.experience;
|
|
|
|
|
rating=b.rating;
|
|
|
|
|
return *this;
|
|
|
|
|
}
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
struct t_trait
|
|
|
|
|
{
|
|
|
|
|
uint16_t value;
|
|
|
|
|
string displayTxt;
|
|
|
|
|
string name;
|
|
|
|
|
t_trait(){
|
|
|
|
|
value=0;
|
|
|
|
|
}
|
|
|
|
|
t_trait(const t_trait &b)
|
|
|
|
|
{
|
|
|
|
|
name=b.name;
|
|
|
|
|
displayTxt=b.displayTxt;
|
|
|
|
|
value=b.value;
|
|
|
|
|
}
|
|
|
|
|
t_trait & operator=(const t_trait &b)
|
|
|
|
|
{
|
|
|
|
|
name=b.name;
|
|
|
|
|
displayTxt=b.displayTxt;
|
|
|
|
|
value=b.value;
|
|
|
|
|
return *this;
|
|
|
|
|
}
|
|
|
|
|
};
|
|
|
|
|
*/
|
|
|
|
|
/**
|
|
|
|
|
namespace Simple
|
|
|
|
|
{
|
|
|
|
|
namespace Units
|
|
|
|
|
{
|
|
|
|
|
/**
|
|
|
|
|
* \ingroup grp_units
|
|
|
|
|
*/
|
|
|
|
|
struct t_skill
|
|
|
|
|
{
|
|
|
|
|
struct t_skill
|
|
|
|
|
{
|
|
|
|
|
uint32_t id;
|
|
|
|
|
uint32_t rating;
|
|
|
|
|
uint32_t experience;
|
|
|
|
|
};
|
|
|
|
|
/**
|
|
|
|
|
};
|
|
|
|
|
/**
|
|
|
|
|
* \ingroup grp_units
|
|
|
|
|
*/
|
|
|
|
|
struct t_job
|
|
|
|
|
{
|
|
|
|
|
struct t_job
|
|
|
|
|
{
|
|
|
|
|
bool active;
|
|
|
|
|
uint32_t jobId;
|
|
|
|
|
uint8_t jobType;
|
|
|
|
|
uint32_t occupationPtr;
|
|
|
|
|
};
|
|
|
|
|
/**
|
|
|
|
|
};
|
|
|
|
|
/**
|
|
|
|
|
* \ingroup grp_units
|
|
|
|
|
*/
|
|
|
|
|
struct t_like
|
|
|
|
|
{
|
|
|
|
|
struct t_like
|
|
|
|
|
{
|
|
|
|
|
int16_t type;
|
|
|
|
|
int16_t itemClass;
|
|
|
|
|
int16_t itemIndex;
|
|
|
|
|
t_matglossPair material;
|
|
|
|
|
bool active;
|
|
|
|
|
uint32_t mystery;
|
|
|
|
|
};
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
// FIXME: THIS IS VERY, VERY BAD.
|
|
|
|
|
#define NUM_CREATURE_LABORS 96
|
|
|
|
|
#define NUM_CREATURE_TRAITS 30
|
|
|
|
|
#define NUM_CREATURE_MENTAL_ATTRIBUTES 13
|
|
|
|
|
#define NUM_CREATURE_PHYSICAL_ATTRIBUTES 6
|
|
|
|
|
/**
|
|
|
|
|
// FIXME: THIS IS VERY, VERY BAD.
|
|
|
|
|
#define NUM_CREATURE_LABORS 96
|
|
|
|
|
#define NUM_CREATURE_TRAITS 30
|
|
|
|
|
#define NUM_CREATURE_MENTAL_ATTRIBUTES 13
|
|
|
|
|
#define NUM_CREATURE_PHYSICAL_ATTRIBUTES 6
|
|
|
|
|
/**
|
|
|
|
|
* Structure for holding a copy of a DF unit's soul
|
|
|
|
|
* \ingroup grp_units
|
|
|
|
|
*/
|
|
|
|
|
struct t_soul
|
|
|
|
|
{
|
|
|
|
|
struct t_soul
|
|
|
|
|
{
|
|
|
|
|
uint8_t numSkills;
|
|
|
|
|
t_skill skills[256];
|
|
|
|
|
//uint8_t numLikes;
|
|
|
|
@ -169,15 +104,15 @@ namespace DFHack
|
|
|
|
|
t_attrib kinesthetic_sense;
|
|
|
|
|
t_attrib empathy;
|
|
|
|
|
t_attrib social_awareness;
|
|
|
|
|
};
|
|
|
|
|
#define MAX_COLORS 15
|
|
|
|
|
struct df_unit;
|
|
|
|
|
/**
|
|
|
|
|
};
|
|
|
|
|
#define MAX_COLORS 15
|
|
|
|
|
struct df_unit;
|
|
|
|
|
/**
|
|
|
|
|
* Structure for holding a limited copy of a DF unit
|
|
|
|
|
* \ingroup grp_units
|
|
|
|
|
*/
|
|
|
|
|
struct t_unit
|
|
|
|
|
{
|
|
|
|
|
struct t_unit
|
|
|
|
|
{
|
|
|
|
|
df::unit * origin;
|
|
|
|
|
uint16_t x;
|
|
|
|
|
uint16_t y;
|
|
|
|
@ -221,52 +156,44 @@ namespace DFHack
|
|
|
|
|
|
|
|
|
|
int32_t birth_year;
|
|
|
|
|
uint32_t birth_time;
|
|
|
|
|
};
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
/**
|
|
|
|
|
* The Creatures module - allows reading all non-vermin creatures and their properties
|
|
|
|
|
* \ingroup grp_modules
|
|
|
|
|
* \ingroup grp_units
|
|
|
|
|
*/
|
|
|
|
|
class DFHACK_EXPORT Units : public Module
|
|
|
|
|
{
|
|
|
|
|
public:
|
|
|
|
|
Units();
|
|
|
|
|
~Units();
|
|
|
|
|
bool Start( uint32_t & numCreatures );
|
|
|
|
|
bool Finish();
|
|
|
|
|
|
|
|
|
|
/* Read Functions */
|
|
|
|
|
// Read creatures in a box, starting with index. Returns -1 if no more creatures
|
|
|
|
|
// found. Call repeatedly do get all creatures in a specified box (uses tile coords)
|
|
|
|
|
int32_t GetCreatureInBox(const int32_t index, df::unit ** furball,
|
|
|
|
|
DFHACK_EXPORT bool isValid();
|
|
|
|
|
|
|
|
|
|
/* Read Functions */
|
|
|
|
|
// Read creatures in a box, starting with index. Returns -1 if no more creatures
|
|
|
|
|
// found. Call repeatedly do get all creatures in a specified box (uses tile coords)
|
|
|
|
|
DFHACK_EXPORT int32_t GetCreatureInBox(const int32_t index, df::unit ** furball,
|
|
|
|
|
const uint16_t x1, const uint16_t y1,const uint16_t z1,
|
|
|
|
|
const uint16_t x2, const uint16_t y2,const uint16_t z2);
|
|
|
|
|
df::unit * GetCreature(const int32_t index);
|
|
|
|
|
void CopyCreature(df::unit * source, t_unit & target);
|
|
|
|
|
|
|
|
|
|
bool ReadJob(const df::unit * unit, std::vector<t_material> & mat);
|
|
|
|
|
DFHACK_EXPORT df::unit * GetCreature(const int32_t index);
|
|
|
|
|
DFHACK_EXPORT void CopyCreature(df::unit * source, t_unit & target);
|
|
|
|
|
|
|
|
|
|
bool ReadInventoryByIdx(const uint32_t index, std::vector<df::item *> & item);
|
|
|
|
|
bool ReadInventoryByPtr(const df::unit * unit, std::vector<df::item *> & item);
|
|
|
|
|
DFHACK_EXPORT bool ReadJob(const df::unit * unit, std::vector<t_material> & mat);
|
|
|
|
|
|
|
|
|
|
bool ReadOwnedItemsByIdx(const uint32_t index, std::vector<int32_t> & item);
|
|
|
|
|
bool ReadOwnedItemsByPtr(const df::unit * unit, std::vector<int32_t> & item);
|
|
|
|
|
DFHACK_EXPORT bool ReadInventoryByIdx(const uint32_t index, std::vector<df::item *> & item);
|
|
|
|
|
DFHACK_EXPORT bool ReadInventoryByPtr(const df::unit * unit, std::vector<df::item *> & item);
|
|
|
|
|
|
|
|
|
|
int32_t FindIndexById(int32_t id);
|
|
|
|
|
DFHACK_EXPORT bool ReadOwnedItemsByIdx(const uint32_t index, std::vector<int32_t> & item);
|
|
|
|
|
DFHACK_EXPORT bool ReadOwnedItemsByPtr(const df::unit * unit, std::vector<int32_t> & item);
|
|
|
|
|
|
|
|
|
|
/* Getters */
|
|
|
|
|
uint32_t GetDwarfRaceIndex ( void );
|
|
|
|
|
int32_t GetDwarfCivId ( void );
|
|
|
|
|
DFHACK_EXPORT int32_t FindIndexById(int32_t id);
|
|
|
|
|
|
|
|
|
|
void CopyNameTo(df::unit *creature, df::language_name * target);
|
|
|
|
|
/* Getters */
|
|
|
|
|
DFHACK_EXPORT uint32_t GetDwarfRaceIndex ( void );
|
|
|
|
|
DFHACK_EXPORT int32_t GetDwarfCivId ( void );
|
|
|
|
|
|
|
|
|
|
bool RemoveOwnedItemByIdx(const uint32_t index, int32_t id);
|
|
|
|
|
bool RemoveOwnedItemByPtr(df::unit * unit, int32_t id);
|
|
|
|
|
DFHACK_EXPORT void CopyNameTo(df::unit *creature, df::language_name * target);
|
|
|
|
|
|
|
|
|
|
private:
|
|
|
|
|
struct Private;
|
|
|
|
|
Private *d;
|
|
|
|
|
};
|
|
|
|
|
DFHACK_EXPORT bool RemoveOwnedItemByIdx(const uint32_t index, int32_t id);
|
|
|
|
|
DFHACK_EXPORT bool RemoveOwnedItemByPtr(df::unit * unit, int32_t id);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
#endif
|
|
|
|
|