Overview
Exchange lets you turn any NPC into an item exchange shop: players hand in items (and/or Zen, WCoin, Ruud, Goblin Point) to receive other items or currencies. There are 3 shop types:
- Type 1 - recipe list: each recipe is one row (items to hand in, reward, Exchange button). The items handed in are taken from the inventory.
- Type 2 - drag and drop: uses the game's "Regular Combination" window. The player drags items into an 8 x 4 cell grid and presses the button. It uses the same recipe file as Type 1; only the interface differs.
- Type 3 - combine / enhance: uses the "Elemental items refinement/combination" window: main item + sub item + materials, with a success rate, transferring Excellent options to the main item or raising its + level.
Every exchange is recorded in the exchange_log table (game database, created automatically by the GameServer) to compute limits on the number of times per day / in total, per character or per account. Rewards are given directly into the inventory: before taking anything, the server checks that there is enough room for all rewards; if not, it shows a dialog asking the player to free up space and takes nothing.
Requirements
- Not tied to any key in
Plugin.ini[Plugin]: the GameServer code does not checkFeature()for Exchange. Turn it on / off withEnableinData\Plugin\Exchange\ExchangeList.xml. - Client: a new
Main.dlland the interface files inData\Interface\GFx\:Exchange.ozg(Type 1),ExchangeMix.ozg(Type 2),ExchangeCombine.ozg(Type 3). No NPC model changes are needed. - To attach a shop to an NPC: in
Data\Monster\MonsterSpawn.xml, setNpcFunction="<shop Name>"on the NPC's<Spawn>line. The order when clicking an NPC: NPC script, then the fixed functions (npc_talk_warehouse...), then Exchange, then the regular shop (ShopList.xml). If a name is both an Exchange shop and a shop inData\Shops\ShopList.xml, Exchange is used and a warning is written to the log.
<Spawn Index="240" Distance="0" StartX="135" StartY="128" Dir="3" NpcFunction="exchange_jewel"/>
Folder structure
Path (inside Data\Plugin\Exchange\) | Content |
|---|---|
ExchangeList.xml | List of shops |
Scripts\Exchange_Jewel.xml, Exchange_WCoin.xml, Exchange_Exc.xml | Recipes for Type 1 / Type 2 shops |
Scripts\Exchange_Combine.xml | Combine list for Type 3 shops |
ItemBags\ | Item bag files used by the <GiveBag> tag (same bag format as in Data\ItemBags) |
In the XML files, do not write comments inside a tag.
ExchangeList.xml
| Tag / attribute | Value | Default | Meaning |
|---|---|---|---|
<ExchangeList> Enable | 0 / 1 | 1 | 0 = turn off all shops. |
<Exchange> Name | letters / digits / _, at most 32 characters, no ' character | empty (invalid) | Shop name = the NPC's NpcFunction. Each shop has its own name; an empty name, one longer than 32 characters, or a duplicate causes the shop to be skipped and an error to be written to the log. |
Title | text | empty | Window title. |
Type | 1 / 2 / 3 | 1 | Shop type (see the Overview). Other values are skipped and an error is logged. |
File | file name in Scripts\ | empty | Recipe file (Type 1 / 2) or combine file (Type 3). A shop with no valid recipe is skipped. |
Enable | 0 / 1 | 1 | 0 = turn off this shop only. |
StartDate / EndDate | YYYY-MM-DD HH:MM (server time) | unlimited | 0000-00-00 00:00 = unlimited. Outside this time range, clicking the NPC shows the dialog "This function is not open yet." / "This function has ended." and the window does not open; within the range, the window shows "Active time: start - end". |
<ExchangeList Enable="1">
<Exchange Name="exchange_jewel" Title="Jewel Exchange" Type="1" File="Exchange_Jewel.xml" StartDate="0000-00-00 00:00" EndDate="0000-00-00 00:00" Enable="1" />
<Exchange Name="exchange_exc" Title="Excellent Item Exchange" Type="2" File="Exchange_Exc.xml" StartDate="0000-00-00 00:00" EndDate="0000-00-00 00:00" Enable="1" />
<Exchange Name="exchange_combine" Title="Item Enhancement" Type="3" File="Exchange_Combine.xml" StartDate="0000-00-00 00:00" EndDate="0000-00-00 00:00" Enable="1" />
</ExchangeList>
Recipe file (Type 1 and Type 2)
Root tag <ExchangeScript Name="...">: Name is the line of text at the top of the Type 2 window (Type 1 does not use it). Inside are the <Recipe> tags.
<Recipe>
| Attribute | Value | Default | Meaning |
|---|---|---|---|
Id | number >= 1, one Id per recipe | 0 | Recipe ID within the file; the exchange_log table counts by this Id. |
Name | text | empty | Text of the row (and the recipe name in the Type 2 window). A recipe that uses item groups (with no picture) must have a name that clearly states its content. |
LimitDay | >= 0 | 0 | Number of times per day. 0 = no limit. |
LimitTotal | >= 0 | 0 | Total number of times. 0 = no limit. |
LimitBy | Character / Account | Character | Whether the limit is counted per character or per account. |
StartDate / EndDate | YYYY-MM-DD HH:MM | unlimited | Outside this time range the row is locked. |
LevelMin | >= 0 | 0 | Required total level (normal + master + majestic). |
ResetMin | >= 0 | 0 | Required number of resets. |
<Need> - items that must be handed in
There can be several <Need> tags; each exchange requires all of them. Type 1 takes from the inventory; Type 2 takes from the cells in the window (only items that are a Need of some recipe can be dropped in; recipes without a Need are skipped in Type 2). Items with an expiry time are never taken.
| Attribute | Value | Default | Meaning |
|---|---|---|---|
Cat, Index | number | -1 | A specific item (for example Cat="14" Index="13" = Jewel of Bless). Index="-1" = every item of group Cat. Cat="-1" = every item. |
CatMax | number | -1 | Together with Cat forms the group range Cat..CatMax (for example Cat="0" CatMax="11" = all weapons and armor). |
Level | -1 or 0 - 15 | -1 | -1 = any level (then LevelMin / LevelMax are used), otherwise exactly this level. |
LevelMin / LevelMax | 0 - 15 | 0 / 15 | Level range, used when Level="-1". |
Count | number >= 1 | 1 | Quantity (stackable items are counted one by one: 1 stack of 10 = 10). |
ExcMin | number >= 0 | 0 | Minimum number of Excellent option lines. 0 = any. |
Luck / Skill | -1 / 0 / 1 | -1 | -1 = any, 1 = must have, 0 = must not have. |
Ancient | -1 / 0 / 1 | -1 | -1 = any, 1 = must be an Ancient item, 0 = must not be. |
<NeedCost> and <GiveCost>
<NeedCost> = currency deducted, <GiveCost> = currency added, for ONE exchange. Attributes: Zen, WCoin, Ruud, GoblinPoint (number >= 0, default 0).
<Give> - items received (into the inventory)
| Attribute | Value | Default | Meaning |
|---|---|---|---|
Cat, Index | number | - | The item created. |
Level | 0 - 15 | 0 | + level. |
Count | number >= 1 | 1 | Quantity (stackable items: total quantity). |
Skill / Luck | 0 / 1 | 0 | Has skill / luck. |
Option | 0 - 7 | 0 | Additional option level. |
Exc | 0 - 255 (bits: 1 + 2 + 4 + 8 + 16 + 32; 63 = all 6 lines) | 0 | Excellent lines (same as in item bags). |
Ancient | 0 - 255 | 0 | Ancient type. |
Duration | seconds >= 0 | 0 | Usage time of the item. 0 = unlimited. |
Lock | 0 / 1 | 0 | 1 = the item is trade-locked (trade window, personal store, sending to the web); it can still be used as a material, dropped, sold, or stored in the warehouse. |
<GiveBag>
FileName: a bag file in Data\Plugin\Exchange\ItemBags\ (the Data\ItemBags bag format; the <DropAllow> tag chooses which character class receives which part). The window shows the items the character can receive.
<ExchangeScript>
<Recipe Id="3" Name="Jewel of Chaos + 1,000,000 Zen → Jewel of Life" LimitDay="5" LimitTotal="0" LimitBy="Character" StartDate="0000-00-00 00:00" EndDate="0000-00-00 00:00" LevelMin="0" ResetMin="0">
<Need Cat="12" Index="15" Level="-1" Count="1" ExcMin="0" Luck="-1" Skill="-1" Ancient="-1" />
<NeedCost Zen="1000000" WCoin="0" Ruud="0" GoblinPoint="0" />
<Give Cat="14" Index="16" Level="0" Count="1" Skill="0" Luck="0" Option="0" Exc="0" Ancient="0" Duration="0" />
</Recipe>
<Recipe Id="2" Name="20 Jewel of Soul → 500 Ruud" LimitDay="0" LimitTotal="0" LimitBy="Character" StartDate="0000-00-00 00:00" EndDate="0000-00-00 00:00" LevelMin="0" ResetMin="0">
<Need Cat="14" Index="14" Level="-1" Count="20" ExcMin="0" Luck="-1" Skill="-1" Ancient="-1" />
<GiveCost Zen="0" WCoin="0" Ruud="500" GoblinPoint="0" />
</Recipe>
</ExchangeScript>
Behavior specific to Type 2 (drag and drop)
When the button is pressed, the server checks the recipes from TOP to BOTTOM and performs each recipe AS MANY TIMES AS POSSIBLE according to the items in the cells (for example 90 stones in the cells and a recipe "30 stones → 1 item" gives 3 items). Leftover items stay in the cells; closing the window returns them. The top frame shows <ExchangeScript Name>, the middle frame shows the recipe names (gray; white with "Quantity: X" is the number of times it will be performed), and the bottom list is everything the player will receive.
Combine file (Type 3)
Root tag <ExchangeCombine Name="...">: Name is the guide page shown before a row is selected (scrollable when long). Text formatting commands: \n line break; [color=#ffaa00]text[/color] colored text; [center]text[/center] centered; [dot] the game's dot icon placed before a heading. Text with no color is shown in light gray (#ebebeb).
Each <Combine> tag is one row in the list on the left. The player selects a row, picks up an item from the inventory and clicks a cell to place it (right-click on a cell = take it back), then presses the Combine button. Closing the window (or leaving the game) returns all items to the inventory.
- "Required items": at most 4 cells in a row: the main item (
<Main>), the sub item (<Sub>, if any), then each<Material>in turn. At most 4 cells in total (withSub, 2 materials; withoutSub, 3). - "Optional items": 2 charm cells. Left = luck charm (
<LuckCharm>), right = protection charm (<ProtectCharm>). - The "Result" cell shows the main item after success. Under each cell it shows "have / need"; the bottom of the window shows the fee and the success rate.
<Combine>
| Attribute | Value | Default | Meaning |
|---|---|---|---|
Id | number >= 1, unique in the file | 0 | Row ID. An Id <= 0 or a duplicate causes the row to be skipped and an error to be logged. |
Name | text | empty | Text of the row. |
Action | ExcTransfer / LevelUp | ExcTransfer | ExcTransfer: randomly takes Lines Excellent lines of the sub item that the main item does NOT yet have and adds them to the main item (main A,B + sub A,C → main also gets C); refused when the sub item has no new lines or the main item already has all 6 lines. LevelUp: the + level of the main item increases by Levels (not above LevelMax). Other values are skipped and an error is logged. |
Lines | 1 - 6 | 1 | (ExcTransfer) number of Excellent lines added. |
Levels | 1 - 15 | 1 | (LevelUp) number of levels gained. |
LevelMax | 0 - 15 | 15 | (LevelUp) highest + level. |
Rate | 0 - 100 | 100 | Success rate (%). |
FailMain | 0 / 1 | 0 | 1 = the main item is LOST on failure, 0 = it is kept. |
FailSub | 0 / 1 | 1 | 1 = the sub item is lost on failure, 0 = it is kept. On success, the sub item is always consumed. |
Materials, charms and the fee are always consumed whether the attempt succeeds or fails.
<Main>, <Sub>, <Material>, <LuckCharm>, <ProtectCharm>
The item-selection attributes are the same as <Need> above (Cat, Index, CatMax, Level, LevelMin, LevelMax, ExcMin, Luck, Skill, Ancient), plus:
| Tag / attribute | Value | Default | Meaning |
|---|---|---|---|
<Sub> Same | 0 / 1 | 0 | 1 = the sub item must be of the SAME type as the main item. No <Sub> tag = the row has no sub item (only used for LevelUp). |
Count (or Durability) of Material / charm | number >= 1 | 1 | Quantity that cell requires (stackable items, for example 10 Jewel of Chaos); exactly that amount is consumed. |
<LuckCharm> AddRate | 0 - 100 | 0 | Additional success rate when the charm is in the cell (for example Talisman of Luck 14,53). |
<ProtectCharm> | - | - | When the charm is in the cell and the attempt fails, the MAIN item is not lost (FailMain is ignored); the sub item is still lost if FailSub="1" (for example Talisman of Chaos Assembly 14,96). |
Required | 0 / 1 | 0 | 1 = the charm cell must contain an item before Combine can be pressed. It is enough for one tag of the cell to set 1 for the cell to be mandatory. |
Several <LuckCharm> (or <ProtectCharm>) tags = the cell accepts ANY of those items (each tag has its own Count / AddRate). Removing all tags of a charm cell = that cell is hidden.
<Cost> and <ExcLine>
<Cost Zen WCoin Ruud GoblinPoint/>: fee per attempt.<ExcLine Line Rate Zen WCoin Ruud GoblinPoint/>(ExcTransferonly, optional, one tag per line count):Line1 - 6 is the ordinal number of Excellent lines the main item will have after this attempt (if it currently has 2 lines and a 3rd line is added,Line="3").Ratereplaces theRateof<Combine>(not declared = use theRateof<Combine>). If any fee attribute (Zen/WCoin/Ruud/GoblinPoint) is present, that fee replaces<Cost>. Line counts without an<ExcLine>use theRateand<Cost>of<Combine>. TheAddRateof the luck charm is added on top.
<ExchangeCombine Name="[center][color=#ffaa00]You can combine by selecting the menu on the left.[/color][/center]">
<Combine Id="1" Name="Enhance Excellent Item" Action="ExcTransfer" Lines="1" Rate="60" FailMain="1" FailSub="1">
<Main Cat="0" CatMax="11" Index="-1" Level="-1" LevelMin="0" LevelMax="15" ExcMin="2" Luck="-1" Skill="-1" Ancient="-1" />
<Sub Same="1" Cat="0" CatMax="11" Index="-1" Level="-1" LevelMin="0" LevelMax="15" ExcMin="2" Luck="-1" Skill="-1" Ancient="-1" />
<LuckCharm Cat="14" Index="53" Level="-1" ExcMin="0" Luck="-1" Skill="-1" Ancient="-1" AddRate="10" Required="0" />
<ProtectCharm Cat="14" Index="96" Level="-1" ExcMin="0" Luck="-1" Skill="-1" Ancient="-1" Required="0" />
<Cost Zen="10000000" WCoin="0" Ruud="0" GoblinPoint="0" />
<ExcLine Line="1" Rate="80" Zen="5000000" WCoin="0" Ruud="0" GoblinPoint="0" />
<ExcLine Line="2" Rate="70" Zen="10000000" WCoin="0" Ruud="0" GoblinPoint="0" />
</Combine>
</ExchangeCombine>
Messages (Lang)
The window text comes from Data\Lang, group Type="51" named "Exchange" (ID 1 - 50). Some commonly seen IDs:
- ID 1 - 2 "Exchange", ID 3 "Fee: %s", ID 4 "Today %d / %d", ID 5 "Used %d / %d", ID 6 "Starts %s", ID 7 "Ended", ID 8 "Requires level %d", ID 9 "Requires reset %d", ID 10 "Limit reached", ID 11 "Not enough items".
- ID 14 "[Exchange] %s - done.", ID 16 "You are too far from the NPC.", ID 20 "[Exchange] %d exchange(s) done."
- Type 3: ID 24 - 32 (refusal reasons), ID 33 - 39 (window labels), ID 40 "[Combine] %s - success!", ID 41 "[Combine] %s - failed.", ID 46 - 50 (cell tooltips).
- ID 42 "This function is not open yet.", ID 43 "This function has ended.", ID 44 "Active time: %s - %s".
- The dialog for no inventory room uses
Data\Langgroup 10, ID 37 "Not enough room in the inventory. Please rearrange your inventory."
Reloading the configuration
Press the Reload plugin button on the GameServer panel: it reloads ExchangeList.xml and every file in Scripts\. Configuration errors (shop name, Type, Action, empty recipe...) are written to the GameServer log with the prefix [Exchange].