|
|
@ -66,21 +66,23 @@ Creatures::Creatures(APIPrivate* _d)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
memory_info * minfo = d->d->offset_descriptor;
|
|
|
|
memory_info * minfo = d->d->offset_descriptor;
|
|
|
|
Creatures2010::creature_offsets &creatures = d->creatures;
|
|
|
|
Creatures2010::creature_offsets &creatures = d->creatures;
|
|
|
|
creatures.creature_vector = minfo->getAddress ("creature_vector");
|
|
|
|
creatures.vector = minfo->getAddress ("creature_vector");
|
|
|
|
creatures.creature_pos_offset = minfo->getOffset ("creature_position");
|
|
|
|
creatures.pos_offset = minfo->getOffset ("creature_position");
|
|
|
|
creatures.creature_profession_offset = minfo->getOffset ("creature_profession");
|
|
|
|
creatures.profession_offset = minfo->getOffset ("creature_profession");
|
|
|
|
creatures.creature_custom_profession_offset = minfo->getOffset ("creature_custom_profession");
|
|
|
|
creatures.custom_profession_offset = minfo->getOffset ("creature_custom_profession");
|
|
|
|
creatures.creature_race_offset = minfo->getOffset ("creature_race");
|
|
|
|
creatures.race_offset = minfo->getOffset ("creature_race");
|
|
|
|
creatures.creature_flags1_offset = minfo->getOffset ("creature_flags1");
|
|
|
|
creatures.flags1_offset = minfo->getOffset ("creature_flags1");
|
|
|
|
creatures.creature_flags2_offset = minfo->getOffset ("creature_flags2");
|
|
|
|
creatures.flags2_offset = minfo->getOffset ("creature_flags2");
|
|
|
|
creatures.creature_name_offset = minfo->getOffset ("creature_name");
|
|
|
|
creatures.name_offset = minfo->getOffset ("creature_name");
|
|
|
|
creatures.creature_sex_offset = minfo->getOffset ("creature_sex");
|
|
|
|
creatures.sex_offset = minfo->getOffset ("creature_sex");
|
|
|
|
creatures.creature_id_offset = minfo->getOffset ("creature_id");
|
|
|
|
creatures.id_offset = minfo->getOffset ("creature_id");
|
|
|
|
creatures.creature_labors_offset = minfo->getOffset ("creature_labors");
|
|
|
|
creatures.labors_offset = minfo->getOffset ("creature_labors");
|
|
|
|
creatures.creature_happiness_offset = minfo->getOffset ("creature_happiness");
|
|
|
|
creatures.happiness_offset = minfo->getOffset ("creature_happiness");
|
|
|
|
creatures.creature_artifact_name_offset = minfo->getOffset("creature_artifact_name");
|
|
|
|
creatures.artifact_name_offset = minfo->getOffset("creature_artifact_name");
|
|
|
|
creatures.creature_soul_vector_offset = minfo->getOffset("creature_soul_vector");
|
|
|
|
creatures.soul_vector_offset = minfo->getOffset("creature_soul_vector");
|
|
|
|
|
|
|
|
creatures.default_soul_offset = minfo->getOffset("creature_default_soul");
|
|
|
|
|
|
|
|
creatures.physical_offset = minfo->getOffset("creature_physical");
|
|
|
|
|
|
|
|
creatures.mood_offset = minfo->getOffset("creature_mood");
|
|
|
|
// soul offsets
|
|
|
|
// soul offsets
|
|
|
|
creatures.soul_skills_vector_offset = minfo->getOffset("soul_skills_vector");
|
|
|
|
creatures.soul_skills_vector_offset = minfo->getOffset("soul_skills_vector");
|
|
|
|
|
|
|
|
|
|
|
@ -114,7 +116,7 @@ Creatures::~Creatures()
|
|
|
|
|
|
|
|
|
|
|
|
bool Creatures::Start( uint32_t &numcreatures )
|
|
|
|
bool Creatures::Start( uint32_t &numcreatures )
|
|
|
|
{
|
|
|
|
{
|
|
|
|
d->p_cre = new DfVector (d->d->p, d->creatures.creature_vector, 4);
|
|
|
|
d->p_cre = new DfVector (d->d->p, d->creatures.vector, 4);
|
|
|
|
d->Started = true;
|
|
|
|
d->Started = true;
|
|
|
|
numcreatures = d->p_cre->getSize();
|
|
|
|
numcreatures = d->p_cre->getSize();
|
|
|
|
return true;
|
|
|
|
return true;
|
|
|
@ -150,26 +152,37 @@ bool Creatures::ReadCreature (const int32_t index, t_creature & furball)
|
|
|
|
uint32_t temp = * (uint32_t *) d->p_cre->at (index);
|
|
|
|
uint32_t temp = * (uint32_t *) d->p_cre->at (index);
|
|
|
|
furball.origin = temp;
|
|
|
|
furball.origin = temp;
|
|
|
|
Creatures2010::creature_offsets &offs = d->creatures;
|
|
|
|
Creatures2010::creature_offsets &offs = d->creatures;
|
|
|
|
|
|
|
|
|
|
|
|
//read creature from memory
|
|
|
|
//read creature from memory
|
|
|
|
g_pProcess->read (temp + offs.creature_pos_offset, 3 * sizeof (uint16_t), (uint8_t *) & (furball.x)); // xyz really
|
|
|
|
|
|
|
|
g_pProcess->readDWord (temp + offs.creature_race_offset, furball.type);
|
|
|
|
// name
|
|
|
|
g_pProcess->readDWord (temp + offs.creature_flags1_offset, furball.flags1.whole);
|
|
|
|
d->d->readName(furball.name,temp + offs.name_offset);
|
|
|
|
g_pProcess->readDWord (temp + offs.creature_flags2_offset, furball.flags2.whole);
|
|
|
|
|
|
|
|
// names
|
|
|
|
// basic stuff
|
|
|
|
d->d->readName(furball.name,temp + offs.creature_name_offset);
|
|
|
|
g_pProcess->readDWord (temp + offs.happiness_offset, furball.happiness);
|
|
|
|
//d->readName(furball.squad_name, temp + offs.creature_squad_name_offset);
|
|
|
|
g_pProcess->readDWord (temp + offs.id_offset, furball.id);
|
|
|
|
d->d->readName(furball.artifact_name, temp + offs.creature_artifact_name_offset);
|
|
|
|
g_pProcess->read (temp + offs.pos_offset, 3 * sizeof (uint16_t), (uint8_t *) & (furball.x)); // xyz really
|
|
|
|
|
|
|
|
g_pProcess->readDWord (temp + offs.race_offset, furball.race);
|
|
|
|
|
|
|
|
g_pProcess->readByte (temp + offs.sex_offset, furball.sex);
|
|
|
|
|
|
|
|
g_pProcess->readDWord (temp + offs.flags1_offset, furball.flags1.whole);
|
|
|
|
|
|
|
|
g_pProcess->readDWord (temp + offs.flags2_offset, furball.flags2.whole);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// physical attributes
|
|
|
|
|
|
|
|
g_pProcess->read(temp + offs.physical_offset, sizeof(t_attrib) * 6, (uint8_t *)&furball.strength);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// mood stuff
|
|
|
|
|
|
|
|
furball.mood = (int16_t) g_pProcess->readWord (temp + offs.mood_offset);
|
|
|
|
|
|
|
|
d->d->readName(furball.artifact_name, temp + offs.artifact_name_offset);
|
|
|
|
|
|
|
|
|
|
|
|
// custom profession
|
|
|
|
// custom profession
|
|
|
|
fill_char_buf (furball.custom_profession, g_pProcess->readSTLString (temp + offs.creature_custom_profession_offset));
|
|
|
|
fill_char_buf (furball.custom_profession, g_pProcess->readSTLString (temp + offs.custom_profession_offset));
|
|
|
|
|
|
|
|
|
|
|
|
// labors
|
|
|
|
// labors
|
|
|
|
g_pProcess->read (temp + offs.creature_labors_offset, NUM_CREATURE_LABORS, furball.labors);
|
|
|
|
g_pProcess->read (temp + offs.labors_offset, NUM_CREATURE_LABORS, furball.labors);
|
|
|
|
|
|
|
|
|
|
|
|
// traits
|
|
|
|
|
|
|
|
//g_pProcess->read (temp + offs.creature_traits_offset, sizeof (uint16_t) * NUM_CREATURE_TRAITS, (uint8_t *) &furball.traits);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// profession
|
|
|
|
// profession
|
|
|
|
furball.profession = g_pProcess->readByte (temp + offs.creature_profession_offset);
|
|
|
|
furball.profession = g_pProcess->readByte (temp + offs.profession_offset);
|
|
|
|
|
|
|
|
|
|
|
|
// current job HACK: the job object isn't cleanly represented here
|
|
|
|
// current job HACK: the job object isn't cleanly represented here
|
|
|
|
/*
|
|
|
|
/*
|
|
|
|
uint32_t jobIdAddr = g_pProcess->readDWord (temp + offs.creature_current_job_offset);
|
|
|
|
uint32_t jobIdAddr = g_pProcess->readDWord (temp + offs.creature_current_job_offset);
|
|
|
@ -183,51 +196,42 @@ bool Creatures::ReadCreature (const int32_t index, t_creature & furball)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
furball.current_job.active = false;
|
|
|
|
furball.current_job.active = false;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
*/
|
|
|
|
*/
|
|
|
|
//likes
|
|
|
|
|
|
|
|
/*
|
|
|
|
|
|
|
|
DfVector likes(d->p, temp + offs.creature_likes_offset, 4);
|
|
|
|
|
|
|
|
furball.numLikes = likes.getSize();
|
|
|
|
|
|
|
|
for(uint32_t i = 0;i<furball.numLikes;i++)
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
uint32_t temp2 = *(uint32_t *) likes[i];
|
|
|
|
|
|
|
|
g_pProcess->read(temp2,sizeof(t_like),(uint8_t *) &furball.likes[i]);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
furball.mood = (int16_t) g_pProcess->readWord (temp + offs.creature_mood_offset);
|
|
|
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
g_pProcess->readDWord (temp + offs.creature_happiness_offset, furball.happiness);
|
|
|
|
|
|
|
|
g_pProcess->readDWord (temp + offs.creature_id_offset, furball.id);
|
|
|
|
|
|
|
|
/*
|
|
|
|
/*
|
|
|
|
g_pProcess->readDWord (temp + offs.creature_agility_offset, furball.agility);
|
|
|
|
g_pProcess->readDWord(temp + offs.creature_pregnancy_offset, furball.pregnancy_timer);
|
|
|
|
g_pProcess->readDWord (temp + offs.creature_strength_offset, furball.strength);
|
|
|
|
|
|
|
|
g_pProcess->readDWord (temp + offs.creature_toughness_offset, furball.toughness);
|
|
|
|
|
|
|
|
g_pProcess->readDWord (temp + offs.creature_money_offset, furball.money);
|
|
|
|
|
|
|
|
furball.squad_leader_id = (int32_t) g_pProcess->readDWord (temp + offs.creature_squad_leader_id_offset);
|
|
|
|
|
|
|
|
*/
|
|
|
|
*/
|
|
|
|
g_pProcess->readByte (temp + offs.creature_sex_offset, furball.sex);
|
|
|
|
|
|
|
|
/*
|
|
|
|
|
|
|
|
g_pProcess->readDWord(temp + offs.creature_pregnancy_offset, furball.pregnancy_timer);
|
|
|
|
|
|
|
|
furball.blood_max = (int32_t) g_pProcess->readDWord(temp + offs.creature_blood_max_offset);
|
|
|
|
|
|
|
|
furball.blood_current = (int32_t) g_pProcess->readDWord(temp + offs.creature_blood_current_offset);
|
|
|
|
|
|
|
|
g_pProcess->readDWord(temp + offs.creature_bleed_offset, furball.bleed_rate);
|
|
|
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/*
|
|
|
|
// enum soul pointer vector
|
|
|
|
// enum soul pointer vector
|
|
|
|
DfVector souls(g_pProcess,temp + offs.creature_soul_vector_offset,4);
|
|
|
|
DfVector souls(g_pProcess,temp + offs.creature_soul_vector_offset,4);
|
|
|
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
uint32_t soul = g_pProcess->readDWord(temp + offs.default_soul_offset);
|
|
|
|
// get first soul's skills
|
|
|
|
// get first soul's skills
|
|
|
|
DfVector skills(g_pProcess, *(uint32_t *)souls.at(0) + offs.soul_skills_vector_offset,4 );
|
|
|
|
DfVector skills(g_pProcess, soul + offs.soul_skills_vector_offset, 4 );
|
|
|
|
furball.numSkills = skills.getSize();
|
|
|
|
furball.numSkills = skills.getSize();
|
|
|
|
for (uint32_t i = 0; i < furball.numSkills;i++)
|
|
|
|
for (uint32_t i = 0; i < furball.numSkills;i++)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
uint32_t temp2 = * (uint32_t *) skills[i];
|
|
|
|
uint32_t temp2 = * (uint32_t *) skills[i];
|
|
|
|
//skills.read(i, (uint8_t *) &temp2);
|
|
|
|
|
|
|
|
// a byte: this gives us 256 skills maximum.
|
|
|
|
// a byte: this gives us 256 skills maximum.
|
|
|
|
furball.skills[i].id = g_pProcess->readByte (temp2);
|
|
|
|
furball.skills[i].id = g_pProcess->readByte (temp2);
|
|
|
|
furball.skills[i].rating = g_pProcess->readByte (temp2 + 4);
|
|
|
|
furball.skills[i].rating = g_pProcess->readByte (temp2 + 4);
|
|
|
|
furball.skills[i].experience = g_pProcess->readWord (temp2 + 8);
|
|
|
|
furball.skills[i].experience = g_pProcess->readWord (temp2 + 8);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// traits
|
|
|
|
|
|
|
|
//g_pProcess->read (temp + offs.creature_traits_offset, sizeof (uint16_t) * NUM_CREATURE_TRAITS, (uint8_t *) &furball.traits);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//likes
|
|
|
|
|
|
|
|
/*
|
|
|
|
|
|
|
|
DfVector likes(d->p, temp + offs.creature_likes_offset, 4);
|
|
|
|
|
|
|
|
furball.numLikes = likes.getSize();
|
|
|
|
|
|
|
|
for(uint32_t i = 0;i<furball.numLikes;i++)
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
uint32_t temp2 = *(uint32_t *) likes[i];
|
|
|
|
|
|
|
|
g_pProcess->read(temp2,sizeof(t_like),(uint8_t *) &furball.likes[i]);
|
|
|
|
|
|
|
|
}*/
|
|
|
|
|
|
|
|
|
|
|
|
return true;
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
@ -261,7 +265,7 @@ int32_t Creatures::ReadCreatureInBox (int32_t index, t_creature & furball,
|
|
|
|
{
|
|
|
|
{
|
|
|
|
// read pointer from vector at position
|
|
|
|
// read pointer from vector at position
|
|
|
|
uint32_t temp = * (uint32_t *) d->p_cre->at (index);
|
|
|
|
uint32_t temp = * (uint32_t *) d->p_cre->at (index);
|
|
|
|
g_pProcess->read (temp + d->creatures.creature_pos_offset, 3 * sizeof (uint16_t), (uint8_t *) &coords);
|
|
|
|
g_pProcess->read (temp + d->creatures.pos_offset, 3 * sizeof (uint16_t), (uint8_t *) &coords);
|
|
|
|
if (coords[0] >= x1 && coords[0] < x2)
|
|
|
|
if (coords[0] >= x1 && coords[0] < x2)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
if (coords[1] >= y1 && coords[1] < y2)
|
|
|
|
if (coords[1] >= y1 && coords[1] < y2)
|
|
|
@ -285,7 +289,7 @@ bool Creatures::WriteLabors(const uint32_t index, uint8_t labors[NUM_CREATURE_LA
|
|
|
|
{
|
|
|
|
{
|
|
|
|
if(!d->Started) return false;
|
|
|
|
if(!d->Started) return false;
|
|
|
|
uint32_t temp = * (uint32_t *) d->p_cre->at (index);
|
|
|
|
uint32_t temp = * (uint32_t *) d->p_cre->at (index);
|
|
|
|
g_pProcess->write(temp + d->creatures.creature_labors_offset, NUM_CREATURE_LABORS, labors);
|
|
|
|
g_pProcess->write(temp + d->creatures.labors_offset, NUM_CREATURE_LABORS, labors);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/*
|
|
|
|
/*
|
|
|
|