[Tasks] Use zone currencies instead of hard-coded enum. (#2459)

This commit is contained in:
Kinglykrab 2022-09-28 23:20:07 -04:00 committed by GitHub
parent c1626da40d
commit 267d73ca27
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 12 additions and 27 deletions

View File

@ -49,20 +49,6 @@ enum class TaskTimerType
Request Request
}; };
// live alt currency types, may not match current server alternate currency ids
enum class AltCurrencyType
{
RadiantCrystal = 4,
EbonCrystal = 5,
MarkOfValor = 31,
CommemorativeCoin = 33,
PieceOfEight = 37,
RemnantOfTranquility = 38,
SathirTradeGem = 41,
BathezidTradeGem = 43,
FroststoneDucat = 48,
};
struct ActivityInformation { struct ActivityInformation {
int req_activity_id; int req_activity_id;
int step; int step;
@ -216,7 +202,7 @@ struct TaskInformation {
int faction_amount{}; // faction hit value int faction_amount{}; // faction hit value
TaskMethodType reward_method; TaskMethodType reward_method;
int reward_points; int reward_points;
AltCurrencyType reward_point_type; int32_t reward_point_type;
int activity_count{}; int activity_count{};
uint8_t min_level{}; uint8_t min_level{};
uint8_t max_level{}; uint8_t max_level{};

View File

@ -15,6 +15,9 @@
#include "dynamic_zone.h" #include "dynamic_zone.h"
#include "string_ids.h" #include "string_ids.h"
#define EBON_CRYSTAL 40902
#define RADIANT_CRYSTAL 40903
extern WorldServer worldserver; extern WorldServer worldserver;
extern QueryServ *QServ; extern QueryServ *QServ;
@ -1031,11 +1034,11 @@ void ClientTaskState::RewardTask(Client *c, const TaskInformation *ti, ClientTas
c->CashReward(copper, silver, gold, platinum); c->CashReward(copper, silver, gold, platinum);
} }
int32 experience_reward = ti->experience_reward;
auto experience_reward = ti->experience_reward;
if (experience_reward > 0) { if (experience_reward > 0) {
c->AddEXP(experience_reward); c->AddEXP(experience_reward);
} } else if (experience_reward < 0) {
if (experience_reward < 0) {
uint32 pos_reward = experience_reward * -1; uint32 pos_reward = experience_reward * -1;
// Minimal Level Based Exp reward Setting is 101 (1% exp at level 1) // Minimal Level Based Exp reward Setting is 101 (1% exp at level 1)
if (pos_reward > 100 && pos_reward < 25700) { if (pos_reward > 100 && pos_reward < 25700) {
@ -1045,14 +1048,10 @@ void ClientTaskState::RewardTask(Client *c, const TaskInformation *ti, ClientTas
} }
} }
if (ti->reward_points > 0) if (ti->reward_points > 0) {
{ if (ti->reward_point_type == static_cast<int32_t>(zone->GetCurrencyID(RADIANT_CRYSTAL))) {
if (ti->reward_point_type == AltCurrencyType::RadiantCrystal)
{
c->AddCrystals(ti->reward_points, 0); c->AddCrystals(ti->reward_points, 0);
} } else if (ti->reward_point_type == static_cast<int32_t>(zone->GetCurrencyID(EBON_CRYSTAL))) {
else if (ti->reward_point_type == AltCurrencyType::EbonCrystal)
{
c->AddCrystals(0, ti->reward_points); c->AddCrystals(0, ti->reward_points);
} }
} }

View File

@ -79,7 +79,7 @@ bool TaskManager::LoadTasks(int single_task)
ti.experience_reward = task.exp_reward; ti.experience_reward = task.exp_reward;
ti.reward_method = (TaskMethodType) task.reward_method; ti.reward_method = (TaskMethodType) task.reward_method;
ti.reward_points = task.reward_points; ti.reward_points = task.reward_points;
ti.reward_point_type = static_cast<AltCurrencyType>(task.reward_point_type); ti.reward_point_type = task.reward_point_type;
ti.faction_reward = task.faction_reward; ti.faction_reward = task.faction_reward;
ti.faction_amount = task.faction_amount; ti.faction_amount = task.faction_amount;
ti.min_level = task.min_level; ti.min_level = task.min_level;
@ -1159,7 +1159,7 @@ void TaskManager::SendActiveTaskDescription(
task_description_header->open_window = bring_up_task_journal; task_description_header->open_window = bring_up_task_journal;
task_description_header->task_type = static_cast<uint32>(t->type); task_description_header->task_type = static_cast<uint32>(t->type);
task_description_header->reward_type = static_cast<int>(t->reward_point_type); task_description_header->reward_type = t->reward_point_type;
Ptr = (char *) task_description_header + sizeof(TaskDescriptionHeader_Struct); Ptr = (char *) task_description_header + sizeof(TaskDescriptionHeader_Struct);