1
0

Fixed Formatting, Added DropChances and CanPickUpLoot attributes to Monsters

This commit is contained in:
TheJumper 2014-02-23 19:12:34 +01:00
parent 72dd48f7e7
commit 847aef898d
4 changed files with 17 additions and 10 deletions

View File

@ -86,6 +86,7 @@ cMonster::cMonster(const AString & a_ConfigName, eType a_MobType, const AString
, m_DropChanceChestplate(0.085)
, m_DropChanceLeggings(0.085)
, m_DropChanceBoots(0.085)
, m_CanPickUpLoot(true)
, m_SightDistance(25)
, m_BurnsInDaylight(false)
{

View File

@ -119,16 +119,18 @@ public:
void SetAttackDamage(int a_AttackDamage) { m_AttackDamage = a_AttackDamage; }
void SetSightDistance(int a_SightDistance) { m_SightDistance = a_SightDistance; }
float GetDropChanceWeapon() { return m_DropChanceWeapon; };
float GetDropChanceHelmet() { return m_DropChanceHelmet; };
float GetDropChanceChestplate() { return m_DropChanceChestplate; };
float GetDropChanceLeggings() { return m_DropChanceLeggings; };
float GetDropChanceBoots() { return m_DropChanceBoots; };
void SetDropChanceWeapon(float a_DropChanceWeapon) { m_DropChanceWeapon = a_DropChanceWeapon; };
void SetDropChanceHelmet(float a_DropChanceHelmet) { m_DropChanceHelmet = a_DropChanceHelmet; };
void SetDropChanceChestplate(float a_DropChanceChestplate) { m_DropChanceChestplate = a_DropChanceChestplate; };
void SetDropChanceLeggings(float a_DropChanceLeggings) { m_DropChanceLeggings = a_DropChanceLeggings; };
void SetDropChanceBoots(float a_DropChanceBoots) { m_DropChanceBoots = a_DropChanceBoots; };
float GetDropChanceWeapon() { return m_DropChanceWeapon; }
float GetDropChanceHelmet() { return m_DropChanceHelmet; }
float GetDropChanceChestplate() { return m_DropChanceChestplate; }
float GetDropChanceLeggings() { return m_DropChanceLeggings; }
float GetDropChanceBoots() { return m_DropChanceBoots; }
bool CanPickUpLoot() { return m_CanPickUpLoot; }
void SetDropChanceWeapon(float a_DropChanceWeapon) { m_DropChanceWeapon = a_DropChanceWeapon; }
void SetDropChanceHelmet(float a_DropChanceHelmet) { m_DropChanceHelmet = a_DropChanceHelmet; }
void SetDropChanceChestplate(float a_DropChanceChestplate) { m_DropChanceChestplate = a_DropChanceChestplate; }
void SetDropChanceLeggings(float a_DropChanceLeggings) { m_DropChanceLeggings = a_DropChanceLeggings; }
void SetDropChanceBoots(float a_DropChanceBoots) { m_DropChanceBoots = a_DropChanceBoots; }
void SetCanPickUpLoot(bool a_CanPickUpLoot) { m_CanPickUpLoot = a_CanPickUpLoot; }
/// Sets whether the mob burns in daylight. Only evaluated at next burn-decision tick
void SetBurnsInDaylight(bool a_BurnsInDaylight) { m_BurnsInDaylight = a_BurnsInDaylight; }
@ -237,6 +239,7 @@ protected:
float m_DropChanceChestplate;
float m_DropChanceLeggings;
float m_DropChanceBoots;
bool m_CanPickUpLoot;
void HandleDaylightBurning(cChunk & a_Chunk);
bool m_BurnsInDaylight;

View File

@ -416,6 +416,7 @@ void cNBTChunkSerializer::AddMonsterEntity(cMonster * a_Monster)
m_Writer.AddFloat("", a_Monster->GetDropChanceLeggings());
m_Writer.AddFloat("", a_Monster->GetDropChanceBoots());
m_Writer.EndList();
m_Writer.AddByte("CanPickUpLoot", (char)a_Monster->CanPickUpLoot());
switch (a_Monster->GetMobType())
{
case cMonster::mtBat:

View File

@ -2179,6 +2179,8 @@ bool cWSSAnvil::LoadMonsterBaseFromNBT(cMonster & a_Monster, const cParsedNBT &
a_Monster.SetDropChanceChestplate(DropChance[2]);
a_Monster.SetDropChanceLeggings(DropChance[3]);
a_Monster.SetDropChanceBoots(DropChance[4]);
bool CanPickUpLoot = (a_NBT.GetByte(a_NBT.FindChildByName(a_TagIdx, "CanPickUpLoot")) == 1);
a_Monster.SetCanPickUpLoot(CanPickUpLoot);
return true;
}