Skip to content

Commit

Permalink
Some fixes and prepping for release
Browse files Browse the repository at this point in the history
  • Loading branch information
onimitch committed Dec 21, 2023
1 parent 3645a6f commit c0f3fe7
Show file tree
Hide file tree
Showing 12 changed files with 122 additions and 47 deletions.
30 changes: 18 additions & 12 deletions Balloon.lua
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
addon.name = 'Balloon'
addon.name = 'balloon'
addon.author = 'Originally by Hando, English support added by Yuki & Kenshi, themes added by Ghosty, ported to Ashita v4 by onimitch.'
addon.version = '4.0'
addon.desc = 'Displays NPC chat logs in a UI Balloon, similar to FFXIV.'
Expand Down Expand Up @@ -27,7 +27,7 @@ local chat_modes = defines.chat_modes
local chat_color_codes = defines.chat_color_codes

local balloon = {
debug = 'chunk',
debug = 'off',
waiting_to_close = false,
close_timer = 0,
last_text = '',
Expand Down Expand Up @@ -380,7 +380,7 @@ local function print_help(isError)
{ '/balloon theme <theme>', 'Loads the specified theme.' },
{ '/balloon scale <scale>', 'Scales the size of the balloon by a decimal (eg: 1.5).' },
{ '/balloon delay <seconds>', 'Delay before closing promptless balloons.' },
{ '/balloon text_speed <chars>', 'Speed that text is displayed, in characters per frame.' },
{ '/balloon text_speed <chars per second>', 'Speed that text is displayed, in characters per second.' },
{ '/balloon portrait', 'Toggle the display of character portraits, if the theme has settings for them.' },
{ '/balloon move_closes', 'Toggle balloon auto-close on player movement.' },
{ '/balloon test <name> <lang> <mode>', 'Display a test bubble. Lang: - (auto), en or ja. Mode: 1 (dialogue), 2 (system). "/balloon test" to see the list of available tests.' },
Expand Down Expand Up @@ -683,11 +683,11 @@ ashita.events.register('d3d_present', 'balloon_d3d_present', function()
end)

ashita.events.register('mouse', 'balloon_mouse', function (e)
if ui:hidden() then
return
end

if e.message == defines.MOUSE_DOWN then
if ui:hidden() then
return
end

local ui_x, ui_y = ui:position()
local w, h = ui:window_size()
local mouse_x, mouse_y = e.x, e.y
Expand All @@ -703,18 +703,24 @@ ashita.events.register('mouse', 'balloon_mouse', function (e)
end
elseif balloon.drag_offset ~= nil then
e.blocked = true
if e.message == defines.MOUSE_UP then
ui:position(e.x + balloon.drag_offset[1], e.y + balloon.drag_offset[2], true)

local new_position = {
e.x + balloon.drag_offset[1],
e.y + balloon.drag_offset[2],
}

if e.message == defines.MOUSE_UP or ui:hidden() then
ui:position(new_position[1], new_position[2], true)

-- Convert to center anchor for saving to settings
local w, h = ui:window_size()
balloon.settings.position.x = balloon.drag_offset[1] + w / 2
balloon.settings.position.y = balloon.drag_offset[2] + h / 2
balloon.settings.position.x = new_position[1] + w / 2
balloon.settings.position.y = new_position[2] + h / 2
settings.save()

balloon.drag_offset = nil
else
ui:position(e.x + balloon.drag_offset[1], e.y + balloon.drag_offset[2], true)
ui:position(new_position[1], new_position[2], true)
end
end
end)
Binary file added Example-default.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added Example-ffvii-r.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added Example-ffxi.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added Example-snes-ff.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 1 addition & 1 deletion defaults.lua
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ require('common')
local defaults = T{}

defaults.display_mode = 2
defaults.move_close = false
defaults.move_close = true
defaults.no_prompt_close_delay = 10
defaults.text_speed = 100
defaults.theme = 'default'
Expand Down
2 changes: 1 addition & 1 deletion gdifonts
95 changes: 90 additions & 5 deletions readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,18 +2,103 @@

This is an [Ashita v4](https://github.com/AshitaXI/Ashita-v4beta) port of the Balloon addon, forked from [StarlitGhost's version](https://github.com/StarlitGhost/Balloon).

The original Windower Balloon addon was created by Hando and modified by Yuki and Ghosty.
The original Windower Balloon addon was created by Hando and modified by Kenshi, Yuki and Ghosty.

This Ashita v4 port was created by onimitch.

## Features
![Example default](https://github.com/onimitch/ffxi-balloon-ashitav4/blob/main/Example-default.png "Example default")

todo
## How to install:
1. Download the latest Release from the [Releases page](https://github.com/onimitch/ffxi-balloon-ashitav4/releases)
2. Extract the **_balloon_** folder to your **_Ashita4/addons_** folder

## Install
## How to enable it in-game:
1. Login to your character in FFXI
2. Type `/addon load balloon`

## How to have Ashita load it automatically:
1. Go to your Ashita v4 folder
2. Open the file **_Ashita4/scripts/default.txt_**
3. Add `/addon load balloon` to the list of addons to load under "Load Plugins and Addons"

## Commands

You can use `/balloon` or `/bl`

`/balloon 0` - Hide balloon & display npc text in game log window.

`/balloon 1` - Show balloon & hide npc text from game log window.

`/balloon 2` - Show balloon & display npc text in game log window.

`/balloon reset` - Reset all settings back to default.

`/balloon theme <theme>` - Switch theme (see below for info on Themes).

`/balloon scale <scale>` - Scales the size of the balloon by a decimal (eg: 1.5).

`/balloon delay <seconds>` - Delay before closing promptless balloons.

`/balloon text_speed <chars per second>` - Speed that text is displayed, in characters per second. Set to 0 to disable.

`/balloon portrait` - Toggle the display of character portraits, if the theme has settings for them.

`/balloon move_closes` - Toggle balloon auto-close on player movement.

`/balloon test <name> <lang> <mode>` - Display a test bubble. Lang: "-" (auto), "en" or "ja". Mode: 1 (dialogue), 2 (system).

`/balloon test` - List all available tests.

## Themes

There are currently four themes bundled with the addon.

### default

![Example default](https://github.com/onimitch/ffxi-balloon-ashitav4/blob/main/Example-default.png "Example default")

### ffvii-r

Requires "Libre Franklin Medium" or "Libre Franklin Regular" font, which you can get free from [Google Fonts](https://fonts.google.com/specimen/Libre+Franklin).

![Example ffvii-r](https://github.com/onimitch/ffxi-balloon-ashitav4/blob/main/Example-ffvii-r.png "Example ffvii-r")

### ffxi

![Example ffxi](https://github.com/onimitch/ffxi-balloon-ashitav4/blob/main/Example-ffxi.png "Example ffxi")

### snes-ff

Uses DotGothic16 font, which you can get free from [Google Fonts](https://fonts.google.com/specimen/DotGothic16).
Alternatively you can use DePixel font, which you can get free from [Be Fonts](https://befonts.com/depixel-font-family.html).

![Example snes-ff](https://github.com/onimitch/ffxi-balloon-ashitav4/blob/main/Example-snes-ff.png "Example snes-ff")

## Theme customisation

If you want to customise a theme, copy one of the existing themes from `addons/balloon/themes` into `config/addons/balloon/themes`.

Example: `config/addons/balloon/themes/my_theme`.

In game switch to your new theme: `/balloon theme my_theme`.

Edit the theme.xml file as you wish, or replace the pngs with alternatives. Sorry there isn't any more help on this for now but hopefully the existing themes are enough to figure out how it works.

Reload the theme by using: `/balloon theme my_theme`.

See your changes immediately by using one of the test prompts:

e.g: `/balloon test bahamut` or `/balloon test colors`.

todo

## Issues/Support

I only have limited time available to offer support, but if you have a problem, have discovered a bug or want to request a feature, please [create an issue on GitHub](https://github.com/onimitch/ffxi-balloon-ashitav4/issues).

## Gdifonts

This addon uses a custom fork of ThornyXI's gdifonts and gdifonttextures, in order to support colored regions and clipping:

https://github.com/onimitch/gdifonts/tree/regions

https://github.com/onimitch/gdifonttexture/tree/regions
32 changes: 8 additions & 24 deletions tests.lua
Original file line number Diff line number Diff line change
Expand Up @@ -7,23 +7,16 @@ local tests = T{}

tests.short = {
'Test',
'Can I look after an item?',
'Can I look after an item?',
'アイテムを預けるクポ?',
}

tests.std = {
'Test',
'TODO',
[[モーグリの応援、
ちゃんと届いているクポ? 今、モグハウスは
弱い雷の力で満たされているクポ!]],
}

tests.item = {
'Test',
'TODO',
[[池から]] .. cc.item .. [[魚籠【堀ブナ】]] .. cc.standard ..
[[を、畑で]] .. cc.item .. [[ナットベイン]] .. cc.standard ..
'Moogle',
[[Please get me an ]] .. cc.item .. [[Orange Juice]] .. cc.standard ..
[[ and some ]] .. cc.item .. [[Apple Pie]] .. cc.standard,
[[池から]] .. cc.item .. [[魚籠【堀ブナ】]] .. cc.standard ..
[[を、畑で]] .. cc.item .. [[ナットベイン]] .. cc.standard ..
[[]] .. cc.item .. [[デーツ]] .. cc.standard .. [[を用意してほしいクポ!]],
}

Expand All @@ -48,23 +41,14 @@ tests.colors = {

tests.long = {
'Test',
'TODO',
"Selh'teus proved that to us ten thousand years ago. Destruction is your destiny. You cannot escape what has already been decided.",
[[お前のバッグ、
ゴブリンたちより、ずっと大きい。
それも当然、お前は伝説のゴウツバクリだからだ。
それでも足りない。それこそが伝説……。]],
}

tests.long2 = {
'Test',
'TODO',
[[……なぁんて、な。
ガラでもねぇか、ヘヘッ。
じゃあ、さっそくつけ始めてくれ。
遅くとも夜中の1時ごろまでにはつけ終えてくれよ。]],
}

tests.baha = {
tests.bahamut = {
'Bahamut',
"Selh'teus proved that to us ten thousand years ago. Destruction is your destiny. You cannot escape what has already been decided.",
[[……なぁんて、な。
Expand Down
2 changes: 1 addition & 1 deletion themes/ffvii-r/theme.xml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
<Height>2</Height>
<OffsetX>8</OffsetX>
<OffsetY>-1</OffsetY>
<TextOffsetX>2</TextOffsetX>
<TextOffsetX>5</TextOffsetX>
<TextOffsetY>-23</TextOffsetY>
<Color>
<Alpha>255</Alpha>
Expand Down
4 changes: 2 additions & 2 deletions themes/ffxi/theme.xml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
<Height>43</Height>
<OffsetX>-8</OffsetX>
<OffsetY>-18</OffsetY>
<TextOffsetX>30</TextOffsetX>
<TextOffsetX>40</TextOffsetX>
<TextOffsetY>-13</TextOffsetY>
<Color>
<Alpha>255</Alpha>
Expand All @@ -26,7 +26,7 @@
</NpcName>
<Message>
<FontEnglish>Segoe UI, Calibri, Cambria</FontEnglish>
<FontJapanese>Noto Sans JP, Meiryo</FontJapanese>
<FontJapanese>Meiryo</FontJapanese>
<Size>10</Size>
<MaxLength>81</MaxLength>
<Width>610</Width>
Expand Down
2 changes: 1 addition & 1 deletion themes/snes-ff/theme.xml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
<Height>43</Height>
<OffsetX>15</OffsetX>
<OffsetY>-30</OffsetY>
<TextOffsetX>20</TextOffsetX>
<TextOffsetX>30</TextOffsetX>
<TextOffsetY>-24</TextOffsetY>
<Color>
<Alpha>255</Alpha>
Expand Down

0 comments on commit c0f3fe7

Please sign in to comment.