fix issue that spell runes are no longer comulative

This commit is contained in:
ErikasKontenis 2020-01-13 22:11:17 +02:00
parent 3eaee10d1e
commit 7db3b3fc1f
8 changed files with 130 additions and 103 deletions

View File

@ -14129,282 +14129,282 @@ Attributes = {Weight=120}
TypeID = 3148 TypeID = 3148
Name = "a spell rune" Name = "a spell rune"
Flags = {MultiUse,DistUse,Rune,Take,Cumulative} Flags = {MultiUse,DistUse,Rune,Take}
Attributes = {Weight=120} Attributes = {Weight=120}
TypeID = 3149 TypeID = 3149
Name = "a spell rune" Name = "a spell rune"
Flags = {MultiUse,DistUse,Rune,Take,Cumulative} Flags = {MultiUse,DistUse,Rune,Take}
Attributes = {Weight=120} Attributes = {Weight=120}
TypeID = 3150 TypeID = 3150
Name = "a spell rune" Name = "a spell rune"
Flags = {MultiUse,DistUse,Rune,Take,Cumulative} Flags = {MultiUse,DistUse,Rune,Take}
Attributes = {Weight=120} Attributes = {Weight=120}
TypeID = 3151 TypeID = 3151
Name = "a spell rune" Name = "a spell rune"
Flags = {MultiUse,DistUse,Rune,Take,Cumulative} Flags = {MultiUse,DistUse,Rune,Take}
Attributes = {Weight=120} Attributes = {Weight=120}
TypeID = 3152 TypeID = 3152
Name = "a spell rune" Name = "a spell rune"
Flags = {MultiUse,DistUse,Rune,Take,Cumulative} Flags = {MultiUse,DistUse,Rune,Take}
Attributes = {Weight=120} Attributes = {Weight=120}
TypeID = 3153 TypeID = 3153
Name = "a spell rune" Name = "a spell rune"
Flags = {MultiUse,DistUse,Rune,Take,Cumulative} Flags = {MultiUse,DistUse,Rune,Take}
Attributes = {Weight=120} Attributes = {Weight=120}
TypeID = 3154 TypeID = 3154
Name = "a spell rune" Name = "a spell rune"
Flags = {MultiUse,DistUse,Rune,Take,Cumulative} Flags = {MultiUse,DistUse,Rune,Take}
Attributes = {Weight=120} Attributes = {Weight=120}
TypeID = 3155 TypeID = 3155
Name = "a spell rune" Name = "a spell rune"
Flags = {MultiUse,DistUse,Rune,Take,Cumulative} Flags = {MultiUse,DistUse,Rune,Take}
Attributes = {Weight=120} Attributes = {Weight=120}
TypeID = 3156 TypeID = 3156
Name = "a spell rune" Name = "a spell rune"
Flags = {MultiUse,DistUse,Rune,Take,Cumulative} Flags = {MultiUse,DistUse,Rune,Take}
Attributes = {Weight=120,Brightness=1,LightColor=215} Attributes = {Weight=120,Brightness=1,LightColor=215}
TypeID = 3157 TypeID = 3157
Name = "a spell rune" Name = "a spell rune"
Flags = {MultiUse,DistUse,Rune,Take,Cumulative} Flags = {MultiUse,DistUse,Rune,Take}
Attributes = {Weight=120,Brightness=1,LightColor=215} Attributes = {Weight=120,Brightness=1,LightColor=215}
TypeID = 3158 TypeID = 3158
Name = "a spell rune" Name = "a spell rune"
Flags = {MultiUse,DistUse,Rune,Take,Cumulative} Flags = {MultiUse,DistUse,Rune,Take}
Attributes = {Weight=120,Brightness=1,LightColor=215} Attributes = {Weight=120,Brightness=1,LightColor=215}
TypeID = 3159 TypeID = 3159
Name = "a spell rune" Name = "a spell rune"
Flags = {MultiUse,DistUse,Rune,Take,Cumulative} Flags = {MultiUse,DistUse,Rune,Take}
Attributes = {Weight=120,Brightness=1,LightColor=215} Attributes = {Weight=120,Brightness=1,LightColor=215}
TypeID = 3160 TypeID = 3160
Name = "a spell rune" Name = "a spell rune"
Flags = {MultiUse,DistUse,Rune,Take,Cumulative} Flags = {MultiUse,DistUse,Rune,Take}
Attributes = {Weight=120,Brightness=1,LightColor=215} Attributes = {Weight=120,Brightness=1,LightColor=215}
TypeID = 3161 TypeID = 3161
Name = "a spell rune" Name = "a spell rune"
Flags = {MultiUse,DistUse,Rune,Take,Cumulative} Flags = {MultiUse,DistUse,Rune,Take}
Attributes = {Weight=120,Brightness=1,LightColor=215} Attributes = {Weight=120,Brightness=1,LightColor=215}
TypeID = 3162 TypeID = 3162
Name = "a spell rune" Name = "a spell rune"
Flags = {MultiUse,DistUse,Rune,Take,Cumulative} Flags = {MultiUse,DistUse,Rune,Take}
Attributes = {Weight=120,Brightness=1,LightColor=215} Attributes = {Weight=120,Brightness=1,LightColor=215}
TypeID = 3163 TypeID = 3163
Name = "a spell rune" Name = "a spell rune"
Flags = {MultiUse,DistUse,Rune,Take,Cumulative} Flags = {MultiUse,DistUse,Rune,Take}
Attributes = {Weight=120,Brightness=1,LightColor=215} Attributes = {Weight=120,Brightness=1,LightColor=215}
TypeID = 3164 TypeID = 3164
Name = "a spell rune" Name = "a spell rune"
Flags = {MultiUse,DistUse,Rune,Take,Cumulative} Flags = {MultiUse,DistUse,Rune,Take}
Attributes = {Weight=120,Brightness=1,LightColor=215} Attributes = {Weight=120,Brightness=1,LightColor=215}
TypeID = 3165 TypeID = 3165
Name = "a spell rune" Name = "a spell rune"
Flags = {MultiUse,DistUse,Rune,Take,Cumulative} Flags = {MultiUse,DistUse,Rune,Take}
Attributes = {Weight=120,Brightness=1,LightColor=215} Attributes = {Weight=120,Brightness=1,LightColor=215}
TypeID = 3166 TypeID = 3166
Name = "a spell rune" Name = "a spell rune"
Flags = {MultiUse,DistUse,Rune,Take,Cumulative} Flags = {MultiUse,DistUse,Rune,Take}
Attributes = {Weight=120,Brightness=1,LightColor=215} Attributes = {Weight=120,Brightness=1,LightColor=215}
TypeID = 3167 TypeID = 3167
Name = "a spell rune" Name = "a spell rune"
Flags = {MultiUse,DistUse,Rune,Take,Cumulative} Flags = {MultiUse,DistUse,Rune,Take}
Attributes = {Weight=120,Brightness=1,LightColor=215} Attributes = {Weight=120,Brightness=1,LightColor=215}
TypeID = 3168 TypeID = 3168
Name = "a spell rune" Name = "a spell rune"
Flags = {MultiUse,DistUse,Rune,Take,Cumulative} Flags = {MultiUse,DistUse,Rune,Take}
Attributes = {Weight=120,Brightness=1,LightColor=215} Attributes = {Weight=120,Brightness=1,LightColor=215}
TypeID = 3169 TypeID = 3169
Name = "a spell rune" Name = "a spell rune"
Flags = {MultiUse,DistUse,Rune,Take,Cumulative} Flags = {MultiUse,DistUse,Rune,Take}
Attributes = {Weight=120,Brightness=1,LightColor=215} Attributes = {Weight=120,Brightness=1,LightColor=215}
TypeID = 3170 TypeID = 3170
Name = "a spell rune" Name = "a spell rune"
Flags = {MultiUse,DistUse,Rune,Take,Cumulative} Flags = {MultiUse,DistUse,Rune,Take}
Attributes = {Weight=120,Brightness=1,LightColor=215} Attributes = {Weight=120,Brightness=1,LightColor=215}
TypeID = 3171 TypeID = 3171
Name = "a spell rune" Name = "a spell rune"
Flags = {MultiUse,DistUse,Rune,Take,Cumulative} Flags = {MultiUse,DistUse,Rune,Take}
Attributes = {Weight=120,Brightness=1,LightColor=215} Attributes = {Weight=120,Brightness=1,LightColor=215}
TypeID = 3172 TypeID = 3172
Name = "a spell rune" Name = "a spell rune"
Flags = {MultiUse,DistUse,Rune,Take,Cumulative} Flags = {MultiUse,DistUse,Rune,Take}
Attributes = {Weight=120} Attributes = {Weight=120}
TypeID = 3173 TypeID = 3173
Name = "a spell rune" Name = "a spell rune"
Flags = {MultiUse,DistUse,Rune,Take,Cumulative} Flags = {MultiUse,DistUse,Rune,Take}
Attributes = {Weight=120} Attributes = {Weight=120}
TypeID = 3174 TypeID = 3174
Name = "a spell rune" Name = "a spell rune"
Flags = {MultiUse,DistUse,Rune,Take,Cumulative} Flags = {MultiUse,DistUse,Rune,Take}
Attributes = {Weight=120} Attributes = {Weight=120}
TypeID = 3175 TypeID = 3175
Name = "a spell rune" Name = "a spell rune"
Flags = {MultiUse,DistUse,Rune,Take,Cumulative} Flags = {MultiUse,DistUse,Rune,Take}
Attributes = {Weight=120} Attributes = {Weight=120}
TypeID = 3176 TypeID = 3176
Name = "a spell rune" Name = "a spell rune"
Flags = {MultiUse,DistUse,Rune,Take,Cumulative} Flags = {MultiUse,DistUse,Rune,Take}
Attributes = {Weight=120} Attributes = {Weight=120}
TypeID = 3177 TypeID = 3177
Name = "a spell rune" Name = "a spell rune"
Flags = {MultiUse,DistUse,Rune,Take,Cumulative} Flags = {MultiUse,DistUse,Rune,Take}
Attributes = {Weight=120} Attributes = {Weight=120}
TypeID = 3178 TypeID = 3178
Name = "a spell rune" Name = "a spell rune"
Flags = {MultiUse,DistUse,Rune,Take,Cumulative} Flags = {MultiUse,DistUse,Rune,Take}
Attributes = {Weight=120} Attributes = {Weight=120}
TypeID = 3179 TypeID = 3179
Name = "a spell rune" Name = "a spell rune"
Flags = {MultiUse,DistUse,Rune,Take,Cumulative} Flags = {MultiUse,DistUse,Rune,Take}
Attributes = {Weight=120} Attributes = {Weight=120}
TypeID = 3180 TypeID = 3180
Name = "a spell rune" Name = "a spell rune"
Flags = {MultiUse,DistUse,Rune,Take,Cumulative} Flags = {MultiUse,DistUse,Rune,Take}
Attributes = {Weight=120,Brightness=2,LightColor=215} Attributes = {Weight=120,Brightness=2,LightColor=215}
TypeID = 3181 TypeID = 3181
Name = "a spell rune" Name = "a spell rune"
Flags = {MultiUse,DistUse,Rune,Take,Cumulative} Flags = {MultiUse,DistUse,Rune,Take}
Attributes = {Weight=120,Brightness=2,LightColor=215} Attributes = {Weight=120,Brightness=2,LightColor=215}
TypeID = 3182 TypeID = 3182
Name = "a spell rune" Name = "a spell rune"
Flags = {MultiUse,DistUse,Rune,Take,Cumulative} Flags = {MultiUse,DistUse,Rune,Take}
Attributes = {Weight=120,Brightness=2,LightColor=215} Attributes = {Weight=120,Brightness=2,LightColor=215}
TypeID = 3183 TypeID = 3183
Name = "a spell rune" Name = "a spell rune"
Flags = {MultiUse,DistUse,Rune,Take,Cumulative} Flags = {MultiUse,DistUse,Rune,Take}
Attributes = {Weight=120,Brightness=2,LightColor=215} Attributes = {Weight=120,Brightness=2,LightColor=215}
TypeID = 3184 TypeID = 3184
Name = "a spell rune" Name = "a spell rune"
Flags = {MultiUse,DistUse,Rune,Take,Cumulative} Flags = {MultiUse,DistUse,Rune,Take}
Attributes = {Weight=120,Brightness=2,LightColor=215} Attributes = {Weight=120,Brightness=2,LightColor=215}
TypeID = 3185 TypeID = 3185
Name = "a spell rune" Name = "a spell rune"
Flags = {MultiUse,DistUse,Rune,Take,Cumulative} Flags = {MultiUse,DistUse,Rune,Take}
Attributes = {Weight=120,Brightness=2,LightColor=215} Attributes = {Weight=120,Brightness=2,LightColor=215}
TypeID = 3186 TypeID = 3186
Name = "a spell rune" Name = "a spell rune"
Flags = {MultiUse,DistUse,Rune,Take,Cumulative} Flags = {MultiUse,DistUse,Rune,Take}
Attributes = {Weight=120,Brightness=2,LightColor=215} Attributes = {Weight=120,Brightness=2,LightColor=215}
TypeID = 3187 TypeID = 3187
Name = "a spell rune" Name = "a spell rune"
Flags = {MultiUse,DistUse,Rune,Take,Cumulative} Flags = {MultiUse,DistUse,Rune,Take}
Attributes = {Weight=120,Brightness=2,LightColor=215} Attributes = {Weight=120,Brightness=2,LightColor=215}
TypeID = 3188 TypeID = 3188
Name = "a spell rune" Name = "a spell rune"
Flags = {MultiUse,DistUse,Rune,Take,Cumulative} Flags = {MultiUse,DistUse,Rune,Take}
Attributes = {Weight=120,Brightness=1,LightColor=215} Attributes = {Weight=120,Brightness=1,LightColor=215}
TypeID = 3189 TypeID = 3189
Name = "a spell rune" Name = "a spell rune"
Flags = {MultiUse,DistUse,Rune,Take,Cumulative} Flags = {MultiUse,DistUse,Rune,Take}
Attributes = {Weight=120,Brightness=1,LightColor=215} Attributes = {Weight=120,Brightness=1,LightColor=215}
TypeID = 3190 TypeID = 3190
Name = "a spell rune" Name = "a spell rune"
Flags = {MultiUse,DistUse,Rune,Take,Cumulative} Flags = {MultiUse,DistUse,Rune,Take}
Attributes = {Weight=120,Brightness=1,LightColor=215} Attributes = {Weight=120,Brightness=1,LightColor=215}
TypeID = 3191 TypeID = 3191
Name = "a spell rune" Name = "a spell rune"
Flags = {MultiUse,DistUse,Rune,Take,Cumulative} Flags = {MultiUse,DistUse,Rune,Take}
Attributes = {Weight=120,Brightness=1,LightColor=215} Attributes = {Weight=120,Brightness=1,LightColor=215}
TypeID = 3192 TypeID = 3192
Name = "a spell rune" Name = "a spell rune"
Flags = {MultiUse,DistUse,Rune,Take,Cumulative} Flags = {MultiUse,DistUse,Rune,Take}
Attributes = {Weight=120,Brightness=1,LightColor=215} Attributes = {Weight=120,Brightness=1,LightColor=215}
TypeID = 3193 TypeID = 3193
Name = "a spell rune" Name = "a spell rune"
Flags = {MultiUse,DistUse,Rune,Take,Cumulative} Flags = {MultiUse,DistUse,Rune,Take}
Attributes = {Weight=120,Brightness=1,LightColor=215} Attributes = {Weight=120,Brightness=1,LightColor=215}
TypeID = 3194 TypeID = 3194
Name = "a spell rune" Name = "a spell rune"
Flags = {MultiUse,DistUse,Rune,Take,Cumulative} Flags = {MultiUse,DistUse,Rune,Take}
Attributes = {Weight=120,Brightness=1,LightColor=215} Attributes = {Weight=120,Brightness=1,LightColor=215}
TypeID = 3195 TypeID = 3195
Name = "a spell rune" Name = "a spell rune"
Flags = {MultiUse,DistUse,Rune,Take,Cumulative} Flags = {MultiUse,DistUse,Rune,Take}
Attributes = {Weight=120,Brightness=1,LightColor=215} Attributes = {Weight=120,Brightness=1,LightColor=215}
TypeID = 3196 TypeID = 3196
Name = "a spell rune" Name = "a spell rune"
Flags = {MultiUse,DistUse,Rune,Take,Cumulative} Flags = {MultiUse,DistUse,Rune,Take}
Attributes = {Weight=120,Brightness=1,LightColor=215} Attributes = {Weight=120,Brightness=1,LightColor=215}
TypeID = 3197 TypeID = 3197
Name = "a spell rune" Name = "a spell rune"
Flags = {MultiUse,DistUse,Rune,Take,Cumulative} Flags = {MultiUse,DistUse,Rune,Take}
Attributes = {Weight=120,Brightness=1,LightColor=215} Attributes = {Weight=120,Brightness=1,LightColor=215}
TypeID = 3198 TypeID = 3198
Name = "a spell rune" Name = "a spell rune"
Flags = {MultiUse,DistUse,Rune,Take,Cumulative} Flags = {MultiUse,DistUse,Rune,Take}
Attributes = {Weight=120,Brightness=1,LightColor=215} Attributes = {Weight=120,Brightness=1,LightColor=215}
TypeID = 3199 TypeID = 3199
Name = "a spell rune" Name = "a spell rune"
Flags = {MultiUse,DistUse,Rune,Take,Cumulative} Flags = {MultiUse,DistUse,Rune,Take}
Attributes = {Weight=120,Brightness=1,LightColor=215} Attributes = {Weight=120,Brightness=1,LightColor=215}
TypeID = 3200 TypeID = 3200
Name = "a spell rune" Name = "a spell rune"
Flags = {MultiUse,DistUse,Rune,Take,Cumulative} Flags = {MultiUse,DistUse,Rune,Take}
Attributes = {Weight=120,Brightness=1,LightColor=215} Attributes = {Weight=120,Brightness=1,LightColor=215}
TypeID = 3201 TypeID = 3201
Name = "a spell rune" Name = "a spell rune"
Flags = {MultiUse,DistUse,Rune,Take,Cumulative} Flags = {MultiUse,DistUse,Rune,Take}
Attributes = {Weight=120,Brightness=1,LightColor=215} Attributes = {Weight=120,Brightness=1,LightColor=215}
TypeID = 3202 TypeID = 3202
Name = "a spell rune" Name = "a spell rune"
Flags = {MultiUse,DistUse,Rune,Take,Cumulative} Flags = {MultiUse,DistUse,Rune,Take}
Attributes = {Weight=120,Brightness=1,LightColor=215} Attributes = {Weight=120,Brightness=1,LightColor=215}
TypeID = 3203 TypeID = 3203
Name = "a spell rune" Name = "a spell rune"
Flags = {MultiUse,DistUse,Rune,Take,Cumulative} Flags = {MultiUse,DistUse,Rune,Take}
Attributes = {Weight=120,Brightness=1,LightColor=215} Attributes = {Weight=120,Brightness=1,LightColor=215}
TypeID = 3204 TypeID = 3204

View File

@ -837,7 +837,7 @@ void BehaviourDatabase::checkAction(const NpcBehaviourAction* action, Player* pl
int32_t itemId = evaluate(action->expression, player, message); int32_t itemId = evaluate(action->expression, player, message);
const ItemType& it = Item::items[itemId]; const ItemType& it = Item::items[itemId];
if (it.stackable && !it.isRune()) { if (it.stackable) {
do { do {
int32_t count = std::min<int32_t>(100, amount); int32_t count = std::min<int32_t>(100, amount);
amount -= count; amount -= count;

View File

@ -326,7 +326,7 @@ ReturnValue Container::queryMaxCount(int32_t index, const Thing& thing, uint32_t
} }
} else { } else {
const Item* destItem = getItemByIndex(index); const Item* destItem = getItemByIndex(index);
if (item->equals(destItem) && !destItem->isRune() && destItem->getItemCount() < 100) { if (item->equals(destItem) && destItem->getItemCount() < 100) {
uint32_t remainder = 100 - destItem->getItemCount(); uint32_t remainder = 100 - destItem->getItemCount();
if (queryAdd(index, *item, remainder, flags) == RETURNVALUE_NOERROR) { if (queryAdd(index, *item, remainder, flags) == RETURNVALUE_NOERROR) {
n = remainder; n = remainder;

View File

@ -1019,11 +1019,11 @@ void Game::playerMoveItem(Player* player, const Position& fromPos,
} }
} }
ReturnValue ret = internalMoveItem(fromCylinder, toCylinder, toIndex, item, item->isRune() ? item->getItemCount() : count, nullptr, 0, player); ReturnValue ret = internalMoveItem(fromCylinder, toCylinder, toIndex, item, count, nullptr, 0, player);
if (ret != RETURNVALUE_NOERROR) { if (ret != RETURNVALUE_NOERROR) {
player->sendCancelMessage(ret); player->sendCancelMessage(ret);
} else { } else {
g_events->eventPlayerOnItemMoved(player, item, item->isRune() ? item->getItemCount() : count, fromPos, toPos, fromCylinder, toCylinder); g_events->eventPlayerOnItemMoved(player, item, count, fromPos, toPos, fromCylinder, toCylinder);
} }
} }
@ -1097,12 +1097,7 @@ ReturnValue Game::internalMoveItem(Cylinder* fromCylinder, Cylinder* toCylinder,
uint32_t m; uint32_t m;
if (item->isStackable()) { if (item->isStackable()) {
if (item->isRune()) { m = std::min<uint32_t>(count, maxQueryCount);
m = std::min<uint32_t>(item->getItemCount(), maxQueryCount);
}
else {
m = std::min<uint32_t>(count, maxQueryCount);
}
} }
else { else {
m = maxQueryCount; m = maxQueryCount;
@ -1140,7 +1135,7 @@ ReturnValue Game::internalMoveItem(Cylinder* fromCylinder, Cylinder* toCylinder,
if (item->isStackable()) { if (item->isStackable()) {
uint32_t n; uint32_t n;
if (!item->isRune() && item->equals(toItem)) { if (item->equals(toItem)) {
n = std::min<uint32_t>(100 - toItem->getItemCount(), m); n = std::min<uint32_t>(100 - toItem->getItemCount(), m);
toCylinder->updateThing(toItem, toItem->getID(), toItem->getItemCount() + n); toCylinder->updateThing(toItem, toItem->getID(), toItem->getItemCount() + n);
updateItem = toItem; updateItem = toItem;
@ -1240,7 +1235,7 @@ ReturnValue Game::internalAddItem(Cylinder* toCylinder, Item* item, int32_t inde
return RETURNVALUE_NOERROR; return RETURNVALUE_NOERROR;
} }
if (item->isStackable() && !item->isRune() && item->equals(toItem)) { if (item->isStackable() && item->equals(toItem)) {
uint32_t m = std::min<uint32_t>(item->getItemCount(), maxQueryCount); uint32_t m = std::min<uint32_t>(item->getItemCount(), maxQueryCount);
uint32_t n = std::min<uint32_t>(100 - toItem->getItemCount(), m); uint32_t n = std::min<uint32_t>(100 - toItem->getItemCount(), m);

View File

@ -823,7 +823,7 @@ bool Item::hasProperty(ITEMPROPERTY prop) const
uint32_t Item::getWeight() const uint32_t Item::getWeight() const
{ {
uint32_t weight = getBaseWeight(); uint32_t weight = getBaseWeight();
if (isStackable() && !isRune()) { if (isStackable()) {
return weight * std::max<uint32_t>(1, getItemCount()); return weight * std::max<uint32_t>(1, getItemCount());
} }
return weight; return weight;
@ -840,6 +840,8 @@ std::string Item::getDescription(const ItemType& it, int32_t lookDistance,
} }
if (it.isRune()) { if (it.isRune()) {
uint32_t charges = std::max(static_cast<uint32_t>(1), static_cast<uint32_t>(item == nullptr ? it.charges : item->getCharges()));
if (it.runeLevel > 0) { if (it.runeLevel > 0) {
s << " for level " << it.runeLevel; s << " for level " << it.runeLevel;
} }
@ -849,18 +851,21 @@ std::string Item::getDescription(const ItemType& it, int32_t lookDistance,
} }
s << " for magic level " << it.runeMagLevel; s << " for magic level " << it.runeMagLevel;
s << ". It's an \"" << it.runeSpellName << "\"-spell (" << subType << "x). "; s << ". It's an \"" << it.runeSpellName << "\"-spell (" << charges << "x). ";
} else if (it.isDoor() && item) { }
else if (it.isDoor() && item) {
if (item->hasAttribute(ITEM_ATTRIBUTE_DOORLEVEL)) { if (item->hasAttribute(ITEM_ATTRIBUTE_DOORLEVEL)) {
s << " for level " << item->getIntAttr(ITEM_ATTRIBUTE_DOORLEVEL); s << " for level " << item->getIntAttr(ITEM_ATTRIBUTE_DOORLEVEL);
} }
s << "."; s << ".";
} else if (it.weaponType != WEAPON_NONE) { }
else if (it.weaponType != WEAPON_NONE) {
if (it.weaponType == WEAPON_DISTANCE && it.ammoType != AMMO_NONE) { if (it.weaponType == WEAPON_DISTANCE && it.ammoType != AMMO_NONE) {
if (it.attack != 0) { if (it.attack != 0) {
s << ", Atk" << std::showpos << it.attack << std::noshowpos; s << ", Atk" << std::showpos << it.attack << std::noshowpos;
} }
} else if (it.weaponType != WEAPON_AMMO && it.weaponType != WEAPON_WAND && (it.attack != 0 || it.defense != 0)) { }
else if (it.weaponType != WEAPON_AMMO && it.weaponType != WEAPON_WAND && (it.attack != 0 || it.defense != 0)) {
s << " ("; s << " (";
if (it.attack != 0) { if (it.attack != 0) {
s << "Atk:" << static_cast<int>(it.attack); s << "Atk:" << static_cast<int>(it.attack);
@ -876,39 +881,49 @@ std::string Item::getDescription(const ItemType& it, int32_t lookDistance,
s << ")"; s << ")";
} }
s << "."; s << ".";
} else if (it.armor != 0) { }
else if (it.armor != 0) {
if (it.charges > 0) { if (it.charges > 0) {
if (subType > 1) { if (subType > 1) {
s << " that has " << static_cast<int32_t>(subType) << " charges left"; s << " that has " << static_cast<int32_t>(subType) << " charges left";
} else { }
else {
s << " that has " << it.charges << " charge left"; s << " that has " << it.charges << " charge left";
} }
} }
s << " (Arm:" << it.armor << ")."; s << " (Arm:" << it.armor << ").";
} else if (it.isFluidContainer()) { }
else if (it.isFluidContainer()) {
if (item && item->getFluidType() != 0) { if (item && item->getFluidType() != 0) {
s << " of " << items[item->getFluidType()].name << "."; s << " of " << items[item->getFluidType()].name << ".";
} else { }
else {
s << ". It is empty."; s << ". It is empty.";
} }
} else if (it.isSplash()) { }
else if (it.isSplash()) {
s << " of "; s << " of ";
if (item && item->getFluidType() != 0) { if (item && item->getFluidType() != 0) {
s << items[item->getFluidType()].name; s << items[item->getFluidType()].name;
} else { }
else {
s << items[1].name; s << items[1].name;
} }
s << "."; s << ".";
} else if (it.isContainer() && !it.isChest()) { }
else if (it.isContainer() && !it.isChest()) {
s << " (Vol:" << static_cast<int>(it.maxItems) << ")."; s << " (Vol:" << static_cast<int>(it.maxItems) << ").";
} else if (it.isKey()) { }
else if (it.isKey()) {
if (item) { if (item) {
s << " (Key:" << static_cast<int>(item->getIntAttr(ITEM_ATTRIBUTE_KEYNUMBER)) << ")."; s << " (Key:" << static_cast<int>(item->getIntAttr(ITEM_ATTRIBUTE_KEYNUMBER)) << ").";
} else { }
else {
s << " (Key:0)."; s << " (Key:0).";
} }
} else if (it.allowDistRead) { }
else if (it.allowDistRead) {
s << "."; s << ".";
s << std::endl; s << std::endl;
@ -922,39 +937,49 @@ std::string Item::getDescription(const ItemType& it, int32_t lookDistance,
s << " on " << formatDateShort(date); s << " on " << formatDateShort(date);
} }
s << ": "; s << ": ";
} else { }
else {
s << "You read: "; s << "You read: ";
} }
s << item->getText(); s << item->getText();
} else { }
else {
s << "You are too far away to read it."; s << "You are too far away to read it.";
} }
} else { }
else {
s << "Nothing is written on it."; s << "Nothing is written on it.";
} }
} else if (it.charges > 0) { }
else if (it.charges > 0) {
uint32_t charges = (item == nullptr ? it.charges : item->getCharges()); uint32_t charges = (item == nullptr ? it.charges : item->getCharges());
if (charges > 1) { if (charges > 1) {
s << " that has " << static_cast<int>(charges) << " charges left."; s << " that has " << static_cast<int>(charges) << " charges left.";
} else { }
else {
s << " that has 1 charge left."; s << " that has 1 charge left.";
} }
} else if (it.showDuration) { }
else if (it.showDuration) {
if (item && item->hasAttribute(ITEM_ATTRIBUTE_DURATION)) { if (item && item->hasAttribute(ITEM_ATTRIBUTE_DURATION)) {
int32_t duration = item->getDuration() / 1000; int32_t duration = item->getDuration() / 1000;
s << " that has energy for "; s << " that has energy for ";
if (duration >= 120) { if (duration >= 120) {
s << duration / 60 << " minutes left."; s << duration / 60 << " minutes left.";
} else if (duration > 60) { }
else if (duration > 60) {
s << "1 minute left."; s << "1 minute left.";
} else { }
else {
s << "less than a minute left."; s << "less than a minute left.";
} }
} else { }
else {
s << " that is brand-new."; s << " that is brand-new.";
} }
} else { }
else {
s << "."; s << ".";
} }
@ -967,7 +992,8 @@ std::string Item::getDescription(const ItemType& it, int32_t lookDistance,
if (it.wieldInfo & WIELDINFO_VOCREQ) { if (it.wieldInfo & WIELDINFO_VOCREQ) {
s << it.vocationString; s << it.vocationString;
} else { }
else {
s << "players"; s << "players";
} }
@ -978,7 +1004,8 @@ std::string Item::getDescription(const ItemType& it, int32_t lookDistance,
if (it.wieldInfo & WIELDINFO_MAGLV) { if (it.wieldInfo & WIELDINFO_MAGLV) {
if (it.wieldInfo & WIELDINFO_LEVEL) { if (it.wieldInfo & WIELDINFO_LEVEL) {
s << " and"; s << " and";
} else { }
else {
s << " of"; s << " of";
} }
@ -997,7 +1024,8 @@ std::string Item::getDescription(const ItemType& it, int32_t lookDistance,
if (item && item->getSpecialDescription() != "") { if (item && item->getSpecialDescription() != "") {
s << std::endl << item->getSpecialDescription().c_str(); s << std::endl << item->getSpecialDescription().c_str();
} else if (it.description.length() && lookDistance <= 1) { }
else if (it.description.length() && lookDistance <= 1) {
s << std::endl << it.description << "."; s << std::endl << it.description << ".";
} }
@ -1020,13 +1048,14 @@ std::string Item::getNameDescription(const ItemType& it, const Item* item /*= nu
const std::string& name = (item ? item->getName() : it.name); const std::string& name = (item ? item->getName() : it.name);
if (!name.empty()) { if (!name.empty()) {
if (it.stackable && !it.isRune() && subType > 1) { if (it.stackable && subType > 1) {
if (it.showCount) { if (it.showCount) {
s << subType << ' '; s << subType << ' ';
} }
s << (item ? item->getPluralName() : it.getPluralName()); s << (item ? item->getPluralName() : it.getPluralName());
} else { }
else {
if (addArticle) { if (addArticle) {
const std::string& article = (item ? item->getArticle() : it.article); const std::string& article = (item ? item->getArticle() : it.article);
if (!article.empty()) { if (!article.empty()) {
@ -1036,7 +1065,8 @@ std::string Item::getNameDescription(const ItemType& it, const Item* item /*= nu
s << name; s << name;
} }
} else { }
else {
s << "an item of type " << it.id; s << "an item of type " << it.id;
} }
return s.str(); return s.str();

View File

@ -105,7 +105,7 @@ void NetworkMessage::addItem(uint16_t id, uint8_t count)
add<uint16_t>(it.id); add<uint16_t>(it.id);
} }
if (it.stackable) { if (it.stackable || it.isRune()) {
addByte(count); addByte(count);
} else if (it.isSplash() || it.isFluidContainer()) { } else if (it.isSplash() || it.isFluidContainer()) {
addByte(getLiquidColor(count)); addByte(getLiquidColor(count));
@ -124,6 +124,8 @@ void NetworkMessage::addItem(const Item* item)
if (it.stackable) { if (it.stackable) {
addByte(std::min<uint16_t>(0xFF, item->getItemCount())); addByte(std::min<uint16_t>(0xFF, item->getItemCount()));
} else if (it.isRune()) {
addByte(std::min<uint16_t>(0xFF, item->getCharges()));
} else if (it.isSplash() || it.isFluidContainer()) { } else if (it.isSplash() || it.isFluidContainer()) {
addByte(getLiquidColor(item->getFluidType())); addByte(getLiquidColor(item->getFluidType()));
} }

View File

@ -2138,7 +2138,7 @@ ReturnValue Player::queryAdd(int32_t index, const Thing& thing, uint32_t count,
if (ret == RETURNVALUE_NOERROR || ret == RETURNVALUE_NOTENOUGHROOM) { if (ret == RETURNVALUE_NOERROR || ret == RETURNVALUE_NOTENOUGHROOM) {
//need an exchange with source? //need an exchange with source?
const Item* inventoryItem = getInventoryItem(static_cast<slots_t>(index)); const Item* inventoryItem = getInventoryItem(static_cast<slots_t>(index));
if (inventoryItem && (!inventoryItem->isStackable() || inventoryItem->isRune() || inventoryItem->getID() != item->getID())) { if (inventoryItem && (!inventoryItem->isStackable() || inventoryItem->getID() != item->getID())) {
return RETURNVALUE_NEEDEXCHANGE; return RETURNVALUE_NEEDEXCHANGE;
} }
@ -2207,7 +2207,7 @@ ReturnValue Player::queryMaxCount(int32_t index, const Thing& thing, uint32_t co
} }
if (destItem) { if (destItem) {
if (!destItem->isRune() && destItem->isStackable() && item->equals(destItem) && destItem->getItemCount() < 100) { if (destItem->isStackable() && item->equals(destItem) && destItem->getItemCount() < 100) {
maxQueryCount = 100 - destItem->getItemCount(); maxQueryCount = 100 - destItem->getItemCount();
} }
else { else {

View File

@ -1841,7 +1841,7 @@ bool RuneSpell::executeUse(Player* player, Item* item, const Position&, Thing* t
postCastSpell(player); postCastSpell(player);
if (hasCharges && item && g_config.getBoolean(ConfigManager::REMOVE_RUNE_CHARGES)) { if (hasCharges && item && g_config.getBoolean(ConfigManager::REMOVE_RUNE_CHARGES)) {
int32_t newCount = std::max<int32_t>(0, item->getItemCount() - 1); int32_t newCount = std::max<int32_t>(0, item->getCharges() - 1);
g_game.transformItem(item, item->getID(), newCount); g_game.transformItem(item, item->getID(), newCount);
} }
return true; return true;