summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorgumi <git@gumi.ca>2018-01-03 19:53:32 -0500
committergumi <git@gumi.ca>2018-01-03 19:53:32 -0500
commit57f226414fed86f5591d27fe029a76edccfbb8ac (patch)
tree2943ec122cf07111532b3a8b2242f8545abeee09
parent65ed9867f29bdfafa16f0efbb419f88e9ab139d6 (diff)
downloadtmwa-57f226414fed86f5591d27fe029a76edccfbb8ac.tar.gz
tmwa-57f226414fed86f5591d27fe029a76edccfbb8ac.tar.bz2
tmwa-57f226414fed86f5591d27fe029a76edccfbb8ac.tar.xz
tmwa-57f226414fed86f5591d27fe029a76edccfbb8ac.zip
release v18.1.3v18.1.3
-rw-r--r--CHANGELOG4
-rw-r--r--src/map/atcommand.cpp42
-rw-r--r--src/map/npc.cpp2
3 files changed, 47 insertions, 1 deletions
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
@@ -3749,6 +3749,45 @@ ATCE atcommand_setpartyleader(Session *s, dumb_ptr<map_session_data> sd,
}
static
+ATCE atcommand_setleader(Session *s, dumb_ptr<map_session_data> sd,
+ ZString message)
+{
+ CharName character;
+ short mask = 0;
+ int i = 0;
+
+ if (!asplit(message, &character))
+ return ATCE::USAGE;
+
+ dumb_ptr<map_session_data> 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<map_session_data>,
ZString message)
{
@@ -5338,6 +5377,9 @@ Map<XString, AtCommandInfo> atcommand_info =
{"setpartyleader"_s, {"<party-name-or-id> <flag> <player>"_s,
40, atcommand_setpartyleader,
"Change the leader of a party"_s}},
+ {"setleader"_s, {"<player>"_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<npc_data> nd_)
{
for (int i = 0; i < MAX_EVENTTIMER; i++)
{
- nd->eventtimer[i].cancel();
+ nd_->eventtimer[i].cancel();
}
if (nd_->npc_subtype == NpcSubtype::SCRIPT)