code:
#pragma once

#include "Database/EventCommands/AbortBattle.hpp"
#include "Database/EventCommands/BattleProcessing.hpp"
#include "Database/EventCommands/BreakLoop.hpp"
#include "Database/EventCommands/ChangeActorImage.hpp"
#include "Database/EventCommands/ChangeArmors.hpp"
#include "Database/EventCommands/ChangeBattleBGM.hpp"
#include "Database/EventCommands/ChangeBattleback.hpp"
#include "Database/EventCommands/ChangeClass.hpp"
#include "Database/EventCommands/ChangeDefeatME.hpp"
#include "Database/EventCommands/ChangeEXP.hpp"
#include "Database/EventCommands/ChangeEncounterDisable.hpp"
#include "Database/EventCommands/ChangeEnemyHP.hpp"
#include "Database/EventCommands/ChangeEnemyMP.hpp"
#include "Database/EventCommands/ChangeEnemyState.hpp"
#include "Database/EventCommands/ChangeEnemyTP.hpp"
#include "Database/EventCommands/ChangeEquipment.hpp"
#include "Database/EventCommands/ChangeFormationAccess.hpp"
#include "Database/EventCommands/ChangeGold.hpp"
#include "Database/EventCommands/ChangeHP.hpp"
#include "Database/EventCommands/ChangeItems.hpp"
#include "Database/EventCommands/ChangeLevel.hpp"
#include "Database/EventCommands/ChangeMP.hpp"
#include "Database/EventCommands/ChangeMapDisplayName.hpp"
#include "Database/EventCommands/ChangeMenuAccess.hpp"
#include "Database/EventCommands/ChangeName.hpp"
#include "Database/EventCommands/ChangeNickname.hpp"
#include "Database/EventCommands/ChangeParallax.hpp"
#include "Database/EventCommands/ChangeParameter.hpp"
#include "Database/EventCommands/ChangePartyMember.hpp"
#include "Database/EventCommands/ChangePlayerFollowers.hpp"
#include "Database/EventCommands/ChangeProfile.hpp"
#include "Database/EventCommands/ChangeSaveAccess.hpp"
#include "Database/EventCommands/ChangeSkill.hpp"
#include "Database/EventCommands/ChangeState.hpp"
#include "Database/EventCommands/ChangeTP.hpp"
#include "Database/EventCommands/ChangeTileset.hpp"
#include "Database/EventCommands/ChangeTransparency.hpp"
#include "Database/EventCommands/ChangeVehicleBGM.hpp"
#include "Database/EventCommands/ChangeVehicleImage.hpp"
#include "Database/EventCommands/ChangeVictoryME.hpp"
#include "Database/EventCommands/ChangeWeapons.hpp"
#include "Database/EventCommands/ChangeWindowColor.hpp"
#include "Database/EventCommands/Comment.hpp"
#include "Database/EventCommands/CommonEvent.hpp"
#include "Database/EventCommands/ConditionalBranch.hpp"
#include "Database/EventCommands/ControlSelfSwitch.hpp"
#include "Database/EventCommands/ControlSwitches.hpp"
#include "Database/EventCommands/ControlTimer.hpp"
#include "Database/EventCommands/ControlVariables.hpp"
#include "Database/EventCommands/End.hpp"
#include "Database/EventCommands/EnemyAppear.hpp"
#include "Database/EventCommands/EnemyRecoverAll.hpp"
#include "Database/EventCommands/EnemyTransform.hpp"
#include "Database/EventCommands/EraseEvent.hpp"
#include "Database/EventCommands/ErasePicture.hpp"
#include "Database/EventCommands/EventDummy.hpp"
#include "Database/EventCommands/ExitEventProcessing.hpp"
#include "Database/EventCommands/FadeinScreen.hpp"
#include "Database/EventCommands/FadeoutBGM.hpp"
#include "Database/EventCommands/FadeoutBGS.hpp"
#include "Database/EventCommands/FadeoutScreen.hpp"
#include "Database/EventCommands/FlashScreen.hpp"
#include "Database/EventCommands/ForceAction.hpp"
#include "Database/EventCommands/GameOver.hpp"
#include "Database/EventCommands/GatherFollowers.hpp"
#include "Database/EventCommands/GetLocationInfo.hpp"
#include "Database/EventCommands/GetOnOffVehicle.hpp"
#include "Database/EventCommands/InputNumber.hpp"
#include "Database/EventCommands/JumpToLabel.hpp"
#include "Database/EventCommands/Label.hpp"
#include "Database/EventCommands/Loop.hpp"
#include "Database/EventCommands/MovePicture.hpp"
#include "Database/EventCommands/MovementRoute.hpp"
#include "Database/EventCommands/NameInput.hpp"
#include "Database/EventCommands/OpenMenu.hpp"
#include "Database/EventCommands/OpenSave.hpp"
#include "Database/EventCommands/PlayBGM.hpp"
#include "Database/EventCommands/PlayBGS.hpp"
#include "Database/EventCommands/PlayME.hpp"
#include "Database/EventCommands/PlayMovie.hpp"
#include "Database/EventCommands/PlaySE.hpp"
#include "Database/EventCommands/Plugin.hpp"
#include "Database/EventCommands/RecoverAll.hpp"
#include "Database/EventCommands/RepeatAbove.hpp"
#include "Database/EventCommands/ResumeBGM.hpp"
#include "Database/EventCommands/ReturnToTitle.hpp"
#include "Database/EventCommands/RotatePicture.hpp"
#include "Database/EventCommands/SaveBGM.hpp"
#include "Database/EventCommands/Script.hpp"
#include "Database/EventCommands/ScrollMap.hpp"
#include "Database/EventCommands/ScrollingText.hpp"
#include "Database/EventCommands/SelectItem.hpp"
#include "Database/EventCommands/SetEventLocation.hpp"
#include "Database/EventCommands/SetMovementRoute.hpp"
#include "Database/EventCommands/SetVehicleLocation.hpp"
#include "Database/EventCommands/SetWeatherEffect.hpp"
#include "Database/EventCommands/ShakeScreen.hpp"
#include "Database/EventCommands/ShopProcessing.hpp"
#include "Database/EventCommands/ShowAnimation.hpp"
#include "Database/EventCommands/ShowBalloonIcon.hpp"
#include "Database/EventCommands/ShowBattleAnimation.hpp"
#include "Database/EventCommands/ShowChoice.hpp"
#include "Database/EventCommands/ShowPicture.hpp"
#include "Database/EventCommands/ShowText.hpp"
#include "Database/EventCommands/StopSE.hpp"
#include "Database/EventCommands/TintPicture.hpp"
#include "Database/EventCommands/TintScreen.hpp"
#include "Database/EventCommands/TransferPlayer.hpp"
#include "Database/EventCommands/UnhandledEvent.hpp"
#include "Database/EventCommands/Wait.hpp"


code:
#pragma once
#include "Database/EventCommands/IEventCommand.hpp"
#include <format>

struct AbortBattleCommand final : IEventCommand {
  AbortBattleCommand() = default;
  explicit AbortBattleCommand(const std::optional<int>& indent)
  : IEventCommand(indent) {}
  ~AbortBattleCommand() override = default;
  [[nodiscard]] EventCode code() const override { return EventCode::Abort_Battle; }
  std::shared_ptr<IEventCommand> clone() const override { return std::make_shared<AbortBattleCommand>(*this); }
};

repo_name: Antidote/openrpgeditor

license: mit


code:
#include "Database/EventCommands/BattleProcessing.hpp"

#include "Database/Database.hpp"

BattleProcessingCommand::BattleProcessingCommand(const std::optional<int>& indent, const nlohmann::ordered_json& parameters)
: IEventCommand(indent) {
  parameters.at(0).get_to(type);
  parameters.at(1).get_to(id);
  parameters.at(2).get_to(canEscape);
  parameters.at(3).get_to(canLose);
}

void BattleProcessingCommand::serializeParameters(nlohmann::ordered_json& out) const {
  out.push_back(type);
  out.push_back(id);
  out.push_back(canEscape);
  out.push_back(canLose);
}

std::string BattleProcessingCommand::stringRep(const Database& db, const bool colored) const {
  std::string enemy;
  if (type == BattleProcessType::Direct_designation) {
    enemy = db.troopNameOrId(id);
  } else if (type == BattleProcessType::Designation_with_variables) {
    enemy = std::format("{{{}}}", db.variableNameOrId(id));
  } else {
    enemy = trNOOP("Same as Random Encounter");
  }
  return indentText(indent()) + symbol(code()) + ColorFormatter::getColorCode(code(), colored) + trNOOP("Battle Processing") + colon.data() + enemy + ColorFormatter::popColor(colored);
}


code:
#pragma once
#include "Database/EventCommands/IEventCommand.hpp"
#include <format>

struct BattleProcessingCommand final : IEventCommand {
  BattleProcessingCommand() = default;
  explicit BattleProcessingCommand(const std::optional<int>& indent, const nlohmann::ordered_json& parameters);
  ~BattleProcessingCommand() override = default;
  [[nodiscard]] EventCode code() const override { return EventCode::Battle_Processing; }
  void serializeParameters(nlohmann::ordered_json& out) const override;
  [[nodiscard]] std::string stringRep(const Database& db, bool colored = true) const override;

  BattleProcessType type = BattleProcessType::Direct_designation;
  int id{1}; // troop id if type == 0; variable id if type == 2
  bool canEscape{false};
  bool canLose{false};

  std::shared_ptr<IEventCommand> clone() const override { return std::make_shared<BattleProcessingCommand>(*this); }
};

struct IfWinCommand final : IEventCommand {
  IfWinCommand() = default;
  explicit IfWinCommand(const std::optional<int>& indent)
  : IEventCommand(indent) {}
  ~IfWinCommand() override = default;
  [[nodiscard]] EventCode code() const override { return EventCode::If_Win; }
  std::shared_ptr<IEventCommand> clone() const override { return std::make_shared<IfWinCommand>(*this); }
};

struct IfEscapeCommand final : IEventCommand {
  IfEscapeCommand() = default;
  explicit IfEscapeCommand(const std::optional<int>& indent)
  : IEventCommand(indent) {}
  ~IfEscapeCommand() override = default;
  [[nodiscard]] EventCode code() const override { return EventCode::If_Escape; }
  std::shared_ptr<IEventCommand> clone() const override { return std::make_shared<IfEscapeCommand>(*this); }
};

struct IfLoseCommand final : IEventCommand {
  IfLoseCommand() = default;
  explicit IfLoseCommand(const std::optional<int>& indent)
  : IEventCommand(indent) {}
  ~IfLoseCommand() override = default;
  [[nodiscard]] EventCode code() const override { return EventCode::If_Lose; }
  std::shared_ptr<IEventCommand> clone() const override { return std::make_shared<IfLoseCommand>(*this); }
};

struct EndBattleProcessingCommand final : IEventCommand {
  EndBattleProcessingCommand() = default;
  explicit EndBattleProcessingCommand(const std::optional<int>& indent)
  : IEventCommand(indent) {}
  ~EndBattleProcessingCommand() override = default;
  [[nodiscard]] EventCode code() const override { return EventCode::End_del_Battle_Processing; }
  std::shared_ptr<IEventCommand> clone() const override { return std::make_shared<EndBattleProcessingCommand>(*this); }
};


code:
#pragma once
#include "Database/EventCommands/IEventCommand.hpp"

struct BreakLoopCommand final : IEventCommand {
  BreakLoopCommand() = default;
  explicit BreakLoopCommand(const std::optional<int>& indent)
  : IEventCommand(indent) {}
  ~BreakLoopCommand() override = default;
  [[nodiscard]] EventCode code() const override { return EventCode::Break_Loop; }
  std::shared_ptr<IEventCommand> clone() const override { return std::make_shared<BreakLoopCommand>(*this); }
};


code:
#include "Database/EventCommands/ChangeActorImage.hpp"
#include "Database/Database.hpp"

ChangeActorImageCommand::ChangeActorImageCommand(const std::optional<int>& indent, const nlohmann::ordered_json& parameters)
: IEventCommand(indent) {
  parameters.at(0).get_to(actor);
  parameters.at(1).get_to(charPicture);
  parameters.at(2).get_to(charIndex);
  parameters.at(3).get_to(facePicture);
  parameters.at(4).get_to(faceIndex);
  parameters.at(5).get_to(battlerPicture);
}

void ChangeActorImageCommand::serializeParameters(nlohmann::ordered_json& out) const {
  out.push_back(actor);
  out.push_back(charPicture);
  out.push_back(charIndex);
  out.push_back(facePicture);
  out.push_back(faceIndex);
  out.push_back(battlerPicture);
}

std::string ChangeActorImageCommand::stringRep(const Database& db, const bool colored) const {
  std::string charString = db.imageText(charPicture, charIndex);
  std::string faceString = db.imageText(facePicture, faceIndex);
  std::string battlerString = db.imageText(battlerPicture);

  const auto actName = db.actorNameOrId(actor);
  return indentText(indent()) + symbol(code()) + ColorFormatter::getColorCode(code(), colored) + trNOOP("Change Actor Images") + colon.data() + actName + ", " + charString + ", " + faceString + ", " +
         battlerString + ColorFormatter::popColor(colored);
}


code:
#pragma once
#include "Database/EventCommands/IEventCommand.hpp"
#include <format>

struct ChangeActorImageCommand final : IEventCommand {
  ChangeActorImageCommand() = default;
  explicit ChangeActorImageCommand(const std::optional<int>& indent, const nlohmann::ordered_json& parameters);
  ~ChangeActorImageCommand() override = default;
  [[nodiscard]] EventCode code() const override { return EventCode::Change_Actor_Images; }
  void serializeParameters(nlohmann::ordered_json& out) const override;
  [[nodiscard]] std::string stringRep(const Database& db, bool colored = true) const override;
  std::shared_ptr<IEventCommand> clone() const override { return std::make_shared<ChangeActorImageCommand>(*this); }
  bool hasReference(int targetId, SearchType type) override {
    if (type == SearchType::Actor) {
      return actor == targetId;
    }
    return false;
  };
  bool setReference(int targetId, int newId, SearchType type) override {
    if (hasReference(targetId, type)) {
      actor = newId;
      return true;
    }
    return false;
  }
  int actor{1};
  std::string charPicture;
  int charIndex;
  std::string facePicture;
  int faceIndex;
  std::string battlerPicture;
};


code:
#include "Database/EventCommands/ChangeArmors.hpp"

#include "Database/Database.hpp"

ChangeArmorsCommand::ChangeArmorsCommand(const std::optional<int>& indent, const nlohmann::ordered_json& parameters)
: IEventCommand(indent) {
  parameters.at(0).get_to(item);
  parameters.at(1).get_to(operation);
  parameters.at(2).get_to(operandSource);
  parameters.at(3).get_to(operand);
  parameters.at(4).get_to(includeEquipment);
}

void ChangeArmorsCommand::serializeParameters(nlohmann::ordered_json& out) const {
  out.push_back(item);
  out.push_back(operand);
  out.push_back(operandSource);
  out.push_back(operand);
  out.push_back(includeEquipment);
}

std::string ChangeArmorsCommand::stringRep(const Database& db, const bool colored) const {
  const auto armorName = db.armorNameOrId(item);
  std::string oper;
  if (operandSource == QuantityChangeSource::Variable) {
    oper = std::format("{{{}}}", db.system.variable(operand));
  } else {
    oper = std::to_string(operand);
  }
  std::string suffix;
  if (includeEquipment) {
    suffix = ColorFormatter::getColor(FormatColor::Gray, colored) + db.parentheses(trNOOP("Include Equipment")) + ColorFormatter::popColor(colored);
  }

  return indentText(indent()) + symbol(code()) + ColorFormatter::getColorCode(code(), colored) + trNOOP("Change Armors") + colon.data() + armorName + " " + DecodeEnumName(operation) + " " + oper +
         ColorFormatter::popColor(colored) + suffix;
}


code:
#pragma once
#include "Database/EventCommands/IEventCommand.hpp"

struct ChangeArmorsCommand final : IEventCommand {
  ChangeArmorsCommand() = default;
  explicit ChangeArmorsCommand(const std::optional<int>& indent, const nlohmann::ordered_json& parameters);
  ~ChangeArmorsCommand() override = default;
  [[nodiscard]] EventCode code() const override { return EventCode::Change_Armors; }
  void serializeParameters(nlohmann::ordered_json& out) const override;
  [[nodiscard]] std::string stringRep(const Database& db, bool colored = true) const override;
  std::shared_ptr<IEventCommand> clone() const override { return std::make_shared<ChangeArmorsCommand>(*this); }
  bool hasReference(int targetId, SearchType type) override {
    if (type == SearchType::Variable) {
      return operandSource == QuantityChangeSource::Variable && operand == targetId;
    }
    if (type == SearchType::Armors) {
      return targetId == item;
    }
    return false;
  };
  bool setReference(int targetId, int newId, SearchType type) override {
    if (hasReference(targetId, type)) {
      if (type == SearchType::Variable) {
        if (operandSource == QuantityChangeSource::Variable && operand == targetId) {
          operand = newId;
        }
      } else if (type == SearchType::Armors) {
        item = newId;
      }
      return true;
    }
    return false;
  }
  int item{1};

  QuantityChangeOp operation = QuantityChangeOp::_plu__del_Increase;
  QuantityChangeSource operandSource = QuantityChangeSource::Constant;
  int operand{1};
  bool includeEquipment{false};
};


code:
#include "Database/EventCommands/ChangeBattleBGM.hpp"

#include "Database/Database.hpp"

ChangeBattleBGMCommand::ChangeBattleBGMCommand(const std::optional<int>& indent, const nlohmann::ordered_json& parameters)
: IEventCommand(indent) {
  parameters.at(0).get_to(bgm);
}

void ChangeBattleBGMCommand::serializeParameters(nlohmann::ordered_json& out) const { out.push_back(bgm); }

std::string ChangeBattleBGMCommand::stringRep(const Database& db, const bool colored) const {
  return indentText(indent()) + symbol(code()) + ColorFormatter::getColorCode(code(), colored) + trNOOP("Change Battle BGM") + colon.data() + db.audioText(bgm) + ColorFormatter::popColor(colored);
}


code:
#pragma once
#include "Database/Audio.hpp"
#include "Database/Database.hpp"
#include "Database/EventCommands/IEventCommand.hpp"
#include <format>

struct ChangeBattleBGMCommand final : IEventCommand {
  ChangeBattleBGMCommand() = default;
  explicit ChangeBattleBGMCommand(const std::optional<int>& indent, const nlohmann::ordered_json& parameters);
  ~ChangeBattleBGMCommand() override = default;
  [[nodiscard]] EventCode code() const override { return EventCode::Change_Battle_BGM; }
  void serializeParameters(nlohmann::ordered_json& out) const override;
  [[nodiscard]] std::string stringRep(const Database& db, bool colored = true) const override;
  std::shared_ptr<IEventCommand> clone() const override { return std::make_shared<ChangeBattleBGMCommand>(*this); }
  bool hasStringReference(const std::string& text, SearchType type) override {
    if (type == SearchType::Audio) {
      return text.contains(bgm.name());
    }
    return false;
  };
  Audio bgm;
};


code:
#include "Database/EventCommands/ChangeBattleback.hpp"

#include "Database/Database.hpp"

ChangeBattlebackCommand::ChangeBattlebackCommand(const std::optional<int>& indent, const nlohmann::ordered_json& parameters)
: IEventCommand(indent) {
  parameters.at(0).get_to(battleBack1Name);
  parameters.at(1).get_to(battleBack2Name);
}

void ChangeBattlebackCommand::serializeParameters(nlohmann::ordered_json& out) const {
  out.push_back(battleBack1Name);
  out.push_back(battleBack2Name);
}

std::string ChangeBattlebackCommand::stringRep(const Database& db, const bool colored) const {
  return indentText(indent()) + symbol(code()) + ColorFormatter::getColorCode(code(), colored) + trNOOP("Change Battle Back") + colon.data() + db.dualImageText(battleBack1Name, battleBack2Name) +
         ColorFormatter::popColor(colored);
}


code:
#pragma once
#include "Database/EventCommands/IEventCommand.hpp"
#include <format>

struct ChangeBattlebackCommand final : IEventCommand {
  ChangeBattlebackCommand() = default;
  explicit ChangeBattlebackCommand(const std::optional<int>& indent, const nlohmann::ordered_json& parameters);
  ~ChangeBattlebackCommand() override = default;
  [[nodiscard]] EventCode code() const override { return EventCode::Change_Battle_Back; }
  void serializeParameters(nlohmann::ordered_json& out) const override;
  [[nodiscard]] std::string stringRep(const Database& db, bool colored = true) const override;
  std::shared_ptr<IEventCommand> clone() const override { return std::make_shared<ChangeBattlebackCommand>(*this); }

  std::string battleBack1Name;
  std::string battleBack2Name;
};


code:
#include "Database/EventCommands/ChangeClass.hpp"

#include "Database/Database.hpp"

ChangeClassCommand::ChangeClassCommand(const std::optional<int>& indent, const nlohmann::ordered_json& parameters)
: IEventCommand(indent) {
  parameters.at(0).get_to(actor);
  parameters.at(1).get_to(classId);
  parameters.at(2).get_to(saveLevel);
}

void ChangeClassCommand::serializeParameters(nlohmann::ordered_json& out) const {
  out.push_back(actor);
  out.push_back(classId);
  out.push_back(saveLevel);
}

std::string ChangeClassCommand::stringRep(const Database& db, const bool colored) const {
  const auto actName = db.nameOrId(db.actorName(actor), actor);
  const auto clsName = db.nameOrId(db.className(classId), classId);
  return indentText(indent()) + symbol(code()) + ColorFormatter::getColorCode(code(), colored) + trNOOP("Change Class") + colon.data() + actName + ", " + clsName + ", " +
         (saveLevel ? "true" : "false") + ColorFormatter::popColor(colored);
}


code:
#pragma once
#include "Database/EventCommands/IEventCommand.hpp"
#include <format>

struct ChangeClassCommand final : IEventCommand {
  ChangeClassCommand() = default;
  explicit ChangeClassCommand(const std::optional<int>& indent, const nlohmann::ordered_json& parameters);
  ~ChangeClassCommand() override = default;
  [[nodiscard]] EventCode code() const override { return EventCode::Change_Class; }
  void serializeParameters(nlohmann::ordered_json& out) const override;
  [[nodiscard]] std::string stringRep(const Database& db, bool colored = true) const override;
  std::shared_ptr<IEventCommand> clone() const override { return std::make_shared<ChangeClassCommand>(*this); }
  bool hasReference(int targetId, SearchType type) override {
    if (type == SearchType::Actor) {
      return targetId == actor;
    }
    if (type == SearchType::Class) {
      return targetId == classId;
    }
    return false;
  };
  bool setReference(int targetId, int newId, SearchType type) override {
    if (hasReference(targetId, type)) {
      if (type == SearchType::Actor) {
        actor = newId;
      } else if (type == SearchType::Class) {
        classId = newId;
      }
      return true;
    }
    return false;
  }
  int actor{1};
  int classId{1};
  bool saveLevel{false};
};


code:
#include "Database/EventCommands/ChangeDefeatME.hpp"

#include "Database/Database.hpp"

ChangeDefeatMECommand::ChangeDefeatMECommand(const std::optional<int>& indent, const nlohmann::ordered_json& parameters)
: IEventCommand(indent) {
  parameters.at(0).get_to(me);
}

void ChangeDefeatMECommand::serializeParameters(nlohmann::ordered_json& out) const { out.push_back(me); }

std::string ChangeDefeatMECommand::stringRep(const Database& db, const bool colored) const {
  return indentText(indent()) + symbol(code()) + ColorFormatter::getColorCode(code(), colored) + trNOOP("Change Defeat ME") + colon.data() + db.audioText(me) + ColorFormatter::popColor(colored);
}


code:
#pragma once
#include "Database/Audio.hpp"
#include "Database/Database.hpp"
#include "Database/EventCommands/IEventCommand.hpp"
#include <format>

struct ChangeDefeatMECommand final : IEventCommand {
  ChangeDefeatMECommand() = default;
  explicit ChangeDefeatMECommand(const std::optional<int>& indent, const nlohmann::ordered_json& parameters);
  ~ChangeDefeatMECommand() override = default;
  [[nodiscard]] EventCode code() const override { return EventCode::Change_Defeat_ME; }
  void serializeParameters(nlohmann::ordered_json& out) const override;
  [[nodiscard]] std::string stringRep(const Database& db, bool colored = true) const override;
  std::shared_ptr<IEventCommand> clone() const override { return std::make_shared<ChangeDefeatMECommand>(*this); }
  bool hasStringReference(const std::string& text, SearchType type) override {
    if (type == SearchType::Audio) {
      return text.contains(me.name());
    }
    return false;
  };
  Audio me;
};


code:
#include "Database/EventCommands/ChangeEXP.hpp"

#include "Database/Database.hpp"

ChangeEXPCommand::ChangeEXPCommand(const std::optional<int>& indent, const nlohmann::ordered_json& parameters)
: IEventCommand(indent) {
  parameters.at(0).get_to(comparison);
  parameters.at(1).get_to(value);
  parameters.at(2).get_to(quantityOp);
  parameters.at(3).get_to(quantitySource);
  parameters.at(4).get_to(quantity);
  parameters.at(5).get_to(showLevelUp);
}

void ChangeEXPCommand::serializeParameters(nlohmann::ordered_json& out) const {
  out.push_back(comparison);
  out.push_back(value);
  out.push_back(quantityOp);
  out.push_back(quantitySource);
  out.push_back(quantity);
  out.push_back(showLevelUp);
}

std::string ChangeEXPCommand::stringRep(const Database& db, const bool colored) const {

  std::string actorName;
  if (comparison == ActorComparisonSource::Fixed) {
    if (value <= 0) {
      actorName = trNOOP("Entire Party");
    } else {
      actorName = db.actorNameOrId(value);
    }
  } else {
    actorName = std::format("{{{}}}", db.variableNameOrId(value));
  }

  std::string quantityStr;
  if (quantitySource == QuantityChangeSource::Constant) {
    quantityStr = std::to_string(quantity);
  } else {
    quantityStr = std::format("{{{}}}", db.variableNameOrId(quantity));
  }

  std::string suffix;
  if (showLevelUp) {
    suffix = ColorFormatter::getColor(FormatColor::Gray, colored) + " " + db.parentheses(trNOOP("Show Level Up")) + ColorFormatter::popColor(colored);
  }

  return indentText(indent()) + symbol(code()) + ColorFormatter::getColorCode(code(), colored) + trNOOP("Change EXP") + colon.data() + actorName + ", " + DecodeEnumName(quantityOp) + " " +
         quantityStr + ColorFormatter::popColor(colored) + suffix;
}


code:
#pragma once
#include "Database/EventCommands/IEventCommand.hpp"
#include <format>

struct ChangeEXPCommand final : IEventCommand {
  ChangeEXPCommand() = default;
  explicit ChangeEXPCommand(const std::optional<int>& indent, const nlohmann::ordered_json& parameters);
  ~ChangeEXPCommand() override = default;
  [[nodiscard]] EventCode code() const override { return EventCode::Change_EXP; }
  void serializeParameters(nlohmann::ordered_json& out) const override;
  [[nodiscard]] std::string stringRep(const Database& db, bool colored = true) const override;
  std::shared_ptr<IEventCommand> clone() const override { return std::make_shared<ChangeEXPCommand>(*this); }

  bool hasReference(int targetId, SearchType type) override {
    if (type == SearchType::Variable) {
      return (quantitySource == QuantityChangeSource::Variable && quantity == targetId) || (comparison == ActorComparisonSource::Variable && value == targetId);
    }
    return false;
  };
  bool setReference(int targetId, int newId, SearchType type) override {
    if (hasReference(targetId, type)) {
      if (quantitySource == QuantityChangeSource::Variable && quantity == targetId) {
        quantity = newId;
      }
      if (comparison == ActorComparisonSource::Variable && value == targetId) {
        value = newId;
      }
      return true;
    }
    return false;
  }

  ActorComparisonSource comparison = ActorComparisonSource::Fixed;
  int value{1};
  QuantityChangeOp quantityOp = QuantityChangeOp::_plu__del_Increase;
  QuantityChangeSource quantitySource = QuantityChangeSource::Constant;
  int quantity{1};
  bool showLevelUp{false};
};


code:
#include "Database/EventCommands/ChangeEncounterDisable.hpp"

ChangeEncounterDisableCommand::ChangeEncounterDisableCommand(const std::optional<int>& indent, const nlohmann::ordered_json& parameters)
: IEventCommand(indent) {
  parameters.at(0).get_to(access);
}

void ChangeEncounterDisableCommand::serializeParameters(nlohmann::ordered_json& out) const { out.push_back(access); }

std::string ChangeEncounterDisableCommand::stringRep(const Database& db, const bool colored) const {
  return indentText(indent()) + symbol(code()) + ColorFormatter::getColorCode(code(), colored) + trNOOP("Change Encounter") + colon.data() + DecodeEnumName(access) + ColorFormatter::popColor(colored);
}


code:
#pragma once
#include "Database/EventCommands/IEventCommand.hpp"

struct ChangeEncounterDisableCommand final : IEventCommand {
  ChangeEncounterDisableCommand() = default;
  explicit ChangeEncounterDisableCommand(const std::optional<int>& indent, const nlohmann::ordered_json& parameters);
  ~ChangeEncounterDisableCommand() override = default;
  [[nodiscard]] EventCode code() const override { return EventCode::Change_Encounter; }
  void serializeParameters(nlohmann::ordered_json& out) const override;
  [[nodiscard]] std::string stringRep(const Database& db, bool colored = true) const override;
  std::shared_ptr<IEventCommand> clone() const override { return std::make_shared<ChangeEncounterDisableCommand>(*this); }

  AccessMode access = AccessMode::Disable;
};


code:
#include "Database/EventCommands/ChangeEnemyHP.hpp"
#include "Database/Database.hpp"

ChangeEnemyHPCommand::ChangeEnemyHPCommand(const std::optional<int>& indent, const nlohmann::ordered_json& parameters)
: IEventCommand(indent) {
  parameters.at(0).get_to(troopMember);
  parameters.at(1).get_to(troopMemberOp);
  parameters.at(2).get_to(quantitySource);
  parameters.at(3).get_to(quantity);
  parameters.at(4).get_to(allowKnockOut);
}

void ChangeEnemyHPCommand::serializeParameters(nlohmann::ordered_json& out) const {
  out.push_back(troopMember);
  out.push_back(troopMemberOp);
  out.push_back(quantitySource);
  out.push_back(quantity);
  out.push_back(allowKnockOut);
}

std::string ChangeEnemyHPCommand::stringRep(const Database& db, const bool colored) const {
  std::string enemyStr = db.troopMemberName(m_troopId, troopMember);
  if (troopMember >= 0) {
    enemyStr = std::format("#{} {}", troopMember + 1, enemyStr);
  }

  std::string quantityStr;
  if (quantitySource == QuantityChangeSource::Variable) {
    quantityStr = std::format("{{{}}}", db.variableNameOrId(quantity));
  } else {
    quantityStr = std::format("{}", quantity);
  }

  std::string suffix;
  if (allowKnockOut) {
    suffix = ColorFormatter::getColor(FormatColor::Gray, colored) + " " + db.parentheses(trNOOP("Allow Knockout")) + ColorFormatter::popColor(colored);
  }
  return indentText(indent()) + symbol(code()) + ColorFormatter::getColorCode(code(), colored) + trNOOP("Change Enemy HP") + colon.data() + enemyStr + DecodeEnumName(troopMemberOp) + " " +
         quantityStr + ColorFormatter::popColor(colored) + suffix;
}


code:
#pragma once
#include "Database/EventCommands/IEventCommand.hpp"
#include <format>

struct ChangeEnemyHPCommand final : IEventCommand {
  ChangeEnemyHPCommand() = default;
  explicit ChangeEnemyHPCommand(const std::optional<int>& indent, const nlohmann::ordered_json& parameters);
  ~ChangeEnemyHPCommand() override = default;
  [[nodiscard]] EventCode code() const override { return EventCode::Change_Enemy_HP; }
  void serializeParameters(nlohmann::ordered_json& out) const override;
  [[nodiscard]] std::string stringRep(const Database& db, bool colored = true) const override;
  std::shared_ptr<IEventCommand> clone() const override { return std::make_shared<ChangeEnemyHPCommand>(*this); }

  int troopMember{-1};
  QuantityChangeOp troopMemberOp = QuantityChangeOp::_plu__del_Increase;
  QuantityChangeSource quantitySource = QuantityChangeSource::Constant;
  int quantity{1};
  bool allowKnockOut{false};

  int m_troopId{0};
};


code:
#include "Database/EventCommands/ChangeEnemyMP.hpp"
#include "Database/Database.hpp"

ChangeEnemyMPCommand::ChangeEnemyMPCommand(const std::optional<int>& indent, const nlohmann::ordered_json& parameters)
: IEventCommand(indent) {
  parameters.at(0).get_to(troopMember);
  parameters.at(1).get_to(troopMemberOp);
  parameters.at(2).get_to(quantitySource);
  parameters.at(3).get_to(quantity);
}

void ChangeEnemyMPCommand::serializeParameters(nlohmann::ordered_json& out) const {
  out.push_back(troopMember);
  out.push_back(troopMemberOp);
  out.push_back(quantitySource);
  out.push_back(quantity);
}

std::string ChangeEnemyMPCommand::stringRep(const Database& db, const bool colored) const {
  std::string enemyStr = db.troopMemberName(m_troopId, troopMember);
  if (troopMember >= 0) {
    enemyStr = std::format("#{} {}", troopMember + 1, enemyStr);
  }

  std::string quantityStr;
  if (quantitySource == QuantityChangeSource::Variable) {
    quantityStr = std::format("{{{}}}", db.variableNameOrId(quantity));
  } else {
    quantityStr = std::format("{}", quantity);
  }

  return indentText(indent()) + symbol(code()) + ColorFormatter::getColorCode(code(), colored) + trNOOP("Change Enemy MP") + colon.data() + enemyStr + DecodeEnumName(troopMemberOp) + " " +
         quantityStr + ColorFormatter::popColor(colored);
}


code:
#pragma once
#include "Database/EventCommands/IEventCommand.hpp"
#include <format>

struct ChangeEnemyMPCommand final : IEventCommand {
  ChangeEnemyMPCommand() = default;
  explicit ChangeEnemyMPCommand(const std::optional<int>& indent, const nlohmann::ordered_json& parameters);
  ~ChangeEnemyMPCommand() override = default;
  [[nodiscard]] EventCode code() const override { return EventCode::Change_Enemy_MP; }
  void serializeParameters(nlohmann::ordered_json& out) const override;
  [[nodiscard]] std::string stringRep(const Database& db, bool colored = true) const override;
  std::shared_ptr<IEventCommand> clone() const override { return std::make_shared<ChangeEnemyMPCommand>(*this); }

  int troopMember{-1};
  QuantityChangeOp troopMemberOp = QuantityChangeOp::_plu__del_Increase;
  QuantityChangeSource quantitySource = QuantityChangeSource::Constant;
  int quantity{1};

  int m_troopId{0};
};


code:
#include "Database/EventCommands/ChangeEnemyState.hpp"

#include "Database/Database.hpp"

ChangeEnemyStateCommand::ChangeEnemyStateCommand(const std::optional<int>& indent, const nlohmann::ordered_json& parameters)
: IEventCommand(indent) {
  parameters.at(0).get_to(troopMember);
  parameters.at(1).get_to(troopMemberOp);
  parameters.at(2).get_to(state);
}

void ChangeEnemyStateCommand::serializeParameters(nlohmann::ordered_json& out) const {
  out.push_back(troopMember);
  out.push_back(troopMemberOp);
  out.push_back(state);
}

std::string ChangeEnemyStateCommand::stringRep(const Database& db, const bool colored) const {
  std::string enemyStr;
  if (troopMember < 0) {
    enemyStr = tr("Entire Troop") + ", ";
  } else {
    enemyStr = std::format("#{}, ", troopMember + 1);
  }

  const auto stStr = db.stateNameOrId(state);
  return indentText(indent()) + symbol(code()) + ColorFormatter::getColorCode(code(), colored) + trNOOP("Change Enemy State") + colon.data() + enemyStr + DecodeEnumName(troopMemberOp) + " " + stStr +
         ColorFormatter::popColor(colored);
}


code:
#pragma once
#include "Database/EventCommands/IEventCommand.hpp"
#include <format>

struct ChangeEnemyStateCommand final : IEventCommand {
  ChangeEnemyStateCommand() = default;
  explicit ChangeEnemyStateCommand(const std::optional<int>& indent, const nlohmann::ordered_json& parameters);
  ~ChangeEnemyStateCommand() override = default;
  [[nodiscard]] EventCode code() const override { return EventCode::Change_Enemy_State; }
  void serializeParameters(nlohmann::ordered_json& out) const override;
  [[nodiscard]] std::string stringRep(const Database& db, bool colored = true) const override;

  std::shared_ptr<IEventCommand> clone() const override { return std::make_shared<ChangeEnemyStateCommand>(*this); }
  bool hasReference(const int targetId, const SearchType type) override {
    if (type == SearchType::State) {
      return targetId == state;
    }
    return false;
  }

  bool setReference(const int targetId, const int newId, const SearchType type) override {
    if (hasReference(targetId, type)) {
      if (type == SearchType::State) {
        state = newId;
      }

      return true;
    }
    return false;
  }

  int troopMember{-1};
  PartyMemberOperation troopMemberOp{};
  int state{1};
  int m_troopId{0};
};


code:
#include "Database/EventCommands/ChangeEnemyTP.hpp"

#include "Database/Database.hpp"

ChangeEnemyTPCommand::ChangeEnemyTPCommand(const std::optional<int>& indent, const nlohmann::ordered_json& parameters)
: IEventCommand(indent) {
  parameters.at(0).get_to(troopMember);
  parameters.at(1).get_to(troopMemberOp);
  parameters.at(2).get_to(quantitySource);
  parameters.at(3).get_to(quantity);
}

void ChangeEnemyTPCommand::serializeParameters(nlohmann::ordered_json& out) const {
  out.push_back(troopMember);
  out.push_back(troopMemberOp);
  out.push_back(quantitySource);
  out.push_back(quantity);
}

std::string ChangeEnemyTPCommand::stringRep(const Database& db, const bool colored) const {
  std::string enemyStr = db.troopMemberName(m_troopId, troopMember);
  if (troopMember >= 0) {
    enemyStr = std::format("#{} {}", troopMember + 1, enemyStr);
  }

  std::string quantityStr;
  if (quantitySource == QuantityChangeSource::Variable) {
    quantityStr = std::format("{{{}}}", db.variableNameOrId(quantity));
  } else {
    quantityStr = std::format("{}", quantity);
  }

  return indentText(indent()) + symbol(code()) + ColorFormatter::getColorCode(code(), colored) + trNOOP("Change Enemy TP") + colon.data() + enemyStr + ", " + DecodeEnumName(troopMemberOp) + " " +
         quantityStr + ColorFormatter::popColor(colored);
}


code:
#pragma once
#include "Database/EventCommands/IEventCommand.hpp"
#include <format>

struct ChangeEnemyTPCommand final : IEventCommand {
  ChangeEnemyTPCommand() = default;
  explicit ChangeEnemyTPCommand(const std::optional<int>& indent, const nlohmann::ordered_json& parameters);
  ~ChangeEnemyTPCommand() override = default;
  [[nodiscard]] EventCode code() const override { return EventCode::Change_Enemy_TP; }
  void serializeParameters(nlohmann::ordered_json& out) const override;
  [[nodiscard]] std::string stringRep(const Database& db, bool colored = true) const override;
  std::shared_ptr<IEventCommand> clone() const override { return std::make_shared<ChangeEnemyTPCommand>(*this); }

  int troopMember{-1};
  QuantityChangeOp troopMemberOp = QuantityChangeOp::_plu__del_Increase;
  QuantityChangeSource quantitySource = QuantityChangeSource::Constant;
  int quantity{1};
  int m_troopId{0};
};


code:
#include "Database/EventCommands/ChangeEquipment.hpp"
#include "Database/Database.hpp"

ChangeEquipmentCommand::ChangeEquipmentCommand(const std::optional<int>& indent, const nlohmann::ordered_json& parameters)
: IEventCommand(indent) {
  parameters.at(0).get_to(actorId);
  parameters.at(1).get_to(equipType);
  parameters.at(2).get_to(equipment);
}

void ChangeEquipmentCommand::serializeParameters(nlohmann::ordered_json& out) const {
  out.push_back(actorId);
  out.push_back(equipType);
  out.push_back(equipment);
}

std::string ChangeEquipmentCommand::stringRep(const Database& db, const bool colored) const {
  const auto actorName = db.actorNameOrId(actorId);
  const auto isDualWield = db.isDualWield(actorId);
  auto eType = equipType;
  if (isDualWield && eType == 2) {
    eType = 1;
  }
  const auto equipTypeName = db.equipTypeName(equipType);
  const auto equipName = equipment == 0 ? trNOOP("None") : eType <= 1 ? db.weaponNameOrId(equipment) : db.armorNameOrId(equipment);
  return indentText(indent()) + symbol(code()) + ColorFormatter::getColorCode(code(), colored) + trNOOP("Change Equipment") + colon.data() +
         std::format("{}, {} = {}", actorName, equipTypeName, equipName) + ColorFormatter::popColor(colored);
}


code:
#pragma once
#include "Database/EventCommands/IEventCommand.hpp"
#include <format>

struct ChangeEquipmentCommand final : IEventCommand {
  ChangeEquipmentCommand() = default;
  explicit ChangeEquipmentCommand(const std::optional<int>& indent, const nlohmann::ordered_json& parameters);
  ~ChangeEquipmentCommand() override = default;
  [[nodiscard]] EventCode code() const override { return EventCode::Change_Equipment; }
  void serializeParameters(nlohmann::ordered_json& out) const override;
  [[nodiscard]] std::string stringRep(const Database& db, bool colored = true) const override;
  std::shared_ptr<IEventCommand> clone() const override { return std::make_shared<ChangeEquipmentCommand>(*this); }
  bool hasReference(int targetId, SearchType type) override {
    if (type == SearchType::Actor) {
      return actorId == targetId;
    }
    if (type == SearchType::Equipment) {
      return equipment == targetId; // Might need some verification
    }
    return false;
  };
  bool setReference(int targetId, int newId, SearchType type) override {
    if (hasReference(targetId, type)) {
      if (type == SearchType::Actor) {
        actorId = newId;
      }
      if (type == SearchType::Equipment) {
        equipment = newId;
      }

      return true;
    }
    return false;
  }
  int actorId{1};
  int equipType{0};
  int equipment{0};
};


code:
#include "Database/EventCommands/ChangeFormationAccess.hpp"

ChangeFormationAccessCommand::ChangeFormationAccessCommand(const std::optional<int>& indent, const nlohmann::ordered_json& parameters)
: IEventCommand(indent) {
  parameters.at(0).get_to(access);
}

void ChangeFormationAccessCommand::serializeParameters(nlohmann::ordered_json& out) const { out.push_back(access); }

std::string ChangeFormationAccessCommand::stringRep(const Database& db, const bool colored) const {
  return indentText(indent()) + symbol(code()) + ColorFormatter::getColorCode(code(), colored) + trNOOP("Change Formation Access") + colon.data() + DecodeEnumName(access) +
         ColorFormatter::popColor(colored);
}


code:
#pragma once
#include "Database/EventCommands/IEventCommand.hpp"

struct ChangeFormationAccessCommand final : IEventCommand {
  ChangeFormationAccessCommand() = default;
  explicit ChangeFormationAccessCommand(const std::optional<int>& indent, const nlohmann::ordered_json& parameters);
  ~ChangeFormationAccessCommand() override = default;
  [[nodiscard]] EventCode code() const override { return EventCode::Change_Formation_Access; }
  void serializeParameters(nlohmann::ordered_json& out) const override;
  [[nodiscard]] std::string stringRep(const Database& db, bool colored = true) const override;
  std::shared_ptr<IEventCommand> clone() const override { return std::make_shared<ChangeFormationAccessCommand>(*this); }

  AccessMode access = AccessMode::Disable;
};


code:
#include "Database/EventCommands/ChangeGold.hpp"

#include "Database/Database.hpp"

ChangeGoldCommand::ChangeGoldCommand(const std::optional<int>& indent, const nlohmann::ordered_json& parameters)
: IEventCommand(indent) {
  parameters.at(0).get_to(operation);
  parameters.at(1).get_to(operandSource);
  parameters.at(2).get_to(operand);
}

void ChangeGoldCommand::serializeParameters(nlohmann::ordered_json& out) const {
  out.push_back(operation);
  out.push_back(operandSource);
  out.push_back(operand);
}

std::string ChangeGoldCommand::stringRep(const Database& db, const bool colored) const {
  if (operandSource == QuantityChangeSource::Constant)
    return indentText(indent()) + symbol(code()) + ColorFormatter::getColorCode(code(), colored) + trNOOP("Change Gold") + colon.data() + DecodeEnumName(operation) + std::to_string(operand) +
           ColorFormatter::popColor(colored);

  return indentText(indent()) + symbol(code()) + ColorFormatter::getColorCode(code(), colored) + trNOOP("Change Gold") + colon.data() + DecodeEnumName(operation) +
         std::format(" {{{}}} ", db.variableNameOrId(operand)) + ColorFormatter::popColor(colored); // Add variable name at the end
}


code:
#pragma once
#include "Database/EventCommands/IEventCommand.hpp"

struct ChangeGoldCommand final : IEventCommand {
  ChangeGoldCommand() = default;
  explicit ChangeGoldCommand(const std::optional<int>& indent, const nlohmann::ordered_json& parameters);
  ~ChangeGoldCommand() override = default;
  [[nodiscard]] EventCode code() const override { return EventCode::Change_Gold; }
  void serializeParameters(nlohmann::ordered_json& out) const override;
  [[nodiscard]] std::string stringRep(const Database& db, bool colored = true) const override;
  std::shared_ptr<IEventCommand> clone() const override { return std::make_shared<ChangeGoldCommand>(*this); }
  bool hasReference(int targetId, SearchType type) override {
    if (type == SearchType::Variable) {
      return operandSource == QuantityChangeSource::Variable && operand == targetId;
    }
    return false;
  };
  bool setReference(int targetId, int newId, SearchType type) override {
    if (hasReference(targetId, type)) {
      if (operandSource == QuantityChangeSource::Variable && operand == targetId) {
        operand = newId;
      }
      return true;
    }
    return false;
  }
  QuantityChangeOp operation = QuantityChangeOp::_plu__del_Increase;
  QuantityChangeSource operandSource = QuantityChangeSource::Constant;
  int operand = 1;
};


code:
#include "Database/EventCommands/ChangeHP.hpp"

#include "Database/Database.hpp"

ChangeHPCommand::ChangeHPCommand(const std::optional<int>& indent, const nlohmann::ordered_json& parameters)
: IEventCommand(indent) {
  parameters.at(0).get_to(comparison);
  parameters.at(1).get_to(value);
  parameters.at(2).get_to(quantityOp);
  parameters.at(3).get_to(quantitySource);
  parameters.at(4).get_to(quantity);
  parameters.at(5).get_to(allowKnockout);
}

void ChangeHPCommand::serializeParameters(nlohmann::ordered_json& out) const {
  out.push_back(comparison);
  out.push_back(value);
  out.push_back(quantityOp);
  out.push_back(quantitySource);
  out.push_back(quantity);
  out.push_back(allowKnockout);
}

std::string ChangeHPCommand::stringRep(const Database& db, const bool colored) const {
  std::string actName;
  if (comparison == ActorComparisonSource::Fixed) {
    if (value <= 0) {
      actName = trNOOP("Entire Party");
    } else {
      actName = db.actorNameOrId(value);
    }
  } else {
    actName = std::format("{{{}}}", db.variableNameOrId(value));
  }

  std::string quantityStr;
  if (quantitySource == QuantityChangeSource::Constant) {
    quantityStr = std::to_string(quantity);
  } else {
    quantityStr = std::format("{{{}}}", db.variableNameOrId(quantity));
  }

  std::string suffix;
  if (allowKnockout) {
    suffix = ColorFormatter::getColor(FormatColor::Gray, colored) + " " + db.parentheses(trNOOP("Allow Knockout")) + ColorFormatter::popColor(colored);
  }
  return indentText(indent()) + symbol(code()) + ColorFormatter::getColorCode(code(), colored) + trNOOP("Change HP") + colon.data() + actName + ", " + DecodeEnumName(quantityOp) + " " + quantityStr +
         ColorFormatter::popColor(colored) + suffix;
}


code:
#pragma once
#include "Database/EventCommands/IEventCommand.hpp"
#include <format>

struct ChangeHPCommand final : IEventCommand {
  ChangeHPCommand() = default;
  explicit ChangeHPCommand(const std::optional<int>& indent, const nlohmann::ordered_json& parameters);
  ~ChangeHPCommand() override = default;
  [[nodiscard]] EventCode code() const override { return EventCode::Change_HP; }
  void serializeParameters(nlohmann::ordered_json& out) const override;
  [[nodiscard]] std::string stringRep(const Database& db, bool colored = true) const override;
  std::shared_ptr<IEventCommand> clone() const override { return std::make_shared<ChangeHPCommand>(*this); }
  bool hasReference(int targetId, SearchType type) override {
    if (type == SearchType::Variable) {
      return (quantitySource == QuantityChangeSource::Variable && quantity == targetId) || (comparison == ActorComparisonSource::Variable && value == targetId);
    }
    return false;
  };

  bool setReference(int targetId, int newId, SearchType type) override {
    if (hasReference(targetId, type)) {
      if (quantitySource == QuantityChangeSource::Variable && quantity == targetId) {
        quantity = newId;
      }
      if (comparison == ActorComparisonSource::Variable && value == targetId) {
        value = newId;
      }
      return true;
    }
    return false;
  }
  ActorComparisonSource comparison = ActorComparisonSource::Fixed;
  int value{1};
  QuantityChangeOp quantityOp = QuantityChangeOp::_plu__del_Increase;
  QuantityChangeSource quantitySource = QuantityChangeSource::Constant;
  int quantity{1};
  bool allowKnockout{false};
};


code:
#include "Database/EventCommands/ChangeItems.hpp"

#include "Database/Database.hpp"

ChangeItemsCommand::ChangeItemsCommand(const std::optional<int>& indent, const nlohmann::ordered_json& parameters)
: IEventCommand(indent) {
  parameters.at(0).get_to(item);
  parameters.at(1).get_to(operation);
  parameters.at(2).get_to(operandSource);
  parameters.at(3).get_to(operand);
}

void ChangeItemsCommand::serializeParameters(nlohmann::ordered_json& out) const {
  out.push_back(item);
  out.push_back(operation);
  out.push_back(operandSource);
  out.push_back(operand);
}

std::string ChangeItemsCommand::stringRep(const Database& db, const bool colored) const {
  std::string itemName = db.itemNameOrId(item);
  std::string operandStr;
  if (operandSource == QuantityChangeSource::Constant) {
    operandStr = std::to_string(operand);
  } else {
    operandStr = std::format("{{{}}}", db.variableNameOrId(operand));
  }
  return indentText(indent()) + symbol(code()) + ColorFormatter::getColorCode(code(), colored) + trNOOP("Change Items") + colon.data() + itemName + " " + DecodeEnumName(operation) + " " + operandStr +
         ColorFormatter::popColor(colored);
}


code:
#pragma once
#include "Database/EventCommands/IEventCommand.hpp"

struct ChangeItemsCommand final : IEventCommand {
  ChangeItemsCommand() = default;
  explicit ChangeItemsCommand(const std::optional<int>& indent, const nlohmann::ordered_json& parameters);
  ~ChangeItemsCommand() override = default;
  [[nodiscard]] EventCode code() const override { return EventCode::Change_Items; }
  void serializeParameters(nlohmann::ordered_json& out) const override;
  [[nodiscard]] std::string stringRep(const Database& db, bool colored = true) const override;
  std::shared_ptr<IEventCommand> clone() const override { return std::make_shared<ChangeItemsCommand>(*this); }
  bool hasReference(int targetId, SearchType type) override {
    if (type == SearchType::Variable) {
      return operandSource == QuantityChangeSource::Variable && operand == targetId;
    }
    if (type == SearchType::Items) {
      return targetId == item;
    }
    return false;
  };

  bool setReference(int targetId, int newId, SearchType type) override {
    if (hasReference(targetId, type)) {
      if (operandSource == QuantityChangeSource::Variable && operand == targetId) {
        operand = newId;
      }
      if (type == SearchType::Items) {
        item = newId;
      }
      return true;
    }
    return false;
  }
  int item{1};
  QuantityChangeOp operation = QuantityChangeOp::_plu__del_Increase;
  QuantityChangeSource operandSource = QuantityChangeSource::Constant;
  int operand{1};
};


code:
#include "Database/EventCommands/ChangeLevel.hpp"

#include "Database/Database.hpp"

ChangeLevelCommand::ChangeLevelCommand(const std::optional<int>& indent, const nlohmann::ordered_json& parameters)
: IEventCommand(indent) {
  parameters.at(0).get_to(comparison);
  parameters.at(1).get_to(value);
  parameters.at(2).get_to(quantityOp);
  parameters.at(3).get_to(quantitySource);
  parameters.at(4).get_to(quantity);
  parameters.at(5).get_to(showLevelUp);
}

void ChangeLevelCommand::serializeParameters(nlohmann::ordered_json& out) const {
  out.push_back(comparison);
  out.push_back(value);
  out.push_back(quantityOp);
  out.push_back(quantitySource);
  out.push_back(quantity);
  out.push_back(showLevelUp);
}

std::string ChangeLevelCommand::stringRep(const Database& db, const bool colored) const {
  std::string actName;
  if (comparison == ActorComparisonSource::Fixed) {
    if (value <= 0) {
      actName = trNOOP("Entire Party");
    } else {
      actName = db.actorNameOrId(value);
    }
  } else {
    actName = std::format("{{{}}}", db.variableNameOrId(value));
  }

  std::string quantityStr;
  if (quantitySource == QuantityChangeSource::Constant) {
    quantityStr = std::to_string(quantity);
  } else {
    quantityStr = std::format("{{{}}}", db.variableNameOrId(quantity));
  }

  std::string suffix;
  if (showLevelUp) {
    suffix = ColorFormatter::getColor(FormatColor::Gray, colored) + " " + db.parentheses(trNOOP("Show Level Up")) + ColorFormatter::popColor(colored);
  }

  return indentText(indent()) + symbol(code()) + ColorFormatter::getColorCode(code(), colored) + trNOOP("Change Level") + colon.data() + actName + ", " + DecodeEnumName(quantityOp) + " " +
         quantityStr + ColorFormatter::popColor(colored) + suffix;
}


code:
#pragma once
#include "Database/EventCommands/IEventCommand.hpp"
#include <format>

struct ChangeLevelCommand final : IEventCommand {
  ChangeLevelCommand() = default;
  explicit ChangeLevelCommand(const std::optional<int>& indent, const nlohmann::ordered_json& parameters);
  ~ChangeLevelCommand() override = default;
  [[nodiscard]] EventCode code() const override { return EventCode::Change_Level; }
  void serializeParameters(nlohmann::ordered_json& out) const override;
  [[nodiscard]] std::string stringRep(const Database& db, bool colored = true) const override;
  std::shared_ptr<IEventCommand> clone() const override { return std::make_shared<ChangeLevelCommand>(*this); }

  bool hasReference(int targetId, SearchType type) override {
    if (type == SearchType::Variable) {
      return (quantitySource == QuantityChangeSource::Variable && quantity == targetId) || (comparison == ActorComparisonSource::Variable && value == targetId);
    }
    return false;
  };
  bool setReference(int targetId, int newId, SearchType type) override {
    if (hasReference(targetId, type)) {
      if (quantitySource == QuantityChangeSource::Variable && quantity == targetId) {
        quantity = newId;
      }
      if (comparison == ActorComparisonSource::Variable && value == targetId) {
        value = newId;
      }
      return true;
    }
    return false;
  }
  ActorComparisonSource comparison = ActorComparisonSource::Fixed;
  int value{1};
  QuantityChangeOp quantityOp = QuantityChangeOp::_plu__del_Increase;
  QuantityChangeSource quantitySource = QuantityChangeSource::Constant;
  int quantity{1};
  bool showLevelUp{false};
};


code:
#include "Database/EventCommands/ChangeMP.hpp"
#include "Database/Database.hpp"

ChangeMPCommand::ChangeMPCommand(const std::optional<int>& indent, const nlohmann::ordered_json& parameters)
: IEventCommand(indent) {
  parameters.at(0).get_to(comparison);
  parameters.at(1).get_to(value);
  parameters.at(2).get_to(quantityOp);
  parameters.at(3).get_to(quantitySource);
  parameters.at(4).get_to(quantity);
}

void ChangeMPCommand::serializeParameters(nlohmann::ordered_json& out) const {
  out.push_back(comparison);
  out.push_back(value);
  out.push_back(quantityOp);
  out.push_back(quantitySource);
  out.push_back(quantity);
}

std::string ChangeMPCommand::stringRep(const Database& db, const bool colored) const {
  std::string actName;
  if (comparison == ActorComparisonSource::Fixed) {
    if (value <= 0) {
      actName = trNOOP("Entire Party");
    } else {
      actName = db.actorNameOrId(value);
    }
  } else {
    actName = std::format("{{{}}}", db.variableNameOrId(value));
  }

  std::string quantityStr;
  if (quantitySource == QuantityChangeSource::Constant) {
    quantityStr = std::to_string(quantity);
  } else {
    quantityStr = std::format("{{{}}}", db.variableNameOrId(quantity));
  }

  return indentText(indent()) + symbol(code()) + ColorFormatter::getColorCode(code(), colored) + trNOOP("Change MP") + colon.data() + actName + ", " + DecodeEnumName(quantityOp) + quantityStr +
         ColorFormatter::popColor(colored);
}


code:
#pragma once
#include "Database/EventCommands/IEventCommand.hpp"
#include <format>

struct ChangeMPCommand final : IEventCommand {
  ChangeMPCommand() = default;
  explicit ChangeMPCommand(const std::optional<int>& indent, const nlohmann::ordered_json& parameters);
  ~ChangeMPCommand() override = default;
  [[nodiscard]] EventCode code() const override { return EventCode::Change_MP; }
  void serializeParameters(nlohmann::ordered_json& out) const override;
  [[nodiscard]] std::string stringRep(const Database& db, bool colored = true) const override;
  std::shared_ptr<IEventCommand> clone() const override { return std::make_shared<ChangeMPCommand>(*this); }
  bool hasReference(int targetId, SearchType type) override {
    if (type == SearchType::Variable) {
      return (quantitySource == QuantityChangeSource::Variable && quantity == targetId) || (comparison == ActorComparisonSource::Variable && value == targetId);
    }
    return false;
  };
  bool setReference(int targetId, int newId, SearchType type) override {
    if (hasReference(targetId, type)) {
      if (quantitySource == QuantityChangeSource::Variable && quantity == targetId) {
        quantity = newId;
      }
      if (comparison == ActorComparisonSource::Variable && value == targetId) {
        value = newId;
      }
      return true;
    }
    return false;
  }
  ActorComparisonSource comparison = ActorComparisonSource::Fixed;
  int value{1};
  QuantityChangeOp quantityOp = QuantityChangeOp::_plu__del_Increase;
  QuantityChangeSource quantitySource = QuantityChangeSource::Constant;
  int quantity{1};
};


code:
#include "Database/EventCommands/ChangeMapDisplayName.hpp"

ChangeMapNameDisplayCommand::ChangeMapNameDisplayCommand(const std::optional<int>& indent, const nlohmann::ordered_json& parameters)
: IEventCommand(indent) {
  parameters.at(0).get_to(checkIfOn);
}

void ChangeMapNameDisplayCommand::serializeParameters(nlohmann::ordered_json& out) const { out.push_back(checkIfOn); }

std::string ChangeMapNameDisplayCommand::stringRep(const Database& db, const bool colored) const {
  return indentText(indent()) + symbol(code()) + ColorFormatter::getColorCode(code(), colored) + trNOOP("Change Map Name Display") + colon.data() + DecodeEnumName(checkIfOn) +
         ColorFormatter::popColor(colored);
}


code:
#pragma once
#include "Database/EventCommands/IEventCommand.hpp"
#include <format>

struct ChangeMapNameDisplayCommand final : IEventCommand {
  ChangeMapNameDisplayCommand() = default;
  explicit ChangeMapNameDisplayCommand(const std::optional<int>& indent, const nlohmann::ordered_json& parameters);
  ~ChangeMapNameDisplayCommand() override = default;
  [[nodiscard]] EventCode code() const override { return EventCode::Change_Map_Display_Name; }
  void serializeParameters(nlohmann::ordered_json& out) const override;
  [[nodiscard]] std::string stringRep(const Database& db, bool colored = true) const override;
  std::shared_ptr<IEventCommand> clone() const override { return std::make_shared<ChangeMapNameDisplayCommand>(*this); }

  ValueControl checkIfOn;
};


code:
#include "Database/EventCommands/ChangeMenuAccess.hpp"

ChangeMenuAccessCommand::ChangeMenuAccessCommand(const std::optional<int>& indent, const nlohmann::ordered_json& parameters)
: IEventCommand(indent) {
  parameters.at(0).get_to(access);
}

void ChangeMenuAccessCommand::serializeParameters(nlohmann::ordered_json& out) const { out.push_back(access); }

std::string ChangeMenuAccessCommand::stringRep(const Database& db, const bool colored) const {
  return indentText(indent()) + symbol(code()) + ColorFormatter::getColorCode(code(), colored) + trNOOP("Change Menu Access") + colon.data() + DecodeEnumName(access) +
         ColorFormatter::popColor(colored);
}


code:
#pragma once
#include "Database/EventCommands/IEventCommand.hpp"

struct ChangeMenuAccessCommand final : IEventCommand {
  ChangeMenuAccessCommand() = default;
  explicit ChangeMenuAccessCommand(const std::optional<int>& indent, const nlohmann::ordered_json& parameters);
  ~ChangeMenuAccessCommand() override = default;
  [[nodiscard]] EventCode code() const override { return EventCode::Change_Menu_Access; }
  void serializeParameters(nlohmann::ordered_json& out) const override;
  [[nodiscard]] std::string stringRep(const Database& db, bool colored = true) const override;
  std::shared_ptr<IEventCommand> clone() const override { return std::make_shared<ChangeMenuAccessCommand>(*this); }

  AccessMode access;
};


code:
#include "Database/EventCommands/ChangeName.hpp"
#include "Database/Database.hpp"

ChangeNameCommand::ChangeNameCommand(const std::optional<int>& indent, const nlohmann::ordered_json& parameters)
: IEventCommand(indent) {
  parameters.at(0).get_to(actor);
  parameters.at(1).get_to(name);
}

void ChangeNameCommand::serializeParameters(nlohmann::ordered_json& out) const {
  out.push_back(actor);
  out.push_back(name);
}

std::string ChangeNameCommand::stringRep(const Database& db, const bool colored) const {
  return indentText(indent()) + symbol(code()) + ColorFormatter::getColorCode(code(), colored) + trNOOP("Change Name") + colon.data() + db.actorNameOrId(actor) + ", " + name +
         ColorFormatter::popColor(colored);
}


code:
#pragma once
#include "Database/EventCommands/IEventCommand.hpp"
#include <format>

struct ChangeNameCommand final : IEventCommand {
  ChangeNameCommand() = default;
  explicit ChangeNameCommand(const std::optional<int>& indent, const nlohmann::ordered_json& parameters);
  ~ChangeNameCommand() override = default;
  [[nodiscard]] EventCode code() const override { return EventCode::Change_Name; }
  void serializeParameters(nlohmann::ordered_json& out) const override;
  [[nodiscard]] std::string stringRep(const Database& db, bool colored = true) const override;
  std::shared_ptr<IEventCommand> clone() const override { return std::make_shared<ChangeNameCommand>(*this); }
  bool hasReference(int targetId, SearchType type) override {
    if (type == SearchType::Actor) {
      return targetId == actor;
    }
    return false;
  };
  bool setReference(int targetId, int newId, SearchType type) override {
    if (hasReference(targetId, type)) {
      if (type == SearchType::Actor) {
        actor = newId;
      }
      return true;
    }
    return false;
  }
  int actor = 1;
  std::string name;
};


code:
#include "Database/EventCommands/ChangeNickname.hpp"
#include "Database/Database.hpp"

ChangeNicknameCommand::ChangeNicknameCommand(const std::optional<int>& indent, const nlohmann::ordered_json& parameters)
: IEventCommand(indent) {
  parameters.at(0).get_to(actor);
  parameters.at(1).get_to(nick);
}

void ChangeNicknameCommand::serializeParameters(nlohmann::ordered_json& out) const {
  out.push_back(actor);
  out.push_back(nick);
}

std::string ChangeNicknameCommand::stringRep(const Database& db, const bool colored) const {
  return indentText(indent()) + symbol(code()) + ColorFormatter::getColorCode(code(), colored) + trNOOP("Change Nickname") + colon.data() + db.actorNameOrId(actor) + ", " + nick +
         ColorFormatter::popColor(colored);
}


code:
#pragma once
#include "Database/EventCommands/IEventCommand.hpp"
#include <format>

struct ChangeNicknameCommand final : IEventCommand {
  ChangeNicknameCommand() = default;
  explicit ChangeNicknameCommand(const std::optional<int>& indent, const nlohmann::ordered_json& parameters);
  ~ChangeNicknameCommand() override = default;
  [[nodiscard]] EventCode code() const override { return EventCode::Change_Nickname; }
  void serializeParameters(nlohmann::ordered_json& out) const override;
  [[nodiscard]] std::string stringRep(const Database& db, bool colored = true) const override;
  std::shared_ptr<IEventCommand> clone() const override { return std::make_shared<ChangeNicknameCommand>(*this); }
  bool hasReference(int targetId, SearchType type) override {
    if (type == SearchType::Actor) {
      return targetId == actor;
    }
    return false;
  };
  bool setReference(int targetId, int newId, SearchType type) override {
    if (hasReference(targetId, type)) {
      if (type == SearchType::Actor) {
        actor = newId;
      }
      return true;
    }
    return false;
  }
  int actor{1};
  std::string nick;
};


code:
#include "Database/EventCommands/ChangeParallax.hpp"

#include "Database/Database.hpp"

ChangeParallaxCommand::ChangeParallaxCommand(const std::optional<int>& indent, const nlohmann::ordered_json& parameters)
: IEventCommand(indent) {
  parameters.at(0).get_to(image);
  parameters.at(1).get_to(loopHorizontally);
  parameters.at(2).get_to(loopVertically);
  parameters.at(3).get_to(scrollX);
  parameters.at(4).get_to(scrollY);
}

void ChangeParallaxCommand::serializeParameters(nlohmann::ordered_json& out) const {
  out.push_back(image);
  out.push_back(loopHorizontally);
  out.push_back(loopVertically);
  out.push_back(scrollX);
  out.push_back(scrollY);
}

std::string ChangeParallaxCommand::stringRep(const Database& db, const bool colored) const {
  auto rep = indentText(indent()) + symbol(code()) + ColorFormatter::getColorCode(code(), colored) + trNOOP("Change Parallax") + colon.data() + db.imageText(image) + ColorFormatter::popColor(colored);
  if (loopHorizontally || loopVertically) {
    rep += ColorFormatter::getColor(FormatColor::Gray, colored) + " (";

    if (loopHorizontally) {
      rep += trNOOP("Loop Horizontally");
    }
    if (loopVertically) {
      if (loopHorizontally) {
        rep += ", ";
      }
      rep += trNOOP("Loop Vertically");
    }
    rep = rep + ")" + ColorFormatter::popColor(colored);
  }

  return rep;
}


code:
#pragma once

#include "Database/EventCommands/IEventCommand.hpp"

struct ChangeParallaxCommand final : IEventCommand {
  ChangeParallaxCommand() = default;
  explicit ChangeParallaxCommand(const std::optional<int>& indent, const nlohmann::ordered_json& parameters);
  ~ChangeParallaxCommand() override = default;
  [[nodiscard]] EventCode code() const override { return EventCode::Change_Parallax; }
  void serializeParameters(nlohmann::ordered_json& out) const override;
  std::shared_ptr<IEventCommand> clone() const override { return std::make_shared<ChangeParallaxCommand>(*this); }

  std::string image;
  bool loopHorizontally{false};
  bool loopVertically{false};
  int scrollX{0};
  int scrollY{0};

  std::string stringRep(const Database& db, bool colored = true) const override;
};


code:
#include "Database/EventCommands/ChangeParameter.hpp"

#include "Database/Database.hpp"

ChangeParameterCommand::ChangeParameterCommand(const std::optional<int>& indent, const nlohmann::ordered_json& parameters)
: IEventCommand(indent) {
  parameters.at(0).get_to(comparison);
  parameters.at(1).get_to(value);
  parameters.at(2).get_to(param);
  parameters.at(3).get_to(quantityOp);
  parameters.at(4).get_to(quantitySource);
  parameters.at(5).get_to(quantity);
}

void ChangeParameterCommand::serializeParameters(nlohmann::ordered_json& out) const {
  out.push_back(comparison);
  out.push_back(value);
  out.push_back(param);
  out.push_back(quantityOp);
  out.push_back(quantitySource);
  out.push_back(quantity);
}

std::string ChangeParameterCommand::stringRep(const Database& db, const bool colored) const {
  std::string actorName;
  if (comparison == ActorComparisonSource::Fixed) {
    if (value <= 0) {
      actorName = trNOOP("Entire Party");
    } else {
      actorName = db.actorNameOrId(value);
    }
  } else {
    actorName = std::format("{{{}}}", db.variableNameOrId(value));
  }

  std::string quantityStr;
  if (quantitySource == QuantityChangeSource::Constant) {
    quantityStr = std::to_string(quantity);
  } else {
    quantityStr = std::format("{{{}}}", db.variableNameOrId(quantity));
  }

  return indentText(indent()) + symbol(code()) + ColorFormatter::getColorCode(code(), colored) + trNOOP("Change Parameter") + colon.data() + actorName + ", " + DecodeEnumName(param) + " " +
         DecodeEnumName(quantityOp) + " " + quantityStr + ColorFormatter::popColor(colored);
}


code:
#pragma once
#include "Database/EventCommands/IEventCommand.hpp"
#include <format>

struct ChangeParameterCommand final : IEventCommand {
  ChangeParameterCommand() = default;
  explicit ChangeParameterCommand(const std::optional<int>& indent, const nlohmann::ordered_json& parameters);
  ~ChangeParameterCommand() override = default;
  [[nodiscard]] EventCode code() const override { return EventCode::Change_Parameter; }
  void serializeParameters(nlohmann::ordered_json& out) const override;
  [[nodiscard]] std::string stringRep(const Database& db, bool colored = true) const override;
  std::shared_ptr<IEventCommand> clone() const override { return std::make_shared<ChangeParameterCommand>(*this); }
  bool hasReference(int targetId, SearchType type) override {
    if (type == SearchType::Variable) {
      return (quantitySource == QuantityChangeSource::Variable && quantity == targetId) || (comparison == ActorComparisonSource::Variable && value == targetId);
    }
    return false;
  };
  bool setReference(int targetId, int newId, SearchType type) override {
    if (hasReference(targetId, type)) {
      if (quantitySource == QuantityChangeSource::Variable && quantity == targetId) {
        quantity = newId;
      }
      if (comparison == ActorComparisonSource::Variable && value == targetId) {
        value = newId;
      }
      return true;
    }
    return false;
  }
  ActorComparisonSource comparison = ActorComparisonSource::Fixed;
  int value{1};
  ParameterSource param = ParameterSource::Max_HP;
  QuantityChangeOp quantityOp = QuantityChangeOp::_plu__del_Increase;
  QuantityChangeSource quantitySource = QuantityChangeSource::Constant;
  int quantity{1};
};


code:
#include "Database/EventCommands/ChangePartyMember.hpp"

#include "Database/Database.hpp"

ChangePartyMemberCommand::ChangePartyMemberCommand(const std::optional<int>& indent, const nlohmann::ordered_json& parameters)
: IEventCommand(indent) {
  parameters.at(0).get_to(member);
  parameters.at(1).get_to(operation);
  parameters.at(2).get_to(initialize);
}

void ChangePartyMemberCommand::serializeParameters(nlohmann::ordered_json& out) const {
  out.push_back(member);
  out.push_back(operation);
  out.push_back(initialize);
}

std::string ChangePartyMemberCommand::stringRep(const Database& db, const bool colored) const {
  const auto actName = db.actorNameOrId(member);
  std::string suffix;
  if (initialize) {
    suffix = ColorFormatter::getColor(FormatColor::Gray, colored) + " " + db.parentheses(trNOOP("Initialize")) + ColorFormatter::popColor(colored);
  }
  return indentText(indent()) + symbol(code()) + ColorFormatter::getColorCode(code(), colored) + trNOOP("Change Party Member") + colon.data() +
         (operation == PartyMemberOperation::_daa__del_Remove ? trNOOP("Remove") : trNOOP("Add")) + " " + actName + ColorFormatter::popColor(colored) + suffix;
}


code:
#pragma once
#include "Database/EventCommands/IEventCommand.hpp"

struct ChangePartyMemberCommand final : IEventCommand {
  ChangePartyMemberCommand() = default;
  explicit ChangePartyMemberCommand(const std::optional<int>& indent, const nlohmann::ordered_json& parameters);
  ~ChangePartyMemberCommand() override = default;
  [[nodiscard]] EventCode code() const override { return EventCode::Change_Party_Member; }
  void serializeParameters(nlohmann::ordered_json& out) const override;
  [[nodiscard]] std::string stringRep(const Database& db, bool colored = true) const override;
  std::shared_ptr<IEventCommand> clone() const override { return std::make_shared<ChangePartyMemberCommand>(*this); }
  bool hasReference(int targetId, SearchType type) override {
    if (type == SearchType::Actor) {
      return member == targetId;
    }
    return false;
  };
  bool setReference(int targetId, int newId, SearchType type) override {
    if (hasReference(targetId, type)) {
      if (type == SearchType::Actor) {
        member = newId;
      }
      return true;
    }
    return false;
  }
  int member = 1;
  PartyMemberOperation operation = PartyMemberOperation::_plu__del_Add;
  bool initialize = false;
};


code:
#include "Database/EventCommands/ChangePlayerFollowers.hpp"

ChangePlayerFollowersCommand::ChangePlayerFollowersCommand(const std::optional<int>& indent, const nlohmann::ordered_json& parameters)
: IEventCommand(indent) {
  parameters.at(0).get_to(followersEnabled);
}

void ChangePlayerFollowersCommand::serializeParameters(nlohmann::ordered_json& out) const { out.push_back(followersEnabled); }

std::string ChangePlayerFollowersCommand::stringRep(const Database& db, const bool colored) const {
  return indentText(indent()) + symbol(code()) + ColorFormatter::getColorCode(code(), colored) + trNOOP("Change Player Followers") + colon.data() + DecodeEnumName(followersEnabled) +
         ColorFormatter::popColor(colored);
}


code:
#pragma once
#include "Database/EventCommands/IEventCommand.hpp"
#include <format>

struct ChangePlayerFollowersCommand final : IEventCommand {
  ChangePlayerFollowersCommand() = default;
  explicit ChangePlayerFollowersCommand(const std::optional<int>& indent, const nlohmann::ordered_json& parameters);
  ~ChangePlayerFollowersCommand() override = default;
  [[nodiscard]] EventCode code() const override { return EventCode::Change_Player_Followers; }
  void serializeParameters(nlohmann::ordered_json& out) const override;
  [[nodiscard]] std::string stringRep(const Database& db, bool colored = true) const override;
  std::shared_ptr<IEventCommand> clone() const override { return std::make_shared<ChangePlayerFollowersCommand>(*this); }

  ValueControl followersEnabled = ValueControl::ON;
};


code:
#include "Database/EventCommands/ChangeProfile.hpp"
#include "Database/Database.hpp"

ChangeProfileCommand::ChangeProfileCommand(const std::optional<int>& indent, const nlohmann::ordered_json& parameters)
: IEventCommand(indent) {
  parameters.at(0).get_to(actor);
  parameters.at(1).get_to(profile);
}

void ChangeProfileCommand::serializeParameters(nlohmann::ordered_json& out) const {
  out.push_back(actor);
  out.push_back(profile);
}

std::string ChangeProfileCommand::stringRep(const Database& db, const bool colored) const {
  const auto actName = Database::instance()->actorNameOrId(actor);
  auto tmpProfile = profile;
  ReplaceStr(tmpProfile, "\n", " ");
  return indentText(indent()) + symbol(code()) + ColorFormatter::getColorCode(code(), colored) + trNOOP("Change Profile") + colon.data() + actName + ", " + tmpProfile +
         ColorFormatter::popColor(colored);
}


code:
#pragma once
#include "Database/EventCommands/IEventCommand.hpp"
#include <format>

struct ChangeProfileCommand final : IEventCommand {
  ChangeProfileCommand() = default;
  explicit ChangeProfileCommand(const std::optional<int>& indent, const nlohmann::ordered_json& parameters);
  ~ChangeProfileCommand() override = default;
  [[nodiscard]] EventCode code() const override { return EventCode::Change_Profile; }
  void serializeParameters(nlohmann::ordered_json& out) const override;
  [[nodiscard]] std::string stringRep(const Database& db, bool colored = true) const override;
  std::shared_ptr<IEventCommand> clone() const override { return std::make_shared<ChangeProfileCommand>(*this); }
  bool hasReference(int targetId, SearchType type) override {
    if (type == SearchType::Actor) {
      return actor == targetId;
    }
    return false;
  };
  bool setReference(int targetId, int newId, SearchType type) override {
    if (hasReference(targetId, type)) {
      if (type == SearchType::Actor) {
        actor = newId;
      }
      return true;
    }
    return false;
  }
  int actor = 1;
  std::string profile;
};


code:
#include "Database/EventCommands/ChangeSaveAccess.hpp"

ChangeSaveAccessCommand::ChangeSaveAccessCommand(const std::optional<int>& indent, const nlohmann::ordered_json& parameters)
: IEventCommand(indent) {
  parameters.at(0).get_to(access);
}

void ChangeSaveAccessCommand::serializeParameters(nlohmann::ordered_json& out) const { out.push_back(access); }

std::string ChangeSaveAccessCommand::stringRep(const Database& db, const bool colored) const {
  return indentText(indent()) + symbol(code()) + ColorFormatter::getColorCode(code(), colored) + trNOOP("Change Save Access") + colon.data() + DecodeEnumName(access) +
         ColorFormatter::popColor(colored);
}


code:
#pragma once
#include "Database/EventCommands/IEventCommand.hpp"

struct ChangeSaveAccessCommand final : IEventCommand {
  ChangeSaveAccessCommand() = default;
  explicit ChangeSaveAccessCommand(const std::optional<int>& indent, const nlohmann::ordered_json& parameters);
  ~ChangeSaveAccessCommand() override = default;
  [[nodiscard]] EventCode code() const override { return EventCode::Change_Save_Access; }
  void serializeParameters(nlohmann::ordered_json& out) const override;
  [[nodiscard]] std::string stringRep(const Database& db, bool colored = true) const override;
  std::shared_ptr<IEventCommand> clone() const override { return std::make_shared<ChangeSaveAccessCommand>(*this); }

  AccessMode access = AccessMode::Disable;
};


code:
#include "Database/EventCommands/ChangeSkill.hpp"
#include "Database/Database.hpp"

ChangeSkillCommand::ChangeSkillCommand(const std::optional<int>& indent, const nlohmann::ordered_json& parameters)
: IEventCommand(indent) {
  parameters.at(0).get_to(comparison);
  parameters.at(1).get_to(value);
  parameters.at(2).get_to(skillOp);
  parameters.at(3).get_to(skill);
}

void ChangeSkillCommand::serializeParameters(nlohmann::ordered_json& out) const {
  out.push_back(comparison);
  out.push_back(value);
  out.push_back(skillOp);
  out.push_back(skill);
}

std::string ChangeSkillCommand::stringRep(const Database& db, const bool colored) const {
  std::string actorName;
  if (comparison == ActorComparisonSource::Variable) {
    actorName = db.system.variable(value);
    actorName = actorName.empty() ? std::format("{{{:04}}}", value) : actorName;
  } else {
    actorName = value == 0 ? trNOOP("Entire Party") : db.actorNameOrId(value);
  }

  return indentText(indent()) + symbol(code()) + ColorFormatter::getColorCode(code(), colored) + trNOOP("Change Skill") + colon.data() + actorName + ", " + DecodeEnumName(skillOp) + " " +
         db.skillNameOrId(skill) + ColorFormatter::popColor(colored);
}


code:
#pragma once
#include "Database/EventCommands/IEventCommand.hpp"
#include <format>

struct ChangeSkillCommand final : IEventCommand {
  ChangeSkillCommand() = default;
  explicit ChangeSkillCommand(const std::optional<int>& indent, const nlohmann::ordered_json& parameters);
  ~ChangeSkillCommand() override = default;
  [[nodiscard]] EventCode code() const override { return EventCode::Change_Skill; }
  void serializeParameters(nlohmann::ordered_json& out) const override;
  [[nodiscard]] std::string stringRep(const Database& db, bool colored = true) const override;
  std::shared_ptr<IEventCommand> clone() const override { return std::make_shared<ChangeSkillCommand>(*this); }
  bool hasReference(const int targetId, const SearchType type) override {
    if (type == SearchType::Variable) {
      return comparison == ActorComparisonSource::Variable && value == targetId;
    }
    if (type == SearchType::Skill) {
      return targetId == skill;
    }
    return false;
  };
  bool setReference(const int targetId, const int newId, const SearchType type) override {
    if (hasReference(targetId, type)) {
      if (comparison == ActorComparisonSource::Variable && value == targetId) {
        value = newId;
      }
      if (type == SearchType::Skill) {
        skill = newId;
      }
      return true;
    }
    return false;
  }
  ActorComparisonSource comparison = ActorComparisonSource::Fixed;
  int value{1};
  SkillOperation skillOp = SkillOperation::_plu__del_Learn;
  int skill{1};
};


code:
#include "Database/EventCommands/ChangeState.hpp"

#include "Database/Database.hpp"

ChangeStateCommand::ChangeStateCommand(const std::optional<int>& indent, const nlohmann::ordered_json& parameters)
: IEventCommand(indent) {
  parameters.at(0).get_to(comparison);
  parameters.at(1).get_to(value);
  parameters.at(2).get_to(stateOp);
  parameters.at(3).get_to(state);
}

void ChangeStateCommand::serializeParameters(nlohmann::ordered_json& out) const {
  out.push_back(comparison);
  out.push_back(value);
  out.push_back(stateOp);
  out.push_back(state);
}

std::string ChangeStateCommand::stringRep(const Database& db, const bool colored) const {
  std::string actorName;
  if (comparison == ActorComparisonSource::Fixed) {
    if (value == 0) {
      actorName = trNOOP("Entire Party");
    } else {
      actorName = db.actorNameOrId(value);
    }

  } else {
    actorName = std::format("{{{}}}", db.variableNameOrId(value));
  }

  const auto stateName = db.stateNameOrId(state);
  return indentText(indent()) + symbol(code()) + ColorFormatter::getColorCode(code(), colored) + trNOOP("Change State") + colon.data() + actorName + ", " + DecodeEnumName(stateOp) + " " + stateName +
         ColorFormatter::popColor(colored);
}


code:
#pragma once
#include "Database/EventCommands/IEventCommand.hpp"
#include <format>

struct ChangeStateCommand final : IEventCommand {
  ChangeStateCommand() = default;
  explicit ChangeStateCommand(const std::optional<int>& indent, const nlohmann::ordered_json& parameters);
  ~ChangeStateCommand() override = default;
  [[nodiscard]] EventCode code() const override { return EventCode::Change_State; }
  void serializeParameters(nlohmann::ordered_json& out) const override;
  [[nodiscard]] std::string stringRep(const Database& db, bool colored = true) const override;
  std::shared_ptr<IEventCommand> clone() const override { return std::make_shared<ChangeStateCommand>(*this); }
  bool hasReference(int targetId, SearchType type) override {
    if (type == SearchType::Variable) {
      return comparison == ActorComparisonSource::Variable && value == targetId;
    }
    if (type == SearchType::State) {
      return targetId == state;
    }
    return false;
  };
  bool setReference(int targetId, int newId, SearchType type) override {
    if (hasReference(targetId, type)) {
      if (comparison == ActorComparisonSource::Variable && value == targetId) {
        value = newId;
      }
      if (type == SearchType::State) {
        state = newId;
      }
      return true;
    }
    return false;
  }
  ActorComparisonSource comparison = ActorComparisonSource::Fixed;
  int value{1};
  PartyMemberOperation stateOp = PartyMemberOperation::_plu__del_Add;
  int state{1};
};


code:
#include "Database/EventCommands/ChangeTP.hpp"

#include "Database/Database.hpp"

ChangeTPCommand::ChangeTPCommand(const std::optional<int>& indent, const nlohmann::ordered_json& parameters)
: IEventCommand(indent) {
  parameters.at(0).get_to(comparison);
  parameters.at(1).get_to(value);
  parameters.at(2).get_to(quantityOp);
  parameters.at(3).get_to(quantitySource);
  parameters.at(4).get_to(quantity);
}

void ChangeTPCommand::serializeParameters(nlohmann::ordered_json& out) const {
  out.push_back(comparison);
  out.push_back(value);
  out.push_back(quantityOp);
  out.push_back(quantitySource);
  out.push_back(quantity);
}

std::string ChangeTPCommand::stringRep(const Database& db, const bool colored) const {
  std::string actorName;
  if (comparison == ActorComparisonSource::Fixed) {
    if (value <= 0) {
      actorName = trNOOP("Entire Party");
    } else {
      actorName = db.actorNameOrId(value);
    }
  } else {
    actorName = db.variableNameOrId(value);
  }

  std::string quantityStr;
  if (quantitySource == QuantityChangeSource::Variable) {
    quantityStr = std::format("{{{}}}", db.variableNameOrId(quantity));
  } else {
    quantityStr = std::to_string(quantity);
  }

  return indentText(indent()) + symbol(code()) + ColorFormatter::getColorCode(code(), colored) + trNOOP("Change TP") + colon.data() + actorName + ", " + DecodeEnumName(quantityOp) + " " +
         quantityStr + ColorFormatter::popColor(colored);
}


code:
#pragma once
#include "Database/EventCommands/IEventCommand.hpp"
#include <format>

struct ChangeTPCommand final : IEventCommand {
  ChangeTPCommand() = default;
  explicit ChangeTPCommand(const std::optional<int>& indent, const nlohmann::ordered_json& parameters);
  ~ChangeTPCommand() override = default;
  [[nodiscard]] EventCode code() const override { return EventCode::Change_TP; }
  void serializeParameters(nlohmann::ordered_json& out) const override;
  [[nodiscard]] std::string stringRep(const Database& db, bool colored = true) const override;
  std::shared_ptr<IEventCommand> clone() const override { return std::make_shared<ChangeTPCommand>(*this); }
  bool hasReference(int targetId, SearchType type) override {
    if (type == SearchType::Variable) {
      return (quantitySource == QuantityChangeSource::Variable && quantity == targetId) || (comparison == ActorComparisonSource::Variable && value == targetId);
    }
    return false;
  };
  bool setReference(int targetId, int newId, SearchType type) override {
    if (hasReference(targetId, type)) {
      if (quantitySource == QuantityChangeSource::Variable && quantity == targetId) {
        quantity = newId;
      }
      if (comparison == ActorComparisonSource::Variable && value == targetId) {
        value = newId;
      }
      return true;
    }
    return false;
  }
  ActorComparisonSource comparison = ActorComparisonSource::Fixed;
  int value{1};
  QuantityChangeOp quantityOp = QuantityChangeOp::_plu__del_Increase;
  QuantityChangeSource quantitySource = QuantityChangeSource::Constant;
  int quantity{1};
};


code:
#include "Database/EventCommands/ChangeTileset.hpp"
#include "Database/Database.hpp"

ChangeTilesetCommand::ChangeTilesetCommand(const std::optional<int>& indent, const nlohmann::ordered_json& parameters)
: IEventCommand(indent) {
  parameters.at(0).get_to(tileset);
}

void ChangeTilesetCommand::serializeParameters(nlohmann::ordered_json& out) const { out.push_back(tileset); }

std::string ChangeTilesetCommand::stringRep(const Database& db, const bool colored) const {
  const auto tilesetName = db.tilesetNameOrId(tileset);
  return indentText(indent()) + symbol(code()) + ColorFormatter::getColorCode(code(), colored) + trNOOP("Change Tileset") + colon.data() + tilesetName + ColorFormatter::popColor(colored);
}


code:
#pragma once
#include "Database/EventCommands/IEventCommand.hpp"
#include <format>

struct ChangeTilesetCommand final : IEventCommand {
  ChangeTilesetCommand() = default;
  explicit ChangeTilesetCommand(const std::optional<int>& indent, const nlohmann::ordered_json& parameters);
  ~ChangeTilesetCommand() override = default;
  [[nodiscard]] EventCode code() const override { return EventCode::Change_Tileset; }
  void serializeParameters(nlohmann::ordered_json& out) const override;
  [[nodiscard]] std::string stringRep(const Database& db, bool colored = true) const override;
  std::shared_ptr<IEventCommand> clone() const override { return std::make_shared<ChangeTilesetCommand>(*this); }

  int tileset{1};
};


code:
#include "Database/EventCommands/ChangeTransparency.hpp"

ChangeTransparencyCommand::ChangeTransparencyCommand(const std::optional<int>& indent, const nlohmann::ordered_json& parameters)
: IEventCommand(indent) {
  parameters.at(0).get_to(transparency);
}

void ChangeTransparencyCommand::serializeParameters(nlohmann::ordered_json& out) const { out.push_back(transparency); }

std::string ChangeTransparencyCommand::stringRep(const Database& db, const bool colored) const {
  return indentText(indent()) + symbol(code()) + ColorFormatter::getColorCode(code(), colored) + trNOOP("Change Transparency") + colon.data() + DecodeEnumName(transparency) +
         ColorFormatter::popColor(colored);
}


code:
#pragma once
#include "Database/EventCommands/IEventCommand.hpp"
#include <format>

struct ChangeTransparencyCommand final : IEventCommand {
  ChangeTransparencyCommand() = default;
  explicit ChangeTransparencyCommand(const std::optional<int>& indent, const nlohmann::ordered_json& parameters);
  ~ChangeTransparencyCommand() override = default;
  [[nodiscard]] EventCode code() const override { return EventCode::Change_Transparency; }
  void serializeParameters(nlohmann::ordered_json& out) const override;
  [[nodiscard]] std::string stringRep(const Database& db, bool colored = true) const override;
  std::shared_ptr<IEventCommand> clone() const override { return std::make_shared<ChangeTransparencyCommand>(*this); }

  ValueControl transparency;
};


code:
#include "Database/EventCommands/ChangeVehicleBGM.hpp"

#include "Database/Database.hpp"

ChangeVehicleBGMCommand::ChangeVehicleBGMCommand(const std::optional<int>& indent, const nlohmann::ordered_json& parameters)
: IEventCommand(indent) {
  parameters.at(0).get_to(vehicle);
  parameters.at(1).get_to(bgm);
}

void ChangeVehicleBGMCommand::serializeParameters(nlohmann::ordered_json& out) const {
  out.push_back(vehicle);
  out.push_back(bgm);
}

std::string ChangeVehicleBGMCommand::stringRep(const Database& db, const bool colored) const {
  return indentText(indent()) + symbol(code()) + ColorFormatter::getColorCode(code(), colored) + trNOOP("Change Vehicle BGM") + colon.data() + DecodeEnumName(vehicle) + ", " +
         Database::audioText(bgm) + ColorFormatter::popColor(colored);
}


code:
#pragma once
#include "Database/Audio.hpp"
#include "Database/EventCommands/IEventCommand.hpp"
#include <format>
struct ChangeVehicleBGMCommand final : IEventCommand {
  ChangeVehicleBGMCommand() = default;
  explicit ChangeVehicleBGMCommand(const std::optional<int>& indent, const nlohmann::ordered_json& parameters);
  ~ChangeVehicleBGMCommand() override = default;
  [[nodiscard]] EventCode code() const override { return EventCode::Change_Vehicle_BGM; }
  void serializeParameters(nlohmann::ordered_json& out) const override;
  [[nodiscard]] std::string stringRep(const Database& db, bool colored = true) const override;
  std::shared_ptr<IEventCommand> clone() const override { return std::make_shared<ChangeVehicleBGMCommand>(*this); }
  bool hasStringReference(const std::string& text, SearchType type) override {
    if (type == SearchType::Audio) {
      return text.contains(bgm.name());
    }
    return false;
  };
  VehicleType vehicle = VehicleType::Boat;
  Audio bgm;
};


code:
#include "Database/EventCommands/ChangeVehicleImage.hpp"

#include "Database/Database.hpp"

ChangeVehicleImageCommand::ChangeVehicleImageCommand(const std::optional<int>& indent, const nlohmann::ordered_json& parameters)
: IEventCommand(indent) {
  parameters.at(0).get_to(vehicle);
  parameters.at(1).get_to(picture);
  parameters.at(2).get_to(pictureIndex);
}

void ChangeVehicleImageCommand::serializeParameters(nlohmann::ordered_json& out) const {
  out.push_back(vehicle);
  out.push_back(picture);
  out.push_back(pictureIndex);
}

std::string ChangeVehicleImageCommand::stringRep(const Database& db, const bool colored) const {
  return indentText(indent()) + symbol(code()) + ColorFormatter::getColorCode(code(), colored) + trNOOP("Change Vehicle Image") + colon.data() + DecodeEnumName(vehicle) + ", " +
         db.imageText(picture, pictureIndex) + ColorFormatter::popColor(colored);
}


code:
#pragma once
#include "Database/EventCommands/IEventCommand.hpp"
#include <format>

struct ChangeVehicleImageCommand final : IEventCommand {
  ChangeVehicleImageCommand() = default;
  explicit ChangeVehicleImageCommand(const std::optional<int>& indent, const nlohmann::ordered_json& parameters);
  ~ChangeVehicleImageCommand() override = default;
  [[nodiscard]] EventCode code() const override { return EventCode::Change_Vehicle_Image; }
  void serializeParameters(nlohmann::ordered_json& out) const override;
  [[nodiscard]] std::string stringRep(const Database& db, bool colored = true) const override;
  std::shared_ptr<IEventCommand> clone() const override { return std::make_shared<ChangeVehicleImageCommand>(*this); }

  VehicleType vehicle = VehicleType::Boat;
  std::string picture;
  int pictureIndex{0};
};


code:
#include "Database/EventCommands/ChangeVictoryME.hpp"

#include "Database/Database.hpp"

ChangeVictoryMECommand::ChangeVictoryMECommand(const std::optional<int>& indent, const nlohmann::ordered_json& parameters)
: IEventCommand(indent) {
  parameters.at(0).get_to(me);
}

void ChangeVictoryMECommand::serializeParameters(nlohmann::ordered_json& out) const { out.push_back(me); }

std::string ChangeVictoryMECommand::stringRep(const Database& db, const bool colored) const {
  return indentText(indent()) + symbol(code()) + ColorFormatter::getColorCode(code(), colored) + trNOOP("Change Victory ME") + colon.data() + Database::audioText(me) +
         ColorFormatter::popColor(colored);
}


code:
#pragma once
#include "Database/Audio.hpp"
#include "Database/EventCommands/IEventCommand.hpp"
#include <format>

struct ChangeVictoryMECommand final : IEventCommand {
  ChangeVictoryMECommand() = default;
  explicit ChangeVictoryMECommand(const std::optional<int>& indent, const nlohmann::ordered_json& parameters);
  ~ChangeVictoryMECommand() override = default;
  [[nodiscard]] EventCode code() const override { return EventCode::Change_Victory_ME; }
  void serializeParameters(nlohmann::ordered_json& out) const override;
  [[nodiscard]] std::string stringRep(const Database& db, bool colored = true) const override;
  std::shared_ptr<IEventCommand> clone() const override { return std::make_shared<ChangeVictoryMECommand>(*this); }
  bool hasStringReference(const std::string& text, SearchType type) override {
    if (type == SearchType::Audio) {
      return text.contains(me.name());
    }
    return false;
  };
  Audio me;
};


code:
#include "Database/EventCommands/ChangeWeapons.hpp"

#include "Database/Database.hpp"

ChangeWeaponsCommand::ChangeWeaponsCommand(const std::optional<int>& indent, const nlohmann::ordered_json& parameters)
: IEventCommand(indent) {
  parameters.at(0).get_to(item);
  parameters.at(1).get_to(operation);
  parameters.at(2).get_to(operandSource);
  parameters.at(3).get_to(operand);
  parameters.at(4).get_to(includeEquipment);
}

void ChangeWeaponsCommand::serializeParameters(nlohmann::ordered_json& out) const {
  out.push_back(item);
  out.push_back(operation);
  out.push_back(operandSource);
  out.push_back(operand);
  out.push_back(includeEquipment);
}

std::string ChangeWeaponsCommand::stringRep(const Database& db, const bool colored) const {
  const auto var = db.system.variable(operand);
  std::string suffix;
  if (includeEquipment) {
    suffix = ColorFormatter::getColor(FormatColor::Gray, colored) + " " + db.parentheses(trNOOP("Include Equipment")) + ColorFormatter::popColor(colored);
  }

  return indentText(indent()) + symbol(code()) + ColorFormatter::getColorCode(code(), colored) + trNOOP("Change Weapons") + colon.data() + db.weaponNameOrId(item) + DecodeEnumName(operation) +
         (operandSource == QuantityChangeSource::Constant ? std::to_string(operand) : db.variableNameOrId(operand)) + ColorFormatter::popColor(colored) + suffix;
}


code:
#pragma once
#include "Database/EventCommands/IEventCommand.hpp"

struct ChangeWeaponsCommand final : IEventCommand {
  ChangeWeaponsCommand() = default;
  explicit ChangeWeaponsCommand(const std::optional<int>& indent, const nlohmann::ordered_json& parameters);

  ~ChangeWeaponsCommand() override = default;
  [[nodiscard]] EventCode code() const override { return EventCode::Change_Weapons; }
  void serializeParameters(nlohmann::ordered_json& out) const override;
  [[nodiscard]] std::string stringRep(const Database& db, bool colored = true) const override;
  std::shared_ptr<IEventCommand> clone() const override { return std::make_shared<ChangeWeaponsCommand>(*this); }
  bool hasReference(int targetId, SearchType type) override {
    if (type == SearchType::Variable) {
      return operandSource == QuantityChangeSource::Variable && operand == targetId;
    }
    if (type == SearchType::Weapons) {
      return targetId == item;
    }
    return false;
  };
  bool setReference(int targetId, int newId, SearchType type) override {
    if (hasReference(targetId, type)) {
      if (operandSource == QuantityChangeSource::Variable && operand == targetId) {
        operand = newId;
      } else if (type == SearchType::Weapons) {
        item = newId;
      }
      return true;
    }
    return false;
  }
  int item{1};
  QuantityChangeOp operation = QuantityChangeOp::_plu__del_Increase;
  QuantityChangeSource operandSource = QuantityChangeSource::Constant;
  int operand{1};
  bool includeEquipment{false};
};


code:
#include "Database/EventCommands/ChangeWindowColor.hpp"

ChangeWindowColorCommand::ChangeWindowColorCommand(const std::optional<int>& indent, const nlohmann::ordered_json& parameters)
: IEventCommand(indent) {
  auto colors = parameters.at(0);
  colors[0].get_to(r);
  colors[1].get_to(g);
  colors[2].get_to(b);
}

void ChangeWindowColorCommand::serializeParameters(nlohmann::ordered_json& out) const {
  auto colors = nlohmann::json();
  colors.push_back(r);
  colors.push_back(g);
  colors.push_back(b);
  out.push_back(colors);
}

std::string ChangeWindowColorCommand::stringRep(const Database& db, const bool colored) const {
  return indentText(indent()) + symbol(code()) + ColorFormatter::getColorCode(code(), colored) + trNOOP("Change Window Color") + colon.data() + std::format("({}, {}, {})", r, g, b) +
         ColorFormatter::popColor(colored);
}


code:
#pragma once
#include "Database/EventCommands/IEventCommand.hpp"
#include <format>

struct ChangeWindowColorCommand final : IEventCommand {
  ChangeWindowColorCommand() = default;
  explicit ChangeWindowColorCommand(const std::optional<int>& indent, const nlohmann::ordered_json& parameters);
  ~ChangeWindowColorCommand() override = default;
  [[nodiscard]] EventCode code() const override { return EventCode::Change_Window_Color; }
  void serializeParameters(nlohmann::ordered_json& out) const override;
  [[nodiscard]] std::string stringRep(const Database& db, bool colored = true) const override;
  std::shared_ptr<IEventCommand> clone() const override { return std::make_shared<ChangeWindowColorCommand>(*this); }

  int r = 255;
  int g = 255;
  int b = 255;
};


code:
#include "Database/EventCommands/Comment.hpp"

NextCommentCommand::NextCommentCommand(const std::optional<int>& indent, const nlohmann::ordered_json& parameters)
: IEventCommand(indent) {
  parameters.at(0).get_to(text);
}

void NextCommentCommand::serializeParameters(nlohmann::ordered_json& out) const { out.push_back(text); }

CommentCommand::CommentCommand(const std::optional<int>& indent, const nlohmann::ordered_json& parameters)
: IEventCommand(indent) {
  parameters.at(0).get_to(text);
}

void CommentCommand::serializeParameters(nlohmann::ordered_json& out) const { out.push_back(text); }

std::string CommentCommand::stringRep(const Database& db, const bool colored) const {
  const std::string_view Name = trNOOP("Comment");
  std::string ret = indentText(indent()) + symbol(code()) + ColorFormatter::getColorCode(code(), colored) + Name.data() + colon.data() + text + ColorFormatter::popColor(colored);
  for (const auto& t : nextComments) {
    if (!ret.empty()) {
      ret += "\n";
    }
    ret += indentText(indent()) + symbol(t->code()) + ColorFormatter::getColorCode(code(), colored) + std::string(Name.length(), ' ') + colon.data() + t->text + ColorFormatter::popColor(colored);
  }
  return ret;
}


code:
#pragma once
#include "Database/EventCommands/IEventCommand.hpp"

struct NextCommentCommand final : IEventCommand {
  NextCommentCommand() = default;
  explicit NextCommentCommand(const std::optional<int>& indent, const nlohmann::ordered_json& parameters);
  ~NextCommentCommand() override = default;
  [[nodiscard]] EventCode code() const override { return EventCode::Next_Comment; }
  void serializeParameters(nlohmann::ordered_json& out) const override;
  std::shared_ptr<IEventCommand> clone() const override { return std::make_shared<NextCommentCommand>(*this); }

  std::string text;
};

struct CommentCommand final : IEventCommand {
  CommentCommand() = default;
  explicit CommentCommand(const std::optional<int>& indent, const nlohmann::ordered_json& parameters);
  ~CommentCommand() override = default;
  std::shared_ptr<IEventCommand> clone() const override { return std::make_shared<CommentCommand>(*this); }

  [[nodiscard]] EventCode code() const override { return EventCode::Comment; }
  void serializeParameters(nlohmann::ordered_json& out) const override;
  void addText(NextCommentCommand* n) { nextComments.emplace_back(n); }

  std::string text;
  std::vector<std::shared_ptr<NextCommentCommand>> nextComments;
  [[nodiscard]] std::string stringRep(const Database& db, bool colored = true) const override;
};