"Toggle" items sit in the inventory (for example statues, charms): the player right-clicks to turn it on (ON) and right-clicks again to turn it off (OFF). While on, the character shows a buff icon (BuffIndex) and gains the stats declared in <Option>. No declaration in BuffTemplate.xml is needed.

Requirements

  • PluginPlus has been purchased and Data\Plugin\Plugin.ini has PluginPlus = 1 (see PluginPlus).
  • Enabled="1" in Data\Plugin\UseInventoryItem.xml.
  • The item must exist in Data\Item\ItemList.xml (if not, the row is skipped and an error is logged) and in the client's item list with KindB = 47 (inventory item), otherwise the client does not allow right-clicking.
  • The client uses a new Main.dll (the tooltip is sent by the server; no need to edit the client's tooltip files).

How it works

  • Several items of different types can be on at the same time, up to MaxConcurrentUse. Over the limit: Lang message ID 0 and the item is not turned on.
  • The same item code (Cat/Index) can only be turned on once; turning on a second one reports Lang ID 1.
  • The buff is permanent while the item is on, and is removed when it is turned off (or the item leaves the inventory).
  • A buff ID only takes effect once on a character:
    • A worn fashion (BuffIndex in Data\Plugin\Fashion\Fashion.xml) takes priority first, then items that are on, in inventory slot order. An item whose buff ID is already taken stays ON but gives no buff and no stats.
    • If the character already has a buff with the same ID from another source (for example the timed buff from a potion / scroll), the item gives no buff and no stats until that buff ends; after that, the permanent buff and stats are applied.
  • BuffIndex="0": no buff icon, only stats are added. Several items sharing the same BuffIndex compete according to the rule above.
  • An item that is on is also counted as "equipment" by the fixed-option system, see Fixed options (ItemOptionSystem_Exc).

Configuration

File: Data\Plugin\UseInventoryItem.xml. Root element <UseItemSystem>:

KeyValueDefaultMeaning
Enabled0 / 10 (when missing)Turn the system off / on.
MaxConcurrentUseinteger >= 11Number of items of different types that can be on at the same time. A value less than 1 is set to 1.
ErrorMessage, ErrorMessage2string-Not used. The real text comes from Lang UseInventoryItem ID 0 and 1.

Child element <Item>:

KeyValueDefaultMeaning
Catinteger0Item group.
Indexinteger0Item ordinal number within the group.
BuffIndexinteger >= 00Buff ID (according to the client's buff list) shown on the character while on; 0 = no icon.

Each <Item> has at most 8 <Option> rows (the 9th row onward is skipped):

KeyValueDefaultMeaning
Type1 - 23 (table below)0Stat type. Values other than 1-23 (including 24) are skipped and an error is logged.
Valueinteger0Value added.
Namestring-Only a comment, never read.

The Type table (shared with the Fashion.xml fashion system; the tooltip text comes from Lang section Fashion ID 20-42):

TypeNameEffectTypeNameEffect
1HPMax HP +Value13AttackSpeedNormal + magic attack speed +Value
2MPMax MP +Value14CriticalRateCritical damage rate +Value %
3SDMax SD +Value15ExcellentRateExcellent damage rate +Value %
4AGMax AG +Value16DoubleDamageRateDouble damage rate +Value %
5STRStrength +Value17IgnoreDefenseRateIgnore-defense rate +Value %
6AGIAgility +Value18DamageReductionDamage reduction +Value %
7VITVitality +Value19ElementalDamageElemental damage (min + max) +Value
8ENEEnergy +Value20ElementalDefenseElemental defense +Value
9CMDCommand +Value21SkillDamageSkill damage +Value
10DamagePhysical damage (min + max) +Value22CriticalDamageCritical damage +Value
11MagicDamageMagic damage + curse +Value23ExcellentDamageExcellent damage +Value
12DefenseDefense +Value
[TO VERIFY: the effect table for each Type is taken from the guide at the top of the XML file and the enum list in the code; each stat-calculation branch in Fashion::ApplyOptions has not been traced]

Example

<UseItemSystem Enabled="1" MaxConcurrentUse="1" ErrorMessage="..." ErrorMessage2="...">
	<Item Cat="19" Index="190" BuffIndex="122">
		<Option Type="14" Name="CriticalRate" Value="10" />
	</Item>
	<Item Cat="19" Index="194" BuffIndex="122">
		<Option Type="10" Name="Damage" Value="100" />
		<Option Type="11" Name="MagicDamage" Value="100" />
	</Item>
</UseItemSystem>
In the example above two items share BuffIndex="122": if both are turned on (this needs MaxConcurrentUse >= 2), the item that comes later in the inventory stays ON but gives no buff and no stats. Give each item its own BuffIndex.

Messages and tooltip (Lang)

Section / IDContent (English version)When
UseInventoryItem 0Max allowed to use at the same time: %dThe MaxConcurrentUse limit is reached.
UseInventoryItem 1You already have this item activeAn item with the same code is already on.
UseInventoryItem 2Right click in the inventory to use / stop usingLast tooltip line (gray).
Fashion 20-42Names of the option lines (for example Max HP +%d)Each stat line in the tooltip (light blue).

Reload

Press Reload plugin on the GameServer control panel: the server reloads the file and resends the tooltips to players who are online. Each time a player enters the game, the server also resends this list.