> For the complete documentation index, see [llms.txt](https://docs.ragnasync.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.ragnasync.com/event-logs/economy/refine-log.md).

# Refine Logs

Logs equipment refining attempts to Discord

The Refine Log feature tracks equipment refining attempts, including successes, failures, and downgrades. Perfect for celebrating those +10s or commiserating over broken gear.

## Action

`refine_log`

## When It's Used

This log is triggered when a player:

* **Successfully refines** equipment (refine level increases)
* **Fails a refine** (equipment breaks or refine fails)
* **Downgrades** equipment (refine level decreases)

## Why Use It

* **Celebrate lucky refines** with your community
* **Share the pain** of broken equipment
* **Track refine statistics** for your server
* **Monitor for refine exploits** or unusual patterns
* **Create engaging community moments**

## Server Configuration

In `conf/channels.conf`:

```
// Refine attempt logging
ragnasync_refine_log_enabled: true
ragnasync_refine_log_channel_id: "YOUR_CHANNEL_ID"
ragnasync_refine_log_min_level: 7
ragnasync_refine_log_group_min: 0
ragnasync_refine_log_group_max: 0
```

| Setting      | Description                               | Default |
| ------------ | ----------------------------------------- | ------- |
| `enabled`    | Enable/disable refine logging             | `false` |
| `channel_id` | Discord channel ID for refine logs        | -       |
| `min_level`  | Minimum refine level to log (0 = log all) | `0`     |
| `group_min`  | Minimum GM group level to log             | `0`     |
| `group_max`  | Maximum GM group level to log             | `99`    |

**Tip:** Set `min_level: 7` to only log high-refine attempts where the real excitement (and heartbreak) happens!

## Message Format

The default message shows the refine result with appropriate emoji:

```
✅ Refine [Success]:  | Knight           | Valkyrie Armor       +6 -> +7 | 100,000z
❌ Refine [Fail]:     | Mage             | Staff of Destruction +7 -> +0 | 200,000z
⬇️ Refine [Downgrade]: | Archer          | Composite Bow        +9 -> +8 | 150,000z
```

## Data Fields

| Field         | Type   | Description                               |
| ------------- | ------ | ----------------------------------------- |
| `player_name` | string | Character name                            |
| `item_name`   | string | Name of the item being refined            |
| `item_id`     | int    | Item database ID                          |
| `refine_from` | int    | Refine level before attempt               |
| `refine_to`   | int    | Refine level after attempt                |
| `result`      | string | Result: `success`, `fail`, or `downgrade` |
| `material_id` | int    | Refine material item ID                   |
| `zeny_cost`   | int    | Zeny cost of the refine                   |
| `account_id`  | int    | Player's account ID                       |
| `char_id`     | int    | Player's character ID                     |
| `channel`     | string | Discord channel ID                        |

## Example Use Cases

### Public Refine Channel

Share the excitement (and despair) of refining:

```
ragnasync_refine_log_channel_id: "1234567890"  // #refine-results
```

### High Refine Celebrations

Everyone can cheer when someone hits +10!

### RNG Tracking

Monitor refine success rates to ensure your server rates are working correctly.

### Economy Monitoring

Track zeny sink from refining attempts.

## Custom Messages

Want to customize how these messages look? Head to the **Message Routes** page on your dashboard, set the format to **Custom Message**, and compose your own template using `{{placeholder}}` syntax.

**Example template:**

```
:slot_machine: {{player_name}} went for +{{refine_to}} on {{item_name}}... {{result}}! ({{zeny_cost}}z)
```

**Available placeholders for this event:**

| Placeholder       | Example |
| ----------------- | ------- |
| `{{player_name}}` | Marky   |
| `{{item_name}}`   | Knife   |
| `{{item_id}}`     | 1201    |
| `{{refine_from}}` | 6       |
| `{{refine_to}}`   | 7       |
| `{{result}}`      | success |
| `{{zeny_cost}}`   | 10000   |

See [Message Routing](/ragnascript/message-routing.md) for more about formats, conditions, and multi-channel routing.

## Result Types

| Result      | Description       | What Happens                       |
| ----------- | ----------------- | ---------------------------------- |
| `success`   | Refine succeeded  | Level increases by 1               |
| `fail`      | Refine failed     | Equipment breaks (goes to +0)      |
| `downgrade` | Refine downgraded | Level decreases by 1 (safe refine) |

## Notes

* Each refine attempt is logged individually
* Material ID helps track which ores are being used
* Zeny cost is the amount charged by the NPC
* Great for creating community engagement around RNG moments
