Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
67 changes: 67 additions & 0 deletions libraries/pet/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@
# Pet

Provides information about the player's pet.

## `pet`
This table mostly contains simple/self explanatory information about the player's currently active pet, if any.
- **index**
- **id**
- **name**
- **owner_index**
- **owner_id**
- **target_id**
- **hp_percent** (current/max values not available, except for the player's automaton in `pet.automaton`)
- **mp_percent** (current/max values not available, except for the player's automaton in `pet.automaton`)
- **tp**
- **active** true if the player has a pet out

## `pet.automaton`
This table holds more complex data describing the player's puppetmaster automaton.
- **name**
- **hp**
- **hp_max**
- **mp**
- **mp_max**
- **active** true if the player's currently active pet appears to be their automaton
- **head**
- **raw**: unmodified value
- **item_id**: `raw` + 0x2000
- **item**: Item information from `client_data.items`
- **frame**
- **raw**: unmodified value
- **item_id**: `raw` + 0x2000
- **item**: Item information from `client_data.items`
- **attachments**: Arrays from 0 to 11 of the following type:
- **raw**: unmodified value
- **item_id**: `raw` + 0x2100
- **item**: Item information from `client_data``
- **available_heads[i]**: Original index. Offset from `item_id` by 0x2000, starting at `harlequin_head == 1` (no `0`).
- **available_frames[i]**: Original index. Offset from `item_id` by 0x2020, starting at `harlequin_frame == 0`.
- **available_attach[i]**: Original index. Offset from `item_id` by 0x2100, starting at `strobe == 1` (no `0`).
- **heads_available[item_id]** Modified index to accept `item_id`.
- **frames_available[item_id]** Modified index to accept `item_id`.
- **attach_available[item_id]** Modified index to accept `item_id`.
Automaton's current skill values
- **melee**
- **ranged**
- **magic**
Automaton's skill caps
- **melee_max**
- **magic_max**
- **ranged_max**
Automaton's base stats
- **str**
- **dex**
- **vit**
- **agi**
- **int**
- **mnd**
- **chr**
Automaton's current stat modifiers
- **str_modifier**
- **dex_modifier**
- **vit_modifier**
- **agi_modifier**
- **int_modifier**
- **mnd_modifier**
- **chr_modifier**
11 changes: 11 additions & 0 deletions libraries/pet/manifest.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
<package>
<name>pet</name>
<version>1.0</version>
<type>library</type>
<dependencies>
<dependency>client_data</dependency>
<dependency>entities</dependency>
<dependency>pet_service</dependency>
<dependency>shared</dependency>
</dependencies>
</package>
77 changes: 77 additions & 0 deletions libraries/pet/pet.lua
Original file line number Diff line number Diff line change
@@ -0,0 +1,77 @@
local client = require('shared.client')
local entities = require('entities')
local items = require('client_data.items')

local data, ftype = client.new('pet_service')



ftype.fields.target_entity = {
get = function(data)
return entities:by_id(data.target_id)
end,
}


ftype.fields.automaton.type.fields.attachments.type.base.fields.item = {
get = function(data)
return items[data.item_id]
end,
}

ftype.fields.automaton.type.fields.heads_available = {
get = function(data)
return setmetatable({}, {
__index = function(t, k)
return data.available_heads[k - 0x2000]
end,
})
end,
}

ftype.fields.automaton.type.fields.frames_available = {
get = function(data)
return setmetatable({}, {
__index = function(t, k)
return data.available_frames[k - 0x2020]
end,
})
end,
}

ftype.fields.automaton.type.fields.attach_available = {
get = function(data)
return setmetatable({}, {
__index = function(t, k)
return data.available_attach[k - 0x2100]
end,
})
end,
}

return data

--[[
Copyright © 2020, John S Hobart
All rights reserved.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are met:
* Redistributions of source code must retain the above copyright
notice, this list of conditions and the following disclaimer.
* Redistributions in binary form must reproduce the above copyright
notice, this list of conditions and the following disclaimer in the
documentation and/or other materials provided with the distribution.
* Neither the name of the Windower Dev Team nor the
names of its contributors may be used to endorse or promote products
derived from this software without specific prior written permission.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
DISCLAIMED. IN NO EVENT SHALL THE WINDOWER DEV TEAM BE LIABLE FOR ANY
DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
]]