diff --git a/assets/voxygen/i18n/en/command.ftl b/assets/voxygen/i18n/en/command.ftl index cbc6007b08..b840ca39cd 100644 --- a/assets/voxygen/i18n/en/command.ftl +++ b/assets/voxygen/i18n/en/command.ftl @@ -64,6 +64,7 @@ command-battlemode-available-modes = Available modes: pvp, pve command-battlemode-same = Attempted to set the same battlemode command-battlemode-updated = New battlemode: { $battlemode } command-buff-unknown = Unknown buff: { $buff } +command-buff-complex = /buff doesn't work with this buff, use /buff_complex command-skillpreset-load-error = Error while loading presets command-skillpreset-broken = Skill preset is broken command-skillpreset-missing = Preset does not exist: { $preset } @@ -95,4 +96,4 @@ command-you-dont-exist = You do not exist, so you cannot use this command command-destroyed-tethers = All tethers destroyed! You are now free command-destroyed-no-tethers = You're not connected to any tethers command-dismounted = Dismounted -command-no-dismount = You're not riding or being ridden \ No newline at end of file +command-no-dismount = You're not riding or being ridden diff --git a/common/src/comp/buff.rs b/common/src/comp/buff.rs index bc3c8ca93c..70f9b47905 100644 --- a/common/src/comp/buff.rs +++ b/common/src/comp/buff.rs @@ -245,6 +245,13 @@ impl BuffKind { } } + pub fn is_simple(self) -> bool { + match self.differentiate() { + BuffDescriptor::SimplePositive | BuffDescriptor::SimpleNegative => true, + BuffDescriptor::Complex => false, + } + } + /// Checks if buff should queue. pub fn queues(self) -> bool { matches!(self, BuffKind::Saturation) } diff --git a/server/src/cmd.rs b/server/src/cmd.rs index d7c7ae24c2..8c559a80ee 100644 --- a/server/src/cmd.rs +++ b/server/src/cmd.rs @@ -4145,10 +4145,30 @@ fn handle_buff( let duration = duration.unwrap_or(1.0); let buffdata = BuffData::new(strength, Some(Secs(duration))); if buff != "all" { - cast_buff(&buff, buffdata, server, target) + let buffkind = parse_buffkind(&buff).ok_or_else(|| { + Content::localized_with_args("command-buff-unknown", [("buff", buff.clone())]) + })?; + + if buffkind.is_simple() { + cast_buff(buffkind, buffdata, server, target) + } else { + return Err(Content::localized_with_args("command-buff-complex", [( + "buff", buff, + )])); + } } else { - for kind in BUFF_PACK.iter() { - cast_buff(kind, buffdata, server, target)?; + for kind_key in BUFF_PACK.iter() { + let buffkind = parse_buffkind(kind_key).ok_or_else(|| { + Content::localized_with_args("command-buff-unknown", [( + "buff", + kind_key.to_owned(), + )]) + })?; + + // Execute only simple buffs, ignore complex + if buffkind.is_simple() { + cast_buff(buffkind, buffdata, server, target)?; + } } Ok(()) } @@ -4157,33 +4177,33 @@ fn handle_buff( } } -fn cast_buff(kind: &str, data: BuffData, server: &mut Server, target: EcsEntity) -> CmdResult<()> { - if let Some(buffkind) = parse_buffkind(kind) { - let ecs = &server.state.ecs(); - let mut buffs_all = ecs.write_storage::(); - let stats = ecs.read_storage::(); - let healths = ecs.read_storage::(); - let time = ecs.read_resource::