diff --git a/include/area_data.h b/include/area_data.h index fca0248..abe05a2 100644 --- a/include/area_data.h +++ b/include/area_data.h @@ -272,6 +272,11 @@ class AreaData : public QObject { */ EvidenceMod evi_mod; QMap notecards; + + /** + * @brief The last IC packet sent in an area. + */ + QStringList last_ic_message; }; #endif // AREA_DATA_H diff --git a/src/area_data.cpp b/src/area_data.cpp index f30b36d..b129497 100644 --- a/src/area_data.cpp +++ b/src/area_data.cpp @@ -24,7 +24,8 @@ AreaData::AreaData(QString p_name, int p_index) : locked(FREE), document("No document."), def_hp(10), - pro_hp(10) + pro_hp(10), + last_ic_message() { QStringList name_split = p_name.split(":"); name_split.removeFirst(); diff --git a/src/packets.cpp b/src/packets.cpp index 8f501d0..94b501e 100644 --- a/src/packets.cpp +++ b/src/packets.cpp @@ -168,6 +168,8 @@ void AOClient::pktIcChat(AreaData* area, int argc, QStringList argv, AOPacket pa area->logger->logIC(this, &validated_packet); server->broadcast(validated_packet, current_area); + area->last_ic_message.clear(); + area->last_ic_message.append(validated_packet.contents); } void AOClient::pktOocChat(AreaData* area, int argc, QStringList argv, AOPacket packet) @@ -601,6 +603,15 @@ AOPacket AOClient::validateIcPacket(AOPacket packet) int additive = incoming_args[24].toInt(); if (additive != 0 && additive != 1) return invalid; + else if (area->last_ic_message.isEmpty()){ + additive = 0; + } + else if (!(char_id == area->last_ic_message[8].toInt())) { + additive = 0; + } + else if (additive == 1) { + args[4].insert(0, " "); + } args.append(QString::number(additive)); // effect