From 57f226414fed86f5591d27fe029a76edccfbb8ac Mon Sep 17 00:00:00 2001 From: gumi Date: Wed, 3 Jan 2018 19:53:32 -0500 Subject: release v18.1.3 --- CHANGELOG | 4 ++++ src/map/atcommand.cpp | 42 ++++++++++++++++++++++++++++++++++++++++++ src/map/npc.cpp | 2 +- 3 files changed, 47 insertions(+), 1 deletion(-) diff --git a/CHANGELOG b/CHANGELOG index af0cf28..11db1c8 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -1,3 +1,7 @@ +v18.1.3 + - remove mob timers (unused) + - properly clear timers of all npcs (not just script) + - add @setleader v18.1.1 - increase party limit to 120 - add a command to change party leader diff --git a/src/map/atcommand.cpp b/src/map/atcommand.cpp index 2e11227..718b6f0 100644 --- a/src/map/atcommand.cpp +++ b/src/map/atcommand.cpp @@ -3748,6 +3748,45 @@ ATCE atcommand_setpartyleader(Session *s, dumb_ptr sd, return ATCE::OKAY; } +static +ATCE atcommand_setleader(Session *s, dumb_ptr sd, + ZString message) +{ + CharName character; + short mask = 0; + int i = 0; + + if (!asplit(message, &character)) + return ATCE::USAGE; + + dumb_ptr pl_sd = map_nick2sd(character); + + if (pl_sd == nullptr || pl_sd->status.party_id == PartyId()) + return ATCE::EXIST; + + PartyPair p_ = TRY_UNWRAP(party_search(pl_sd->status.party_id), return ATCE::EXIST); + + for (i = 0; i < MAX_PARTY; i++) + { + if (p_->member[i].account_id == sd->status_key.account_id) + mask |= p_->member[i].leader ? 3 : 1; + + if (p_->member[i].account_id == pl_sd->status_key.account_id) + mask |= p_->member[i].leader ? 12 : 4; + + if (mask & 5) + break; + } + + if (!(mask & 2)) + return ATCE::PERM; + + intif_party_changeleader(pl_sd->status.party_id, pl_sd->status_key.account_id, (mask & 8) ? 0 : 1); + clif_displaymessage(s, "Party leader changed."_s); + + return ATCE::OKAY; +} + static ATCE atcommand_enablenpc(Session *s, dumb_ptr, ZString message) @@ -5338,6 +5377,9 @@ Map atcommand_info = {"setpartyleader"_s, {" "_s, 40, atcommand_setpartyleader, "Change the leader of a party"_s}}, + {"setleader"_s, {""_s, + 0, atcommand_setleader, + "Add/remove a leader to the current party"_s}}, {"mapexit"_s, {""_s, 99, atcommand_mapexit, "Try to kill the server kindly"_s}}, diff --git a/src/map/npc.cpp b/src/map/npc.cpp index f0aefa0..531ad28 100644 --- a/src/map/npc.cpp +++ b/src/map/npc.cpp @@ -1013,7 +1013,7 @@ void npc_free_internal(dumb_ptr nd_) { for (int i = 0; i < MAX_EVENTTIMER; i++) { - nd->eventtimer[i].cancel(); + nd_->eventtimer[i].cancel(); } if (nd_->npc_subtype == NpcSubtype::SCRIPT) -- cgit v1.2.3-60-g2f50