mirror of
https://github.com/EQEmu/Server.git
synced 2025-12-16 01:01:30 +00:00
[Cleanup] Utilize ConvertSecondsToTime() method. (#1805)
* [Cleanup] Utilize ConvertSecondsToTime() method. * Lowercase.
This commit is contained in:
parent
4672e48fbd
commit
a11482ff23
11
zone/bot.cpp
11
zone/bot.cpp
@ -9549,8 +9549,15 @@ bool Bot::UseDiscipline(uint32 spell_id, uint32 target) {
|
|||||||
if(spells[spell_id].timer_id > 0 && spells[spell_id].timer_id < MAX_DISCIPLINE_TIMERS)
|
if(spells[spell_id].timer_id > 0 && spells[spell_id].timer_id < MAX_DISCIPLINE_TIMERS)
|
||||||
SetDisciplineRecastTimer(spells[spell_id].timer_id, spell.recast_time);
|
SetDisciplineRecastTimer(spells[spell_id].timer_id, spell.recast_time);
|
||||||
} else {
|
} else {
|
||||||
uint32 remain = (GetDisciplineRemainingTime(this, spells[spell_id].timer_id) / 1000);
|
uint32 remaining_time = (GetDisciplineRemainingTime(this, spells[spell_id].timer_id) / 1000);
|
||||||
GetOwner()->Message(Chat::White, "%s can use this discipline in %d minutes %d seconds.", GetCleanName(), (remain / 60), (remain % 60));
|
GetOwner()->Message(
|
||||||
|
Chat::White,
|
||||||
|
fmt::format(
|
||||||
|
"{} can use this discipline in {}.",
|
||||||
|
GetCleanName(),
|
||||||
|
ConvertSecondsToTime(remaining_time)
|
||||||
|
).c_str()
|
||||||
|
);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -857,39 +857,18 @@ void Client::CompleteConnect()
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (zone && zone->GetInstanceTimer()) {
|
if (zone && zone->GetInstanceTimer()) {
|
||||||
|
bool is_permanent = false;
|
||||||
bool is_permanent = false;
|
uint32 remaining_time = database.GetTimeRemainingInstance(zone->GetInstanceID(), is_permanent);
|
||||||
uint32 remaining_time_seconds = database.GetTimeRemainingInstance(zone->GetInstanceID(), is_permanent);
|
auto time_string = ConvertSecondsToTime(remaining_time);
|
||||||
uint32 day = (remaining_time_seconds / 86400);
|
Message(
|
||||||
uint32 hour = (remaining_time_seconds / 3600) % 24;
|
Chat::Yellow,
|
||||||
uint32 minute = (remaining_time_seconds / 60) % 60;
|
fmt::format(
|
||||||
uint32 second = (remaining_time_seconds / 1) % 60;
|
"{} ({}) will expire in {}.",
|
||||||
|
zone->GetLongName(),
|
||||||
if (day) {
|
zone->GetInstanceID(),
|
||||||
Message(
|
time_string
|
||||||
Chat::Yellow, "%s (%u) will expire in %u days, %u hours, %u minutes, and %u seconds.",
|
).c_str()
|
||||||
zone->GetLongName(), zone->GetInstanceID(), day, hour, minute, second
|
);
|
||||||
);
|
|
||||||
}
|
|
||||||
else if (hour) {
|
|
||||||
Message(
|
|
||||||
Chat::Yellow, "%s (%u) will expire in %u hours, %u minutes, and %u seconds.",
|
|
||||||
zone->GetLongName(), zone->GetInstanceID(), hour, minute, second
|
|
||||||
);
|
|
||||||
}
|
|
||||||
else if (minute) {
|
|
||||||
Message(
|
|
||||||
Chat::Yellow, "%s (%u) will expire in %u minutes, and %u seconds.",
|
|
||||||
zone->GetLongName(), zone->GetInstanceID(), minute, second
|
|
||||||
);
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
Message(
|
|
||||||
Chat::Yellow, "%s (%u) will expire in in %u seconds.",
|
|
||||||
zone->GetLongName(), zone->GetInstanceID(), second
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
SendRewards();
|
SendRewards();
|
||||||
@ -4963,54 +4942,44 @@ void Client::Handle_OP_Consider(const EQApplicationPacket *app)
|
|||||||
|
|
||||||
void Client::Handle_OP_ConsiderCorpse(const EQApplicationPacket *app)
|
void Client::Handle_OP_ConsiderCorpse(const EQApplicationPacket *app)
|
||||||
{
|
{
|
||||||
if (app->size != sizeof(Consider_Struct))
|
if (app->size != sizeof(Consider_Struct)) {
|
||||||
{
|
|
||||||
LogDebug("Size mismatch in Consider corpse expected [{}] got [{}]", sizeof(Consider_Struct), app->size);
|
LogDebug("Size mismatch in Consider corpse expected [{}] got [{}]", sizeof(Consider_Struct), app->size);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
Consider_Struct* conin = (Consider_Struct*)app->pBuffer;
|
Consider_Struct* conin = (Consider_Struct*)app->pBuffer;
|
||||||
Corpse* tcorpse = entity_list.GetCorpseByID(conin->targetid);
|
Corpse* target = entity_list.GetCorpseByID(conin->targetid);
|
||||||
std::string export_string = fmt::format("{}", conin->targetid);
|
std::string export_string = fmt::format("{}", conin->targetid);
|
||||||
if (tcorpse && tcorpse->IsNPCCorpse()) {
|
if (!target) {
|
||||||
if (parse->EventPlayer(EVENT_CONSIDER_CORPSE, this, export_string, 0) == 1) {
|
return;
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
uint32 min; uint32 sec; uint32 ttime;
|
|
||||||
if ((ttime = tcorpse->GetDecayTime()) != 0) {
|
|
||||||
sec = (ttime / 1000) % 60; // Total seconds
|
|
||||||
min = (ttime / 60000) % 60; // Total seconds / 60 drop .00
|
|
||||||
char val1[20] = { 0 };
|
|
||||||
char val2[20] = { 0 };
|
|
||||||
MessageString(Chat::NPCQuestSay, CORPSE_DECAY1, ConvertArray(min, val1), ConvertArray(sec, val2));
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
MessageString(Chat::NPCQuestSay, CORPSE_DECAY_NOW);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
else if (tcorpse && tcorpse->IsPlayerCorpse()) {
|
|
||||||
if (parse->EventPlayer(EVENT_CONSIDER_CORPSE, this, export_string, 0) == 1) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
uint32 day, hour, min, sec, ttime;
|
if (parse->EventPlayer(EVENT_CONSIDER_CORPSE, this, export_string, 0)) {
|
||||||
if ((ttime = tcorpse->GetDecayTime()) != 0) {
|
return;
|
||||||
sec = (ttime / 1000) % 60; // Total seconds
|
}
|
||||||
min = (ttime / 60000) % 60; // Total seconds
|
|
||||||
hour = (ttime / 3600000) % 24; // Total hours
|
|
||||||
day = ttime / 86400000; // Total Days
|
|
||||||
if (day)
|
|
||||||
Message(0, "This corpse will decay in %i days, %i hours, %i minutes and %i seconds.", day, hour, min, sec);
|
|
||||||
else if (hour)
|
|
||||||
Message(0, "This corpse will decay in %i hours, %i minutes and %i seconds.", hour, min, sec);
|
|
||||||
else
|
|
||||||
Message(0, "This corpse will decay in %i minutes and %i seconds.", min, sec);
|
|
||||||
|
|
||||||
Message(0, "This corpse %s be resurrected.", tcorpse->IsRezzed() ? "cannot" : "can");
|
uint32 decay_time = target->GetDecayTime();
|
||||||
}
|
if (decay_time) {
|
||||||
else {
|
auto time_string = ConvertSecondsToTime(decay_time, true);
|
||||||
MessageString(Chat::NPCQuestSay, CORPSE_DECAY_NOW);
|
Message(
|
||||||
|
Chat::NPCQuestSay,
|
||||||
|
fmt::format(
|
||||||
|
"This corpse will decay in {}.",
|
||||||
|
time_string
|
||||||
|
).c_str()
|
||||||
|
);
|
||||||
|
|
||||||
|
if (target->IsPlayerCorpse()) {
|
||||||
|
Message(
|
||||||
|
Chat::NPCQuestSay,
|
||||||
|
fmt::format(
|
||||||
|
"This corpse {} be resurrected.",
|
||||||
|
target->IsRezzed() ? "cannot" : "can"
|
||||||
|
).c_str()
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
} else {
|
||||||
|
MessageString(Chat::NPCQuestSay, CORPSE_DECAY_NOW);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -12943,8 +12912,14 @@ void Client::Handle_OP_Shielding(const EQApplicationPacket *app)
|
|||||||
pTimerType timer = pTimerShieldAbility;
|
pTimerType timer = pTimerShieldAbility;
|
||||||
|
|
||||||
if (!p_timers.Expired(&database, timer, false)) {
|
if (!p_timers.Expired(&database, timer, false)) {
|
||||||
uint32 remain = p_timers.GetRemainingTime(timer);
|
uint32 remaining_time = p_timers.GetRemainingTime(timer);
|
||||||
Message(Chat::White, "You can use the ability /shield in %d minutes %d seconds.", ((remain) / 60), (remain % 60));
|
Message(
|
||||||
|
Chat::White,
|
||||||
|
fmt::format(
|
||||||
|
"You can use the ability /shield in {}.",
|
||||||
|
ConvertSecondsToTime(remaining_time)
|
||||||
|
).c_str()
|
||||||
|
);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -774,12 +774,15 @@ bool Client::UseDiscipline(uint32 spell_id, uint32 target) {
|
|||||||
//Check the disc timer
|
//Check the disc timer
|
||||||
pTimerType DiscTimer = pTimerDisciplineReuseStart + spell.timer_id;
|
pTimerType DiscTimer = pTimerDisciplineReuseStart + spell.timer_id;
|
||||||
if(!p_timers.Expired(&database, DiscTimer, false)) { // lets not set the reuse timer in case CastSpell fails (or we would have to turn off the timer, but CastSpell will set it as well)
|
if(!p_timers.Expired(&database, DiscTimer, false)) { // lets not set the reuse timer in case CastSpell fails (or we would have to turn off the timer, but CastSpell will set it as well)
|
||||||
/*char val1[20]={0};*/ //unused
|
uint32 remaining_time = p_timers.GetRemainingTime(DiscTimer);
|
||||||
/*char val2[20]={0};*/ //unused
|
Message(
|
||||||
uint32 remain = p_timers.GetRemainingTime(DiscTimer);
|
Chat::White,
|
||||||
//MessageString(Chat::White, DISCIPLINE_CANUSEIN, ConvertArray((remain)/60,val1), ConvertArray(remain%60,val2));
|
fmt::format(
|
||||||
Message(0, "You can use this discipline in %d minutes %d seconds.", ((remain)/60), (remain%60));
|
"You can use this discipline in {}.",
|
||||||
return(false);
|
ConvertSecondsToTime(remaining_time)
|
||||||
|
).c_str()
|
||||||
|
);
|
||||||
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if(spell.recast_time > 0)
|
if(spell.recast_time > 0)
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user