mirror of
https://github.com/EQEmu/Server.git
synced 2025-12-13 14:41:28 +00:00
[Money Messages] Cleanup quest::givecash(), split, and task reward messages. (#2205)
* [Money Messages] Cleanup quest::givecash(), split, and task reward messages. - Cleans up all the money messages using ConvertMoneyToString(). - Allows quest::givecash() to have optional parameters other than copper. * Commification. * Corpse messages. * String IDs and cleanup.
This commit is contained in:
parent
9e9ef6809b
commit
bcf7ccefcd
@ -1192,75 +1192,75 @@ std::string ConvertMoneyToString(uint32 platinum, uint32 gold, uint32 silver, ui
|
|||||||
if (copper && silver && gold && platinum) { // CSGP
|
if (copper && silver && gold && platinum) { // CSGP
|
||||||
money_string = fmt::format(
|
money_string = fmt::format(
|
||||||
"{} Platinum, {} Gold, {} Silver, and {} Copper",
|
"{} Platinum, {} Gold, {} Silver, and {} Copper",
|
||||||
platinum,
|
commify(std::to_string(platinum)),
|
||||||
gold,
|
commify(std::to_string(gold)),
|
||||||
silver,
|
commify(std::to_string(silver)),
|
||||||
copper
|
commify(std::to_string(copper))
|
||||||
);
|
);
|
||||||
} else if (copper && silver && gold && !platinum) { // CSG
|
} else if (copper && silver && gold && !platinum) { // CSG
|
||||||
money_string = fmt::format(
|
money_string = fmt::format(
|
||||||
"{} Gold, {} Silver, and {} Copper",
|
"{} Gold, {} Silver, and {} Copper",
|
||||||
gold,
|
commify(std::to_string(gold)),
|
||||||
silver,
|
commify(std::to_string(silver)),
|
||||||
copper
|
commify(std::to_string(copper))
|
||||||
);
|
);
|
||||||
} else if (copper && silver && !gold && !platinum) { // CS
|
} else if (copper && silver && !gold && !platinum) { // CS
|
||||||
money_string = fmt::format(
|
money_string = fmt::format(
|
||||||
"{} Silver and {} Copper",
|
"{} Silver and {} Copper",
|
||||||
silver,
|
commify(std::to_string(silver)),
|
||||||
copper
|
commify(std::to_string(copper))
|
||||||
);
|
);
|
||||||
} else if (!copper && silver && gold && platinum) { // SGP
|
} else if (!copper && silver && gold && platinum) { // SGP
|
||||||
money_string = fmt::format(
|
money_string = fmt::format(
|
||||||
"{} Platinum, {} Gold, and {} Silver",
|
"{} Platinum, {} Gold, and {} Silver",
|
||||||
platinum,
|
commify(std::to_string(platinum)),
|
||||||
gold,
|
commify(std::to_string(gold)),
|
||||||
silver
|
commify(std::to_string(silver))
|
||||||
);
|
);
|
||||||
} else if (!copper && silver && gold && !platinum) { // SG
|
} else if (!copper && silver && gold && !platinum) { // SG
|
||||||
money_string = fmt::format(
|
money_string = fmt::format(
|
||||||
"{} Gold and {} Silver",
|
"{} Gold and {} Silver",
|
||||||
gold,
|
commify(std::to_string(gold)),
|
||||||
silver
|
commify(std::to_string(silver))
|
||||||
);
|
);
|
||||||
} else if (copper && !silver && gold && platinum) { // CGP
|
} else if (copper && !silver && gold && platinum) { // CGP
|
||||||
money_string = fmt::format(
|
money_string = fmt::format(
|
||||||
"{} Platinum, {} Gold, and {} Copper",
|
"{} Platinum, {} Gold, and {} Copper",
|
||||||
platinum,
|
commify(std::to_string(platinum)),
|
||||||
gold,
|
commify(std::to_string(gold)),
|
||||||
copper
|
commify(std::to_string(copper))
|
||||||
);
|
);
|
||||||
} else if (copper && !silver && gold && !platinum) { // CG
|
} else if (copper && !silver && gold && !platinum) { // CG
|
||||||
money_string = fmt::format(
|
money_string = fmt::format(
|
||||||
"{} Gold and {} Copper",
|
"{} Gold and {} Copper",
|
||||||
gold,
|
commify(std::to_string(gold)),
|
||||||
copper
|
commify(std::to_string(copper))
|
||||||
);
|
);
|
||||||
} else if (!copper && !silver && gold && platinum) { // GP
|
} else if (!copper && !silver && gold && platinum) { // GP
|
||||||
money_string = fmt::format(
|
money_string = fmt::format(
|
||||||
"{} Platinum and {} Gold",
|
"{} Platinum and {} Gold",
|
||||||
platinum,
|
commify(std::to_string(platinum)),
|
||||||
gold
|
commify(std::to_string(gold))
|
||||||
);
|
);
|
||||||
} else if (!copper && !silver && !gold && platinum) { // P
|
} else if (!copper && !silver && !gold && platinum) { // P
|
||||||
money_string = fmt::format(
|
money_string = fmt::format(
|
||||||
"{} Platinum",
|
"{} Platinum",
|
||||||
platinum
|
commify(std::to_string(platinum))
|
||||||
);
|
);
|
||||||
} else if (!copper && !silver && gold && !platinum) { // G
|
} else if (!copper && !silver && gold && !platinum) { // G
|
||||||
money_string = fmt::format(
|
money_string = fmt::format(
|
||||||
"{} Gold",
|
"{} Gold",
|
||||||
gold
|
commify(std::to_string(gold))
|
||||||
);
|
);
|
||||||
} else if (!copper && silver && !gold && !platinum) { // S
|
} else if (!copper && silver && !gold && !platinum) { // S
|
||||||
money_string = fmt::format(
|
money_string = fmt::format(
|
||||||
"{} Silver",
|
"{} Silver",
|
||||||
silver
|
commify(std::to_string(silver))
|
||||||
);
|
);
|
||||||
} else if (copper && !silver && !gold && !platinum) { // C
|
} else if (copper && !silver && !gold && !platinum) { // C
|
||||||
money_string = fmt::format(
|
money_string = fmt::format(
|
||||||
"{} Copper",
|
"{} Copper",
|
||||||
copper
|
commify(std::to_string(copper))
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
return money_string;
|
return money_string;
|
||||||
|
|||||||
@ -1019,8 +1019,27 @@ void Corpse::MakeLootRequestPackets(Client* client, const EQApplicationPacket* a
|
|||||||
loot_coin = (tmp[0] == 1 && tmp[1] == '\0');
|
loot_coin = (tmp[0] == 1 && tmp[1] == '\0');
|
||||||
|
|
||||||
if (loot_request_type == LootRequestType::GMPeek || loot_request_type == LootRequestType::GMAllowed) {
|
if (loot_request_type == LootRequestType::GMPeek || loot_request_type == LootRequestType::GMAllowed) {
|
||||||
client->Message(Chat::Yellow, "This corpse contains %u platinum, %u gold, %u silver and %u copper.",
|
if (
|
||||||
GetPlatinum(), GetGold(), GetSilver(), GetCopper());
|
GetPlatinum() ||
|
||||||
|
GetGold() ||
|
||||||
|
GetSilver() ||
|
||||||
|
GetCopper()
|
||||||
|
) {
|
||||||
|
client->Message(
|
||||||
|
Chat::Yellow,
|
||||||
|
fmt::format(
|
||||||
|
"This corpse contains {}.",
|
||||||
|
ConvertMoneyToString(
|
||||||
|
GetPlatinum(),
|
||||||
|
GetGold(),
|
||||||
|
GetSilver(),
|
||||||
|
GetCopper()
|
||||||
|
)
|
||||||
|
).c_str()
|
||||||
|
);
|
||||||
|
} else {
|
||||||
|
client->Message(Chat::Yellow, "This corpse contains no money.");
|
||||||
|
}
|
||||||
|
|
||||||
auto outapp = new EQApplicationPacket(OP_MoneyOnCorpse, sizeof(moneyOnCorpseStruct));
|
auto outapp = new EQApplicationPacket(OP_MoneyOnCorpse, sizeof(moneyOnCorpseStruct));
|
||||||
moneyOnCorpseStruct* d = (moneyOnCorpseStruct*)outapp->pBuffer;
|
moneyOnCorpseStruct* d = (moneyOnCorpseStruct*)outapp->pBuffer;
|
||||||
@ -1505,13 +1524,12 @@ void Corpse::QueryLoot(Client* to) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
bool has_money = (
|
if (
|
||||||
platinum > 0 ||
|
platinum ||
|
||||||
gold > 0 ||
|
gold ||
|
||||||
silver > 0 ||
|
silver ||
|
||||||
copper > 0
|
copper
|
||||||
);
|
) {
|
||||||
if (has_money) {
|
|
||||||
to->Message(
|
to->Message(
|
||||||
Chat::White,
|
Chat::White,
|
||||||
fmt::format(
|
fmt::format(
|
||||||
|
|||||||
@ -1160,13 +1160,26 @@ XS(XS__untraindiscs) {
|
|||||||
XS(XS__givecash);
|
XS(XS__givecash);
|
||||||
XS(XS__givecash) {
|
XS(XS__givecash) {
|
||||||
dXSARGS;
|
dXSARGS;
|
||||||
if (items != 4)
|
if (items < 1 || items > 4) {
|
||||||
Perl_croak(aTHX_ "Usage: quest::givecash(int copper, int silver, int gold, int platinum)");
|
Perl_croak(aTHX_ "Usage: quest::givecash(uint32 copper, [uint32 silver = 0, uint32 gold = 0, uint32 platinum = 0])");
|
||||||
|
}
|
||||||
|
|
||||||
int copper = (int) SvIV(ST(0));
|
uint32 copper = (uint32) SvUV(ST(0));
|
||||||
int silver = (int) SvIV(ST(1));
|
uint32 silver = 0;
|
||||||
int gold = (int) SvIV(ST(2));
|
uint32 gold = 0;
|
||||||
int platinum = (int) SvIV(ST(3));
|
uint32 platinum = 0;
|
||||||
|
|
||||||
|
if (items > 1) {
|
||||||
|
silver = (uint32) SvUV(ST(1));
|
||||||
|
}
|
||||||
|
|
||||||
|
if (items > 2) {
|
||||||
|
gold = (uint32) SvUV(ST(2));
|
||||||
|
}
|
||||||
|
|
||||||
|
if (items > 3) {
|
||||||
|
platinum = (uint32) SvUV(ST(3));
|
||||||
|
}
|
||||||
|
|
||||||
quest_manager.givecash(copper, silver, gold, platinum);
|
quest_manager.givecash(copper, silver, gold, platinum);
|
||||||
|
|
||||||
|
|||||||
@ -35,7 +35,12 @@ void command_givemoney(Client *c, const Seperator *sep)
|
|||||||
Chat::White,
|
Chat::White,
|
||||||
fmt::format(
|
fmt::format(
|
||||||
"Added {} to {}.",
|
"Added {} to {}.",
|
||||||
ConvertMoneyToString(platinum, gold, silver, copper),
|
ConvertMoneyToString(
|
||||||
|
platinum,
|
||||||
|
gold,
|
||||||
|
silver,
|
||||||
|
copper
|
||||||
|
),
|
||||||
c->GetTargetDescription(target)
|
c->GetTargetDescription(target)
|
||||||
).c_str()
|
).c_str()
|
||||||
);
|
);
|
||||||
|
|||||||
125
zone/groups.cpp
125
zone/groups.cpp
@ -116,91 +116,76 @@ Group::~Group()
|
|||||||
//Split money used in OP_Split (/split and /autosplit).
|
//Split money used in OP_Split (/split and /autosplit).
|
||||||
void Group::SplitMoney(uint32 copper, uint32 silver, uint32 gold, uint32 platinum, Client *splitter) {
|
void Group::SplitMoney(uint32 copper, uint32 silver, uint32 gold, uint32 platinum, Client *splitter) {
|
||||||
//avoid unneeded work
|
//avoid unneeded work
|
||||||
if(copper == 0 && silver == 0 && gold == 0 && platinum == 0)
|
if (
|
||||||
|
!copper &&
|
||||||
|
!silver &&
|
||||||
|
!gold &&
|
||||||
|
!platinum
|
||||||
|
) {
|
||||||
return;
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
uint32 i;
|
uint8 member_count = 0;
|
||||||
uint8 membercount = 0;
|
for (uint32 i = 0; i < MAX_GROUP_MEMBERS; i++) {
|
||||||
for (i = 0; i < MAX_GROUP_MEMBERS; i++) {
|
|
||||||
// Don't split with Mercs or Bots
|
// Don't split with Mercs or Bots
|
||||||
if (members[i] != nullptr && members[i]->IsClient()) {
|
if (members[i] && members[i]->IsClient()) {
|
||||||
membercount++;
|
member_count++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (membercount == 0)
|
if (!member_count) {
|
||||||
return;
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
uint32 mod;
|
uint32 modifier;
|
||||||
//try to handle round off error a little better
|
if (member_count > 1) {
|
||||||
if(membercount > 1) {
|
modifier = platinum % member_count;
|
||||||
mod = platinum % membercount;
|
|
||||||
if((mod) > 0) {
|
if (modifier) {
|
||||||
platinum -= mod;
|
platinum -= modifier;
|
||||||
gold += 10 * mod;
|
gold += 10 * modifier;
|
||||||
}
|
}
|
||||||
mod = gold % membercount;
|
|
||||||
if((mod) > 0) {
|
modifier = gold % member_count;
|
||||||
gold -= mod;
|
|
||||||
silver += 10 * mod;
|
if (modifier) {
|
||||||
|
gold -= modifier;
|
||||||
|
silver += 10 * modifier;
|
||||||
}
|
}
|
||||||
mod = silver % membercount;
|
|
||||||
if((mod) > 0) {
|
modifier = silver % member_count;
|
||||||
silver -= mod;
|
|
||||||
copper += 10 * mod;
|
if (modifier) {
|
||||||
|
silver -= modifier;
|
||||||
|
copper += 10 * modifier;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
//calculate the splits
|
auto copper_split = copper / member_count;
|
||||||
//We can still round off copper pieces, but I dont care
|
auto silver_split = silver / member_count;
|
||||||
uint32 sc;
|
auto gold_split = gold / member_count;
|
||||||
uint32 cpsplit = copper / membercount;
|
auto platinum_split = platinum / member_count;
|
||||||
sc = copper % membercount;
|
|
||||||
uint32 spsplit = silver / membercount;
|
|
||||||
uint32 gpsplit = gold / membercount;
|
|
||||||
uint32 ppsplit = platinum / membercount;
|
|
||||||
|
|
||||||
char buf[128];
|
for (uint32 i = 0; i < MAX_GROUP_MEMBERS; i++) {
|
||||||
buf[63] = '\0';
|
if (members[i] && members[i]->IsClient()) { // If Group Member is Client
|
||||||
std::string msg = "You receive";
|
members[i]->CastToClient()->AddMoneyToPP(
|
||||||
bool one = false;
|
copper_split,
|
||||||
|
silver_split,
|
||||||
|
gold_split,
|
||||||
|
platinum_split,
|
||||||
|
true
|
||||||
|
);
|
||||||
|
|
||||||
if(ppsplit > 0) {
|
members[i]->CastToClient()->MessageString(
|
||||||
snprintf(buf, 63, " %u platinum", ppsplit);
|
Chat::MoneySplit,
|
||||||
msg += buf;
|
YOU_RECEIVE_AS_SPLIT,
|
||||||
one = true;
|
ConvertMoneyToString(
|
||||||
}
|
platinum_split,
|
||||||
if(gpsplit > 0) {
|
gold_split,
|
||||||
if(one)
|
silver_split,
|
||||||
msg += ",";
|
copper_split
|
||||||
snprintf(buf, 63, " %u gold", gpsplit);
|
).c_str()
|
||||||
msg += buf;
|
);
|
||||||
one = true;
|
|
||||||
}
|
|
||||||
if(spsplit > 0) {
|
|
||||||
if(one)
|
|
||||||
msg += ",";
|
|
||||||
snprintf(buf, 63, " %u silver", spsplit);
|
|
||||||
msg += buf;
|
|
||||||
one = true;
|
|
||||||
}
|
|
||||||
if(cpsplit > 0) {
|
|
||||||
if(one)
|
|
||||||
msg += ",";
|
|
||||||
//this message is not 100% accurate for the splitter
|
|
||||||
//if they are receiving any roundoff
|
|
||||||
snprintf(buf, 63, " %u copper", cpsplit);
|
|
||||||
msg += buf;
|
|
||||||
one = true;
|
|
||||||
}
|
|
||||||
msg += " as your split";
|
|
||||||
|
|
||||||
for (i = 0; i < MAX_GROUP_MEMBERS; i++) {
|
|
||||||
if (members[i] != nullptr && members[i]->IsClient()) { // If Group Member is Client
|
|
||||||
Client *c = members[i]->CastToClient();
|
|
||||||
//I could not get MoneyOnCorpse to work, so we use this
|
|
||||||
c->AddMoneyToPP(cpsplit, spsplit, gpsplit, ppsplit, true);
|
|
||||||
c->Message(Chat::Green, msg.c_str());
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
13
zone/npc.cpp
13
zone/npc.cpp
@ -693,13 +693,12 @@ void NPC::QueryLoot(Client* to, bool is_pet_query)
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (!is_pet_query) {
|
if (!is_pet_query) {
|
||||||
bool has_money = (
|
if (
|
||||||
platinum > 0 ||
|
platinum ||
|
||||||
gold > 0 ||
|
gold ||
|
||||||
silver > 0 ||
|
silver ||
|
||||||
copper > 0
|
copper
|
||||||
);
|
) {
|
||||||
if (has_money) {
|
|
||||||
to->Message(
|
to->Message(
|
||||||
Chat::White,
|
Chat::White,
|
||||||
fmt::format(
|
fmt::format(
|
||||||
|
|||||||
@ -1170,52 +1170,38 @@ void QuestManager::untraindiscs() {
|
|||||||
initiator->UntrainDiscAll();
|
initiator->UntrainDiscAll();
|
||||||
}
|
}
|
||||||
|
|
||||||
void QuestManager::givecash(int copper, int silver, int gold, int platinum) {
|
void QuestManager::givecash(uint32 copper, uint32 silver, uint32 gold, uint32 platinum) {
|
||||||
QuestManagerCurrentQuestVars();
|
QuestManagerCurrentQuestVars();
|
||||||
if (initiator && initiator->IsClient() && ((copper + silver + gold + platinum) > 0))
|
if (
|
||||||
{
|
initiator &&
|
||||||
initiator->AddMoneyToPP(copper, silver, gold, platinum, true);
|
initiator->IsClient() &&
|
||||||
|
(
|
||||||
|
copper ||
|
||||||
|
silver ||
|
||||||
|
gold ||
|
||||||
|
platinum
|
||||||
|
)
|
||||||
|
) {
|
||||||
|
initiator->AddMoneyToPP(
|
||||||
|
copper,
|
||||||
|
silver,
|
||||||
|
gold,
|
||||||
|
platinum,
|
||||||
|
true
|
||||||
|
);
|
||||||
|
|
||||||
std::string tmp;
|
if (initiator) {
|
||||||
if (platinum > 0)
|
initiator->MessageString(
|
||||||
{
|
Chat::MoneySplit,
|
||||||
tmp = "You receive ";
|
YOU_RECEIVE,
|
||||||
tmp += itoa(platinum);
|
ConvertMoneyToString(
|
||||||
tmp += " platinum";
|
platinum,
|
||||||
|
gold,
|
||||||
|
silver,
|
||||||
|
copper
|
||||||
|
).c_str()
|
||||||
|
);
|
||||||
}
|
}
|
||||||
if (gold > 0)
|
|
||||||
{
|
|
||||||
if (tmp.length() == 0)
|
|
||||||
tmp = "You receive ";
|
|
||||||
else
|
|
||||||
tmp += ",";
|
|
||||||
|
|
||||||
tmp += itoa(gold);
|
|
||||||
tmp += " gold";
|
|
||||||
}
|
|
||||||
if(silver > 0)
|
|
||||||
{
|
|
||||||
if (tmp.length() == 0)
|
|
||||||
tmp = "You receive ";
|
|
||||||
else
|
|
||||||
tmp += ",";
|
|
||||||
|
|
||||||
tmp += itoa(silver);
|
|
||||||
tmp += " silver";
|
|
||||||
}
|
|
||||||
if(copper > 0)
|
|
||||||
{
|
|
||||||
if (tmp.length() == 0)
|
|
||||||
tmp = "You receive ";
|
|
||||||
else
|
|
||||||
tmp += ",";
|
|
||||||
|
|
||||||
tmp += itoa(copper);
|
|
||||||
tmp += " copper";
|
|
||||||
}
|
|
||||||
tmp += " pieces.";
|
|
||||||
if (initiator)
|
|
||||||
initiator->Message(Chat::OOC, tmp.c_str());
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -135,7 +135,7 @@ public:
|
|||||||
uint16 traindiscs(uint8 max_level, uint8 min_level = 1);
|
uint16 traindiscs(uint8 max_level, uint8 min_level = 1);
|
||||||
void unscribespells();
|
void unscribespells();
|
||||||
void untraindiscs();
|
void untraindiscs();
|
||||||
void givecash(int copper, int silver, int gold, int platinum);
|
void givecash(uint32 copper, uint32 silver = 0, uint32 gold = 0, uint32 platinum = 0);
|
||||||
void pvp(const char *mode);
|
void pvp(const char *mode);
|
||||||
void movepc(int zone_id, float x, float y, float z, float heading);
|
void movepc(int zone_id, float x, float y, float z, float heading);
|
||||||
void gmmove(float x, float y, float z);
|
void gmmove(float x, float y, float z);
|
||||||
|
|||||||
129
zone/raids.cpp
129
zone/raids.cpp
@ -24,6 +24,7 @@
|
|||||||
#include "groups.h"
|
#include "groups.h"
|
||||||
#include "mob.h"
|
#include "mob.h"
|
||||||
#include "raids.h"
|
#include "raids.h"
|
||||||
|
#include "string_ids.h"
|
||||||
|
|
||||||
#include "worldserver.h"
|
#include "worldserver.h"
|
||||||
|
|
||||||
@ -736,93 +737,79 @@ void Raid::BalanceMana(int32 penalty, uint32 gid, float range, Mob* caster, int3
|
|||||||
void Raid::SplitMoney(uint32 gid, uint32 copper, uint32 silver, uint32 gold, uint32 platinum, Client *splitter)
|
void Raid::SplitMoney(uint32 gid, uint32 copper, uint32 silver, uint32 gold, uint32 platinum, Client *splitter)
|
||||||
{
|
{
|
||||||
//avoid unneeded work
|
//avoid unneeded work
|
||||||
if (gid == RAID_GROUPLESS)
|
if (gid == RAID_GROUPLESS) {
|
||||||
return;
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
if(copper == 0 && silver == 0 && gold == 0 && platinum == 0)
|
if (
|
||||||
|
!copper &&
|
||||||
|
!silver &&
|
||||||
|
!gold &&
|
||||||
|
!platinum
|
||||||
|
) {
|
||||||
return;
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
uint32 i;
|
uint8 member_count = 0;
|
||||||
uint8 membercount = 0;
|
for (uint32 i = 0; i < MAX_RAID_MEMBERS; i++) {
|
||||||
for (i = 0; i < MAX_RAID_MEMBERS; i++) {
|
if (members[i].member && members[i].GroupNumber == gid) {
|
||||||
if (members[i].member != nullptr && members[i].GroupNumber == gid) {
|
member_count++;
|
||||||
membercount++;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (membercount == 0)
|
if (!member_count) {
|
||||||
return;
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
uint32 mod;
|
uint32 modifier;
|
||||||
//try to handle round off error a little better
|
if (member_count > 1) {
|
||||||
if(membercount > 1) {
|
modifier = platinum % member_count;
|
||||||
mod = platinum % membercount;
|
|
||||||
if((mod) > 0) {
|
if (modifier) {
|
||||||
platinum -= mod;
|
platinum -= modifier;
|
||||||
gold += 10 * mod;
|
gold += 10 * modifier;
|
||||||
}
|
}
|
||||||
mod = gold % membercount;
|
|
||||||
if((mod) > 0) {
|
modifier = gold % member_count;
|
||||||
gold -= mod;
|
|
||||||
silver += 10 * mod;
|
if (modifier) {
|
||||||
|
gold -= modifier;
|
||||||
|
silver += 10 * modifier;
|
||||||
}
|
}
|
||||||
mod = silver % membercount;
|
|
||||||
if((mod) > 0) {
|
modifier = silver % member_count;
|
||||||
silver -= mod;
|
|
||||||
copper += 10 * mod;
|
if (modifier) {
|
||||||
|
silver -= modifier;
|
||||||
|
copper += 10 * modifier;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
//calculate the splits
|
auto copper_split = copper / member_count;
|
||||||
//We can still round off copper pieces, but I dont care
|
auto silver_split = silver / member_count;
|
||||||
uint32 sc;
|
auto gold_split = gold / member_count;
|
||||||
uint32 cpsplit = copper / membercount;
|
auto platinum_split = platinum / member_count;
|
||||||
sc = copper % membercount;
|
|
||||||
uint32 spsplit = silver / membercount;
|
|
||||||
uint32 gpsplit = gold / membercount;
|
|
||||||
uint32 ppsplit = platinum / membercount;
|
|
||||||
|
|
||||||
char buf[128];
|
for (uint32 i = 0; i < MAX_RAID_MEMBERS; i++) {
|
||||||
buf[63] = '\0';
|
if (members[i].member && members[i].GroupNumber == gid) { // If Group Member is Client
|
||||||
std::string msg = "You receive";
|
members[i].member->AddMoneyToPP(
|
||||||
bool one = false;
|
copper_split,
|
||||||
|
silver_split,
|
||||||
|
gold_split,
|
||||||
|
platinum_split,
|
||||||
|
true
|
||||||
|
);
|
||||||
|
|
||||||
if(ppsplit > 0) {
|
members[i].member->MessageString(
|
||||||
snprintf(buf, 63, " %u platinum", ppsplit);
|
Chat::MoneySplit,
|
||||||
msg += buf;
|
YOU_RECEIVE_AS_SPLIT,
|
||||||
one = true;
|
ConvertMoneyToString(
|
||||||
}
|
platinum_split,
|
||||||
if(gpsplit > 0) {
|
gold_split,
|
||||||
if(one)
|
silver_split,
|
||||||
msg += ",";
|
copper_split
|
||||||
snprintf(buf, 63, " %u gold", gpsplit);
|
).c_str()
|
||||||
msg += buf;
|
);
|
||||||
one = true;
|
|
||||||
}
|
|
||||||
if(spsplit > 0) {
|
|
||||||
if(one)
|
|
||||||
msg += ",";
|
|
||||||
snprintf(buf, 63, " %u silver", spsplit);
|
|
||||||
msg += buf;
|
|
||||||
one = true;
|
|
||||||
}
|
|
||||||
if(cpsplit > 0) {
|
|
||||||
if(one)
|
|
||||||
msg += ",";
|
|
||||||
//this message is not 100% accurate for the splitter
|
|
||||||
//if they are receiving any roundoff
|
|
||||||
snprintf(buf, 63, " %u copper", cpsplit);
|
|
||||||
msg += buf;
|
|
||||||
one = true;
|
|
||||||
}
|
|
||||||
msg += " as your split";
|
|
||||||
|
|
||||||
for (i = 0; i < MAX_RAID_MEMBERS; i++) {
|
|
||||||
if (members[i].member != nullptr && members[i].GroupNumber == gid) { // If Group Member is Client
|
|
||||||
//I could not get MoneyOnCorpse to work, so we use this
|
|
||||||
members[i].member->AddMoneyToPP(cpsplit, spsplit, gpsplit, ppsplit, true);
|
|
||||||
|
|
||||||
members[i].member->Message(Chat::Green, msg.c_str());
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -455,6 +455,7 @@
|
|||||||
#define AE_RAMPAGE 11015 //%1 goes on a WILD RAMPAGE!
|
#define AE_RAMPAGE 11015 //%1 goes on a WILD RAMPAGE!
|
||||||
#define FACE_ACCEPTED 12028 //Facial features accepted.
|
#define FACE_ACCEPTED 12028 //Facial features accepted.
|
||||||
#define SPELL_LEVEL_TO_LOW 12048 //You will have to achieve level %1 before you can scribe the %2.
|
#define SPELL_LEVEL_TO_LOW 12048 //You will have to achieve level %1 before you can scribe the %2.
|
||||||
|
#define YOU_RECEIVE_AS_SPLIT 12071 //You receive %1 as your split.
|
||||||
#define ATTACKFAILED 12158 //%1 try to %2 %3, but %4!
|
#define ATTACKFAILED 12158 //%1 try to %2 %3, but %4!
|
||||||
#define HIT_STRING 12183 //hit
|
#define HIT_STRING 12183 //hit
|
||||||
#define CRUSH_STRING 12191 //crush
|
#define CRUSH_STRING 12191 //crush
|
||||||
|
|||||||
@ -1340,45 +1340,23 @@ void ClientTaskState::RewardTask(Client *client, TaskInformation *task_informati
|
|||||||
silver = copper / 10;
|
silver = copper / 10;
|
||||||
copper = copper - (silver * 10);
|
copper = copper - (silver * 10);
|
||||||
|
|
||||||
std::string cash_message;
|
if (
|
||||||
|
copper ||
|
||||||
if (platinum > 0) {
|
silver ||
|
||||||
cash_message = "You receive ";
|
gold ||
|
||||||
cash_message += itoa(platinum);
|
platinum
|
||||||
cash_message += " platinum";
|
) {
|
||||||
|
client->MessageString(
|
||||||
|
Chat::Yellow,
|
||||||
|
YOU_RECEIVE,
|
||||||
|
ConvertMoneyToString(
|
||||||
|
platinum,
|
||||||
|
gold,
|
||||||
|
silver,
|
||||||
|
copper
|
||||||
|
).c_str()
|
||||||
|
);
|
||||||
}
|
}
|
||||||
if (gold > 0) {
|
|
||||||
if (cash_message.length() == 0) {
|
|
||||||
cash_message = "You receive ";
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
cash_message += ",";
|
|
||||||
}
|
|
||||||
cash_message += itoa(gold);
|
|
||||||
cash_message += " gold";
|
|
||||||
}
|
|
||||||
if (silver > 0) {
|
|
||||||
if (cash_message.length() == 0) {
|
|
||||||
cash_message = "You receive ";
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
cash_message += ",";
|
|
||||||
}
|
|
||||||
cash_message += itoa(silver);
|
|
||||||
cash_message += " silver";
|
|
||||||
}
|
|
||||||
if (copper > 0) {
|
|
||||||
if (cash_message.length() == 0) {
|
|
||||||
cash_message = "You receive ";
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
cash_message += ",";
|
|
||||||
}
|
|
||||||
cash_message += itoa(copper);
|
|
||||||
cash_message += " copper";
|
|
||||||
}
|
|
||||||
cash_message += " pieces.";
|
|
||||||
client->Message(Chat::Yellow, cash_message.c_str());
|
|
||||||
}
|
}
|
||||||
int32 experience_reward = task_information->experience_reward;
|
int32 experience_reward = task_information->experience_reward;
|
||||||
if (experience_reward > 0) {
|
if (experience_reward > 0) {
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user