Untitled
unknown
plain_text
a year ago
5.2 kB
23
Indexable
#if defined(NEW_ITEM_WATER)
case USE_AFFECT:
{
const uint32_t itemVnum = item->GetVnum();
auto it = MultipleAppliesElixirNS::g_elixir_collection.find(itemVnum);
if (it != MultipleAppliesElixirNS::g_elixir_collection.end())
{
// Item found in the elixir collection
const auto& affects = it->second;
bool anyAffectApplied = false;
for (const auto& affect : affects)
{
if (FindAffect(affect.type_, affect.apply_))
{
ChatPacket(CHAT_TYPE_INFO, LC_STRING("You already have this affect!"));
}
else
{
AddAffect(affect.type_, affect.apply_, affect.value_, 0, affect.duration, 0, false);
anyAffectApplied = true;
}
}
if (anyAffectApplied)
{
item->SetCount(item->GetCount() - 1);
}
} else {
#if defined(__LOOT_FILTER_SYSTEM__) && defined(__PREMIUM_LOOT_FILTER__)
if (item->GetValue(0) == AFFECT_LOOTING_SYSTEM)
{
CAffect* pkAff = FindAffect(AFFECT_LOOTING_SYSTEM);
long lDur = item->GetValue(3);
if (pkAff)
{
if (lDur > 0)
{
if (pkAff->lDuration > LONG_MAX - lDur)
return false;
}
else
{
sys_err("AFFECT_LOOTING_SYSTEM, lDur not a positive value.");
return false;
}
lDur += pkAff->lDuration;
RemoveAffect(pkAff);
ChatPacket(CHAT_TYPE_NOTICE, LC_STRING("Loot filter duration extended."));
}
else
{
ChatPacket(CHAT_TYPE_NOTICE, LC_STRING("Loot filter activated."));
}
AddAffect(AFFECT_LOOTING_SYSTEM, POINT_NONE, 0, AFF_NONE, lDur, 0, false);
item->SetCount(item->GetCount() - 1);
return true;
}
#endif
#if defined(__EXTENDED_BLEND_AFFECT__)
for (int i = AFFECT_ENERGY; i <= AFFECT_PENETRATE; ++i)
{
if (FindAffect(i, aApplyInfo[item->GetValue(1)].wPointType))
{
ChatPacket(CHAT_TYPE_INFO, LC_STRING("ÀÌ¹Ì È¿°ú°¡ °É·Á ÀÖ½À´Ï´Ù."));
return false;
}
}
#endif
if (FindAffect(item->GetValue(0), aApplyInfo[item->GetValue(1)].wPointType))
{
ChatPacket(CHAT_TYPE_INFO, LC_STRING("ÀÌ¹Ì È¿°ú°¡ °É·Á ÀÖ½À´Ï´Ù."));
}
else
{
AddAffect(item->GetValue(0), aApplyInfo[item->GetValue(1)].wPointType, item->GetValue(2), 0, item->GetValue(3), 0, false);
item->SetCount(item->GetCount() - 1);
}
}
}
break;
#else
case USE_AFFECT:
{
#if defined(__LOOT_FILTER_SYSTEM__) && defined(__PREMIUM_LOOT_FILTER__)
if (item->GetValue(0) == AFFECT_LOOTING_SYSTEM)
{
CAffect* pkAff = FindAffect(AFFECT_LOOTING_SYSTEM);
long lDur = item->GetValue(3);
if (pkAff)
{
if (lDur > 0)
{
if (pkAff->lDuration > LONG_MAX - lDur)
return false;
}
else
{
sys_err("AFFECT_LOOTING_SYSTEM, lDur not a positive value.");
return false;
}
lDur += pkAff->lDuration;
RemoveAffect(pkAff);
ChatPacket(CHAT_TYPE_NOTICE, LC_STRING("Loot filter duration extended."));
}
else
{
ChatPacket(CHAT_TYPE_NOTICE, LC_STRING("Loot filter activated."));
}
AddAffect(AFFECT_LOOTING_SYSTEM, POINT_NONE, 0, AFF_NONE, lDur, 0, false);
item->SetCount(item->GetCount() - 1);
return true;
}
#endif
#if defined(__EXTENDED_BLEND_AFFECT__)
for (int i = AFFECT_ENERGY; i <= AFFECT_PENETRATE; ++i)
{
if (FindAffect(i, aApplyInfo[item->GetValue(1)].wPointType))
{
ChatPacket(CHAT_TYPE_INFO, LC_STRING("ÀÌ¹Ì È¿°ú°¡ °É·Á ÀÖ½À´Ï´Ù."));
return false;
}
}
#endif
if (FindAffect(item->GetValue(0), aApplyInfo[item->GetValue(1)].wPointType))
{
ChatPacket(CHAT_TYPE_INFO, LC_STRING("ÀÌ¹Ì È¿°ú°¡ °É·Á ÀÖ½À´Ï´Ù."));
}
else
{
AddAffect(item->GetValue(0), aApplyInfo[item->GetValue(1)].wPointType, item->GetValue(2), 0, item->GetValue(3), 0, false);
item->SetCount(item->GetCount() - 1);
}
}
break;
#endif
#if defined(NEW_ITEM_WATER)
namespace MultipleAppliesElixirNS
{
elixir_collection_t g_elixir_collection = {
{927250, {
AffectInfo{AFFECT_POTION_BOOST, POINT_MOV_SPEED, 3, 60 * 10},
AffectInfo{AFFECT_POTION_BOOST, POINT_ST, 2, 60 * 10},
AffectInfo{AFFECT_POTION_BOOST, POINT_MAX_HP, 50, 60 * 10},
AffectInfo{AFFECT_POTION_BOOST, POINT_CRITICAL_PCT, 3, 60 * 10},
AffectInfo{AFFECT_POTION_BOOST, POINT_PENETRATE_PCT, 3, 60 * 10},
AffectInfo{AFFECT_POTION_BOOST, POINT_DEF_GRADE, 10, 60 * 10},
AffectInfo{AFFECT_POTION_BOOST, POINT_ATT_SPEED, 3, 60 * 10},
}},
};
}
#endif
#if defined(NEW_ITEM_WATER)
namespace MultipleAppliesElixirNS
{
struct AffectInfo
{
uint16_t type_;
uint8_t apply_;
uint16_t value_;
time_t duration;
};
using affect_collection = std::vector<AffectInfo>;
using elixir_collection_t = std::unordered_map<uint32_t, affect_collection>;
extern elixir_collection_t g_elixir_collection;
}
#endif
Editor is loading...
Leave a Comment