Skip to content

Commit

Permalink
refactor: refactoring api
Browse files Browse the repository at this point in the history
  • Loading branch information
ShrBox committed Aug 6, 2024
1 parent 5e20009 commit f151463
Showing 1 changed file with 3 additions and 12 deletions.
15 changes: 3 additions & 12 deletions src/API.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -165,10 +165,7 @@ bool LLMoney_Trans(std::string from, std::string to, long long val, std::string
}

bool LLMoney_Add(std::string xuid, long long money) {
if (xuid.empty()) {
return false;
}
if (!CallBeforeEvent(LLMoneyEvent::Add, {}, xuid, money)) {
if (xuid.empty() || !CallBeforeEvent(LLMoneyEvent::Add, {}, xuid, money)) {
return false;
}

Expand All @@ -179,10 +176,7 @@ bool LLMoney_Add(std::string xuid, long long money) {
}

bool LLMoney_Reduce(std::string xuid, long long money) {
if (xuid.empty()) {
return false;
}
if (!CallBeforeEvent(LLMoneyEvent::Reduce, {}, xuid, money)) {
if (xuid.empty() || !CallBeforeEvent(LLMoneyEvent::Reduce, {}, xuid, money)) {
return false;
}

Expand All @@ -193,10 +187,7 @@ bool LLMoney_Reduce(std::string xuid, long long money) {
}

bool LLMoney_Set(std::string xuid, long long money) {
if (xuid.empty()) {
return false;
}
if (!CallBeforeEvent(LLMoneyEvent::Set, {}, xuid, money)) {
if (xuid.empty() || !CallBeforeEvent(LLMoneyEvent::Set, {}, xuid, money)) {
return false;
}
long long now = LLMoney_Get(xuid), diff;
Expand Down

0 comments on commit f151463

Please sign in to comment.