mirror of
https://github.com/EQEmu/Server.git
synced 2026-05-16 22:58:34 +00:00
[Quest API] Add EVENT_CRYSTAL_GAIN and EVENT_CRYSTAL_LOSS to Perl/Lua (#3735)
* [Quest API] Add EVENT_CRYSTAL_GAIN and EVENT_CRYSTAL_LOSS - Add `$client->AddEbonCrystals(amount)`. - Add `$client->AddRadiantCrystals(amount)`. - Add `$client->RemoveEbonCrystals(amount)`. - Add `$client->RemoveRadiantCrystals(amount)`. - Add `EVENT_CRYSTAL_GAIN`. - Add `EVENT_CRYSTAL_LOSS`. - Export `$ebon_amount`, `$radiant_amount`, and `$is_reclaim`. - Add `client:AddEbonCrystals(amount)`. - Add `client:AddRadiantCrystals(amount)`. - Add `client:RemoveEbonCrystals(amount)`. - Add `client:RemoveRadiantCrystals(amount)`. - Add `event_crystal_gain`. - Add `event_crystal_loss`. - Export `e.ebon_amount`, `e.radiant_amount`, and `e.is_reclaim`. - Allows operators to add or remove Ebon/Radiant Crystals directly. - Allows operators to track gain/loss of Ebon/Radiant Crystals. * Update perl_client.cpp * Update lua_client.cpp
This commit is contained in:
+78
-15
@@ -5727,26 +5727,89 @@ void Client::AddPVPPoints(uint32 Points)
|
||||
SendPVPStats();
|
||||
}
|
||||
|
||||
void Client::AddCrystals(uint32 radiant, uint32 ebon)
|
||||
{
|
||||
m_pp.currentRadCrystals += radiant;
|
||||
m_pp.careerRadCrystals += radiant;
|
||||
m_pp.currentEbonCrystals += ebon;
|
||||
m_pp.careerEbonCrystals += ebon;
|
||||
void Client::AddEbonCrystals(uint32 amount, bool is_reclaim) {
|
||||
m_pp.currentEbonCrystals += amount;
|
||||
m_pp.careerEbonCrystals += amount;
|
||||
|
||||
SaveCurrency();
|
||||
|
||||
SendCrystalCounts();
|
||||
|
||||
// newer clients handle message client side (older clients likely used eqstr 5967 and 5968, this matches live)
|
||||
if (radiant > 0)
|
||||
{
|
||||
MessageString(Chat::Yellow, YOU_RECEIVE, fmt::format("{} Radiant Crystals", radiant).c_str());
|
||||
}
|
||||
MessageString(
|
||||
Chat::Yellow,
|
||||
YOU_RECEIVE,
|
||||
fmt::format(
|
||||
"{} {}",
|
||||
amount,
|
||||
database.CreateItemLink(RuleI(Zone, EbonCrystalItemID))
|
||||
).c_str()
|
||||
);
|
||||
|
||||
if (ebon > 0)
|
||||
{
|
||||
MessageString(Chat::Yellow, YOU_RECEIVE, fmt::format("{} Ebon Crystals", ebon).c_str());
|
||||
if (parse->PlayerHasQuestSub(EVENT_CRYSTAL_GAIN)) {
|
||||
const std::string &export_string = fmt::format(
|
||||
"{} 0 {}",
|
||||
amount,
|
||||
is_reclaim ? 1 : 0
|
||||
);
|
||||
parse->EventPlayer(EVENT_CRYSTAL_GAIN, this, export_string, 0);
|
||||
}
|
||||
}
|
||||
|
||||
void Client::AddRadiantCrystals(uint32 amount, bool is_reclaim) {
|
||||
m_pp.currentRadCrystals += amount;
|
||||
m_pp.careerRadCrystals += amount;
|
||||
|
||||
SaveCurrency();
|
||||
SendCrystalCounts();
|
||||
|
||||
MessageString(
|
||||
Chat::Yellow,
|
||||
YOU_RECEIVE,
|
||||
fmt::format(
|
||||
"{} {}",
|
||||
amount,
|
||||
database.CreateItemLink(RuleI(Zone, RadiantCrystalItemID))
|
||||
).c_str()
|
||||
);
|
||||
|
||||
if (parse->PlayerHasQuestSub(EVENT_CRYSTAL_GAIN)) {
|
||||
const std::string &export_string = fmt::format(
|
||||
"0 {} {}",
|
||||
amount,
|
||||
is_reclaim ? 1 : 0
|
||||
);
|
||||
parse->EventPlayer(EVENT_CRYSTAL_GAIN, this, export_string, 0);
|
||||
}
|
||||
}
|
||||
|
||||
void Client::RemoveEbonCrystals(uint32 amount, bool is_reclaim) {
|
||||
m_pp.currentEbonCrystals -= amount;
|
||||
|
||||
SaveCurrency();
|
||||
SendCrystalCounts();
|
||||
|
||||
if (parse->PlayerHasQuestSub(EVENT_CRYSTAL_LOSS)) {
|
||||
const std::string &export_string = fmt::format(
|
||||
"{} 0 {}",
|
||||
amount,
|
||||
is_reclaim ? 1 : 0
|
||||
);
|
||||
parse->EventPlayer(EVENT_CRYSTAL_LOSS, this, export_string, 0);
|
||||
}
|
||||
}
|
||||
|
||||
void Client::RemoveRadiantCrystals(uint32 amount, bool is_reclaim) {
|
||||
m_pp.currentRadCrystals -= amount;
|
||||
|
||||
SaveCurrency();
|
||||
SendCrystalCounts();
|
||||
|
||||
if (parse->PlayerHasQuestSub(EVENT_CRYSTAL_LOSS)) {
|
||||
const std::string &export_string = fmt::format(
|
||||
"0 {} {}",
|
||||
amount,
|
||||
is_reclaim ? 1 : 0
|
||||
);
|
||||
parse->EventPlayer(EVENT_CRYSTAL_LOSS, this, export_string, 0);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user