introduce coloured loot message

This commit is contained in:
ErikasKontenis
2022-08-09 19:59:44 +03:00
parent 1c35d04337
commit eed5309ed0
11 changed files with 89 additions and 14 deletions

View File

@@ -155,8 +155,19 @@ std::ostringstream& Container::getContentDescription(std::ostringstream& os) con
} else {
os << ", ";
}
os << item->getNameDescription();
if (item->getCost() >= 50000) {
os << "[#BA90C7:" << item->getNameDescription() << "]";
}
else if (item->getCost() >= 15000) {
os << "[#F3E84A:" << item->getNameDescription() << "]";
}
else if (item->getCost() >= 1000) {
os << "[#629AC4:" << item->getNameDescription() << "]";
}
else {
os << item->getNameDescription();
}
}
if (firstitem) {

View File

@@ -1182,6 +1182,12 @@ std::string Item::getWeightDescription() const
return getWeightDescription(weight);
}
uint32_t Item::getCost() const
{
const ItemType& it = items[id];
return it.cost;
}
bool Item::canDecay() const
{
if (isRemoved()) {

View File

@@ -565,6 +565,7 @@ class Item : virtual public Thing
std::string getDescription(int32_t lookDistance) const final;
std::string getNameDescription() const;
std::string getWeightDescription() const;
uint32_t getCost() const;
//serialization
virtual Attr_ReadValue readAttr(AttrTypes_t attr, PropStream& propStream);

View File

@@ -423,6 +423,8 @@ bool Items::loadItems()
items[id].lightColor = script.readNumber();
} else if (identifier == "extrahitchance") {
items[id].extraHitChance = script.readNumber();
} else if (identifier == "cost") {
items[id].cost = script.readNumber();
} else if (identifier == "extraattack") {
items[id].extraAttack = script.readNumber();
} else if (identifier == "totalexpiretime") {

View File

@@ -208,6 +208,7 @@ class ItemType
uint32_t minReqLevel = 0;
uint32_t minReqMagicLevel = 0;
uint32_t charges = 0;
uint32_t cost = 0;
int32_t attackStrength = 0;
int32_t attackVariation = 0;
int32_t manaConsumption = 0;
@@ -222,7 +223,7 @@ class ItemType
int32_t runeLevel = 0;
int32_t nutrition = 0;
int32_t destroyTarget = 0;
CombatType_t combatType = COMBAT_NONE;
CombatType_t damageType = COMBAT_NONE;