"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
PluginPlushas been purchased andData\Plugin\Plugin.inihasPluginPlus = 1(see PluginPlus).Enabled="1"inData\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 withKindB = 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 (
BuffIndexinData\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.
- A worn fashion (
BuffIndex="0": no buff icon, only stats are added. Several items sharing the sameBuffIndexcompete 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>:
| Key | Value | Default | Meaning |
|---|---|---|---|
Enabled | 0 / 1 | 0 (when missing) | Turn the system off / on. |
MaxConcurrentUse | integer >= 1 | 1 | Number of items of different types that can be on at the same time. A value less than 1 is set to 1. |
ErrorMessage, ErrorMessage2 | string | - | Not used. The real text comes from Lang UseInventoryItem ID 0 and 1. |
Child element <Item>:
| Key | Value | Default | Meaning |
|---|---|---|---|
Cat | integer | 0 | Item group. |
Index | integer | 0 | Item ordinal number within the group. |
BuffIndex | integer >= 0 | 0 | Buff 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):
| Key | Value | Default | Meaning |
|---|---|---|---|
Type | 1 - 23 (table below) | 0 | Stat type. Values other than 1-23 (including 24) are skipped and an error is logged. |
Value | integer | 0 | Value added. |
Name | string | - | 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):
| Type | Name | Effect | Type | Name | Effect |
|---|---|---|---|---|---|
| 1 | HP | Max HP +Value | 13 | AttackSpeed | Normal + magic attack speed +Value |
| 2 | MP | Max MP +Value | 14 | CriticalRate | Critical damage rate +Value % |
| 3 | SD | Max SD +Value | 15 | ExcellentRate | Excellent damage rate +Value % |
| 4 | AG | Max AG +Value | 16 | DoubleDamageRate | Double damage rate +Value % |
| 5 | STR | Strength +Value | 17 | IgnoreDefenseRate | Ignore-defense rate +Value % |
| 6 | AGI | Agility +Value | 18 | DamageReduction | Damage reduction +Value % |
| 7 | VIT | Vitality +Value | 19 | ElementalDamage | Elemental damage (min + max) +Value |
| 8 | ENE | Energy +Value | 20 | ElementalDefense | Elemental defense +Value |
| 9 | CMD | Command +Value | 21 | SkillDamage | Skill damage +Value |
| 10 | Damage | Physical damage (min + max) +Value | 22 | CriticalDamage | Critical damage +Value |
| 11 | MagicDamage | Magic damage + curse +Value | 23 | ExcellentDamage | Excellent damage +Value |
| 12 | Defense | Defense +Value |
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>
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 / ID | Content (English version) | When |
|---|---|---|
UseInventoryItem 0 | Max allowed to use at the same time: %d | The MaxConcurrentUse limit is reached. |
UseInventoryItem 1 | You already have this item active | An item with the same code is already on. |
UseInventoryItem 2 | Right click in the inventory to use / stop using | Last tooltip line (gray). |
Fashion 20-42 | Names 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.